Option to clear cookies & local storage (of site)
Plus fix-update MIT Sloan Management Review (modal)merge-requests/1/head
parent
60930063c5
commit
9c721e4ef4
@ -0,0 +1,22 @@
|
||||
var ext_api = (typeof browser === 'object') ? browser : chrome;
|
||||
|
||||
window.localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
|
||||
// send domain to background.js (to clear cookies)
|
||||
ext_api.runtime.sendMessage({
|
||||
domain: document.domain
|
||||
});
|
||||
|
||||
let msg = "Cookies (and local storage) removed from " + document.domain;
|
||||
showMessage(msg, 2000);
|
||||
|
||||
function showMessage(msg, duration) {
|
||||
var el = document.createElement("div");
|
||||
el.setAttribute("style", "position:fixed;top:40%;left:40%;z-index:99;padding:4px;font-family: Arial, sans-serif;font-size:18px;color:white;background-color:blue;");
|
||||
el.innerText = msg;
|
||||
setTimeout(function () {
|
||||
el.parentNode.removeChild(el);
|
||||
}, duration);
|
||||
document.body.appendChild(el);
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
var ext_api = chrome || browser;
|
||||
document.getElementById("site_switch").addEventListener('click', function() {
|
||||
ext_api.extension.getBackgroundPage().site_switch();
|
||||
window.close();
|
||||
});
|
||||
document.getElementById("clear_cookies").addEventListener('click', function() {
|
||||
ext_api.extension.getBackgroundPage().clear_cookies();
|
||||
window.close();
|
||||
});
|
||||
|
Loading…
Reference in New Issue