forked from binary-com/binary-mt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
105 lines (104 loc) · 4.46 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<style id="antiClickjack">body{display:none !important;}</style>
<script type="text/javascript">
if (self === top) {
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>
<title>MT5.binary.com</title>
<meta charset="utf-8" />
<!-- <meta name="google-site-verification" content="Myh35QddfEArh0686LcO2zMjrgv0C7L4FCBU0k0oZvU" /> -->
<script type="text/javascript">
function getCookieItem(sKey) {
'use strict';
if (!sKey) { return null; }
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
}
function getLanguage(country) {
var langs = {
'ar': 'dz|bh|km|dj|eg|iq|jo|kw|lb|ly|mr|ma|om|ps|qa|sa|so|sd|sy|tn|ae|ye',
'de': 'de|at|li',
'es': 'ar|bo|cl|co|cr|cu|do|ec|sv|gt|hn|mx|ni|pa|py|pr|es|uy|ve',
'fr': 'fr|ad|bj|bf|cf|cg|ga|gn|ml|mc|ne|sn|tg',
'id': 'id',
'it': 'it',
'pl': 'po',
'pt': 'br|mz|ao|pt|gw|pg|cv|st',
'ru': 'ru|ua|by|kz',
'vi': 'vn',
'zh_tw': 'tw|mo',
'zh_cn': 'cn|sg',
};
var conLang = 'en';
if(country) {
Object.keys(langs).map(function(l) {
if((new RegExp(langs[l], 'i')).test(country)) conLang = l;
});
}
return conLang;
}
function redirect() {
window.location.href = (lang || 'en').toLowerCase() + '/' + 'home.html' + window.location.search;
}
function isDelayedRedirect() {
if(isGtmApplicable() && !window.redirectTimeOut) {
window.redirectTimeOut = setTimeout(redirect, 5000);
} else {
clearTimeout(window.redirectTimeOut);
redirect();
}
}
function isGtmApplicable() {
return /mt5\.binary\.com/i.test(window.location.hostname);
}
function pushEvent() {
/*if(isGtmApplicable()) {
dataLayer.push({
'event': 'page_load',
'eventCallback': function() {*/
isDelayedRedirect();
/*}
});
}*/
}
if(document.referrer) {
localStorage.setItem('index_referrer', document.referrer);
}
var lang = getCookieItem('language');
if(lang) {
isDelayedRedirect();
} else {
var ws = new WebSocket('wss://ws.binaryws.com/websockets/v3');
ws.onopen = function(e) {
ws.send(JSON.stringify({'website_status': '1'}));
};
ws.onmessage = function(msg) {
var response = JSON.parse(msg.data);
if(response.msg_type === 'website_status') {
if(!response.error && response.hasOwnProperty('website_status')) {
lang = getLanguage(response.website_status.clients_country);
}
ws.close();
isDelayedRedirect();
}
};
}
</script>
</head>
<body onload="pushEvent()">
<!-- Google Tag Manager
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-MZWFF7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script data-cfasync="false">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MZWFF7');</script>
End Google Tag Manager -->
</body>
</html>