自作greasemonkeyのテンプレートを公開

これは何?

自作のgreasemonkeyを作る際のテンプレートです
複数マシンで開発してるので、どっからでも見れるようにここにUPしました
ライセンスはNYSLでご自由にどうぞ

// ==UserScript==
// @name           
// @namespace      http://d.hatena.ne.jp/kasei_san/
// @description 
// @include        
// @exclude 
// ==/UserScript==
//
/*
   LICENSE : NYSL ( http://www.kmonos.net/nysl/NYSL.TXT )
*/


(function() {

	// Greasemonkey Manual:API
	//  http://wiki.greasespot.net/API_reference

	//-------------------------------------------------------------------------
	// AutoPagerizeでループする部分(検索結果とか)の処理
	//-------------------------------------------------------------------------
	// AutoPagerize対応
	if( window.AutoPagerize ) {
		// AutoPagerizeにて読み込み完了時に、引数のメソッドが呼ばれる
		window.AutoPagerize.addFilter( 
			function( doms ) {
				for( var i=0; i<doms.length; i++ ) {
					loop(dom[i]);
				}
			}
		 )
	}
	
	loop(document);
	
	function loop(dom){
	}
	

	//-------------------------------------------------------------------------
	// common
	//-------------------------------------------------------------------------

	// htmlテキストをDOMにコンバート
	function convertToHTMLDocument(html) {
		var xsl = (new DOMParser()).parseFromString(
		'<?xml version="1.0"?>\
			<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">\
			<output method="html"/>\
		 </stylesheet>', "text/xml");

		var xsltp = new XSLTProcessor();
		xsltp.importStylesheet(xsl);

		var doc = xsltp.transformToDocument(document.implementation.createDocument("", "", null));
		doc.appendChild(doc.createElement("html"));

		var range = doc.createRange();
		range.selectNodeContents(doc.documentElement);
		doc.documentElement.appendChild(range.createContextualFragment(html));

		return doc;
	}

	// DOM取得系
	function $(id) {
		return document.getElementById(id);
	}

	function $T(tab, dom) {
		if( !dom || dom == undefined ) {
			$T( tab, document );
		}
		return dom.getElementsByTagName(tab);
	}

	function $C(class, dom) {
		if( !dom || dom == undefined ) {
			$C( class, document );
		}

		var retnode = [];
		var myclass = new RegExp('\\b'+class+'\\b');
		var elem = dom.getElementsByTagName('*');
		for (var i = 0; i < elem.length; i++) {
			var classes = elem[i].className;
			if (myclass.test(classes)) retnode.push(elem[i]);
		}
		return retnode;
	}

	// firebugにログ出力。ない場合、何もしない
	function log( str ) {
		if( console ) {
			console.log( str );
		}
	}

	// firebugにエラー出力。ない場合、アラート
	function err( str ) {
		if( console ) {
			console.error( str );
		} else {
			alert( str );
		}
	}
	
	// ロード中のgifアニメ
	var loadingImg = 
		'data:image/gif;base64,'+
		'R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH5BAAKAAAAIf4VTWFkZSBieSBB'+
		'amF4TG9hZC5pbmZvACH/C05FVFNDQVBFMi4wAwEAAAAsAAAAABAAEAAAAzMIutz+MMpJaxNjCDoI'+
		'GZwHTphmCUWxMcK6FJnBti5gxMJx0C1bGDndpgc5GAwHSmvnSAAAIfkEAAoAAAAsAAAAABAAEAAA'+
		'AzQIutz+TowhIBuEDLuw5opEcUJRVGAxGSBgTEVbGqh8HLV13+1hGAeAINcY4oZDGbIlJCoSACH5'+
		'BAAKAAAALAAAAAAQABAAAAM2CLoyIyvKQciQzJRWLwaFYxwO9BlO8UlCYZircBzwCsyzvRzGqCsC'+
		'We0X/AGDww8yqWQan78EACH5BAAKAAAALAAAAAAQABAAAAMzCLpiJSvKMoaR7JxWX4WLpgmFIQwE'+
		'MUSHYRwRqkaCsNEfA2JSXfM9HzA4LBqPyKRyOUwAACH5BAAKAAAALAAAAAAQABAAAAMyCLpyJytK'+
		'52QU8BjzTIEMJnbDYFxiVJSFhLkeaFlCKc/KQBADHuk8H8MmLBqPyKRSkgAAIfkEAAoAAAAsAAAA'+
		'ABAAEAAAAzMIuiDCkDkX43TnvNqeMBnHHOAhLkK2ncpXrKIxDAYLFHNhu7A195UBgTCwCYm7n20p'+
		'SgAAIfkEAAoAAAAsAAAAABAAEAAAAzIIutz+8AkR2ZxVXZoB7tpxcJVgiN1hnN00loVBRsUwFJBg'+
		'm7YBDQTCQBCbMYDC1s6RAAAh+QQACgAAACwAAAAAEAAQAAADMgi63P4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