vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Google Highlight Hack (https://vborg.vbsupport.ru/showthread.php?t=110342)

Nutz 03-13-2006 10:00 PM

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:...k&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/

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 :)

Nutz 03-14-2006 01:52 PM

Thnaks :)

Thanks,
Mat

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, 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 03-14-2006 03:49 PM

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 :)

Ziki 03-14-2006 04:41 PM

I think the plugin just uses the bold/strenght tags or am I wrong?

Milad 04-03-2006 11:00 PM

It doesn't highlight the arabic words

try http://www.google.com/search?as_q=%D...s=&safe=images

Nutz 04-05-2006 09:38 PM

Quote:

Originally Posted by Milad
It doesn't highlight the arabic words

try http://www.google.com/search?as_q=%D...s=&safe=images

Sorry can't help you there :(

Thanks,
Mat

SaN-DeeP 04-06-2006 01:37 AM

the plugin wont work globally.. anyone had success ?

TECK 04-25-2006 05:56 AM

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:

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.


All times are GMT. The time now is 04:40 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01645 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete