@require, @resource of Greasemonkey
ãããã Greasemonkey 0.8 ã 㨠@require ã®ä»ã«ããä¸ã¤ä½ã使ããããªã¨æã£ã¦è©¦ãã¦ã¿ããã¨ãããã http://labs.gmo.jp/blog/ku/2007/11/firefox3greasemonkeyimport_require.html ã® hit æ°èªä½ãå°ãªãã®ã§ãã¾ã使ããã¦ãªãã®ãããããªã ) ã
ã§ã使ãæ¹ã¨ãã¯æ®éã«ä¸è¨ã«æ¸ãã¦ãããã ãã©ã以ä¸ã®ãããªæãã§ãå ´ææå®ã¯ Greasemonkey script ãç½®ãã¦ããä½ç½®ãåºç¹ã¨ãã¦ç¸å¯¾ path æå®ãåãã¤ããã¿ãããªã®ã§åã directory ã css/, image/ directory ãªãããæã£ã¦ããã«ç½®ãã¦ããã¨åãæ±ãã楽ãã£ã¦ããã local 㧠test ããªããæ¸ãã¨ãã¯å¿ ç¶çã«ãã£ã¡ã«ãªã£ã¡ããããã
// ==UserScript== // @name exsample // @namespace http://example.com/userscript/ // @description "@resource" example // @include * // @resource CSS example.css // @resource PNG example.png // ==/UserScript== (function () { GM_addStyle(GM_getResourceText('CSS')); document.getElementsByTagName('img')[0].src = GM_getResourceURL(PNG); } )();
ä»æ°ä»ãããã©ä¸è¨ã®åçç¡ç¨ã§ GM_addStyle
ããæ¹æ³ã¯ Stylish å
¥ãã¦ãªããã°ãªã¬ãªã¬ style ã®é©ç¨ã toggle ã§ãããæ軽ãªæ¹æ³ãããããªãã add-on ã²ã¨ã¤ã¶ã軽ãã§ããã¨ã highlight ãè£å®ã®å¹ã editor ã§ç·¨éã§ããã¨ããæ°æ¥½ãã¨ããã¡ãªãããã㪠?