jscher2000 Author

For what it's worth, I use the copy/paste method. For the kind of changes I make, Github would be overkill. (Also, I'm hosting nearly all of the same scripts on Greasyfork, which has version comparison so I can use that for reference.)


One thing that might make this script more convenient for use on FB is a MutationObserver to watch for and modify new newsfeed content as it automatically loads into the page (usually triggered by scrolling). Or perhaps it could be on a timer with setInterval() if the performance is acceptable.



Oh, you use it with www? That's an important detail because line 62 did not allow for that. Please see the updated version, 0.7.1.




You could try this script:

https://openuserjs.org/scripts/jscher2000/Google_SERP_Keyword_Highlighter

It's a bit rough due to various things Google does with its matching (singular/plural, synonyms, etc.).

If you don't actually want all your matches yellow, edit line 20 to

var yellowonly = false;

I didn't build a whole array of colors, so if you have a lot of query terms, a lot of them will be yellow anyway.

It's a start. Someone can take it over and improve on it.


By the way, the matches in the cite (green URL) and in the snippet below it are bolded by Google, so it's easy to inject a style rule into the page to highlight those bolded terms.

If you use Stylish / userContent.css:

div.g cite b, 
div.g span.st em {
    background-color: #ff0 !important;
}

If you prefer a userscript:

var r = "div.g cite b, div.g span.st em {background-color: #ff0 !important;}";
var s = document.createElement("style");
s.appendChild(document.createTextNode(r));
document.body.appendChild(s);

But real code would be required to highlight the matching words in the large headline, since Google does not mark those in any way.



How did you generate the screen shot? Is that what you have now? Add-on?




Where did you want your search terms to be highlighted:

  • search results page?
  • Google's cached copy of the page?
  • actual page when you follow a link to that result?

I updated the script to handle this. It works for me, hopefully it works for you! Thank you for bringing it to my attention.


This is caused by turning on one of the site's features: "Automatic highlighting: When results are clicked, highlight the search terms on the page"

That changes the URL of the result, so I'll need to write special logic to extract the true site address:

NORMAL:

<a 
href="https://www.jeffersonscher.com/gm/google-hit-hider/" 
id="title_1" 
name="title_1" 
onmouseover="window.status='https://www.jeffersonscher.com/gm/google-hit-hider/'; return true;" 
onmouseout="ws('');" 
onclick="tc(this);changeIxquickStarRatingImage(1,1,'#763B75','s/white/graphics/star_purple_fade.gif');return openResult('https://www.jeffersonscher.com/gm/google-hit-hider/', 'https://www.jeffersonscher.com/gm/google-hit-hider/', '');">
<span style="text-decoration: none;" class="result_url_heading">Google Hit Hider by Domain — Author's Site - jeffersonscher.com</span>
</a>

PROXIED:

<a 
href="https://ixquick-proxy.com/do/spg/highlight.pl?ah=1&l=english&cat=web&c=hf&q=%22google+hit+hider%22&rl=NONE&u=https:%2F%2Fwww.jeffersonscher.com%2Fgm%2Fgoogle-hit-hider%2F&rid=LFLOQRLMPLLK478GTYHSU&hlq=https%3A%2F%2Fstartpage.com%2Fdo%2Fsearch&mtcmd=process_search&mtlanguage=english&mtqid=LFLOQRLMPLLK478GTYHSU&mtrcount=&mtrl=NONE&mtabp=-1&mtt=air&mtcat=web&mtstartat=0&mtnj=0" 
id="title_1" 
name="title_1" 
target="_blank" 
onmouseover="window.status='https://www.jeffersonscher.com/gm/google-hit-hider/'; return true;" 
onmouseout="ws('');" 
onclick="tc(this);changeIxquickStarRatingImage(1,1,'#763B75','s/white/graphics/star_purple_fade.gif');return openResult('https://www.jeffersonscher.com/gm/google-hit-hider/', 'https://ixquick-proxy.com/do/spg/highlight.pl?ah=1&l=english&cat=web&c=hf&q=%22google+hit+hider%22&rl=NONE&u=https:%2F%2Fwww.jeffersonscher.com%2Fgm%2Fgoogle-hit-hider%2F&rid=LFLOQRLMPLLK478GTYHSU&hlq=https%3A%2F%2Fstartpage.com%2Fdo%2Fsearch&mtcmd=process_search&mtlanguage=english&mtqid=LFLOQRLMPLLK478GTYHSU&mtrcount=&mtrl=NONE&mtabp=-1&mtt=air&mtcat=web&mtstartat=0&mtnj=0', '_blank');">
<span style="text-decoration: none;" class="result_url_heading">Google Hit Hider by Domain — Author's Site - jeffersonscher.com</span>
</a>

Re: @stoptheads:
Is it just me on a Sunday morning or is the site in German?

There are lots of scripts for cleaning URLs for Google and other sites. One of those might be convenient to adapt.



Re: @chacham:
I don't understand your question:

Why does the script not us the default parameter?

Those lines try to retrieve a username value the user previously saved in GM storage. If the parameter comes back with a text value, that's fine, but if it comes back null/undefined, a blank string is assigned. If I don't do this, when I try do to anything with uname I may get an error or strange results.


Re: @chacham:
I don't use that site, so I'm probably not the right person to work on this.

By "right end of the tab line" do you mean in the page? If this is a feature added by an extension to the toolbar area, then a userscript isn't going to be able to touch that area.

Generally speaking, there are two ways to save data locally:

(1) Greasemonkey storage. The GM_setValue and GM_getValue are the functions you need. This is script-specific but cross-domain. https://wiki.greasespot.net/GM_setValue https://wiki.greasespot.net/GM_getValue For example: https://openuserjs.org/scripts/jscher2000/oujs_Forum_-_My_Scripts_Filter/source

(2) DOM storage (AKA local storage). This is domain-specific, but accessible to any scripts that run on the site and to the site itself. It can be wiped by the site or by DOM storage data cleaners, so possibly a bit fragile. I rarely use this, but for example: http://userscripts-mirror.org/scripts/review/96765


Re: @Marti:
That looks good, and the clipboard is convenient. I wonder whether it might need a caption to explain what it's for?

As for whether to serve scripts without @updateURL, I think you can decide later whether that is a permanent policy or just for the duration of the current troubles.


I'm not sure how much trouble it would be, but to minimize potential errors, what do you think about adding a "Required Metadata" heading to the Author Tools section, along with a computed line such as:

document.write("// @updateURL " + window.location.href.replace("scripts", "meta")+".meta.js");

(I don't know what the server-side code would be, so...)





Thank you for the report and apologies for the delayed reply.

I don't know why google.co.za works differently than other multi-level TLDs. I suggest adding a "user include" on the Tampermonkey dashboard as a workaround.

Open the dashboard, click the script name, then click the Settings tab. You will see a box listing the standard included domains and below that, an empty box labeled "User includes". Click the "Add..." button below that box and paste:

https://www.google.co.za/*

and Okay that. Then reload your search results page and the block buttons should appear.