1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 12:06:31 +02:00

Add reload button to browser action

For #535
This commit is contained in:
kkapsner 2021-06-12 00:49:10 +02:00
parent cdfe72fada
commit 015350c385
6 changed files with 139 additions and 4 deletions

View file

@ -42,4 +42,23 @@ div {
}
#addonStatus.on {
background-image: url(../icons/browserAction-CBon.svg);
}
#reload {
cursor: pointer;
vertical-align: text-bottom;
height: 19px;
width: 19px;
margin-right: 0.25em;
background-color: currentColor;
mask-size: 100%;
display: inline-block;
mask-image: url(../icons/browserAction-reload.svg);
position: absolute;
top: calc(5px + 0.5em);
right: 0.5em;
}
#reload.hidden {
display: none;
}

View file

@ -8,6 +8,7 @@
</head>
<body>
<button id="addonStatus" class="undefined"></button>
<span id="reload" class="hidden"></span>
<div id="actions" class="stackedInputs"></div>
<script src="../lib/require.js"></script>
<script src="../lib/logging.js"></script>

View file

@ -23,8 +23,14 @@
}
const currentURL = new URL(currentTab.url);
const reloadButton = document.getElementById("reload");
reloadButton.addEventListener("click", async function(){
await browser.tabs.reload(currentTab.id);
window.close();
});
const addonStatus = document.getElementById("addonStatus");
addonStatus.addEventListener("click", async function(){
reloadButton.classList.toggle("hidden");
if (isWhitelisted(currentURL)){
settingContainers.resetUrlValue("blockMode", currentURL);
if (settings.get("blockMode").startsWith("allow")){