Skip to content

Instantly share code, notes, and snippets.

@RandalK
Forked from L-four/gist:2405585
Created April 27, 2012 04:09
Show Gist options
  • Save RandalK/2505687 to your computer and use it in GitHub Desktop.
Save RandalK/2505687 to your computer and use it in GitHub Desktop.
g+ full sized images and google image search
;(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));
@L-four
Copy link

L-four commented Apr 27, 2012

Yup works good.

@RandalK
Copy link
Author

RandalK commented Apr 27, 2012

todo fix problem with "gallery" posts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment