tixcraft_bot/webdriver/Maxbotplus_1.0.0/js/cityline_msg_front.js

91 lines
2.7 KiB
JavaScript
Raw Normal View History

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);
$("#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-15 12:40:08 +00:00
if(auto_reload_page_interval < 0.1) {
auto_reload_page_interval = 0.1;
}
if(status=='ON') {
2024-03-21 07:42:29 +00:00
let target_interval = auto_reload_page_interval * 1000;
setInterval(() => {
2024-04-16 01:38:03 +00:00
$(".eventposter").off();
$(".btn_cta").prop('disabled', false);
if(location.href.indexOf('?loc=') > -1) {
if(location.href.indexOf('%2F') > -1) {
2024-04-12 07:46:24 +00:00
const myArray = url.split("lang=TW");
2024-04-16 01:38:03 +00:00
if(myArray.length >=3) {
if(myArray[1]=="utsvInternet") {
let new_url = "https://event.cityline.com/utsvInternet/"+myArray[1]+"/home?lang=TW";
location.href = new_url;
}
}
2024-04-12 07:46:24 +00:00
}
2024-04-11 09:52:16 +00:00
if (typeof setRetryUrl !== "undefined") {
2024-04-16 01:38:03 +00:00
setRetryUrl(window.location.href);
2024-04-11 09:52:16 +00:00
}
2024-04-11 02:56:01 +00:00
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-16 01:38:03 +00:00
//goEvent();
remainTime = 0;
2024-04-11 02:56:01 +00:00
}
2024-04-15 04:09:44 +00:00
} else {
2024-04-16 01:38:03 +00:00
//$("#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-03-28 03:13:31 +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);
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