Last active
June 20, 2017 11:09
-
-
Save repentsinner/503cfa5ffb57a98a9eba to your computer and use it in GitHub Desktop.
Unfortunate hack to address https://github.com/mitro-co/mitro/issues/15
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
/* Unfortunate hack to address https://github.com/mitro-co/mitro/issues/15 */ | |
/*eslint-env browser */ | |
/*eslint no-console:0, no-undef:0 */ | |
delete console.log; // unbreak the redirected log | |
var secrets = document.querySelectorAll("[data-secret-id]"); | |
function removeSecret(i) { | |
"use strict"; | |
if (i < secrets.length) { | |
var id = parseInt(secrets[i].attributes["data-secret-id"].value); | |
background.removeSecret(id, | |
function () { | |
console.log("successfully removed secret #" + (secrets.length - i) + ", id=" + id); | |
removeSecret(i = i + 1); | |
}, | |
function () {console.log("error trying to remove secret " + id); }); | |
} else { | |
console.log("finished bulk removing secrets!"); | |
helper.setLocation("secrets.html"); | |
} | |
} | |
console.log("removing " + secrets.length + " secrets"); | |
removeSecret(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment