From 419d8c8ba3513a43ded116720668a68002edbedf Mon Sep 17 00:00:00 2001
From: nobody42 <5514211-nobody42@users.noreply.gitlab.com>
Date: Sat, 16 May 2020 17:40:46 +0200
Subject: [PATCH] Added Donation button
---
icons/credits | 4 ++
icons/donate.svg | 124 +++++++++++++++++++++++++++++++++++++
pages/popup/popup.css | 9 ++-
pages/popup/popup.html | 4 ++
pages/popup/popup.js | 18 +++++-
pages/updates/updates.html | 1 +
6 files changed, 158 insertions(+), 2 deletions(-)
create mode 100644 icons/donate.svg
diff --git a/icons/credits b/icons/credits
index 90b98910..19899a39 100644
--- a/icons/credits
+++ b/icons/credits
@@ -3,3 +3,7 @@ enabled.svg (edited)
settings-dark.svg, settings-light.svg (edited)
https://www.svgrepo.com/vectors/web-security-fill/
Creative Commons BY 4.0
+
+donate.svg (edited)
+https://www.svgrepo.com/svg/39500/heart
+CC0
diff --git a/icons/donate.svg b/icons/donate.svg
new file mode 100644
index 00000000..d513fae5
--- /dev/null
+++ b/icons/donate.svg
@@ -0,0 +1,124 @@
+
+
+
+
\ No newline at end of file
diff --git a/pages/popup/popup.css b/pages/popup/popup.css
index c1cc0246..2cca6b15 100644
--- a/pages/popup/popup.css
+++ b/pages/popup/popup.css
@@ -20,6 +20,7 @@ header {
border-bottom: solid #d3d3d3 1px;
display: flex;
position: relative;
+ padding: 8px;
}
.panel {
@@ -76,6 +77,7 @@ footer {
font-size: 14px;
font-weight: 600;
padding-left: 0;
+ width: 100%;
}
.subheading {
@@ -177,7 +179,8 @@ footer {
color: #339a6f;
}
-#options-button-svg {
+#options-button-svg,
+#donate-button-svg {
background-size: cover;
width: 15px;
height: 15px;
@@ -187,6 +190,10 @@ footer {
background-image: url("../../icons/settings-dark.svg");
}
+#donate-button-svg {
+ background-image: url("../../icons/donate.svg");
+}
+
#protection-toggle {
-moz-user-select: none;
cursor: pointer;
diff --git a/pages/popup/popup.html b/pages/popup/popup.html
index ca8e1f1d..ce8ce09f 100644
--- a/pages/popup/popup.html
+++ b/pages/popup/popup.html
@@ -27,6 +27,10 @@
LocalCDN
+
+
diff --git a/pages/popup/popup.js b/pages/popup/popup.js
index 071887b2..955693c3 100644
--- a/pages/popup/popup.js
+++ b/pages/popup/popup.js
@@ -39,18 +39,20 @@ popup._renderContents = function () {
popup._renderNonContextualContents = function () {
- let versionLabelElement, counterElement, testingUtilityLinkElement, optionsButtonElement;
+ let versionLabelElement, counterElement, testingUtilityLinkElement, optionsButtonElement, donationButtonElement;
versionLabelElement = document.getElementById('version-label');
counterElement = document.getElementById('injection-counter');
testingUtilityLinkElement = document.getElementById('testing-utility-link');
optionsButtonElement = document.getElementById('options-button');
+ donationButtonElement = document.getElementById('donate-button');
versionLabelElement.innerText = popup._version;
counterElement.innerText = helpers.formatNumber(popup._amountInjected);
testingUtilityLinkElement.addEventListener('mouseup', popup._onTestingUtilityLinkClicked);
optionsButtonElement.addEventListener('mouseup', popup._onOptionsButtonClicked);
+ donationButtonElement.addEventListener('mouseup', popup._onDonationButtonClicked);
};
popup._renderContextualContents = function () {
@@ -356,6 +358,20 @@ popup._onOptionsButtonClicked = function () {
return window.close();
};
+popup._onDonationButtonClicked = function () {
+ if (event.button === 0 || event.button === 1) {
+
+ chrome.tabs.create({
+ 'url': 'https://localcdn.de/donate/',
+ 'active': (event.button === 0)
+ });
+ }
+
+ if (event.button === 0) {
+ window.close();
+ }
+};
+
popup._onProtectionToggled = function () {
let bypassCache = (typeof browser === 'undefined');
diff --git a/pages/updates/updates.html b/pages/updates/updates.html
index b16db176..6aa7d64d 100644
--- a/pages/updates/updates.html
+++ b/pages/updates/updates.html
@@ -24,6 +24,7 @@
- Fixed: Encoding problem with some websites (maybe only temporary, because at the moment only 9 websites are affected)
- Added: Twitter Bootstrap JS and CSS v4.5.0
+ - Added: Donation button
- Added: Material Design for Bootstrap (MDB) v4.18.0
- Added: Tether v1.4.7