2024-01-19, update for kktix

master
Your Name 2024-02-07 16:30:17 +08:00
parent 237bf68882
commit 7d62422d80
8 changed files with 62 additions and 39 deletions

View File

@ -41,7 +41,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.01.18)" CONST_APP_VERSION = "MaxBot (2024.01.19)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -22,7 +22,7 @@ import sys
import threading import threading
import webbrowser import webbrowser
CONST_APP_VERSION = "MaxBot (2024.01.18)" CONST_APP_VERSION = "MaxBot (2024.01.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"

View File

@ -40,7 +40,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.01.18)" CONST_APP_VERSION = "MaxBot (2024.01.19)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -1,32 +1,40 @@
function get_target_area_with_order(settings, matched_block) function get_target_area_with_order(settings, matched_block)
{ {
//console.log(settings); //console.log(settings);
let target_area = []; let target_area = null;
if(matched_block.length) {
let last_index = matched_block.length-1
let center_index = parseInt(last_index/2);
if(settings.area_auto_select.mode=="from top to bottom") if(settings.area_auto_select.mode=="from top to bottom")
target_area = matched_block.first(); target_area = matched_block[0];
if(settings.area_auto_select.mode=="from bottom to top") if(settings.area_auto_select.mode=="from bottom to top")
target_area = matched_block.last(); target_area = matched_block[last_index];
if(settings.area_auto_select.mode=="center") if(settings.area_auto_select.mode=="center")
target_area = matched_block.first(); target_area = matched_block[center_index];
if(settings.area_auto_select.mode=="random") if(settings.area_auto_select.mode=="random")
target_area = matched_block.first(); target_area = matched_block[0];
}
return target_area; return target_area;
} }
function get_target_date_with_order(settings, matched_block) function get_target_date_with_order(settings, matched_block)
{ {
//console.log(settings); //console.log(settings);
let target_area = []; let target_area = null;
if(matched_block.length) {
let last_index = matched_block.length-1
let center_index = parseInt(last_index/2);
if(settings.date_auto_select.mode=="from top to bottom") if(settings.date_auto_select.mode=="from top to bottom")
target_date = matched_block.first(); target_area = matched_block[0];
if(settings.date_auto_select.mode=="from bottom to top") if(settings.date_auto_select.mode=="from bottom to top")
target_date = matched_block.last(); target_area = matched_block[last_index];
if(settings.date_auto_select.mode=="center") if(settings.date_auto_select.mode=="center")
target_date = matched_block.first(); target_area = matched_block[center_index];
if(settings.date_auto_select.mode=="random") if(settings.date_auto_select.mode=="random")
target_date = matched_block.first(); target_area = matched_block[0];
}
return target_area; return target_area;
} }

View File

