Last active
August 29, 2015 14:23
-
-
Save amihalik/6af391b805d7a7e24794 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> | |
<h2>Remove Url Defense</h2> | |
<form method="post" action="fixUrls"> | |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> | |
<tr> | |
<td width="100%">Enter URL Defended Text here: </td> | |
</tr> | |
<tr> | |
<td><textarea cols="150" rows="20" id="myTextArea"></textarea></td> | |
</tr> | |
<tr> | |
<td> </td> | |
</tr> | |
<tr> | |
<td><input type="button" onclick='callJsApi();' value="Process Text"></td> | |
</tr> | |
<tr> | |
<td> </td> | |
</tr> | |
<tr> | |
<td><textarea cols="150" rows="20" id="goodTextArea"></textarea></td> | |
</tr> | |
</table> | |
</form> | |
<script type="text/javascript"> | |
function callJsApi() { | |
var ppPattern = /(https:..urldefense\S*)\s/g; | |
var str = document.getElementById("myTextArea").value; | |
str.match(ppPattern).forEach(function(proofpointUrl) { | |
var urlPattern = /u=([^&]*)[&\s]/g; | |
var encodedUrl = urlPattern.exec(proofpointUrl)[1].replace(/_/g,'/').replace(/-/g,'%'); | |
encodedUrl = decodeURIComponent(encodedUrl); | |
str = str.replace(proofpointUrl, encodedUrl); | |
}); | |
document.getElementById("goodTextArea").value = str; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment