From 6f7d4bb969d11a4ab851ecab84e3b555af6fd3b7 Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 3 Jul 2020 08:40:10 +0200 Subject: [PATCH] "Show more Injections"-Button removed and code optimized --- _locales/ar/messages.json | 4 - _locales/bg/messages.json | 4 - _locales/cs/messages.json | 4 - _locales/da/messages.json | 4 - _locales/de/messages.json | 4 - _locales/el/messages.json | 4 - _locales/en_GB/messages.json | 4 - _locales/en_US/messages.json | 4 - _locales/eo/messages.json | 4 - _locales/es/messages.json | 4 - _locales/et/messages.json | 4 - _locales/fi/messages.json | 4 - _locales/fr/messages.json | 4 - _locales/he/messages.json | 4 - _locales/hu/messages.json | 4 - _locales/id/messages.json | 4 - _locales/is/messages.json | 4 - _locales/it/messages.json | 4 - _locales/ja/messages.json | 4 - _locales/ko/messages.json | 4 - _locales/lb/messages.json | 4 - _locales/nb/messages.json | 4 - _locales/nl/messages.json | 4 - _locales/pl/messages.json | 4 - _locales/pt_BR/messages.json | 4 - _locales/pt_PT/messages.json | 4 - _locales/ro/messages.json | 4 - _locales/ru/messages.json | 4 - _locales/sr/messages.json | 4 - _locales/sv/messages.json | 4 - _locales/tl/messages.json | 4 - _locales/tr/messages.json | 4 - _locales/zh_CN/messages.json | 4 - _locales/zh_TW/messages.json | 4 - pages/options/options.css | 6 + pages/popup/popup.css | 10 +- pages/popup/popup.js | 88 ++------ pages/statistics/statistics.css | 332 ------------------------------- pages/statistics/statistics.html | 28 --- pages/statistics/statistics.js | 188 ----------------- pages/updates/updates.html | 1 + 41 files changed, 33 insertions(+), 756 deletions(-) delete mode 100644 pages/statistics/statistics.css delete mode 100644 pages/statistics/statistics.html delete mode 100644 pages/statistics/statistics.js diff --git a/_locales/ar/messages.json b/_locales/ar/messages.json index a55ab4cd..8c55e436 100644 --- a/_locales/ar/messages.json +++ b/_locales/ar/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/bg/messages.json b/_locales/bg/messages.json index 0513d570..ba7637bf 100644 --- a/_locales/bg/messages.json +++ b/_locales/bg/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/cs/messages.json b/_locales/cs/messages.json index 3cc3f494..d9ce10f2 100644 --- a/_locales/cs/messages.json +++ b/_locales/cs/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/da/messages.json b/_locales/da/messages.json index 3593bdb6..6806e791 100644 --- a/_locales/da/messages.json +++ b/_locales/da/messages.json @@ -103,10 +103,6 @@ "message": "Filtrere HTML kildekode", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Vis flere injektioner", - "description": "Show more Injections" - }, "labelDonate": { "message": "Doner", "description": "Donate" diff --git a/_locales/de/messages.json b/_locales/de/messages.json index d1f849cc..2f81a335 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -103,10 +103,6 @@ "message": "HTML-Quelltext filtern", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Weitere Injektionen anzeigen", - "description": "Show more Injections" - }, "labelDonate": { "message": "Spenden", "description": "Donate" diff --git a/_locales/el/messages.json b/_locales/el/messages.json index 12cec06d..4be4aa4c 100644 --- a/_locales/el/messages.json +++ b/_locales/el/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/en_GB/messages.json b/_locales/en_GB/messages.json index 7b2e6b24..6f0b0be4 100644 --- a/_locales/en_GB/messages.json +++ b/_locales/en_GB/messages.json @@ -103,10 +103,6 @@ "message": "Filter HTML source code", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Show more injections", - "description": "Show more Injections" - }, "labelDonate": { "message": "Donate", "description": "Donate" diff --git a/_locales/en_US/messages.json b/_locales/en_US/messages.json index 2573a5e5..5c4c2860 100644 --- a/_locales/en_US/messages.json +++ b/_locales/en_US/messages.json @@ -103,10 +103,6 @@ "message": "Filter HTML source code", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Show more injections", - "description": "Show more Injections" - }, "labelDonate": { "message": "Donate", "description": "Donate" diff --git a/_locales/eo/messages.json b/_locales/eo/messages.json index f9c9e302..dd1b1d18 100644 --- a/_locales/eo/messages.json +++ b/_locales/eo/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/es/messages.json b/_locales/es/messages.json index f4638cce..121602e1 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -103,10 +103,6 @@ "message": "Optimizar código fuente HTML", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Mostrar más inyecciones", - "description": "Show more Injections" - }, "labelDonate": { "message": "Donar", "description": "Donate" diff --git a/_locales/et/messages.json b/_locales/et/messages.json index 77ac4e1a..45f9410e 100644 --- a/_locales/et/messages.json +++ b/_locales/et/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/fi/messages.json b/_locales/fi/messages.json index be23956c..485a4d24 100644 --- a/_locales/fi/messages.json +++ b/_locales/fi/messages.json @@ -103,10 +103,6 @@ "message": "Suodattaa HTML lähdekoodia", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "Lahjoita", "description": "Donate" diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index a6d409fd..cc0f4151 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -103,10 +103,6 @@ "message": "Filtrage de code source HTML", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Afficher plus d'injections", - "description": "Show more Injections" - }, "labelDonate": { "message": "Faire un don", "description": "Donate" diff --git a/_locales/he/messages.json b/_locales/he/messages.json index edfd34d5..eedfe717 100644 --- a/_locales/he/messages.json +++ b/_locales/he/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/hu/messages.json b/_locales/hu/messages.json index bce03df5..ece50de9 100644 --- a/_locales/hu/messages.json +++ b/_locales/hu/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/id/messages.json b/_locales/id/messages.json index e93e0c05..9f0724bb 100644 --- a/_locales/id/messages.json +++ b/_locales/id/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/is/messages.json b/_locales/is/messages.json index 59a6c4a8..6faaa9a8 100644 --- a/_locales/is/messages.json +++ b/_locales/is/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/it/messages.json b/_locales/it/messages.json index d53c81e0..4f38ed2a 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json index 332f7cf8..66f496a3 100644 --- a/_locales/ja/messages.json +++ b/_locales/ja/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/ko/messages.json b/_locales/ko/messages.json index 2c38a712..f4526a74 100644 --- a/_locales/ko/messages.json +++ b/_locales/ko/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/lb/messages.json b/_locales/lb/messages.json index 53189d8c..015b7e79 100644 --- a/_locales/lb/messages.json +++ b/_locales/lb/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/nb/messages.json b/_locales/nb/messages.json index 79d5df69..8b8ed0e3 100644 --- a/_locales/nb/messages.json +++ b/_locales/nb/messages.json @@ -103,10 +103,6 @@ "message": "Filtrer HTML-kildekode", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Vis flere injeksjoner", - "description": "Show more Injections" - }, "labelDonate": { "message": "Doner", "description": "Donate" diff --git a/_locales/nl/messages.json b/_locales/nl/messages.json index 4f539bb8..de13e352 100644 --- a/_locales/nl/messages.json +++ b/_locales/nl/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/pl/messages.json b/_locales/pl/messages.json index 0971e55f..45eef916 100644 --- a/_locales/pl/messages.json +++ b/_locales/pl/messages.json @@ -103,10 +103,6 @@ "message": "Filtruj kod źródłowy HTML", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Pokaż więcej wstrzyknięć", - "description": "Show more Injections" - }, "labelDonate": { "message": "Dotacja", "description": "Donate" diff --git a/_locales/pt_BR/messages.json b/_locales/pt_BR/messages.json index dfbe1d5d..2a245994 100644 --- a/_locales/pt_BR/messages.json +++ b/_locales/pt_BR/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/pt_PT/messages.json b/_locales/pt_PT/messages.json index b9b78817..af7e22ad 100644 --- a/_locales/pt_PT/messages.json +++ b/_locales/pt_PT/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/ro/messages.json b/_locales/ro/messages.json index 6399a7f5..9c58c085 100644 --- a/_locales/ro/messages.json +++ b/_locales/ro/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index c8b3bb15..73553f77 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -103,10 +103,6 @@ "message": "Фильтры исходного кода HTML", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Показать больше инъекций", - "description": "Show more Injections" - }, "labelDonate": { "message": "Донат", "description": "Donate" diff --git a/_locales/sr/messages.json b/_locales/sr/messages.json index 55ceadd3..0b2d2c1f 100644 --- a/_locales/sr/messages.json +++ b/_locales/sr/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/sv/messages.json b/_locales/sv/messages.json index 62d94bdc..ec7cacd2 100644 --- a/_locales/sv/messages.json +++ b/_locales/sv/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/tl/messages.json b/_locales/tl/messages.json index ea308cb4..b636fb5d 100644 --- a/_locales/tl/messages.json +++ b/_locales/tl/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/_locales/tr/messages.json b/_locales/tr/messages.json index 234695dd..8ffa8427 100644 --- a/_locales/tr/messages.json +++ b/_locales/tr/messages.json @@ -103,10 +103,6 @@ "message": "HTML kaynak kodunu filtrele", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "Daha fazla enjeksiyon göster", - "description": "Show more Injections" - }, "labelDonate": { "message": "Bağış yap", "description": "Donate" diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index 817b0997..5d92a2d5 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -103,10 +103,6 @@ "message": "过滤 HTML 源码", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "展示更多注入", - "description": "Show more Injections" - }, "labelDonate": { "message": "捐赠", "description": "Donate" diff --git a/_locales/zh_TW/messages.json b/_locales/zh_TW/messages.json index bf2e9793..e9812687 100644 --- a/_locales/zh_TW/messages.json +++ b/_locales/zh_TW/messages.json @@ -103,10 +103,6 @@ "message": "", "description": "Filter HTML source code" }, - "labelShowMoreInjections": { - "message": "", - "description": "Show more Injections" - }, "labelDonate": { "message": "", "description": "Donate" diff --git a/pages/options/options.css b/pages/options/options.css index b61eed52..e1677539 100644 --- a/pages/options/options.css +++ b/pages/options/options.css @@ -137,6 +137,7 @@ body { text-decoration: none; user-select: none; text-align: center; + background: none; } .button:hover { @@ -156,6 +157,7 @@ body { .button-warning:hover { background-color: #d88c00; border-color: #c98200; + color: #fff !important; } .button-warning:active { @@ -265,6 +267,10 @@ body { font-style: normal; } +#block-google-fonts { + padding-left: 1.8rem; +} + /** * Right to Left */ diff --git a/pages/popup/popup.css b/pages/popup/popup.css index 813be0c9..fbd70aae 100644 --- a/pages/popup/popup.css +++ b/pages/popup/popup.css @@ -29,7 +29,15 @@ header { .subpanel { padding-top: 8px; - overflow: hidden; + max-height: 200px; + overflow: auto; +} + +.panel-overflow { + max-height: 300px; + overflow: auto; + margin-left: 0px; + padding-left: 0px; } .subpanel:last-child { diff --git a/pages/popup/popup.js b/pages/popup/popup.js index 6183f0db..df035a23 100644 --- a/pages/popup/popup.js +++ b/pages/popup/popup.js @@ -21,11 +21,6 @@ /** * Popup */ - -let counterFrameworks = 0; -let counterCDNs = 0; -let oversized = false; -let negateHtmlFilterList; var popup = {}; /** @@ -84,8 +79,7 @@ popup._renderContextualContents = function () { popup._renderDomainWhitelistPanel(); } - counterCDNs = Object.keys(popup._resourceInjections).length; - if (counterCDNs > 0) { + if (Object.keys(popup._resourceInjections).length > 0) { popup._renderInjectionPanel(popup._resourceInjections); } }; @@ -120,16 +114,16 @@ popup._renderDomainWhitelistPanel = function () { protectionToggleElement.checked = true; protectionToggleElement.addEventListener('click', popup._disableProtection); - if ( negateHtmlFilterList && !popup._domainManipulateDOM) { + if ( popup.negateHtmlFilterList && !popup._domainManipulateDOM) { manipulateDOMToggleElement.checked = true; manipulateDOMToggleElement.addEventListener('click', popup._enableManipulateDOM); - } else if (!negateHtmlFilterList && !popup._domainManipulateDOM) { + } else if (!popup.negateHtmlFilterList && !popup._domainManipulateDOM) { manipulateDOMToggleElement.checked = false; manipulateDOMToggleElement.addEventListener('click', popup._enableManipulateDOM); - } else if ( negateHtmlFilterList && popup._domainManipulateDOM) { + } else if ( popup.negateHtmlFilterList && popup._domainManipulateDOM) { manipulateDOMToggleElement.checked = false; manipulateDOMToggleElement.addEventListener('click', popup._disableManipulateDOM); - } else if (!negateHtmlFilterList && popup._domainManipulateDOM) { + } else if (!popup.negateHtmlFilterList && popup._domainManipulateDOM) { manipulateDOMToggleElement.checked = true; manipulateDOMToggleElement.addEventListener('click', popup._disableManipulateDOM); } @@ -144,7 +138,7 @@ popup._renderInjectionPanel = function (groupedInjections) { websiteContextElement = document.getElementById('website-context'); injectionOverviewElement = popup._createInjectionOverviewElement(groupedInjections); - + injectionOverviewElement.setAttribute('class', 'panel-overflow'); websiteContextElement.append(injectionOverviewElement); }; @@ -281,7 +275,7 @@ popup._determineNegateHtmlFilterOption = function () { chrome.storage.sync.get(Setting.NEGATE_HTML_FILTER_LIST, function (items) { - negateHtmlFilterList = items.negateHtmlFilterList; + popup.negateHtmlFilterList = items.negateHtmlFilterList; resolve(); }); }); @@ -307,27 +301,19 @@ popup._createInjectionOverviewElement = function (groupedInjections) { let injectionOverviewElement = document.createElement('ul'); injectionOverviewElement.setAttribute('class', 'list'); - statisticData = groupedInjections; - for (let source in groupedInjections) { let injectionGroupHeaderElement, injectionGroupElement, cdn; cdn = groupedInjections[source]; - if (counterFrameworks < 3) { - injectionGroupHeaderElement = popup._createInjectionGroupHeaderElement(source, cdn); - injectionGroupElement = popup._createInjectionGroupElement(source, cdn); - injectionOverviewElement.appendChild(injectionGroupHeaderElement); - injectionOverviewElement.appendChild(injectionGroupElement); - } else { - oversized = true; - } + injectionGroupHeaderElement = popup._createInjectionGroupHeaderElement(source, cdn); + injectionGroupElement = popup._createInjectionGroupElement(source, cdn); + + injectionOverviewElement.appendChild(injectionGroupHeaderElement); + injectionOverviewElement.appendChild(injectionGroupElement); } - if (oversized) { - injectionOverviewElement.append(popup._appendMoreButton()); - } return injectionOverviewElement; }; @@ -368,13 +354,9 @@ popup._createInjectionGroupElement = function (source, cdn) { for (let injection of filtered) { - if(counterFrameworks < 3){ - let injectionElement = popup._createInjectionElement(injection); - injectionGroupElement.appendChild(injectionElement); - } else { - oversized = true; - } - counterFrameworks++; + let injectionElement = popup._createInjectionElement(injection); + injectionGroupElement.appendChild(injectionElement); + } return injectionGroupElement; @@ -384,10 +366,6 @@ popup._createInjectionElement = function (injection) { let injectionElement, filename, name, nameTextNode, noteElement, noteTextNode; - if(oversized) { - return popup._appendMoreButton(); - } - injectionElement = document.createElement('li'); injectionElement.setAttribute('class', 'sublist-item'); @@ -415,23 +393,6 @@ popup._createInjectionElement = function (injection) { return injectionElement; }; -popup._appendMoreButton = function() { - - let lastElement = document.createElement('p'); - let moreInjections = document.createElement('span'); - let nameTextNode = document.createTextNode(chrome.i18n.getMessage('labelShowMoreInjections')); - - moreInjections.setAttribute('id', 'get-more-injections-btn'); - - moreInjections.addEventListener('mouseup', function() { - popup._onMoreInjectionsButton(); - }, false); - - moreInjections.appendChild(nameTextNode); - lastElement.appendChild(moreInjections); - return lastElement; -} - popup._filterDuplicates = function(array, key) { /** * Function to remove duplicates from an array, depending on 'key'. @@ -543,22 +504,6 @@ popup._close = function () { }); }; -popup._onMoreInjectionsButton = function () { - - // Store current injections in extension storage. - // Maybe a local statistic/diagram will be implemented later. - chrome.storage.sync.set({ - [Setting.STATISTIC_DATA]: statisticData - }); - - chrome.tabs.create({ - 'url': chrome.extension.getURL('pages/statistics/statistics.html'), - 'active': true - }); - - popup._close(); -}; - popup._onInfoButtonClicked = function () { if (event.button === 0 || event.button === 1) { @@ -590,5 +535,6 @@ popup._onIncompleteTranslation = function () { /** * Initializations */ -let statisticData; +popup.negateHtmlFilterList = false; + document.addEventListener('DOMContentLoaded', popup._onDocumentLoaded); diff --git a/pages/statistics/statistics.css b/pages/statistics/statistics.css deleted file mode 100644 index 30464657..00000000 --- a/pages/statistics/statistics.css +++ /dev/null @@ -1,332 +0,0 @@ -/** - * Sections - */ - -body { - background-color: #f0f0f0; - color: #555; - cursor: default; - font-family: 'Noto Sans', Arial, sans-serif !important; - font-size: 75%; - margin: 0 auto; - overflow-y: auto; - overflow-x: hidden; - padding: 0px 15px 0px 15px; -} - -header { - align-items: center; - border-bottom: solid #d3d3d3 1px; - display: flex; - position: relative; - padding: 8px 15px 8px 4px; -} - -.panel { - overflow: hidden; - padding: 10px 8px; -} - -.panel:not(:last-child) { - border-bottom: 1px solid #d8d8d8; -} - -.subpanel { - overflow: hidden; -} - -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; - width: 100%; -} - -.subheading { - font-weight: 600; - margin-bottom: 2px; - text-align: center; -} - -/** - * Lists - */ - -.list { - margin: 0; - padding: 8px 0 0; - min-width: 300px; -} - -.list-item { - background-color: #f7f7f7; - border: 1px solid #e4e4e4; - color: #737373; - 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-left: 8px; - padding: 0; - margin-top: 0px; -} - -.sublist:last-child { - border-bottom: 1px solid #e0e0e0; -} - -.sublist-item { - border-bottom: 1px solid #e0e0e0; - color: #737373; - font-weight: 600; - padding: 10px; -} - -.sublist-item:last-child { - border-bottom: none; -} - -.cdn-list { - display: flex; - flex-wrap: wrap; - justify-content: center; -} - -#get-stats-btn { - color: white; -} - -#label-donate { - cursor: pointer; - background-color: #f0f0f0; - color: #737373; - font-weight: 600; - margin: 0px 5px; -} - -/** - * Icons - */ - -.icon { - margin-right: 6px; -} - -.icon-logo { - height: 26px; - padding: 14px 6px 14px 8px; - width: 26px; -} - -/** - * Buttons - */ - -#donate-button { - -moz-user-select: none; - user-select: none; - color: #5f5f5f; - cursor: pointer; - float: right; - font-size: 12px; - padding: 5px; - display: flex; -} - -#donate-button:hover #donate-button-svg { - transform: scale(1.3); -} - -#donate-button:hover #label-donate { - text-decoration: underline; -} - -#donate-button-svg { - background-size: cover; - width: 15px; - height: 15px; -} - -#donate-button-svg { - background-image: url("../../icons/donate.svg"); -} - -/** - * Miscellaneous - */ - -.badge { - background-color: #6bb798; - border-radius: 10px; - color: #fff; - font-family: monospace; - font-size: 13px; - font-weight: 600; - margin-right: 8px; - padding: 3px 15px; -} - -.counter { - font-size: 36px; - font-weight: 600; - margin-top: 4px; - text-align: center; -} - -.description { - color: #777; - font-style: italic; - margin: 0 6px; - text-align: center; -} - -.label-version { - color: #6aac91; - font-size: 9px; -} - -.label-domain { - color: #bbb; - display: flex; - font-style: italic; - overflow: hidden; - padding: 6px 0 0 4px; - white-space: nowrap; -} - -.side-note { - color: #a5a5a5; - font-style: italic; - font-weight: 400; -} - -/** - * Compatibility - */ - -@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; - } - - /** - * Links - */ - - .link-text { - color: #7d7d7d; - } - - .link-text:hover { - color: #dadada; - } - - /** - * Miscellaneous - */ - - .badge { - color: #2d5042; - } - - .description { - color: #dadada; - } - - .label-domain { - color: #717171; - } - - #label-donate { - background-color: #404040; - color: #bbb; - } - - .panel:not(:last-child) { - border-bottom-color: #292929; - } - - .side-note { - color: #888; - } -} diff --git a/pages/statistics/statistics.html b/pages/statistics/statistics.html deleted file mode 100644 index e0826601..00000000 --- a/pages/statistics/statistics.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - LocalCDN | Statistics - - - - - - - - - - -
- -
LocalCDN
- -
-
- -
- - - diff --git a/pages/statistics/statistics.js b/pages/statistics/statistics.js deleted file mode 100644 index 9fa91fab..00000000 --- a/pages/statistics/statistics.js +++ /dev/null @@ -1,188 +0,0 @@ -/** - * Details of Requests - * Belongs to LocalCDN. - * - * @author nobody - * @since 2020-02-26 - * - * @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'; - -/** - * Overview - */ - -var statistics = {}; - -/** - * Private Methods - */ - -statistics._renderContents = function () { - - helpers.insertI18nContentIntoDocument(document); - helpers.insertI18nTitlesIntoDocument(document); - - statistics._renderNonContextualContents(); - statistics._renderContextualContents(); -}; - -statistics._renderNonContextualContents = function () { - - let donationButtonElement, versionLabelElement, version; - - version = chrome.runtime.getManifest().version; - - donationButtonElement = document.getElementById('donate-button'); - donationButtonElement.addEventListener('mouseup', statistics._onDonationButtonClicked); - - versionLabelElement = document.getElementById('version-label'); - versionLabelElement.innerText = helpers.formatVersion(version); -}; - -statistics._renderInjectionPanel = function () { - - let websiteContextElement, injectionOverviewElement; - - websiteContextElement = document.getElementById('website-context'); - injectionOverviewElement = statistics._createInjectionOverviewElement(statisticData); - - websiteContextElement.append(injectionOverviewElement); -}; - -statistics._renderContextualContents = function () { - - if (Object.keys(statisticData).length > 0) { - statistics._renderInjectionPanel(statisticData); - } -}; - -statistics._createInjectionOverviewElement = function () { - - let divOutline = document.createElement('div'); - divOutline.setAttribute('class', 'cdn-list'); - - for (let source in statisticData) { - - let injectionOverviewElement = document.createElement('div'); - injectionOverviewElement.setAttribute('class', 'list'); - - let injectionGroupHeaderElement, injectionGroupElement, cdn; - - cdn = statisticData[source]; - - injectionGroupHeaderElement = statistics._createInjectionGroupHeaderElement(source, cdn); - injectionGroupElement = statistics._createInjectionGroupElement(source, cdn); - - injectionOverviewElement.appendChild(injectionGroupHeaderElement); - injectionOverviewElement.appendChild(injectionGroupElement); - - divOutline.appendChild(injectionOverviewElement); - } - - return divOutline; -}; - -statistics._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; -}; - -statistics._createInjectionGroupElement = function (source, cdn) { - - let injectionGroupElement; - - injectionGroupElement = document.createElement('ul'); - injectionGroupElement.setAttribute('class', 'sublist'); - - for (let injection of cdn) { - - let injectionElement = statistics._createInjectionElement(injection); - injectionGroupElement.appendChild(injectionElement); - } - - return injectionGroupElement; -}; - -statistics._createInjectionElement = function (injection) { - - let injectionElement, filename, name, nameTextNode, noteElement, noteTextNode; - - injectionElement = document.createElement('li'); - injectionElement.setAttribute('class', 'sublist-item'); - filename = helpers.extractFilenameFromPath(injection.path); - - // If bundle empty, use filename - if (injection.bundle === ''){ - name = helpers.determineResourceName(filename); - } else { - name = injection.bundle + ' (Bundle)' - } - - nameTextNode = document.createTextNode(`- ${name}`); - injectionElement.appendChild(nameTextNode); - - if (injection.version !== null) { - noteElement = document.createElement('span'); - noteElement.setAttribute('class', 'side-note'); - let versionNode = (injection.version === 'beta') ? ` ${injection.version}` : ` v${injection.version}`; - noteTextNode = document.createTextNode(versionNode); - noteElement.appendChild(noteTextNode); - injectionElement.appendChild(noteElement); - } - - return injectionElement; -}; - - -/** - * Event Handlers - */ - -statistics._onDocumentLoaded = function () { - - chrome.storage.sync.get([Setting.STATISTIC_DATA], function (items) { - statisticData = items.statisticData; - statistics._renderContents(); - }); - -}; - -statistics._onDonationButtonClicked = function () { - - chrome.tabs.update({ - 'url': chrome.extension.getURL('pages/donate/donate.html'), - 'active': (event.button === 0) - }); - -}; - - -/** - * Initializations - */ - -let statisticData; -document.addEventListener('DOMContentLoaded', statistics._onDocumentLoaded); diff --git a/pages/updates/updates.html b/pages/updates/updates.html index dab57f2f..768570a4 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -31,6 +31,7 @@
  • Added: slick-carousel/slick v1.9.0 (review)
  • Added: Materialize (JS & CSS) v100.2 and v1.0.0 (#47)
  • Implemented: Option to block unhandled Google Fonts requests
  • +
  • "Show more Injections"-Button removed. All injections in the popup now.
  • Generate rule sets for uBlock or uMatrix