Created
February 27, 2013 04:20
-
-
Save tenten0213/5045046 to your computer and use it in GitHub Desktop.
文章に☆を付けられるのが嫌だったので、置換するスクリプトを作成。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TARGET_URL = "https:\/\/www\.skipaas\.com\/"; | |
(function(){ | |
function deathStar(elem){ | |
var children = elem.childNodes; | |
var child; | |
for(var i=0; i < children.length; i++){ | |
child = children.item(i); | |
if(child.nodeType == 3){ // テキストノード | |
child.nodeValue = child.nodeValue.replace(/☆/g, "。"); | |
}else{ | |
if(child.childNodes.length>0){ | |
deathStar(child); | |
} | |
} | |
} | |
} | |
if(location.href.indexOf(TARGET_URL) != -1) {deathStar(document.body);} | |
})(); |
”。”に置換した場所が分からないとなんとなく不安なので、Boldにするか色でも付けるかなー
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
置換対象はリストにしよう。
後、文末の☆だけウザいので、文末だけヒットするように修正するか。