Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

gsearch+

looking ahead & previewing on google search

This gives you SOME GOODIES at searching webpages or images.

(goodies)

1 You never wait for loading the next page. Next page is always loaded. And the next search results ADD in the end of the first page. So, You can see all results by scrolling.

2 Previewing the page that the link represents in a inline frame.

3 On the image search, one click and you can get the original image instantly.






1 point
login to vote
Original 3 scriptwright
Posted Jun 13, 2006

This script has changed my life! THANK U!

1 point
login to vote
M sime user
Posted May 17, 2006

Sorry about that comment (below) - I'd remove it if I knew how. Great script by the way!

1 point
login to vote
M sime user
Posted May 17, 2006

I've managed to "translate" it (don't understand scripts myself). Don't know if I can attach it, but here goes:
// ==UserScript==
// @name gsearch+
// @namespace tag:arakitakaya@gmail.com,2006:gm-script
// @description looking ahead & previewing on google search
// @include http://www.google.*
// @include http://images.google.*
// ==/UserScript==

document.initElement = function( /* Object */ props ){
var elem = document.createElement(props.tagName); delete(props.tagName);
if( props.class ){ props.className = props.class; delete(props.class); }
for(var n in props){
try{ elem[n] = props[n]; }catch(e){ elem.setAttribute(n, props[n]); };
}
return elem;
};

document.getSnapshot = function( /* String */ xpath, /* Node */ contextNode ){
return document.evaluate(
xpath,
contextNode ? contextNode : document,
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) ;
};

location.host.match(/([^\.]+)\.google/);
var gsp_mode = RegExp.$1;

var gsp_lookAhead = (function( ){
var IF_NAME = 'lookahead';
if( window.name.match(new RegExp(IF_NAME + '.*')) ) return;
var resultsNode = getResultNode();
if( !resultsNode ) return;
var BUTTON_ID = '_gsp_goNext';
var url = location.href.replace(/#.*/, '').replace(/&start=\d+/, '');
var pageNum = 1;
var step = ( gsp_mode == 'images' ) ? 20 : 10;
var iframe = document.initElement({
tagName: 'IFRAME', name: IF_NAME, width: '0px', height: '0px'
});
var button = document.initElement({
tagName: 'P',
id: BUTTON_ID,
style: 'font-weight: bold; background-color: #e5ecf9; text-align: center; width: 100%;',
innerHTML: 'Next Page' });

function getResultNode( ){
var node;
if( gsp_mode == 'images' ){
node = document.createElement('DIV');
var next = document.getSnapshot('/html/body/div[@class="n"]').snapshotItem(0);
if( next ){
next.parentNode.insertBefore(node, next);
}else{
node = null;
}
}else{
node = document.getSnapshot('//comment()[string(.)="a"]/following::div[1]').snapshotItem(0);
}
return node;
}

function getIfResultNodes( contextNode ){
var nodes;
if( gsp_mode == 'images' ){
nodes = document.getSnapshot('/html/body/table[position()>=5 and position()<=last()]', contextNode); <br /> }else{ <br /> nodes = document.getSnapshot('//comment()[string(.)="a"]/following::div[1]/*', contextNode); <br /> } <br /> return nodes; <br /> }</p> <p> var mouseover = false; <br /> button.addEventListener('mouseout', <br /> function( e ){ <br /> mouseover = false; <br /> button.style.backgroundColor = '#e5ecf9'; <br /> }, false); <br /> button.addEventListener('mouseover', <br /> function( e ){ <br /> mouseover = true; <br /> button.style.backgroundColor = '#00bfff'; <br /> setTimeout(function(){ <br /> button.style.backgroundColor = '#e5ecf9'; <br /> if( mouseover ) gsp_lookAhead(RegExp.$1); <br /> }, 300); <br /> }, false);</p> <p> resultsNode.appendChild(button); <br /> document.body.appendChild(iframe); <br /> iframe.src = url + '&start=' + (step * pageNum);</p> <p> return function( ){ <br /> var ifResNodes = getIfResultNodes(iframe.contentDocument); <br /> var statNode = document.getSnapshot('/html/body/table[4]', iframe.contentDocument).snapshotItem(0); <br /> var table = statNode.childNodes[0].childNodes[0].lastChild; <br /> if( gsp_mode == 'images' ) table = table.previousSibling; <br /> table.appendChild(document.initElement({ <br /> tagName: 'FONT', <br /> style: 'font-size: small', <br /> innerHTML: ' 
Page Up  '
+ 'Top  '
}));
resultsNode.appendChild(statNode);
if( gsp_mode == 'images' ) resultsNode.appendChild(document.createElement('BR'));
button.style.display = 'none';

for( var i = 0; i < ifResNodes.snapshotLength; i++ ){
resultsNode.appendChild(ifResNodes.snapshotItem(i));
if( gsp_mode == 'images' ) resultsNode.appendChild(document.createElement('BR'));
}
pageNum++;
iframe.contentWindow.name = IF_NAME + String(pageNum);
iframe.src = url + '&start=' + (step * pageNum);
resultsNode.appendChild(button);
button.style.display = 'block';
}
})( );

var gsp_preview = (function( ){
if( gsp_mode != 'www' ) return;
var PFX_BUTTON = '_gsp_pv_button_';
var PFX_FRAME = '_gsp_pv_frame_';
var TEXT_OPEN = 'Open';
var TEXT_CLOSE = 'Close';

var briefs = document.getSnapshot('//p[@class="g"]/*[last()]');
var links = document.getSnapshot('//a[@class="l"]');
var idNum = 0; var brief;
for( var i = 0; i < briefs.snapshotLength; i++ ){
brief = briefs.snapshotItem(i);
link = links.snapshotItem(i);
brief.id = PFX_FRAME + window.name + '_' + idNum;
button = document.createElement('SPAN');
button.style.fontSize = 'small';
button.innerHTML = ' - [ '
+ TEXT_OPEN + '
] ';
link.parentNode.insertBefore(button, link.nextSibling);
idNum++;
}

addEventListener('click',
function( e ){
var el = e.target;
var pat = new RegExp(PFX_BUTTON + '(.*)');
if( el && el.id && el.id.match(pat) ) gsp_preview(RegExp.$1);
}, false);

var brief, button;
var iframe = document.initElement({
tagName: 'IFRAME', height: '240px', width: '800px', style: 'display: none'
});
return function( id ){
var equelId = 0;
if( button && button.id == PFX_BUTTON + id ){
equelId = ( iframe.style.display == 'none' ) ? -1 : 1;
}
if( brief && equelId >= 0 ){
brief.style.display = 'block';
iframe.style.display = 'none';
button.innerHTML = TEXT_OPEN;
}
if( equelId <= 0 ){
button = document.getElementById(PFX_BUTTON + id);
button.innerHTML = TEXT_CLOSE;
brief = document.getElementById(PFX_FRAME + id);
brief.style.display = 'none';
iframe.src = button.parentNode.previousSibling.href;
brief.parentNode.insertBefore(iframe, brief.nextSibling);
iframe.style.display = 'block';
}
}
})( );

var gsp_zoom = (function( ){
if( gsp_mode != 'images' ) return;
var IMG_RES_NODE = '/html/body/table[position()>=5 and position()<=last()]/tbody'; <br /> var CLASS_NAME = '_gsp_zoom'; </p> <p> var image = document.createElement('IMG'); <br /> var box = document.initElement({ <br /> tagName: 'DIV', <br /> style: 'background-color: white; padding: 3px; border: 1px solid blue; display: none; position: absolute; cursor: pointer'}); <br /> var message = document.initElement({ <br /> tagName: 'DIV', <br /> innerHTML: '読み込み中', <br /> style: 'background-color: red; color: white; font-weight: bold; font-size: small; position: absolute; display: none; padding: 2px;'}); <br /> var close = document.initElement({ <br /> tagName: 'DIV', <br /> innerHTML: 'X', <br /> style: 'background-color: navy; color: white; font-weight: bold; font-size: 12px; width: 8px; cursor: pointer; display: none; position: absolute; padding: 2px; z-index: 10;'}); <br /> box.appendChild(image); <br /> box.appendChild(close); <br /> document.body.appendChild(message); <br /> document.body.appendChild(box);</p> <p> addEventListener('click', <br /> function( e ){ <br /> var el = e.target; <br /> if( el && el.className && (el.className == CLASS_NAME) ) gsp_zoom(e); <br /> }, false); <br /> image.addEventListener('load', <br /> function( e ){ <br /> box.style.display = 'block'; <br /> message.style.display = 'none'; <br /> }, false); <br /> box.addEventListener('click', <br /> function( e ){ <br /> box.style.display = 'none'; <br /> }, false); <br /> box.addEventListener('mouseover', <br /> function( e ){ <br /> close.style.display = 'block'; <br /> }, false); <br /> box.addEventListener('mouseout', <br /> function( e ){ <br /> close.style.display = 'none'; <br /> }, false);</p> <p> var hosts = document.getSnapshot(IMG_RES_NODE + '/tr[2]/td/font/font'); <br /> var infos = document.getSnapshot(IMG_RES_NODE + '/tr[2]/td/font/text()[contains(string(.), " x ")]'); <br /> var links = document.getSnapshot(IMG_RES_NODE + '/tr[1]/td/a');</p> <p> var PAT_URL = /imgurl=http:\/\/([^&]*)/; <br /> var PAT_SIZE = /(\d{3}) x (\d{3}) /; <br /> var i, url; <br /> for( i = 0; i < hosts.snapshotLength; i++ ){ <br /> links.snapshotItem(i).href.match(PAT_URL); <br /> url = RegExp.$1; <br /> infos.snapshotItem(i).textContent.match(PAT_SIZE); <br /> button = document.createElement('SPAN'); <br /> button.innerHTML = ' ['
+ 'Howzat' + '
] ';
hosts.snapshotItem(i).appendChild(button);
}

return function( event ){
var info, x, y;
box.style.display = 'none';
message.style.display = 'none';
x = event.pageX - 100;
y = event.pageY - 100;
info = event.target.id.split(':');
image.src = "http://" + info[0];
with( message.style ){
left = x + 'px';
top = y + 'px';
display = 'block';
}
x = x - (Number(info[1]) / 2); if( x < 0 ) x = 0;
y = y - (Number(info[2]) / 2); if( y < 0 ) y = 0;
with( box.style ){ left = x + 'px'; top = y + 'px'; }
with( close.style ){ left = (Number(info[1]) - 6) + 'px'; top = '-1px'; }
}
})( );

1 point
login to vote
cgm scriptwright
Posted Apr 16, 2006

heh - I was gonna play with something like this. Is there a reason it is in chinese?

You could comment on this script if you were logged in.