PDA

View Full Version : Google Highlight Hack


Nutz
14 Mar 2006, 13:47
Google Highlight Hack

Description
This is a simple hack that highlights keywords searched for when the user uses Google, like the Google catch system. E.g. http://72.14.203.104/search?q=cache:vtK0RVQXCx8J:news.bbc.co.uk/+bbc+news&hl=en&gl=uk&ct=clnk&cd=1

Details

1 Product


Notes
This is adapted from Cal Henderson[http://code.iamcal.com] highlighter code to work with vBulletin
Once some one installs this on a Google searched board I will post an example of the hack at work.

History
1.0
Initial Version

Last Words
I hope you enjoy the hack!
And don't forget to click install please :)

http://www.vbulletin.org/forum/images/smoothblue/buttons/installed.gif
(http://www.vbulletin.org/forum/vborg_miscactions.php?do=installhack&threadid=110342)
Thanks,
Mat

Corriewf
14 Mar 2006, 14:35
Cool! GOOD JOB!

Robru
14 Mar 2006, 15:02
Thanks, *click install* :)

Floris
14 Mar 2006, 15:07
nutz, very cool! thanks for sharing :)

Nutz
14 Mar 2006, 15:52
Thnaks :)

Thanks,
Mat

The Realist
14 Mar 2006, 17:40
Installed but dont highlight for me?

georgedd
14 Mar 2006, 17:42
I just installed and activated the product on CodingForums (http://www.codingforums.com/), though somehow can't get it to work. I don't see any references to google.js inside the source code of the thread pages either. How can I verify whether the product is installed correctly? In the CP everything looks to be in order, and the product is listed as active.

thanks!

Nutz
14 Mar 2006, 17:49
Sorry about that wrong hook location :D
You can reinstall the product or change the hook location your self to 'global_complete' :)

Thanks,
Mat

georgedd
14 Mar 2006, 18:22
Thanks, though I think there's still a bug, as the "onload="init_google()" code still doesn't appear on showthread.php pages. I'm guessing because you're only replacing "<body>" verbatim with the new code, whereas in showthread.php, the code is "<body onload="">"

Anyhow, it might be easier just to release this as a standonly JavaScript :)

Ziki
14 Mar 2006, 18:41
I think the plugin just uses the bold/strenght tags or am I wrong?

Milad
04 Apr 2006, 02:00
It doesn't highlight the arabic words

try http://www.google.com/search?as_q=%D8%A8%D8%B4%D8%B1%D9%8A+%D8%AD%D9%84%D8%A8&num=10&hs=V2t&hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=basharialep.com&as_rights=&safe=images

Nutz
06 Apr 2006, 00:38
It doesn't highlight the arabic words

try http://www.google.com/search?as_q=%D8%A8%D8%B4%D8%B1%D9%8A+%D8%AD%D9%84%D8%A8&num=10&hs=V2t&hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=basharialep.com&as_rights=&safe=images
Sorry can't help you there :(

Thanks,
Mat

SaN-DeeP
06 Apr 2006, 04:37
the plugin wont work globally.. anyone had success ?

TECK
25 Apr 2006, 08:56
Cool find, Nutz. :)
There is no need to use hooks for this, it's more like a template mod.
Open google.js and add this line at the end of the file:
window.onload = init_google;

Then open your headinclude template and add this line:
<script type="text/javascript" src="clientscript/google.js"></script>

I never liked to use body onload= atributes... ;)
Now, the onload function should load your code only after the hole page is fully loaded... and some of us find this bad.
If you want to complicate your life, you could simply create a script that will make sure it loads the javascript code, before the page is loaded.

For example:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


This was done off my mind, not tested, so feel free to play with it.