@ -45,11 +45,10 @@ function kktix_area_keyword(settings, base_info, register_info)
} }
} }
// console.log(area_keyword_array); // console.log(area_keyword_array);
let target_area = []; let target_area = null;
if(area_keyword_array.length) { if(area_keyword_array.length) {
for (let i = 0; i < area_keyword_array.length; i++) { for (let i = 0; i < area_keyword_array.length; i++) {
let matched_block=[]; let matched_block=[];
$("div.ticket-unit").each(function () $("div.ticket-unit").each(function ()
{ {
let html_text=$(this).text(); let html_text=$(this).text();
@ -65,12 +64,15 @@ function kktix_area_keyword(settings, base_info, register_info)
} }
} }
} else { } else {
let query_string = "div.ticket-unit"; let matched_block=[];
let matched_block=$(query_string); $("div.ticket-unit").each(function ()
{
matched_block.push($(this));
});
target_area = get_target_area_with_order(settings, matched_block); target_area = get_target_area_with_order(settings, matched_block);
} }
if (target_area.length) { if (target_area) {
let first_node = target_area.find(":first-child"); let first_node = target_area.find(":first-child");
let link_id = first_node.attr("id"); let link_id = first_node.attr("id");
//console.log("link_id: " + link_id); //console.log("link_id: " + link_id);

View File

@ -36,14 +36,18 @@ function tixcraft_area_keyword(settings)
} }
} }
// console.log(area_keyword_array); // console.log(area_keyword_array);
let target_area=[]; let target_area=null;
if(area_keyword_array.length) { if(area_keyword_array.length) {
for (let i = 0; i < area_keyword_array.length; i++) { for (let i = 0; i < area_keyword_array.length; i++) {
let query_string = "ul.area-list > li > a:contains('"+ area_keyword_array[i] +"')"; let query_string = "ul.area-list > li > a:contains('"+ area_keyword_array[i] +"')";
if(area_keyword_array[i]=="") { if(area_keyword_array[i]=="") {
query_string = "ul.area-list > li > a" query_string = "ul.area-list > li > a"
} }
let matched_block=$(query_string); let matched_block=[];
$(query_string).each(function ()
{
matched_block.push($(this));
});
target_area = get_target_area_with_order(settings, matched_block); target_area = get_target_area_with_order(settings, matched_block);
if (target_area.length) { if (target_area.length) {
console.log("match keyword:" + area_keyword_array[i]); console.log("match keyword:" + area_keyword_array[i]);
@ -52,11 +56,15 @@ function tixcraft_area_keyword(settings)
} }
} else { } else {
let query_string = "ul.area-list > li > a"; let query_string = "ul.area-list > li > a";
let matched_block=$(query_string); let matched_block=[];
$(query_string).each(function ()
{
matched_block.push($(this));
});
target_area = get_target_area_with_order(settings, matched_block); target_area = get_target_area_with_order(settings, matched_block);
} }
if (target_area.length) { if (target_area) {
let link_id = target_area.attr("id"); let link_id = target_area.attr("id");
//console.log("link_id: " + link_id); //console.log("link_id: " + link_id);
if(link_id) { if(link_id) {

View File

@ -35,27 +35,35 @@ function date_keyword(settings)
} }
} }
//console.log(date_keyword_array); //console.log(date_keyword_array);
let target_date; let target_date=null;
if(date_keyword_array.length) { if(date_keyword_array.length) {
for (let i = 0; i < date_keyword_array.length; i++) { for (let i = 0; i < date_keyword_array.length; i++) {
let query_string = "#gameList td:contains('"+ date_keyword_array[i] +"')"; let query_string = "#gameList td:contains('"+ date_keyword_array[i] +"')";
if(date_keyword_array[i]=="") { if(date_keyword_array[i]=="") {
query_string = "#gameList td" query_string = "#gameList td"
} }
let matched_block=$(query_string); let matched_block=[];
$(query_string).each(function ()
{
matched_block.push($(this));
});
target_date = get_target_date_with_order(settings, matched_block); target_date = get_target_date_with_order(settings, matched_block);
if (target_date.length) { if (target_date) {
console.log("match keyword:" + date_keyword_array[i]); console.log("match keyword:" + date_keyword_array[i]);
break; break;
} }
} }
} else { } else {
let query_string = "#gameList td"; let query_string = "#gameList td";
let matched_block=$(query_string); let matched_block=[];
$(query_string).each(function ()
{
matched_block.push($(this));
});
target_date = get_target_area_with_order(settings, matched_block); target_date = get_target_area_with_order(settings, matched_block);
} }
if (target_date.length) { if (target_date) {
let button_tag = "button"; let button_tag = "button";
const currentUrl = window.location.href; const currentUrl = window.location.href;
const domain = currentUrl.split('/')[2]; const domain = currentUrl.split('/')[2];

View File

@ -159,7 +159,6 @@
"run_at": "document_end", "run_at": "document_end",
"js": [ "js": [
"jquery.min.js", "jquery.min.js",
"js/common.js",
"js/ticket_area.js" "js/ticket_area.js"
] ]
}, },
@ -173,7 +172,6 @@
"run_at": "document_end", "run_at": "document_end",
"js": [ "js": [
"jquery.min.js", "jquery.min.js",
"js/common.js",
"js/ticket_ticket.js" "js/ticket_ticket.js"
] ]
}, },
@ -386,10 +384,9 @@
"run_at": "document_start", "run_at": "document_start",
"js": [ "js": [
"jquery.min.js", "jquery.min.js",
"js/common.js",
"js/kktix_registrations_reload.js" "js/kktix_registrations_reload.js"
] ]
} }
], ],
"version": "1.0.10" "version": "1.0.11"
} }