1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Added setting to controll to save notification details

Fixes #236
This commit is contained in:
kkapsner 2018-09-11 23:54:59 +02:00
parent 1a066de2fd
commit 5e5011f208
16 changed files with 556 additions and 90 deletions

View File

@ -595,24 +595,52 @@
"message": "ignoriere URL", "message": "ignoriere URL",
"description": "" "description": ""
}, },
"selectIgnore": {
"message": "Wählen Sie die Domain oder URL aus, die zur Ignorierliste hinzugefügt werden soll:",
"description": ""
},
"inputIgnore": {
"message": "Geben Sie die Domain oder URL \"RegExp\" ein, die zur Ignorierliste hinzugefügt werden soll:",
"description": ""
},
"inputIgnoreDomain": { "inputIgnoreDomain": {
"message": "Geben Sie die Domain ein, die zur Ignorierliste hinzugefügt werden soll:", "message": "Geben Sie die Domain ein, die zur Ignorierliste hinzugefügt werden soll:",
"description": "" "description": ""
}, },
"inputWhitelistDomain": { "inputIgnoreURL": {
"message": "Geben Sie die URL \"RegExp\" ein, die erlaubt werden soll:", "message": "Geben Sie die URL \"RegExp\" ein, die zur Ignorierliste hinzugefügt werden soll:",
"description": "" "description": ""
}, },
"inputWhitelistURL": { "selectWhitelist": {
"message": "Wählen Sie die Domain oder URL aus, die erlaubt werden soll:",
"description": ""
},
"inputWhitelist": {
"message": "Geben Sie die Domain oder die URL \"RegExp\" ein, die erlaubt werden soll:",
"description": ""
},
"inputWhitelistDomain": {
"message": "Geben Sie die Domain ein, die erlaubt werden soll:", "message": "Geben Sie die Domain ein, die erlaubt werden soll:",
"description": "" "description": ""
}, },
"inputWhitelistURL": {
"message": "Geben Sie die URL \"RegExp\" ein, die erlaubt werden soll:",
"description": ""
},
"selectSessionWhitelist": {
"message": "Wählen Sie die Domain oder URL aus, die für diese Sitzung erlaubt werden soll:",
"description": ""
},
"inputSessionWhitelist": {
"message": "Geben Sie die Domain oder URL \"RegExp\" ein, die für dieses Sitzung erlaubt werden soll:",
"description": ""
},
"inputSessionWhitelistDomain": { "inputSessionWhitelistDomain": {
"message": "Geben Sie die URL \"RegExp\" ein, die für diese Sitzung erlaubt werden soll:", "message": "Geben Sie die Domain ein, die für diese Sitzung erlaubt werden soll:",
"description": "" "description": ""
}, },
"inputSessionWhitelistURL": { "inputSessionWhitelistURL": {
"message": "Geben Sie die Domain ein, die für diese Sitzung erlaubt werden soll:", "message": "Geben Sie die URL \"RegExp\" ein, die für diese Sitzung erlaubt werden soll:",
"description": "" "description": ""
}, },
"settings": { "settings": {
@ -754,6 +782,15 @@
"description": "" "description": ""
}, },
"storeNotificationData_title": {
"message": "Details der Benachrichtigungen speichern",
"description": ""
},
"storeNotificationData_description": {
"message": "",
"description": ""
},
"inspectImage": { "inspectImage": {
"message": "Bild betrachten", "message": "Bild betrachten",
"description": "" "description": ""

View File

@ -594,24 +594,52 @@
"message": "ignore URL", "message": "ignore URL",
"description": "" "description": ""
}, },
"selectIgnore": {
"message": "Select domain or URL to add to ignore list:",
"description": ""
},
"inputIgnore": {
"message": "Input domain or URL \"RegExp\" to add to ignore list:",
"description": ""
},
"inputIgnoreDomain": { "inputIgnoreDomain": {
"message": "Input domain to add to ignore list:", "message": "Input domain to add to ignore list:",
"description": "" "description": ""
}, },
"inputWhitelistDomain": { "inputIgnoreURL": {
"message": "Input URL \"RegExp\" to add to white list:", "message": "Input URL \"RegExp\" to add to ignore list:",
"description": "" "description": ""
}, },
"inputWhitelistURL": { "selectWhitelist": {
"message": "Select domain or URL to add to white list:",
"description": ""
},
"inputWhitelist": {
"message": "Input domain or URL \"RegExp\" to add to white list:",
"description": ""
},
"inputWhitelistDomain": {
"message": "Input domain to add to white list:", "message": "Input domain to add to white list:",
"description": "" "description": ""
}, },
"inputWhitelistURL": {
"message": "Input URL \"RegExp\" to add to white list:",
"description": ""
},
"selectSessionWhitelist": {
"message": "Select domain or URL to add to the session white list:",
"description": ""
},
"inputSessionWhitelist": {
"message": "Input domain or URL \"RegExp\" to add to the session white list:",
"description": ""
},
"inputSessionWhitelistDomain": { "inputSessionWhitelistDomain": {
"message": "Input URL \"RegExp\" to add to the session white list:", "message": "Input domain to add to the session white list:",
"description": "" "description": ""
}, },
"inputSessionWhitelistURL": { "inputSessionWhitelistURL": {
"message": "Input domain to add to the session white list:", "message": "Input URL \"RegExp\" to add to the session white list:",
"description": "" "description": ""
}, },
"settings": { "settings": {
@ -753,6 +781,15 @@
"description": "" "description": ""
}, },
"storeNotificationData_title": {
"message": "Store detail data of the notifications",
"description": ""
},
"storeNotificationData_description": {
"message": "",
"description": ""
},
"inspectImage": { "inspectImage": {
"message": "inspect image", "message": "inspect image",
"description": "" "description": ""

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
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="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="17"
height="19"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pageAction-ignorelistDomain.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="49.848596"
inkscape:cy="25.401849"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1600"
inkscape:window-height="848"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1033.3622)">
<text
xml:space="preserve"
style="font-size:144px;font-style:normal;font-weight:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="-2.5989053"
y="1016.2492"
id="text3755"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3757"
x="-2.5989053"
y="1016.2492"
style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;text-anchor:start;font-family:Times New Roman;-inkscape-font-specification:Times New Roman">www.</tspan></text>
<path
inkscape:connector-curvature="0"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#919191;fill-opacity:1;stroke:none;stroke-width:5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
d="m 8.7680531,1033.5273 c -0.348299,0.01 -0.667634,0.033 -0.953125,0.047 -0.438898,0.022 -1.058414,-0.01 -1.796875,0.2031 -0.884045,0.2512 -1.775855,0.6432 -2.562499,1.2656 -0.898661,0.711 -1.888393,1.6298 -2.390626,2.9531 a 1.2536462,1.2536462 0 1 0 2.343751,0.8907 c 0.238633,-0.6288 0.855014,-1.3062 1.59375,-1.8907 0.456167,-0.3609 1.062726,-0.6305 1.703124,-0.8125 0.240818,-0.068 0.65655,-0.08 1.234375,-0.1093 0.648213,-0.033 1.198974,-0.072 1.6093747,-0.016 0.6140962,0.085 1.1637372,0.2209 1.5781252,0.4375 0.65097,0.3403 1.249745,0.8112 1.640625,1.3281 0.346939,0.4588 0.539607,0.9009 0.6875,1.6094 a 1.250125,1.250125 0 1 0 2.4375,-0.5 c -0.202225,-0.9688 -0.559493,-1.8565 -1.140625,-2.625 -0.673824,-0.8911 -1.555325,-1.5538 -2.46875,-2.0313 -0.809569,-0.4232 -1.636616,-0.5833 -2.3906252,-0.6875 -0.399437,-0.055 -0.7767007,-0.069 -1.1249997,-0.062 z m 0.0625,4.0937 c -0.191903,-0.01 -0.378031,0 -0.5625,0.015 -0.368938,0.033 -0.730297,0.098 -1.046875,0.1875 -0.725057,0.2052 -1.438147,0.5529 -2.062499,1.0938 -0.919358,0.7963 -1.300668,1.7391 -1.6875,2.2968 -0.401133,0.5784 -0.581049,0.9597 -0.671875,1.0469 -0.242332,0.2326 -0.576986,0.5013 -0.859376,0.6875 -0.282389,0.1862 -0.568921,0.2183 -0.328125,0.2188 a 1.250125,1.250125 0 1 0 0,2.5 c 0.802852,0 1.242602,-0.3214 1.703126,-0.625 0.460523,-0.3037 0.88137,-0.6606 1.21875,-0.9844 0.626249,-0.6011 0.819032,-1.1835 0.984374,-1.4219 0.574753,-0.8287 0.909677,-1.5198 1.265625,-1.8281 0.282899,-0.2451 0.695129,-0.4565 1.125,-0.5781 0.399532,-0.1131 0.7815,-0.1425 1.015625,-0.094 0.06037,0.013 0.3006427,0.1611 0.6874997,0.4219 0.192519,0.1298 0.313125,0.2252 0.359375,0.2812 0.2278552,0.276 0.4024262,0.5826 0.4843752,0.8438 0.07477,0.2382 0.11054,0.6041 0.09375,1.0469 -0.01581,0.417 -0.358331,1.1398 -0.390625,2.2343 -0.01846,0.626 -0.07982,1.472 0.3125,2.3907 0.233369,0.5464 0.558433,1.015 0.90625,1.4218 0.347817,0.4068 0.505767,0.7242 1.25,1.0157 a 1.250125,1.250125 0 1 0 0.9375,-2.3125 c 0.292466,0.1101 -0.07053,-0.082 -0.28125,-0.3282 -0.222452,-0.2601 -0.449744,-0.6113 -0.515625,-0.7656 -0.09996,-0.2341 -0.127871,-0.7168 -0.109375,-1.3437 0.01211,-0.4103 0.333757,-1.1314 0.375,-2.2188 0.0205,-0.5405 0.03235,-1.19 -0.1875,-1.8906 -0.206421,-0.6578 -0.552101,-1.2208 -0.9375,-1.6875 -0.302703,-0.3666 -0.62872,-0.5891 -0.890625,-0.7656 -0.324931,-0.2191 -0.81368,-0.6191 -1.5937502,-0.7813 -0.204165,-0.043 -0.4018457,-0.069 -0.5937497,-0.078 z m 6.4531249,4.3282 a 1.250125,1.250125 0 0 0 -1.125,1.125 l -0.171875,1.4843 a 1.2510265,1.2510265 0 1 0 2.484375,0.2969 l 0.171875,-1.4844 a 1.250125,1.250125 0 0 0 -1.234375,-1.4218 1.250125,1.250125 0 0 0 -0.125,0 z m -7.3749999,0.3281 a 1.250125,1.250125 0 0 0 -1.0625,0.9062 c -0.405514,1.3311 -0.79748,2.038 -1.515624,2.8907 -0.621831,0.7383 -1.551617,1.4353 -2.390625,1.8437 a 1.2508786,1.2508786 0 1 0 1.09375,2.25 c 1.155067,-0.5622 2.317654,-1.4145 3.218749,-2.4844 0.897991,-1.0662 1.510122,-2.2089 1.9843747,-3.7656 a 1.250125,1.250125 0 0 0 -1.2031247,-1.6406 1.250125,1.250125 0 0 0 -0.125,0 z m 1.03125,5.6562 c -0.160705,0 -0.32344,0.024 -0.453125,0.078 -0.25937,0.1072 -0.407801,0.2646 -0.5,0.375 -0.368796,0.4416 -0.275597,0.5394 -0.3125,0.7031 -0.02073,0.028 -0.0865,0.1172 -0.203125,0.25 -0.16964,0.1931 -0.420338,0.4169 -0.6875,0.8125 a 1.250125,1.250125 0 0 0 1.78125,1.7031 1.250125,1.250125 0 0 0 1.9999999,-1.4219 c 4.83e-4,0.01 -0.0035,0 -0.01563,-0.031 -0.01294,-0.047 -0.03793,-0.1564 -0.0625,-0.2812 -0.03977,-0.2021 -0.08156,-0.4521 -0.125,-0.6875 -0.02172,-0.1177 -0.04841,-0.2382 -0.07813,-0.3594 -0.02971,-0.1212 -0.03464,-0.2132 -0.1875,-0.4844 -0.07643,-0.1356 -0.1681422,-0.4079 -0.7031252,-0.5937 -0.133745,-0.046 -0.2924197,-0.065 -0.4531247,-0.062 z"
id="path3753-8" />
<g
id="g3803-8"
transform="matrix(0.44599777,0,0,0.44599846,-0.15099788,1034.1493)"
style="fill:#ff0101;fill-opacity:0.6;stroke:#ff0000;stroke-width:3.36324286;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
<path
inkscape:connector-curvature="0"
style="fill:#ff0101;fill-opacity:0.6;fill-rule:nonzero;stroke:#ff0000;stroke-width:3.36324286;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="M 10.78125,5.125 C 9.6228558,5.031087 8.3153904,5.5344787 7.28125,6.5625 L 6.6875,7.15625 C 5.0328753,8.8010841 4.733916,11.163694 6.03125,12.46875 L 12.53125,19 6,25.46875 c -1.3050563,1.297334 -1.0510841,3.689125 0.59375,5.34375 l 0.59375,0.59375 c 1.6448341,1.654625 4.038694,1.922334 5.34375,0.625 l 6.53125,-6.46875 6.46875,6.5 c 1.297334,1.305056 3.657875,1.051084 5.3125,-0.59375 L 31.4375,30.875 c 1.654625,-1.644834 1.953584,-4.007444 0.65625,-5.3125 l -6.5,-6.53125 L 32.125,12.5625 C 33.430056,11.265166 33.144834,8.8733747 31.5,7.21875 L 30.90625,6.625 C 29.261416,4.9703753 26.898806,4.7026659 25.59375,6 l -6.5,6.46875 -6.5,-6.53125 C 12.10725,5.448104 11.476287,5.1813479 10.78125,5.125 z"
transform="translate(0.33931853,-0.58823573)"
id="rect2988" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
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="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="19"
height="19"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pageAction-whitelistDomain.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="49.848596"
inkscape:cy="42.058864"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1600"
inkscape:window-height="848"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<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:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1033.3622)">
<text
xml:space="preserve"
style="font-size:144px;font-style:normal;font-weight:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="-4.8717484"
y="1008.9256"
id="text3755"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3757"
x="-4.8717484"
y="1008.9256"
style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;text-anchor:start;font-family:Times New Roman;-inkscape-font-specification:Times New Roman">www.</tspan></text>
<path
style="fill:none;stroke:#00be00;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 4.1668789,1040.8717 c 2.65165,3.1567 3.661803,3.788 4.293148,8.5863 0.883884,-3.7881 2.3550471,-9.0615 7.0710681,-13.3846"
id="path2985"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
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="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="19"
height="19"
id="svg2"
version="1.1"
inkscape:version="0.92.2 2405546, 2018-03-11"
sodipodi:docname="pageAction-whitelistDomainTemporarily.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="34.759442"
inkscape:cy="26.906576"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1600"
inkscape:window-height="841"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<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:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1033.3622)">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
x="-4.8717484"
y="1008.9256"
id="text3755"><tspan
sodipodi:role="line"
id="tspan3757"
x="-4.8717484"
y="1008.9256"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:1.25;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman';text-align:start;text-anchor:start">www.</tspan></text>
<path
style="fill:none;stroke:#00be00;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 4.1668789,1040.8717 c 2.65165,3.1567 3.661803,3.788 4.293148,8.5863 0.883884,-3.7881 2.3550471,-9.0615 7.0710681,-13.3846"
id="path2985"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<g
id="g1396"
transform="matrix(1.25,0,0,1.25,-4.2499997,-262.84053)"
style="fill:#ffffff;fill-opacity:1">
<circle
r="3.6056104"
cy="1047.3622"
cx="13"
id="path1366"
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#bbbbbb;stroke-width:0.78877938;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path1368"
d="m 13.188069,1044.9014 v 2.5254"
style="fill:#ffffff;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path1370"
d="m 13.188069,1047.4268 2.466712,-1.2334"
style="fill:#ffffff;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -68,9 +68,13 @@
} }
}); });
var notifications = []; var notifications = [];
var notificationCounter = {};
function notify(data){ function notify(data){
if (!settings.ignoredAPIs[data.api]){ if (!settings.ignoredAPIs[data.api]){
if (settings.storeNotificationData){
notifications.push(data); notifications.push(data);
}
notificationCounter[data.messageId] = (notificationCounter[data.messageId] || 0) + 1;
port.postMessage({"canvasBlocker-notify": data}); port.postMessage({"canvasBlocker-notify": data});
} }
} }
@ -154,6 +158,8 @@
notice("sending notifications:", notifications); notice("sending notifications:", notifications);
browser.runtime.sendMessage({ browser.runtime.sendMessage({
sender: tabId, sender: tabId,
url: window.location.href,
"canvasBlocker-notificationCounter": notificationCounter,
"canvasBlocker-notifications": notifications "canvasBlocker-notifications": notifications
}); });
notice("notifications sent"); notice("notifications sent");

