Skip to content

Instantly share code, notes, and snippets.

@teramako
Created January 30, 2012 13:43
Show Gist options
  • Select an option

  • Save teramako/1704471 to your computer and use it in GitHub Desktop.

Select an option

Save teramako/1704471 to your computer and use it in GitHub Desktop.
about:newtab の4行にするUserScript (for Scriptish & enables aboutURL)
// ==UserScript==
// @id newtab@teramako.github.com
// @name newtab
// @version 1.0
// @namespace http://teramako.github.com
// @author teramako
// @description
// @include about:newtab
// @run-at document-end
// ==/UserScript==
var rows = 4,
columns = 5;
function initStyle (grid) {
grid.style.height = (127 * rows + 15 * (rows -1)) +"px";
grid.style.width = (201 * columns + 16 * (columns - 1) + 1) + "px";
var style = document.styleSheets[1];
style.deleteRule(16);
style.insertRule(".cell:nth-child(" + columns + "n+" + columns +"){ -moz-margin-end: 0; }", 16);
document.getElementById("body").style.paddingTop = "50px";
}
function init() {
var grid = document.getElementById("grid");
initStyle(grid);
var links = gLinks.getLinks();
for (let i = 9, len = rows * columns; i < len; ++i) {
let li = document.createElementNS(HTML_NAMESPACE, "li");
li.setAttribute("class", "cell");
grid.appendChild(li);
let cell = new Cell(gGrid, li);
gGrid.cells.push(cell);
if (links[i])
gGrid.createSite(links[i], cell);
}
}
init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment