Greasemonkeyã®user scriptãéãã¨ï¼ãã®ãããªãã¤ã¢ãã°ãåºã¦ï¼ã¤ã³ã¹ãã¼ã«ãããï¼ã½ã¼ã¹ã³ã¼ããè¦ããã§ããï¼
ããã¯ï¼ãã®ãããªæ£è¦è¡¨ç¾ã§å®ç¾ããã¦ããï¼URLã®æ«å°¾ã.user(?:-\d+).jsãªããã¤ã¢ãã°ãåºãï¼
http://github.com/greasemonkey/greasemonkey/blob/master/content/browser.js
// Show the greasemonkey install banner if we are navigating to a .user.js // file in a top-level tab. If the file was previously cached it might have // been given a number after .user, like gmScript.user-12.js if (href.match(/\.user(?:-\d+)?\.js$/) && safeWin == safeWin.top) { var browser = this.tabBrowser.getBrowserForDocument(safeWin.document); this.showInstallBanner(browser); }
ãªã®ã§ï¼user scriptã§ã¯ãªããï¼ãã¾ãã¾æ«å°¾ã.user.jsã®URLãéãã¨ï¼èª¤ã£ã¦ãã¤ã¢ãã°ãåºã¦ãã¾ãï¼ãã¼ã¸ãè¦ããã¨ãã§ããªãï¼ä¾ãã°ï¼ä»¥ä¸ã®ãã¼ã¸ï¼
- http://www.google.com/search?q=.user.js
- http://github.com/cho45/jAutoPagerize/blob/master/jautopagerize.user.js
- http://github.com/cho45/jAutoPagerize/commits/master/jautopagerize.user.js
æ®éã«æ®ããã¦ããã°1çªç®ã®URLã«ã¢ã¯ã»ã¹ãããã¨ã¯ãªãããã ãã©ï¼ãã以å¤ã¯ãã¨ãããã®URLãªã®ã§ï¼Greasemonkeyããªã³ã«ãªã£ã¦ããéã¯ãããã®ãã¼ã¸ãè¦ããã¨ãã§ããªãï¼
å¾ãã«#ã§ãæ¸ãã¦ããã¨ï¼å·¦è¨ã®æ£è¦è¡¨ç¾ã«ãããããªããªãã®ã§ï¼è¦ããã¨ãã§ããï¼
æ¯åGreasemonkeyãç¡å¹ã«ããã®ãããã©ããªã®ã§ï¼user scriptã¨ãã¦èªèããããªã³ã¯å
ã«ä¸åº¦ãªã¯ã¨ã¹ããæãã¦ï¼ContentTypeãHTMLã£ã½ãã¨ãï¼ãªã³ã¯ã®é·ç§»å
ã®æ«å°¾ã«#ãã¤ããGreasemonkeyãæ¸ããï¼
æ ¹æ¬çã§ã¯ãªããï¼ã¨ããããããã§å¯¾å¦ï¼
http://gist.github.com/279123
// ==UserScript== // @name check-userjs // @namespace http://www.hatena.ne.jp/hitode909 // @include http://* // @include https://* // ==/UserScript== var anchors = document.querySelectorAll('a[href$=".js"]'); for (var i = 0, len = anchors.length; i < len; i++) { if (anchors[i].href.match(/\.user(?:-\d+)?\.js$/)) { check(anchors[i]); } } function check(anchor) { var cache = GM_getValue(anchor.href); if (cache == "true") { anchor.href += '#'; } if (cache) { return; } GM_xmlhttpRequest({ method : "GET", url : anchor.href, onload : function (req) { if (req.responseHeaders.match(/^Content-Type: .*html.*$/m)) { GM_setValue(anchor.href, "true"); anchor.href += '#'; } else { GM_setValue(anchor.href, "false"); } } }); }
ä¸æ¹ï¼Jetpack Featureã¯ï¼
<link rel="jetpack" href="boom.js" name="Boom!"/>
ã®ãããªlinkã¿ã°ãè¦ã¦ã¤ã³ã¹ãã¼ã«ãããã®ã§ï¼ãã®ãããªèª¤èªèããªãããï¼
ä»åã®ä¾ã«éããï¼URLã«ããããããããããããç³»ã¯åæ§ã®åé¡ãèµ·ããããªã®ã§ï¼èªåã§ä½ãä½ãã¨ãã¯æ°ãã¤ãããã¨æã£ãï¼
ä¸åº¦ãªã¯ã¨ã¹ããæãã¦ContentTypeãè¦ãã¨ãï¼ãªãã¤ã¬ã¯ãå
ãè¦ãã¨ãï¼ãã¾ããããããªããï¼1ã¤ã®ãã¼ã¸ã«100000åã®ãªã³ã¯ãããã¨ï¼ãããããã¨ãã§ããªãï¼