From e08559ef6681cb55e40e658f2da2b869a23e56bd Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 3 Jun 2020 16:32:02 +0200 Subject: [PATCH] Added note about missing translation in popup --- pages/popup/popup.css | 20 +++++++++++++++++--- pages/popup/popup.html | 2 ++ pages/popup/popup.js | 30 ++++++++++++++++++++++++++++++ pages/updates/updates.html | 1 + 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/pages/popup/popup.css b/pages/popup/popup.css index a89ae03b..49cf6252 100644 --- a/pages/popup/popup.css +++ b/pages/popup/popup.css @@ -11,7 +11,6 @@ body { margin: 0 auto; overflow-y: auto; overflow-x: hidden; - padding: 0px 15px 0px 15px; max-width: 348px; } @@ -20,7 +19,7 @@ header { border-bottom: solid #d3d3d3 1px; display: flex; position: relative; - padding: 8px 0px 0px 4px; + padding: 8px 15px 15px 4px; } .panel { @@ -39,7 +38,7 @@ header { footer { overflow: hidden; - padding: 8px 0px; + padding: 8px 15px; } #more-injections-section { @@ -47,6 +46,11 @@ footer { padding: 0px 8px; } +.content { + padding: 0px 15px; +} + + /** * Fonts */ @@ -381,6 +385,16 @@ input:checked + .slider:before { font-weight: 400; } +#popup-incomplete-translation { + width: 100%; + color: white; + text-align: center; + font-weight: bold; + background-color: #ffa500; + padding: 0px; + cursor: pointer; +} + /** * Compatibility */ diff --git a/pages/popup/popup.html b/pages/popup/popup.html index 68917c03..fa92bd7d 100644 --- a/pages/popup/popup.html +++ b/pages/popup/popup.html @@ -90,6 +90,8 @@ + + diff --git a/pages/popup/popup.js b/pages/popup/popup.js index 8e5cd238..1e4b84ab 100644 --- a/pages/popup/popup.js +++ b/pages/popup/popup.js @@ -32,6 +32,10 @@ popup._renderContents = function () { helpers.insertI18nContentIntoDocument(document); helpers.insertI18nTitlesIntoDocument(document); + if (!helpers.insertI18nContentIntoDocument(document)) { + popup._renderLocaleNotice(); + } + popup._renderNonContextualContents(); popup._determineTargetTab() @@ -422,6 +426,19 @@ popup._filterDuplicates = function(array, key) { return filtered; }; +popup._renderLocaleNotice = function () { + + let localeNoticeElement, nameTextNode; + + localeNoticeElement = document.getElementById('popup-incomplete-translation'); + localeNoticeElement.setAttribute('class', 'notice notice-default'); + localeNoticeElement.addEventListener('mouseup', popup._onIncompleteTranslation); + + nameTextNode = document.createTextNode('Translation is incomplete. You want to help?'); + + localeNoticeElement.appendChild(nameTextNode); + localeNoticeElement.addEventListener('mouseup', popup._onIncompleteTranslation); +}; /** * Event Handlers @@ -533,6 +550,19 @@ popup._onInfoButtonClicked = function () { } }; +popup._onIncompleteTranslation = function () { + if (event.button === 0 || event.button === 1) { + + chrome.tabs.create({ + 'url': 'https://localcdn.de/translation/', + 'active': (event.button === 0) + }); + } + + if (event.button === 0) { + window.close(); + } +}; /** * Initializations diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 685ff536..9c717f47 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -28,6 +28,7 @@
  • Improved font color for dark mode
  • Updated welcome page
  • Updated URL for missing translation in option page
  • +
  • Added note about missing translation in popup
  • Please update your uBlock/uMatrix rules