I try to block all websites in Hebrew because I want to give more time on websites in other languages.
Given that many webmasters don't add <meta name="language" content="Hebrew"> meta attribute to all webpages of their websites I can't use it to block websites which appear in a certain language.
According to one work the most common letter in Hebrew is Yod ('), parallel to the Arabic Ya (ي) and common in all Semitic languages, so what I try to do is to just block any webpage that has Yod in it:
const [...elements] = document.getElementsByTagName("*");
elements.forEach((element) => {
if (element.textContent.includes("י")) {
window.open("https://google.com/", "_self");
}
});
In my tests the code works on Hebrew-appearing-websites and doesn't work on non-Hebrew-appearing-websites, but maybe there is something to improve?