Closes #82, closes #84.

This commit is contained in:
SimonBrazell 2020-07-30 22:40:36 +10:00
parent 48e02be94e
commit 28c9ee8a0d
9 changed files with 113 additions and 66 deletions

View File

@ -75,9 +75,17 @@
"message": "Ausnahmen",
"description": "Exceptions tab (options)."
},
"exceptionsDescription": {
"message": "<p>Gib eine URL oder einen regulären Ausdruck (Regex) ein, die/der von Weiterleitungen ausgeschlossen werden soll.</p><p>Alle Anfragen für oder ausgehend von einer URL, die auf die Ausnahme zutrifft, werden von Weiterleitungen ausgeschlossen.</p><p><b>Hinweis </b> Unterstützt reguläre JavaScript-Ausdrücke (Regex), mit Ausnahme der einschließenden Schrägstriche.</p>",
"description": "A description of the 'Exceptions' feature (options)."
"exceptionsDescriptionP1": {
"message": "Gib eine URL oder einen regulären Ausdruck (Regex) ein, die/der von Weiterleitungen ausgeschlossen werden soll.",
"description": "A description of the 'Exceptions' feature paragraph 1 (options)."
},
"exceptionsDescriptionP2": {
"message": "Alle Anfragen für oder ausgehend von einer URL, die auf die Ausnahme zutrifft, werden von Weiterleitungen ausgeschlossen.",
"description": "A description of the 'Exceptions' feature paragraph 2 (options)."
},
"exceptionsDescriptionP3": {
"message": "Hinweis Unterstützt reguläre JavaScript-Ausdrücke (Regex), mit Ausnahme der einschließenden Schrägstriche.",
"description": "A description of the 'Exceptions' feature paragraph 3 (options)."
},
"addException": {
"message": "Ausnahme hinzufügen",
@ -94,5 +102,9 @@
"redirect": {
"message": "Redirect",
"description": "Extension title - Redirect (pop-up)."
},
"version": {
"message": "Version",
"description": "Version"
}
}
}

View File

@ -75,9 +75,17 @@
"message": "Exceptions",
"description": "Exceptions tab (options)."
},
"exceptionsDescription": {
"message": "<p>Enter a URL or Regular Expression to be excluded from redirects.</p><p>All requests for or initiating from a URL that matches the exception will be excluded from redirects.</p><p><b>Note -</b> Supports JavaScript regular expressions, excluding the enclosing forward slashes.</p>",
"description": "A description of the 'Exceptions' feature (options)."
"exceptionsDescriptionP1": {
"message": "Enter a URL or Regular Expression to be excluded from redirects.",
"description": "A description of the 'Exceptions' feature paragraph 1 (options)."
},
"exceptionsDescriptionP2": {
"message": "All requests for or initiating from a URL that matches the exception will be excluded from redirects.",
"description": "A description of the 'Exceptions' feature paragraph 2 (options)."
},
"exceptionsDescriptionP3": {
"message": "Note - Supports JavaScript regular expressions, excluding the enclosing forward slashes.",
"description": "A description of the 'Exceptions' feature paragraph 3 (options)."
},
"addException": {
"message": "Add Exception",
@ -94,5 +102,9 @@
"redirect": {
"message": "Redirect",
"description": "Extension title - Redirect (pop-up)."
},
"version": {
"message": "Version",
"description": "Version"
}
}
}

View File

@ -75,8 +75,16 @@
"message": "Exceptions",
"description": "Onglet des Exceptions dans les options."
},
"exceptionsDescription": {
"message": "<p>Entrez une adresse URL ou une expression régulière qui sera exclue des redirections.</p><p>All requests for or initiating from a URL that matches the exception will be excluded from redirects.</p><p><b>Note -</b> Supports JavaScript regular expressions, excluding the enclosing forward slashes.</p>",
"exceptionsDescriptionP1": {
"message": "Entrez une adresse URL ou une expression régulière qui sera exclue des redirections.",
"description": "Description pour la rubrique 'Exceptions' dans les options."
},
"exceptionsDescriptionP2": {
"message": "All requests for or initiating from a URL that matches the exception will be excluded from redirects.",
"description": "Description pour la rubrique 'Exceptions' dans les options."
},
"exceptionsDescriptionP3": {
"message": "Note - Supports JavaScript regular expressions, excluding the enclosing forward slashes.",
"description": "Description pour la rubrique 'Exceptions' dans les options."
},
"addException": {
@ -94,5 +102,9 @@
"redirect": {
"message": "Redirect",
"description": "Titre du module complémentaire - Redirection (pop-up)."
},
"version": {
"message": "Version",
"description": "Version"
}
}
}

View File

