-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
3,292 additions
and
3,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src/_locales/ | ||
.github/ | ||
.gitea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"printWidth": 120, | ||
"semi": false, | ||
"singleQuote": false, | ||
"trailingComma": "es5", | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
{ | ||
"name": "libredirect", | ||
"description": "Redirects YouTube, Twitter, TikTok and more to privacy friendly frontends.", | ||
"engines": { | ||
"node": ">=16.13.1", | ||
"npm": ">=8.1.2" | ||
}, | ||
"scripts": { | ||
"start": "web-ext run", | ||
"nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", | ||
"android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix", | ||
"build": "web-ext build", | ||
"test": "web-ext lint", | ||
"html": "pug --basedir ./ --obj ./src/config.json src/pages/options/index.pug --out src/pages/options/ && pug --basedir ./ --obj ./src/config.json src/pages/popup/popup.pug --out src/pages/popup/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/libredirect/libredirect.git" | ||
}, | ||
"author": "LibRedirect", | ||
"license": "GPL-3.0-only", | ||
"bugs": { | ||
"url": "https://github.com/libredirect/libredirect/issues" | ||
}, | ||
"homepage": "https://libredirect.github.io", | ||
"devDependencies": { | ||
"pug-cli": "^1.0.0-alpha6", | ||
"web-ext": "^7.2.0" | ||
}, | ||
"webExt": { | ||
"sourceDir": "./src/", | ||
"run": { | ||
"browserConsole": true | ||
}, | ||
"build": { | ||
"overwriteDest": true | ||
} | ||
} | ||
"name": "libredirect", | ||
"description": "Redirects YouTube, Twitter, TikTok and more to privacy friendly frontends.", | ||
"engines": { | ||
"node": ">=16.13.1", | ||
"npm": ">=8.1.2" | ||
}, | ||
"scripts": { | ||
"start": "web-ext run", | ||
"nightly": "web-ext run --firefox=/home/esmail/software/firefox_nightly/firefox", | ||
"android": "web-ext run -t firefox-android --adb-device emulator-5554 --firefox-apk org.mozilla.fenix", | ||
"build": "web-ext build", | ||
"test": "web-ext lint", | ||
"html": "pug --basedir ./ --obj ./src/config.json src/pages/options/index.pug --out src/pages/options/ && pug --basedir ./ --obj ./src/config.json src/pages/popup/popup.pug --out src/pages/popup/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/libredirect/libredirect.git" | ||
}, | ||
"author": "LibRedirect", | ||
"license": "GPL-3.0-only", | ||
"bugs": { | ||
"url": "https://github.com/libredirect/libredirect/issues" | ||
}, | ||
"homepage": "https://libredirect.github.io", | ||
"devDependencies": { | ||
"pug-cli": "^1.0.0-alpha6", | ||
"web-ext": "^7.2.0" | ||
}, | ||
"webExt": { | ||
"sourceDir": "./src/", | ||
"run": { | ||
"browserConsole": true | ||
}, | ||
"build": { | ||
"overwriteDest": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
window.browser = window.browser || window.chrome | ||
|
||
function localisePage() { | ||
/** | ||
* @param {string} tag | ||
*/ | ||
function getMessage(tag) { | ||
return tag.replace(/__MSG_(\w+)__/g, (_match, v1) => { | ||
return v1 ? browser.i18n.getMessage(v1) : null | ||
}) | ||
} | ||
/** | ||
* @param {string} tag | ||
*/ | ||
function getMessage(tag) { | ||
return tag.replace(/__MSG_(\w+)__/g, (_match, v1) => { | ||
return v1 ? browser.i18n.getMessage(v1) : null | ||
}) | ||
} | ||
|
||
const elements = document.querySelectorAll("[data-localise]") | ||
for (let i in elements) | ||
if (elements.hasOwnProperty(i)) { | ||
const obj = elements[i] | ||
const tag = obj.getAttribute("data-localise").toString() | ||
const msg = getMessage(tag) | ||
if (msg && msg !== tag) obj.textContent = msg | ||
} | ||
const elements = document.querySelectorAll("[data-localise]") | ||
for (let i in elements) | ||
if (elements.hasOwnProperty(i)) { | ||
const obj = elements[i] | ||
const tag = obj.getAttribute("data-localise").toString() | ||
const msg = getMessage(tag) | ||
if (msg && msg !== tag) obj.textContent = msg | ||
} | ||
|
||
const placeholders = document.querySelectorAll("[data-localise-placeholder]") | ||
for (let i in placeholders) | ||
if (placeholders.hasOwnProperty(i)) { | ||
const obj = placeholders[i] | ||
const tag = obj.getAttribute("data-localise-placeholder").toString() | ||
const msg = getMessage(tag) | ||
if (msg && msg !== tag) obj.placeholder = msg | ||
} | ||
const placeholders = document.querySelectorAll("[data-localise-placeholder]") | ||
for (let i in placeholders) | ||
if (placeholders.hasOwnProperty(i)) { | ||
const obj = placeholders[i] | ||
const tag = obj.getAttribute("data-localise-placeholder").toString() | ||
const msg = getMessage(tag) | ||
if (msg && msg !== tag) obj.placeholder = msg | ||
} | ||
} | ||
|
||
export default { | ||
localisePage, | ||
localisePage, | ||
} |
Oops, something went wrong.