1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Added note about missing translation in popup

This commit is contained in:
nobody
2020-06-03 16:32:02 +02:00
parent 4fad2e0b66
commit e08559ef66
4 changed files with 50 additions and 3 deletions

View File

@@ -11,7 +11,6 @@ body {
margin: 0 auto; margin: 0 auto;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
padding: 0px 15px 0px 15px;
max-width: 348px; max-width: 348px;
} }
@@ -20,7 +19,7 @@ header {
border-bottom: solid #d3d3d3 1px; border-bottom: solid #d3d3d3 1px;
display: flex; display: flex;
position: relative; position: relative;
padding: 8px 0px 0px 4px; padding: 8px 15px 15px 4px;
} }
.panel { .panel {
@@ -39,7 +38,7 @@ header {
footer { footer {
overflow: hidden; overflow: hidden;
padding: 8px 0px; padding: 8px 15px;
} }
#more-injections-section { #more-injections-section {
@@ -47,6 +46,11 @@ footer {
padding: 0px 8px; padding: 0px 8px;
} }
.content {
padding: 0px 15px;
}
/** /**
* Fonts * Fonts
*/ */
@@ -381,6 +385,16 @@ input:checked + .slider:before {
font-weight: 400; font-weight: 400;
} }
#popup-incomplete-translation {
width: 100%;
color: white;
text-align: center;
font-weight: bold;
background-color: #ffa500;
padding: 0px;
cursor: pointer;
}
/** /**
* Compatibility * Compatibility
*/ */

View File

@@ -90,6 +90,8 @@
</footer> </footer>
<div id="popup-incomplete-translation"></div>
</body> </body>
</html> </html>

View File

@@ -32,6 +32,10 @@ popup._renderContents = function () {
helpers.insertI18nContentIntoDocument(document); helpers.insertI18nContentIntoDocument(document);
helpers.insertI18nTitlesIntoDocument(document); helpers.insertI18nTitlesIntoDocument(document);
if (!helpers.insertI18nContentIntoDocument(document)) {
popup._renderLocaleNotice();
}
popup._renderNonContextualContents(); popup._renderNonContextualContents();
popup._determineTargetTab() popup._determineTargetTab()
@@ -422,6 +426,19 @@ popup._filterDuplicates = function(array, key) {
return filtered; 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 * 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 * Initializations

View File

@@ -28,6 +28,7 @@
<li>Improved font color for dark mode</li> <li>Improved font color for dark mode</li>
<li>Updated welcome page</li> <li>Updated welcome page</li>
<li>Updated URL for missing translation in option page</li> <li>Updated URL for missing translation in option page</li>
<li>Added note about missing translation in popup</li>
</ul> </ul>
<div class="topic-label"> <div class="topic-label">
Please update your uBlock/uMatrix rules Please update your uBlock/uMatrix rules