Last active
December 21, 2015 03:08
-
-
Save Fusselwurm/6239687 to your computer and use it in GitHub Desktop.
Deleting known hosts in my Fritz!Box 7170 is a PITA. One click per host plus the wait for page reload. This is a script to take the P from ITA :p (untested in this form. todo: wait for DOM structure instead of fixed timeout)
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
var | |
pattern = /^PC-192/, | |
deleteText = 'Löschen', | |
timeout = 3000; | |
(function moo() { | |
var found = Array.prototype.some.call(document.getElementsByTagName('frame')[0].contentDocument.querySelectorAll('button[value="' + deleteText + '"]'), function (e) { | |
var hostname = e.parentNode.parentNode.firstChild.nextSibling.textContent.trim(); | |
if (hostname.match(pattern)) { | |
console.log('deleting ' + hostname + '...'); | |
e.onclick(); | |
return true; | |
} | |
}); | |
if (found) { | |
setTimeout(moo, timeout); | |
} else { | |
console.log('no further hosts found.') | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment