Skip to content

Instantly share code, notes, and snippets.

@repentsinner
Last active June 20, 2017 11:09
Show Gist options
  • Save repentsinner/503cfa5ffb57a98a9eba to your computer and use it in GitHub Desktop.
Save repentsinner/503cfa5ffb57a98a9eba to your computer and use it in GitHub Desktop.
Unfortunate hack to address https://github.com/mitro-co/mitro/issues/15
/* 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