summaryrefslogtreecommitdiffstats
path: root/HTML
diff options
context:
space:
mode:
Diffstat (limited to 'HTML')
-rw-r--r--HTML/mdk_redirect.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/HTML/mdk_redirect.js b/HTML/mdk_redirect.js
new file mode 100644
index 0000000..80c6538
--- /dev/null
+++ b/HTML/mdk_redirect.js
@@ -0,0 +1,27 @@
+function LANGUAGE() {
+ var s = navigator.browserLanguage || navigator.language;
+ if (s[2] == '-') {
+ s = s.substring(0, 2) + '_' + s.substring(3, 5).toUpperCase()
+ }
+ if (s == "pt_BR" || s == "zh_CN") return s;
+ return s.substring(0, 2);
+}
+
+
+function myname() {
+ var s = window.location.pathname
+ var i
+ i = s.lastIndexOf("/")
+ if (i >= 0) s = s.substring(i + 1, 99)
+ i = s.lastIndexOf(".html")
+ if (i >= 0) s = s.substring(0, i)
+ return s;
+}
+
+function may_redirect()
+{
+ var name = myname()
+ if (name.indexOf("-") == -1)
+ window.location.href = '../../mdk/indexhtml/' + name + '-' + LANGUAGE() + '.html';
+}
+