Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-05-08 19:10:02 +0300
committerGitHub <noreply@github.com>2023-05-08 19:10:02 +0300
commit30a5f66f26164e1bcbdf9a0780a40bc56230e73c (patch)
tree749ce90b0895352639d2c45fa176a362b3105b32 /web/assets/js/langs.js
parent7bb3e517b2e279a52fb5627e011ea03fd91f648e (diff)
parentbb6e6861ca683894139c5307bd2d41f2e264fe00 (diff)
Merge pull request #381 from hamid-gh98/main
[FIX] bug logout path + [UPDATE] login UI and more ...
Diffstat (limited to 'web/assets/js/langs.js')
-rw-r--r--web/assets/js/langs.js84
1 files changed, 29 insertions, 55 deletions
diff --git a/web/assets/js/langs.js b/web/assets/js/langs.js
index e83b05f3..9e1f0911 100644
--- a/web/assets/js/langs.js
+++ b/web/assets/js/langs.js
@@ -1,41 +1,41 @@
const supportLangs = [
{
- name : "English",
- value : "en-US",
- icon : "🇺🇸"
+ name: 'English',
+ value: 'en-US',
+ icon: '🇺🇸',
},
{
- name : "Farsi",
- value : "fa_IR",
- icon : "🇮🇷"
+ name: 'Farsi',
+ value: 'fa_IR',
+ icon: '🇮🇷',
},
{
- name : "汉语",
- value : "zh-Hans",
- icon : "🇨🇳"
+ name: '汉语',
+ value: 'zh-Hans',
+ icon: '🇨🇳',
},
{
- name : "Russian",
- value : "ru_RU",
- icon : "🇷🇺"
+ name: 'Russian',
+ value: 'ru_RU',
+ icon: '🇷🇺',
},
-]
+];
-function getLang(){
- let lang = getCookie('lang')
+function getLang() {
+ let lang = getCookie('lang');
- if (! lang){
- if (window.navigator){
+ if (!lang) {
+ if (window.navigator) {
lang = window.navigator.language || window.navigator.userLanguage;
- if (isSupportLang(lang)){
- setCookie('lang' , lang , 150)
- }else{
- setCookie('lang' , 'en-US' , 150)
+ if (isSupportLang(lang)) {
+ setCookie('lang', lang, 150);
+ } else {
+ setCookie('lang', 'en-US', 150);
window.location.reload();
}
- }else{
- setCookie('lang' , 'en-US' , 150)
+ } else {
+ setCookie('lang', 'en-US', 150);
window.location.reload();
}
}
@@ -43,47 +43,21 @@ function getLang(){
return lang;
}
-function setLang(lang){
-
- if (!isSupportLang(lang)){
+function setLang(lang) {
+ if (!isSupportLang(lang)) {
lang = 'en-US';
}
- setCookie('lang' , lang , 150)
+ setCookie('lang', lang, 150);
window.location.reload();
}
-function isSupportLang(lang){
- for (l of supportLangs){
- if (l.value === lang){
+function isSupportLang(lang) {
+ for (l of supportLangs) {
+ if (l.value === lang) {
return true;
}
}
return false;
}
-
-
-
-function getCookie(cname) {
- let name = cname + "=";
- let decodedCookie = decodeURIComponent(document.cookie);
- let ca = decodedCookie.split(';');
- for(let i = 0; i <ca.length; i++) {
- let c = ca[i];
- while (c.charAt(0) == ' ') {
- c = c.substring(1);
- }
- if (c.indexOf(name) == 0) {
- return c.substring(name.length, c.length);
- }
- }
- return "";
-}
-
-function setCookie(cname, cvalue, exdays) {
- const d = new Date();
- d.setTime(d.getTime() + (exdays*24*60*60*1000));
- let expires = "expires="+ d.toUTCString();
- document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
-} \ No newline at end of file