Last active
September 8, 2015 17:15
-
-
Save KenshoFujisaki/619486797331bf66fb72 to your computer and use it in GitHub Desktop.
ページ内のすべてのURLについて,正規表現`url_regex`にマッチするものを紫色で強調
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
// ページ内のすべてのURLについて,正規表現`url_regex`にマッチするものを紫色で強調 | |
var url_regex = /hatena/; | |
var iterator = document.evaluate("//a", document, null, 5, null); | |
var highlighter = function(elm) { | |
elm.style = | |
"font-weight:900;" + | |
"color:white;" + | |
"background-color:purple;"; | |
}; | |
var node; | |
while ( node = iterator.iterateNext() ) { | |
if ( node.href.match(url_regex) ) { | |
setTimeout(function(_node){highlighter(_node)}, 0, node); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vimperator向け -> ページ内のすべてのURLについて,正規表現
url_regex
にマッチするものを紫色で強調 for vimperator - https://gist.github.com/KenshoFujisaki/768b8f25e0822b8f3974