Created
September 16, 2015 15:10
-
-
Save AustinDizzy/b78d5f0d889c01716af0 to your computer and use it in GitHub Desktop.
A simple javascript bookmarklet to automatically clean unwanted URLs from an IBM AppScan walkthrough during import.
This file contains hidden or 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
function extractDomain(url) { | |
return url.split('/')[(url.indexOf("://") > -1) ? 2 : 0].split(':')[0]; | |
} | |
function doIt(sites) { | |
var d = document.getElementsByClassName("admin_grid")[0].getElementsByTagName("tbody")[0]; | |
for (var i = 0; i < d.children.length; i++) { | |
var checkbox = d.children[i].getElementsByTagName("input")[0], | |
url = d.children[i].getElementsByTagName("td")[1].innerText; | |
var allowed = sites; | |
for (var k = 0; k < sites.length; k++) { | |
if (sites[k].trim() == extractDomain(url)) { | |
break; | |
} | |
if (k + 1 == sites.length) { | |
checkbox.checked = true; | |
} | |
} | |
} | |
} | |
doIt(prompt("Please enter the allowed sites (comma seperated):").split(",")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment