faviconを換えるUserJS
Twitter, wassr, はてなハイクのを作ったけど、下みたいなテンプレートにすれば他にも簡単に色々適用できるのかな?
(ちょっと修正した)
(もっと修正した)
// ==UserScript== // @name hogehoge favicon changer // @namespace おくの // @description change hogehoge favicon to user icon // @include http://hogehoge/* // ==/UserScript== (function(){ var xpath = "faviconにしたい画像のxpath"; var links = document.getElementsByTagName('link'); var head = document.getElementsByTagName('head')[0]; var icon = document.evaluate( xpath, document, null, 7, null ); if(icon.snapshotLength == 0) return; for(var i=0; i<links.length; i++){ if (links[i].rel == "shortcut icon"){ head.removeChild(links[i]); break; } } icon = icon.snapshotItem(0).src; var link = document.createElement('link'); link.setAttribute('rel', 'shortcut icon'); link.setAttribute('href', icon); head.appendChild(link); })();