2023-12-27, update for kktix extension
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
|
|
35
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):
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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": ""}}
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
|
@ -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');
|
||||
}
|
||||
});
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -32,21 +32,33 @@ 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,
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
import heartbeatconnect from './modules/heartbeatconnect.js';
|
|
@ -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": ""}}
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
@ -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;
|
||||
}
|
|
@ -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_number<ticket_number) {
|
||||
ticket_number=seat_inventory_number;
|
||||
}
|
||||
|
||||
if(ticket_number>0) {
|
||||
/*
|
||||
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<ticket_number; i++) {
|
||||
add_button.click();
|
||||
}
|
||||
|
||||
let $next_btn = $('div.register-new-next-button-area > 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);
|
|
@ -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="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
||||
$("body").append(settings_div);
|
||||
let register_info_div="<div style='display:none' id='register_info'>" + JSON.stringify(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');
|
||||
}
|
||||
});
|
|
@ -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');
|
||||
}
|
||||
});
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -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"
|
|
@ -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");
|