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