@ -91,8 +91,16 @@
"message": "Исключения",
"description": "Вкладка 'Исключения' (в настройках)."
},
"exceptionsDescription": {
"message": "<p>Введите URL или регулярное выражение для исключения из перенаправлений.</p><p>Все запросы на URL, совпадающие с исключениями, или инициированные с них будут исключены из перенаправлений.</p><p><b>Примечание:</b> Поддерживает регулярные выражения JavaScript, кроме закрывающих обратных слэшей.</p>",
"exceptionsDescriptionP1": {
"message": "Введите URL или регулярное выражение для исключения из перенаправлений.",
"description": "Описание функции 'Исключения' (в настройках)."
},
"exceptionsDescriptionP2": {
"message": "Все запросы на URL, совпадающие с исключениями, или инициированные с них будут исключены из перенаправлений.",
"description": "Описание функции 'Исключения' (в настройках)."
},
"exceptionsDescriptionP3": {
"message": "Примечание: Поддерживает регулярные выражения JavaScript, кроме закрывающих обратных слэшей.",
"description": "Описание функции 'Исключения' (в настройках)."
},
"addException": {
@ -110,5 +118,9 @@
"redirect": {
"message": "Redirect",
"description": "Название расширения - Redirect (во всплывающем окне)."
},
"version": {
"message": "Version",
"description": "Version"
}
}

View File

@ -1,19 +1,19 @@
window.browser = window.browser || window.chrome;
function localizeHtmlPage() {
// Localize using __MSG_***__ data tags
var data = document.querySelectorAll('[data-localize]');
function localisePage() {
var data = document.querySelectorAll("[data-localise]");
for (var i in data) if (data.hasOwnProperty(i)) {
var obj = data[i];
var tag = obj.getAttribute('data-localize').toString();
for (var i in data)
if (data.hasOwnProperty(i)) {
var obj = data[i];
var tag = obj.getAttribute("data-localise").toString();
var msg = tag.replace(/__MSG_(\w+)__/g, function (_match, v1) {
return v1 ? browser.i18n.getMessage(v1) : null;
});
var msg = tag.replace(/__MSG_(\w+)__/g, function (_match, v1) {
return v1 ? browser.i18n.getMessage(v1) : null;
});
if (msg && msg !== tag) obj.innerHTML = msg;
}
if (msg && msg !== tag) obj.textContent = msg;
}
}
localizeHtmlPage();
localisePage();

View File

@ -1,7 +1,7 @@
{
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "1.1.37",
"version": "1.1.38",
"manifest_version": 2,
"background": {
"scripts": ["background.js"],

View File

@ -13,21 +13,21 @@
<button
class="tablinks"
id="general-tab"
data-localize="__MSG_generalTab__"
data-localise="__MSG_generalTab__"
>
General
</button>
<button
class="tablinks"
id="advanced-tab"
data-localize="__MSG_advancedTab__"
data-localise="__MSG_advancedTab__"
>
Advanced
</button>
<button
class="tablinks"
id="exceptions-tab"
data-localize="__MSG_exceptionsTab__"
data-localise="__MSG_exceptionsTab__"
>
Exceptions
</button>
@ -39,7 +39,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableNitter__">Nitter Redirects</h1>
<h1 data-localise="__MSG_disableNitter__">Nitter Redirects</h1>
</td>
<td>
<input
@ -59,7 +59,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableInvidious__">
<h1 data-localise="__MSG_disableInvidious__">
Invidious Redirects
</h1>
</td>
@ -81,7 +81,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableBibliogram__">
<h1 data-localise="__MSG_disableBibliogram__">
Bibliogram Redirects
</h1>
</td>
@ -103,7 +103,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableOsm__">
<h1 data-localise="__MSG_disableOsm__">
OpenStreetMap Redirects
</h1>
</td>
@ -121,7 +121,7 @@
</table>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_nitterInstance__">Nitter Instance</h1>
<h1 data-localise="__MSG_nitterInstance__">Nitter Instance</h1>
<div class="autocomplete">
<input
id="nitter-instance"
@ -132,7 +132,7 @@
</div>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_invidiousInstance__">Invidious Instance</h1>
<h1 data-localise="__MSG_invidiousInstance__">Invidious Instance</h1>
<div class="autocomplete">
<input
id="invidious-instance"
@ -142,7 +142,7 @@
</div>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_bibliogramInstance__">Bibliogram Instance</h1>
<h1 data-localise="__MSG_bibliogramInstance__">Bibliogram Instance</h1>
<div class="autocomplete">
<input
id="bibliogram-instance"
@ -152,7 +152,7 @@
</div>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_osmInstance__">OpenStreetMap Instance</h1>
<h1 data-localise="__MSG_osmInstance__">OpenStreetMap Instance</h1>
<div class="autocomplete">
<input
id="osm-instance"
@ -162,7 +162,7 @@
</div>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_theme__">Theme</h1>
<h1 data-localise="__MSG_theme__">Theme</h1>
<select id="theme">
<option value="">System</option>
<option value="light-theme">Light</option>
@ -180,7 +180,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_alwaysProxy__">
<h1 data-localise="__MSG_alwaysProxy__">
Always proxy videos through Invidious
</h1>
</td>
@ -205,7 +205,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_onlyEmbeddedVideo__">
<h1 data-localise="__MSG_onlyEmbeddedVideo__">
Only redirect embedded video to Invidious
</h1>
</td>
@ -223,7 +223,7 @@
</table>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_videoQuality__">Invidious Video Quality</h1>
<h1 data-localise="__MSG_videoQuality__">Invidious Video Quality</h1>
<select id="video-quality">
<option value="">Default</option>
<option value="hd720">720p</option>
@ -238,7 +238,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_invidiousDarkMode__">
<h1 data-localise="__MSG_invidiousDarkMode__">
Invidious dark mode always on
</h1>
</td>
@ -257,7 +257,7 @@
</table>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_invidiousVolume__">Invidious Volume</h1>
<h1 data-localise="__MSG_invidiousVolume__">Invidious Volume</h1>
<input
id="invidious-volume"
name="invidious-volume"
@ -268,7 +268,7 @@
/>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_invidiousPlayerStyle__">
<h1 data-localise="__MSG_invidiousPlayerStyle__">
Invidious Player Style
</h1>
<select id="invidious-player-style">
@ -277,7 +277,7 @@
</select>
</section>
<section class="settings-block">
<h1 data-localize="__MSG_invidiousSubtitles__">
<h1 data-localise="__MSG_invidiousSubtitles__">
Invidious Subtitles - language codes (comma-separated)
</h1>
<input
@ -294,7 +294,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_invidiousAutoplay__">
<h1 data-localise="__MSG_invidiousAutoplay__">
Invidious automatically play video on load
</h1>
</td>
@ -316,7 +316,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_persistInvidiousPrefs__">
<h1 data-localise="__MSG_persistInvidiousPrefs__">
Persist Invidious preferences (as cookie)
</h1>
</td>
@ -342,7 +342,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_removeTwitterSW__">
<h1 data-localise="__MSG_removeTwitterSW__">
Proactively remove Twitter service worker
</h1>
</td>
@ -362,19 +362,16 @@
</div>
<div id="exceptions" class="tabcontent">
<section
class="settings-block"
data-localize="__MSG_exceptionsDescription__"
>
<p>
<section class="settings-block">
<p data-localise="__MSG_exceptionsDescriptionP1__">
Enter a URL or Regular Expression to be excluded from redirects.
</p>
<p>
<p data-localise="__MSG_exceptionsDescriptionP2__">
All requests for or initiating from a URL that matches your exception
will be excluded from redirects.
</p>
<p>
<b>Note -</b> Supports JavaScript regular expressions, excluding the
<p data-localise="__MSG_exceptionsDescriptionP3__">
Note - Supports JavaScript regular expressions, excluding the
enclosing forward slashes.
</p>
</section>
@ -383,7 +380,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_addException__">Add Exception</h1>
<h1 data-localise="__MSG_addException__">Add Exception</h1>
</td>
</tr>
<tr>

View File

@ -15,12 +15,14 @@
alt="Privacy Redirect logo"
/>
<h1>
<span data-localize="__MSG_privacy__" class="privacy">Privacy</span
><br /><span data-localize="__MSG_redirect__">Redirect</span>
<span data-localise="__MSG_privacy__" class="privacy">Privacy</span
><br /><span data-localise="__MSG_redirect__">Redirect</span>
</h1>
</div>
<div class="version">
<span>Version:&nbsp;<span id="version"></span></span>
<span data-localise="__MSG_version__">Version</span>:&nbsp;<span
id="version"
></span>
</div>
</header>
@ -29,7 +31,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableNitter__">Nitter Redirects</h1>
<h1 data-localise="__MSG_disableNitter__">Nitter Redirects</h1>
</td>
<td>
<input
@ -50,7 +52,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableInvidious__">
<h1 data-localise="__MSG_disableInvidious__">
Invidious Redirects
</h1>
</td>
@ -73,7 +75,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableBibliogram__">
<h1 data-localise="__MSG_disableBibliogram__">
Bibliogram Redirects
</h1>
</td>
@ -96,7 +98,7 @@
<tbody>
<tr>
<td>
<h1 data-localize="__MSG_disableOsm__">
<h1 data-localise="__MSG_disableOsm__">
OpenStreetMap Redirects
</h1>
</td>
@ -118,7 +120,7 @@
<footer>
<a class="button" id="more-options">
<span data-localize="__MSG_moreOptions__">More Options&nbsp;</span>
<span data-localise="__MSG_moreOptions__">More Options&nbsp;</span>
<svg
xmlns="http://www.w3.org/2000/svg"
width="512"

View File

@ -17,7 +17,7 @@ browser.storage.sync.get(
"theme",
],
(result) => {
document.body.classList.add(result.theme);
if (result.theme) document.body.classList.add(result.theme);
disableNitter.checked = !result.disableNitter;
disableInvidious.checked = !result.disableInvidious;
disableBibliogram.checked = !result.disableBibliogram;