diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 9fe6fcb..a1238aa 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -41,7 +41,7 @@ try: except Exception as exc: pass -CONST_APP_VERSION = "MaxBot (2024.01.18)" +CONST_APP_VERSION = "MaxBot (2024.01.19)" 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 465ceb4..39d69db 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -22,7 +22,7 @@ import sys import threading import webbrowser -CONST_APP_VERSION = "MaxBot (2024.01.18)" +CONST_APP_VERSION = "MaxBot (2024.01.19)" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/settings.py b/settings.py index 7831c2c..95a5d93 100644 --- a/settings.py +++ b/settings.py @@ -40,7 +40,7 @@ try: except Exception as exc: pass -CONST_APP_VERSION = "MaxBot (2024.01.18)" +CONST_APP_VERSION = "MaxBot (2024.01.19)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/webdriver/Maxbotplus_1.0.0/js/common.js b/webdriver/Maxbotplus_1.0.0/js/common.js index da73aab..cfed655 100644 --- a/webdriver/Maxbotplus_1.0.0/js/common.js +++ b/webdriver/Maxbotplus_1.0.0/js/common.js @@ -1,32 +1,40 @@ function get_target_area_with_order(settings, matched_block) { //console.log(settings); - let target_area = []; + let target_area = null; - if(settings.area_auto_select.mode=="from top to bottom") - target_area = matched_block.first(); - if(settings.area_auto_select.mode=="from bottom to top") - target_area = matched_block.last(); - if(settings.area_auto_select.mode=="center") - target_area = matched_block.first(); - if(settings.area_auto_select.mode=="random") - target_area = matched_block.first(); + if(matched_block.length) { + let last_index = matched_block.length-1 + let center_index = parseInt(last_index/2); + if(settings.area_auto_select.mode=="from top to bottom") + target_area = matched_block[0]; + if(settings.area_auto_select.mode=="from bottom to top") + target_area = matched_block[last_index]; + if(settings.area_auto_select.mode=="center") + target_area = matched_block[center_index]; + if(settings.area_auto_select.mode=="random") + target_area = matched_block[0]; + } return target_area; } function get_target_date_with_order(settings, matched_block) { //console.log(settings); - let target_area = []; + let target_area = null; - if(settings.date_auto_select.mode=="from top to bottom") - target_date = matched_block.first(); - if(settings.date_auto_select.mode=="from bottom to top") - target_date = matched_block.last(); - if(settings.date_auto_select.mode=="center") - target_date = matched_block.first(); - if(settings.date_auto_select.mode=="random") - target_date = matched_block.first(); + if(matched_block.length) { + let last_index = matched_block.length-1 + let center_index = parseInt(last_index/2); + if(settings.date_auto_select.mode=="from top to bottom") + target_area = matched_block[0]; + if(settings.date_auto_select.mode=="from bottom to top") + target_area = matched_block[last_index]; + if(settings.date_auto_select.mode=="center") + target_area = matched_block[center_index]; + if(settings.date_auto_select.mode=="random") + target_area = matched_block[0]; + } return target_area; } \ No newline at end of file diff --git a/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js b/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js index b3d70af..306f6b2 100644 --- a/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js +++ b/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js @@ -45,11 +45,10 @@ function kktix_area_keyword(settings, base_info, register_info) } } // console.log(area_keyword_array); - let target_area = []; + let target_area = null; if(area_keyword_array.length) { for (let i = 0; i < area_keyword_array.length; i++) { let matched_block=[]; - $("div.ticket-unit").each(function () { let html_text=$(this).text(); @@ -65,12 +64,15 @@ function kktix_area_keyword(settings, base_info, register_info) } } } else { - let query_string = "div.ticket-unit"; - let matched_block=$(query_string); + let matched_block=[]; + $("div.ticket-unit").each(function () + { + matched_block.push($(this)); + }); target_area = get_target_area_with_order(settings, matched_block); } - if (target_area.length) { + if (target_area) { let first_node = target_area.find(":first-child"); let link_id = first_node.attr("id"); //console.log("link_id: " + link_id); diff --git a/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js index 7520195..7c2bc69 100644 --- a/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js +++ b/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js @@ -36,14 +36,18 @@ function tixcraft_area_keyword(settings) } } // console.log(area_keyword_array); - let target_area=[]; + let target_area=null; if(area_keyword_array.length) { for (let i = 0; i < area_keyword_array.length; i++) { let query_string = "ul.area-list > li > a:contains('"+ area_keyword_array[i] +"')"; if(area_keyword_array[i]=="") { query_string = "ul.area-list > li > a" } - let matched_block=$(query_string); + let matched_block=[]; + $(query_string).each(function () + { + matched_block.push($(this)); + }); target_area = get_target_area_with_order(settings, matched_block); if (target_area.length) { console.log("match keyword:" + area_keyword_array[i]); @@ -52,11 +56,15 @@ function tixcraft_area_keyword(settings) } } else { let query_string = "ul.area-list > li > a"; - let matched_block=$(query_string); + let matched_block=[]; + $(query_string).each(function () + { + matched_block.push($(this)); + }); target_area = get_target_area_with_order(settings, matched_block); } - if (target_area.length) { + if (target_area) { let link_id = target_area.attr("id"); //console.log("link_id: " + link_id); if(link_id) { diff --git a/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js index 899f1f0..97d991c 100644 --- a/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js +++ b/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js @@ -35,27 +35,35 @@ function date_keyword(settings) } } //console.log(date_keyword_array); - let target_date; + let target_date=null; if(date_keyword_array.length) { for (let i = 0; i < date_keyword_array.length; i++) { let query_string = "#gameList td:contains('"+ date_keyword_array[i] +"')"; if(date_keyword_array[i]=="") { query_string = "#gameList td" } - let matched_block=$(query_string); + let matched_block=[]; + $(query_string).each(function () + { + matched_block.push($(this)); + }); target_date = get_target_date_with_order(settings, matched_block); - if (target_date.length) { + if (target_date) { console.log("match keyword:" + date_keyword_array[i]); break; } } } else { let query_string = "#gameList td"; - let matched_block=$(query_string); + let matched_block=[]; + $(query_string).each(function () + { + matched_block.push($(this)); + }); target_date = get_target_area_with_order(settings, matched_block); } - if (target_date.length) { + if (target_date) { let button_tag = "button"; const currentUrl = window.location.href; const domain = currentUrl.split('/')[2]; diff --git a/webdriver/Maxbotplus_1.0.0/manifest.json b/webdriver/Maxbotplus_1.0.0/manifest.json index e487696..3a7e699 100644 --- a/webdriver/Maxbotplus_1.0.0/manifest.json +++ b/webdriver/Maxbotplus_1.0.0/manifest.json @@ -159,7 +159,6 @@ "run_at": "document_end", "js": [ "jquery.min.js", - "js/common.js", "js/ticket_area.js" ] }, @@ -173,7 +172,6 @@ "run_at": "document_end", "js": [ "jquery.min.js", - "js/common.js", "js/ticket_ticket.js" ] }, @@ -386,10 +384,9 @@ "run_at": "document_start", "js": [ "jquery.min.js", - "js/common.js", "js/kktix_registrations_reload.js" ] } ], - "version": "1.0.10" + "version": "1.0.11" } \ No newline at end of file