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", "message": "Ausnahmen",
"description": "Exceptions tab (options)." "description": "Exceptions tab (options)."
}, },
"exceptionsDescription": { "exceptionsDescriptionP1": {
"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>", "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 (options)." "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": { "addException": {
"message": "Ausnahme hinzufügen", "message": "Ausnahme hinzufügen",
@ -94,5 +102,9 @@
"redirect": { "redirect": {
"message": "Redirect", "message": "Redirect",
"description": "Extension title - Redirect (pop-up)." "description": "Extension title - Redirect (pop-up)."
},
"version": {
"message": "Version",
"description": "Version"
} }
} }

View File

@ -75,9 +75,17 @@
"message": "Exceptions", "message": "Exceptions",
"description": "Exceptions tab (options)." "description": "Exceptions tab (options)."
}, },
"exceptionsDescription": { "exceptionsDescriptionP1": {
"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>", "message": "Enter a URL or Regular Expression to be excluded from redirects.",
"description": "A description of the 'Exceptions' feature (options)." "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": { "addException": {
"message": "Add Exception", "message": "Add Exception",
@ -94,5 +102,9 @@
"redirect": { "redirect": {
"message": "Redirect", "message": "Redirect",
"description": "Extension title - Redirect (pop-up)." "description": "Extension title - Redirect (pop-up)."
},
"version": {
"message": "Version",
"description": "Version"
} }
} }

View File

@ -75,8 +75,16 @@
"message": "Exceptions", "message": "Exceptions",
"description": "Onglet des Exceptions dans les options." "description": "Onglet des Exceptions dans les options."
}, },
"exceptionsDescription": { "exceptionsDescriptionP1": {
"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>", "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." "description": "Description pour la rubrique 'Exceptions' dans les options."
}, },
"addException": { "addException": {
@ -94,5 +102,9 @@
"redirect": { "redirect": {
"message": "Redirect", "message": "Redirect",
"description": "Titre du module complémentaire - Redirection (pop-up)." "description": "Titre du module complémentaire - Redirection (pop-up)."
},
"version": {
"message": "Version",
"description": "Version"
} }
} }

View File

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

View File

@ -1,19 +1,19 @@
window.browser = window.browser || window.chrome; window.browser = window.browser || window.chrome;
function localizeHtmlPage() { function localisePage() {
// Localize using __MSG_***__ data tags var data = document.querySelectorAll("[data-localise]");
var data = document.querySelectorAll('[data-localize]');
for (var i in data) if (data.hasOwnProperty(i)) { for (var i in data)
var obj = data[i]; if (data.hasOwnProperty(i)) {
var tag = obj.getAttribute('data-localize').toString(); var obj = data[i];
var tag = obj.getAttribute("data-localise").toString();
var msg = tag.replace(/__MSG_(\w+)__/g, function (_match, v1) { var msg = tag.replace(/__MSG_(\w+)__/g, function (_match, v1) {
return v1 ? browser.i18n.getMessage(v1) : null; 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__", "name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__", "description": "__MSG_extensionDescription__",
"version": "1.1.37", "version": "1.1.38",
"manifest_version": 2, "manifest_version": 2,
"background": { "background": {
"scripts": ["background.js"], "scripts": ["background.js"],

View File

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

View File

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

View File

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