2024-01-13, split maxbot plus extension to maxblock plus.
parent
a6d8d6677e
commit
e9eb8b72b1
|
@ -41,7 +41,7 @@ try:
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.01.12)"
|
CONST_APP_VERSION = "MaxBot (2024.01.13)"
|
||||||
|
|
||||||
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"
|
||||||
|
@ -49,6 +49,7 @@ CONST_MAXBOT_EXTENSION_NAME = "Maxbotplus_1.0.0"
|
||||||
CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt"
|
CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
|
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
|
||||||
|
CONST_MAXBLOCK_EXTENSION_NAME = "Maxblockplus_1.0.0"
|
||||||
|
|
||||||
CONST_CHROME_VERSION_NOT_MATCH_EN="Please download the WebDriver version to match your browser version."
|
CONST_CHROME_VERSION_NOT_MATCH_EN="Please download the WebDriver version to match your browser version."
|
||||||
CONST_CHROME_VERSION_NOT_MATCH_TW="請下載與您瀏覽器相同版本的WebDriver版本,或更新您的瀏覽器版本。"
|
CONST_CHROME_VERSION_NOT_MATCH_TW="請下載與您瀏覽器相同版本的WebDriver版本,或更新您的瀏覽器版本。"
|
||||||
|
@ -369,6 +370,7 @@ def get_favoriate_extension_path(webdriver_path, config_dict):
|
||||||
#print("webdriver_path:", webdriver_path)
|
#print("webdriver_path:", webdriver_path)
|
||||||
extension_list = []
|
extension_list = []
|
||||||
extension_list.append(os.path.join(webdriver_path, CONST_MAXBOT_EXTENSION_NAME + ".crx"))
|
extension_list.append(os.path.join(webdriver_path, CONST_MAXBOT_EXTENSION_NAME + ".crx"))
|
||||||
|
extension_list.append(os.path.join(webdriver_path, CONST_MAXBLOCK_EXTENSION_NAME + ".crx"))
|
||||||
return extension_list
|
return extension_list
|
||||||
|
|
||||||
def get_chromedriver_path(webdriver_path):
|
def get_chromedriver_path(webdriver_path):
|
||||||
|
@ -611,26 +613,6 @@ def dump_settins_to_maxbot_plus_extension(ext, config_dict):
|
||||||
with open(target_path, 'w') as outfile:
|
with open(target_path, 'w') as outfile:
|
||||||
outfile.write(json_str)
|
outfile.write(json_str)
|
||||||
|
|
||||||
# show advanced rows in extension.
|
|
||||||
target_path = ext
|
|
||||||
target_path = os.path.join(target_path, "options.html")
|
|
||||||
if os.path.isfile(target_path):
|
|
||||||
file_options = open(target_path, 'r')
|
|
||||||
html_lines = file_options.readlines()
|
|
||||||
file_options.close()
|
|
||||||
new_html_array = []
|
|
||||||
my_target_row = ['remote_url_row','ocr_captcha_enable_row']
|
|
||||||
for line in html_lines:
|
|
||||||
for row in my_target_row:
|
|
||||||
if row in line:
|
|
||||||
line = line.replace('display: none;','')
|
|
||||||
new_html_array.append(line)
|
|
||||||
if len(new_html_array) > 0:
|
|
||||||
#print("output new options.html")
|
|
||||||
with open(target_path, 'w') as outfile:
|
|
||||||
outfile.write("".join(new_html_array))
|
|
||||||
|
|
||||||
|
|
||||||
def get_uc_options(uc, config_dict, webdriver_path):
|
def get_uc_options(uc, config_dict, webdriver_path):
|
||||||
options = uc.ChromeOptions()
|
options = uc.ChromeOptions()
|
||||||
options.page_load_strategy = 'eager'
|
options.page_load_strategy = 'eager'
|
||||||
|
|
|
@ -22,7 +22,7 @@ import sys
|
||||||
import threading
|
import threading
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.01.12)"
|
CONST_APP_VERSION = "MaxBot (2024.01.13)"
|
||||||
|
|
||||||
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"
|
||||||
|
|
|
@ -39,7 +39,7 @@ try:
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.01.12)"
|
CONST_APP_VERSION = "MaxBot (2024.01.13)"
|
||||||
|
|
||||||
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"
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 438 B |
Binary file not shown.
After Width: | Height: | Size: 764 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"author": "Max Yao",
|
||||||
|
"name": "MaxBlock Plus",
|
||||||
|
"description": "Helps you hide ads, avoid tracking, load pages faster.",
|
||||||
|
"icons": {
|
||||||
|
"16": "icons/maxblock-16.png",
|
||||||
|
"32": "icons/maxblock-32.png",
|
||||||
|
"48": "icons/maxblock-48.png",
|
||||||
|
"64": "icons/maxblock-64.png",
|
||||||
|
"128": "icons/maxblock-128.png"
|
||||||
|
},
|
||||||
|
"manifest_version": 3,
|
||||||
|
"declarative_net_request": {
|
||||||
|
"rule_resources": [
|
||||||
|
{
|
||||||
|
"id": "ruleset_1",
|
||||||
|
"enabled": true,
|
||||||
|
"path": "rules_1.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"declarativeNetRequest",
|
||||||
|
"declarativeNetRequestFeedback"
|
||||||
|
],
|
||||||
|
"action": {
|
||||||
|
"default_icon": "icons/maxblock-128.png",
|
||||||
|
"default_title": "MaxBlock"
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
|
@ -1,318 +1,318 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*google-analytics.com/*",
|
"urlFilter": "*google-analytics.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*googletagmanager.com/*",
|
"urlFilter": "*googletagmanager.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*googletagservices.com/*",
|
"urlFilter": "*googletagservices.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*lndata.com/*",
|
"urlFilter": "*lndata.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*a.amnet.tw/*",
|
"urlFilter": "*a.amnet.tw/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*ad.setn.com/*",
|
"urlFilter": "*ad.setn.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*adx.c.appier.net/*",
|
"urlFilter": "*adx.c.appier.net/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*cbcapi.setn.com/*",
|
"urlFilter": "*cbcapi.setn.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*clarity.ms/*",
|
"urlFilter": "*clarity.ms/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 10,
|
"id": 10,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*cloudfront.com/*",
|
"urlFilter": "*cloudfront.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*cms.analytics.yahoo.com/*",
|
"urlFilter": "*cms.analytics.yahoo.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*doubleclick.net/*",
|
"urlFilter": "*doubleclick.net/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 13,
|
"id": 13,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*e2elog.fetnet.net/*",
|
"urlFilter": "*e2elog.fetnet.net/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 14,
|
"id": 14,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*fundingchoicesmessages.google.com/*",
|
"urlFilter": "*fundingchoicesmessages.google.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 15,
|
"id": 15,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*ghtinc.com/*",
|
"urlFilter": "*ghtinc.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 16,
|
"id": 16,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*match.adsrvr.org/*",
|
"urlFilter": "*match.adsrvr.org/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 17,
|
"id": 17,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*onead.onevision.com.tw/*",
|
"urlFilter": "*onead.onevision.com.tw/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 18,
|
"id": 18,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*popin.cc/*",
|
"urlFilter": "*popin.cc/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 19,
|
"id": 19,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*rollbar.com/*",
|
"urlFilter": "*rollbar.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 20,
|
"id": 20,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*sb.scorecardresearch.com/*",
|
"urlFilter": "*sb.scorecardresearch.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 22,
|
"id": 22,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*tagtoo.co/*",
|
"urlFilter": "*tagtoo.co/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 23,
|
"id": 23,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*.ssp.hinet.net/*",
|
"urlFilter": "*.ssp.hinet.net/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 24,
|
"id": 24,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*ticketmaster.sg/js/adblock*",
|
"urlFilter": "*ticketmaster.sg/js/adblock*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 25,
|
"id": 25,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*.googlesyndication.com/*",
|
"urlFilter": "*.googlesyndication.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 26,
|
"id": 26,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*treasuredata.com/*",
|
"urlFilter": "*treasuredata.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 27,
|
"id": 27,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*ubas.setn.com/*",
|
"urlFilter": "*ubas.setn.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 28,
|
"id": 28,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*play.google.com/log?*",
|
"urlFilter": "*play.google.com/log?*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 29,
|
"id": 29,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*www.youtube.com/youtubei/v1/player/heartbeat*",
|
"urlFilter": "*www.youtube.com/youtubei/v1/player/heartbeat*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 30,
|
"id": 30,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*tixcraft.com/js/analytics.js*",
|
"urlFilter": "*tixcraft.com/js/analytics.js*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 31,
|
"id": 31,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*ticketmaster.sg/js/adblock.js*",
|
"urlFilter": "*ticketmaster.sg/js/adblock.js*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 32,
|
"id": 32,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*img.uniicreative.com/*",
|
"urlFilter": "*img.uniicreative.com/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 33,
|
"id": 33,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*cdn.cookielaw.org/*",
|
"urlFilter": "*cdn.cookielaw.org/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 34,
|
"id": 34,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*tixcraft.com/js/custom.js*",
|
"urlFilter": "*tixcraft.com/js/custom.js*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 35,
|
"id": 35,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*tixcraft.com/js/common.js*",
|
"urlFilter": "*tixcraft.com/js/common.js*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 36,
|
"id": 36,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"action": { "type": "block"},
|
"action": { "type": "block"},
|
||||||
"condition": {
|
"condition": {
|
||||||
"urlFilter": "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*",
|
"urlFilter": "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*",
|
||||||
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
"resourceTypes": ["main_frame", "sub_frame", "script", "image", "font", "xmlhttprequest", "media", "stylesheet"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,13 @@
|
||||||
body {
|
body {
|
||||||
margin: 36px;
|
margin: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background: #eee;
|
background: #eee;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,3 @@
|
||||||
$('input[type=checkbox]').each(function() {
|
$('input[type=checkbox]').each(function() {
|
||||||
$(this).prop('checked', true);
|
$(this).prop('checked', true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,347 +1,347 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
var eventDataCache = null;
|
var eventDataCache = null;
|
||||||
var performanceDataCache = null;
|
var performanceDataCache = null;
|
||||||
var selectedPerfId = null;
|
var selectedPerfId = null;
|
||||||
var perfPriceListMap = null;
|
var perfPriceListMap = null;
|
||||||
var pageLoaded = false;
|
var pageLoaded = false;
|
||||||
var eventImageUrl = null;
|
var eventImageUrl = null;
|
||||||
var perfDisplayStyle = null;
|
var perfDisplayStyle = null;
|
||||||
var allPerformanceDataCache = null;
|
var allPerformanceDataCache = null;
|
||||||
var contextPath = "/utsvInternet";
|
var contextPath = "/utsvInternet";
|
||||||
|
|
||||||
var showEnlargedImage = function(image){
|
var showEnlargedImage = function(image){
|
||||||
if(image === 'event'){
|
if(image === 'event'){
|
||||||
$('.image').attr('src', eventImageUrl);
|
$('.image').attr('src', eventImageUrl);
|
||||||
}
|
}
|
||||||
$("#commonImageModal").modal('show');
|
$("#commonImageModal").modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
var addToCalendar = function() {
|
var addToCalendar = function() {
|
||||||
if(eventDataCache && eventDataCache.eventDate){
|
if(eventDataCache && eventDataCache.eventDate){
|
||||||
let addToCalButton= document.querySelector('add-to-calendar-button')
|
let addToCalButton= document.querySelector('add-to-calendar-button')
|
||||||
|
|
||||||
localStorage.getItem('theme-color') == 'black'? addToCalButton.setAttribute('lightMode','dark') : addToCalButton.removeAttribute('lightMode')
|
localStorage.getItem('theme-color') == 'black'? addToCalButton.setAttribute('lightMode','dark') : addToCalButton.removeAttribute('lightMode')
|
||||||
|
|
||||||
let options = [];
|
let options = [];
|
||||||
options.push('Google|'+ $.i18n("calendar-google"))
|
options.push('Google|'+ $.i18n("calendar-google"))
|
||||||
options.push('iCal|'+ $.i18n("calendar-ical"))
|
options.push('iCal|'+ $.i18n("calendar-ical"))
|
||||||
options.push('Outlook.com|'+ $.i18n("calendar-outlook"))
|
options.push('Outlook.com|'+ $.i18n("calendar-outlook"))
|
||||||
addToCalButton.setAttribute('options',JSON.stringify(options))
|
addToCalButton.setAttribute('options',JSON.stringify(options))
|
||||||
|
|
||||||
let customLabels = {
|
let customLabels = {
|
||||||
'close': $.i18n("calendar-close"),
|
'close': $.i18n("calendar-close"),
|
||||||
'label.addtocalendar': $.i18n("calendar-label-addtocalendar")
|
'label.addtocalendar': $.i18n("calendar-label-addtocalendar")
|
||||||
};
|
};
|
||||||
addToCalButton.setAttribute('customLabels',JSON.stringify(customLabels))
|
addToCalButton.setAttribute('customLabels',JSON.stringify(customLabels))
|
||||||
|
|
||||||
let venueNameField = getDataFieldByLang("venueName")
|
let venueNameField = getDataFieldByLang("venueName")
|
||||||
addToCalButton.setAttribute('location',eventDataCache.venue[venueNameField])
|
addToCalButton.setAttribute('location',eventDataCache.venue[venueNameField])
|
||||||
|
|
||||||
$("#addToCal").show();
|
$("#addToCal").show();
|
||||||
|
|
||||||
if(performanceDataCache){
|
if(performanceDataCache){
|
||||||
if(performanceDataCache.performances && performanceDataCache.performances.length > 0) {
|
if(performanceDataCache.performances && performanceDataCache.performances.length > 0) {
|
||||||
let dates = []
|
let dates = []
|
||||||
performanceDataCache.performances.forEach(perf =>{
|
performanceDataCache.performances.forEach(perf =>{
|
||||||
let performanceNameField = getDataFieldByLang("performanceName");
|
let performanceNameField = getDataFieldByLang("performanceName");
|
||||||
let performanceName = perf[performanceNameField];
|
let performanceName = perf[performanceNameField];
|
||||||
|
|
||||||
if(performanceDataCache.performances.length == 1){
|
if(performanceDataCache.performances.length == 1){
|
||||||
addToCalButton.setAttribute('name', performanceName)
|
addToCalButton.setAttribute('name', performanceName)
|
||||||
addToCalButton.setAttribute('startDate', moment(perf.performanceDate).format("YYYY-MM-DD"))
|
addToCalButton.setAttribute('startDate', moment(perf.performanceDate).format("YYYY-MM-DD"))
|
||||||
}else{
|
}else{
|
||||||
let prefDate = {
|
let prefDate = {
|
||||||
name: performanceName,
|
name: performanceName,
|
||||||
startDate: moment(perf.performanceDate).format("YYYY-MM-DD")
|
startDate: moment(perf.performanceDate).format("YYYY-MM-DD")
|
||||||
}
|
}
|
||||||
dates.push(prefDate)
|
dates.push(prefDate)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if(performanceDataCache.performances.length > 1) addToCalButton.setAttribute('dates',JSON.stringify(dates))
|
if(performanceDataCache.performances.length > 1) addToCalButton.setAttribute('dates',JSON.stringify(dates))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var fillEventData = function(data) {
|
var fillEventData = function(data) {
|
||||||
console.log("eventData:", data);
|
console.log("eventData:", data);
|
||||||
eventDataCache = data;
|
eventDataCache = data;
|
||||||
eventImageUrl = data.eventLargeCoverUrl
|
eventImageUrl = data.eventLargeCoverUrl
|
||||||
|
|
||||||
let reload=false;
|
let reload=false;
|
||||||
let eventStatues = {"TOBESOLD" : "event-status-tobesold", "SALE" : "event-status-sale", "SOLDOUT" : "event-status-soldout", "EXPIRED" : "event-status-expired"};
|
let eventStatues = {"TOBESOLD" : "event-status-tobesold", "SALE" : "event-status-sale", "SOLDOUT" : "event-status-soldout", "EXPIRED" : "event-status-expired"};
|
||||||
if(data.status=="TOBESOLD") reload=true;
|
if(data.status=="TOBESOLD") reload=true;
|
||||||
if(data.status=="SOLDOUT") reload=true;;
|
if(data.status=="SOLDOUT") reload=true;;
|
||||||
|
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var openWindow = function(url) {
|
var openWindow = function(url) {
|
||||||
let citylineWindow = window.open(url,"_blank ","width=1020,height=600,top=0,left=20,resizable=yes,menubar=no,scrollbars=yes,status=yes");
|
let citylineWindow = window.open(url,"_blank ","width=1020,height=600,top=0,left=20,resizable=yes,menubar=no,scrollbars=yes,status=yes");
|
||||||
citylineWindow.focus();
|
citylineWindow.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
var fillPerformanceData = function(data) {
|
var fillPerformanceData = function(data) {
|
||||||
console.log("eventPerfData:", data);
|
console.log("eventPerfData:", data);
|
||||||
performanceDataCache = data;
|
performanceDataCache = data;
|
||||||
perfPriceListMap = new Map();
|
perfPriceListMap = new Map();
|
||||||
//selectedPerfId = null;
|
//selectedPerfId = null;
|
||||||
let perfHtml = "";
|
let perfHtml = "";
|
||||||
if(data.performances && data.performances.length > 0) {
|
if(data.performances && data.performances.length > 0) {
|
||||||
|
|
||||||
let fillerPerId = [];
|
let fillerPerId = [];
|
||||||
data.performances.forEach(i => fillerPerId.push(i.performanceId))
|
data.performances.forEach(i => fillerPerId.push(i.performanceId))
|
||||||
|
|
||||||
data.performances.forEach(function(perf, i) {
|
data.performances.forEach(function(perf, i) {
|
||||||
perfHtml += getPerfHtml(perf)
|
perfHtml += getPerfHtml(perf)
|
||||||
perfPriceListMap.set(perf.performanceId, perf.pricelist);
|
perfPriceListMap.set(perf.performanceId, perf.pricelist);
|
||||||
|
|
||||||
if(perfDisplayStyle === 'DEFAULT'){
|
if(perfDisplayStyle === 'DEFAULT'){
|
||||||
if(!selectedPerfId && perf.status != 'SOLDOUT') selectedPerfId = perf.performanceId;
|
if(!selectedPerfId && perf.status != 'SOLDOUT') selectedPerfId = perf.performanceId;
|
||||||
}else if(perfDisplayStyle === 'CALENDAR'){
|
}else if(perfDisplayStyle === 'CALENDAR'){
|
||||||
if(!selectedPerfId && perf.status != 'SOLDOUT') selectedPerfId = perf.performanceId;
|
if(!selectedPerfId && perf.status != 'SOLDOUT') selectedPerfId = perf.performanceId;
|
||||||
|
|
||||||
if(!fillerPerId.includes(+selectedPerfId)){
|
if(!fillerPerId.includes(+selectedPerfId)){
|
||||||
if(perf.status != 'SOLDOUT') selectedPerfId = perf.performanceId;
|
if(perf.status != 'SOLDOUT') selectedPerfId = perf.performanceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Google Analytics */
|
/* Google Analytics */
|
||||||
var formatDate = new Date(perf.performanceDate);
|
var formatDate = new Date(perf.performanceDate);
|
||||||
var item = {
|
var item = {
|
||||||
id : "[" + eventSynonym + "] " + formatForGoogleAnalytics(formatDate), // 2021/08/14 23:59 (Sat)
|
id : "[" + eventSynonym + "] " + formatForGoogleAnalytics(formatDate), // 2021/08/14 23:59 (Sat)
|
||||||
name : event_en,
|
name : event_en,
|
||||||
category : "[" + eventSynonym + "] " + formatForGoogleAnalytics(formatDate),
|
category : "[" + eventSynonym + "] " + formatForGoogleAnalytics(formatDate),
|
||||||
list_position : i
|
list_position : i
|
||||||
};
|
};
|
||||||
viewItems.push(item);
|
viewItems.push(item);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
googleAnalyticViewItem(perf.performanceId, formatForGoogleAnalytics(perf.performanceDate));
|
googleAnalyticViewItem(perf.performanceId, formatForGoogleAnalytics(perf.performanceDate));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
googleAnalyticViewItemList();
|
googleAnalyticViewItemList();
|
||||||
|
|
||||||
$(".date-box").html(perfHtml);
|
$(".date-box").html(perfHtml);
|
||||||
selectPerf();
|
selectPerf();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(".date-title").addClass("d-none");
|
$(".date-title").addClass("d-none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var getPerfById = function(perfId) {
|
var getPerfById = function(perfId) {
|
||||||
var perfList = performanceDataCache.performances;
|
var perfList = performanceDataCache.performances;
|
||||||
if(perfList && perfList.length > 0) {
|
if(perfList && perfList.length > 0) {
|
||||||
return perfList.find(perf => perf.performanceId == perfId)
|
return perfList.find(perf => perf.performanceId == perfId)
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var fillPriceList = function(perfId) {
|
var fillPriceList = function(perfId) {
|
||||||
let priceList = perfPriceListMap.get(perfId);
|
let priceList = perfPriceListMap.get(perfId);
|
||||||
let ticketPriceHtml = getTicketPriceHtml(priceList);
|
let ticketPriceHtml = getTicketPriceHtml(priceList);
|
||||||
$(".puchase-bottom").html(ticketPriceHtml);
|
$(".puchase-bottom").html(ticketPriceHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectPerf = function() {
|
var selectPerf = function() {
|
||||||
if(selectedPerfId){
|
if(selectedPerfId){
|
||||||
$('button.date-time-position').attr("aria-pressed", false);
|
$('button.date-time-position').attr("aria-pressed", false);
|
||||||
let selectedElement = $("*[data-perf-id='" + selectedPerfId + "']");
|
let selectedElement = $("*[data-perf-id='" + selectedPerfId + "']");
|
||||||
selectedElement.addClass("item-onclick");
|
selectedElement.addClass("item-onclick");
|
||||||
selectedElement.attr("aria-pressed", true);
|
selectedElement.attr("aria-pressed", true);
|
||||||
fillPriceList(selectedPerfId);
|
fillPriceList(selectedPerfId);
|
||||||
|
|
||||||
var perf = getPerfById(selectedPerfId);
|
var perf = getPerfById(selectedPerfId);
|
||||||
if (perf) {
|
if (perf) {
|
||||||
var perfDate = new Date(perf.performanceDate);
|
var perfDate = new Date(perf.performanceDate);
|
||||||
googleAnalyticViewItem(selectedPerfId, formatForGoogleAnalytics(perfDate));
|
googleAnalyticViewItem(selectedPerfId, formatForGoogleAnalytics(perfDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var getTicketPriceHtml = function(priceList){
|
var getTicketPriceHtml = function(priceList){
|
||||||
let ticketPriceHtml = "";
|
let ticketPriceHtml = "";
|
||||||
if(priceList){
|
if(priceList){
|
||||||
priceList.sort((a, b) => (a.price > b.price) ? -1 : 1);
|
priceList.sort((a, b) => (a.price > b.price) ? -1 : 1);
|
||||||
priceList.forEach(function(pl) {
|
priceList.forEach(function(pl) {
|
||||||
let statusHtml = "";
|
let statusHtml = "";
|
||||||
if(pl.status == 'LIMIT' || pl.status == 'SOLDOUT'){
|
if(pl.status == 'LIMIT' || pl.status == 'SOLDOUT'){
|
||||||
statusHtml = '<img class="limited-img" src="./revamp/images/limited2.svg" alt="">';
|
statusHtml = '<img class="limited-img" src="./revamp/images/limited2.svg" alt="">';
|
||||||
}
|
}
|
||||||
ticketPriceHtml += '<button type="button" class="btn btn-outline-primary price-btn" ><div><span>' + getFormattedPrice(pl.price) +'</span>' +statusHtml + '</div>'+'</button> ';
|
ticketPriceHtml += '<button type="button" class="btn btn-outline-primary price-btn" ><div><span>' + getFormattedPrice(pl.price) +'</span>' +statusHtml + '</div>'+'</button> ';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ticketPriceHtml = '<div class="price-box">' +
|
ticketPriceHtml = '<div class="price-box">' +
|
||||||
' <div class="date-title price-title1" data-i18n="price-title">' + $.i18n("price-title" ) + '</div>' +
|
' <div class="date-title price-title1" data-i18n="price-title">' + $.i18n("price-title" ) + '</div>' +
|
||||||
' <div>'+ ticketPriceHtml + '</div>' +
|
' <div>'+ ticketPriceHtml + '</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="ticketCard"> ' +
|
'<div class="ticketCard"> ' +
|
||||||
' <button type="button" class="btn btn-outline-primary purchase-btn" data-i18n="purchase-title">' + $.i18n("purchase-title" ) + '</button>' +
|
' <button type="button" class="btn btn-outline-primary purchase-btn" data-i18n="purchase-title">' + $.i18n("purchase-title" ) + '</button>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
return ticketPriceHtml;
|
return ticketPriceHtml;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var postConstruct = function(){
|
var postConstruct = function(){
|
||||||
$(".date-time-position").click(function(){
|
$(".date-time-position").click(function(){
|
||||||
$('button.date-time-position').attr("aria-pressed", false);
|
$('button.date-time-position').attr("aria-pressed", false);
|
||||||
$(".item-onclick").removeClass("item-onclick");
|
$(".item-onclick").removeClass("item-onclick");
|
||||||
$(this).addClass("item-onclick");
|
$(this).addClass("item-onclick");
|
||||||
$(this).attr("aria-pressed", true);
|
$(this).attr("aria-pressed", true);
|
||||||
let perfId = $(this).data("perf-id");
|
let perfId = $(this).data("perf-id");
|
||||||
selectedPerfId = perfId;
|
selectedPerfId = perfId;
|
||||||
fillPriceList(perfId);
|
fillPriceList(perfId);
|
||||||
setPurchaseBtnClick();
|
setPurchaseBtnClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#likeButton').on('click', function() {
|
$('#likeButton').on('click', function() {
|
||||||
var eventId = getUrlParameter('event');
|
var eventId = getUrlParameter('event');
|
||||||
if(doLikeThisEvent(eventId))
|
if(doLikeThisEvent(eventId))
|
||||||
$('.likeIcon').addClass('liked');
|
$('.likeIcon').addClass('liked');
|
||||||
})
|
})
|
||||||
|
|
||||||
setPurchaseBtnClick();
|
setPurchaseBtnClick();
|
||||||
if (needToPurchase) {
|
if (needToPurchase) {
|
||||||
$(".purchase-btn").click();
|
$(".purchase-btn").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide presenter if repeated
|
// hide presenter if repeated
|
||||||
if($("[data-i18n=event-presenter]").text() == $("#firstDesc div p:first-child").text()) {
|
if($("[data-i18n=event-presenter]").text() == $("#firstDesc div p:first-child").text()) {
|
||||||
$("[data-i18n=event-presenter]").parent().hide();
|
$("[data-i18n=event-presenter]").parent().hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var purchaseBtnClick = function() {
|
var purchaseBtnClick = function() {
|
||||||
$.LoadingOverlay("show");
|
$.LoadingOverlay("show");
|
||||||
var eventId = getUrlParameter('event');
|
var eventId = getUrlParameter('event');
|
||||||
var url = contextPath + "/internet/performance?event=[eventId]&perfId=[perfId]";
|
var url = contextPath + "/internet/performance?event=[eventId]&perfId=[perfId]";
|
||||||
url = url.replace("[eventId]", eventId)
|
url = url.replace("[eventId]", eventId)
|
||||||
.replace("[perfId]",selectedPerfId)
|
.replace("[perfId]",selectedPerfId)
|
||||||
location.href = url;
|
location.href = url;
|
||||||
$.LoadingOverlay("close");
|
$.LoadingOverlay("close");
|
||||||
}
|
}
|
||||||
|
|
||||||
var setPurchaseBtnClick = function() {
|
var setPurchaseBtnClick = function() {
|
||||||
$(".purchase-btn").click(function () {
|
$(".purchase-btn").click(function () {
|
||||||
if(hasLoggedIn){
|
if(hasLoggedIn){
|
||||||
purchaseBtnClick();
|
purchaseBtnClick();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var addParams = [];
|
var addParams = [];
|
||||||
if(selectedPerfId)
|
if(selectedPerfId)
|
||||||
addParams.push('perfId=' + selectedPerfId);
|
addParams.push('perfId=' + selectedPerfId);
|
||||||
//console.log('addParams', addParams)
|
//console.log('addParams', addParams)
|
||||||
loginCallback = purchaseBtnClick;
|
loginCallback = purchaseBtnClick;
|
||||||
login(true, addParams);
|
login(true, addParams);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var reloadFromCache = function() {
|
var reloadFromCache = function() {
|
||||||
fillEventData(eventDataCache);
|
fillEventData(eventDataCache);
|
||||||
if(perfDisplayStyle === 'DEFAULT'){
|
if(perfDisplayStyle === 'DEFAULT'){
|
||||||
fillPerformanceData(performanceDataCache);
|
fillPerformanceData(performanceDataCache);
|
||||||
}else if(perfDisplayStyle === 'CALENDAR'){
|
}else if(perfDisplayStyle === 'CALENDAR'){
|
||||||
fillCalendar(allPerformanceDataCache)
|
fillCalendar(allPerformanceDataCache)
|
||||||
}
|
}
|
||||||
postConstruct();
|
postConstruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
var loadArchiveUrl = function(archiveUrl) {
|
var loadArchiveUrl = function(archiveUrl) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : "GET",
|
type : "GET",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: archiveUrl,
|
url: archiveUrl,
|
||||||
async: false,
|
async: false,
|
||||||
global: false,
|
global: false,
|
||||||
cache: true,
|
cache: true,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
fillEventData(data);
|
fillEventData(data);
|
||||||
},
|
},
|
||||||
statusCode: {
|
statusCode: {
|
||||||
403: function() {
|
403: function() {
|
||||||
handleEventNotAvail();
|
handleEventNotAvail();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var loadData = function() {
|
var loadData = function() {
|
||||||
let eventId = getUrlParameter('event');
|
let eventId = getUrlParameter('event');
|
||||||
if(eventId){
|
if(eventId){
|
||||||
let eventRequestUrl = contextPath + "/internet/api/event/" + eventId;
|
let eventRequestUrl = contextPath + "/internet/api/event/" + eventId;
|
||||||
let eventPerfRequestUrl = contextPath + "/internet/api/event/" + eventId + "/performances";
|
let eventPerfRequestUrl = contextPath + "/internet/api/event/" + eventId + "/performances";
|
||||||
return $.when($.getJSON(eventRequestUrl)).then(function(data){
|
return $.when($.getJSON(eventRequestUrl)).then(function(data){
|
||||||
if(data.eventId) fillEventData(data);
|
if(data.eventId) fillEventData(data);
|
||||||
else if (data.archiveUrl){
|
else if (data.archiveUrl){
|
||||||
//$(".date-title").addClass("d-none");
|
//$(".date-title").addClass("d-none");
|
||||||
loadArchiveUrl(data.archiveUrl);
|
loadArchiveUrl(data.archiveUrl);
|
||||||
}
|
}
|
||||||
else handleEventNotAvail();
|
else handleEventNotAvail();
|
||||||
|
|
||||||
perfDisplayStyle = data.performancesDisplayStyle;
|
perfDisplayStyle = data.performancesDisplayStyle;
|
||||||
return $.getJSON(eventPerfRequestUrl);
|
return $.getJSON(eventPerfRequestUrl);
|
||||||
}).then(function(data){
|
}).then(function(data){
|
||||||
allPerformanceDataCache = data;
|
allPerformanceDataCache = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("no event specified");
|
console.log("no event specified");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cityline_event_status_check()
|
function cityline_event_status_check()
|
||||||
{
|
{
|
||||||
selectedPerfId = getUrlParameter('perfId');
|
selectedPerfId = getUrlParameter('perfId');
|
||||||
if(pageLoaded) {
|
if(pageLoaded) {
|
||||||
reloadFromCache();
|
reloadFromCache();
|
||||||
}else{
|
}else{
|
||||||
pageLoaded = true;
|
pageLoaded = true;
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
cityline_event_status_check();
|
cityline_event_status_check();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
function cityline_msg_start(status)
|
function cityline_msg_start(status)
|
||||||
{
|
{
|
||||||
if(settings) {
|
if(settings) {
|
||||||
let settings_div="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
let settings_div="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
||||||
$("body").append(settings_div);
|
$("body").append(settings_div);
|
||||||
let status_div="<div style='display:none' id='status'>" + status + "</div>";
|
let status_div="<div style='display:none' id='status'>" + status + "</div>";
|
||||||
$("body").append(status_div);
|
$("body").append(status_div);
|
||||||
//console.log("dom append");
|
//console.log("dom append");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
cityline_msg_start(items.status);
|
cityline_msg_start(items.status);
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
let settings = JSON.parse($("#settings").html());
|
let settings = JSON.parse($("#settings").html());
|
||||||
let status = $("#status").html();
|
let status = $("#status").html();
|
||||||
console.log("msg");
|
console.log("msg");
|
||||||
console.log(settings);
|
console.log(settings);
|
||||||
console.log(status);
|
console.log(status);
|
||||||
|
|
||||||
$("#settings").remove();
|
$("#settings").remove();
|
||||||
$("#status").remove();
|
$("#status").remove();
|
||||||
|
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// too short to cause error.
|
// too short to cause error.
|
||||||
if(auto_reload_page_interval < 0.3) {
|
if(auto_reload_page_interval < 0.3) {
|
||||||
auto_reload_page_interval = 0.3;
|
auto_reload_page_interval = 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status=='ON') {
|
if(status=='ON') {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
retry();
|
retry();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dom_ready()
|
function dom_ready()
|
||||||
{
|
{
|
||||||
//console.log("checking...");
|
//console.log("checking...");
|
||||||
if($("#settings").length>0) {
|
if($("#settings").length>0) {
|
||||||
clearInterval(myInterval);
|
clearInterval(myInterval);
|
||||||
begin();
|
begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
dom_ready();
|
dom_ready();
|
||||||
}, 100);
|
}, 100);
|
|
@ -1,32 +1,32 @@
|
||||||
function get_target_area_with_order(settings, matched_block)
|
function get_target_area_with_order(settings, matched_block)
|
||||||
{
|
{
|
||||||
//console.log(settings);
|
//console.log(settings);
|
||||||
let target_area = [];
|
let target_area = [];
|
||||||
|
|
||||||
if(settings.area_auto_select.mode=="from top to bottom")
|
if(settings.area_auto_select.mode=="from top to bottom")
|
||||||
target_area = matched_block.first();
|
target_area = matched_block.first();
|
||||||
if(settings.area_auto_select.mode=="from bottom to top")
|
if(settings.area_auto_select.mode=="from bottom to top")
|
||||||
target_area = matched_block.last();
|
target_area = matched_block.last();
|
||||||
if(settings.area_auto_select.mode=="center")
|
if(settings.area_auto_select.mode=="center")
|
||||||
target_area = matched_block.first();
|
target_area = matched_block.first();
|
||||||
if(settings.area_auto_select.mode=="random")
|
if(settings.area_auto_select.mode=="random")
|
||||||
target_area = matched_block.first();
|
target_area = matched_block.first();
|
||||||
return target_area;
|
return target_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_target_date_with_order(settings, matched_block)
|
function get_target_date_with_order(settings, matched_block)
|
||||||
{
|
{
|
||||||
//console.log(settings);
|
//console.log(settings);
|
||||||
let target_area = [];
|
let target_area = [];
|
||||||
|
|
||||||
if(settings.date_auto_select.mode=="from top to bottom")
|
if(settings.date_auto_select.mode=="from top to bottom")
|
||||||
target_date = matched_block.first();
|
target_date = matched_block.first();
|
||||||
if(settings.date_auto_select.mode=="from bottom to top")
|
if(settings.date_auto_select.mode=="from bottom to top")
|
||||||
target_date = matched_block.last();
|
target_date = matched_block.last();
|
||||||
if(settings.date_auto_select.mode=="center")
|
if(settings.date_auto_select.mode=="center")
|
||||||
target_date = matched_block.first();
|
target_date = matched_block.first();
|
||||||
if(settings.date_auto_select.mode=="random")
|
if(settings.date_auto_select.mode=="random")
|
||||||
target_date = matched_block.first();
|
target_date = matched_block.first();
|
||||||
|
|
||||||
return target_area;
|
return target_area;
|
||||||
}
|
}
|
|
@ -1,32 +1,32 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
function hkticketing_msg_start(status)
|
function hkticketing_msg_start(status)
|
||||||
{
|
{
|
||||||
if(settings) {
|
if(settings) {
|
||||||
let settings_div="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
let settings_div="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
||||||
$("body").append(settings_div);
|
$("body").append(settings_div);
|
||||||
let status_div="<div style='display:none' id='status'>" + status + "</div>";
|
let status_div="<div style='display:none' id='status'>" + status + "</div>";
|
||||||
$("body").append(status_div);
|
$("body").append(status_div);
|
||||||
console.log("dom append");
|
console.log("dom append");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
hkticketing_msg_start(items.status);
|
hkticketing_msg_start(items.status);
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
const settings_div = document.querySelector('#settings');
|
const settings_div = document.querySelector('#settings');
|
||||||
const status_div = document.querySelector('#status');
|
const status_div = document.querySelector('#status');
|
||||||
let settings = JSON.parse(settings_div.innerHTML);
|
let settings = JSON.parse(settings_div.innerHTML);
|
||||||
let status = status_div.innerHTML;
|
let status = status_div.innerHTML;
|
||||||
console.log("msg");
|
console.log("msg");
|
||||||
console.log(settings);
|
console.log(settings);
|
||||||
console.log(status);
|
console.log(status);
|
||||||
|
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// too short to cause error.
|
// too short to cause error.
|
||||||
if(auto_reload_page_interval < 0.8) {
|
if(auto_reload_page_interval < 0.8) {
|
||||||
auto_reload_page_interval = 0.8;
|
auto_reload_page_interval = 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status=='ON') {
|
if(status=='ON') {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
busyFor = 0;
|
busyFor = 0;
|
||||||
reload();
|
reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dom_ready()
|
function dom_ready()
|
||||||
{
|
{
|
||||||
//console.log("checking...");
|
//console.log("checking...");
|
||||||
const settings_div = document.querySelector('#settings');
|
const settings_div = document.querySelector('#settings');
|
||||||
if(settings_div) {
|
if(settings_div) {
|
||||||
clearInterval(myInterval);
|
clearInterval(myInterval);
|
||||||
begin();
|
begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
dom_ready();
|
dom_ready();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
|
@ -1,147 +1,147 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
//console.log("start ibon area");
|
//console.log("start ibon area");
|
||||||
|
|
||||||
// price row.
|
// price row.
|
||||||
$("table.table > tbody > tr.disabled").remove();
|
$("table.table > tbody > tr.disabled").remove();
|
||||||
$("table.table > tbody > tr.sold-out").remove();
|
$("table.table > tbody > tr.sold-out").remove();
|
||||||
$("div.map > div > img").remove();
|
$("div.map > div > img").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
||||||
var $tr=$("table.table > tbody > tr[onclick]");
|
var $tr=$("table.table > tbody > tr[onclick]");
|
||||||
//console.log("$tr.length:"+$tr.length);
|
//console.log("$tr.length:"+$tr.length);
|
||||||
if($tr.length==1) {
|
if($tr.length==1) {
|
||||||
//console.log("$tr.html:"+$tr.html());
|
//console.log("$tr.html:"+$tr.html());
|
||||||
$tr.click();
|
$tr.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function ibon_area_ready(settings) {
|
function ibon_area_ready(settings) {
|
||||||
let area_keyword_array = [];
|
let area_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.area_auto_select.area_keyword.length > 0) {
|
if(settings.area_auto_select.area_keyword.length > 0) {
|
||||||
if(settings.area_auto_select.area_keyword!='""') {
|
if(settings.area_auto_select.area_keyword!='""') {
|
||||||
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//let target_area = [];
|
//let target_area = [];
|
||||||
|
|
||||||
let target_row=null;
|
let target_row=null;
|
||||||
let all_row = $("table.table > tbody > tr[onclick]");
|
let all_row = $("table.table > tbody > tr[onclick]");
|
||||||
if (all_row.length > 0)
|
if (all_row.length > 0)
|
||||||
{
|
{
|
||||||
if (all_row.length == 1) {
|
if (all_row.length == 1) {
|
||||||
// single select.
|
// single select.
|
||||||
target_row=all_row;
|
target_row=all_row;
|
||||||
} else {
|
} else {
|
||||||
// multi select.
|
// multi select.
|
||||||
all_row.each(function ()
|
all_row.each(function ()
|
||||||
{
|
{
|
||||||
//console.log(all_row.index(this));
|
//console.log(all_row.index(this));
|
||||||
let is_match_keyword = false;
|
let is_match_keyword = false;
|
||||||
if(all_row.index(this)==0) {
|
if(all_row.index(this)==0) {
|
||||||
target_row=$(this);
|
target_row=$(this);
|
||||||
} else {
|
} else {
|
||||||
if(area_keyword_array.length) {
|
if(area_keyword_array.length) {
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
//console.log("html:"+html_text);
|
//console.log("html:"+html_text);
|
||||||
|
|
||||||
for (let i = 0; i < area_keyword_array.length; i++) {
|
for (let i = 0; i < area_keyword_array.length; i++) {
|
||||||
// TOOD: multi item matched, need sort.
|
// TOOD: multi item matched, need sort.
|
||||||
// target_area = get_target_area_with_order(settings, matched_block);
|
// target_area = get_target_area_with_order(settings, matched_block);
|
||||||
|
|
||||||
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
||||||
is_match_keyword = true;
|
is_match_keyword = true;
|
||||||
target_row=$(this);
|
target_row=$(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(all_row.index(this)==0) {
|
if(all_row.index(this)==0) {
|
||||||
is_match_keyword = true;
|
is_match_keyword = true;
|
||||||
target_row=$(this);
|
target_row=$(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("is_match_keyword:"+is_match_keyword);
|
//console.log("is_match_keyword:"+is_match_keyword);
|
||||||
if(is_match_keyword) {
|
if(is_match_keyword) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(target_row) {
|
if(target_row) {
|
||||||
target_row.click();
|
target_row.click();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ibon_area_clean_exclude(settings)
|
function ibon_area_clean_exclude(settings)
|
||||||
{
|
{
|
||||||
let exclude_keyword_array = [];
|
let exclude_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.keyword_exclude.length > 0) {
|
if(settings.keyword_exclude.length > 0) {
|
||||||
if(settings.keyword_exclude != '""') {
|
if(settings.keyword_exclude != '""') {
|
||||||
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
||||||
$("table.table > tbody > tr").each(function ()
|
$("table.table > tbody > tr").each(function ()
|
||||||
{
|
{
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
//console.log("html:"+html_text);
|
//console.log("html:"+html_text);
|
||||||
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
|
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ibon_area_main() {
|
function ibon_area_main() {
|
||||||
let reload=false;
|
let reload=false;
|
||||||
let $tr=$("table.table > tbody > tr[onclick]");
|
let $tr=$("table.table > tbody > tr[onclick]");
|
||||||
if($tr.length==0) {
|
if($tr.length==0) {
|
||||||
reload=true;
|
reload=true;
|
||||||
}
|
}
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ibon_area_clean_exclude(settings);
|
ibon_area_clean_exclude(settings);
|
||||||
ibon_area_ready(settings);
|
ibon_area_ready(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
ibon_area_main();
|
ibon_area_main();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,164 +1,164 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
function ibon_detail_ajax_done(game_info)
|
function ibon_detail_ajax_done(game_info)
|
||||||
{
|
{
|
||||||
let date_keyword_array = [];
|
let date_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.date_auto_select.date_keyword.length > 0) {
|
if(settings.date_auto_select.date_keyword.length > 0) {
|
||||||
date_keyword_array = JSON.parse('[' + settings.date_auto_select.date_keyword +']');
|
date_keyword_array = JSON.parse('[' + settings.date_auto_select.date_keyword +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let reload=false;
|
let reload=false;
|
||||||
let target_href = "";
|
let target_href = "";
|
||||||
|
|
||||||
//console.log(game_info.Item);
|
//console.log(game_info.Item);
|
||||||
if(game_info.Item.GIHtmls.length) {
|
if(game_info.Item.GIHtmls.length) {
|
||||||
// one of game able to buy.
|
// one of game able to buy.
|
||||||
let one_can_buy = false;
|
let one_can_buy = false;
|
||||||
|
|
||||||
for (let i = 0; i < game_info.Item.GIHtmls.length; i++) {
|
for (let i = 0; i < game_info.Item.GIHtmls.length; i++) {
|
||||||
let rs = game_info.Item.GIHtmls[i];
|
let rs = game_info.Item.GIHtmls[i];
|
||||||
if(game_info.Item.GIHtmls.length==1) {
|
if(game_info.Item.GIHtmls.length==1) {
|
||||||
// single row.
|
// single row.
|
||||||
if(rs.Href==null) {
|
if(rs.Href==null) {
|
||||||
reload=true;
|
reload=true;
|
||||||
} else {
|
} else {
|
||||||
if(rs.CanBuy==false) {
|
if(rs.CanBuy==false) {
|
||||||
reload=true;
|
reload=true;
|
||||||
} else {
|
} else {
|
||||||
one_can_buy = true;
|
one_can_buy = true;
|
||||||
target_href = rs.Href;
|
target_href = rs.Href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(reload) {
|
if(reload) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// multi rows.
|
// multi rows.
|
||||||
if(settings) {
|
if(settings) {
|
||||||
let is_match_row = false;
|
let is_match_row = false;
|
||||||
if(date_keyword_array.length) {
|
if(date_keyword_array.length) {
|
||||||
for (let j = 0; j < date_keyword_array.length; j++) {
|
for (let j = 0; j < date_keyword_array.length; j++) {
|
||||||
// TOOD: multi item matched, need sort.
|
// TOOD: multi item matched, need sort.
|
||||||
// target_area = get_target_area_with_order(settings, matched_block);
|
// target_area = get_target_area_with_order(settings, matched_block);
|
||||||
|
|
||||||
if(rs.ShowSaleDate.indexOf(date_keyword_array[j])>-1) {
|
if(rs.ShowSaleDate.indexOf(date_keyword_array[j])>-1) {
|
||||||
is_match_row = true;
|
is_match_row = true;
|
||||||
}
|
}
|
||||||
if(rs.GameInfoName.indexOf(date_keyword_array[j])>-1) {
|
if(rs.GameInfoName.indexOf(date_keyword_array[j])>-1) {
|
||||||
is_match_row = true;
|
is_match_row = true;
|
||||||
}
|
}
|
||||||
if(is_match_row) {
|
if(is_match_row) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// empty keyword.
|
// empty keyword.
|
||||||
is_match_row = true;
|
is_match_row = true;
|
||||||
}
|
}
|
||||||
if(is_match_row) {
|
if(is_match_row) {
|
||||||
if(rs.Href!=null) {
|
if(rs.Href!=null) {
|
||||||
if(rs.CanBuy!=false) {
|
if(rs.CanBuy!=false) {
|
||||||
one_can_buy = true;
|
one_can_buy = true;
|
||||||
target_href = rs.Href;
|
target_href = rs.Href;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!reload) {
|
if(!reload) {
|
||||||
if(one_can_buy == false) reload=true;
|
if(one_can_buy == false) reload=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("reload:"+reload);
|
console.log("reload:"+reload);
|
||||||
console.log("target_href:"+target_href);
|
console.log("target_href:"+target_href);
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// goto target event.
|
// goto target event.
|
||||||
//console.log(target_href);
|
//console.log(target_href);
|
||||||
if(target_href.length > 0) {
|
if(target_href.length > 0) {
|
||||||
location.href= "https://ticket.ibon.com.tw/" + target_href;
|
location.href= "https://ticket.ibon.com.tw/" + target_href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ibon_event_status_check()
|
function ibon_event_status_check()
|
||||||
{
|
{
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const event_code = currentUrl.split('/')[5];
|
const event_code = currentUrl.split('/')[5];
|
||||||
//console.log(currentUrl);
|
//console.log(currentUrl);
|
||||||
//console.log(event_code);
|
//console.log(event_code);
|
||||||
if(event_code){
|
if(event_code){
|
||||||
let api_url = "https://ticketapi.ibon.com.tw/api/ActivityInfo/GetGameInfoList";
|
let api_url = "https://ticketapi.ibon.com.tw/api/ActivityInfo/GetGameInfoList";
|
||||||
|
|
||||||
"{\"id\":38042,\"hasDeadline\":true,\"SystemBrowseType\":0}"
|
"{\"id\":38042,\"hasDeadline\":true,\"SystemBrowseType\":0}"
|
||||||
dataJSON = {
|
dataJSON = {
|
||||||
id: parseInt(event_code, 10),
|
id: parseInt(event_code, 10),
|
||||||
hasDeadline: true,
|
hasDeadline: true,
|
||||||
SystemBrowseType: 0
|
SystemBrowseType: 0
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: api_url,
|
url: api_url,
|
||||||
data: JSON.stringify(dataJSON),
|
data: JSON.stringify(dataJSON),
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
xhrFields: {
|
xhrFields: {
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
"x-xsrf-token": getCookie("XSRF-TOKEN")
|
"x-xsrf-token": getCookie("XSRF-TOKEN")
|
||||||
},
|
},
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
success: function(returnData){
|
success: function(returnData){
|
||||||
ibon_detail_ajax_done(returnData);
|
ibon_detail_ajax_done(returnData);
|
||||||
//console.log(returnData);
|
//console.log(returnData);
|
||||||
},
|
},
|
||||||
error: function(xhr, ajaxOptions, thrownError){
|
error: function(xhr, ajaxOptions, thrownError){
|
||||||
//console.log(xhr.status);
|
//console.log(xhr.status);
|
||||||
//console.log(thrownError);
|
//console.log(thrownError);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
console.log("start to ibon detail.");
|
console.log("start to ibon detail.");
|
||||||
//console.log(document.cookie);
|
//console.log(document.cookie);
|
||||||
//console.log(getCookie("XSRF-TOKEN"));
|
//console.log(getCookie("XSRF-TOKEN"));
|
||||||
ibon_event_status_check();
|
ibon_event_status_check();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,177 +1,177 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
||||||
function ibon_assign_ticket_number(ticket_number)
|
function ibon_assign_ticket_number(ticket_number)
|
||||||
{
|
{
|
||||||
let $main_table = $("table.table");
|
let $main_table = $("table.table");
|
||||||
if ($main_table.length > 0)
|
if ($main_table.length > 0)
|
||||||
{
|
{
|
||||||
console.log("found main table");
|
console.log("found main table");
|
||||||
let $ticket_options = $main_table.find("select:first option");
|
let $ticket_options = $main_table.find("select:first option");
|
||||||
if ($ticket_options.length)
|
if ($ticket_options.length)
|
||||||
{
|
{
|
||||||
let is_ticket_number_assign = false;
|
let is_ticket_number_assign = false;
|
||||||
if (ticket_number > 0)
|
if (ticket_number > 0)
|
||||||
{
|
{
|
||||||
console.log("target ticket_number:"+ticket_number);
|
console.log("target ticket_number:"+ticket_number);
|
||||||
$ticket_options.each(function ()
|
$ticket_options.each(function ()
|
||||||
{
|
{
|
||||||
if ($(this).val() == ticket_number)
|
if ($(this).val() == ticket_number)
|
||||||
{
|
{
|
||||||
$(this).prop('selected', true);
|
$(this).prop('selected', true);
|
||||||
is_ticket_number_assign = true;
|
is_ticket_number_assign = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log("is_ticket_number_assign:"+is_ticket_number_assign);
|
console.log("is_ticket_number_assign:"+is_ticket_number_assign);
|
||||||
if (!is_ticket_number_assign)
|
if (!is_ticket_number_assign)
|
||||||
{
|
{
|
||||||
$ticket_options.last().prop('selected', true);
|
$ticket_options.last().prop('selected', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ibon_assign_adjacent_seat(flag) {
|
function ibon_assign_adjacent_seat(flag) {
|
||||||
//console.log("disable_adjacent_seat flag:"+flag);
|
//console.log("disable_adjacent_seat flag:"+flag);
|
||||||
if(flag) {
|
if(flag) {
|
||||||
$('input[type=checkbox]').each(function() {
|
$('input[type=checkbox]').each(function() {
|
||||||
$(this).prop('checked', true);
|
$(this).prop('checked', true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ibon_focus_on_captcha()
|
function ibon_focus_on_captcha()
|
||||||
{
|
{
|
||||||
$("div.editor-box > div > input[type='text']").focus();
|
$("div.editor-box > div > input[type='text']").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
var myInterval = null;
|
var myInterval = null;
|
||||||
|
|
||||||
function ibon_get_ocr_image()
|
function ibon_get_ocr_image()
|
||||||
{
|
{
|
||||||
//console.log("get_ocr_image");
|
//console.log("get_ocr_image");
|
||||||
let image_data = "";
|
let image_data = "";
|
||||||
|
|
||||||
// PS: tixcraft have different domain to use the same content script.
|
// PS: tixcraft have different domain to use the same content script.
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const domain = currentUrl.split('/')[2];
|
const domain = currentUrl.split('/')[2];
|
||||||
|
|
||||||
let image_id = 'chk_pic';
|
let image_id = 'chk_pic';
|
||||||
let img = document.getElementById(image_id);
|
let img = document.getElementById(image_id);
|
||||||
if(img!=null) {
|
if(img!=null) {
|
||||||
let canvas = document.createElement('canvas');
|
let canvas = document.createElement('canvas');
|
||||||
let context = canvas.getContext('2d');
|
let context = canvas.getContext('2d');
|
||||||
canvas.height = img.naturalHeight;
|
canvas.height = img.naturalHeight;
|
||||||
canvas.width = img.naturalWidth;
|
canvas.width = img.naturalWidth;
|
||||||
context.drawImage(img, 0, 0);
|
context.drawImage(img, 0, 0);
|
||||||
let img_data = canvas.toDataURL();
|
let img_data = canvas.toDataURL();
|
||||||
if(img_data) {
|
if(img_data) {
|
||||||
image_data = img_data.split(",")[1];
|
image_data = img_data.split(",")[1];
|
||||||
//console.log(image_data);
|
//console.log(image_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image_data;
|
return image_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener((message) => {
|
chrome.runtime.onMessage.addListener((message) => {
|
||||||
//console.log('sent from background', message);
|
//console.log('sent from background', message);
|
||||||
ibon_set_ocr_answer(message.answer);
|
ibon_set_ocr_answer(message.answer);
|
||||||
});
|
});
|
||||||
|
|
||||||
function ibon_set_ocr_answer(answer)
|
function ibon_set_ocr_answer(answer)
|
||||||
{
|
{
|
||||||
console.log("answer:"+answer);
|
console.log("answer:"+answer);
|
||||||
if(answer.length > 0) {
|
if(answer.length > 0) {
|
||||||
$("div.editor-box > div > input[type='text']").val(answer);
|
$("div.editor-box > div > input[type='text']").val(answer);
|
||||||
//console.log($("div#ticket-wrap a[onclick]").length);
|
//console.log($("div#ticket-wrap a[onclick]").length);
|
||||||
//$("div#ticket-wrap a[onclick]").click();
|
//$("div#ticket-wrap a[onclick]").click();
|
||||||
//$("#aspnetForm").submit();
|
//$("#aspnetForm").submit();
|
||||||
let done_div="<div style='display:none' id='done'></div>";
|
let done_div="<div style='display:none' id='done'></div>";
|
||||||
$("body").append(done_div);
|
$("body").append(done_div);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ibon_get_ocr_answer(api_url, image_data)
|
async function ibon_get_ocr_answer(api_url, image_data)
|
||||||
{
|
{
|
||||||
let bundle = {
|
let bundle = {
|
||||||
action: 'ocr',
|
action: 'ocr',
|
||||||
data: {
|
data: {
|
||||||
'url': api_url + 'ocr',
|
'url': api_url + 'ocr',
|
||||||
'image_data':image_data,
|
'image_data':image_data,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let bundle_string = JSON.stringify(bundle);
|
let bundle_string = JSON.stringify(bundle);
|
||||||
const return_answer = await chrome.runtime.sendMessage(bundle);
|
const return_answer = await chrome.runtime.sendMessage(bundle);
|
||||||
//console.log(return_answer);
|
//console.log(return_answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ibon_orc_image_ready(api_url)
|
function ibon_orc_image_ready(api_url)
|
||||||
{
|
{
|
||||||
let ret=false;
|
let ret=false;
|
||||||
let image_data = ibon_get_ocr_image();
|
let image_data = ibon_get_ocr_image();
|
||||||
if(image_data.length>0) {
|
if(image_data.length>0) {
|
||||||
ret=true;
|
ret=true;
|
||||||
if(myInterval) clearInterval(myInterval);
|
if(myInterval) clearInterval(myInterval);
|
||||||
ibon_get_ocr_answer(api_url, image_data);
|
ibon_get_ocr_answer(api_url, image_data);
|
||||||
}
|
}
|
||||||
//console.log("ibon_orc_image_ready:"+ret);
|
//console.log("ibon_orc_image_ready:"+ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
} else {
|
} else {
|
||||||
console.log('no settings found');
|
console.log('no settings found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
//console.log("ticket_number:"+ settings.ticket_number);
|
//console.log("ticket_number:"+ settings.ticket_number);
|
||||||
ibon_assign_ticket_number(settings.ticket_number);
|
ibon_assign_ticket_number(settings.ticket_number);
|
||||||
ibon_assign_adjacent_seat(settings.advanced.disable_adjacent_seat);
|
ibon_assign_adjacent_seat(settings.advanced.disable_adjacent_seat);
|
||||||
|
|
||||||
// ocr
|
// ocr
|
||||||
if(settings.ocr_captcha.enable) {
|
if(settings.ocr_captcha.enable) {
|
||||||
let remote_url_string = "";
|
let remote_url_string = "";
|
||||||
let remote_url_array = [];
|
let remote_url_array = [];
|
||||||
if(settings.advanced.remote_url.length > 0) {
|
if(settings.advanced.remote_url.length > 0) {
|
||||||
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
|
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
|
||||||
}
|
}
|
||||||
if(remote_url_array.length) {
|
if(remote_url_array.length) {
|
||||||
remote_url_string = remote_url_array[0];
|
remote_url_string = remote_url_array[0];
|
||||||
}
|
}
|
||||||
if(!ibon_orc_image_ready(remote_url_string)) {
|
if(!ibon_orc_image_ready(remote_url_string)) {
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
ibon_orc_image_ready(remote_url_string);
|
ibon_orc_image_ready(remote_url_string);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// no orc, just focus;
|
// no orc, just focus;
|
||||||
ibon_focus_on_captcha();
|
ibon_focus_on_captcha();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,105 +1,105 @@
|
||||||
var myInterval = null;
|
var myInterval = null;
|
||||||
//console.log("assign appear");
|
//console.log("assign appear");
|
||||||
|
|
||||||
function kktix_area_keyword(settings, register_info)
|
function kktix_area_keyword(settings, register_info)
|
||||||
{
|
{
|
||||||
let area_keyword_array = [];
|
let area_keyword_array = [];
|
||||||
if(settings.area_auto_select.area_keyword.length > 0) {
|
if(settings.area_auto_select.area_keyword.length > 0) {
|
||||||
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
||||||
}
|
}
|
||||||
// console.log(area_keyword_array);
|
// console.log(area_keyword_array);
|
||||||
let target_area = [];
|
let target_area = [];
|
||||||
if(area_keyword_array.length) {
|
if(area_keyword_array.length) {
|
||||||
for (let i = 0; i < area_keyword_array.length; i++) {
|
for (let i = 0; i < area_keyword_array.length; i++) {
|
||||||
let matched_block=[];
|
let matched_block=[];
|
||||||
|
|
||||||
$("div.ticket-unit").each(function ()
|
$("div.ticket-unit").each(function ()
|
||||||
{
|
{
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
||||||
matched_block.push($(this));
|
matched_block.push($(this));
|
||||||
}
|
}
|
||||||
target_area = get_target_area_with_order(settings, matched_block);
|
target_area = get_target_area_with_order(settings, matched_block);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (matched_block.length) {
|
if (matched_block.length) {
|
||||||
console.log("match keyword:" + area_keyword_array[i]);
|
console.log("match keyword:" + area_keyword_array[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let query_string = "div.ticket-unit";
|
let query_string = "div.ticket-unit";
|
||||||
let matched_block=$(query_string);
|
let matched_block=$(query_string);
|
||||||
target_area = get_target_area_with_order(settings, matched_block);
|
target_area = get_target_area_with_order(settings, matched_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_area.length) {
|
if (target_area.length) {
|
||||||
let first_node = target_area.find(":first-child");
|
let first_node = target_area.find(":first-child");
|
||||||
let link_id = first_node.attr("id");
|
let link_id = first_node.attr("id");
|
||||||
//console.log("link_id: " + link_id);
|
//console.log("link_id: " + link_id);
|
||||||
if(link_id) {
|
if(link_id) {
|
||||||
$('input[type=checkbox]').each(function() {
|
$('input[type=checkbox]').each(function() {
|
||||||
//$(this).prop('checked', true);
|
//$(this).prop('checked', true);
|
||||||
if(!$(this).is(':checked')) {
|
if(!$(this).is(':checked')) {
|
||||||
$(this).click();
|
$(this).click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let seat_inventory_key=link_id.split("_")[1];
|
let seat_inventory_key=link_id.split("_")[1];
|
||||||
let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key];
|
let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key];
|
||||||
let ticket_number = settings.ticket_number;
|
let ticket_number = settings.ticket_number;
|
||||||
if(seat_inventory_number<ticket_number) {
|
if(seat_inventory_number<ticket_number) {
|
||||||
ticket_number=seat_inventory_number;
|
ticket_number=seat_inventory_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ticket_number>0) {
|
if(ticket_number>0) {
|
||||||
/*
|
/*
|
||||||
let target_input = target_area.find("input");
|
let target_input = target_area.find("input");
|
||||||
target_input.click();
|
target_input.click();
|
||||||
target_input.prop("value", ticket_number);
|
target_input.prop("value", ticket_number);
|
||||||
let down = $.Event('keydown');
|
let down = $.Event('keydown');
|
||||||
down.key=""+ticket_number;
|
down.key=""+ticket_number;
|
||||||
target_input.trigger(down);
|
target_input.trigger(down);
|
||||||
|
|
||||||
let up = $.Event('keyup');
|
let up = $.Event('keyup');
|
||||||
up.key=""+ticket_number;
|
up.key=""+ticket_number;
|
||||||
target_input.trigger(up);
|
target_input.trigger(up);
|
||||||
*/
|
*/
|
||||||
let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]');
|
let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]');
|
||||||
for(let i=0; i<ticket_number; i++) {
|
for(let i=0; i<ticket_number; i++) {
|
||||||
add_button.click();
|
add_button.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
let $next_btn = $('div.register-new-next-button-area > button');
|
let $next_btn = $('div.register-new-next-button-area > button');
|
||||||
$next_btn.click();
|
$next_btn.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("not target_area found.")
|
console.log("not target_area found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
console.log("begin to next");
|
console.log("begin to next");
|
||||||
$("div#ticket-wrap a[onclick]").click();
|
$("div#ticket-wrap a[onclick]").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function dom_ready()
|
function dom_ready()
|
||||||
{
|
{
|
||||||
let ret=false;
|
let ret=false;
|
||||||
if($("#done").length>0) {
|
if($("#done").length>0) {
|
||||||
$("#done").remove();
|
$("#done").remove();
|
||||||
ret=true;
|
ret=true;
|
||||||
if(myInterval) clearInterval(myInterval);
|
if(myInterval) clearInterval(myInterval);
|
||||||
begin();
|
begin();
|
||||||
}
|
}
|
||||||
console.log("dom_ready:"+ret);
|
console.log("dom_ready:"+ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dom_ready()) {
|
if(!dom_ready()) {
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
dom_ready();
|
dom_ready();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
// price row.
|
// price row.
|
||||||
$("#salesTable > tbody > tr.Soldout").remove();
|
$("#salesTable > tbody > tr.Soldout").remove();
|
||||||
$("div.footer").remove();
|
$("div.footer").remove();
|
|
@ -1,7 +1,7 @@
|
||||||
$("div#DIV_REMARK").remove();
|
$("div#DIV_REMARK").remove();
|
||||||
$("div.footer").remove();
|
$("div.footer").remove();
|
||||||
|
|
||||||
$a_btn=$("#content").find("table.eventTABLE > tbody > tr > td > a > button[onclick]");
|
$a_btn=$("#content").find("table.eventTABLE > tbody > tr > td > a > button[onclick]");
|
||||||
if($a_btn.length==1) {
|
if($a_btn.length==1) {
|
||||||
$a_btn.click();
|
$a_btn.click();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
$a_btn=$("#content").find("p > a > button[onclick]");
|
$a_btn=$("#content").find("p > a > button[onclick]");
|
||||||
if($a_btn.length>0) {
|
if($a_btn.length>0) {
|
||||||
$click_event=$a_btn.attr("onclick");
|
$click_event=$a_btn.attr("onclick");
|
||||||
$a_btn.click();
|
$a_btn.click();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
$("div#dialog-message").remove();
|
$("div#dialog-message").remove();
|
||||||
$("div#ad3").remove();
|
$("div#ad3").remove();
|
||||||
$("div#buyTicket").remove();
|
$("div#buyTicket").remove();
|
||||||
$("div#marquee").remove();
|
$("div#marquee").remove();
|
||||||
$("div.footer").remove();
|
$("div.footer").remove();
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
|
|
||||||
$("div.description").remove();
|
$("div.description").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
||||||
function kktix_event_redirect()
|
function kktix_event_redirect()
|
||||||
{
|
{
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const event_code = currentUrl.split('/')[4];
|
const event_code = currentUrl.split('/')[4];
|
||||||
//console.log(currentUrl);
|
//console.log(currentUrl);
|
||||||
//console.log(event_code);
|
//console.log(event_code);
|
||||||
if(event_code){
|
if(event_code){
|
||||||
let button_count = $("div.tickets > a.btn-point").length;
|
let button_count = $("div.tickets > a.btn-point").length;
|
||||||
console.log("length:"+button_count);
|
console.log("length:"+button_count);
|
||||||
if (button_count == 1) {
|
if (button_count == 1) {
|
||||||
let new_url = "https://kktix.com/events/"+ event_code +"/registrations/new";
|
let new_url = "https://kktix.com/events/"+ event_code +"/registrations/new";
|
||||||
location.href=new_url;
|
location.href=new_url;
|
||||||
} else {
|
} else {
|
||||||
// do nothing.
|
// do nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
kktix_event_redirect();
|
kktix_event_redirect();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
$("div.headlines").remove();
|
$("div.headlines").remove();
|
||||||
$("section.app-intro").remove();
|
$("section.app-intro").remove();
|
||||||
$("section.copywriting").remove();
|
$("section.copywriting").remove();
|
||||||
$("section.partner-venues").remove();
|
$("section.partner-venues").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
|
@ -1,112 +1,112 @@
|
||||||
var myInterval = null;
|
var myInterval = null;
|
||||||
//console.log("assign appear");
|
//console.log("assign appear");
|
||||||
|
|
||||||
function kktix_area_keyword(settings, register_info)
|
function kktix_area_keyword(settings, register_info)
|
||||||
{
|
{
|
||||||
let area_keyword_array = [];
|
let area_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.area_auto_select.area_keyword.length > 0) {
|
if(settings.area_auto_select.area_keyword.length > 0) {
|
||||||
if(settings.area_auto_select.area_keyword!='""') {
|
if(settings.area_auto_select.area_keyword!='""') {
|
||||||
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log(area_keyword_array);
|
// console.log(area_keyword_array);
|
||||||
let target_area = [];
|
let target_area = [];
|
||||||
if(area_keyword_array.length) {
|
if(area_keyword_array.length) {
|
||||||
for (let i = 0; i < area_keyword_array.length; i++) {
|
for (let i = 0; i < area_keyword_array.length; i++) {
|
||||||
let matched_block=[];
|
let matched_block=[];
|
||||||
|
|
||||||
$("div.ticket-unit").each(function ()
|
$("div.ticket-unit").each(function ()
|
||||||
{
|
{
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
||||||
matched_block.push($(this));
|
matched_block.push($(this));
|
||||||
}
|
}
|
||||||
target_area = get_target_area_with_order(settings, matched_block);
|
target_area = get_target_area_with_order(settings, matched_block);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (matched_block.length) {
|
if (matched_block.length) {
|
||||||
console.log("match keyword:" + area_keyword_array[i]);
|
console.log("match keyword:" + area_keyword_array[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let query_string = "div.ticket-unit";
|
let query_string = "div.ticket-unit";
|
||||||
let matched_block=$(query_string);
|
let matched_block=$(query_string);
|
||||||
target_area = get_target_area_with_order(settings, matched_block);
|
target_area = get_target_area_with_order(settings, matched_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_area.length) {
|
if (target_area.length) {
|
||||||
let first_node = target_area.find(":first-child");
|
let first_node = target_area.find(":first-child");
|
||||||
let link_id = first_node.attr("id");
|
let link_id = first_node.attr("id");
|
||||||
//console.log("link_id: " + link_id);
|
//console.log("link_id: " + link_id);
|
||||||
if(link_id) {
|
if(link_id) {
|
||||||
$('input[type=checkbox]').each(function() {
|
$('input[type=checkbox]').each(function() {
|
||||||
//$(this).prop('checked', true);
|
//$(this).prop('checked', true);
|
||||||
if(!$(this).is(':checked')) {
|
if(!$(this).is(':checked')) {
|
||||||
$(this).click();
|
$(this).click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let seat_inventory_key=link_id.split("_")[1];
|
let seat_inventory_key=link_id.split("_")[1];
|
||||||
let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key];
|
let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key];
|
||||||
let ticket_number = settings.ticket_number;
|
let ticket_number = settings.ticket_number;
|
||||||
if(seat_inventory_number<ticket_number) {
|
if(seat_inventory_number<ticket_number) {
|
||||||
ticket_number=seat_inventory_number;
|
ticket_number=seat_inventory_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ticket_number>0) {
|
if(ticket_number>0) {
|
||||||
/*
|
/*
|
||||||
let target_input = target_area.find("input");
|
let target_input = target_area.find("input");
|
||||||
target_input.click();
|
target_input.click();
|
||||||
target_input.prop("value", ticket_number);
|
target_input.prop("value", ticket_number);
|
||||||
let down = $.Event('keydown');
|
let down = $.Event('keydown');
|
||||||
down.key=""+ticket_number;
|
down.key=""+ticket_number;
|
||||||
target_input.trigger(down);
|
target_input.trigger(down);
|
||||||
|
|
||||||
let up = $.Event('keyup');
|
let up = $.Event('keyup');
|
||||||
up.key=""+ticket_number;
|
up.key=""+ticket_number;
|
||||||
target_input.trigger(up);
|
target_input.trigger(up);
|
||||||
*/
|
*/
|
||||||
let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]');
|
let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]');
|
||||||
for(let i=0; i<ticket_number; i++) {
|
for(let i=0; i<ticket_number; i++) {
|
||||||
add_button.click();
|
add_button.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
let $next_btn = $('div.register-new-next-button-area > button');
|
let $next_btn = $('div.register-new-next-button-area > button');
|
||||||
$next_btn.click();
|
$next_btn.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("not target_area found.")
|
console.log("not target_area found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
let settings = JSON.parse($("#settings").html());
|
let settings = JSON.parse($("#settings").html());
|
||||||
let register_info = JSON.parse($("#register_info").html());
|
let register_info = JSON.parse($("#register_info").html());
|
||||||
//console.log(settings);
|
//console.log(settings);
|
||||||
//console.log(register_info);
|
//console.log(register_info);
|
||||||
kktix_area_keyword(settings, register_info);
|
kktix_area_keyword(settings, register_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dom_ready()
|
function dom_ready()
|
||||||
{
|
{
|
||||||
let ret=false;
|
let ret=false;
|
||||||
//console.log("checking...");
|
//console.log("checking...");
|
||||||
if($("#settings").length>0) {
|
if($("#settings").length>0) {
|
||||||
ret=true;
|
ret=true;
|
||||||
if(myInterval) clearInterval(myInterval);
|
if(myInterval) clearInterval(myInterval);
|
||||||
begin();
|
begin();
|
||||||
}
|
}
|
||||||
console.log("dom_ready:"+ret);
|
console.log("dom_ready:"+ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dom_ready()) {
|
if(!dom_ready()) {
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
dom_ready();
|
dom_ready();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,143 +1,143 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
var myInterval = null;
|
var myInterval = null;
|
||||||
|
|
||||||
function kktix_clean_exclude(settings, register_info)
|
function kktix_clean_exclude(settings, register_info)
|
||||||
{
|
{
|
||||||
let exclude_keyword_array = [];
|
let exclude_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.keyword_exclude.length > 0) {
|
if(settings.keyword_exclude.length > 0) {
|
||||||
if(settings.keyword_exclude != '""') {
|
if(settings.keyword_exclude != '""') {
|
||||||
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
||||||
$("div.ticket-unit").each(function ()
|
$("div.ticket-unit").each(function ()
|
||||||
{
|
{
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
let is_match_keyword=false;
|
let is_match_keyword=false;
|
||||||
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
|
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
|
||||||
is_match_keyword=true;
|
is_match_keyword=true;
|
||||||
}
|
}
|
||||||
if(is_match_keyword) {
|
if(is_match_keyword) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clean_sold_out_row(register_info)
|
function clean_sold_out_row(register_info)
|
||||||
{
|
{
|
||||||
//console.log("clean_sold_out_row");
|
//console.log("clean_sold_out_row");
|
||||||
|
|
||||||
let match_target = false;
|
let match_target = false;
|
||||||
for (var key in register_info.inventory.ticketInventory) {
|
for (var key in register_info.inventory.ticketInventory) {
|
||||||
if(register_info.inventory.ticketInventory[key]) {
|
if(register_info.inventory.ticketInventory[key]) {
|
||||||
//console.log("key:"+key);
|
//console.log("key:"+key);
|
||||||
if($("#ticket_"+key).length) {
|
if($("#ticket_"+key).length) {
|
||||||
match_target = true;
|
match_target = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("match_target:"+match_target);
|
//console.log("match_target:"+match_target);
|
||||||
if(match_target) {
|
if(match_target) {
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
$("div.banner-wrapper").remove();
|
$("div.banner-wrapper").remove();
|
||||||
$("div.ticket-img-wrapper").remove();
|
$("div.ticket-img-wrapper").remove();
|
||||||
|
|
||||||
$("span.ticket-quantity[ng-if=\"!purchasableAndSelectable\"]").each(function ()
|
$("span.ticket-quantity[ng-if=\"!purchasableAndSelectable\"]").each(function ()
|
||||||
{
|
{
|
||||||
$(this).parent().parent().parent().remove();
|
$(this).parent().parent().parent().remove();
|
||||||
});
|
});
|
||||||
clearInterval(myInterval);
|
clearInterval(myInterval);
|
||||||
|
|
||||||
if(settings) {
|
if(settings) {
|
||||||
let settings_div="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
let settings_div="<div style='display:none' id='settings'>" + JSON.stringify(settings) + "</div>";
|
||||||
$("body").append(settings_div);
|
$("body").append(settings_div);
|
||||||
let register_info_div="<div style='display:none' id='register_info'>" + JSON.stringify(register_info) + "</div>";
|
let register_info_div="<div style='display:none' id='register_info'>" + JSON.stringify(register_info) + "</div>";
|
||||||
$("body").append(register_info_div);
|
$("body").append(register_info_div);
|
||||||
kktix_clean_exclude(settings, register_info);
|
kktix_clean_exclude(settings, register_info);
|
||||||
//kktix_area_keyword(settings, register_info);
|
//kktix_area_keyword(settings, register_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function kktix_ajax_done(register_info)
|
function kktix_ajax_done(register_info)
|
||||||
{
|
{
|
||||||
let reload=false;
|
let reload=false;
|
||||||
console.log(register_info.inventory.registerStatus);
|
console.log(register_info.inventory.registerStatus);
|
||||||
// IN_STOCK
|
// IN_STOCK
|
||||||
if(register_info.inventory.registerStatus=='OUT_OF_STOCK') {reload=true;}
|
if(register_info.inventory.registerStatus=='OUT_OF_STOCK') {reload=true;}
|
||||||
if(register_info.inventory.registerStatus=='COMING_SOON') {reload=true;}
|
if(register_info.inventory.registerStatus=='COMING_SOON') {reload=true;}
|
||||||
if(register_info.inventory.registerStatus=='SOLD_OUT') {reload=true;}
|
if(register_info.inventory.registerStatus=='SOLD_OUT') {reload=true;}
|
||||||
//console.log(reload);
|
//console.log(reload);
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(function() {
|
$(function() {
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
clean_sold_out_row(register_info);
|
clean_sold_out_row(register_info);
|
||||||
}, 200);
|
}, 200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function kktix_event_status_check()
|
function kktix_event_status_check()
|
||||||
{
|
{
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const event_code = currentUrl.split('/')[4];
|
const event_code = currentUrl.split('/')[4];
|
||||||
//console.log(currentUrl);
|
//console.log(currentUrl);
|
||||||
//console.log(event_code);
|
//console.log(event_code);
|
||||||
if(event_code){
|
if(event_code){
|
||||||
let api_url = "https://kktix.com/g/events/"+ event_code +"/register_info";
|
let api_url = "https://kktix.com/g/events/"+ event_code +"/register_info";
|
||||||
$.get( api_url, function() {
|
$.get( api_url, function() {
|
||||||
//alert( "success" );
|
//alert( "success" );
|
||||||
})
|
})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
//alert( "second success" );
|
//alert( "second success" );
|
||||||
kktix_ajax_done(data);
|
kktix_ajax_done(data);
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
//alert( "error" );
|
//alert( "error" );
|
||||||
})
|
})
|
||||||
.always(function() {
|
.always(function() {
|
||||||
//alert( "finished" );
|
//alert( "finished" );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
kktix_event_status_check();
|
kktix_event_status_check();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// price row.
|
// price row.
|
||||||
$("ul.area-list > span > li:not(:has(a))").remove();
|
$("ul.area-list > span > li:not(:has(a))").remove();
|
||||||
// description row.
|
// description row.
|
||||||
$("ul.area-list > li:not(:has(a))").remove();
|
$("ul.area-list > li:not(:has(a))").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
|
@ -1,4 +1,4 @@
|
||||||
$a_btn=$("#portfolio").find("div.description > table.table > tbody > tr > td > button[onclick]");
|
$a_btn=$("#portfolio").find("div.description > table.table > tbody > tr > td > button[onclick]");
|
||||||
if($a_btn.length==1) {
|
if($a_btn.length==1) {
|
||||||
$a_btn.click();
|
$a_btn.click();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
$a_btn=$("#portfolio").find("a[onclick]");
|
$a_btn=$("#portfolio").find("a[onclick]");
|
||||||
if($a_btn.length>0) {
|
if($a_btn.length>0) {
|
||||||
$click_event=$a_btn.attr("onclick");
|
$click_event=$a_btn.attr("onclick");
|
||||||
$a_btn.click();
|
$a_btn.click();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
$("#footer").remove();
|
$("#footer").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
var settings = null;
|
var settings = null;
|
||||||
var maxbot_status = null;
|
var maxbot_status = null;
|
||||||
|
|
||||||
async function ajax_return_done(data, event_id)
|
async function ajax_return_done(data, event_id)
|
||||||
{
|
{
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(data.sessions.length==1) {
|
if(data.sessions.length==1) {
|
||||||
let session_id=data.sessions[0].sessionId;
|
let session_id=data.sessions[0].sessionId;
|
||||||
if(session_id) {
|
if(session_id) {
|
||||||
let new_url = "https://ticketplus.com.tw/order/"+ event_id +"/" + session_id;
|
let new_url = "https://ticketplus.com.tw/order/"+ event_id +"/" + session_id;
|
||||||
location.href = new_url;
|
location.href = new_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function wait_function_ready() {
|
async function wait_function_ready() {
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const event_id = currentUrl.split('/')[4];
|
const event_id = currentUrl.split('/')[4];
|
||||||
if(event_id){
|
if(event_id){
|
||||||
let api_url = "https://apis.ticketplus.com.tw/config/api/v1/getS3?path=event/"+event_id+"/sessions.json";
|
let api_url = "https://apis.ticketplus.com.tw/config/api/v1/getS3?path=event/"+event_id+"/sessions.json";
|
||||||
//console.log("calling api:" + api_url);
|
//console.log("calling api:" + api_url);
|
||||||
$.get( api_url, function() {
|
$.get( api_url, function() {
|
||||||
//alert( "success" );
|
//alert( "success" );
|
||||||
})
|
})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
//alert( "second success" );
|
//alert( "second success" );
|
||||||
ajax_return_done(data, event_id);
|
ajax_return_done(data, event_id);
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
//alert( "error" );
|
//alert( "error" );
|
||||||
})
|
})
|
||||||
.always(function() {
|
.always(function() {
|
||||||
//alert( "finished" );
|
//alert( "finished" );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.storage.local.get('settings', function (items)
|
chrome.storage.local.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.storage.local.get('status', function (items)
|
chrome.storage.local.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status)
|
if (items.status)
|
||||||
{
|
{
|
||||||
maxbot_status = items.status;
|
maxbot_status = items.status;
|
||||||
//console.log("maxbot_status:" + maxbot_status)
|
//console.log("maxbot_status:" + maxbot_status)
|
||||||
if(maxbot_status =='ON') wait_function_ready();
|
if(maxbot_status =='ON') wait_function_ready();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,147 +1,147 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
var settings = null;
|
var settings = null;
|
||||||
var maxbot_status = null;
|
var maxbot_status = null;
|
||||||
|
|
||||||
var retry_count =0;
|
var retry_count =0;
|
||||||
|
|
||||||
function get_event_status_entry(real_event_id, real_session_id) {
|
function get_event_status_entry(real_event_id, real_session_id) {
|
||||||
//console.log("start to get_event_status");
|
//console.log("start to get_event_status");
|
||||||
|
|
||||||
if (maxbot_status =='ON')
|
if (maxbot_status =='ON')
|
||||||
{
|
{
|
||||||
get_event_status_core(real_event_id, real_session_id);
|
get_event_status_core(real_event_id, real_session_id);
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajax_return_done(data, real_event_id, real_session_id) {
|
function ajax_return_done(data, real_event_id, real_session_id) {
|
||||||
//console.log("ajax return done")
|
//console.log("ajax return done")
|
||||||
let reload=false;
|
let reload=false;
|
||||||
|
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
//console.log("auto_reload_page_interval:"+auto_reload_page_interval);
|
//console.log("auto_reload_page_interval:"+auto_reload_page_interval);
|
||||||
|
|
||||||
if(data.result.session[0].status=="pending" || data.result.session[0].status=="soldout" || data.result.session[0].status=="unavailable") {
|
if(data.result.session[0].status=="pending" || data.result.session[0].status=="soldout" || data.result.session[0].status=="unavailable") {
|
||||||
reload=true;
|
reload=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("is_match_reload_status:"+is_match_reload_status);
|
//console.log("is_match_reload_status:"+is_match_reload_status);
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.result.session[0].status=="onsale") {
|
if(data.result.session[0].status=="onsale") {
|
||||||
//console.log("bingo ^_^, onsale")
|
//console.log("bingo ^_^, onsale")
|
||||||
//$(function() {
|
//$(function() {
|
||||||
// console.log("hello ^_^, onsale");
|
// console.log("hello ^_^, onsale");
|
||||||
//let $captcha = $("input[required='required']");
|
//let $captcha = $("input[required='required']");
|
||||||
//console.log($captcha.length);
|
//console.log($captcha.length);
|
||||||
//});
|
//});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_event_status_core(real_event_id, real_session_id) {
|
function get_event_status_core(real_event_id, real_session_id) {
|
||||||
let timestamp = new Date().getTime();
|
let timestamp = new Date().getTime();
|
||||||
timestamp = (timestamp/1000).toFixed()*1000;
|
timestamp = (timestamp/1000).toFixed()*1000;
|
||||||
//console.log(timestamp);
|
//console.log(timestamp);
|
||||||
|
|
||||||
let api_url = "https://apis.ticketplus.com.tw/config/api/v1/get?eventId="+ real_event_id +"&sessionId="+real_session_id+"&_="+timestamp;
|
let api_url = "https://apis.ticketplus.com.tw/config/api/v1/get?eventId="+ real_event_id +"&sessionId="+real_session_id+"&_="+timestamp;
|
||||||
//console.log("calling api:" + api_url);
|
//console.log("calling api:" + api_url);
|
||||||
$.get( api_url, function() {
|
$.get( api_url, function() {
|
||||||
//alert( "success" );
|
//alert( "success" );
|
||||||
})
|
})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
//alert( "second success" );
|
//alert( "second success" );
|
||||||
ajax_return_done(data, real_event_id, real_session_id);
|
ajax_return_done(data, real_event_id, real_session_id);
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
//alert( "error" );
|
//alert( "error" );
|
||||||
})
|
})
|
||||||
.always(function() {
|
.always(function() {
|
||||||
//alert( "finished" );
|
//alert( "finished" );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function decrypt_text(event_id, session_id) {
|
async function decrypt_text(event_id, session_id) {
|
||||||
//console.log("start to decrypt_text");
|
//console.log("start to decrypt_text");
|
||||||
const KEY = 'ILOVEFETIXFETIX!';
|
const KEY = 'ILOVEFETIXFETIX!';
|
||||||
const IV = '!@#$FETIXEVENTiv';
|
const IV = '!@#$FETIXEVENTiv';
|
||||||
|
|
||||||
let bundle = {
|
let bundle = {
|
||||||
action: 'decrypt',
|
action: 'decrypt',
|
||||||
data: {
|
data: {
|
||||||
'KEY':KEY,
|
'KEY':KEY,
|
||||||
'IV':IV,
|
'IV':IV,
|
||||||
'text': event_id
|
'text': event_id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let bundle_string = JSON.stringify(bundle);
|
let bundle_string = JSON.stringify(bundle);
|
||||||
const event_answer = await chrome.runtime.sendMessage(bundle);
|
const event_answer = await chrome.runtime.sendMessage(bundle);
|
||||||
//console.log(event_answer);
|
//console.log(event_answer);
|
||||||
const real_event_id = event_answer.answer;
|
const real_event_id = event_answer.answer;
|
||||||
//console.log(real_event_id);
|
//console.log(real_event_id);
|
||||||
|
|
||||||
bundle = {
|
bundle = {
|
||||||
action: 'decrypt',
|
action: 'decrypt',
|
||||||
data: {
|
data: {
|
||||||
'KEY':KEY,
|
'KEY':KEY,
|
||||||
'IV':IV,
|
'IV':IV,
|
||||||
'text': session_id
|
'text': session_id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let session_answer = await chrome.runtime.sendMessage(bundle);
|
let session_answer = await chrome.runtime.sendMessage(bundle);
|
||||||
let real_session_id = session_answer.answer;
|
let real_session_id = session_answer.answer;
|
||||||
//console.log(real_session_id);
|
//console.log(real_session_id);
|
||||||
get_event_status_entry(real_event_id, real_session_id);
|
get_event_status_entry(real_event_id, real_session_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function wait_function_ready() {
|
async function wait_function_ready() {
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const event_id = currentUrl.split('/')[4];
|
const event_id = currentUrl.split('/')[4];
|
||||||
const session_id = currentUrl.split('/')[5];
|
const session_id = currentUrl.split('/')[5];
|
||||||
//console.log(event_id);
|
//console.log(event_id);
|
||||||
//console.log(session_id);
|
//console.log(session_id);
|
||||||
if(event_id && session_id){
|
if(event_id && session_id){
|
||||||
decrypt_text(event_id, session_id)
|
decrypt_text(event_id, session_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.storage.local.get('settings', function (items)
|
chrome.storage.local.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.storage.local.get('status', function (items)
|
chrome.storage.local.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status)
|
if (items.status)
|
||||||
{
|
{
|
||||||
maxbot_status = items.status;
|
maxbot_status = items.status;
|
||||||
//console.log("maxbot_status:" + maxbot_status)
|
//console.log("maxbot_status:" + maxbot_status)
|
||||||
if(maxbot_status =='ON') wait_function_ready();
|
if(maxbot_status =='ON') wait_function_ready();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,147 +1,147 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
$("ul.area-list > li:not(:has(a))").remove();
|
$("ul.area-list > li:not(:has(a))").remove();
|
||||||
$("#selectseat div div img").remove();
|
$("#selectseat div div img").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
||||||
function tixcraft_clean_exclude(settings)
|
function tixcraft_clean_exclude(settings)
|
||||||
{
|
{
|
||||||
let exclude_keyword_array = [];
|
let exclude_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.keyword_exclude.length > 0) {
|
if(settings.keyword_exclude.length > 0) {
|
||||||
if(settings.keyword_exclude != '""') {
|
if(settings.keyword_exclude != '""') {
|
||||||
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
||||||
$("ul.area-list > li > a:contains('"+ exclude_keyword_array[i] +"')").each(function ()
|
$("ul.area-list > li > a:contains('"+ exclude_keyword_array[i] +"')").each(function ()
|
||||||
{
|
{
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tixcraft_area_keyword(settings)
|
function tixcraft_area_keyword(settings)
|
||||||
{
|
{
|
||||||
let area_keyword_array = [];
|
let area_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.area_auto_select.area_keyword.length > 0) {
|
if(settings.area_auto_select.area_keyword.length > 0) {
|
||||||
if(settings.area_auto_select.area_keyword!='""') {
|
if(settings.area_auto_select.area_keyword!='""') {
|
||||||
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log(area_keyword_array);
|
// console.log(area_keyword_array);
|
||||||
let target_area=[];
|
let target_area=[];
|
||||||
if(area_keyword_array.length) {
|
if(area_keyword_array.length) {
|
||||||
for (let i = 0; i < area_keyword_array.length; i++) {
|
for (let i = 0; i < area_keyword_array.length; i++) {
|
||||||
let query_string = "ul.area-list > li > a:contains('"+ area_keyword_array[i] +"')";
|
let query_string = "ul.area-list > li > a:contains('"+ area_keyword_array[i] +"')";
|
||||||
if(area_keyword_array[i]=="") {
|
if(area_keyword_array[i]=="") {
|
||||||
query_string = "ul.area-list > li > a"
|
query_string = "ul.area-list > li > a"
|
||||||
}
|
}
|
||||||
let matched_block=$(query_string);
|
let matched_block=$(query_string);
|
||||||
target_area = get_target_area_with_order(settings, matched_block);
|
target_area = get_target_area_with_order(settings, matched_block);
|
||||||
if (target_area.length) {
|
if (target_area.length) {
|
||||||
console.log("match keyword:" + area_keyword_array[i]);
|
console.log("match keyword:" + area_keyword_array[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let query_string = "ul.area-list > li > a";
|
let query_string = "ul.area-list > li > a";
|
||||||
let matched_block=$(query_string);
|
let matched_block=$(query_string);
|
||||||
target_area = get_target_area_with_order(settings, matched_block);
|
target_area = get_target_area_with_order(settings, matched_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_area.length) {
|
if (target_area.length) {
|
||||||
let link_id = target_area.attr("id");
|
let link_id = target_area.attr("id");
|
||||||
//console.log("link_id: " + link_id);
|
//console.log("link_id: " + link_id);
|
||||||
if(link_id) {
|
if(link_id) {
|
||||||
let body = document.body.innerHTML;
|
let body = document.body.innerHTML;
|
||||||
let areaUrlList = null;
|
let areaUrlList = null;
|
||||||
if(body.indexOf('var areaUrlList =')>-1) {
|
if(body.indexOf('var areaUrlList =')>-1) {
|
||||||
const javasrit_right = body.split('var areaUrlList =')[1];
|
const javasrit_right = body.split('var areaUrlList =')[1];
|
||||||
let areaUrlHtml = "";
|
let areaUrlHtml = "";
|
||||||
if(javasrit_right) {
|
if(javasrit_right) {
|
||||||
areaUrlHtml = javasrit_right.split("};")[0];
|
areaUrlHtml = javasrit_right.split("};")[0];
|
||||||
}
|
}
|
||||||
if(areaUrlHtml.length > 0) {
|
if(areaUrlHtml.length > 0) {
|
||||||
areaUrlHtml = areaUrlHtml + "}";
|
areaUrlHtml = areaUrlHtml + "}";
|
||||||
areaUrlList = JSON.parse(areaUrlHtml);
|
areaUrlList = JSON.parse(areaUrlHtml);
|
||||||
}
|
}
|
||||||
//console.log(areaUrlHtml);
|
//console.log(areaUrlHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_url = null;
|
let new_url = null;
|
||||||
if(areaUrlList) {
|
if(areaUrlList) {
|
||||||
let new_url = areaUrlList[link_id];
|
let new_url = areaUrlList[link_id];
|
||||||
if (new_url) {
|
if (new_url) {
|
||||||
//console.log(new_url);
|
//console.log(new_url);
|
||||||
window.location.href = new_url
|
window.location.href = new_url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("not target_area found.")
|
console.log("not target_area found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tixcraft_area_main(settings) {
|
function tixcraft_area_main(settings) {
|
||||||
if(settings) {
|
if(settings) {
|
||||||
//console.log("area_mode:"+ settings.area_auto_select.mode);
|
//console.log("area_mode:"+ settings.area_auto_select.mode);
|
||||||
//console.log("area_keyword:"+ settings.area_auto_select.area_keyword);
|
//console.log("area_keyword:"+ settings.area_auto_select.area_keyword);
|
||||||
//console.log("keyword_exclude:"+ settings.keyword_exclude);
|
//console.log("keyword_exclude:"+ settings.keyword_exclude);
|
||||||
tixcraft_clean_exclude(settings);
|
tixcraft_clean_exclude(settings);
|
||||||
tixcraft_area_keyword(settings);
|
tixcraft_area_keyword(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function area_auto_reload()
|
function area_auto_reload()
|
||||||
{
|
{
|
||||||
let reload=false;
|
let reload=false;
|
||||||
if ($("ul.area-list > li:has(a)").length) {
|
if ($("ul.area-list > li:has(a)").length) {
|
||||||
if (settings)
|
if (settings)
|
||||||
{
|
{
|
||||||
tixcraft_area_main(settings);
|
tixcraft_area_main(settings);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reload=true;
|
reload=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
area_auto_reload();
|
area_auto_reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const event_code = currentUrl.split('/')[5];
|
const event_code = currentUrl.split('/')[5];
|
||||||
//console.log(currentUrl);
|
//console.log(currentUrl);
|
||||||
//console.log(event_code);
|
//console.log(event_code);
|
||||||
if(event_code){
|
if(event_code){
|
||||||
const domain = currentUrl.split('/')[2];
|
const domain = currentUrl.split('/')[2];
|
||||||
const new_url = "https://"+ domain +"/activity/game/"+ event_code;
|
const new_url = "https://"+ domain +"/activity/game/"+ event_code;
|
||||||
location.href=new_url;
|
location.href=new_url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,145 +1,145 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
var myInterval = null;
|
var myInterval = null;
|
||||||
|
|
||||||
$("div.masthead-wrap").remove();
|
$("div.masthead-wrap").remove();
|
||||||
|
|
||||||
function date_clean()
|
function date_clean()
|
||||||
{
|
{
|
||||||
remove_list=['Currently Unavailable',
|
remove_list=['Currently Unavailable',
|
||||||
'Sale ended on 20',
|
'Sale ended on 20',
|
||||||
'Sold out',
|
'Sold out',
|
||||||
'暫停販售',
|
'暫停販售',
|
||||||
':00 截止',
|
':00 截止',
|
||||||
'已售完',
|
'已售完',
|
||||||
'00に発売終了',
|
'00に発売終了',
|
||||||
'販売一時中止',
|
'販売一時中止',
|
||||||
'完売した'
|
'完売した'
|
||||||
];
|
];
|
||||||
for (let i = 0; i < remove_list.length; i++) {
|
for (let i = 0; i < remove_list.length; i++) {
|
||||||
$("#gameList td:contains('"+ remove_list[i] +"')").each(function ()
|
$("#gameList td:contains('"+ remove_list[i] +"')").each(function ()
|
||||||
{
|
{
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function date_keyword(settings)
|
function date_keyword(settings)
|
||||||
{
|
{
|
||||||
let date_keyword_array = [];
|
let date_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.date_auto_select.date_keyword.length > 0) {
|
if(settings.date_auto_select.date_keyword.length > 0) {
|
||||||
if(settings.date_auto_select.date_keyword!='""') {
|
if(settings.date_auto_select.date_keyword!='""') {
|
||||||
date_keyword_array = JSON.parse('[' + settings.date_auto_select.date_keyword +']');
|
date_keyword_array = JSON.parse('[' + settings.date_auto_select.date_keyword +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log(date_keyword_array);
|
//console.log(date_keyword_array);
|
||||||
let target_date;
|
let target_date;
|
||||||
if(date_keyword_array.length) {
|
if(date_keyword_array.length) {
|
||||||
for (let i = 0; i < date_keyword_array.length; i++) {
|
for (let i = 0; i < date_keyword_array.length; i++) {
|
||||||
let query_string = "#gameList td:contains('"+ date_keyword_array[i] +"')";
|
let query_string = "#gameList td:contains('"+ date_keyword_array[i] +"')";
|
||||||
if(date_keyword_array[i]=="") {
|
if(date_keyword_array[i]=="") {
|
||||||
query_string = "#gameList td"
|
query_string = "#gameList td"
|
||||||
}
|
}
|
||||||
let matched_block=$(query_string);
|
let matched_block=$(query_string);
|
||||||
target_date = get_target_date_with_order(settings, matched_block);
|
target_date = get_target_date_with_order(settings, matched_block);
|
||||||
if (target_date.length) {
|
if (target_date.length) {
|
||||||
console.log("match keyword:" + date_keyword_array[i]);
|
console.log("match keyword:" + date_keyword_array[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let query_string = "#gameList td";
|
let query_string = "#gameList td";
|
||||||
let matched_block=$(query_string);
|
let matched_block=$(query_string);
|
||||||
target_date = get_target_area_with_order(settings, matched_block);
|
target_date = get_target_area_with_order(settings, matched_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_date.length) {
|
if (target_date.length) {
|
||||||
let button_tag = "button";
|
let button_tag = "button";
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const domain = currentUrl.split('/')[2];
|
const domain = currentUrl.split('/')[2];
|
||||||
if(domain=="ticketmaster.sg") {
|
if(domain=="ticketmaster.sg") {
|
||||||
button_tag = "a";
|
button_tag = "a";
|
||||||
}
|
}
|
||||||
|
|
||||||
let link = target_date.parent().find(button_tag).attr("data-href");
|
let link = target_date.parent().find(button_tag).attr("data-href");
|
||||||
if (link) {
|
if (link) {
|
||||||
//console.log("link: " + link);
|
//console.log("link: " + link);
|
||||||
clearInterval(myInterval);
|
clearInterval(myInterval);
|
||||||
window.location.href = link;
|
window.location.href = link;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//console.log("not target_date found.")
|
//console.log("not target_date found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function date_main(settings)
|
function date_main(settings)
|
||||||
{
|
{
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
//console.log("date_mode:"+ settings.date_auto_select.mode);
|
//console.log("date_mode:"+ settings.date_auto_select.mode);
|
||||||
//console.log("date_keyword:"+ settings.date_auto_select.date_keyword);
|
//console.log("date_keyword:"+ settings.date_auto_select.date_keyword);
|
||||||
date_keyword(settings);
|
date_keyword(settings);
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function date_auto_reload()
|
function date_auto_reload()
|
||||||
{
|
{
|
||||||
let reload=false;
|
let reload=false;
|
||||||
|
|
||||||
let button_tag = "button";
|
let button_tag = "button";
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const domain = currentUrl.split('/')[2];
|
const domain = currentUrl.split('/')[2];
|
||||||
if(domain=="ticketmaster.sg") {
|
if(domain=="ticketmaster.sg") {
|
||||||
button_tag = "a";
|
button_tag = "a";
|
||||||
}
|
}
|
||||||
|
|
||||||
const query_string = "#gameList "+button_tag;
|
const query_string = "#gameList "+button_tag;
|
||||||
if ($(query_string).length) {
|
if ($(query_string).length) {
|
||||||
date_clean();
|
date_clean();
|
||||||
if ($(query_string).length) {
|
if ($(query_string).length) {
|
||||||
if (settings)
|
if (settings)
|
||||||
{
|
{
|
||||||
date_main(settings);
|
date_main(settings);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reload=true;
|
reload=true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reload=true;
|
reload=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reload) {
|
if(reload) {
|
||||||
let auto_reload_page_interval = 0.0;
|
let auto_reload_page_interval = 0.0;
|
||||||
if(settings) {
|
if(settings) {
|
||||||
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
||||||
}
|
}
|
||||||
if(auto_reload_page_interval == 0) {
|
if(auto_reload_page_interval == 0) {
|
||||||
//console.log('Start to reload now.');
|
//console.log('Start to reload now.');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('We are going to reload after few seconeds.');
|
console.log('We are going to reload after few seconeds.');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
}, auto_reload_page_interval * 1000);
|
}, auto_reload_page_interval * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
date_auto_reload();
|
date_auto_reload();
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
$("#newsHome").remove();
|
$("#newsHome").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
$("#topAlert").remove();
|
$("#topAlert").remove();
|
||||||
$("div.darkBg > div.container > div.row").remove();
|
$("div.darkBg > div.container > div.row").remove();
|
|
@ -1,245 +1,245 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
$('input[type=checkbox]').each(function ()
|
$('input[type=checkbox]').each(function ()
|
||||||
{
|
{
|
||||||
$(this).prop('checked', true);
|
$(this).prop('checked', true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$("img[style='width: 100%; padding: 0;']").remove();
|
$("img[style='width: 100%; padding: 0;']").remove();
|
||||||
$("footer").remove();
|
$("footer").remove();
|
||||||
|
|
||||||
function tixcraft_ticket_clean_exclude(settings)
|
function tixcraft_ticket_clean_exclude(settings)
|
||||||
{
|
{
|
||||||
let exclude_keyword_array = [];
|
let exclude_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.keyword_exclude.length > 0) {
|
if(settings.keyword_exclude.length > 0) {
|
||||||
if(settings.keyword_exclude!='""') {
|
if(settings.keyword_exclude!='""') {
|
||||||
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
for (let i = 0; i < exclude_keyword_array.length; i++) {
|
||||||
$("#ticketPriceList > tbody > tr").each(function ()
|
$("#ticketPriceList > tbody > tr").each(function ()
|
||||||
{
|
{
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
//console.log("html:"+html_text);
|
//console.log("html:"+html_text);
|
||||||
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
|
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tixcraft_assign_ticket_number(settings)
|
function tixcraft_assign_ticket_number(settings)
|
||||||
{
|
{
|
||||||
let area_keyword_array = [];
|
let area_keyword_array = [];
|
||||||
if(settings) {
|
if(settings) {
|
||||||
if(settings.area_auto_select.area_keyword.length > 0) {
|
if(settings.area_auto_select.area_keyword.length > 0) {
|
||||||
if(settings.area_auto_select.area_keyword!='""') {
|
if(settings.area_auto_select.area_keyword!='""') {
|
||||||
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//let target_area = [];
|
//let target_area = [];
|
||||||
|
|
||||||
let target_row=null;
|
let target_row=null;
|
||||||
let all_row = $("#ticketPriceList > tbody > tr");
|
let all_row = $("#ticketPriceList > tbody > tr");
|
||||||
if (all_row.length > 0)
|
if (all_row.length > 0)
|
||||||
{
|
{
|
||||||
if (all_row.length == 1) {
|
if (all_row.length == 1) {
|
||||||
// single select.
|
// single select.
|
||||||
target_row=all_row;
|
target_row=all_row;
|
||||||
} else {
|
} else {
|
||||||
// single select.
|
// single select.
|
||||||
all_row.each(function ()
|
all_row.each(function ()
|
||||||
{
|
{
|
||||||
//console.log(all_row.index(this));
|
//console.log(all_row.index(this));
|
||||||
let is_match_keyword = false;
|
let is_match_keyword = false;
|
||||||
if(all_row.index(this)==0) {
|
if(all_row.index(this)==0) {
|
||||||
target_row=$(this);
|
target_row=$(this);
|
||||||
} else {
|
} else {
|
||||||
if(area_keyword_array.length) {
|
if(area_keyword_array.length) {
|
||||||
let html_text=$(this).text();
|
let html_text=$(this).text();
|
||||||
//console.log("html:"+html_text);
|
//console.log("html:"+html_text);
|
||||||
|
|
||||||
for (let i = 0; i < area_keyword_array.length; i++) {
|
for (let i = 0; i < area_keyword_array.length; i++) {
|
||||||
// TOOD: multi item matched, need sort.
|
// TOOD: multi item matched, need sort.
|
||||||
// target_area = get_target_area_with_order(settings, matched_block);
|
// target_area = get_target_area_with_order(settings, matched_block);
|
||||||
|
|
||||||
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
||||||
is_match_keyword = true;
|
is_match_keyword = true;
|
||||||
target_row=$(this);
|
target_row=$(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(all_row.index(this)==0) {
|
if(all_row.index(this)==0) {
|
||||||
is_match_keyword = true;
|
is_match_keyword = true;
|
||||||
target_row=$(this);
|
target_row=$(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("is_match_keyword:"+is_match_keyword);
|
//console.log("is_match_keyword:"+is_match_keyword);
|
||||||
if(is_match_keyword) {
|
if(is_match_keyword) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let $ticket_options = target_row.find("option");
|
let $ticket_options = target_row.find("option");
|
||||||
if ($ticket_options.length)
|
if ($ticket_options.length)
|
||||||
{
|
{
|
||||||
let is_ticket_number_assign = false;
|
let is_ticket_number_assign = false;
|
||||||
if (settings.ticket_number > 0)
|
if (settings.ticket_number > 0)
|
||||||
{
|
{
|
||||||
$ticket_options.each(function ()
|
$ticket_options.each(function ()
|
||||||
{
|
{
|
||||||
if ($(this).val() == settings.ticket_number)
|
if ($(this).val() == settings.ticket_number)
|
||||||
{
|
{
|
||||||
$(this).prop('selected', true);
|
$(this).prop('selected', true);
|
||||||
is_ticket_number_assign = true;
|
is_ticket_number_assign = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!is_ticket_number_assign)
|
if (!is_ticket_number_assign)
|
||||||
{
|
{
|
||||||
$ticket_options.last().prop('selected', true);
|
$ticket_options.last().prop('selected', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var myInterval = null;
|
var myInterval = null;
|
||||||
|
|
||||||
function get_ocr_image()
|
function get_ocr_image()
|
||||||
{
|
{
|
||||||
//console.log("get_ocr_image");
|
//console.log("get_ocr_image");
|
||||||
let image_data = "";
|
let image_data = "";
|
||||||
|
|
||||||
// PS: tixcraft have different domain to use the same content script.
|
// PS: tixcraft have different domain to use the same content script.
|
||||||
const currentUrl = window.location.href;
|
const currentUrl = window.location.href;
|
||||||
const domain = currentUrl.split('/')[2];
|
const domain = currentUrl.split('/')[2];
|
||||||
|
|
||||||
let image_id = 'TicketForm_verifyCode-image';
|
let image_id = 'TicketForm_verifyCode-image';
|
||||||
let img = document.getElementById(image_id);
|
let img = document.getElementById(image_id);
|
||||||
if(img!=null) {
|
if(img!=null) {
|
||||||
let canvas = document.createElement('canvas');
|
let canvas = document.createElement('canvas');
|
||||||
let context = canvas.getContext('2d');
|
let context = canvas.getContext('2d');
|
||||||
canvas.height = img.naturalHeight;
|
canvas.height = img.naturalHeight;
|
||||||
canvas.width = img.naturalWidth;
|
canvas.width = img.naturalWidth;
|
||||||
context.drawImage(img, 0, 0);
|
context.drawImage(img, 0, 0);
|
||||||
let img_data = canvas.toDataURL();
|
let img_data = canvas.toDataURL();
|
||||||
if(img_data) {
|
if(img_data) {
|
||||||
image_data = img_data.split(",")[1];
|
image_data = img_data.split(",")[1];
|
||||||
//console.log(image_data);
|
//console.log(image_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image_data;
|
return image_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
var last_captcha_answer="";
|
var last_captcha_answer="";
|
||||||
chrome.runtime.onMessage.addListener((message) => {
|
chrome.runtime.onMessage.addListener((message) => {
|
||||||
//console.log('sent from background', message);
|
//console.log('sent from background', message);
|
||||||
if(message.answer.length==4) {
|
if(message.answer.length==4) {
|
||||||
tixcraft_set_ocr_answer(message.answer);
|
tixcraft_set_ocr_answer(message.answer);
|
||||||
last_captcha_answer=message.answer;
|
last_captcha_answer=message.answer;
|
||||||
} else {
|
} else {
|
||||||
// renew captcha.
|
// renew captcha.
|
||||||
if(last_captcha_answer!=message.answer) {
|
if(last_captcha_answer!=message.answer) {
|
||||||
last_captcha_answer=message.answer;
|
last_captcha_answer=message.answer;
|
||||||
console.log("renew captcha");
|
console.log("renew captcha");
|
||||||
$('#TicketForm_verifyCode').click();
|
$('#TicketForm_verifyCode').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function tixcraft_set_ocr_answer(answer)
|
function tixcraft_set_ocr_answer(answer)
|
||||||
{
|
{
|
||||||
//console.log("answer:"+answer);
|
//console.log("answer:"+answer);
|
||||||
if(answer.length > 0) {
|
if(answer.length > 0) {
|
||||||
$('#TicketForm_verifyCode').val(answer);
|
$('#TicketForm_verifyCode').val(answer);
|
||||||
$("button[type='submit']").click();
|
$("button[type='submit']").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function tixcraft_get_ocr_answer(api_url, image_data)
|
async function tixcraft_get_ocr_answer(api_url, image_data)
|
||||||
{
|
{
|
||||||
let bundle = {
|
let bundle = {
|
||||||
action: 'ocr',
|
action: 'ocr',
|
||||||
data: {
|
data: {
|
||||||
'url': api_url + 'ocr',
|
'url': api_url + 'ocr',
|
||||||
'image_data':image_data,
|
'image_data':image_data,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let bundle_string = JSON.stringify(bundle);
|
let bundle_string = JSON.stringify(bundle);
|
||||||
const return_answer = await chrome.runtime.sendMessage(bundle);
|
const return_answer = await chrome.runtime.sendMessage(bundle);
|
||||||
//console.log(return_answer);
|
//console.log(return_answer);
|
||||||
|
|
||||||
// fail due to CORS error
|
// fail due to CORS error
|
||||||
//ocr(bundle.data.url, bundle.data.image_data, bundle.data.callback);
|
//ocr(bundle.data.url, bundle.data.image_data, bundle.data.callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tixcraft_orc_image_ready(api_url)
|
function tixcraft_orc_image_ready(api_url)
|
||||||
{
|
{
|
||||||
let ret=false;
|
let ret=false;
|
||||||
let image_data = get_ocr_image();
|
let image_data = get_ocr_image();
|
||||||
if(image_data.length>0) {
|
if(image_data.length>0) {
|
||||||
ret=true;
|
ret=true;
|
||||||
if(myInterval) clearInterval(myInterval);
|
if(myInterval) clearInterval(myInterval);
|
||||||
tixcraft_get_ocr_answer(api_url, image_data);
|
tixcraft_get_ocr_answer(api_url, image_data);
|
||||||
}
|
}
|
||||||
//console.log("orc_image_ready:"+ret);
|
//console.log("orc_image_ready:"+ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
} else {
|
} else {
|
||||||
console.log('no settings found');
|
console.log('no settings found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('settings', function (items)
|
storage.get('settings', function (items)
|
||||||
{
|
{
|
||||||
if (items.settings)
|
if (items.settings)
|
||||||
{
|
{
|
||||||
settings = items.settings;
|
settings = items.settings;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
storage.get('status', function (items)
|
storage.get('status', function (items)
|
||||||
{
|
{
|
||||||
if (items.status && items.status=='ON')
|
if (items.status && items.status=='ON')
|
||||||
{
|
{
|
||||||
tixcraft_ticket_clean_exclude(settings);
|
tixcraft_ticket_clean_exclude(settings);
|
||||||
|
|
||||||
//console.log("ticket_number:"+ settings.ticket_number);
|
//console.log("ticket_number:"+ settings.ticket_number);
|
||||||
tixcraft_assign_ticket_number(settings);
|
tixcraft_assign_ticket_number(settings);
|
||||||
|
|
||||||
// ocr
|
// ocr
|
||||||
if(settings.ocr_captcha.enable) {
|
if(settings.ocr_captcha.enable) {
|
||||||
let remote_url_string = "";
|
let remote_url_string = "";
|
||||||
let remote_url_array = [];
|
let remote_url_array = [];
|
||||||
if(settings.advanced.remote_url.length > 0) {
|
if(settings.advanced.remote_url.length > 0) {
|
||||||
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
|
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
|
||||||
}
|
}
|
||||||
if(remote_url_array.length) {
|
if(remote_url_array.length) {
|
||||||
remote_url_string = remote_url_array[0];
|
remote_url_string = remote_url_array[0];
|
||||||
}
|
}
|
||||||
if(!tixcraft_orc_image_ready(remote_url_string)) {
|
if(!tixcraft_orc_image_ready(remote_url_string)) {
|
||||||
myInterval = setInterval(() => {
|
myInterval = setInterval(() => {
|
||||||
tixcraft_orc_image_ready(remote_url_string);
|
tixcraft_orc_image_ready(remote_url_string);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('no status found');
|
console.log('no status found');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,367 +1,359 @@
|
||||||
{
|
{
|
||||||
"author": "Max Yao",
|
"author": "Max Yao",
|
||||||
"name": "MaxBot Plus",
|
"name": "MaxBot Plus",
|
||||||
"description": "Quick way to get expected tickets on some specific websites.",
|
"description": "Quick way to get expected tickets on some specific websites.",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "icons/maxbot-16.png",
|
"16": "icons/maxbot-16.png",
|
||||||
"32": "icons/maxbot-32.png",
|
"32": "icons/maxbot-32.png",
|
||||||
"48": "icons/maxbot-48.png",
|
"48": "icons/maxbot-48.png",
|
||||||
"64": "icons/maxbot-64.png",
|
"64": "icons/maxbot-64.png",
|
||||||
"128": "icons/maxbot-128.png"
|
"128": "icons/maxbot-128.png"
|
||||||
},
|
},
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "background.js",
|
"service_worker": "background.js",
|
||||||
"type": "module"
|
"type": "module"
|
||||||
},
|
},
|
||||||
"declarative_net_request": {
|
"permissions": [
|
||||||
"rule_resources": [
|
"storage",
|
||||||
{
|
"declarativeNetRequest",
|
||||||
"id": "ruleset_1",
|
"declarativeNetRequestFeedback"
|
||||||
"enabled": true,
|
],
|
||||||
"path": "rules_1.json"
|
"host_permissions": [
|
||||||
}
|
"http://maxbot.dropboxlike.com:16888/*",
|
||||||
]
|
"http://127.0.0.1:16888/*"
|
||||||
},
|
],
|
||||||
"permissions": [
|
"web_accessible_resources": [
|
||||||
"storage",
|
{
|
||||||
"declarativeNetRequest",
|
"resources": [
|
||||||
"declarativeNetRequestFeedback"
|
"data/*.json"
|
||||||
],
|
],
|
||||||
"host_permissions": [
|
"extension_ids": [
|
||||||
"http://127.0.0.1:16888/*"
|
"*"
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"matches": [
|
||||||
{
|
"*://*/*"
|
||||||
"resources": [
|
]
|
||||||
"data/*.json"
|
}
|
||||||
],
|
],
|
||||||
"extension_ids": [
|
"options_page": "options.html",
|
||||||
"*"
|
"action": {
|
||||||
],
|
"default_icon": "icons/maxbot-128.png",
|
||||||
"matches": [
|
"default_title": "MaxBot"
|
||||||
"*://*/*"
|
},
|
||||||
]
|
"content_scripts": [
|
||||||
}
|
{
|
||||||
],
|
"matches": [
|
||||||
"options_page": "options.html",
|
"https://tixcraft.com/",
|
||||||
"action": {
|
"https://www.indievox.com/",
|
||||||
"default_icon": "icons/maxbot-128.png",
|
"https://indievox.com/",
|
||||||
"default_title": "MaxBot"
|
"https://ticketmaster.sg/"
|
||||||
},
|
],
|
||||||
"content_scripts": [
|
"run_at": "document_end",
|
||||||
{
|
"js": [
|
||||||
"matches": [
|
"jquery.min.js",
|
||||||
"https://tixcraft.com/",
|
"js/tixcraft_home.js"
|
||||||
"https://www.indievox.com/",
|
]
|
||||||
"https://indievox.com/",
|
},
|
||||||
"https://ticketmaster.sg/"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://tixcraft.com/activity/detail/*",
|
||||||
"js": [
|
"https://www.indievox.com/activity/detail/*",
|
||||||
"jquery.min.js",
|
"https://indievox.com/activity/detail/*",
|
||||||
"js/tixcraft_home.js"
|
"https://ticketmaster.sg/activity/detail/*"
|
||||||
]
|
],
|
||||||
},
|
"run_at": "document_start",
|
||||||
{
|
"js": [
|
||||||
"matches": [
|
"jquery.min.js",
|
||||||
"https://tixcraft.com/activity/detail/*",
|
"js/tixcraft_detail.js"
|
||||||
"https://www.indievox.com/activity/detail/*",
|
]
|
||||||
"https://indievox.com/activity/detail/*",
|
},
|
||||||
"https://ticketmaster.sg/activity/detail/*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_start",
|
"https://tixcraft.com/activity/game/*",
|
||||||
"js": [
|
"https://www.indievox.com/activity/game/*",
|
||||||
"jquery.min.js",
|
"https://indievox.com/activity/game/*",
|
||||||
"js/tixcraft_detail.js"
|
"https://ticketmaster.sg/activity/game/*"
|
||||||
]
|
],
|
||||||
},
|
"run_at": "document_end",
|
||||||
{
|
"js": [
|
||||||
"matches": [
|
"jquery.min.js",
|
||||||
"https://tixcraft.com/activity/game/*",
|
"js/common.js",
|
||||||
"https://www.indievox.com/activity/game/*",
|
"js/tixcraft_game.js"
|
||||||
"https://indievox.com/activity/game/*",
|
]
|
||||||
"https://ticketmaster.sg/activity/game/*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"js": [
|
"https://tixcraft.com/ticket/area/*",
|
||||||
"jquery.min.js",
|
"https://www.indievox.com/ticket/area/*",
|
||||||
"js/common.js",
|
"https://indievox.com/ticket/area/*"
|
||||||
"js/tixcraft_game.js"
|
],
|
||||||
]
|
"run_at": "document_end",
|
||||||
},
|
"js": [
|
||||||
{
|
"jquery.min.js",
|
||||||
"matches": [
|
"js/common.js",
|
||||||
"https://tixcraft.com/ticket/area/*",
|
"js/tixcraft_area.js"
|
||||||
"https://www.indievox.com/ticket/area/*",
|
]
|
||||||
"https://indievox.com/ticket/area/*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"js": [
|
"https://tixcraft.com/ticket/ticket/*",
|
||||||
"jquery.min.js",
|
"https://www.indievox.com/ticket/ticket/*",
|
||||||
"js/common.js",
|
"https://indievox.com/ticket/ticket/*",
|
||||||
"js/tixcraft_area.js"
|
"https://ticketmaster.sg/ticket/ticket/*"
|
||||||
]
|
],
|
||||||
},
|
"run_at": "document_end",
|
||||||
{
|
"js": [
|
||||||
"matches": [
|
"jquery.min.js",
|
||||||
"https://tixcraft.com/ticket/ticket/*",
|
"js/common.js",
|
||||||
"https://www.indievox.com/ticket/ticket/*",
|
"js/tixcraft_ticket.js"
|
||||||
"https://indievox.com/ticket/ticket/*",
|
]
|
||||||
"https://ticketmaster.sg/ticket/ticket/*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"js": [
|
"https://ticket.com.tw/application/utk01/utk0101_.aspx"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/common.js",
|
"run_at": "document_end",
|
||||||
"js/tixcraft_ticket.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/ticket_home.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://ticket.com.tw/application/utk01/utk0101_.aspx"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://ticket.com.tw/application/UTK02/UTK0201_.aspx?PRODUCT_ID=*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/ticket_home.js"
|
"world": "MAIN",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/ticket_event_home.js"
|
||||||
"matches": [
|
]
|
||||||
"https://ticket.com.tw/application/UTK02/UTK0201_.aspx?PRODUCT_ID=*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"world": "MAIN",
|
"https://ticket.com.tw/application/UTK02/UTK0201_00.aspx?PRODUCT_ID=*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/ticket_event_home.js"
|
"world": "MAIN",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/ticket_date.js"
|
||||||
"matches": [
|
]
|
||||||
"https://ticket.com.tw/application/UTK02/UTK0201_00.aspx?PRODUCT_ID=*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"world": "MAIN",
|
"https://ticket.com.tw/application/UTK02/UTK0204_.aspx?*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/ticket_date.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/common.js",
|
||||||
{
|
"js/ticket_area.js"
|
||||||
"matches": [
|
]
|
||||||
"https://ticket.com.tw/application/UTK02/UTK0204_.aspx?*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"js": [
|
"https://kham.com.tw/application/utk01/UTK0101_03.aspx"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/common.js",
|
"run_at": "document_end",
|
||||||
"js/ticket_area.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/kham_home.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://kham.com.tw/application/utk01/UTK0101_03.aspx"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://kham.com.tw/application/UTK02/UTK0201_.aspx?PRODUCT_ID=*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/kham_home.js"
|
"world": "MAIN",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/kham_event_home.js"
|
||||||
"matches": [
|
]
|
||||||
"https://kham.com.tw/application/UTK02/UTK0201_.aspx?PRODUCT_ID=*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"world": "MAIN",
|
"https://kham.com.tw/application/UTK02/UTK0201_00.aspx?PRODUCT_ID=*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/kham_event_home.js"
|
"world": "MAIN",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/kham_date.js"
|
||||||
"matches": [
|
]
|
||||||
"https://kham.com.tw/application/UTK02/UTK0201_00.aspx?PRODUCT_ID=*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"world": "MAIN",
|
"https://kham.com.tw/application/UTK02/UTK0204_.aspx?*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/kham_date.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/kham_area.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://kham.com.tw/application/UTK02/UTK0204_.aspx?*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://ticket.ibon.com.tw/ActivityInfo/Details/*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_start",
|
||||||
"js/kham_area.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/ibon_detail.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://ticket.ibon.com.tw/ActivityInfo/Details/*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_start",
|
"https://orders.ibon.com.tw/application/UTK02/UTK0201_000.aspx?*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/ibon_detail.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/ibon_area.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://orders.ibon.com.tw/application/UTK02/UTK0201_000.aspx?*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*",
|
||||||
"js": [
|
"https://orders.ibon.com.tw/application/UTK02/UTK0202_.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/ibon_area.js"
|
"run_at": "document_end",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/ibon_ticket.js"
|
||||||
"matches": [
|
]
|
||||||
"https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*",
|
},
|
||||||
"https://orders.ibon.com.tw/application/UTK02/UTK0202_.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*",
|
||||||
"js": [
|
"https://orders.ibon.com.tw/application/UTK02/UTK0202_.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/ibon_ticket.js"
|
"run_at": "document_end",
|
||||||
]
|
"world": "MAIN",
|
||||||
},
|
"js": [
|
||||||
{
|
"jquery.min.js",
|
||||||
"matches": [
|
"js/ibon_ticket_next.js"
|
||||||
"https://orders.ibon.com.tw/application/UTK02/UTK0201_001.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*",
|
]
|
||||||
"https://orders.ibon.com.tw/application/UTK02/UTK0202_.aspx?PERFORMANCE_ID=*PERFORMANCE_PRICE_AREA_ID=*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"world": "MAIN",
|
"https://queue.hkticketing.com/hotshow.html",
|
||||||
"js": [
|
"https://busy.hkticketing.com/"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/ibon_ticket_next.js"
|
"run_at": "document_end",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/hkticketing_queue_background.js"
|
||||||
"matches": [
|
]
|
||||||
"https://queue.hkticketing.com/hotshow.html",
|
},
|
||||||
"https://busy.hkticketing.com/"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://queue.hkticketing.com/hotshow.html",
|
||||||
"js": [
|
"https://busy.hkticketing.com/"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/hkticketing_queue_background.js"
|
"run_at": "document_end",
|
||||||
]
|
"world": "MAIN",
|
||||||
},
|
"js": [
|
||||||
{
|
"js/hkticketing_queue_front.js"
|
||||||
"matches": [
|
]
|
||||||
"https://queue.hkticketing.com/hotshow.html",
|
},
|
||||||
"https://busy.hkticketing.com/"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://msg.cityline.com/*.html*"
|
||||||
"world": "MAIN",
|
],
|
||||||
"js": [
|
"run_at": "document_end",
|
||||||
"js/hkticketing_queue_front.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/cityline_msg_background.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://msg.cityline.com/*.html*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://msg.cityline.com/*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/cityline_msg_background.js"
|
"world": "MAIN",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/cityline_msg_front.js"
|
||||||
"matches": [
|
]
|
||||||
"https://msg.cityline.com/*"
|
},
|
||||||
],
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"world": "MAIN",
|
"https://*.cityline.com/utsvInternet/internet/eventDetail?event=*",
|
||||||
"js": [
|
"https://*.cityline.com/utsvlnternet/*/login?lang=TW"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/cityline_msg_front.js"
|
"run_at": "document_end",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/cityline_event_common.js"
|
||||||
"matches": [
|
]
|
||||||
"https://*.cityline.com/utsvInternet/internet/eventDetail?event=*",
|
},
|
||||||
"https://*.cityline.com/utsvlnternet/*/login?lang=TW"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://ticketplus.com.tw/activity/*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/cityline_event_common.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/ticketplus_activity.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://ticketplus.com.tw/activity/*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://ticketplus.com.tw/order/*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_start",
|
||||||
"js/ticketplus_activity.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/ticketplus_order.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://ticketplus.com.tw/order/*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_start",
|
"https://kktix.com/"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/ticketplus_order.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/kktix_home.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://kktix.com/"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://*.kktix.cc/events/*"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"run_at": "document_end",
|
||||||
"js/kktix_home.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/kktix_events.js"
|
||||||
{
|
]
|
||||||
"matches": [
|
},
|
||||||
"https://*.kktix.cc/events/*"
|
{
|
||||||
],
|
"matches": [
|
||||||
"run_at": "document_end",
|
"https://kktix.com/events/*/registrations/new"
|
||||||
"js": [
|
],
|
||||||
"jquery.min.js",
|
"world": "MAIN",
|
||||||
"js/kktix_events.js"
|
"run_at": "document_end",
|
||||||
]
|
"js": [
|
||||||
},
|
"jquery.min.js",
|
||||||
{
|
"js/common.js",
|
||||||
"matches": [
|
"js/kktix_registrations_assign.js"
|
||||||
"https://kktix.com/events/*/registrations/new"
|
]
|
||||||
],
|
},
|
||||||
"world": "MAIN",
|
{
|
||||||
"run_at": "document_end",
|
"matches": [
|
||||||
"js": [
|
"https://kktix.com/events/*/registrations/new"
|
||||||
"jquery.min.js",
|
],
|
||||||
"js/common.js",
|
"run_at": "document_start",
|
||||||
"js/kktix_registrations_assign.js"
|
"js": [
|
||||||
]
|
"jquery.min.js",
|
||||||
},
|
"js/common.js",
|
||||||
{
|
"js/kktix_registrations_reload.js"
|
||||||
"matches": [
|
]
|
||||||
"https://kktix.com/events/*/registrations/new"
|
}
|
||||||
],
|
],
|
||||||
"run_at": "document_start",
|
"version": "1.0.5"
|
||||||
"js": [
|
|
||||||
"jquery.min.js",
|
|
||||||
"js/common.js",
|
|
||||||
"js/kktix_registrations_reload.js"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": "1.0.5"
|
|
||||||
}
|
}
|
|
@ -1,92 +1,92 @@
|
||||||
const https_url = "https://";
|
const https_url = "https://";
|
||||||
const http_url = "https://";
|
const http_url = "https://";
|
||||||
|
|
||||||
class HeartBeatConnector
|
class HeartBeatConnector
|
||||||
{
|
{
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
sync_status_from_parent();
|
sync_status_from_parent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_status_to(flag)
|
function set_status_to(flag)
|
||||||
{
|
{
|
||||||
let nextState = 'ON';
|
let nextState = 'ON';
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
nextState = 'OFF';
|
nextState = 'OFF';
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(nextState);
|
//console.log(nextState);
|
||||||
chrome.action.setBadgeText(
|
chrome.action.setBadgeText(
|
||||||
{
|
{
|
||||||
text: nextState
|
text: nextState
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
chrome.storage.local.set(
|
chrome.storage.local.set(
|
||||||
{
|
{
|
||||||
status: nextState
|
status: nextState
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_webserver_runing_to(flag)
|
function set_webserver_runing_to(flag)
|
||||||
{
|
{
|
||||||
chrome.storage.local.set(
|
chrome.storage.local.set(
|
||||||
{
|
{
|
||||||
webserver_runing: flag
|
webserver_runing: flag
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sync_status_from_parent()
|
function sync_status_from_parent()
|
||||||
{
|
{
|
||||||
//console.log("sync_status_from_parent");
|
//console.log("sync_status_from_parent");
|
||||||
|
|
||||||
let data_url = chrome.runtime.getURL("data/status.json");
|
let data_url = chrome.runtime.getURL("data/status.json");
|
||||||
fetch(data_url)
|
fetch(data_url)
|
||||||
.then(response =>
|
.then(response =>
|
||||||
{
|
{
|
||||||
if (response.ok)
|
if (response.ok)
|
||||||
{
|
{
|
||||||
set_webserver_runing_to(true);
|
set_webserver_runing_to(true);
|
||||||
return response.json()
|
return response.json()
|
||||||
}
|
}
|
||||||
else if (response.status === 404)
|
else if (response.status === 404)
|
||||||
{
|
{
|
||||||
set_webserver_runing_to(false);
|
set_webserver_runing_to(false);
|
||||||
return Promise.reject('error 404')
|
return Promise.reject('error 404')
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_webserver_runing_to(false);
|
set_webserver_runing_to(false);
|
||||||
return Promise.reject('some other error: ' + response.status)
|
return Promise.reject('some other error: ' + response.status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then((data) =>
|
.then((data) =>
|
||||||
{
|
{
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
set_status_to(data.status);
|
set_status_to(data.status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error =>
|
.catch(error =>
|
||||||
{
|
{
|
||||||
//console.log('error is', error)
|
//console.log('error is', error)
|
||||||
set_webserver_runing_to(false);
|
set_webserver_runing_to(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ack()
|
function ack()
|
||||||
{
|
{
|
||||||
//console.log("act");
|
//console.log("act");
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new HeartBeatConnector();
|
export default new HeartBeatConnector();
|
||||||
|
|
|
@ -1,123 +1,133 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Extension Options</title>
|
<title>Extension Options</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link href="dist/bootstrap/bootstrap.min.css" rel="stylesheet">
|
<link href="dist/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||||
<script src="dist/bootstrap/bootstrap.min.js"></script>
|
<script src="dist/bootstrap/bootstrap.min.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="css/options.css" />
|
<link rel="stylesheet" type="text/css" href="css/options.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="message"></div>
|
<div id="message"></div>
|
||||||
<h2>MaxBot Settings</h2>
|
<h2>MaxBot Settings</h2>
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Perference</button>
|
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Perference</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link" id="advanced-tab" data-bs-toggle="tab" data-bs-target="#advanced-tab-pane" type="button" role="tab" aria-controls="advanced-tab-pane" aria-selected="false">Advanced</button>
|
<button class="nav-link" id="advanced-tab" data-bs-toggle="tab" data-bs-target="#advanced-tab-pane" type="button" role="tab" aria-controls="advanced-tab-pane" aria-selected="false">Advanced</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" id="myTabContent">
|
<div class="tab-content" id="myTabContent">
|
||||||
<div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">
|
<div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="ticket_number" class="form-label">Ticket Number</label>
|
<label for="ticket_number" class="form-label">Ticket Number</label>
|
||||||
<select id="ticket_number" class="form-select" aria-label="Default select">
|
<select id="ticket_number" class="form-select" aria-label="Default select">
|
||||||
<option selected>Ticket Number</option>
|
<option selected>Ticket Number</option>
|
||||||
<option value="1">1</option>
|
<option value="1">1</option>
|
||||||
<option value="2">2</option>
|
<option value="2">2</option>
|
||||||
<option value="3">3</option>
|
<option value="3">3</option>
|
||||||
<option value="4">4</option>
|
<option value="4">4</option>
|
||||||
<option value="5">5</option>
|
<option value="5">5</option>
|
||||||
<option value="6">6</option>
|
<option value="6">6</option>
|
||||||
<option value="7">7</option>
|
<option value="7">7</option>
|
||||||
<option value="8">8</option>
|
<option value="8">8</option>
|
||||||
<option value="9">9</option>
|
<option value="9">9</option>
|
||||||
<option value="10">10</option>
|
<option value="10">10</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="date_select_mode" class="form-label">Date Select Order</label>
|
<label for="date_select_mode" class="form-label">Date Select Order</label>
|
||||||
<select id="date_select_mode" class="form-select" aria-label="Default select">
|
<select id="date_select_mode" class="form-select" aria-label="Default select">
|
||||||
<option value="from top to bottom">from top to bottom</option>
|
<option value="from top to bottom">from top to bottom</option>
|
||||||
<option value="from bottom to top">from bottom to top</option>
|
<option value="from bottom to top">from bottom to top</option>
|
||||||
<option value="center">center</option>
|
<option value="center">center</option>
|
||||||
<option value="random">random</option>
|
<option value="random">random</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="date_keyword" class="form-label">Date Keywords</label>
|
<label for="date_keyword" class="form-label">Date Keywords</label>
|
||||||
<textarea class="form-control" id="date_keyword" rows="3"></textarea>
|
<textarea class="form-control" id="date_keyword" rows="3"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="area_select_mode" class="form-label">Area Select Order</label>
|
<label for="area_select_mode" class="form-label">Area Select Order</label>
|
||||||
<select id="area_select_mode" class="form-select" aria-label="Default select">
|
<select id="area_select_mode" class="form-select" aria-label="Default select">
|
||||||
<option value="from top to bottom">from top to bottom</option>
|
<option value="from top to bottom">from top to bottom</option>
|
||||||
<option value="from bottom to top">from bottom to top</option>
|
<option value="from bottom to top">from bottom to top</option>
|
||||||
<option value="center">center</option>
|
<option value="center">center</option>
|
||||||
<option value="random">random</option>
|
<option value="random">random</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="area_keyword" class="form-label">Area Keywords</label>
|
<label for="area_keyword" class="form-label">Area Keywords</label>
|
||||||
<textarea class="form-control" id="area_keyword" rows="3"></textarea>
|
<textarea class="form-control" id="area_keyword" rows="3"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="keyword_exclude" class="form-label">Exclude Keywords</label>
|
<label for="keyword_exclude" class="form-label">Exclude Keywords</label>
|
||||||
<textarea class="form-control" id="keyword_exclude" rows="3"></textarea>
|
<textarea class="form-control" id="keyword_exclude" rows="3"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="advanced-tab-pane" role="tabpanel" aria-labelledby="advanced-tab" tabindex="0">
|
<div class="tab-pane fade" id="advanced-tab-pane" role="tabpanel" aria-labelledby="advanced-tab" tabindex="0">
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="auto_reload_page_interval" class="form-label">Reload page interval(sec.)</label>
|
<label for="auto_reload_page_interval" class="form-label">Reload page interval(sec.)</label>
|
||||||
<input class="form-control" id="auto_reload_page_interval" value="" />
|
<input class="form-control" id="auto_reload_page_interval" value="" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" id="disable_adjacent_seat">
|
<input class="form-check-input" type="checkbox" id="disable_adjacent_seat">
|
||||||
<label class="form-check-label" for="disable_adjacent_seat">
|
<label class="form-check-label" for="disable_adjacent_seat">
|
||||||
Disable Adjacent Seat
|
Disable Adjacent Seat
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12" id="ocr_captcha_enable_row" style="">
|
<div class="col-12">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" id="ocr_captcha_enable">
|
<input class="form-check-input" type="checkbox" id="ocr_captcha_enable">
|
||||||
<label class="form-check-label" for="ocr_captcha_enable">
|
<label class="form-check-label" for="ocr_captcha_enable">
|
||||||
OCR
|
OCR
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12" id="remote_url_row" style="">
|
<div class="col-12">
|
||||||
<label for="remote_url" class="form-label">OCR Server URL</label>
|
<label for="remote_url" class="form-label">OCR Server URL</label>
|
||||||
<input class="form-control" id="remote_url" value="" />
|
<input class="form-control" id="remote_url" value="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div class="col-12">
|
||||||
</div>
|
<div class="form-check">
|
||||||
</div>
|
<input class="form-check-input" type="checkbox" id="ocr_captcha_use_public_server">
|
||||||
|
<label class="form-check-label" for="ocr_captcha_use_public_server">
|
||||||
<div class="col-12">
|
Use MaxBot Pulic OCR Server
|
||||||
<button class="btn btn-primary" id="save_btn">Save</button>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="options.js"></script>
|
</div>
|
||||||
</body>
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<button class="btn btn-primary" id="save_btn">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="options.js"></script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,128 +1,140 @@
|
||||||
const storage = chrome.storage.local;
|
const storage = chrome.storage.local;
|
||||||
|
|
||||||
const submitButton = document.querySelector('#save_btn');
|
const submitButton = document.querySelector('#save_btn');
|
||||||
const ticket_number = document.querySelector('#ticket_number');
|
const ticket_number = document.querySelector('#ticket_number');
|
||||||
const date_select_mode = document.querySelector('#date_select_mode');
|
const date_select_mode = document.querySelector('#date_select_mode');
|
||||||
const date_keyword = document.querySelector('#date_keyword');
|
const date_keyword = document.querySelector('#date_keyword');
|
||||||
const area_select_mode = document.querySelector('#area_select_mode');
|
const area_select_mode = document.querySelector('#area_select_mode');
|
||||||
const area_keyword = document.querySelector('#area_keyword');
|
const area_keyword = document.querySelector('#area_keyword');
|
||||||
const keyword_exclude = document.querySelector('#keyword_exclude');
|
const keyword_exclude = document.querySelector('#keyword_exclude');
|
||||||
const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval');
|
const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval');
|
||||||
const disable_adjacent_seat = document.querySelector('#disable_adjacent_seat');
|
const disable_adjacent_seat = document.querySelector('#disable_adjacent_seat');
|
||||||
const ocr_captcha_enable = document.querySelector('#ocr_captcha_enable');
|
const ocr_captcha_enable = document.querySelector('#ocr_captcha_enable');
|
||||||
const remote_url = document.querySelector('#remote_url');
|
const ocr_captcha_use_public_server = document.querySelector('#ocr_captcha_use_public_server');
|
||||||
|
const remote_url = document.querySelector('#remote_url');
|
||||||
var settings = null;
|
|
||||||
|
const PUBLIC_SERVER_URL = "http://maxbot.dropboxlike.com:16888/";
|
||||||
loadChanges();
|
|
||||||
|
var settings = null;
|
||||||
submitButton.addEventListener('click', saveChanges);
|
|
||||||
|
loadChanges();
|
||||||
async function saveChanges()
|
|
||||||
{
|
submitButton.addEventListener('click', saveChanges);
|
||||||
const ticket_number_value = ticket_number.value;
|
ocr_captcha_use_public_server.addEventListener('change', checkUsePublicServer);
|
||||||
console.log(ticket_number_value);
|
|
||||||
if (!ticket_number_value)
|
async function saveChanges()
|
||||||
{
|
{
|
||||||
message('Error: No ticket_number specified');
|
const ticket_number_value = ticket_number.value;
|
||||||
} else {
|
console.log(ticket_number_value);
|
||||||
if(settings) {
|
if (!ticket_number_value)
|
||||||
settings.ticket_number = ticket_number_value;
|
{
|
||||||
settings.date_auto_select.mode = date_select_mode.value;
|
message('Error: No ticket_number specified');
|
||||||
|
} else {
|
||||||
let date_keyword_string = date_keyword.value;
|
if(settings) {
|
||||||
if(date_keyword_string.indexOf('"')==-1) {
|
settings.ticket_number = ticket_number_value;
|
||||||
date_keyword_string = '"' + date_keyword_string + '"';
|
settings.date_auto_select.mode = date_select_mode.value;
|
||||||
}
|
|
||||||
settings.date_auto_select.date_keyword = date_keyword_string;
|
let date_keyword_string = date_keyword.value;
|
||||||
|
if(date_keyword_string.indexOf('"')==-1) {
|
||||||
settings.area_auto_select.mode = area_select_mode.value;
|
date_keyword_string = '"' + date_keyword_string + '"';
|
||||||
|
}
|
||||||
let area_keyword_string = area_keyword.value;
|
settings.date_auto_select.date_keyword = date_keyword_string;
|
||||||
if(area_keyword_string.indexOf('"')==-1) {
|
|
||||||
area_keyword_string = '"' + area_keyword_string + '"';
|
settings.area_auto_select.mode = area_select_mode.value;
|
||||||
}
|
|
||||||
settings.area_auto_select.area_keyword = area_keyword_string;
|
let area_keyword_string = area_keyword.value;
|
||||||
|
if(area_keyword_string.indexOf('"')==-1) {
|
||||||
settings.keyword_exclude = keyword_exclude.value;
|
area_keyword_string = '"' + area_keyword_string + '"';
|
||||||
|
}
|
||||||
settings.advanced.auto_reload_page_interval = auto_reload_page_interval.value;
|
settings.area_auto_select.area_keyword = area_keyword_string;
|
||||||
settings.advanced.disable_adjacent_seat = disable_adjacent_seat.checked;
|
|
||||||
settings.ocr_captcha.enable = ocr_captcha_enable.checked;
|
settings.keyword_exclude = keyword_exclude.value;
|
||||||
|
|
||||||
let remote_url_array = [];
|
settings.advanced.auto_reload_page_interval = auto_reload_page_interval.value;
|
||||||
remote_url_array.push(remote_url.value);
|
settings.advanced.disable_adjacent_seat = disable_adjacent_seat.checked;
|
||||||
let remote_url_string = JSON.stringify(remote_url_array);
|
settings.ocr_captcha.enable = ocr_captcha_enable.checked;
|
||||||
remote_url_string = remote_url_string.substring(0,remote_url_string.length-1);
|
|
||||||
remote_url_string = remote_url_string.substring(1);
|
let remote_url_array = [];
|
||||||
//console.log("final remote_url_string:"+remote_url_string);
|
remote_url_array.push(remote_url.value);
|
||||||
settings.advanced.remote_url = remote_url_string;
|
let remote_url_string = JSON.stringify(remote_url_array);
|
||||||
|
remote_url_string = remote_url_string.substring(0,remote_url_string.length-1);
|
||||||
await storage.set(
|
remote_url_string = remote_url_string.substring(1);
|
||||||
{
|
//console.log("final remote_url_string:"+remote_url_string);
|
||||||
settings: settings
|
settings.advanced.remote_url = remote_url_string;
|
||||||
}
|
|
||||||
);
|
await storage.set(
|
||||||
}
|
{
|
||||||
message('Settings saved');
|
settings: settings
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
|
}
|
||||||
function loadChanges()
|
message('Settings saved');
|
||||||
{
|
}
|
||||||
storage.get('settings', function (items)
|
}
|
||||||
{
|
|
||||||
//console.log(items);
|
function loadChanges()
|
||||||
if (items.settings)
|
{
|
||||||
{
|
storage.get('settings', function (items)
|
||||||
settings = items.settings;
|
{
|
||||||
//console.log("ticket_number:"+ settings.ticket_number);
|
//console.log(items);
|
||||||
ticket_number.value = settings.ticket_number;
|
if (items.settings)
|
||||||
date_select_mode.value = settings.date_auto_select.mode;
|
{
|
||||||
date_keyword.value = settings.date_auto_select.date_keyword;
|
settings = items.settings;
|
||||||
if(date_keyword.value=='""') {
|
//console.log("ticket_number:"+ settings.ticket_number);
|
||||||
date_keyword.value='';
|
ticket_number.value = settings.ticket_number;
|
||||||
}
|
date_select_mode.value = settings.date_auto_select.mode;
|
||||||
|
date_keyword.value = settings.date_auto_select.date_keyword;
|
||||||
area_select_mode.value = settings.area_auto_select.mode;
|
if(date_keyword.value=='""') {
|
||||||
area_keyword.value = settings.area_auto_select.area_keyword;
|
date_keyword.value='';
|
||||||
if(area_keyword.value=='""') {
|
}
|
||||||
area_keyword.value='';
|
|
||||||
}
|
area_select_mode.value = settings.area_auto_select.mode;
|
||||||
|
area_keyword.value = settings.area_auto_select.area_keyword;
|
||||||
keyword_exclude.value = settings.keyword_exclude;
|
if(area_keyword.value=='""') {
|
||||||
auto_reload_page_interval.value = settings.advanced.auto_reload_page_interval;
|
area_keyword.value='';
|
||||||
disable_adjacent_seat.checked = settings.advanced.disable_adjacent_seat;
|
}
|
||||||
ocr_captcha_enable.checked = settings.ocr_captcha.enable;
|
|
||||||
|
keyword_exclude.value = settings.keyword_exclude;
|
||||||
let remote_url_string = "";
|
auto_reload_page_interval.value = settings.advanced.auto_reload_page_interval;
|
||||||
let remote_url_array = [];
|
disable_adjacent_seat.checked = settings.advanced.disable_adjacent_seat;
|
||||||
if(settings.advanced.remote_url.length > 0) {
|
ocr_captcha_enable.checked = settings.ocr_captcha.enable;
|
||||||
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
|
|
||||||
}
|
let remote_url_string = "";
|
||||||
if(remote_url_array.length) {
|
let remote_url_array = [];
|
||||||
remote_url_string = remote_url_array[0];
|
if(settings.advanced.remote_url.length > 0) {
|
||||||
}
|
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
|
||||||
remote_url.value = remote_url_string;
|
}
|
||||||
|
if(remote_url_array.length) {
|
||||||
//message('Loaded saved settings.');
|
remote_url_string = remote_url_array[0];
|
||||||
} else {
|
}
|
||||||
console.log('no settings found');
|
remote_url.value = remote_url_string;
|
||||||
}
|
|
||||||
|
//message('Loaded saved settings.');
|
||||||
}
|
} else {
|
||||||
);
|
console.log('no settings found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
let messageClearTimer;
|
);
|
||||||
function message(msg)
|
}
|
||||||
{
|
|
||||||
clearTimeout(messageClearTimer);
|
async function checkUsePublicServer()
|
||||||
const message = document.querySelector('#message');
|
{
|
||||||
message.innerText = msg;
|
if(ocr_captcha_enable.checked) {
|
||||||
messageClearTimer = setTimeout(function ()
|
remote_url.value = PUBLIC_SERVER_URL;
|
||||||
{
|
} else {
|
||||||
message.innerText = '';
|
|
||||||
}, 3000);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let messageClearTimer;
|
||||||
|
function message(msg)
|
||||||
|
{
|
||||||
|
clearTimeout(messageClearTimer);
|
||||||
|
const message = document.querySelector('#message');
|
||||||
|
message.innerText = msg;
|
||||||
|
messageClearTimer = setTimeout(function ()
|
||||||
|
{
|
||||||
|
message.innerText = '';
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue