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")){

View File

@ -5,7 +5,7 @@
id="svg2" sodipodi:docname="browserAction-whitelisted.svg" inkscape:version="0.92.2 2405546, 2018-03-11" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="96px" height="96px"
viewBox="0 0 96 96" enable-background="new 0 0 96 96" xml:space="preserve">
<symbol id="Löschen" viewBox="-32 -32 64 64">
<symbol id="Loeschen" viewBox="-32 -32 64 64">
<polygon points="8.452,15.699 -0.001,7.246 -8.453,15.697 -15.698,8.453 -7.245,0 -15.698,-8.453 -8.453,-15.697 -0.001,-7.244
8.452,-15.697 15.697,-8.453 7.244,0 15.697,8.453 "/>
<path d="M22.627,22.627C16.379,28.875,8.189,32,0,32s-16.38-3.125-22.628-9.373c-12.496-12.496-12.496-32.758,0-45.254
@ -87,5 +87,5 @@
<path id="rect3826-0" fill="none" stroke="#000000" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M23.808,2
h48.385C84.236,2,94,11.764,94,23.808v48.385C94,84.236,84.236,94,72.192,94H23.808C11.764,94,2,84.236,2,72.192V23.808
C2,11.764,11.764,2,23.808,2z"/>
<use xlink:href="#Löschen" width="64" height="64" x="-32" y="-32" transform="matrix(0.4704 0 0 -0.4704 70.5 73.2471)" overflow="visible"/>
<use xlink:href="#Loeschen" width="64" height="64" x="-32" y="-32" transform="matrix(0.4704 0 0 -0.4704 70.5 73.2471)" overflow="visible"/>
</svg>

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -5,7 +5,7 @@
id="svg2" sodipodi:docname="browserAction-notPrinted.svg" inkscape:version="0.92.2 2405546, 2018-03-11" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="96px" height="96px"
viewBox="0 0 96 96" enable-background="new 0 0 96 96" xml:space="preserve">
<symbol id="Häkchen" viewBox="-32 -32 64 64">
<symbol id="Haekchen" viewBox="-32 -32 64 64">
<path d="M22.628,22.627C16.38,28.877,8.189,32,0,32s-16.379-3.123-22.628-9.373c-12.496-12.496-12.496-32.758,0-45.254
C-16.379-28.875-8.189-32,0-32s16.38,3.125,22.628,9.373C35.124-10.131,35.124,10.131,22.628,22.627z M19.093-19.092
C13.993-24.191,7.212-27,0-27s-13.992,2.809-19.093,7.908c-10.526,10.527-10.526,27.656,0,38.184C-13.992,24.191-7.212,27,0,27
@ -85,5 +85,5 @@
<path id="rect3826-0" fill="none" stroke="#000000" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" d="M23.808,2
h48.385C84.236,2,94,11.764,94,23.808v48.385C94,84.236,84.236,94,72.192,94H23.808C11.764,94,2,84.236,2,72.192V23.808
C2,11.764,11.764,2,23.808,2z"/>
<use xlink:href="#Häkchen" width="64" height="64" x="-32" y="-32" transform="matrix(0.4707 0 0 -0.4707 70.5 73.2383)" overflow="visible"/>
<use xlink:href="#Haekchen" width="64" height="64" x="-32" y="-32" transform="matrix(0.4707 0 0 -0.4707 70.5 73.2383)" overflow="visible"/>
</svg>

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg2"
version="1.1"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
width="38"
height="38"
viewBox="0 0 38 38"
sodipodi:docname="browserAction-reload.svg"
inkscape:export-filename="Fingerprint.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<cc:license
rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="841"
id="namedview4"
showgrid="false"
inkscape:zoom="8.8685035"
inkscape:cx="0.62017228"
inkscape:cy="22.044305"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
showguides="true"
inkscape:pagecheckerboard="0">
<inkscape:grid
type="xygrid"
id="grid3725" />
</sodipodi:namedview>
<path
id="path819"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#919191;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 27.558376,2.036681 C 18.208263,-2.6806621 6.7540244,1.0915089 2.036681,10.441624 c -4.7173433,9.350114 -0.9451714,20.804352 8.404943,25.521695 9.350113,4.717343 20.804352,0.945172 25.521695,-8.404943 1.490789,-2.95485 2.131192,-6.119738 2.017806,-9.215679 l -3.48287,0.09573 c 0.09126,2.528509 -0.436066,5.11796 -1.659758,7.543405 -3.865316,7.661336 -13.158996,10.72198 -20.82033,6.856664 C 4.3568317,28.973181 1.2961865,19.679502 5.1615029,12.018167 9.0268193,4.3568308 18.320499,1.2961869 25.981833,5.1615029 27.491656,5.9232425 28.81983,6.8983886 29.954505,8.027729 L 32.30738,5.4367801 C 30.943863,4.0966388 29.353902,2.942564 27.558376,2.036681 Z" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#bbbbbb;fill-opacity:1;stroke:none"
x="10.982422"
y="33.580078"
id="text823"><tspan
sodipodi:role="line"
id="tspan821"
x="10.982422"
y="68.970703"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AkrutiMal2;-inkscape-font-specification:AkrutiMal2" /></text>
<g
id="g180"
transform="matrix(-0.67598944,-0.06825165,0.06825165,-0.67598944,43.19324,21.507957)"
style="stroke-width:1.47183">
<rect
style="fill:#919191;fill-opacity:1;stroke:#919191;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect829"
width="5.999999"
height="16.195862"
x="15.780028"
y="-28.064632"
transform="rotate(82.446816)" />
<rect
style="fill:#919191;fill-opacity:1;stroke:#919191;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect829-3"
width="5.999999"
height="16.195862"
x="-18.228109"
y="-31.699099"
transform="rotate(173.76303)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB