2024-03-12, update for cityline
parent
67b86ebaee
commit
eb4f0dbeb5
|
@ -1,21 +1,72 @@
|
||||||
|
function getHtmlDocName() {
|
||||||
|
var pathname = location.pathname;
|
||||||
|
var pathParts = pathname.split('/');
|
||||||
|
if(pathParts.length >= 3) return pathParts[2];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToCityline(){
|
||||||
|
window.location="https://www.cityline.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRetryUrl(requestUrl){
|
||||||
|
urlThrottler = requestUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
function startCountDownTimer() {
|
||||||
|
setRetryUrl(window.location.href);
|
||||||
|
|
||||||
|
if (enableAutoRetry){
|
||||||
|
setRemainTime(remainTime);
|
||||||
|
if (ddsScheduler == undefined) {
|
||||||
|
ddsScheduler = setInterval(function(){
|
||||||
|
updateRemainTime();
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
document.getElementById("remainTime1").innerHTML = '';
|
||||||
|
$('#btn-retry-en-1').removeAttr('disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRemainTime(sec) {
|
||||||
|
document.getElementById("remainTime1").innerHTML = '(' +sec+ ')';
|
||||||
|
}
|
||||||
|
|
||||||
function goEvent(){
|
function goEvent(){
|
||||||
if(urlThrottler.indexOf('https://event.cityline.com/')>-1) {
|
|
||||||
window.location.href = urlThrottler;
|
window.location.href = urlThrottler;
|
||||||
} else {
|
}
|
||||||
document.getElementById("multiple_tab_layout").innerHTML = 'start to retry';
|
|
||||||
|
/*
|
||||||
|
function goEvent(){
|
||||||
|
if(urlThrottler) {
|
||||||
|
if(window.location.href.indexOf("https://msg.cityline.com/") > -1) {
|
||||||
|
if(urlThrottler == "https://event.cityline.com") {
|
||||||
|
if(window.location.href.indexOf("?") > -1) {
|
||||||
|
urlThrottler = "https://event.cityline.com/queue?" + window.location.href.split("?")[1];
|
||||||
|
}
|
||||||
|
document.getElementById("multiple_tab_layout").innerHTML = '';
|
||||||
|
$('#busy_zone').removeClass('d-none')
|
||||||
|
document.getElementById("busy_zone").innerHTML = '<div class="event"><button id="btn-retry-en-1" class="btn_cta" type="button" onclick="javascript:goEvent()">請重試 Retry<span id="remainTime1"></span></button></div>';
|
||||||
|
|
||||||
var ddsScheduler = undefined;
|
var ddsScheduler = undefined;
|
||||||
var retryingMsg = "重試中...<br>Retrying...";
|
setRemainTime(remainTime);
|
||||||
var retryingMsg2 = "重試中... Retrying...";
|
if (ddsScheduler == undefined) {
|
||||||
var enableAutoRetry = true;
|
ddsScheduler = setInterval(function(){
|
||||||
var remainTime = 10;
|
updateRemainTime();
|
||||||
var enableButtonTime = 7;
|
}, 1000);
|
||||||
|
|
||||||
document.getElementById("busy_zone").innerHTML = '<button id="btn-retry-en-1" class="btn_cta" type="button" onclick="javascript:goEvent()">請重試 Retry<span id="remainTime1"></span></button>';
|
|
||||||
setTimeout(startCountDownTimer, 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(urlThrottler.indexOf("?") > -1) {
|
||||||
|
document.getElementById("multiple_tab_layout").innerHTML = urlThrottler;
|
||||||
|
window.location.href = urlThrottler;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
|
@ -66,3 +117,36 @@ function dom_ready()
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
dom_ready();
|
dom_ready();
|
||||||
}, 100);
|
}, 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(() => {
|
||||||
|
console.log('set item');
|
||||||
|
SetItem(ItemType.Local, "");
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,8 @@
|
||||||
"matches": [
|
"matches": [
|
||||||
"https://msg.cityline.com/*.html*",
|
"https://msg.cityline.com/*.html*",
|
||||||
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
|
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
|
||||||
"https://event.cityline.com/"
|
"https://event.cityline.com/",
|
||||||
|
"https://event.cityline.com/queue?loc=*"
|
||||||
],
|
],
|
||||||
"run_at": "document_end",
|
"run_at": "document_end",
|
||||||
"js": [
|
"js": [
|
||||||
|
@ -320,7 +321,8 @@
|
||||||
"matches": [
|
"matches": [
|
||||||
"https://msg.cityline.com/*",
|
"https://msg.cityline.com/*",
|
||||||
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
|
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
|
||||||
"https://event.cityline.com/"
|
"https://event.cityline.com/",
|
||||||
|
"https://event.cityline.com/queue?loc=*"
|
||||||
],
|
],
|
||||||
"run_at": "document_end",
|
"run_at": "document_end",
|
||||||
"world": "MAIN",
|
"world": "MAIN",
|
||||||
|
|
Loading…
Reference in New Issue