diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 181c7e8..17f4a9a 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -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" diff --git a/config_launcher.py b/config_launcher.py index 345c162..24b9036 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -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" diff --git a/settings.py b/settings.py index 3f9ba46..a4ad5cc 100644 --- a/settings.py +++ b/settings.py @@ -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" diff --git a/webdriver/Maxbotplus_1.0.0/js/ibon_area.js b/webdriver/Maxbotplus_1.0.0/js/ibon_area.js index ade9c0b..aca3eed 100644 --- a/webdriver/Maxbotplus_1.0.0/js/ibon_area.js +++ b/webdriver/Maxbotplus_1.0.0/js/ibon_area.js @@ -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=""; + $("body").append(done_div); } } else { location.reload(); diff --git a/webdriver/Maxbotplus_1.0.0/js/ibon_area_front.js b/webdriver/Maxbotplus_1.0.0/js/ibon_area_front.js new file mode 100644 index 0000000..7537621 --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/ibon_area_front.js @@ -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); +} diff --git a/webdriver/Maxbotplus_1.0.0/js/ibon_detail.js b/webdriver/Maxbotplus_1.0.0/js/ibon_detail.js index d0092c3..50666ba 100644 --- a/webdriver/Maxbotplus_1.0.0/js/ibon_detail.js +++ b/webdriver/Maxbotplus_1.0.0/js/ibon_detail.js @@ -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, diff --git a/webdriver/Maxbotplus_1.0.0/js/ibon_ticket_next.js b/webdriver/Maxbotplus_1.0.0/js/ibon_ticket_next.js index 60c3f31..de7d6c9 100644 --- a/webdriver/Maxbotplus_1.0.0/js/ibon_ticket_next.js +++ b/webdriver/Maxbotplus_1.0.0/js/ibon_ticket_next.js @@ -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); } diff --git a/webdriver/Maxbotplus_1.0.0/js/tixcraft_ticket.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_ticket.js index 568adbd..e66f5d2 100644 --- a/webdriver/Maxbotplus_1.0.0/js/tixcraft_ticket.js +++ b/webdriver/Maxbotplus_1.0.0/js/tixcraft_ticket.js @@ -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); diff --git a/webdriver/Maxbotplus_1.0.0/manifest.json b/webdriver/Maxbotplus_1.0.0/manifest.json index 3a7e699..2ae9edc 100644 --- a/webdriver/Maxbotplus_1.0.0/manifest.json +++ b/webdriver/Maxbotplus_1.0.0/manifest.json @@ -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" } \ No newline at end of file