2024-02-06, update for maxbot plus extension on ibon.

master
Your Name 2024-03-08 12:05:56 +08:00
parent fc088781ab
commit 8c51f5338d
9 changed files with 95 additions and 49 deletions

View File

@ -41,7 +41,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.02.05)"
CONST_APP_VERSION = "MaxBot (2024.02.06)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -22,7 +22,7 @@ import sys
import threading
import webbrowser
CONST_APP_VERSION = "MaxBot (2024.02.05)"
CONST_APP_VERSION = "MaxBot (2024.02.06)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -48,7 +48,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.02.05)"
CONST_APP_VERSION = "MaxBot (2024.02.06)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -36,25 +36,30 @@ function ibon_area_ready(settings) {
target_row=all_row;
} else {
// multi select.
all_row.each(function ()
{
//console.log(all_row.index(this));
let is_match_keyword = false;
if(all_row.index(this)==0) {
target_row=$(this);
} else {
try {
all_row.each(function ()
{
//console.log(all_row.index(this));
let is_match_keyword = false;
if(area_keyword_array.length) {
let html_text=$(this).text();
//console.log("html:"+html_text);
// TOOD: multi item matched, need sort.
for (let i = 0; i < area_keyword_array.length; i++) {
// TOOD: multi item matched, need sort.
// target_area = get_target_area_with_order(settings, matched_block);
//console.log("area_keyword:"+area_keyword_array[i]);
if(html_text.indexOf(area_keyword_array[i])>-1) {
is_match_keyword = true;
target_row=$(this);
break;
if(area_keyword_array[i].indexOf(" ")>-1) {
// TODO: muti keywords with AND logic.
} else {
// single keyword.
if(html_text.indexOf(area_keyword_array[i])>-1) {
is_match_keyword = true;
target_row=$(this);
break;
}
}
}
} else {
@ -63,15 +68,20 @@ function ibon_area_ready(settings) {
target_row=$(this);
}
}
}
//console.log("is_match_keyword:"+is_match_keyword);
if(is_match_keyword) {
return;
}
});
//console.log("is_match_keyword:"+is_match_keyword);
if(is_match_keyword) {
throw {};
}
});
} catch { }
}
if(target_row) {
target_row.click();
//console.log("found target, clicking");
// click fail on sandbox world.
//target_row.click();
let done_div="<div style='display:none' id='maxbot'>"+ target_row.attr("id") +"</div>";
$("body").append(done_div);
}
} else {
location.reload();

View File

@ -0,0 +1,31 @@
var myInterval = null;
function dom_ready()
{
let ret=false;
if($("#maxbot").length>0) {
let target_id = $("#maxbot").text();
//console.log(target_id);
$("#maxbot").remove();
ret=true;
if(myInterval) clearInterval(myInterval);
(function () {
if(target_id) {
console.log(target_id);
console.log($("#"+target_id).text());
//https://orders.ibon.com.tw/application/UTK02/UTK0201_000.aspx?PERFORMANCE_ID=B06PV2MC&PRODUCT_ID=B06PS1OC
//https://orders.ibon.com.tw/application/UTK02/UTK0202_.aspx?PERFORMANCE_ID=B06PV2MC&GROUP_ID=&PERFORMANCE_PRICE_AREA_ID=B06PV2PH
$("#"+target_id).trigger("click");
onTicketArea(target_id);
}
})();
}
//console.log("dom_ready:"+ret);
return ret;
}
if(!dom_ready()) {
myInterval = setInterval(() => {
dom_ready();
}, 100);
}

View File

@ -111,8 +111,6 @@ function ibon_event_status_check()
//console.log(event_code);
if(event_code){
let api_url = "https://ticketapi.ibon.com.tw/api/ActivityInfo/GetGameInfoList";
"{\"id\":38042,\"hasDeadline\":true,\"SystemBrowseType\":0}"
dataJSON = {
id: parseInt(event_code, 10),
hasDeadline: true,

View File

@ -1,11 +1,4 @@
var myInterval = null;
//console.log("assign appear");
function begin()
{
console.log("begin to next");
$("div#ticket-wrap a[onclick]").click();
}
function dom_ready()
{
@ -14,14 +7,16 @@ function dom_ready()
$("#done").remove();
ret=true;
if(myInterval) clearInterval(myInterval);
begin();
(function () {
$("div#ticket-wrap a[onclick]").click();
})();
}
console.log("dom_ready:"+ret);
//console.log("dom_ready:"+ret);
return ret;
}
if(!dom_ready()) {
myInterval = setInterval(() => {
dom_ready();
}, 100);
}, 100);
}

View File

@ -56,28 +56,29 @@ function tixcraft_assign_ticket_number(settings)
{
//console.log(all_row.index(this));
let is_match_keyword = false;
if(all_row.index(this)==0) {
target_row=$(this);
} else {
if(area_keyword_array.length) {
let html_text=$(this).text();
//console.log("html:"+html_text);
if(area_keyword_array.length) {
let html_text=$(this).text();
//console.log("html:"+html_text);
for (let i = 0; i < area_keyword_array.length; i++) {
// TOOD: multi item matched, need sort.
// target_area = get_target_area_with_order(settings, matched_block);
// TOOD: multi item matched, need sort.
for (let i = 0; i < area_keyword_array.length; i++) {
// target_area = get_target_area_with_order(settings, matched_block);
console.log("area_keyword:"+area_keyword_array[i]);
if(area_keyword_array[i].indexOf(" ")>-1) {
// TODO: muti keywords with AND logic.
} else {
if(html_text.indexOf(area_keyword_array[i])>-1) {
is_match_keyword = true;
target_row=$(this);
break;
}
}
} else {
if(all_row.index(this)==0) {
is_match_keyword = true;
target_row=$(this);
}
}
} else {
if(all_row.index(this)==0) {
is_match_keyword = true;
target_row=$(this);
}
}
//console.log("is_match_keyword:"+is_match_keyword);

View File

@ -237,6 +237,17 @@
"js/ibon_area.js"
]
},
{
"matches": [
"https://orders.ibon.com.tw/application/UTK02/UTK0201_000.aspx?*"
],
"run_at": "document_end",
"world": "MAIN",
"js": [
"jquery.min.js",
"js/ibon_area_front.js"
]
},
{
"matches": [
"https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*",
@ -388,5 +399,5 @@
]
}
],
"version": "1.0.11"
"version": "1.0.12"
}