1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00
appwrite/public/scripts/services/rtl.js
2020-04-30 19:35:22 +03:00

31 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function (window) {
"use strict";
window.ls.container.set('rtl', function () {
var rtlStock = "^ا^ب^ت^ث^ج^ح^خ^د^ذ^ر^ز^س^ش^ص^ض^ط^ظ^ع^غ^ف^ق^ك^ل^م^ن^ه^و^ي^א^ב^ג^ד^ה^ו^ז^ח^ט^י^כ^ך^ל^מ^ם^נ^ן^ס^ע^פ^ף^צ^ץ^ק^ר^ש^ת^";
var special = ["\n", " ", " ", "״", '"', "_", "'", "!", "@", "#", "$", "^", "&", "%", "*", "(", ")", "+", "=", "-", "[", "]", "\\", "/", "{", "}", "|", ":", "<", ">", "?", ",", ".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
var isRTL = function(value) {
for (var i = 0; i < value.length; i++) {
if(/\s/g.test(value[i])) {
continue;
}
if (-1 === special.indexOf(value[i])) {
var firstChar = value[i];
break;
}
}
if (-1 < rtlStock.indexOf("^" + firstChar + "^")) {
return true;
}
return false;
};
return {
isRTL: isRTL,
};
}, true);
})(window);