2024-04-15, cityline allow to not retry while queue page.

master
Your Name 2024-05-03 23:12:04 +08:00
parent 168904232f
commit cb82e86840
12 changed files with 193 additions and 94 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.14)" CONST_APP_VERSION = "MaxBot (2024.04.15)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -24,7 +24,7 @@ import webbrowser
import util import util
CONST_APP_VERSION = "MaxBot (2024.04.14)" CONST_APP_VERSION = "MaxBot (2024.04.15)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -246,17 +246,12 @@ def applyNewLanguage():
btn_save.config(text=translate[language_code]["save"]) btn_save.config(text=translate[language_code]["save"])
btn_restore_defaults.config(text=translate[language_code]["restore_defaults"]) btn_restore_defaults.config(text=translate[language_code]["restore_defaults"])
# PS: nothing need to do, at current process.
def callbackHomepageOnChange(event):
showHideBlocks()
def showHideBlocks(all_layout_visible=False):
pass
def btn_items_browse_event(event): def btn_items_browse_event(event):
working_dir = os.path.dirname(os.path.realpath(__file__)) working_dir = os.path.dirname(os.path.realpath(__file__))
btn_index = int(str(event.widget['text']).split(" ")[1]) btn_index = int(str(event.widget['text']).split(" ")[1])
global txt_file_name_value
global widgets
if "widgets" in globals():
file_path = filedialog.askopenfilename(initialdir=working_dir, defaultextension=".json",filetypes=[("json Documents","*.json"),("All Files","*.*")]) file_path = filedialog.askopenfilename(initialdir=working_dir, defaultextension=".json",filetypes=[("json Documents","*.json"),("All Files","*.*")])
if not file_path is None: if not file_path is None:
display_path = file_path display_path = file_path
@ -264,13 +259,15 @@ def btn_items_browse_event(event):
if file_path[:len(working_dir)]==working_dir: if file_path[:len(working_dir)]==working_dir:
display_path = file_path[len(working_dir)+1:] display_path = file_path[len(working_dir)+1:]
#print("json file path:", file_path) #print("json file path:", file_path)
txt_file_name_value[btn_index-1].set(display_path) widgets['txt_file_name_value'][btn_index-1].set(display_path)
#print("new json file path:", txt_file_name[btn_index-1].get().strip()) #print("new json file path:", txt_file_name[btn_index-1].get().strip())
def btn_items_run_event(event): def btn_items_run_event(event):
btn_index = int(str(event.widget['text']).split(" ")[1]) btn_index = int(str(event.widget['text']).split(" ")[1])
global txt_file_name
filename=txt_file_name[btn_index-1].get().strip() global widgets
if "widgets" in globals():
filename=widgets['txt_file_name_value'][btn_index-1].get().strip()
script_name = "chrome_tixcraft" script_name = "chrome_tixcraft"
threading.Thread(target=util.launch_maxbot, args=(script_name,filename,)).start() threading.Thread(target=util.launch_maxbot, args=(script_name,filename,)).start()
@ -463,9 +460,10 @@ def load_GUI(root, config_dict):
frame_action.grid(column=0, row=row_count) frame_action.grid(column=0, row=row_count)
global UI_PADDING_X global UI_PADDING_X
ConfigListTab(tab1, config_dict, language_code, UI_PADDING_X) widgets = ConfigListTab(tab1, config_dict, language_code, UI_PADDING_X)
AdvancedTab(tab2, config_dict, language_code, UI_PADDING_X) AdvancedTab(tab2, config_dict, language_code, UI_PADDING_X)
AboutTab(tab3, language_code) AboutTab(tab3, language_code)
return widgets
def main_gui(): def main_gui():
global translate global translate
@ -484,7 +482,8 @@ def main_gui():
global UI_PADDING_X global UI_PADDING_X
UI_PADDING_X = 15 UI_PADDING_X = 15
load_GUI(root, config_dict) global widgets
widgets = load_GUI(root, config_dict)
GUI_SIZE_WIDTH = 580 GUI_SIZE_WIDTH = 580
GUI_SIZE_HEIGHT = 580 GUI_SIZE_HEIGHT = 580
@ -513,11 +512,6 @@ def main_gui():
tmpIcon.close() tmpIcon.close()
if platform.system() == 'Windows': if platform.system() == 'Windows':
root.iconbitmap(icon_filepath) root.iconbitmap(icon_filepath)
if platform.system() == 'Darwin':
#from PIL import Image, ImageTk
#logo = ImageTk.PhotoImage(Image.open(icon_filepath).convert('RGB'))
#root.call('wm', 'iconphoto', root._w, logo)
pass
if platform.system() == 'Linux': if platform.system() == 'Linux':
logo = PhotoImage(file=icon_filepath) logo = PhotoImage(file=icon_filepath)
root.call('wm', 'iconphoto', root._w, logo) root.call('wm', 'iconphoto', root._w, logo)

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.14)" CONST_APP_VERSION = "MaxBot (2024.04.15)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -2,7 +2,7 @@
"homepage": "about:blank", "homepage": "about:blank",
"browser": "chrome", "browser": "chrome",
"language": "English", "language": "English",
"ticket_number": "2", "ticket_number": 2,
"ocr_captcha": { "ocr_captcha": {
"enable": true, "enable": true,
"beta": true, "beta": true,
@ -23,7 +23,12 @@
"keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"",
"kktix": { "kktix": {
"auto_press_next_step_button": true, "auto_press_next_step_button": true,
"auto_fill_ticket_number": true "auto_fill_ticket_number": true,
"kktix_status_api": false,
"max_dwell_time": 60
},
"cityline": {
"cityline_queue_retry": true
}, },
"tixcraft": { "tixcraft": {
"pass_date_is_sold_out": true, "pass_date_is_sold_out": true,
@ -76,10 +81,8 @@
"auto_guess_options": true, "auto_guess_options": true,
"user_guess_string": "\"\"", "user_guess_string": "\"\"",
"remote_url": "\"http://127.0.0.1:16888/\"", "remote_url": "\"http://127.0.0.1:16888/\"",
"auto_reload_page_interval": "0.1", "auto_reload_page_interval": 0.1,
"reset_browser_interval": "0", "reset_browser_interval": 0,
"kktix_status_api": false,
"max_dwell_time": "60",
"proxy_server_port": "", "proxy_server_port": "",
"window_size": "480,1024", "window_size": "480,1024",
"idle_keyword": "", "idle_keyword": "",

View File

@ -39,7 +39,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.14)" CONST_APP_VERSION = "MaxBot (2024.04.15)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -127,6 +127,11 @@ def get_default_config():
config_dict['kktix']={} config_dict['kktix']={}
config_dict["kktix"]["auto_press_next_step_button"] = True config_dict["kktix"]["auto_press_next_step_button"] = True
config_dict["kktix"]["auto_fill_ticket_number"] = True config_dict["kktix"]["auto_fill_ticket_number"] = True
config_dict["kktix"]["kktix_status_api"] = False
config_dict["kktix"]["max_dwell_time"] = 60
config_dict['cityline']={}
config_dict["cityline"]["cityline_queue_retry"] = True
config_dict['tixcraft']={} config_dict['tixcraft']={}
config_dict["tixcraft"]["pass_date_is_sold_out"] = True config_dict["tixcraft"]["pass_date_is_sold_out"] = True
@ -187,8 +192,6 @@ def get_default_config():
config_dict["advanced"]["auto_reload_page_interval"] = 0.1 config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["reset_browser_interval"] = 0 config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["kktix_status_api"] = False
config_dict["advanced"]["max_dwell_time"] = 60
config_dict["advanced"]["proxy_server_port"] = "" config_dict["advanced"]["proxy_server_port"] = ""
config_dict["advanced"]["window_size"] = "480,1024" config_dict["advanced"]["window_size"] = "480,1024"
@ -429,6 +432,7 @@ class LoadJsonHandler(tornado.web.RequestHandler):
class ResetJsonHandler(tornado.web.RequestHandler): class ResetJsonHandler(tornado.web.RequestHandler):
def get(self): def get(self):
config_filepath, config_dict = reset_json() config_filepath, config_dict = reset_json()
util.save_json(config_dict, config_filepath)
self.write(config_dict) self.write(config_dict)
class SaveJsonHandler(tornado.web.RequestHandler): class SaveJsonHandler(tornado.web.RequestHandler):
@ -452,6 +456,21 @@ class SaveJsonHandler(tornado.web.RequestHandler):
app_root = util.get_app_root() app_root = util.get_app_root()
config_filepath = os.path.join(app_root, CONST_MAXBOT_CONFIG_FILE) config_filepath = os.path.join(app_root, CONST_MAXBOT_CONFIG_FILE)
config_dict = encrypt_password(_body) config_dict = encrypt_password(_body)
if config_dict["kktix"]["max_dwell_time"] > 0:
if config_dict["kktix"]["max_dwell_time"] < 15:
# min value is 15 seconds.
config_dict["kktix"]["max_dwell_time"] = 15
if config_dict["advanced"]["reset_browser_interval"] > 0:
if config_dict["advanced"]["reset_browser_interval"] < 20:
# min value is 20 seconds.
config_dict["advanced"]["reset_browser_interval"] = 20
# due to cloudflare.
if ".cityline.com" in config_dict["homepage"]:
config_dict["webdriver_type"] = CONST_WEBDRIVER_TYPE_NODRIVER
util.save_json(config_dict, config_filepath) util.save_json(config_dict, config_filepath)
if not is_pass_check: if not is_pass_check:

View File

@ -34,7 +34,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.14)" CONST_APP_VERSION = "MaxBot (2024.04.15)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -131,6 +131,7 @@ def load_translate():
en_us["auto_reload_page_interval"] = 'Reload page interval(sec.)' en_us["auto_reload_page_interval"] = 'Reload page interval(sec.)'
en_us["kktix_status_api"] = 'KKTIX status API' en_us["kktix_status_api"] = 'KKTIX status API'
en_us["max_dwell_time"] = 'KKTIX dwell time(sec.)' en_us["max_dwell_time"] = 'KKTIX dwell time(sec.)'
en_us["cityline_queue_retry"] = 'cityline queue retry'
en_us["reset_browser_interval"] = 'Reset browser interval(sec.)' en_us["reset_browser_interval"] = 'Reset browser interval(sec.)'
en_us["proxy_server_port"] = 'Proxy IP:PORT' en_us["proxy_server_port"] = 'Proxy IP:PORT'
en_us["window_size"] = 'Window size' en_us["window_size"] = 'Window size'
@ -250,7 +251,8 @@ def load_translate():
zh_tw["auto_reload_page_interval"] = '自動刷新頁面間隔(秒)' zh_tw["auto_reload_page_interval"] = '自動刷新頁面間隔(秒)'
zh_tw["kktix_status_api"] = 'KKTIX購票狀態API' zh_tw["kktix_status_api"] = 'KKTIX購票狀態API'
zh_tw["max_dwell_time"] = 'KKTIX購票最長停留(秒)' zh_tw["max_dwell_time"] = 'KKTIX購票最長停留(秒)'
zh_tw["reset_browser_interval"] = '重新啟動瀏覽器間隔(秒)' zh_tw["reset_browser_interval"] = '重新啓動瀏覽器間隔(秒)'
zh_tw["cityline_queue_retry"] = 'cityline queue retry'
zh_tw["proxy_server_port"] = 'Proxy IP:PORT' zh_tw["proxy_server_port"] = 'Proxy IP:PORT'
zh_tw["window_size"] = '瀏覽器視窗大小' zh_tw["window_size"] = '瀏覽器視窗大小'
@ -368,6 +370,7 @@ def load_translate():
zh_cn["auto_reload_coming_soon_page"] = '自动刷新倒数中的日期页面' zh_cn["auto_reload_coming_soon_page"] = '自动刷新倒数中的日期页面'
zh_cn["auto_reload_page_interval"] = '重新加载间隔(秒)' zh_cn["auto_reload_page_interval"] = '重新加载间隔(秒)'
zh_cn["kktix_status_api"] = 'KKTIX购票状态API' zh_cn["kktix_status_api"] = 'KKTIX购票状态API'
zh_cn["cityline_queue_retry"] = 'cityline queue retry'
zh_cn["max_dwell_time"] = '购票网页最长停留(秒)' zh_cn["max_dwell_time"] = '购票网页最长停留(秒)'
zh_cn["reset_browser_interval"] = '重新启动浏览器间隔(秒)' zh_cn["reset_browser_interval"] = '重新启动浏览器间隔(秒)'
zh_cn["proxy_server_port"] = 'Proxy IP:PORT' zh_cn["proxy_server_port"] = 'Proxy IP:PORT'
@ -489,6 +492,7 @@ def load_translate():
ja_jp["auto_reload_page_interval"] = 'リロード間隔(秒)' ja_jp["auto_reload_page_interval"] = 'リロード間隔(秒)'
ja_jp["kktix_status_api"] = 'KKTIX status API' ja_jp["kktix_status_api"] = 'KKTIX status API'
ja_jp["max_dwell_time"] = '最大滞留時間(秒)' ja_jp["max_dwell_time"] = '最大滞留時間(秒)'
ja_jp["cityline_queue_retry"] = 'cityline queue retry'
ja_jp["reset_browser_interval"] = 'ブラウザの再起動間隔(秒)' ja_jp["reset_browser_interval"] = 'ブラウザの再起動間隔(秒)'
ja_jp["proxy_server_port"] = 'Proxy IP:PORT' ja_jp["proxy_server_port"] = 'Proxy IP:PORT'
ja_jp["window_size"] = 'ウィンドウサイズ' ja_jp["window_size"] = 'ウィンドウサイズ'
@ -612,6 +616,11 @@ def get_default_config():
config_dict['kktix']={} config_dict['kktix']={}
config_dict["kktix"]["auto_press_next_step_button"] = True config_dict["kktix"]["auto_press_next_step_button"] = True
config_dict["kktix"]["auto_fill_ticket_number"] = True config_dict["kktix"]["auto_fill_ticket_number"] = True
config_dict["kktix"]["kktix_status_api"] = False
config_dict["kktix"]["max_dwell_time"] = 60
config_dict['cityline']={}
config_dict["cityline"]["cityline_queue_retry"] = True
config_dict['tixcraft']={} config_dict['tixcraft']={}
config_dict["tixcraft"]["pass_date_is_sold_out"] = True config_dict["tixcraft"]["pass_date_is_sold_out"] = True
@ -672,8 +681,6 @@ def get_default_config():
config_dict["advanced"]["auto_reload_page_interval"] = 0.1 config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["reset_browser_interval"] = 0 config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["kktix_status_api"] = False
config_dict["advanced"]["max_dwell_time"] = 60
config_dict["advanced"]["proxy_server_port"] = "" config_dict["advanced"]["proxy_server_port"] = ""
config_dict["advanced"]["window_size"] = "480,1024" config_dict["advanced"]["window_size"] = "480,1024"
@ -794,6 +801,7 @@ def btn_save_act(slience_mode=False):
global txt_auto_reload_page_interval global txt_auto_reload_page_interval
global chk_status_kktix_status_api global chk_status_kktix_status_api
global txt_max_dwell_time global txt_max_dwell_time
global chk_status_cityline_queue_retry
global txt_reset_browser_intervalv global txt_reset_browser_intervalv
global txt_proxy_server_port global txt_proxy_server_port
global txt_window_size global txt_window_size
@ -882,6 +890,14 @@ def btn_save_act(slience_mode=False):
if is_all_data_correct: if is_all_data_correct:
config_dict["kktix"]["auto_press_next_step_button"] = bool(chk_state_auto_press_next_step_button.get()) config_dict["kktix"]["auto_press_next_step_button"] = bool(chk_state_auto_press_next_step_button.get())
config_dict["kktix"]["auto_fill_ticket_number"] = bool(chk_state_auto_fill_ticket_number.get()) config_dict["kktix"]["auto_fill_ticket_number"] = bool(chk_state_auto_fill_ticket_number.get())
config_dict["kktix"]["kktix_status_api"] = bool(chk_state_kktix_status_api.get())
config_dict["kktix"]["max_dwell_time"] = int(txt_max_dwell_time.get().strip())
if config_dict["kktix"]["max_dwell_time"] > 0:
if config_dict["kktix"]["max_dwell_time"] < 15:
config_dict["kktix"]["max_dwell_time"] = 15
config_dict["cityline"]["cityline_queue_retry"] = bool(chk_state_cityline_queue_retry.get())
config_dict["date_auto_select"]["enable"] = bool(chk_state_date_auto_select.get()) config_dict["date_auto_select"]["enable"] = bool(chk_state_date_auto_select.get())
config_dict["date_auto_select"]["mode"] = combo_date_auto_select_mode.get().strip() config_dict["date_auto_select"]["mode"] = combo_date_auto_select_mode.get().strip()
@ -1076,16 +1092,10 @@ def btn_save_act(slience_mode=False):
config_dict["advanced"]["auto_guess_options"] = bool(chk_state_auto_guess_options.get()) config_dict["advanced"]["auto_guess_options"] = bool(chk_state_auto_guess_options.get())
config_dict["advanced"]["auto_reload_page_interval"] = float(txt_auto_reload_page_interval.get().strip()) config_dict["advanced"]["auto_reload_page_interval"] = float(txt_auto_reload_page_interval.get().strip())
config_dict["advanced"]["kktix_status_api"] = bool(chk_state_kktix_status_api.get())
config_dict["advanced"]["max_dwell_time"] = int(txt_max_dwell_time.get().strip())
config_dict["advanced"]["reset_browser_interval"] = int(txt_reset_browser_interval.get().strip()) config_dict["advanced"]["reset_browser_interval"] = int(txt_reset_browser_interval.get().strip())
config_dict["advanced"]["proxy_server_port"] = txt_proxy_server_port.get().strip() config_dict["advanced"]["proxy_server_port"] = txt_proxy_server_port.get().strip()
config_dict["advanced"]["window_size"] = txt_window_size.get().strip() config_dict["advanced"]["window_size"] = txt_window_size.get().strip()
if config_dict["advanced"]["max_dwell_time"] > 0:
if config_dict["advanced"]["max_dwell_time"] < 15:
config_dict["advanced"]["max_dwell_time"] = 15
if config_dict["advanced"]["reset_browser_interval"] > 0: if config_dict["advanced"]["reset_browser_interval"] > 0:
if config_dict["advanced"]["reset_browser_interval"] < 20: if config_dict["advanced"]["reset_browser_interval"] < 20:
# min value is 20 seconds. # min value is 20 seconds.
@ -1332,7 +1342,10 @@ def applyNewLanguage():
global lbl_auto_reload_page_interval global lbl_auto_reload_page_interval
global lbl_kktix_status_api global lbl_kktix_status_api
global chk_kktix_status_api
global lbl_max_dwell_time global lbl_max_dwell_time
global lbl_cityline_queue_retry
global chk_cityline_queue_retry
global lbl_reset_browser_interval global lbl_reset_browser_interval
global lbl_proxy_server_port global lbl_proxy_server_port
global lbl_window_size global lbl_window_size
@ -1373,6 +1386,7 @@ def applyNewLanguage():
lbl_auto_reload_page_interval.config(text=translate[language_code]["auto_reload_page_interval"]) lbl_auto_reload_page_interval.config(text=translate[language_code]["auto_reload_page_interval"])
lbl_kktix_status_api.config(text=translate[language_code]["kktix_status_api"]) lbl_kktix_status_api.config(text=translate[language_code]["kktix_status_api"])
lbl_max_dwell_time.config(text=translate[language_code]["max_dwell_time"]) lbl_max_dwell_time.config(text=translate[language_code]["max_dwell_time"])
lbl_cityline_queue_retry.config(text=translate[language_code]["cityline_queue_retry"])
lbl_reset_browser_interval.config(text=translate[language_code]["reset_browser_interval"]) lbl_reset_browser_interval.config(text=translate[language_code]["reset_browser_interval"])
lbl_proxy_server_port.config(text=translate[language_code]["proxy_server_port"]) lbl_proxy_server_port.config(text=translate[language_code]["proxy_server_port"])
lbl_window_size.config(text=translate[language_code]["window_size"]) lbl_window_size.config(text=translate[language_code]["window_size"])
@ -1414,6 +1428,8 @@ def applyNewLanguage():
chk_headless.config(text=translate[language_code]["enable"]) chk_headless.config(text=translate[language_code]["enable"])
chk_verbose.config(text=translate[language_code]["enable"]) chk_verbose.config(text=translate[language_code]["enable"])
chk_auto_guess_options.config(text=translate[language_code]["enable"]) chk_auto_guess_options.config(text=translate[language_code]["enable"])
chk_kktix_status_api.config(text=translate[language_code]["enable"])
chk_cityline_queue_retry.config(text=translate[language_code]["enable"])
tabControl.tab(0, text=translate[language_code]["preference"]) tabControl.tab(0, text=translate[language_code]["preference"])
tabControl.tab(1, text=translate[language_code]["advanced"]) tabControl.tab(1, text=translate[language_code]["advanced"])
@ -2047,7 +2063,7 @@ def AdvancedTab(root, config_dict, language_code, UI_PADDING_X):
global chk_state_kktix_status_api global chk_state_kktix_status_api
chk_state_kktix_status_api = BooleanVar() chk_state_kktix_status_api = BooleanVar()
chk_state_kktix_status_api.set(config_dict["advanced"]["kktix_status_api"]) chk_state_kktix_status_api.set(config_dict["kktix"]["kktix_status_api"])
global chk_kktix_status_api global chk_kktix_status_api
chk_kktix_status_api = Checkbutton(frame_group_header, text=translate[language_code]['enable'], variable=chk_state_kktix_status_api) chk_kktix_status_api = Checkbutton(frame_group_header, text=translate[language_code]['enable'], variable=chk_state_kktix_status_api)
@ -2060,12 +2076,26 @@ def AdvancedTab(root, config_dict, language_code, UI_PADDING_X):
lbl_max_dwell_time.grid(column=0, row=group_row_count, sticky = E) lbl_max_dwell_time.grid(column=0, row=group_row_count, sticky = E)
global txt_max_dwell_time global txt_max_dwell_time
txt_max_dwell_time_value = StringVar(frame_group_header, value=config_dict["advanced"]["max_dwell_time"]) txt_max_dwell_time_value = StringVar(frame_group_header, value=config_dict["kktix"]["max_dwell_time"])
txt_max_dwell_time = Entry(frame_group_header, width=30, textvariable = txt_max_dwell_time_value) txt_max_dwell_time = Entry(frame_group_header, width=30, textvariable = txt_max_dwell_time_value)
txt_max_dwell_time.grid(column=1, row=group_row_count, sticky = W) txt_max_dwell_time.grid(column=1, row=group_row_count, sticky = W)
group_row_count +=1 group_row_count +=1
global lbl_cityline_queue_retry
lbl_cityline_queue_retry = Label(frame_group_header, text=translate[language_code]['cityline_queue_retry'])
lbl_cityline_queue_retry.grid(column=0, row=group_row_count, sticky = E)
global chk_state_cityline_queue_retry
chk_state_cityline_queue_retry = BooleanVar()
chk_state_cityline_queue_retry.set(config_dict["cityline"]["cityline_queue_retry"])
global chk_cityline_queue_retry
chk_cityline_queue_retry = Checkbutton(frame_group_header, text=translate[language_code]['enable'], variable=chk_state_cityline_queue_retry)
chk_cityline_queue_retry.grid(column=1, row=group_row_count, sticky = W)
group_row_count +=1
global lbl_reset_browser_interval global lbl_reset_browser_interval
lbl_reset_browser_interval = Label(frame_group_header, text=translate[language_code]['reset_browser_interval']) lbl_reset_browser_interval = Label(frame_group_header, text=translate[language_code]['reset_browser_interval'])
lbl_reset_browser_interval.grid(column=0, row=group_row_count, sticky = E) lbl_reset_browser_interval.grid(column=0, row=group_row_count, sticky = E)
@ -3124,7 +3154,7 @@ def main_gui():
load_GUI(root, config_dict) load_GUI(root, config_dict)
GUI_SIZE_WIDTH = 590 GUI_SIZE_WIDTH = 590
GUI_SIZE_HEIGHT = 645 GUI_SIZE_HEIGHT = 665
GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT) GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT)
GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-70) + 'x' + str(GUI_SIZE_HEIGHT-80) GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-70) + 'x' + str(GUI_SIZE_HEIGHT-80)

