mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-01-26 17:25:03 +01:00
"Show more Injections"-Button removed and code optimized
This commit is contained in:
parent
8c9d5837ad
commit
6f7d4bb969
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "Фильтры исходного кода HTML",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "Показать больше инъекций",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "Донат",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "过滤 HTML 源码",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "展示更多注入",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "捐赠",
|
||||
"description": "Donate"
|
||||
|
@ -103,10 +103,6 @@
|
||||
"message": "",
|
||||
"description": "Filter HTML source code"
|
||||
},
|
||||
"labelShowMoreInjections": {
|
||||
"message": "",
|
||||
"description": "Show more Injections"
|
||||
},
|
||||
"labelDonate": {
|
||||
"message": "",
|
||||
"description": "Donate"
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>LocalCDN | Statistics</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="statistics.css">
|
||||
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
||||
</head>
|
||||
<body>
|
||||
<script src="../../core/constants.js"></script>
|
||||
<script src="../../modules/internal/helpers.js"></script>
|
||||
<script src="statistics.js"></script>
|
||||
<header>
|
||||
<img class="icon-logo" src="../../icons/icon.svg" alt="Extension Icon">
|
||||
<div class="heading">LocalCDN <sup id="version-label" class="label-version"></sup></div>
|
||||
<div id="donate-button">
|
||||
<p id="label-donate" data-i18n-content="labelDonate">Donate</p>
|
||||
<div id="donate-button-svg"></div>
|
||||
</div>
|
||||
</header>
|
||||
<section class="content">
|
||||
<div id="website-context" class="panel hidden"></div>
|
||||
</section>
|
||||
<footer></footer>
|
||||
</body>
|
||||
</html>
|
@ -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);
|
@ -31,6 +31,7 @@
|
||||
<li>Added: slick-carousel/slick v1.9.0 (<a href="https://addons.mozilla.org/de/firefox/addon/localcdn-fork-of-decentraleyes/reviews/1563434/">review</a>)</li>
|
||||
<li>Added: Materialize (JS & CSS) v100.2 and v1.0.0 (<a href="https://codeberg.org/nobody/LocalCDN/issues/47">#47</a>)</li>
|
||||
<li>Implemented: Option to block unhandled Google Fonts requests</li>
|
||||
<li>"Show more Injections"-Button removed. All injections in the popup now.</li>
|
||||
</ul>
|
||||
<div class="topic-label">
|
||||
Generate rule sets for uBlock or uMatrix
|
||||
|
Loading…
Reference in New Issue
Block a user