-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.js
More file actions
49 lines (46 loc) · 1.22 KB
/
Copy pathcommon.js
File metadata and controls
49 lines (46 loc) · 1.22 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
function common_init() {
/*
setting
+---lang:language
0:en-gb English - Great Britain
1:zh-cn Chinese - China
+---color:color mode
0:normal polychromatic
1:monochromatic
*/
var setting = {};
setting.lang = 0;
setting.color = 0;
common_init_ReadCookie(setting);
}
function common_init_ReadCookie(setting) {
var CookieStr = document.cookie;
var index0, index1;
var substr;
// setting
// lang
index0 = CookieStr.search(/(^|;)\s*lang\s*=.*(;|$)/);
if (index0 != -1) {
// extract value field
index0 = CookieStr.indexOf("=", index0) + 1;
index1 = CookieStr.indexOf(";", index0);
if (index1 == -1) substr = CookieStr.slice(index0);
else substr = CookieStr.slice(index0, index1);
// convert to number
setting.lang = parseInt(substr);
}
// color
index0 = CookieStr.search(/(^|;)\s*color\s*=.*(;|$)/);
if (index0 != -1) {
// extract value field
index0 = CookieStr.indexOf("=", index0) + 1;
index1 = CookieStr.indexOf(";", index0);
if (index1 == -1) substr = CookieStr.slice(index0);
else substr = CookieStr.slice(index0, index1);
// convert to number
setting.color = parseInt(substr);
}
}
function common_init_LanguageSelector() {
}
common_init();