📝 Added entire config directory for backup purposes
This commit is contained in:
parent
4b38e59bb6
commit
9b946e2d14
11091 changed files with 1440953 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="7.1673mm" width="7.2061mm" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 25.5334 25.395792">
|
||||
<g transform="translate(177.77 -519.66)">
|
||||
<path d="m-165 519.66c-2.6196 0-4.9735 0.71508-7.2323 2.1971-0.9279 0.60864-2.7283 2.4092-3.337 3.337-1.4712 2.2424-2.1972 4.6154-2.1972 7.1819 0 2.5788 0.7141 4.9223 2.1797 7.1552 0.6309 0.96123 2.4192 2.7501 3.3802 3.3808 1.4791 0.97083 3.2841 1.71 4.9268 2.0176 1.0838 0.20297 3.9457 0.15209 5.0159-0.0894 2.4596-0.55481 4.4742-1.6723 6.29-3.4887 2.4847-2.4856 3.7408-5.4989 3.7408-8.9756 0-3.4682-1.2629-6.498-3.7405-8.9756-2.4919-2.4919-5.5045-3.7404-9.0264-3.7404z" fill="#7db69f"/>
|
||||
<path d="m-165.02 528.24c-0.8699 0-1.6514 0.23746-2.4016 0.72959-0.3081 0.20212-0.9061 0.80004-1.1081 1.1081-0.4886 0.74466-0.7298 1.5326-0.7298 2.3849 0 0.85636 0.2371 1.6346 0.724 2.3761 0.2094 0.3192 0.8033 0.91326 1.1224 1.1227 0.4911 0.32239 1.0906 0.56785 1.6361 0.67001 0.3598 0.0673 1.3102 0.0504 1.6658-0.0297 0.8167-0.18424 1.4856-0.55532 2.0886-1.1585 0.8251-0.8254 1.2423-1.826 1.2423-2.9806 0-1.1517-0.4195-2.1578-1.2421-2.9806-0.8277-0.82751-1.8279-1.2421-2.9976-1.2421z" fill="#4a826c"/>
|
||||
<path d="m-2404.4 671.18c-3.2399-0.0194-6.3107 1.2365-8.6289 3.5547 0 0.002 0 0.004-0.01 0.006-1.9541 1.9569-3.1473 4.4242-3.4687 7.1758-0.1336 1.143-0.1324 1.8177 0.2265 2.3984 0.3941 0.63745 0.9181 0.94336 1.6758 0.94336 0.2981 0 0.6535-0.10695 0.916-0.24414 0.2434-0.12713 0.6126-0.46272 0.7539-0.69141 0.065-0.10555 0.202-0.39493 0.2403-0.56641 0.053-0.23546 0.061-0.41065 0.084-0.74218 0.088-1.2626 0.2865-2.0912 0.7089-3.0312 0.4385-0.97557 0.9254-1.6871 1.6778-2.4395 1.2078-1.2078 2.6659-1.965 4.3828-2.2754 0.3293-0.0595 0.7416-0.0624 1.2617-0.0684s1.0247-0.004 1.3828 0.0469c0.3661 0.0518 0.6053 0.0832 0.9219 0.0391 0.2645-0.0368 0.6003-0.19398 0.791-0.32031 0.8224-0.54467 1.1248-1.5151 0.707-2.4219a0.6513 0.6513 0 0 1 0 -0.002c-0.1439-0.31257-0.5075-0.75154-0.8496-0.92969-0.4136-0.21541-0.8031-0.27857-1.3769-0.3457-0.4667-0.0546-0.9332-0.0832-1.3985-0.0859zm9.3692 6.3516c-1.074-0.004-1.9883 0.87522-1.9883 1.957 0 1.3647 1.5564 2.3925 2.7988 1.8066 0.3338-0.1574 0.8593-0.69555 0.9922-1.0137 0.5288-1.2658-0.423-2.7422-1.8008-2.75zm-1.291 9.6602c-0.5015 0.009-1.1313 0.39448-1.4707 0.78906-0.7801 0.90716-0.9293 1.0694-1.2911 1.3887-1.0664 0.94113-2.4514 1.6118-3.957 1.9062-0.394 0.0771-0.8958 0.072-1.4824 0.0664-0.5866-0.006-1.0998-0.0118-1.4941-0.0957l0.1328 0.0137a0.6513 0.6513 0 0 1 -0.1328 -0.0137c-1.5797-0.33594-2.8091-0.96601-4.0195-2.0606-0.3529-0.31903-0.5674-0.50965-0.8692-0.67969-0.2288-0.12895-0.689-0.22851-0.8945-0.22851-1.03 0-1.951 0.94359-1.9551 1.9688v0.002a0.6513 0.6513 0 0 1 0 0.002c0 0.26313 0.1216 0.80286 0.3028 1.0781 0.2346 0.35637 0.5009 0.59192 0.957 0.99805 1.8218 1.622 4.2177 2.6942 6.6543 2.9746 0.7641 0.0879 1.9155 0.0871 2.6895 0.002 2.1894-0.23969 4.2945-1.0791 6.0489-2.4082 0.7055-0.53445 1.6855-1.491 2.2129-2.1816 0.2682-0.35126 0.4557-0.64063 0.5664-1.0176 0.098-0.33319 0.076-0.788-0.01-1.0938-0.1165-0.42605-0.279-0.59899-0.5546-0.85157-0.2646-0.24237-0.4858-0.39738-0.8809-0.49218-0.1798-0.0432-0.3602-0.0694-0.5527-0.0664z" fill-rule="evenodd" transform="matrix(.82404 0 0 .82404 1816.1 -30.489)" fill="#f1f7f5"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
|
|
@ -0,0 +1,397 @@
|
|||
/**
|
||||
* Sections
|
||||
*/
|
||||
|
||||
body {
|
||||
background-color: #f0f0f0;
|
||||
color: #555;
|
||||
cursor: default;
|
||||
font-family: 'Noto Sans', Arial, sans-serif !important;
|
||||
font-size: 75%;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
max-width: 348px;
|
||||
}
|
||||
|
||||
header {
|
||||
align-items: center;
|
||||
border-bottom: solid #d3d3d3 1px;
|
||||
display: flex;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.panel {
|
||||
overflow: hidden;
|
||||
padding: 10px 8px;
|
||||
}
|
||||
|
||||
.panel:not(:last-child) {
|
||||
border-bottom: 1px solid #d8d8d8;
|
||||
}
|
||||
|
||||
.subpanel {
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
footer {
|
||||
overflow: hidden;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonts
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url('../../modules/noto-sans/noto-sans.woff2')
|
||||
format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
src: url('../../modules/noto-sans/noto-sans-bold.woff2')
|
||||
format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
src: url('../../modules/noto-sans/noto-sans-italic.woff2')
|
||||
format('woff2');
|
||||
}
|
||||
|
||||
/**
|
||||
* Headings
|
||||
*/
|
||||
|
||||
.heading {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.subheading {
|
||||
font-weight: 600;
|
||||
margin-bottom: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists
|
||||
*/
|
||||
|
||||
.list {
|
||||
margin: 0;
|
||||
padding: 8px 0 0;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #e4e4e4;
|
||||
color: #555;
|
||||
font-weight: 600;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.sublist {
|
||||
align-items: center;
|
||||
background-color: #ececec;
|
||||
border: 1px solid #e0e0e0;
|
||||
box-shadow: inset 0 2px 10px #e2e2e2;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sublist:last-child {
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.sublist-item {
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
color: #555;
|
||||
font-weight: 600;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.sublist-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icons
|
||||
*/
|
||||
|
||||
.icon {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.icon-logo {
|
||||
height: 26px;
|
||||
padding: 14px 6px 14px 8px;
|
||||
width: 26px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
.button {
|
||||
-moz-user-select: none;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #cfcfcf;
|
||||
color: #5f5f5f;
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-size: 12px;
|
||||
padding: 5px 22px;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.button-toggle {
|
||||
border-color: #d8d8d8;
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.button-toggle.active {
|
||||
border-color: #cfcfcf;
|
||||
color: #339a6f;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.button:focus {
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #bbb;
|
||||
box-shadow: 0 0 4px #b9b9b9;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.button:active {
|
||||
background-color: #dedede;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links
|
||||
*/
|
||||
|
||||
.link-text {
|
||||
color: #6d6d6d;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
margin: 6px 0 0 2px;
|
||||
padding: 1px 2px 4px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.link-text:hover {
|
||||
color: #555;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.link-text:focus {
|
||||
color: #555;
|
||||
outline-color: #555;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
.badge {
|
||||
background: #fbfbfb;
|
||||
border-radius: 10px;
|
||||
border: 2px solid #7db69f;
|
||||
color: #4a7767;
|
||||
font-family: monospace;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin-right: 7px;
|
||||
padding: 0 13px;
|
||||
}
|
||||
|
||||
.counter {
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
margin-top: 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: #6d6d6d;
|
||||
font-style: italic;
|
||||
margin: 0 6px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.label-version {
|
||||
color: #457763;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.label-domain {
|
||||
color: #6d6d6d;
|
||||
display: flex;
|
||||
font-style: italic;
|
||||
overflow: hidden;
|
||||
padding: 6px 0 0 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.side-note {
|
||||
color: #646464;
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility
|
||||
*/
|
||||
|
||||
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
||||
|
||||
body {
|
||||
width: 348px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
/**
|
||||
* Sections
|
||||
*/
|
||||
|
||||
body {
|
||||
background-color: #404040;
|
||||
color: #f9f9fa;
|
||||
}
|
||||
|
||||
header {
|
||||
border-bottom-color: #292929;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists
|
||||
*/
|
||||
|
||||
.list-item {
|
||||
background-color: #484848;
|
||||
border-color: #292929;
|
||||
color: #f0f0f0;
|
||||
}
|
||||
|
||||
.sublist {
|
||||
background-color: #323232;
|
||||
border-color: #292929;
|
||||
box-shadow: inset 0 2px 10px #292929;
|
||||
}
|
||||
|
||||
.sublist:last-child {
|
||||
border-bottom-color: #292929;
|
||||
}
|
||||
|
||||
.sublist-item {
|
||||
border-bottom-color: #2c2c2c;
|
||||
color: #f0f0f0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
.button {
|
||||
background-color: #3c3c3c;
|
||||
border-color: #292929;
|
||||
color: #dadada;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: #434343;
|
||||
}
|
||||
|
||||
.button:focus {
|
||||
background-color: #434343;
|
||||
border-color: #292929;
|
||||
box-shadow: 0 0 4px #323232;
|
||||
}
|
||||
|
||||
.button:active {
|
||||
background-color: #393939;
|
||||
}
|
||||
|
||||
.button-toggle {
|
||||
border-color: #363636;
|
||||
color: #636363;
|
||||
}
|
||||
|
||||
.button-toggle.active {
|
||||
border-color: #292929;
|
||||
color: #3dbb87;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links
|
||||
*/
|
||||
|
||||
.link-text {
|
||||
color: #dadada;
|
||||
}
|
||||
|
||||
.link-text:hover {
|
||||
color: #f9f9fa;
|
||||
}
|
||||
|
||||
.link-text:focus {
|
||||
color: #f9f9fa;
|
||||
outline-color: #dadada;
|
||||
}
|
||||
|
||||
/**
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
.badge {
|
||||
background-color: #323232;
|
||||
border-color: #4a826c;
|
||||
color: #f9f9fa;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: #dadada;
|
||||
}
|
||||
|
||||
.label-version {
|
||||
color: #93d7bc;
|
||||
}
|
||||
|
||||
.label-domain {
|
||||
color: #dadada;
|
||||
}
|
||||
|
||||
.panel:not(:last-child) {
|
||||
border-bottom-color: #292929;
|
||||
}
|
||||
|
||||
.side-note {
|
||||
color: #dadada;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Decentraleyes Popup</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="popup.css">
|
||||
|
||||
<script defer src="../../modules/internal/icons.js"></script>
|
||||
<script defer src="../../modules/fontawesome/fontawesome.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script src="../../core/constants.js"></script>
|
||||
<script src="../../modules/internal/helpers.js"></script>
|
||||
|
||||
<script src="popup.js"></script>
|
||||
|
||||
<div id="wrapper" class="hidden">
|
||||
|
||||
<header>
|
||||
|
||||
<img class="icon-logo" src="icon.svg" alt="Extension Icon">
|
||||
<div class="heading">Decentraleyes <sup id="version-label" class="label-version"></sup></div>
|
||||
|
||||
</header>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<div id="website-context" class="panel hidden">
|
||||
|
||||
<div class="subpanel">
|
||||
|
||||
<div id="protection-toggle-button" class="button button-toggle active" tabindex="0">
|
||||
<i class="fai fa-power-off" data-fa-transform="grow-2 down-.5"></i>
|
||||
</div>
|
||||
|
||||
<div class="label-domain">
|
||||
<i class="icon fai fa-globe fa-lg" data-fa-transform="down-1"></i>
|
||||
<span id="domain-indicator"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="extension-context" class="panel">
|
||||
|
||||
<div id="injection-counter" class="counter">0</div>
|
||||
|
||||
<div class="subheading" data-i18n-content="amountInjectedTitle"></div>
|
||||
<div class="description" data-i18n-content="amountInjectedDescription"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
|
||||
<span id="testing-utility-link" class="link-text" tabindex="0">decentraleyes.org/test</span>
|
||||
|
||||
<div id="options-button" class="button" data-i18n-title="optionsTitle" tabindex="0">
|
||||
<i class="fai fa-cog" data-fa-transform="grow-2 down-.5"></i>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,429 @@
|
|||
/**
|
||||
* Main Popup Page
|
||||
* Belongs to Decentraleyes.
|
||||
*
|
||||
* @author Thomas Rientjes
|
||||
* @since 2016-08-09
|
||||
* @license MPL 2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Popup
|
||||
*/
|
||||
|
||||
var popup = {};
|
||||
|
||||
/**
|
||||
* Private Methods
|
||||
*/
|
||||
|
||||
popup._renderContents = function () {
|
||||
|
||||
helpers.insertI18nContentIntoDocument(document);
|
||||
helpers.insertI18nTitlesIntoDocument(document);
|
||||
|
||||
popup._renderNonContextualContents();
|
||||
|
||||
popup._determineTargetTab()
|
||||
.then(popup._determineDomainWhitelistStatus)
|
||||
.then(popup._determineResourceInjections)
|
||||
.then(popup._renderContextualContents)
|
||||
.then(popup._showRenderedContents);
|
||||
};
|
||||
|
||||
popup._renderNonContextualContents = function () {
|
||||
|
||||
let versionLabelElement, counterElement, testingUtilityLinkElement, optionsButtonElement;
|
||||
|
||||
versionLabelElement = document.getElementById('version-label');
|
||||
counterElement = document.getElementById('injection-counter');
|
||||
testingUtilityLinkElement = document.getElementById('testing-utility-link');
|
||||
optionsButtonElement = document.getElementById('options-button');
|
||||
|
||||
versionLabelElement.innerText = popup._version;
|
||||
counterElement.innerText = helpers.formatNumber(popup._amountInjected);
|
||||
|
||||
testingUtilityLinkElement.addEventListener('mouseup', popup._onTestingUtilityLinkClicked);
|
||||
optionsButtonElement.addEventListener('mouseup', popup._onOptionsButtonClicked);
|
||||
|
||||
testingUtilityLinkElement.addEventListener('keydown', function (event) {
|
||||
|
||||
let enterOrSpaceKeyPressed = helpers.enterOrSpaceKeyPressed(event);
|
||||
|
||||
if (enterOrSpaceKeyPressed) {
|
||||
|
||||
chrome.tabs.create({
|
||||
'url': 'https://decentraleyes.org/test'
|
||||
});
|
||||
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
|
||||
optionsButtonElement.addEventListener('keydown', function (event) {
|
||||
|
||||
let enterOrSpaceKeyPressed = helpers.enterOrSpaceKeyPressed(event);
|
||||
|
||||
if (enterOrSpaceKeyPressed) {
|
||||
|
||||
chrome.runtime.openOptionsPage();
|
||||
return window.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
popup._renderContextualContents = function () {
|
||||
|
||||
if (popup._domain !== null) {
|
||||
popup._renderDomainWhitelistPanel();
|
||||
}
|
||||
|
||||
if (Object.keys(popup._resourceInjections).length > 0) {
|
||||
popup._renderInjectionPanel(popup._resourceInjections);
|
||||
}
|
||||
};
|
||||
|
||||
popup._showRenderedContents = function () {
|
||||
document.getElementById('wrapper').classList.remove('hidden');
|
||||
};
|
||||
|
||||
popup._renderDomainWhitelistPanel = function () {
|
||||
|
||||
let websiteContextElement, protectionToggleElement, domainIndicatorElement;
|
||||
|
||||
websiteContextElement = document.getElementById('website-context');
|
||||
protectionToggleElement = document.getElementById('protection-toggle-button');
|
||||
domainIndicatorElement = document.getElementById('domain-indicator');
|
||||
|
||||
protectionToggleElement.setAttribute('dir', popup._scriptDirection);
|
||||
domainIndicatorElement.innerText = popup._domain;
|
||||
|
||||
if (popup._domainIsWhitelisted === true) {
|
||||
|
||||
let enableProtectionTitle = chrome.i18n.getMessage('enableProtectionTitle');
|
||||
|
||||
protectionToggleElement.setAttribute('class', 'button button-toggle');
|
||||
protectionToggleElement.addEventListener('click', popup._enableProtection);
|
||||
protectionToggleElement.setAttribute('title', enableProtectionTitle);
|
||||
|
||||
protectionToggleElement.addEventListener('keydown', function (event) {
|
||||
|
||||
let enterOrSpaceKeyPressed = helpers.enterOrSpaceKeyPressed(event);
|
||||
|
||||
if (enterOrSpaceKeyPressed) {
|
||||
popup._enableProtection();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
let disableProtectionTitle = chrome.i18n.getMessage('disableProtectionTitle');
|
||||
|
||||
protectionToggleElement.setAttribute('class', 'button button-toggle active');
|
||||
protectionToggleElement.addEventListener('click', popup._disableProtection);
|
||||
protectionToggleElement.setAttribute('title', disableProtectionTitle);
|
||||
|
||||
protectionToggleElement.addEventListener('keydown', function (event) {
|
||||
|
||||
let enterOrSpaceKeyPressed = helpers.enterOrSpaceKeyPressed(event);
|
||||
|
||||
if (enterOrSpaceKeyPressed) {
|
||||
popup._disableProtection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
websiteContextElement.setAttribute('class', 'panel');
|
||||
};
|
||||
|
||||
popup._renderInjectionPanel = function (groupedInjections) {
|
||||
|
||||
let websiteContextElement, injectionOverviewElement;
|
||||
|
||||
websiteContextElement = document.getElementById('website-context');
|
||||
injectionOverviewElement = popup._createInjectionOverviewElement(groupedInjections);
|
||||
|
||||
websiteContextElement.append(injectionOverviewElement);
|
||||
};
|
||||
|
||||
popup._enableProtection = function () {
|
||||
|
||||
let message = {
|
||||
'topic': 'whitelist:remove-domain',
|
||||
'value': popup._domain
|
||||
};
|
||||
|
||||
chrome.runtime.sendMessage(message, function () {
|
||||
popup._onProtectionToggled();
|
||||
});
|
||||
};
|
||||
|
||||
popup._disableProtection = function () {
|
||||
|
||||
let message = {
|
||||
'topic': 'whitelist:add-domain',
|
||||
'value': popup._domain
|
||||
};
|
||||
|
||||
chrome.runtime.sendMessage(message, function () {
|
||||
popup._onProtectionToggled();
|
||||
});
|
||||
};
|
||||
|
||||
popup._determineDomainWhitelistStatus = function () {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
let message = {
|
||||
'topic': 'domain:fetch-is-whitelisted',
|
||||
'value': popup._domain
|
||||
};
|
||||
|
||||
chrome.runtime.sendMessage(message, function (response) {
|
||||
|
||||
popup._domainIsWhitelisted = response.value;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
popup._determineResourceInjections = function () {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
let message = {
|
||||
'topic': 'tab:fetch-injections',
|
||||
'value': popup._targetTab.id
|
||||
};
|
||||
|
||||
chrome.runtime.sendMessage(message, function (response) {
|
||||
|
||||
popup._resourceInjections = popup._groupResourceInjections(response.value);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
popup._determineTargetTab = function () {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
helpers.determineActiveTab().then((activeTab) => {
|
||||
|
||||
popup._targetTab = activeTab;
|
||||
popup._domain = helpers.extractDomainFromUrl(activeTab.url, true);
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
popup._determineAmountInjected = function () {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
helpers.getStoredSettings(Setting.AMOUNT_INJECTED, function (items) {
|
||||
|
||||
popup._amountInjected = items.amountInjected || 0;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
popup._groupResourceInjections = function (injections) {
|
||||
|
||||
let groupedInjections = {};
|
||||
|
||||
for (let index in injections) {
|
||||
|
||||
if (injections.hasOwnProperty(index)) {
|
||||
|
||||
let {source} = injections[index];
|
||||
|
||||
groupedInjections[source] = groupedInjections[source] || [];
|
||||
groupedInjections[source].push(injections[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return groupedInjections;
|
||||
};
|
||||
|
||||
popup._createInjectionOverviewElement = function (groupedInjections) {
|
||||
|
||||
let injectionOverviewElement = document.createElement('ul');
|
||||
injectionOverviewElement.setAttribute('class', 'list');
|
||||
|
||||
for (let source in groupedInjections) {
|
||||
|
||||
if (groupedInjections.hasOwnProperty(source)) {
|
||||
|
||||
let injectionGroupHeaderElement, injectionGroupElement, cdn;
|
||||
|
||||
cdn = groupedInjections[source];
|
||||
|
||||
injectionGroupHeaderElement = popup._createInjectionGroupHeaderElement(source, cdn);
|
||||
injectionGroupElement = popup._createInjectionGroupElement(source, cdn);
|
||||
|
||||
injectionOverviewElement.appendChild(injectionGroupHeaderElement);
|
||||
injectionOverviewElement.appendChild(injectionGroupElement);
|
||||
}
|
||||
}
|
||||
|
||||
return injectionOverviewElement;
|
||||
};
|
||||
|
||||
popup._createInjectionGroupHeaderElement = function (source, cdn) {
|
||||
|
||||
let injectionGroupHeaderElement, badgeElement, badgeTextNode, cdnNameTextNode;
|
||||
|
||||
injectionGroupHeaderElement = document.createElement('li');
|
||||
injectionGroupHeaderElement.setAttribute('class', 'list-item');
|
||||
|
||||
badgeElement = document.createElement('span');
|
||||
badgeElement.setAttribute('class', 'badge');
|
||||
|
||||
badgeTextNode = document.createTextNode(cdn.length);
|
||||
badgeElement.appendChild(badgeTextNode);
|
||||
|
||||
cdnNameTextNode = document.createTextNode(helpers.determineCdnName(source));
|
||||
|
||||
injectionGroupHeaderElement.appendChild(badgeElement);
|
||||
injectionGroupHeaderElement.appendChild(cdnNameTextNode);
|
||||
|
||||
return injectionGroupHeaderElement;
|
||||
};
|
||||
|
||||
popup._createInjectionGroupElement = function (source, cdn) {
|
||||
|
||||
let injectionGroupElement;
|
||||
|
||||
injectionGroupElement = document.createElement('ul');
|
||||
injectionGroupElement.setAttribute('class', 'sublist');
|
||||
|
||||
for (let injection of cdn) {
|
||||
|
||||
let injectionElement = popup._createInjectionElement(injection);
|
||||
injectionGroupElement.appendChild(injectionElement);
|
||||
}
|
||||
|
||||
return injectionGroupElement;
|
||||
};
|
||||
|
||||
popup._createInjectionElement = function (injection) {
|
||||
|
||||
let injectionElement, filename, name, nameTextNode, noteElement, noteTextNode;
|
||||
|
||||
injectionElement = document.createElement('li');
|
||||
injectionElement.setAttribute('class', 'sublist-item');
|
||||
|
||||
filename = helpers.extractFilenameFromPath(injection.path);
|
||||
name = helpers.determineResourceName(filename);
|
||||
|
||||
nameTextNode = document.createTextNode(`- ${name}`);
|
||||
injectionElement.appendChild(nameTextNode);
|
||||
|
||||
noteElement = document.createElement('span');
|
||||
noteElement.setAttribute('class', 'side-note');
|
||||
|
||||
noteTextNode = document.createTextNode(` v${injection.version}`);
|
||||
|
||||
noteElement.appendChild(noteTextNode);
|
||||
injectionElement.appendChild(noteElement);
|
||||
|
||||
return injectionElement;
|
||||
};
|
||||
|
||||
popup._close = function () {
|
||||
|
||||
chrome.runtime.getPlatformInfo(function (information) {
|
||||
|
||||
if (information.os === chrome.runtime.PlatformOs.ANDROID) {
|
||||
|
||||
chrome.tabs.getCurrent(function (activeTab) {
|
||||
|
||||
if (activeTab) {
|
||||
chrome.tabs.remove(activeTab.id);
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Event Handlers
|
||||
*/
|
||||
|
||||
popup._onDocumentLoaded = function () {
|
||||
|
||||
let manifest, language;
|
||||
|
||||
manifest = chrome.runtime.getManifest();
|
||||
language = navigator.language;
|
||||
|
||||
popup._version = helpers.formatVersion(manifest.version);
|
||||
popup._scriptDirection = helpers.determineScriptDirection(language);
|
||||
|
||||
popup._determineAmountInjected()
|
||||
.then(popup._renderContents);
|
||||
};
|
||||
|
||||
popup._onTestingUtilityLinkClicked = function (event) {
|
||||
|
||||
if (event.button === 0 || event.button === 1) {
|
||||
|
||||
chrome.tabs.create({
|
||||
'url': 'https://decentraleyes.org/test',
|
||||
'active': (event.button === 0)
|
||||
});
|
||||
}
|
||||
|
||||
if (event.button === 0) {
|
||||
window.close();
|
||||
}
|
||||
};
|
||||
|
||||
popup._onOptionsButtonClicked = function () {
|
||||
|
||||
chrome.runtime.getPlatformInfo(function (information) {
|
||||
|
||||
if (information.os === chrome.runtime.PlatformOs.ANDROID) {
|
||||
|
||||
chrome.tabs.create({
|
||||
'url': chrome.runtime.getURL('pages/options/options.html'),
|
||||
'active': true
|
||||
});
|
||||
|
||||
return window.close();
|
||||
|
||||
} else {
|
||||
|
||||
chrome.runtime.openOptionsPage();
|
||||
return window.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
popup._onProtectionToggled = function () {
|
||||
|
||||
let bypassCache = (typeof browser === 'undefined');
|
||||
|
||||
chrome.tabs.reload(popup._targetTab.id, {bypassCache});
|
||||
popup._close();
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializations
|
||||
*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', popup._onDocumentLoaded);
|
||||
Loading…
Add table
Add a link
Reference in a new issue