This module currently takes advantage of the option to show search results on your own page, via a Javascript snippet. There is no option to change this. That's especially unfortunate because it requires Javascript support and does not gracefully degrade, so without Javascript enabled, you're left with a non-functioning search page for no visible reason.

Could a future version please add an option to toggle between "Direct users to results page on Google" and "Show results on your site (requires Javascript)"?

-----

Also, could there be some addition that makes it gracefully degrade?

Let's say, a text that says "Javascript required to display search results - click [link] to get results at Google". Where [link] is the URL that the user would be directed to if the "search results on own site" option were disabled. This text would be displayed initially and set to display:none with a Javascript call - so it would only show up when Javascript doesn't work.

If other people would like this too, I may try to make a patch for it myself, but I haven't yet looked at the module's code.

Comments

mfb’s picture

I can put this on my list of things to look in to but a patch would be helpful.

cburschka’s picture

Status: Active » Needs review
StatusFileSize
new4.76 KB

First version of a patch. This one adds the ability to toggle between showing the results at Google and showing it on the search/google path.

No graceful degradation yet, though, and I think there are probably some bugs I haven't yet noticed. But it's worked for me with some superficial testing.

Oh, I turned two links into placeholders in the form field descriptions, but I don't know if doing this is standard. Otherwise, I'll leave out that change in the next version of the patch.

mfb’s picture

As far as I've read in the handbook, the links should not be placeholders. I originally had them as placeholders and already changed them back.

cburschka’s picture

StatusFileSize
new5.64 KB

Okay, here's the new patch. I've reverted the changes to the links (didn't see the note in the handbook), and also put in the bit that graceful degradation.

The search results page will now display this text to non-Javascript users: "Your browser is not executing JavaScript. You will need to view the results at [Google] or enable JavaScript to view them here." [Google] links to the corresponding results page on Google. This text isn't displayed when Javascript works.

Ideally, the form might change its action parameter automatically so users without Javascript get taken to the Google page right away, but as it is now (having to click an extra link), I guess it's fine too.

(This patch is rolled against the current CVS HEAD)

cburschka’s picture

StatusFileSize
new7.66 KB

Whoops - I didn't realize that by changing the name of the query field, all the styling (width and watermark) didn't work anymore. That's fixed now. This required changing the js file as well, so the new patch affects multiple files.

This patch is supposed to be applied from within the google_cse folder.

mfb’s picture

Status: Needs review » Fixed

Finally applied. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)