diff --git a/assets/icons/language.svg b/assets/icons/language.svg new file mode 100644 index 0000000..5350475 --- /dev/null +++ b/assets/icons/language.svg @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/index.html b/index.html index 3626a05..96aa74e 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ -
We are currently evaluating if uBlock Origin's filters have been updated to deal with the latest Anti-Adblocker script. This website doesn't check your device. It simply compares text files provided by the uBO team to let you know the current status of uBO's solutions for YouTube.
- - -Please come back later.
- +We are currently evaluating if uBlock Origin's filters have been updated to deal with the latest Anti-Adblocker script. This website doesn't check your device. It simply compares text files provided by the uBO team to let you know the current status of uBO's solutions for YouTube.
+ + +Please come back later.
+ - + -It simply gets the info of the latest YT script ID solved by uBlock Origin and compares it against the latest YouTube Anti-Adblocker script ID. +
It simply gets the info of the latest YT script ID solved by uBlock Origin and compares it against the latest YouTube Anti-Adblocker script ID. If it's the same, then the uBlock Origin team has finally updated their filters. If it's not, a fix is on the way. This website does not check if your own uBlock Origin version is up-to-date.
-You can make changes and pull request to the dev
branch.
Please keep in mind we are all volunteers. We don't get any revenue from this and we cannot be online 24/7. Thanks for understanding!
+You can make changes and pull request to the dev
branch.
Please keep in mind we are all volunteers. We don't get any revenue from this and we cannot be online 24/7. Thanks for understanding!
dev
branch.",
+ "h2-4-2": "Please keep in mind we are all volunteers. We don't get any revenue from this and we cannot be online 24/7. Thanks for understanding!"
+}
\ No newline at end of file
diff --git a/lang/es-ES.json b/lang/es-ES.json
new file mode 100644
index 0000000..017a0bb
--- /dev/null
+++ b/lang/es-ES.json
@@ -0,0 +1,34 @@
+{
+ "html-title":"¿uBlock Origin (uBO) es capaz de bloquear anuncios en YouTube?",
+ "main-question": "Puede uBlock Origin (uBO) saltarse el último script anti-adblock de YouTube?",
+ "answer-default": "Ni idea",
+ "answer-yes": "SÍ",
+ "answer-no": "NO",
+
+ "troubleshoot-footer": "¿Sigues teniendo la molesta ventana emergente? Consulte r/uBlockOrigin",
+ "update-since-yes": "Última actualización del parche: ",
+ "update-since-no": "Última actualización de YT: ",
+
+ "h2-1": "Qué es esto?",
+ "h2-1-default": "Ahora mismo estamos evaluando si los filtros de uBlock Origin se han actualizado para hacer frente al último script Anti-Adblocker. Este sitio web no analiza tu dispositivo. Simplemente compara bases de datos proporcionados por el equipo de uBO para informarte del estado actual de los filtros de uBO para YouTube.",
+ "h2-1-yes": "Los filtros de uBO pueden saltarse el script Anti-Adblocker de YouTube, y puedes ver YouTube sin anuncios de forma segura",
+ "h2-1-no": "Significa que los filtros de uBO aún no se han actualizado para evitar el último script de YouTube, por lo que es posible que detecten uBO",
+
+ "h3-1": "¿Significa esto que uBlock Origin no funciona en YouTube?",
+ "h3-1-1": "Un ID distinto no siempre significa que detectarán uBO.",
+ "h3-1-2": "uBlock Origin podría seguir funcionando en YouTube. No todas las actualizaciones de YT están dirigidas contra las soluciones de uBO.",
+
+ "h2-2": "¿Qué debería hacer ahora?",
+ "h2-2-default": "Por favor, inténtelo de nuevo más tarde",
+ "h2-2-yes": "A lo mejor necesitas forzar una actualización de los filtros 'Quick fixes' de uBlock Origin y eliminar cualquier conflicto provocado por otra extensión o ver qué está causando la detección. Cerrar sesión, limpiar las cookies de YouTube y Google, cerrando las pestañas de YT y reiniciando tu navegador podría ayudarte. dev
. Es recmendable que uses inglés para comunicarte con los que mantienen el proyecto",
+ "h2-4-2": "Por favor, piensa que todos somos voluntarios. No obtenemos ningún beneficio económico de esto y no podemos estar pendientes 24/7. Gracias por entenderlo."
+}
\ No newline at end of file
diff --git a/main.js b/main.js
index 044ebea..3520efb 100644
--- a/main.js
+++ b/main.js
@@ -5,6 +5,7 @@ Main javascript function.
import { areCodesEqual } from "./modules/are_codes_equal.mjs"
import { changeUpdatedDateHTML } from "./modules/change_updated_date_html.mjs"
import { quickFilterButtonChange } from "./modules/quick_filter_button_change.mjs"
+import { getLanguage } from "./modules/languaje.mjs"
const UBLOCK_LIST = "https://raw.githubusercontent.com/stephenhawk8054/misc/main/yt-fix.txt"
const UBLOCK_API_URL = "https://api.github.com/repos/stephenhawk8054/misc/commits?path=yt-fix.txt&page=1&per_page=1";
@@ -116,6 +117,7 @@ async function main(){
}
window.addEventListener("load", (event) => {
+ getLanguage();
main();
});
diff --git a/modules/are_codes_equal.mjs b/modules/are_codes_equal.mjs
index 9dcf495..76188a9 100644
--- a/modules/are_codes_equal.mjs
+++ b/modules/are_codes_equal.mjs
@@ -112,22 +112,18 @@ async function areCodesEqual({id_ublock, id_yt, force_deploy_url, forceEquality
// All the changes listed below.
if (codes.id_ublock == codes.id_yt) {
// It means uBlock is updated to the latest YouTube script.
- document.getElementById('main-answer').innerHTML = "YES";
changeBgColor('yes');
changeShortcutIconColor('yes');
displayClassname('default', 'none');
displayClassname('aa-blocked', 'block');
displayTroubleshootLink(true);
- document.getElementById('update-since-footer-p').innerHTML = 'Latest Solution: '
} else {
// It means YouTube has a new update not registered by uBlock.
- document.getElementById('main-answer').innerHTML = "NO";
changeBgColor('no');
changeShortcutIconColor('no');
displayClassname('default', 'none');
displayClassname('not-aa-blocked', 'block');
displayTroubleshootLink(false);
- document.getElementById('update-since-footer-p').innerHTML = 'YT script changed: '
}
})
}
diff --git a/modules/languaje.mjs b/modules/languaje.mjs
new file mode 100644
index 0000000..e1e5846
--- /dev/null
+++ b/modules/languaje.mjs
@@ -0,0 +1,76 @@
+/* languaje.mjs
+Controls which language is being displayed in use. It will use a "php-esque" query varibale in the url:
+www.example.com/?lang=en
+
+The main language is gonna be english, so if no variable is provided it should display english (And maybe
+ change the URL?)
+
+Language codes are going to be using the IANA code (es, en, ja...)
+https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
+It will detect the language and the region. If the region is not avaliable/not in the list it will pick another
+*/
+// Avaliable languages. Manual change (so outdated languages can be removed)
+const avaliable_lang_reg = ['en-EN'];
+
+function getLanguage(){
+ // Get the language parameter from the URL
+ const url_params = new URLSearchParams(window.location.search);
+ const lang_param = url_params.get('lang') ?? 'en-EN'; // Default is English.
+
+ console.log("Querried language is: ", lang_param);
+ console.log("AVALIABLE: ", avaliable_lang_reg);
+
+ if (lang_param != 'en_EN'){
+ setLanguage(lang_param)
+ }
+}
+
+function setLanguage(lang) {
+ // Implement logic to set the language as needed
+ console.log('Language:', lang);
+ let language_file = './lang/' + lang + '.json'
+ loadJsonFile(language_file)
+ .then(trans_data => {
+ // Thinking about what the fuck I'm gonna write here.
+ console.log(trans_data);
+
+ const translatable_elements = document.querySelectorAll('.translatable')
+ translatable_elements.forEach(element => {
+ let translation_key = element.dataset.translate;
+ if (trans_data[translation_key] != undefined){
+ // If the key does not exist ignore it.
+ element.innerHTML = trans_data[translation_key];
+ };
+
+ })
+ })
+ .catch(error => {
+ console.error('Error loading JSON: ', error)
+ })
+}
+
+async function loadJsonFile(filePath){
+ // Basically gets a public json file in the server.
+ try {
+ const response = await fetch(filePath);
+
+ if (!response.ok) {
+ throw new Error(`Failed to load JSON file: ${response.statusText}`);
+ }
+
+ const jsonData = await response.json();
+ return jsonData;
+ } catch (error) {
+ console.error(error.message);
+ }
+}
+
+// [Not Used] Function that would be run manually before deploying the website,
+// just in case the list of languages is huge.
+
+function avaliableLanguages(avaliable_lang_reg) {
+ // This will take avaliableLangReg and generate a list of avaliableLangs
+ return avaliable_lang_reg.map(tag => tag.split('-')[0]);
+}
+
+export { getLanguage }
\ No newline at end of file