Unbeastifying methods

This commit is contained in:
EvolvedCode
2016-10-14 01:25:37 +03:00
parent ea49ad0f60
commit 2a5cd05a48
4 changed files with 81 additions and 24 deletions
+27
View File
@@ -0,0 +1,27 @@
/*
clear():
* either reloads or clears the page depending on the request
*/
function clear(request, sender, sendResponse) {
switch (request.type){
case "Reload":
location.reload();
break;
case "Blank":
removeEverything();
break;
}
chrome.runtime.onMessage.removeListener(clear);
}
function removeEverything() {
while (document.body.firstChild) {
document.body.firstChild.remove();
}
}
/*
Assign clear() as a listener for messages from the extension.
*/
chrome.runtime.onMessage.addListener(clear);