View File

@ -1 +1 @@
{"homepage": "about:blank", "browser": "chrome", "language": "English", "ticket_number": "2", "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "\"\"", "mode": "random"}, "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\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "\"\"", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": "0.1", "reset_browser_interval": "0", "kktix_status_api": false, "max_dwell_time": "60", "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*.doubleclick.net/*", "*.googlesyndication.com/*", "*.ssp.hinet.net/*", "*a.amnet.tw/*", "*anymind360.com/*", "*adx.c.appier.net/*", "*cdn.cookielaw.org/*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*img.uniicreative.com/*", "*lndata.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*play.google.com/log?*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*ticketmaster.sg/js/adblock*", "*ticketmaster.sg/js/adblock.js*", "*tixcraft.com/js/analytics.js*", "*tixcraft.com/js/common.js*", "*tixcraft.com/js/custom.js*", "*treasuredata.com/*", "*www.youtube.com/youtubei/v1/player/heartbeat*"]} {"homepage": "about:blank", "browser": "chrome", "language": "English", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "\"\"", "mode": "random"}, "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\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true, "kktix_status_api": false, "max_dwell_time": 60}, "cityline": {"cityline_queue_retry": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "\"\"", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "reset_browser_interval": 0, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*.doubleclick.net/*", "*.googlesyndication.com/*", "*.ssp.hinet.net/*", "*a.amnet.tw/*", "*anymind360.com/*", "*adx.c.appier.net/*", "*cdn.cookielaw.org/*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*img.uniicreative.com/*", "*lndata.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*play.google.com/log?*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*ticketmaster.sg/js/adblock*", "*ticketmaster.sg/js/adblock.js*", "*tixcraft.com/js/analytics.js*", "*tixcraft.com/js/common.js*", "*tixcraft.com/js/custom.js*", "*treasuredata.com/*", "*www.youtube.com/youtubei/v1/player/heartbeat*"]}

View File

@ -1 +1 @@
{"homepage": "about:blank", "browser": "chrome", "language": "English", "ticket_number": "2", "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "\"\"", "mode": "random"}, "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\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "\"\"", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": "0.1", "reset_browser_interval": "0", "kktix_status_api": false, "max_dwell_time": "60", "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}} {"homepage": "about:blank", "browser": "chrome", "language": "English", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "\"\"", "mode": "random"}, "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\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true, "kktix_status_api": false, "max_dwell_time": 60}, "cityline": {"cityline_queue_retry": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "\"\"", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "reset_browser_interval": 0, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}

View File

@ -9,7 +9,12 @@ function begin()
$("#settings").remove(); $("#settings").remove();
$("#status").remove(); $("#status").remove();
if(status=='ON') { let cityline_queue_retry = true;
if(settings) {
cityline_queue_retry = settings.cityline.cityline_queue_retry;
}
if(status=='ON' && cityline_queue_retry) {
setInterval(() => { setInterval(() => {
if (typeof remainTime !== "undefined") { if (typeof remainTime !== "undefined") {
remainTime = 0; remainTime = 0;

View File

@ -177,7 +177,7 @@ function kktix_force_auto_reload_by_timer()
if(settings.advanced.kktix_account.length > 0) { if(settings.advanced.kktix_account.length > 0) {
let max_dwell_time = 120; let max_dwell_time = 120;
if(settings) { if(settings) {
max_dwell_time = settings.advanced.max_dwell_time; max_dwell_time = settings.kktix.max_dwell_time;
} }
if(max_dwell_time <= 10) { if(max_dwell_time <= 10) {
max_dwell_time = 10; max_dwell_time = 10;
@ -204,7 +204,7 @@ storage.get('status', function (items)
{ {
let kktix_status_api = false; let kktix_status_api = false;
if(settings) { if(settings) {
kktix_status_api = settings.advanced.kktix_status_api; kktix_status_api = settings.kktix.kktix_status_api;
} }
if(kktix_status_api) { if(kktix_status_api) {
kktix_event_register_info(); kktix_event_register_info();

View File

@ -110,6 +110,32 @@
</div> </div>
</div> </div>
<div class="row mb-3 disappear" data-under="kktix">
<label class="col-sm-2 col-form-label form-check-label" for="auto_press_next_step_button">KKTIX點選下一步按鈕</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="auto_press_next_step_button" />
</div>
</div>
<div class="row mb-3 disappear" data-under="kktix">
<label class="col-sm-2 col-form-label form-check-label" for="kktix_status_api">KKTIX購票狀態API</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="kktix_status_api" />
</div>
</div>
<div class="row mb-3 disappear" data-under="kktix">
<label for="max_dwell_time" class="col-sm-2 col-form-label">KKTIX購票最長停留(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="max_dwell_time" value="" />
</div>
</div>
<div class="row mb-3 disappear" data-under="cityline">
<label class="col-sm-2 col-form-label form-check-label" for="cityline_queue_retry">Cityline 排隊撞牆</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="cityline_queue_retry" />
</div>
</div>
<div class="row mb-3"> <div class="row mb-3">
<label for="ticket_number" class="col-sm-2 col-form-label">張數</label> <label for="ticket_number" class="col-sm-2 col-form-label">張數</label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -267,24 +293,6 @@
</div> </div>
</div> </div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="auto_press_next_step_button">KKTIX點選下一步按鈕</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="auto_press_next_step_button" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="kktix_status_api">KKTIX購票狀態API</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="kktix_status_api" />
</div>
</div>
<div class="row mb-3">
<label for="max_dwell_time" class="col-sm-2 col-form-label">KKTIX購票最長停留(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="max_dwell_time" value="" />
</div>
</div>
<div class="row mb-3"> <div class="row mb-3">
<label for="reset_browser_interval" class="col-sm-2 col-form-label">重新啟動瀏覽器間隔(秒)</label> <label for="reset_browser_interval" class="col-sm-2 col-form-label">重新啟動瀏覽器間隔(秒)</label>
<div class="col-sm-10"> <div class="col-sm-10">

View File

@ -23,10 +23,13 @@ const play_ticket_sound = document.querySelector('#play_ticket_sound');
const play_order_sound = document.querySelector('#play_order_sound'); const play_order_sound = document.querySelector('#play_order_sound');
const play_sound_filename = document.querySelector('#play_sound_filename'); const play_sound_filename = document.querySelector('#play_sound_filename');
const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval');
const auto_press_next_step_button = document.querySelector('#auto_press_next_step_button'); const auto_press_next_step_button = document.querySelector('#auto_press_next_step_button');
const kktix_status_api = document.querySelector('#kktix_status_api'); const kktix_status_api = document.querySelector('#kktix_status_api');
const max_dwell_time = document.querySelector('#max_dwell_time'); const max_dwell_time = document.querySelector('#max_dwell_time');
const cityline_queue_retry = document.querySelector('#cityline_queue_retry');
const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval');
const reset_browser_interval = document.querySelector('#reset_browser_interval'); const reset_browser_interval = document.querySelector('#reset_browser_interval');
const proxy_server_port = document.querySelector('#proxy_server_port'); const proxy_server_port = document.querySelector('#proxy_server_port');
const window_size = document.querySelector('#window_size'); const window_size = document.querySelector('#window_size');
@ -113,10 +116,13 @@ function load_settins_to_form(settings)
play_order_sound.checked = settings.advanced.play_sound.order; play_order_sound.checked = settings.advanced.play_sound.order;
play_sound_filename.value = settings.advanced.play_sound.filename; play_sound_filename.value = settings.advanced.play_sound.filename;
auto_reload_page_interval.value = settings.advanced.auto_reload_page_interval;
auto_press_next_step_button.checked = settings.kktix.auto_press_next_step_button; auto_press_next_step_button.checked = settings.kktix.auto_press_next_step_button;
kktix_status_api.checked = settings.advanced.kktix_status_api; kktix_status_api.checked = settings.kktix.kktix_status_api;
max_dwell_time.value = settings.advanced.max_dwell_time; max_dwell_time.value = settings.kktix.max_dwell_time;
cityline_queue_retry.checked = settings.cityline.cityline_queue_retry;
auto_reload_page_interval.value = settings.advanced.auto_reload_page_interval;
reset_browser_interval.value = settings.advanced.reset_browser_interval; reset_browser_interval.value = settings.advanced.reset_browser_interval;
proxy_server_port.value = settings.advanced.proxy_server_port; proxy_server_port.value = settings.advanced.proxy_server_port;
window_size.value = settings.advanced.window_size; window_size.value = settings.advanced.window_size;
@ -226,6 +232,7 @@ function maxbot_reset_api()
//console.log(data); //console.log(data);
settings = data; settings = data;
load_settins_to_form(data); load_settins_to_form(data);
check_unsaved_fields();
}) })
.fail(function() { .fail(function() {
//alert( "error" ); //alert( "error" );
@ -267,7 +274,6 @@ function maxbot_launch()
{ {
save_changes_to_dict(true); save_changes_to_dict(true);
maxbot_save_api(maxbot_run_api()); maxbot_save_api(maxbot_run_api());
check_unsaved_fields();
} }
function maxbot_run_api() function maxbot_run_api()
@ -307,7 +313,7 @@ function maxbot_shutdown_api()
function save_changes_to_dict(silent_flag) function save_changes_to_dict(silent_flag)
{ {
const ticket_number_value = ticket_number.value; const ticket_number_value = parseInt(ticket_number.value);
//console.log(ticket_number_value); //console.log(ticket_number_value);
if (!ticket_number_value) if (!ticket_number_value)
{ {
@ -344,12 +350,15 @@ function save_changes_to_dict(silent_flag)
settings.advanced.play_sound.order = play_order_sound.checked; settings.advanced.play_sound.order = play_order_sound.checked;
settings.advanced.play_sound.filename = play_sound_filename.value; settings.advanced.play_sound.filename = play_sound_filename.value;
settings.advanced.auto_reload_page_interval = auto_reload_page_interval.value;
settings.kktix.auto_press_next_step_button = auto_press_next_step_button.checked; settings.kktix.auto_press_next_step_button = auto_press_next_step_button.checked;
settings.advanced.kktix_status_api = kktix_status_api.checked; settings.kktix.kktix_status_api = kktix_status_api.checked;
settings.advanced.max_dwell_time = max_dwell_time.value; settings.kktix.max_dwell_time = parseInt(max_dwell_time.value);
settings.advanced.reset_browser_interval = reset_browser_interval.value; settings.cityline.cityline_queue_retry = cityline_queue_retry.checked;
settings.advanced.auto_reload_page_interval = Number(auto_reload_page_interval.value);
settings.advanced.reset_browser_interval = parseInt(reset_browser_interval.value);
settings.advanced.proxy_server_port = proxy_server_port.value; settings.advanced.proxy_server_port = proxy_server_port.value;
settings.advanced.window_size = window_size.value; settings.advanced.window_size = window_size.value;
@ -425,6 +434,7 @@ function maxbot_save_api(callback)
}) })
.done(function(data) { .done(function(data) {
//alert( "second success" ); //alert( "second success" );
check_unsaved_fields();
if(callback) callback; if(callback) callback;
}) })
.fail(function() { .fail(function() {
@ -477,7 +487,6 @@ function maxbot_save()
{ {
save_changes_to_dict(false); save_changes_to_dict(false);
maxbot_save_api(); maxbot_save_api();
check_unsaved_fields();
} }
function check_unsaved_fields() function check_unsaved_fields()
@ -518,7 +527,6 @@ function check_unsaved_fields()
"remote_url", "remote_url",
"auto_reload_page_interval", "auto_reload_page_interval",
"reset_browser_interval", "reset_browser_interval",
"max_dwell_time",
"proxy_server_port", "proxy_server_port",
"window_size", "window_size",
"idle_keyword", "idle_keyword",
@ -528,23 +536,53 @@ function check_unsaved_fields()
]; ];
field_list_advance.forEach(f => { field_list_advance.forEach(f => {
const field = document.querySelector('#'+f); const field = document.querySelector('#'+f);
let formated_input = field.value;
let formated_saved_value = settings["advanced"][f]; let formated_saved_value = settings["advanced"][f];
if(formated_saved_value=='""') formated_saved_value="";
//console.log(f); //console.log(f);
//console.log(field.value); //console.log(field.value);
//console.log(formated_saved_value); //console.log(formated_saved_value);
let compare_resule = (field.value != formated_saved_value); if(typeof formated_saved_value == "string") {
if(!compare_resule) { if(formated_input=='')
if(field.value.indexOf('"') > -1) { formated_input='""';
compare_resule = (field.value != '"' + formated_saved_value + '"'); if(formated_saved_value=='')
formated_saved_value='""';
if(formated_saved_value.indexOf('"') > -1) {
if(formated_input.length) {
if(formated_input != '""') {
formated_input = '"' + formated_input + '"';
} }
} }
if(compare_resule) { }
}
let is_not_match = (formated_input != formated_saved_value);
if(is_not_match) {
//console.log(f);
//console.log(formated_input);
//console.log(formated_saved_value);
$("#"+f).addClass("is-invalid"); $("#"+f).addClass("is-invalid");
} else { } else {
$("#"+f).removeClass("is-invalid"); $("#"+f).removeClass("is-invalid");
} }
}); });
// check spcial feature for sites.
if(homepage.value.length) {
let special_site = "";
const special_site_list = ["kktix", "cityline"];
for(let i=0; i<special_site_list.length; i++) {
const site=special_site_list[i];
const match_url_1 = "." + site + ".com/";
const match_url_2 = "/" + site + ".com/";
//console.log(match_url);
if(homepage.value.indexOf(match_url_1) > 0 || homepage.value.indexOf(match_url_2) > 0) {
special_site = site;
}
}
$('div[data-under]').addClass("disappear");
if(special_site.length) {
$('div[data-under="'+ special_site +'"]').removeClass("disappear");
}
}
} }
} }
@ -607,3 +645,5 @@ onchange_tag_list.forEach((tag) => {
userItem.addEventListener('change', check_unsaved_fields); userItem.addEventListener('change', check_unsaved_fields);
}); });
}); });
homepage.addEventListener('keyup', check_unsaved_fields);