Created
November 8, 2012 12:40
-
-
Save iambibhas/4038568 to your computer and use it in GitHub Desktop.
Google Image Search Direct Link to Image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Image Direct Link | |
// @namespace http://userscripts.org/users/192333 | |
// @include http*://*.google.co.in/search* | |
// @version 1 | |
// @grant GM_deleteValue | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @grant GM_info | |
// ==/UserScript== | |
si = window.setInterval(clearanchors, 2000); | |
function clearanchors(){ | |
anchors = document.getElementsByClassName('rg_l') | |
for(i=0;i<anchors.length;i++){ | |
url = anchors[i].getAttribute('href'); | |
var patt = /imgurl\=[^&]*/g; | |
regstr = patt.exec(url); | |
if(regstr != null && regstr.length > 0){ | |
str = regstr[0].replace("imgurl=", ""); | |
anchors[i].setAttribute('href', str); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment