2024-01-18 17:35:42 +00:00
|
|
|
function begin()
|
|
|
|
{
|
|
|
|
let settings = JSON.parse($("#settings").html());
|
|
|
|
let status = $("#status").html();
|
2024-03-27 07:38:54 +00:00
|
|
|
//console.log("msg");
|
|
|
|
//console.log(settings);
|
|
|
|
//console.log(status);
|
2024-01-18 17:35:42 +00:00
|
|
|
|
|
|
|
$("#settings").remove();
|
|
|
|
$("#status").remove();
|
|
|
|
|
|
|
|
let auto_reload_page_interval = 0.0;
|
|
|
|
if(settings) {
|
|
|
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
|
|
|
}
|
|
|
|
|
|
|
|
// too short to cause error.
|
2024-04-01 04:16:06 +00:00
|
|
|
if(auto_reload_page_interval < 0.05) {
|
2024-04-15 04:09:44 +00:00
|
|
|
auto_reload_page_interval = 0.2;
|
2024-01-18 17:35:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(status=='ON') {
|
2024-03-21 07:42:29 +00:00
|
|
|
let target_interval = auto_reload_page_interval * 1000;
|
2024-01-18 17:35:42 +00:00
|
|
|
setInterval(() => {
|
2024-03-21 07:42:29 +00:00
|
|
|
//retry();
|
|
|
|
//console.log("trigger");
|
2024-04-12 07:46:24 +00:00
|
|
|
let url = window.location.href;
|
|
|
|
if(url.indexOf('lang=TW') > -1) {
|
|
|
|
const myArray = url.split("lang=TW");
|
2024-04-15 02:12:05 +00:00
|
|
|
//url = url[0]+"lang=TW";
|
2024-04-12 07:46:24 +00:00
|
|
|
}
|
2024-04-11 02:56:01 +00:00
|
|
|
$(".eventposter").off();
|
2024-04-11 09:52:16 +00:00
|
|
|
if (typeof setRetryUrl !== "undefined") {
|
2024-04-12 07:46:24 +00:00
|
|
|
setRetryUrl(url);
|
2024-04-11 09:52:16 +00:00
|
|
|
}
|
2024-04-11 02:56:01 +00:00
|
|
|
$(".btn_cta").prop('disabled', false);
|
|
|
|
//$(".btn_cta").prop('disabled', false).trigger("click");
|
|
|
|
if (typeof goEvent !== "undefined") {
|
2024-04-15 04:09:44 +00:00
|
|
|
let is_need_goEvent = false;
|
|
|
|
if(location.href.indexOf('home?') > -1) is_need_goEvent = true;
|
|
|
|
if(location.href.indexOf('?loc=') > -1) is_need_goEvent = true;
|
|
|
|
if(location.href.indexOf('lang=') > -1) is_need_goEvent = true;
|
|
|
|
if(is_need_goEvent) {
|
2024-04-11 02:56:01 +00:00
|
|
|
goEvent();
|
|
|
|
}
|
2024-04-15 04:09:44 +00:00
|
|
|
} else {
|
|
|
|
$("#btn-retry-en-1").prop('disabled', false).trigger("click");
|
2024-04-11 02:56:01 +00:00
|
|
|
}
|
2024-03-21 07:42:29 +00:00
|
|
|
}, target_interval);
|
2024-01-18 17:35:42 +00:00
|
|
|
}
|
2024-03-28 03:13:31 +00:00
|
|
|
|
2024-04-10 05:50:23 +00:00
|
|
|
if (typeof window.IsDuplicate !== "undefined") {
|
|
|
|
if(window.IsDuplicate()) {
|
|
|
|
window.IsDuplicate = function () {return false;};
|
|
|
|
document.getElementById("busy_zone").innerHTML = '<button id="btn-retry-en-1" class="btn_cta" type="button" disabled="disabled" onclick="javascript:goEvent()">請重試 Retry<span id="remainTime1"></span></button>';
|
|
|
|
setTimeout(startCountDownTimer, 1000);
|
|
|
|
}
|
2024-03-28 03:13:31 +00:00
|
|
|
}
|
2024-01-18 17:35:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function dom_ready()
|
|
|
|
{
|
|
|
|
//console.log("checking...");
|
|
|
|
if($("#settings").length>0) {
|
|
|
|
clearInterval(myInterval);
|
|
|
|
begin();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
myInterval = setInterval(() => {
|
|
|
|
dom_ready();
|
2024-03-28 05:01:54 +00:00
|
|
|
}, 100);
|
|
|
|
|
|
|
|
var ItemType = {
|
|
|
|
Session: 1,
|
|
|
|
Local: 2
|
|
|
|
};
|
|
|
|
|
|
|
|
var localStorageTabKey = 'my-application-browser-tab';
|
|
|
|
function SetItem(itemtype, val) {
|
|
|
|
switch (itemtype) {
|
|
|
|
case ItemType.Session:
|
|
|
|
window.name = val;
|
|
|
|
break;
|
|
|
|
case ItemType.Local:
|
|
|
|
setCookie(localStorageTabKey, val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setCookie(name, value, days) {
|
|
|
|
var expires = "";
|
|
|
|
if (days) {
|
|
|
|
var date = new Date();
|
|
|
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
|
|
expires = "; expires=" + date.toUTCString();
|
|
|
|
}
|
|
|
|
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
|
|
|
}
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
SetItem(ItemType.Local, "");
|
|
|
|
}, 100);
|
|
|
|
|
2024-04-11 02:56:01 +00:00
|
|
|
function getHtmlDocName() {
|
|
|
|
var pathname = location.pathname;
|
|
|
|
var pathParts = pathname.split('/');
|
|
|
|
if(pathParts.length >= 3) return pathParts[2];
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(getHtmlDocName()==null) {
|
|
|
|
history.back();
|
|
|
|
}
|
2024-04-15 04:09:44 +00:00
|
|
|
if (typeof goEvent !== "undefined") {
|
|
|
|
let is_need_back = true;
|
|
|
|
if(location.href.indexOf('home?') > -1) is_need_back = false;
|
|
|
|
if(location.href.indexOf('?loc=') > -1) is_need_back = false;
|
|
|
|
if(location.href.indexOf('lang=') > -1) is_need_back = false;
|
|
|
|
if (is_need_back) {
|
2024-04-11 02:56:01 +00:00
|
|
|
history.back();
|
|
|
|
}
|
|
|
|
}
|
2024-04-11 09:52:16 +00:00
|
|
|
|