mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
update to 4.0
This commit is contained in:
23
docs-src/assets/auto-lang.js
Normal file
23
docs-src/assets/auto-lang.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint no-var: off */
|
||||
/**
|
||||
* detect if the browser is in UTF-8 zone
|
||||
* @return boolean
|
||||
*/
|
||||
function isUTF8Zone() {
|
||||
return new Date().getTimezoneOffset() === -480;
|
||||
}
|
||||
|
||||
/**
|
||||
* detect if the browser is already in a locale view
|
||||
*/
|
||||
function isInLocaleView() {
|
||||
return /(cn|en)/i.test(location.href);
|
||||
}
|
||||
|
||||
function initDefaultLocaleAndStatic() {
|
||||
if (!isInLocaleView()) {
|
||||
location.href = isUTF8Zone() ? '/cn' : 'en';
|
||||
}
|
||||
}
|
||||
|
||||
initDefaultLocaleAndStatic();
|
||||
Reference in New Issue
Block a user