Last active
February 17, 2017 15:56
-
-
Save GreeeenApple/6fa9347bb1a53617e573f1b23e2613f3 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
<html> | |
<body> | |
<div id="hoge"> | |
<!-- ここにタグ文字がエスケープされた(>や<は>や<)任意の文字列が入れられる --> | |
</div> | |
<script> | |
function f(){ | |
var txt = document.getElementById("hoge").innerHTML; | |
txt = txt.replace(/(http:\/\/[\x21-\x7e]+)/gi, '<a href="http://redirect.com/$1" onmousedown="f=' + "'1'" + ';" target=\"_b\">$1</a>'); | |
txt = txt.replace(/(https:\/\/[\x21-\x7e]+)/gi, '<a href="http://redirect.com/$1" onmousedown="f=' + "'1'" + ';" target=\"_b\">$1</a>'); | |
document.getElementById("hoge").innerHTML = txt; | |
} | |
f(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment