Skip to content

Instantly share code, notes, and snippets.

@tenten0213
Created February 27, 2013 04:20
Show Gist options
  • Save tenten0213/5045046 to your computer and use it in GitHub Desktop.
Save tenten0213/5045046 to your computer and use it in GitHub Desktop.
文章に☆を付けられるのが嫌だったので、置換するスクリプトを作成。
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);}
})();
@tenten0213
Copy link
Author

置換対象はリストにしよう。
後、文末の☆だけウザいので、文末だけヒットするように修正するか。

@tenten0213
Copy link
Author

”。”に置換した場所が分からないとなんとなく不安なので、Boldにするか色でも付けるかなー

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment