-
-
Save RandalK/2505687 to your computer and use it in GitHub Desktop.
g+ full sized images and google image search
This file contains 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
;(function(ready, window){ | |
// loading stuffs | |
var req = { paths: { jquery: "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" }, }; | |
// if missing requirejs hook define func | |
if (!window.require && !window.define) { | |
window.define = function(mod, list, callback) { | |
if (mod != 'jquery') return; | |
delete window.define; | |
ready(callback()); | |
}; | |
window.define.amd = { jQuery: true }; | |
var s = document.createElement('script'); | |
s.async = true; s.src = req.paths.jquery; | |
document.head.appendChild(s); | |
} | |
else require(req, ['jquery'], ready); | |
}(function($){ | |
$.noConflict(true); | |
(function linker(){ | |
$('header:not(.g-linker-done)') | |
// find items not yet touched | |
.addClass('g-linker-done') | |
// g+ y u no meaningful classes | |
.parent().next().next().find('div div div a:not(.ot-anchor) img') | |
.each(function() { | |
var src = $.map(this.src.split('/'), function(part, i){ | |
return !part.indexOf('w') && 0<part.indexOf('-h') ? 's0' : part; | |
}).join('/'); | |
$(this).closest('.Vl').next().children().last() | |
.before('<div class="c-wa-Da" style="margin: 10px 0 0 5px;"><a href="' + src +'">Full Size</a> ' | |
+'<a href="//www.google.com/searchbyimage?image_url=' + src + '">Image Search</a></div>'); | |
}); | |
// todo dom modify event? | |
setTimeout(linker, 5000); | |
}()); | |
}, this)); |
todo fix problem with "gallery" posts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yup works good.