You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.2 KiB
72 lines
2.2 KiB
var iframe = document.createElement('iframe');
|
|
if (
|
|
document.domain === 'www.tokcoder.com' ||
|
|
document.domain === 'tokcoder.com'
|
|
) {
|
|
iframe.src = 'https://www.educoder.net/autologin.html?t=' + Date.now();
|
|
} else {
|
|
iframe.src = 'https://www.tokcoder.com/autologin.html?t=' + Date.now();
|
|
}
|
|
iframe.sandbox =
|
|
'allow-scripts allow-same-origin allow-top-navigation allow-forms allow-popups allow-pointer-lock allow-popups-to-escape-sandbox allow-presentation allow-top-navigation-by-user-activation';
|
|
iframe.allow = 'geolocation document-domain';
|
|
iframe.style.position = 'absolute';
|
|
iframe.style.top = '-1000px';
|
|
iframe.style.opacity = 0;
|
|
iframe.style.visibility = 'hidden';
|
|
iframe.style.zIndex = -1;
|
|
document.body.appendChild(iframe);
|
|
iframe.onload = function() {
|
|
iframe.contentWindow.postMessage(
|
|
{ type: 'cookie', data: document.cookie },
|
|
'*',
|
|
);
|
|
};
|
|
|
|
|
|
window.gtag = new Function;
|
|
function setTop() {
|
|
if ((location.host.indexOf("ilearning") > -1 || location.host.indexOf("i-learning") > -1) && location.pathname.indexOf("/tasks") === -1) {
|
|
document.getElementById("root").style.paddingTop = "60px"
|
|
}
|
|
}
|
|
window.addEventListener('popstate', function () {
|
|
setTop();
|
|
})
|
|
setTop();
|
|
|
|
|
|
|
|
if (window.ENV !== 'dev') {
|
|
console.log = new Function;
|
|
}
|
|
function IEVersion() {
|
|
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
|
|
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
|
|
var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
|
|
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
|
|
if (isIE || isIE11) {
|
|
window.location.replace('/upgrade-browser.html');
|
|
}
|
|
}
|
|
IEVersion();
|
|
|
|
function getChromeVersion() {
|
|
var arr = navigator.userAgent.split(' ');
|
|
var chromeVersion = '';
|
|
for (var i = 0; i < arr.length; i++) {
|
|
if (/chrome/i.test(arr[i]))
|
|
chromeVersion = arr[i]
|
|
}
|
|
if (chromeVersion) {
|
|
return Number(chromeVersion.split('/')[1].split('.')[0]);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
if (getChromeVersion()) {
|
|
var version = getChromeVersion();
|
|
if (!!version && version < 70) {
|
|
window.location.replace('/upgrade-browser.html');
|
|
}
|
|
} |