Show ROM ID at links to ROM page.

Parses all links and show ROM ID at link text, for all links to ROM description pages.

目前為 2016-04-08 提交的版本,檢視 最新版本

// ==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;
			}
		}
	}
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址