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: except Exception as exc:
pass 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_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -22,7 +22,7 @@ import sys
import threading import threading
import webbrowser 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_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -48,7 +48,7 @@ try:
except Exception as exc: except Exception as exc:
pass 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_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -36,42 +36,52 @@ function ibon_area_ready(settings) {
target_row=all_row; target_row=all_row;
} else { } else {
// multi select. // multi select.
try {
all_row.each(function () all_row.each(function ()
{ {
//console.log(all_row.index(this)); //console.log(all_row.index(this));
let is_match_keyword = false; let is_match_keyword = false;
if(all_row.index(this)==0) {
target_row=$(this);
} else {
if(area_keyword_array.length) { if(area_keyword_array.length) {
let html_text=$(this).text(); let html_text=$(this).text();
//console.log("html:"+html_text); //console.log("html:"+html_text);
for (let i = 0; i < area_keyword_array.length; i++) {
// TOOD: multi item matched, need sort. // 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); // 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 {
// single keyword.
if(html_text.indexOf(area_keyword_array[i])>-1) { if(html_text.indexOf(area_keyword_array[i])>-1) {
is_match_keyword = true; is_match_keyword = true;
target_row=$(this); target_row=$(this);
break; break;
} }
} }
}
} else { } else {
if(all_row.index(this)==0) { if(all_row.index(this)==0) {
is_match_keyword = true; is_match_keyword = true;
target_row=$(this); target_row=$(this);
} }
} }
}
//console.log("is_match_keyword:"+is_match_keyword); //console.log("is_match_keyword:"+is_match_keyword);
if(is_match_keyword) { if(is_match_keyword) {
return; throw {};
} }
}); });
} catch { }
} }
if(target_row) { 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 { } else {
location.reload(); 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); //console.log(event_code);
if(event_code){ if(event_code){
let api_url = "https://ticketapi.ibon.com.tw/api/ActivityInfo/GetGameInfoList"; let api_url = "https://ticketapi.ibon.com.tw/api/ActivityInfo/GetGameInfoList";
"{\"id\":38042,\"hasDeadline\":true,\"SystemBrowseType\":0}"
dataJSON = { dataJSON = {
id: parseInt(event_code, 10), id: parseInt(event_code, 10),
hasDeadline: true, hasDeadline: true,

View File

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

View File

@ -56,30 +56,31 @@ function tixcraft_assign_ticket_number(settings)
{ {
//console.log(all_row.index(this)); //console.log(all_row.index(this));
let is_match_keyword = false; let is_match_keyword = false;
if(all_row.index(this)==0) {
target_row=$(this);
} else {
if(area_keyword_array.length) { if(area_keyword_array.length) {
let html_text=$(this).text(); let html_text=$(this).text();
//console.log("html:"+html_text); //console.log("html:"+html_text);
for (let i = 0; i < area_keyword_array.length; i++) {
// TOOD: multi item matched, need sort. // 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); // 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) { if(html_text.indexOf(area_keyword_array[i])>-1) {
is_match_keyword = true; is_match_keyword = true;
target_row=$(this); target_row=$(this);
break; break;
} }
} }
}
} else { } else {
if(all_row.index(this)==0) { if(all_row.index(this)==0) {
is_match_keyword = true; is_match_keyword = true;
target_row=$(this); target_row=$(this);
} }
} }
}
//console.log("is_match_keyword:"+is_match_keyword); //console.log("is_match_keyword:"+is_match_keyword);
if(is_match_keyword) { if(is_match_keyword) {
return; return;

View File

@ -237,6 +237,17 @@
"js/ibon_area.js" "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": [ "matches": [
"https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*", "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"
} }