View Full Version : Google Highlight Hack
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 :)
https://vborg.vbsupport.ru/
(https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=110342)
Thanks,
Mat
Corriewf
03-14-2006, 12:35 PM
Cool! GOOD JOB!
Robru
03-14-2006, 01:02 PM
Thanks, *click install* :)
Floris
03-14-2006, 01:07 PM
nutz, very cool! thanks for sharing :)
The Realist
03-14-2006, 03:40 PM
Installed but dont highlight for me?
georgedd
03-14-2006, 03:42 PM
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!
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
03-14-2006, 04:22 PM
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 :)
I think the plugin just uses the bold/strenght tags or am I wrong?
Milad
04-04-2006, 12:00 AM
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
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
04-06-2006, 02:37 AM
the plugin wont work globally.. anyone had success ?
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:
function init_google()
{
// Avoid statement ‘Element Ready’ to be displayed twice
if (arguments.callee.done)
{
return;
}
arguments.callee.done = true;
var pattern = /google\./i;
if (pattern.exec(document.referrer) != null)
{
var url_parts = document.referrer.split('?');
if (url_parts[1])
{
var url_args = url_parts[1].split('&');
for(var i = 0; i < url_args.length; i++)
{
var keyval = url_args[i].split('=');
if (keyval[0] == 'q')
{
go_google(decode_url(keyval[1]));
return;
}
}
}
}
}
if (document.addEventListener)
{
document.addEventListener('DOMContentLoaded', init_google, null);
}
else
{
addLoadEvent(init_google);
}
window.onload = init_google;
This was done off my mind, not tested, so feel free to play with it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.