condense locale extraction for isRTL

This commit is contained in:
epicsam123 2025-02-04 21:45:22 -05:00 committed by GitHub
parent 814267bd1c
commit d8ac5e4782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,12 +1,7 @@
var video_data = JSON.parse(document.getElementById('video_data').textContent);
var isRTL = (() => {
var ltrChars = 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF'+'\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF',
rtlChars = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC',
rtlDirCheck = new RegExp('^[^'+ltrChars+']*['+rtlChars+']');
return rtlDirCheck.test(video_data.hide_replies_text);
})();
// Arabic, Persian, Hebrew
var isRTL = ["ar", "fa", "he"].includes(video_data.preferences.locale);
var spinnerHTML = '<h3 style="text-align:center"><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>';
var spinnerHTMLwithHR = spinnerHTML + '<hr>';