View File

@ -184,6 +184,10 @@
name: "displayBadge", name: "displayBadge",
defaultValue: true defaultValue: true
}, },
{
name: "storeNotificationData",
defaultValue: false
},
{ {
name: "storeImageForInspection", name: "storeImageForInspection",
defaultValue: false defaultValue: false

View File

@ -209,11 +209,21 @@
{ {
"name": "highlightBrowserAction" "name": "highlightBrowserAction"
}, },
{
"name": "storeNotificationData",
"displayDependencies": [
{
"showNotifications": [true],
"displayAdvancedSettings": [true]
}
]
},
{ {
"name": "storeImageForInspection", "name": "storeImageForInspection",
"displayDependencies": [ "displayDependencies": [
{ {
"showNotifications": [true], "showNotifications": [true],
"storeNotificationData": [true],
"displayAdvancedSettings": [true] "displayAdvancedSettings": [true]
} }
] ]

View File

@ -25,14 +25,27 @@
}; };
}(); }();
const DomainNotification = function DomainNotification(domain, messageId){ const DomainNotification = function DomainNotification(domain, messageId, count = 0){
if (domain instanceof URL){
this.urls().add(domain.href);
domain = domain.hostname;
}
this.domain = domain; this.domain = domain;
this.messageId = messageId; this.messageId = messageId;
this.count = count;
this.extraNotifications = 0; this.extraNotifications = 0;
addToContainer(this); addToContainer(this);
this.update(); this.update();
}; };
DomainNotification.prototype.urls = function urls(){
const urls = new Set();
this.urls = function(){
return urls;
};
return urls;
};
DomainNotification.prototype.notifications = function notifications(){ DomainNotification.prototype.notifications = function notifications(){
const notifications = []; const notifications = [];
this.notifications = function(){ this.notifications = function(){
@ -47,6 +60,7 @@
} }
else { else {
this.notifications().push(notification); this.notifications().push(notification);
this.urls().add(notification.url.href);
this.notificationsNode().appendChild(notification.node()); this.notificationsNode().appendChild(notification.node());
} }
this.update(); this.update();
@ -77,6 +91,7 @@
}; };
DomainNotification.prototype.update = function update(){ DomainNotification.prototype.update = function update(){
this.updateTextNode(); this.updateTextNode();
this.node().classList[this.notifications().length? "remove": "add"]("empty");
this.notifications().forEach(function(notification){ this.notifications().forEach(function(notification){
notification.update(); notification.update();
}); });
@ -110,28 +125,29 @@
DomainNotification.prototype.updateTextNode = function updateTextNode(){ DomainNotification.prototype.updateTextNode = function updateTextNode(){
const node = this.textNode(); const node = this.textNode();
const notifications = this.notifications(); const notifications = this.notifications();
const urls = notifications.map(function(not){ const urls = Array.from(this.urls()).join("\n");
return not.url;
}).filter(function(url, i, urls){
return urls.indexOf(url) === i;
}).join("\n");
node.querySelectorAll(".url").forEach((urlSpan) => { node.querySelectorAll(".url").forEach((urlSpan) => {
urlSpan.title = urls + (this.extraNotifications? "\n...": ""); urlSpan.title = urls;
}); });
node.title = notifications.map(function(notification){ node.title = notifications.map(function(notification){
return notification.timestamp + ": " + notification.functionName; return notification.timestamp + ": " + notification.functionName;
}).join("\n") + this.extraNotifications? "\n...": ""; }).join("\n") + (this.extraNotifications? "\n...": "");
node.querySelectorAll(".count").forEach((countSpan) => { node.querySelectorAll(".count").forEach((countSpan) => {
if (this.count){
countSpan.textContent = this.count;
}
else {
countSpan.textContent = notifications.length + this.extraNotifications; countSpan.textContent = notifications.length + this.extraNotifications;
}
}); });
}; };
DomainNotification.prototype.actionsNode = function actionsNode(){ DomainNotification.prototype.actionsNode = function actionsNode(){
const node = document.createElement("div"); const node = document.createElement("div");
node.className = "actions"; node.className = "actions";
createActionButtons(node, actions, this.domain); createActionButtons(node, actions, {domain: this.domain, urls: this.urls()});
this.actionsNode = function(){ this.actionsNode = function(){
return node; return node;
}; };
@ -148,12 +164,18 @@
}; };
const domains = new Map(); const domains = new Map();
const domainNotification = function(domain, messageId){ const domainNotification = function(url, messageId, count = 0){
const domain = url.hostname;
var domainNotification = domains.get(domain + messageId); var domainNotification = domains.get(domain + messageId);
if (!domainNotification){ if (!domainNotification){
domainNotification = new DomainNotification(domain, messageId); domainNotification = new DomainNotification(url, messageId, count);
domains.set(domain + messageId, domainNotification); domains.set(domain + messageId, domainNotification);
} }
else {
domainNotification.count += count;
domainNotification.urls().add(url.href);
domainNotification.update();
}
return domainNotification; return domainNotification;
}; };
domainNotification.addAction = addAction; domainNotification.addAction = addAction;

View File

@ -58,12 +58,29 @@
}); });
}; };
scope.modalChoice = function modalChoice(messageText, choices){
message("open modal choice");
return new Promise(function(resolve, reject){
document.body.innerHTML = "";
document.body.className = "modal";
document.body.appendChild(document.createTextNode(messageText));
choices.forEach(function(choice){
const button = document.createElement("button");
button.addEventListener("click", function(){
resolve(choice.value || choice);
message("modal choice closed with value", choice.value || choice);
});
button.appendChild(document.createTextNode(choice.text || choice));
document.body.appendChild(button);
});
});
};
scope.modalPrompt = function modalPrompt(messageText, defaultValue){ scope.modalPrompt = function modalPrompt(messageText, defaultValue){
message("open modal prompt"); message("open modal prompt");
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
document.body.innerHTML = ""; document.body.innerHTML = "";
document.body.className = "modal";
document.body.appendChild(document.createTextNode(messageText)); document.body.appendChild(document.createTextNode(messageText));
var input = document.createElement("input"); var input = document.createElement("input");
input.value = defaultValue; input.value = defaultValue;

View File

@ -14,3 +14,11 @@ body {
.hasHiddenActions:hover, .hasHiddenActions .actions { .hasHiddenActions:hover, .hasHiddenActions .actions {
background-color: rgb(92, 92, 97); background-color: rgb(92, 92, 97);
} }
.modal button {
border-color: rgb(92, 92, 97);
}
.modal button:active, .modal button:hover, .modal button:focus {
background-color: rgb(92, 92, 97);
}

View File

@ -14,3 +14,11 @@ body {
.hasHiddenActions:hover, .hasHiddenActions .actions { .hasHiddenActions:hover, .hasHiddenActions .actions {
background-color: rgb(236, 237, 236); background-color: rgb(236, 237, 236);
} }
.modal button {
border-color: rgb(236, 237, 236);
}
.modal button:active, .modal button:hover, .modal button:focus {
background-color: rgb(236, 237, 236);
}

View File

@ -14,3 +14,11 @@ body {
.hasHiddenActions:hover, .hasHiddenActions .actions { .hasHiddenActions:hover, .hasHiddenActions .actions {
background-color: rgb(240, 240, 240); background-color: rgb(240, 240, 240);
} }
.modal button {
border-color: rgb(240, 240, 240);
}
.modal button:active, .modal button:hover, .modal button:focus {
background-color: rgb(240, 240, 240);
}

View File

@ -6,6 +6,7 @@ body {
margin: 0.5em; margin: 0.5em;
padding: 2px; padding: 2px;
padding-right: 23px; padding-right: 23px;
padding-bottom: 1.5em;
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
} }
@ -85,6 +86,9 @@ button.action img {
position: relative; position: relative;
margin: 0; margin: 0;
} }
.collapsible.empty .collapser {
display: none;
}
.collapsible.collapsed .collapser { .collapsible.collapsed .collapser {
display: inline-block; display: inline-block;
width: 20px; width: 20px;
@ -108,6 +112,9 @@ button.action img {
.collapsible .collapser .less { .collapsible .collapser .less {
display: inline; display: inline;
} }
.collapsible.empty .collapser, .collapsible.collapsed.empty .collapser {
display: none;
}
.collapsible.collapsed .collapsing { .collapsible.collapsed .collapsing {
height: 0px; height: 0px;
overflow: hidden; overflow: hidden;
@ -118,3 +125,46 @@ button.action img {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
/* modal display*/
body.modal {
padding: 2px;
}
.modal input {
display: block;
box-sizing: border-box;
width: 100%;
}
.modal button {
display: block;
padding: 0.5em;
background-color: transparent;
border: 1px solid currentColor;
cursor: pointer;
width: 100%;
text-align: left;
height: auto;
z-index: 1;
position: relative;
white-space: nowrap;
color: currentColor;
}
.modal button + .modal button {
border-top-width: 0;
}
.modal button:first-child {
border-radius: 3px 3px 0 0;
}
.modal button:last-child {
border-radius: 0 0 3px 3px;
}
.modal button:active, .modal button:hover, .modal button:focus {
z-index: 10;
}

View File

@ -11,7 +11,7 @@
const domainNotification = require("./domainNotification"); const domainNotification = require("./domainNotification");
const Notification = require("./Notification"); const Notification = require("./Notification");
const {createActionButtons, modalPrompt} = require("./gui"); const {createActionButtons, modalPrompt, modalChoice} = require("./gui");
const lists = require("./lists"); const lists = require("./lists");
Promise.all([ Promise.all([
@ -69,19 +69,44 @@
throw new Error("tooManyTabsFound"); throw new Error("tooManyTabsFound");
} }
function domainOrUrlPicker(domain, urls, selectText, urlInputText){
const choices = Array.from(urls).map(function(url){
return {
text: url,
value: "^" + url.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "$"
};
});
choices.unshift(domain);
return modalChoice(
selectText,
choices
).then(function(choice){
if (choice.startsWith("^")){
return modalPrompt(
urlInputText,
choice
);
}
else {
return choice;
}
});
}
verbose("registering domain actions"); verbose("registering domain actions");
[ [
{ {
name: "ignorelistDomain", name: "ignorelist",
isIcon: true, isIcon: true,
callback: function(domain){ callback: function({domain, urls}){
modalPrompt( domainOrUrlPicker(
browser.i18n.getMessage("inputIgnoreDomain"), domain,
domain urls,
).then(function(domain){ browser.i18n.getMessage("selectIgnore"),
if (domain){ browser.i18n.getMessage("inputIgnoreURL")
settings.set("showNotifications", false, domain).then(function(){ ).then(function(choice){
if (choice){
settings.set("showNotifications", false, choice).then(function(){
window.close(); window.close();
}); });
} }
@ -92,15 +117,17 @@
} }
}, },
{ {
name: "whitelistDomain", name: "whitelist",
isIcon: true, isIcon: true,
callback: function(domain){ callback: function({domain, urls}){
modalPrompt( domainOrUrlPicker(
browser.i18n.getMessage("inputWhitelistURL"), domain,
domain urls,
).then(function(domain){ browser.i18n.getMessage("selectWhitelist"),
if (domain){ browser.i18n.getMessage("inputWhitelistURL")
settings.set("blockMode", "allow", domain).then(function(){ ).then(function(choice){
if (choice){
settings.set("blockMode", "allow", choice).then(function(){
window.close(); window.close();
}); });
} }
@ -111,15 +138,17 @@
} }
}, },
{ {
name: "whitelistDomainTemporarily", name: "whitelistTemporarily",
isIcon: true, isIcon: true,
callback: function(domain){ callback: function({domain, urls}){
modalPrompt( domainOrUrlPicker(
browser.i18n.getMessage("inputSessionWhitelistURL"), domain,
domain urls,
).then(function(domain){ browser.i18n.getMessage("selectSessionWhitelist"),
if (domain){ browser.i18n.getMessage("inputSessionWhitelistURL")
lists.appendTo("sessionWhite", domain).then(function(){ ).then(function(choice){
if (choice){
lists.appendTo("sessionWhite", choice).then(function(){
window.close(); window.close();
}); });
} }
@ -148,44 +177,6 @@
callback: function({errorStack}){ callback: function({errorStack}){
alert(parseErrorStack(errorStack)); alert(parseErrorStack(errorStack));
} }
},
{
name: "whitelistURL",
isIcon: true,
callback: function({url}){
modalPrompt(
browser.i18n.getMessage("inputWhitelistDomain"),
"^" + url.href.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "$"
).then(function(url){
if (url){
settings.set("blockMode", "allow", url).then(function(){
window.close();
});
}
else {
window.close();
}
});
}
},
{
name: "whitelistURLTemporarily",
isIcon: true,
callback: function({url}){
modalPrompt(
browser.i18n.getMessage("inputSessionWhitelistDomain"),
"^" + url.href.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "$"
).then(function(url){
if (url){
lists.appendTo("sessionWhite", url).then(function(){
window.close();
});
}
else {
window.close();
}
});
}
} }
].forEach(function(action){ ].forEach(function(action){
Notification.addAction(action); Notification.addAction(action);
@ -193,7 +184,20 @@
var tab = tabs[0]; var tab = tabs[0];
browser.runtime.onMessage.addListener(function(data){ browser.runtime.onMessage.addListener(function(data){
if (Array.isArray(data["canvasBlocker-notifications"])){ if (data["canvasBlocker-notificationCounter"]){
const url = new URL(data.url);
Object.keys(data["canvasBlocker-notificationCounter"]).forEach(function(key){
const notification = domainNotification(
url,
key,
data["canvasBlocker-notificationCounter"][key]
);
});
}
if (
Array.isArray(data["canvasBlocker-notifications"]) &&
data["canvasBlocker-notifications"].length
){
message("got notifications"); message("got notifications");
const notifications = data["canvasBlocker-notifications"]; const notifications = data["canvasBlocker-notifications"];
let i = 0; let i = 0;
@ -205,13 +209,14 @@
else { else {
for (var delta = 0; delta < 20 && i + delta < length; delta += 1){ for (var delta = 0; delta < 20 && i + delta < length; delta += 1){
let notification = notifications[i + delta]; let notification = notifications[i + delta];
verbose(notification);
if (settings.ignoredAPIs[notification.api]){ if (settings.ignoredAPIs[notification.api]){
continue; continue;
} }
verbose(notification); verbose(notification);
notification.url = new URL(notification.url); notification.url = new URL(notification.url);
domainNotification( domainNotification(
notification.url.hostname, notification.url,
notification.messageId notification.messageId
).addNotification(new Notification(notification)); ).addNotification(new Notification(notification));
} }

View File

@ -1,10 +1,12 @@
Version 0.5.4: Version 0.5.4:
changes: changes:
- converted "API whitelist" to "protected API features" (automatic settings migration) - converted "API whitelist" to "protected API features" (automatic settings migration)
- notification details are not stored by default
new features: new features:
- added save/load directly to/from file option - added save/load directly to/from file option
- added protection for DOMRect (getClientRects) - added protection for DOMRect (getClientRects)
- added setting to control if notification details should be stored
fixes: fixes:
- window and audio API were always blocked when using any of the "block ..." modes - window and audio API were always blocked when using any of the "block ..." modes