Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

libai / footsen

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • footsen
  • js
  • new
  • langnew.js
Find file
BlameHistoryPermalink
  • agan's avatar
    新的ios主页 · 1fc3c551
    agan committed 3 years ago
    1fc3c551
langnew.js 2.73 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

var langList = [
	//中文 英文 阿拉伯文
	{
		foot1: '儲值',
		foot2: '下載APP',
		foot3: '邀請碼:',
		foot4: '複製成功',
	},
	{
		foot1: 'Top-up',
		foot2: 'Download APP',
		foot3: 'Invitation code:',
		foot4: 'Copy success',
	},
	{
		foot1: 'شحن',
		foot2: 'تحميل التطبيق',
		foot3: 'شفرة الدعوة:',
		foot4: 'تم النسخ بنجاح',
	}
]
var langType = 0;
var langStr = (navigator.language || navigator.browserLanguage).toLowerCase();
if (sessionStorage.lang == undefined || sessionStorage.lang == 'undefined') {
	if (langStr.indexOf('ar') >= 0) {
		sessionStorage.lang = 7;
		$('.langTitle font').html('العربية');
		langType = 2;
		$('.langList p').eq(2).addClass('check');
	} else if (langStr.indexOf('zh') >= 0) {
		sessionStorage.lang = 2;
		$('.langTitle font').html('繁體中文');
		langType = 0;
		$('.langList p').eq(0).addClass('check');
	} else {
		sessionStorage.lang = 1;
		$('.langTitle font').html('English');
		langType = 1;
		$('.langList p').eq(1).addClass('check');
	}
} else {
	if (sessionStorage.lang == 7) {
		langType = 2;
		$('.langTitle font').html('العربية');
		$('.langList p').eq(2).addClass('check');
	} else if (sessionStorage.lang == 2) {
		langType = 0;
		$('.langTitle font').html('繁體中文');
		$('.langList p').eq(0).addClass('check');
	} else {
		langType = 1;
		$('.langTitle font').html('English');
		$('.langList p').eq(1).addClass('check');
	}
}

$(function () {
	lang();
	$('.langTitle').on('click', function (e) {
		$('.langList').show();
		$('.langTitle img').attr('src', 'https://footseen.com/img/up2.png');
		e.stopPropagation();
	})
	$('.langList p').on('click', function (e) {
		$(this).addClass('check').siblings().removeClass('check');
		$('.langTitle font').html($(this).html());
		$('.langList').hide();
		$('.langTitle img').attr('src', 'https://footseen.com/img/down2.png');
		sessionStorage.lang = $(this).attr('data-lang');
		lang();
		e.stopPropagation();
	})
	$(document).on('click', function (e) {
		$('.langList').hide();
		$('.langTitle img').attr('src', 'https://footseen.com/img/down2.png');

		e.stopPropagation();
	})
})

function lang() {
	if (sessionStorage.lang == 1) {
		langType = 1;
	} else if (sessionStorage.lang == 2) {
		langType = 0;
	} else if (sessionStorage.lang == 7) {
		langType = 2;
	}
	$('.code span').html(langList[langType].foot3 + getRequest().agentCode);
	$('.topUp').html(langList[langType].foot1);
}

function getRequest() {
	var url = location.href;
	var theRequest = new Object();
	if (url.indexOf("?") != -1) {
		var str = url.substr(url.indexOf("?") + 1);
		strs = str.split("&");
		for (var i = 0; i < strs.length; i++) {
			theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
		}
	}
	return theRequest;
}