2023-12-19
parent
ee7da6a121
commit
90aac32d4b
|
@ -54,7 +54,7 @@ import webbrowser
|
||||||
|
|
||||||
import chromedriver_autoinstaller
|
import chromedriver_autoinstaller
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.12.18)"
|
CONST_APP_VERSION = "MaxBot (2023.12.19)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
|
|
@ -22,7 +22,7 @@ import sys
|
||||||
import threading
|
import threading
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.12.18)"
|
CONST_APP_VERSION = "MaxBot (2023.12.19)"
|
||||||
|
|
||||||
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
|
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
|
|
|
@ -34,7 +34,7 @@ import ssl
|
||||||
|
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.12.18)"
|
CONST_APP_VERSION = "MaxBot (2023.12.19)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
|
|
@ -27,7 +27,7 @@ import pyperclip
|
||||||
import tornado
|
import tornado
|
||||||
from tornado.web import Application
|
from tornado.web import Application
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.12.18)"
|
CONST_APP_VERSION = "MaxBot (2023.12.19)"
|
||||||
|
|
||||||
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
|
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
chrome.runtime.onInstalled.addListener(function(){
|
||||||
|
fetch("data/settings.json")
|
||||||
|
.then((resp) => resp.json())
|
||||||
|
.then((settings) =>
|
||||||
|
{
|
||||||
|
chrome.storage.local.set(
|
||||||
|
{
|
||||||
|
settings: settings
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
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
|
@ -24,7 +24,7 @@ setTimeout(function () {
|
||||||
if(data.inventory.registerStatus=='COMING_SOON') {reload=true;}
|
if(data.inventory.registerStatus=='COMING_SOON') {reload=true;}
|
||||||
if(data.inventory.registerStatus=='SOLD_OUT') {reload=true;}
|
if(data.inventory.registerStatus=='SOLD_OUT') {reload=true;}
|
||||||
//console.log(reload);
|
//console.log(reload);
|
||||||
//if(reload) {location.reload();}
|
if(reload) {location.reload();}
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
//alert( "error" );
|
//alert( "error" );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"author": "Max Yao",
|
"author": "Max Yao",
|
||||||
"name": "MaxBot",
|
"name": "MaxBot",
|
||||||
|
"description": "MaxBot Extension",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "icons/maxbot-16.png",
|
"16": "icons/maxbot-16.png",
|
||||||
"32": "icons/maxbot-32.png",
|
"32": "icons/maxbot-32.png",
|
||||||
|
@ -8,27 +9,31 @@
|
||||||
"64": "icons/maxbot-64.png",
|
"64": "icons/maxbot-64.png",
|
||||||
"128": "icons/maxbot-128.png"
|
"128": "icons/maxbot-128.png"
|
||||||
},
|
},
|
||||||
"manifest_version": 2,
|
"manifest_version": 3,
|
||||||
"background": {
|
"background": {
|
||||||
"persistent": true,
|
"service_worker": "background.js"
|
||||||
"scripts": [
|
|
||||||
"background.js"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"minimum_chrome_version": "77.0",
|
"minimum_chrome_version": "77.0",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"<all_urls>",
|
"activeTab",
|
||||||
"notifications",
|
|
||||||
"storage",
|
"storage",
|
||||||
|
"scripting",
|
||||||
"tabs",
|
"tabs",
|
||||||
"unlimitedStorage",
|
|
||||||
"webNavigation",
|
"webNavigation",
|
||||||
"webRequest",
|
"webRequest"
|
||||||
"webRequestBlocking"
|
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
"data/settings.json"
|
{
|
||||||
|
"resources": [ "data/settings.json" ],
|
||||||
|
"extension_ids": ["*"],
|
||||||
|
"matches": [ "*://*/*" ]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
|
"options_page": "options.html",
|
||||||
|
"action": {
|
||||||
|
"default_icon": "icons/maxbot-128.png",
|
||||||
|
"default_title": "MaxBot"
|
||||||
|
},
|
||||||
"content_scripts" : [
|
"content_scripts" : [
|
||||||
{
|
{
|
||||||
"matches" : [ "https://tixcraft.com/ticket/area/*" ],
|
"matches" : [ "https://tixcraft.com/ticket/area/*" ],
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
<!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">
|
||||||
|
<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 selected>Select Mode</option>
|
||||||
|
<option value="from top to bottom">from top to bottom</option>
|
||||||
|
<option value="from bottom to top">from bottom to top</option>
|
||||||
|
<option value="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 selected>Select Mode</option>
|
||||||
|
<option value="from top to bottom">from top to bottom</option>
|
||||||
|
<option value="from bottom to top">from bottom to top</option>
|
||||||
|
<option value="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 class="col-12">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" id="gridCheck">
|
||||||
|
<label class="form-check-label" for="gridCheck">
|
||||||
|
Check me out
|
||||||
|
</label>
|
||||||
|
</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>
|
|
@ -0,0 +1,77 @@
|
||||||
|
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');
|
||||||
|
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.tixcraft.date_auto_select.mode = date_select_mode.value;
|
||||||
|
settings.tixcraft.date_auto_select.date_keyword = date_keyword.value;
|
||||||
|
settings.area_auto_select.mode = area_select_mode.value;
|
||||||
|
settings.area_auto_select.area_keyword = area_keyword.value;
|
||||||
|
settings.keyword_exclude = keyword_exclude.value;
|
||||||
|
|
||||||
|
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.tixcraft.date_auto_select.mode;
|
||||||
|
date_keyword.value = settings.tixcraft.date_auto_select.date_keyword;
|
||||||
|
area_select_mode.value = settings.area_auto_select.mode;
|
||||||
|
area_keyword.value = settings.area_auto_select.area_keyword;
|
||||||
|
keyword_exclude.value = settings.keyword_exclude;
|
||||||
|
//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);
|
||||||
|
}
|
Loading…
Reference in New Issue