From 05a98fe0f18f3fbccc0eeb882822637edc75496c Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 25 Apr 2024 20:01:17 +0800 Subject: [PATCH] 2024-04-11, add bank register event --- chrome_tixcraft.py | 2 +- config_launcher.py | 2 +- nodriver_tixcraft.py | 2 +- settings.json | 2 +- settings.py | 6 +- webdriver/Maxbotplus_1.0.0/js/hncb_fill.js | 67 ++++++++++++++++++++++ webdriver/Maxbotplus_1.0.0/manifest.json | 10 ++++ 7 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 webdriver/Maxbotplus_1.0.0/js/hncb_fill.js diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 95de2c9..a38939a 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -44,7 +44,7 @@ except Exception as exc: print(exc) pass -CONST_APP_VERSION = "MaxBot (2024.04.10)" +CONST_APP_VERSION = "MaxBot (2024.04.11)" 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 7d066bf..9644ef4 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -24,7 +24,7 @@ import webbrowser import util -CONST_APP_VERSION = "MaxBot (2024.04.09)" +CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/nodriver_tixcraft.py b/nodriver_tixcraft.py index 8824474..d2fb1a8 100644 --- a/nodriver_tixcraft.py +++ b/nodriver_tixcraft.py @@ -32,7 +32,7 @@ except Exception as exc: print(exc) pass -CONST_APP_VERSION = "MaxBot (2024.04.10)" +CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/settings.json b/settings.json index 9edd351..41d6d76 100644 --- a/settings.json +++ b/settings.json @@ -76,7 +76,7 @@ "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", - "auto_reload_page_interval": 0.0, + "auto_reload_page_interval": 0.2, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, diff --git a/settings.py b/settings.py index c1d973a..2f3ffd6 100644 --- a/settings.py +++ b/settings.py @@ -34,7 +34,7 @@ try: except Exception as exc: pass -CONST_APP_VERSION = "MaxBot (2024.04.10)" +CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" @@ -670,7 +670,7 @@ def get_default_config(): config_dict["advanced"]["user_guess_string"] = "" config_dict["advanced"]["remote_url"] = "http://127.0.0.1:%d/" % (CONST_SERVER_PORT) - config_dict["advanced"]["auto_reload_page_interval"] = 0 + config_dict["advanced"]["auto_reload_page_interval"] = 0.2 config_dict["advanced"]["reset_browser_interval"] = 0 config_dict["advanced"]["kktix_status_api"] = False config_dict["advanced"]["max_dwell_time"] = 60 @@ -2749,7 +2749,7 @@ def settgins_gui_timer(): preview_question_text_file() update_maxbot_runtime_status() change_maxbot_status_by_keyword() - time.sleep(0.3) + time.sleep(0.4) if GLOBAL_SERVER_SHUTDOWN: break diff --git a/webdriver/Maxbotplus_1.0.0/js/hncb_fill.js b/webdriver/Maxbotplus_1.0.0/js/hncb_fill.js new file mode 100644 index 0000000..968352d --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/hncb_fill.js @@ -0,0 +1,67 @@ +const storage = chrome.storage.local; +var settings = null; +var inputInterval = null; + +function hncb_main(settings) { + let is_text_sent = false; + let user_guess_string_array = []; + if(settings) { + if(settings.advanced.user_guess_string.length > 0) { + if(settings.advanced.user_guess_string!='""') { + user_guess_string_array = JSON.parse('[' + settings.advanced.user_guess_string +']'); + } + } + } + + let target_row=null; + let all_row = $("input[name='IDNO']"); + if (all_row.length > 0 && user_guess_string_array.length > 0) + { + //console.log("input count:" + all_row.length); + let travel_index=0; + all_row.each(function () + { + let current_index = all_row.index(this); + //console.log("current_index:" + current_index); + if(current_index+1 <= user_guess_string_array.length) { + //console.log("input data:" + user_guess_string_array[current_index]); + console.log("input value:" + $(this).val()); + if($(this).val()=="") { + if(user_guess_string_array[current_index].length) { + $(this).val(user_guess_string_array[current_index]); + is_text_sent = true; + } + } else { + is_text_sent = true; + } + } + }); + } + + if(is_text_sent) { + console.log("start focus"); + document.querySelector("#TrxCaptchaKey").focus(); + } + + return is_text_sent; +} + +storage.get('settings', function (items) +{ + if (items.settings) + { + settings = items.settings; + } +}); + +storage.get('status', function (items) +{ + if (items.status && items.status=='ON') + { + inputInterval= setInterval(() => { + hncb_main(settings); + }, 200); + } else { + //console.log('maxbot status is not ON'); + } +}); diff --git a/webdriver/Maxbotplus_1.0.0/manifest.json b/webdriver/Maxbotplus_1.0.0/manifest.json index f7a8e4f..e0217c3 100644 --- a/webdriver/Maxbotplus_1.0.0/manifest.json +++ b/webdriver/Maxbotplus_1.0.0/manifest.json @@ -453,6 +453,16 @@ "jquery.min.js", "js/kktix_registrations_reload.js" ] + }, + { + "matches": [ + "https://netbank.hncb.com.tw/netbank/servlet/TrxDispatcher?trx=com.lb.wibc.trx.CardPromoteOverall_RWD&state=prompt" + ], + "run_at": "document_start", + "js": [ + "jquery.min.js", + "js/hncb_fill.js" + ] } ], "version": "1.0.25"