Parses all links and show ROM ID at link text, for all links to ROM description pages.
目前為
// ==UserScript==
// @name Show ROM ID at links to ROM page.
// @author Denilson Sá
// @namespace http://denilson.sa.nom.br
// @version 1.0
// @description Parses all links and show ROM ID at link text, for all links to ROM description pages.
// ==/UserScript==
(function () {
var l=document.getElementsByTagName('a');
var url, m;
for(var i=0, link; link=l[i] ; i++) {
if( link.firstChild && link.firstChild.nodeType==Node.TEXT_NODE ){
url=link.getAttribute('href');
// Using literal notation (with slashes), the regexp is assumed constant
// and is automatically compiled once, even when inside a loop, like this.
if( m=url.match(/action=showrom&id=([0-9]+)/) ) {
link.firstChild.nodeValue = '[' + m[1] + '] ' + link.firstChild.nodeValue;
}
}
}
})();