Two Column Google (row-wise)
By mungushume
—
Last update Apr 16, 2007
—
Installed
6,473 times.
// ==UserScript==
// @author mungushume
// @version 1.1
// @name Two Column Google (row-wise)
// @namespace mungushume_@_hotmail_._com
// @description Places Google search results into two columns row-wise. Based on the original idea by Jeffrey Sharkey
// @include http://www.google.*/search*
// @include http://google.*/search*
// @scriptsource http://userscripts.org/scripts/show/8477
// ==/UserScript==
// New in v1.1 numbering of the results
var table = document.createElement("table");
table.setAttribute("cellspacing", "0");
table.setAttribute("cellpadding", "0");
var cols=2;
var links, link, row;
links = document.evaluate("//div[@class='g']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
var parent=links.snapshotItem(0).parentNode;
for(var i = 0; i < links.snapshotLength; i++) {
link = links.snapshotItem(i);
link.innerHTML="<strong>"+(i+1)+" </strong>"+link.innerHTML;
if(i%cols==0){
row = table.insertRow(Math.floor(i/cols));
}
var cell = row.insertCell(i%cols);
cell.setAttribute("valign", "top");
cell.appendChild(link);
}
parent.appendChild(table);