From ec0b14d21fb30cb25842bda953c995ce5f40f8e2 Mon Sep 17 00:00:00 2001 From: CHUN YU YAO Date: Sun, 7 Jan 2024 01:44:06 +0800 Subject: [PATCH] 2023-12-27, update for kktix extension --- chrome_tixcraft.py | 27 +--- config_launcher.py | 2 +- settings.py | 35 ++++- text_server.py | 2 +- webdriver/Maxbot_1.0.0/data/settings.json | 1 - .../js/kktix_registrations_reload.js | 88 ------------ webdriver/Maxbot_1.0.0/js/tixcraft_area.js | 115 ---------------- webdriver/Maxbot_1.0.0/js/tixcraft_game.js | 110 --------------- .../background.js | 28 ++-- .../css/options.css | 0 webdriver/Maxbotplus_1.0.0/data/settings.json | 1 + .../dist/bootstrap/bootstrap.min.css | 0 .../dist/bootstrap/bootstrap.min.js | 0 .../icons/maxbot-128.png | Bin .../icons/maxbot-16.png | Bin .../icons/maxbot-32.png | Bin .../icons/maxbot-48.png | Bin .../icons/maxbot-64.png | Bin .../jquery.min.js | 0 .../js/checkbox.js | 0 .../js/cityline_event_common.js | 0 .../js/cityline_event_detail.js | 0 webdriver/Maxbotplus_1.0.0/js/common.js | 32 +++++ .../js/ibon_area.js | 0 .../js/kham_area.js | 0 .../js/kham_date.js | 0 .../js/kham_event_home.js | 0 .../js/kktix_events.js | 0 .../js/kktix_registrations_assign.js | 109 +++++++++++++++ .../js/kktix_registrations_reload.js | 126 ++++++++++++++++++ .../js/ticket_area.js | 0 .../js/ticket_date.js | 0 .../js/ticket_event_home.js | 0 .../js/ticketplus_activity.js | 0 .../js/ticketplus_order.js | 0 .../Maxbotplus_1.0.0/js/tixcraft_area.js | 117 ++++++++++++++++ .../js/tixcraft_detail.js | 0 .../Maxbotplus_1.0.0/js/tixcraft_game.js | 110 +++++++++++++++ .../js/tixcraft_home.js | 0 .../js/tixcraft_ticket.js | 0 .../manifest.json | 20 ++- .../modules/heartbeatconnect.js | 39 +++--- .../options.html | 0 .../options.js | 0 .../rules_1.json | 0 45 files changed, 587 insertions(+), 375 deletions(-) delete mode 100644 webdriver/Maxbot_1.0.0/data/settings.json delete mode 100644 webdriver/Maxbot_1.0.0/js/kktix_registrations_reload.js delete mode 100644 webdriver/Maxbot_1.0.0/js/tixcraft_area.js delete mode 100644 webdriver/Maxbot_1.0.0/js/tixcraft_game.js rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/background.js (76%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/css/options.css (100%) create mode 100644 webdriver/Maxbotplus_1.0.0/data/settings.json rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/dist/bootstrap/bootstrap.min.css (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/dist/bootstrap/bootstrap.min.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/icons/maxbot-128.png (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/icons/maxbot-16.png (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/icons/maxbot-32.png (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/icons/maxbot-48.png (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/icons/maxbot-64.png (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/jquery.min.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/checkbox.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/cityline_event_common.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/cityline_event_detail.js (100%) create mode 100644 webdriver/Maxbotplus_1.0.0/js/common.js rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/ibon_area.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/kham_area.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/kham_date.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/kham_event_home.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/kktix_events.js (100%) create mode 100644 webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js create mode 100644 webdriver/Maxbotplus_1.0.0/js/kktix_registrations_reload.js rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/ticket_area.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/ticket_date.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/ticket_event_home.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/ticketplus_activity.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/ticketplus_order.js (100%) create mode 100644 webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/tixcraft_detail.js (100%) create mode 100644 webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/tixcraft_home.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/js/tixcraft_ticket.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/manifest.json (87%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/modules/heartbeatconnect.js (81%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/options.html (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/options.js (100%) rename webdriver/{Maxbot_1.0.0 => Maxbotplus_1.0.0}/rules_1.json (100%) diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 636a3bc..7b51447 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -54,15 +54,14 @@ import webbrowser import chromedriver_autoinstaller -CONST_APP_VERSION = "MaxBot (2023.12.26)" +CONST_APP_VERSION = "MaxBot (2023.12.27)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" -MAXBOT_EXTENSION_NAME = "Maxbot_1.0.0" -MAXBOT_EXTENSION_STATUS_JSON = "status.json" +MAXBOT_EXTENSION_NAME = "Maxbotplus_1.0.0" CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com" URL_CHROME_DRIVER = 'https://chromedriver.chromium.org/' @@ -12235,27 +12234,6 @@ def get_current_url(driver): return url, is_quit_bot -def sync_status_to_extension(status): - Root_Dir = get_app_root() - webdriver_path = os.path.join(Root_Dir, "webdriver") - target_path = os.path.join(webdriver_path, MAXBOT_EXTENSION_NAME) - target_path = os.path.join(target_path, "data") - target_path = os.path.join(target_path, MAXBOT_EXTENSION_STATUS_JSON) - #print("save as to:", target_path) - status_json={} - status_json["status"]=status - #print("dump json to path:", target_path) - if not status: - with open(target_path, 'w') as outfile: - json.dump(status_json, outfile) - else: - if os.path.exists(target_path): - try: - os.unlink(target_path) - except Exception as exc: - print(exc) - pass - def main(args): config_dict = get_config_dict(args) @@ -12342,7 +12320,6 @@ def main(args): is_maxbot_paused = False if os.path.exists(CONST_MAXBOT_INT28_FILE): is_maxbot_paused = True - sync_status_to_extension(not is_maxbot_paused) if len(url) > 0 : if url != last_url: diff --git a/config_launcher.py b/config_launcher.py index 372f564..32f47a6 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -22,7 +22,7 @@ import sys import threading import webbrowser -CONST_APP_VERSION = "MaxBot (2023.12.26)" +CONST_APP_VERSION = "MaxBot (2023.12.27)" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/settings.py b/settings.py index a657c7e..36a9d7b 100644 --- a/settings.py +++ b/settings.py @@ -34,7 +34,7 @@ import ssl ssl._create_default_https_context = ssl._create_unverified_context -CONST_APP_VERSION = "MaxBot (2023.12.26)" +CONST_APP_VERSION = "MaxBot (2023.12.27)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" @@ -42,6 +42,9 @@ CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" +MAXBOT_EXTENSION_NAME = "Maxbotplus_1.0.0" +MAXBOT_EXTENSION_STATUS_JSON = "status.json" + CONST_SERVER_PORT_DEFAULT = 8888 CONST_SERVER_PORT = CONST_SERVER_PORT_DEFAULT @@ -2441,11 +2444,39 @@ def settings_timer(): update_maxbot_runtime_status() time.sleep(0.6) +def clean_extension_status(): + Root_Dir = get_app_root() + webdriver_path = os.path.join(Root_Dir, "webdriver") + target_path = os.path.join(webdriver_path, MAXBOT_EXTENSION_NAME) + target_path = os.path.join(target_path, "data") + target_path = os.path.join(target_path, MAXBOT_EXTENSION_STATUS_JSON) + if os.path.exists(target_path): + try: + os.unlink(target_path) + except Exception as exc: + print(exc) + pass + +def sync_status_to_extension(status): + Root_Dir = get_app_root() + webdriver_path = os.path.join(Root_Dir, "webdriver") + target_path = os.path.join(webdriver_path, MAXBOT_EXTENSION_NAME) + target_path = os.path.join(target_path, "data") + target_path = os.path.join(target_path, MAXBOT_EXTENSION_STATUS_JSON) + #print("save as to:", target_path) + status_json={} + status_json["status"]=status + #print("dump json to path:", target_path) + with open(target_path, 'w') as outfile: + json.dump(status_json, outfile) + def update_maxbot_runtime_status(): is_paused = False if os.path.exists(CONST_MAXBOT_INT28_FILE): is_paused = True + sync_status_to_extension(not is_paused) + try: global combo_language new_language = combo_language.get().strip() @@ -2746,6 +2777,8 @@ def main(): threading.Thread(target=settings_timer, daemon=True).start() root.mainloop() + print("exit settings") + clean_extension_status() def force_remove_file(filepath): if os.path.exists(filepath): diff --git a/text_server.py b/text_server.py index 544e68d..e55dfcd 100644 --- a/text_server.py +++ b/text_server.py @@ -27,7 +27,7 @@ import pyperclip import tornado from tornado.web import Application -CONST_APP_VERSION = "MaxBot (2023.12.26)" +CONST_APP_VERSION = "MaxBot (2023.12.27)" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" diff --git a/webdriver/Maxbot_1.0.0/data/settings.json b/webdriver/Maxbot_1.0.0/data/settings.json deleted file mode 100644 index cd01bb7..0000000 --- a/webdriver/Maxbot_1.0.0/data/settings.json +++ /dev/null @@ -1 +0,0 @@ -{"homepage": "https://kktix.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "weng.32002@gmail.com", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "eXlme2omX3Nq", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "adblock_plus_enable": false, "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": true, "auto_guess_options": true, "user_guess_string": "", "online_dictionary_url": "", "auto_reload_page_interval": 1.0, "auto_reload_random_delay": false, "proxy_server_port": ""}} \ No newline at end of file diff --git a/webdriver/Maxbot_1.0.0/js/kktix_registrations_reload.js b/webdriver/Maxbot_1.0.0/js/kktix_registrations_reload.js deleted file mode 100644 index 5ebc58c..0000000 --- a/webdriver/Maxbot_1.0.0/js/kktix_registrations_reload.js +++ /dev/null @@ -1,88 +0,0 @@ -const storage = chrome.storage.local; - -var myInterval = null; - -function clean_sold_out_row(data) -{ - console.log("clean_sold_out_row"); - - let match_target = false; - for (var key in data.inventory.ticketInventory) { - if(data.inventory.ticketInventory[key]) { - //console.log("key:"+key); - if($("#ticket_"+key).length) { - match_target = true; - break; - } - - } - } - //console.log("match_target:"+match_target); - if(match_target) { - $("footer").remove(); - $("div.banner-wrapper").remove(); - $("div.ticket-img-wrapper").remove(); - - $("span.ticket-quantity[ng-if=\"!purchasableAndSelectable\"]").each(function () - { - $(this).parent().parent().parent().remove(); - }); - clearInterval(myInterval); - } -} - -function kktix_ajax_done(data) -{ - let reload=false; - console.log(data.inventory.registerStatus); - // IN_STOCK - if(data.inventory.registerStatus=='OUT_OF_STOCK') {reload=true;} - if(data.inventory.registerStatus=='COMING_SOON') {reload=true;} - if(data.inventory.registerStatus=='SOLD_OUT') {reload=true;} - //console.log(reload); - if(reload) { - location.reload(); - } else { - $(function() { - myInterval = setInterval(() => { - clean_sold_out_row(data); - }, 200); - }); - } -} - -function kktix_event_status_check() -{ - const currentUrl = window.location.href; - const event_code = currentUrl.split('/')[4]; - //console.log(currentUrl); - //console.log(event_code); - if(event_code){ - let api_url = "https://kktix.com/g/events/"+ event_code +"/register_info"; - $.get( api_url, function() { - //alert( "success" ); - }) - .done(function(data) { - //alert( "second success" ); - kktix_ajax_done(data); - }) - .fail(function() { - //alert( "error" ); - }) - .always(function() { - //alert( "finished" ); - }); - } -} - - -storage.get('status', function (items) -{ - if (items.status && items.status=='ON') - { - kktix_event_status_check(); - } else { - console.log('no status found'); - } -}); - diff --git a/webdriver/Maxbot_1.0.0/js/tixcraft_area.js b/webdriver/Maxbot_1.0.0/js/tixcraft_area.js deleted file mode 100644 index 984d77b..0000000 --- a/webdriver/Maxbot_1.0.0/js/tixcraft_area.js +++ /dev/null @@ -1,115 +0,0 @@ -const storage = chrome.storage.local; -var settings = null; - -$("ul.area-list > li:not(:has(a))").remove(); -$("#selectseat div div img").remove(); -$("footer").remove(); - -function tixcraft_area_main(settings) { - if(settings) { - //console.log("area_mode:"+ settings.area_auto_select.mode); - //console.log("area_keyword:"+ settings.area_auto_select.area_keyword); - //console.log("keyword_exclude:"+ settings.keyword_exclude); - let exclude_keyword_array = []; - if(settings.keyword_exclude.length > 0) { - exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']'); - } - for (let i = 0; i < exclude_keyword_array.length; i++) { - $("ul.area-list > li > a:contains('"+ exclude_keyword_array[i] +"')").each(function () - { - $(this).parent().remove(); - } - ); - } - - { - let area_keyword_array = []; - if(settings.area_auto_select.area_keyword.length > 0) { - area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']'); - } - console.log(area_keyword_array); - let target_area; - 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" - } - if(settings.tixcraft.area_auto_select.mode=="from top to bottom") - target_area = $(query_string).first(); - if(settings.tixcraft.area_auto_select.mode=="from bottom to top") - target_area = $(query_string).last(); - if(settings.tixcraft.area_auto_select.mode=="center") - target_area = $(query_string).first(); - if(settings.tixcraft.area_auto_select.mode=="random") - target_area = $(query_string).first(); - - if (target_area.length) { - console.log("match keyword:" + area_keyword_array[i]); - break; - } - } - } else { - target_area = $("ul.area-list > li > a").first(); - } - - if (target_area.length) { - let link_id = target_area.attr("id"); - //console.log("link_id: " + link_id); - if(link_id) { - let body = document.body.innerHTML; - let areaUrlList = null; - if(body.indexOf('var areaUrlList =')>-1) { - const javasrit_right = body.split('var areaUrlList =')[1]; - let areaUrlHtml = ""; - if(javasrit_right) { - areaUrlHtml = javasrit_right.split("};")[0]; - } - if(areaUrlHtml.length > 0) { - areaUrlHtml = areaUrlHtml + "}"; - areaUrlList = JSON.parse(areaUrlHtml); - } - //console.log(areaUrlHtml); - } - - let new_url = null; - if(areaUrlList) { - let new_url = areaUrlList[link_id]; - if (new_url) { - //console.log(new_url); - window.location.href = new_url - } - } - } - } else { - console.log("not target_area found.") - } - } - } -} - -function area_auto_reload() -{ - if ($("ul.area-list > li:has(a)").length) { - storage.get('settings', function (items) - { - if (items.settings) - { - settings = items.settings; - tixcraft_area_main(settings); - } - }); - } else { - location.reload(); - } -} - -storage.get('status', function (items) -{ - if (items.status && items.status=='ON') - { - area_auto_reload(); - } else { - console.log('no status found'); - } -}); diff --git a/webdriver/Maxbot_1.0.0/js/tixcraft_game.js b/webdriver/Maxbot_1.0.0/js/tixcraft_game.js deleted file mode 100644 index d0a45fa..0000000 --- a/webdriver/Maxbot_1.0.0/js/tixcraft_game.js +++ /dev/null @@ -1,110 +0,0 @@ -const storage = chrome.storage.local; -var settings = null; -var myInterval = null; - -$("div.masthead-wrap").remove(); - -function date_clean() -{ - remove_list=['Currently Unavailable', - 'Sale ended on 20', - 'Sold out', - '暫停販售', - ':00 截止', - '已售完', - '00に発売終了', - '販売一時中止', - '完売した' - ]; - for (let i = 0; i < remove_list.length; i++) { - $("#gameList td:contains('"+ remove_list[i] +"')").each(function () - { - $(this).parent().remove(); - }); - } -} - -function date_main(settings) -{ - myInterval = setInterval(() => { - //console.log("date_mode:"+ settings.tixcraft.date_auto_select.mode); - //console.log("date_keyword:"+ settings.tixcraft.date_auto_select.date_keyword); - let date_keyword_array = []; - if(settings.tixcraft.date_auto_select.date_keyword.length > 0) { - date_keyword_array = JSON.parse('[' + settings.tixcraft.date_auto_select.date_keyword +']'); - } - //console.log(date_keyword_array); - let target_date; - 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" - } - if(settings.tixcraft.date_auto_select.mode=="from top to bottom") - target_date = $(query_string).first(); - if(settings.tixcraft.date_auto_select.mode=="from bottom to top") - target_date = $(query_string).last(); - if(settings.tixcraft.date_auto_select.mode=="center") - target_date = $(query_string).first(); - if(settings.tixcraft.date_auto_select.mode=="random") - target_date = $(query_string).first(); - - if (target_date.length) { - //console.log("match keyword:" + date_keyword_array[i]); - break; - } - } - } else { - target_date = $("#gameList td").first(); - } - - if (target_date.length) { - let link = target_date.parent().find("button").attr("data-href"); - if (link) { - //console.log("link: " + link); - clearInterval(myInterval); - window.location.href = link; - } - } else { - //console.log("not target_date found.") - } - }, 200); -} - -function date_auto_reload() -{ - if ($("#gameList button").length) { - date_clean(); - if ($("#gameList button").length) { - storage.get('settings', function (items) - { - if (items.settings) - { - settings = items.settings; - date_main(settings); - } else { - console.log('no settings found'); - } - }); - - } else { - location.reload(); - } - } else { - location.reload(); - } -} - -storage.get('status', function (items) -{ - console.log(items); - if (items.status && items.status=='ON') - { - date_auto_reload(); - } else { - console.log('no status found'); - } -}); - - diff --git a/webdriver/Maxbot_1.0.0/background.js b/webdriver/Maxbotplus_1.0.0/background.js similarity index 76% rename from webdriver/Maxbot_1.0.0/background.js rename to webdriver/Maxbotplus_1.0.0/background.js index 526d9d0..3ddbe88 100644 --- a/webdriver/Maxbot_1.0.0/background.js +++ b/webdriver/Maxbotplus_1.0.0/background.js @@ -32,20 +32,32 @@ chrome.declarativeNetRequest.onRuleMatchedDebug.addListener((e) => { //console.log(msg); }); -chrome.action.onClicked.addListener(async (tab) => { - const prevState = await chrome.action.getBadgeText({ tabId: tab.id }); - // Next state will always be the opposite - const nextState = prevState === 'ON' ? 'OFF' : 'ON'; +function set_status_to(flag) +{ + let nextState = 'ON'; + if(!flag) nextState = 'OFF'; + chrome.storage.local.set( { status: nextState } ); - // Set the action badge to the next state - await chrome.action.setBadgeText({ - tabId: tab.id, - text: nextState + chrome.action.setBadgeText({ + text: nextState + }); +} + +chrome.action.onClicked.addListener(async (tab) => { + chrome.storage.local.get('status', function (items) + { + let next_flag = true; + if (items.status && items.status=='ON') + { + next_flag = false; + } + console.log("next_flag:"+next_flag); + set_status_to(next_flag); }); }); diff --git a/webdriver/Maxbot_1.0.0/css/options.css b/webdriver/Maxbotplus_1.0.0/css/options.css similarity index 100% rename from webdriver/Maxbot_1.0.0/css/options.css rename to webdriver/Maxbotplus_1.0.0/css/options.css diff --git a/webdriver/Maxbotplus_1.0.0/data/settings.json b/webdriver/Maxbotplus_1.0.0/data/settings.json new file mode 100644 index 0000000..ad94138 --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/data/settings.json @@ -0,0 +1 @@ +{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "adblock_plus_enable": false, "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "online_dictionary_url": "", "auto_reload_page_interval": 1.0, "auto_reload_random_delay": false, "proxy_server_port": ""}} \ No newline at end of file diff --git a/webdriver/Maxbot_1.0.0/dist/bootstrap/bootstrap.min.css b/webdriver/Maxbotplus_1.0.0/dist/bootstrap/bootstrap.min.css similarity index 100% rename from webdriver/Maxbot_1.0.0/dist/bootstrap/bootstrap.min.css rename to webdriver/Maxbotplus_1.0.0/dist/bootstrap/bootstrap.min.css diff --git a/webdriver/Maxbot_1.0.0/dist/bootstrap/bootstrap.min.js b/webdriver/Maxbotplus_1.0.0/dist/bootstrap/bootstrap.min.js similarity index 100% rename from webdriver/Maxbot_1.0.0/dist/bootstrap/bootstrap.min.js rename to webdriver/Maxbotplus_1.0.0/dist/bootstrap/bootstrap.min.js diff --git a/webdriver/Maxbot_1.0.0/icons/maxbot-128.png b/webdriver/Maxbotplus_1.0.0/icons/maxbot-128.png similarity index 100% rename from webdriver/Maxbot_1.0.0/icons/maxbot-128.png rename to webdriver/Maxbotplus_1.0.0/icons/maxbot-128.png diff --git a/webdriver/Maxbot_1.0.0/icons/maxbot-16.png b/webdriver/Maxbotplus_1.0.0/icons/maxbot-16.png similarity index 100% rename from webdriver/Maxbot_1.0.0/icons/maxbot-16.png rename to webdriver/Maxbotplus_1.0.0/icons/maxbot-16.png diff --git a/webdriver/Maxbot_1.0.0/icons/maxbot-32.png b/webdriver/Maxbotplus_1.0.0/icons/maxbot-32.png similarity index 100% rename from webdriver/Maxbot_1.0.0/icons/maxbot-32.png rename to webdriver/Maxbotplus_1.0.0/icons/maxbot-32.png diff --git a/webdriver/Maxbot_1.0.0/icons/maxbot-48.png b/webdriver/Maxbotplus_1.0.0/icons/maxbot-48.png similarity index 100% rename from webdriver/Maxbot_1.0.0/icons/maxbot-48.png rename to webdriver/Maxbotplus_1.0.0/icons/maxbot-48.png diff --git a/webdriver/Maxbot_1.0.0/icons/maxbot-64.png b/webdriver/Maxbotplus_1.0.0/icons/maxbot-64.png similarity index 100% rename from webdriver/Maxbot_1.0.0/icons/maxbot-64.png rename to webdriver/Maxbotplus_1.0.0/icons/maxbot-64.png diff --git a/webdriver/Maxbot_1.0.0/jquery.min.js b/webdriver/Maxbotplus_1.0.0/jquery.min.js similarity index 100% rename from webdriver/Maxbot_1.0.0/jquery.min.js rename to webdriver/Maxbotplus_1.0.0/jquery.min.js diff --git a/webdriver/Maxbot_1.0.0/js/checkbox.js b/webdriver/Maxbotplus_1.0.0/js/checkbox.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/checkbox.js rename to webdriver/Maxbotplus_1.0.0/js/checkbox.js diff --git a/webdriver/Maxbot_1.0.0/js/cityline_event_common.js b/webdriver/Maxbotplus_1.0.0/js/cityline_event_common.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/cityline_event_common.js rename to webdriver/Maxbotplus_1.0.0/js/cityline_event_common.js diff --git a/webdriver/Maxbot_1.0.0/js/cityline_event_detail.js b/webdriver/Maxbotplus_1.0.0/js/cityline_event_detail.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/cityline_event_detail.js rename to webdriver/Maxbotplus_1.0.0/js/cityline_event_detail.js diff --git a/webdriver/Maxbotplus_1.0.0/js/common.js b/webdriver/Maxbotplus_1.0.0/js/common.js new file mode 100644 index 0000000..f1494e1 --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/common.js @@ -0,0 +1,32 @@ +function get_target_area_with_order(settings, matched_block) +{ + //console.log(settings); + let target_area = []; + + 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(); + return target_area; +} + +function get_target_date_with_order(settings, matched_block) +{ + //console.log(settings); + let target_area = []; + + if(settings.tixcraft.date_auto_select.mode=="from top to bottom") + target_date = matched_block.first(); + if(settings.tixcraft.date_auto_select.mode=="from bottom to top") + target_date = matched_block.last(); + if(settings.tixcraft.date_auto_select.mode=="center") + target_date = matched_block.first(); + if(settings.tixcraft.date_auto_select.mode=="random") + target_date = matched_block.first(); + + return target_area; +} \ No newline at end of file diff --git a/webdriver/Maxbot_1.0.0/js/ibon_area.js b/webdriver/Maxbotplus_1.0.0/js/ibon_area.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/ibon_area.js rename to webdriver/Maxbotplus_1.0.0/js/ibon_area.js diff --git a/webdriver/Maxbot_1.0.0/js/kham_area.js b/webdriver/Maxbotplus_1.0.0/js/kham_area.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/kham_area.js rename to webdriver/Maxbotplus_1.0.0/js/kham_area.js diff --git a/webdriver/Maxbot_1.0.0/js/kham_date.js b/webdriver/Maxbotplus_1.0.0/js/kham_date.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/kham_date.js rename to webdriver/Maxbotplus_1.0.0/js/kham_date.js diff --git a/webdriver/Maxbot_1.0.0/js/kham_event_home.js b/webdriver/Maxbotplus_1.0.0/js/kham_event_home.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/kham_event_home.js rename to webdriver/Maxbotplus_1.0.0/js/kham_event_home.js diff --git a/webdriver/Maxbot_1.0.0/js/kktix_events.js b/webdriver/Maxbotplus_1.0.0/js/kktix_events.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/kktix_events.js rename to webdriver/Maxbotplus_1.0.0/js/kktix_events.js diff --git a/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js b/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js new file mode 100644 index 0000000..813e7df --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_assign.js @@ -0,0 +1,109 @@ +var myInterval = null; +//console.log("assign appear"); + +function kktix_area_keyword(settings, register_info) +{ + let area_keyword_array = []; + if(settings.area_auto_select.area_keyword.length > 0) { + area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']'); + } + // console.log(area_keyword_array); + let target_area = []; + if(area_keyword_array.length) { + for (let i = 0; i < area_keyword_array.length; i++) { + let matched_flag=false; + let matched_block=[]; + + $("div.ticket-unit").each(function () + { + let html_text=$(this).text(); + if(html_text.indexOf(exclude_keyword_array[i])>-1) { + is_match_keyword=true; + } + if(is_match_keyword) { + matched_block.push($(this)); + } + target_area = get_target_area_with_order(settings, matched_block); + if (target_area.length) { + matched_flag=true; + } + }); + + if (matched_flag) { + console.log("match keyword:" + area_keyword_array[i]); + break; + } + } + } else { + let query_string = "div.ticket-unit"; + let matched_block=$(query_string); + target_area = get_target_area_with_order(settings, matched_block); + } + + if (target_area.length) { + let first_node = target_area.find(":first-child"); + let link_id = first_node.attr("id"); + //console.log("link_id: " + link_id); + if(link_id) { + $('input[type=checkbox]').each(function() { + //$(this).prop('checked', true); + if(!$(this).is(':checked')) { + $(this).click(); + } + }); + + let seat_inventory_key=link_id.split("_")[1]; + let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key]; + let ticket_number = settings.ticket_number; + if(seat_inventory_number0) { + /* + let target_input = target_area.find("input"); + target_input.click(); + target_input.prop("value", ticket_number); + let down = $.Event('keydown'); + down.key=""+ticket_number; + target_input.trigger(down); + + let up = $.Event('keyup'); + up.key=""+ticket_number; + target_input.trigger(up); + */ + let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]'); + for(let i=0; i button'); + $next_btn.click(); + } + } + } else { + console.log("not target_area found.") + } +} + +function begin() +{ + let settings = JSON.parse($("#settings").html()); + let register_info = JSON.parse($("#register_info").html()); + //console.log(settings); + //console.log(register_info); + kktix_area_keyword(settings, register_info); +} + +function dom_ready() +{ + //console.log("checking..."); + if($("#settings").length>0) { + clearInterval(myInterval); + begin(); + } +} + +myInterval = setInterval(() => { + dom_ready(); +}, 100); \ No newline at end of file diff --git a/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_reload.js b/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_reload.js new file mode 100644 index 0000000..0ca73f6 --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/kktix_registrations_reload.js @@ -0,0 +1,126 @@ +const storage = chrome.storage.local; + +var settings = null; +var myInterval = null; + +function kktix_clean_exclude(settings, register_info) +{ + let exclude_keyword_array = []; + if(settings.keyword_exclude.length > 0) { + exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']'); + } + for (let i = 0; i < exclude_keyword_array.length; i++) { + $("div.ticket-unit").each(function () + { + let html_text=$(this).text(); + let is_match_keyword=false; + if(html_text.indexOf(exclude_keyword_array[i])>-1) { + is_match_keyword=true; + } + if(is_match_keyword) { + $(this).remove(); + } + } + ); + } +} + +function clean_sold_out_row(register_info) +{ + //console.log("clean_sold_out_row"); + + let match_target = false; + for (var key in register_info.inventory.ticketInventory) { + if(register_info.inventory.ticketInventory[key]) { + //console.log("key:"+key); + if($("#ticket_"+key).length) { + match_target = true; + break; + } + + } + } + //console.log("match_target:"+match_target); + if(match_target) { + $("footer").remove(); + $("div.banner-wrapper").remove(); + $("div.ticket-img-wrapper").remove(); + + $("span.ticket-quantity[ng-if=\"!purchasableAndSelectable\"]").each(function () + { + $(this).parent().parent().parent().remove(); + }); + clearInterval(myInterval); + + if(settings) { + let settings_div=""; + $("body").append(settings_div); + let register_info_div=""; + $("body").append(register_info_div); + kktix_clean_exclude(settings, register_info); + //kktix_area_keyword(settings, register_info); + } + } +} + +function kktix_ajax_done(register_info) +{ + let reload=false; + console.log(register_info.inventory.registerStatus); + // IN_STOCK + if(register_info.inventory.registerStatus=='OUT_OF_STOCK') {reload=true;} + if(register_info.inventory.registerStatus=='COMING_SOON') {reload=true;} + if(register_info.inventory.registerStatus=='SOLD_OUT') {reload=true;} + //console.log(reload); + if(reload) { + location.reload(); + } else { + $(function() { + myInterval = setInterval(() => { + clean_sold_out_row(register_info); + }, 200); + }); + } +} + +function kktix_event_status_check() +{ + const currentUrl = window.location.href; + const event_code = currentUrl.split('/')[4]; + //console.log(currentUrl); + //console.log(event_code); + if(event_code){ + let api_url = "https://kktix.com/g/events/"+ event_code +"/register_info"; + $.get( api_url, function() { + //alert( "success" ); + }) + .done(function(data) { + //alert( "second success" ); + kktix_ajax_done(data); + }) + .fail(function() { + //alert( "error" ); + }) + .always(function() { + //alert( "finished" ); + }); + } +} + +storage.get('settings', function (items) +{ + if (items.settings) + { + settings = items.settings; + } +}); + +storage.get('status', function (items) +{ + if (items.status && items.status=='ON') + { + kktix_event_status_check(); + } else { + console.log('no status found'); + } +}); diff --git a/webdriver/Maxbot_1.0.0/js/ticket_area.js b/webdriver/Maxbotplus_1.0.0/js/ticket_area.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/ticket_area.js rename to webdriver/Maxbotplus_1.0.0/js/ticket_area.js diff --git a/webdriver/Maxbot_1.0.0/js/ticket_date.js b/webdriver/Maxbotplus_1.0.0/js/ticket_date.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/ticket_date.js rename to webdriver/Maxbotplus_1.0.0/js/ticket_date.js diff --git a/webdriver/Maxbot_1.0.0/js/ticket_event_home.js b/webdriver/Maxbotplus_1.0.0/js/ticket_event_home.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/ticket_event_home.js rename to webdriver/Maxbotplus_1.0.0/js/ticket_event_home.js diff --git a/webdriver/Maxbot_1.0.0/js/ticketplus_activity.js b/webdriver/Maxbotplus_1.0.0/js/ticketplus_activity.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/ticketplus_activity.js rename to webdriver/Maxbotplus_1.0.0/js/ticketplus_activity.js diff --git a/webdriver/Maxbot_1.0.0/js/ticketplus_order.js b/webdriver/Maxbotplus_1.0.0/js/ticketplus_order.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/ticketplus_order.js rename to webdriver/Maxbotplus_1.0.0/js/ticketplus_order.js diff --git a/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js new file mode 100644 index 0000000..9df972c --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/tixcraft_area.js @@ -0,0 +1,117 @@ +const storage = chrome.storage.local; +var settings = null; + +$("ul.area-list > li:not(:has(a))").remove(); +$("#selectseat div div img").remove(); +$("footer").remove(); + +function tixcraft_clean_exclude(settings) +{ + let exclude_keyword_array = []; + if(settings.keyword_exclude.length > 0) { + exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']'); + } + for (let i = 0; i < exclude_keyword_array.length; i++) { + $("ul.area-list > li > a:contains('"+ exclude_keyword_array[i] +"')").each(function () + { + $(this).parent().remove(); + } + ); + } +} + +function tixcraft_area_keyword(settings) +{ + let area_keyword_array = []; + if(settings.area_auto_select.area_keyword.length > 0) { + area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']'); + } + // console.log(area_keyword_array); + let target_area=[]; + 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); + target_area = get_target_area_with_order(settings, matched_block); + if (target_area.length) { + console.log("match keyword:" + area_keyword_array[i]); + break; + } + } + } else { + let query_string = "ul.area-list > li > a"; + let matched_block=$(query_string); + target_area = get_target_area_with_order(settings, matched_block); + } + + if (target_area.length) { + let link_id = target_area.attr("id"); + //console.log("link_id: " + link_id); + if(link_id) { + let body = document.body.innerHTML; + let areaUrlList = null; + if(body.indexOf('var areaUrlList =')>-1) { + const javasrit_right = body.split('var areaUrlList =')[1]; + let areaUrlHtml = ""; + if(javasrit_right) { + areaUrlHtml = javasrit_right.split("};")[0]; + } + if(areaUrlHtml.length > 0) { + areaUrlHtml = areaUrlHtml + "}"; + areaUrlList = JSON.parse(areaUrlHtml); + } + //console.log(areaUrlHtml); + } + + let new_url = null; + if(areaUrlList) { + let new_url = areaUrlList[link_id]; + if (new_url) { + //console.log(new_url); + window.location.href = new_url + } + } + } + } else { + console.log("not target_area found.") + } +} + +function tixcraft_area_main(settings) { + if(settings) { + //console.log("area_mode:"+ settings.area_auto_select.mode); + //console.log("area_keyword:"+ settings.area_auto_select.area_keyword); + //console.log("keyword_exclude:"+ settings.keyword_exclude); + tixcraft_clean_exclude(settings); + tixcraft_area_keyword(settings); + } +} + +function area_auto_reload() +{ + if ($("ul.area-list > li:has(a)").length) { + storage.get('settings', function (items) + { + if (items.settings) + { + settings = items.settings; + tixcraft_area_main(settings); + } + }); + } else { + location.reload(); + } +} + +storage.get('status', function (items) +{ + if (items.status && items.status=='ON') + { + area_auto_reload(); + } else { + console.log('no status found'); + } +}); diff --git a/webdriver/Maxbot_1.0.0/js/tixcraft_detail.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_detail.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/tixcraft_detail.js rename to webdriver/Maxbotplus_1.0.0/js/tixcraft_detail.js diff --git a/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js new file mode 100644 index 0000000..409ae81 --- /dev/null +++ b/webdriver/Maxbotplus_1.0.0/js/tixcraft_game.js @@ -0,0 +1,110 @@ +const storage = chrome.storage.local; +var settings = null; +var myInterval = null; + +$("div.masthead-wrap").remove(); + +function date_clean() +{ + remove_list=['Currently Unavailable', + 'Sale ended on 20', + 'Sold out', + '暫停販售', + ':00 截止', + '已售完', + '00に発売終了', + '販売一時中止', + '完売した' + ]; + for (let i = 0; i < remove_list.length; i++) { + $("#gameList td:contains('"+ remove_list[i] +"')").each(function () + { + $(this).parent().remove(); + }); + } +} + +function date_keyword(settings) +{ + let date_keyword_array = []; + if(settings.tixcraft.date_auto_select.date_keyword.length > 0) { + date_keyword_array = JSON.parse('[' + settings.tixcraft.date_auto_select.date_keyword +']'); + } + //console.log(date_keyword_array); + let target_date; + 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); + target_date = get_target_date_with_order(settings, matched_block); + if (target_date.length) { + console.log("match keyword:" + date_keyword_array[i]); + break; + } + } + } else { + let query_string = "#gameList td"; + let matched_block=$(query_string); + target_date = get_target_area_with_order(settings, matched_block); + } + + if (target_date.length) { + let link = target_date.parent().find("button").attr("data-href"); + if (link) { + //console.log("link: " + link); + clearInterval(myInterval); + window.location.href = link; + } + } else { + //console.log("not target_date found.") + } +} + +function date_main(settings) +{ + myInterval = setInterval(() => { + //console.log("date_mode:"+ settings.tixcraft.date_auto_select.mode); + //console.log("date_keyword:"+ settings.tixcraft.date_auto_select.date_keyword); + date_keyword(settings); + }, 200); +} + +function date_auto_reload() +{ + if ($("#gameList button").length) { + date_clean(); + if ($("#gameList button").length) { + storage.get('settings', function (items) + { + if (items.settings) + { + settings = items.settings; + date_main(settings); + } else { + console.log('no settings found'); + } + }); + + } else { + location.reload(); + } + } else { + location.reload(); + } +} + +storage.get('status', function (items) +{ + console.log(items); + if (items.status && items.status=='ON') + { + date_auto_reload(); + } else { + console.log('no status found'); + } +}); + + diff --git a/webdriver/Maxbot_1.0.0/js/tixcraft_home.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_home.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/tixcraft_home.js rename to webdriver/Maxbotplus_1.0.0/js/tixcraft_home.js diff --git a/webdriver/Maxbot_1.0.0/js/tixcraft_ticket.js b/webdriver/Maxbotplus_1.0.0/js/tixcraft_ticket.js similarity index 100% rename from webdriver/Maxbot_1.0.0/js/tixcraft_ticket.js rename to webdriver/Maxbotplus_1.0.0/js/tixcraft_ticket.js diff --git a/webdriver/Maxbot_1.0.0/manifest.json b/webdriver/Maxbotplus_1.0.0/manifest.json similarity index 87% rename from webdriver/Maxbot_1.0.0/manifest.json rename to webdriver/Maxbotplus_1.0.0/manifest.json index 42d64d0..e577a30 100644 --- a/webdriver/Maxbot_1.0.0/manifest.json +++ b/webdriver/Maxbotplus_1.0.0/manifest.json @@ -1,7 +1,7 @@ { "author": "Max Yao", - "name": "MaxBot", - "description": "MaxBot Extension", + "name": "MaxBot Plus", + "description": "Quick way to get your expected ticket on some target sites.", "icons": { "16": "icons/maxbot-16.png", "32": "icons/maxbot-32.png", @@ -28,8 +28,6 @@ "storage", "scripting", "tabs", - "webNavigation", - "webRequest", "declarativeNetRequest", "declarativeNetRequestFeedback" ], @@ -54,7 +52,7 @@ { "matches" : [ "https://tixcraft.com/activity/game/*" ], "run_at": "document_end", - "js" : [ "jquery.min.js", "js/tixcraft_game.js" ] + "js" : [ "jquery.min.js", "js/common.js", "js/tixcraft_game.js" ] }, { "matches" : [ "https://tixcraft.com/activity/detail/*" ], @@ -86,7 +84,7 @@ { "matches" : [ "https://ticket.com.tw/application/UTK02/UTK0204_.aspx?*" ], "run_at": "document_end", - "js" : [ "jquery.min.js", "js/ticket_area.js" ] + "js" : [ "jquery.min.js", "js/common.js", "js/ticket_area.js" ] }, { "matches" : [ "https://kham.com.tw/application/UTK02/UTK0201_.aspx?PRODUCT_ID=*" ], @@ -139,12 +137,20 @@ "run_at": "document_end", "js" : [ "jquery.min.js", "js/kktix_events.js" ] }, + { + "matches" : [ + "https://kktix.com/events/*/registrations/new" + ], + "world": "MAIN", + "run_at": "document_end", + "js" : [ "jquery.min.js", "js/common.js", "js/kktix_registrations_assign.js" ] + }, { "matches" : [ "https://kktix.com/events/*/registrations/new" ], "run_at": "document_start", - "js" : [ "jquery.min.js", "js/kktix_registrations_reload.js" ] + "js" : [ "jquery.min.js", "js/common.js", "js/kktix_registrations_reload.js" ] } ], "version": "1.0.0" diff --git a/webdriver/Maxbot_1.0.0/modules/heartbeatconnect.js b/webdriver/Maxbotplus_1.0.0/modules/heartbeatconnect.js similarity index 81% rename from webdriver/Maxbot_1.0.0/modules/heartbeatconnect.js rename to webdriver/Maxbotplus_1.0.0/modules/heartbeatconnect.js index 8d9a233..e307668 100644 --- a/webdriver/Maxbot_1.0.0/modules/heartbeatconnect.js +++ b/webdriver/Maxbotplus_1.0.0/modules/heartbeatconnect.js @@ -1,5 +1,3 @@ -const storage = chrome.storage.local; -var settings=null; const https_url="https://"; const http_url="https://"; @@ -43,6 +41,25 @@ class HeartBeatConnector } } +function set_status_to(flag) +{ + let nextState = 'ON'; + if(!flag) { + nextState = 'OFF'; + } + + //console.log(nextState); + chrome.action.setBadgeText({ + text: nextState + }); + + chrome.storage.local.set( + { + status: nextState + } + ); +} + function sync_status_from_parent() { //console.log("sync_status_from_parent"); @@ -62,27 +79,13 @@ function sync_status_from_parent() { console.log(data); if(data) { - let nextState = 'ON'; - if(!data.status) { - nextState = 'OFF'; - } - - //console.log(nextState); - chrome.action.setBadgeText({ - text: nextState - }); - - chrome.storage.local.set( - { - status: nextState - } - ); + set_status_to(data.status); } }) .catch(error => { //console.log('error is', error) }); - } +} function ack() { //console.log("act"); diff --git a/webdriver/Maxbot_1.0.0/options.html b/webdriver/Maxbotplus_1.0.0/options.html similarity index 100% rename from webdriver/Maxbot_1.0.0/options.html rename to webdriver/Maxbotplus_1.0.0/options.html diff --git a/webdriver/Maxbot_1.0.0/options.js b/webdriver/Maxbotplus_1.0.0/options.js similarity index 100% rename from webdriver/Maxbot_1.0.0/options.js rename to webdriver/Maxbotplus_1.0.0/options.js diff --git a/webdriver/Maxbot_1.0.0/rules_1.json b/webdriver/Maxbotplus_1.0.0/rules_1.json similarity index 100% rename from webdriver/Maxbot_1.0.0/rules_1.json rename to webdriver/Maxbotplus_1.0.0/rules_1.json