Jump to content

Topic on Extension talk:GoogleCustomWikiSearch/Flow

Rudloff (talkcontribs)

Hello,

It seems the extension does not work anymore (it just suddenly stopped working on one of my wikis).

I get this error in the browser console:

too much recursion[En savoir plus] www.archi-wiki.org:143:1
	gcseCallback https://www.archi-wiki.org/:143:1
	ak https://www.google.com/cse/static/element/ef505fd519591213/cse_element__fr.js:431:850
	<anonyme> https://www.google.com/cse/static/element/ef505fd519591213/cse_element__fr.js:437:268
	gcseCallback https://www.archi-wiki.org/:144:10
	ak https://www.google.com/cse/static/element/ef505fd519591213/cse_element__fr.js:431:850
	<anonyme> https://www.google.com/cse/static/element/ef505fd519591213/cse_element__fr.js:437:268
	gcseCallback https://www.archi-wiki.org/:144:10
	ak https://www.google.com/cse/static/element/ef505fd519591213/cse_element__fr.js:431:850
	<anonyme> https://www.google.com/cse/static/element/ef505fd519591213/cse_element__fr.js:437:268
...

It seems gcseCallback is calling itself too many times.

This workaround seems to make it work again:

diff --git a/GoogleCustomWikiSearch.class.php b/GoogleCustomWikiSearch.class.php
index a519217..3fe0b06 100644
--- a/GoogleCustomWikiSearch.class.php
+++ b/GoogleCustomWikiSearch.class.php
@@ -166,8 +166,6 @@ END;
                $term = $this->getTermEncoded();
                return <<<END
 function gcseCallback() {
-       if (document.readyState != 'complete')
-               return google.setOnLoadCallback(gcseCallback, true);
        google.search.cse.element.render({gname:'gcws', div:'cse', {$this->getSearchDisplayOption()}});
        var element = google.search.cse.element.getElement('gcws');
        element.execute( {$term} );

(I am not sure this is the best way to fix it though.)