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:
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_CONFIG_FILE = "settings.json"

View File

@ -22,7 +22,7 @@ import sys
import threading
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_CONFIG_FILE = "settings.json"

View File

@ -40,7 +40,7 @@ try:
except Exception as exc:
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_CONFIG_FILE = "settings.json"

View File

@ -1,32 +1,40 @@
function get_target_area_with_order(settings, matched_block)
{
//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")
target_area = matched_block.first();
target_area = matched_block[0];
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")
target_area = matched_block.first();
target_area = matched_block[center_index];
if(settings.area_auto_select.mode=="random")
target_area = matched_block.first();
target_area = matched_block[0];
}
return target_area;
}
function get_target_date_with_order(settings, matched_block)
{
//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")
target_date = matched_block.first();
target_area = matched_block[0];
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")
target_date = matched_block.first();
target_area = matched_block[center_index];
if(settings.date_auto_select.mode=="random")
target_date = matched_block.first();
target_area = matched_block[0];
}
return target_area;
}

View File

@ -45,11 +45,10 @@ function kktix_area_keyword(settings, base_info, register_info)
}
}
// console.log(area_keyword_array);
let target_area = [];
let target_area = null;
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();
@ -65,12 +64,15 @@ function kktix_area_keyword(settings, base_info, register_info)
}
}
} else {
let query_string = "div.ticket-unit";
let matched_block=$(query_string);
let matched_block=[];
$("div.ticket-unit").each(function ()
{
matched_block.push($(this));
});
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 link_id = first_node.attr("id");
//console.log("link_id: " + link_id);

View File

@ -36,14 +36,18 @@ function tixcraft_area_keyword(settings)
}
}
// console.log(area_keyword_array);
let target_area=[];
let target_area=null;
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);
let matched_block=[];
$(query_string).each(function ()
{
matched_block.push($(this));
});
target_area = get_target_area_with_order(settings, matched_block);
if (target_area.length) {
console.log("match keyword:" + area_keyword_array[i]);
@ -52,11 +56,15 @@ function tixcraft_area_keyword(settings)
}
} else {
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);
}
if (target_area.length) {
if (target_area) {
let link_id = target_area.attr("id");
//console.log("link_id: " + link_id);
if(link_id) {

View File

@ -35,27 +35,35 @@ function date_keyword(settings)
}
}
//console.log(date_keyword_array);
let target_date;
let target_date=null;
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);
let matched_block=[];
$(query_string).each(function ()
{
matched_block.push($(this));
});
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]);
break;
}
}
} else {
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);
}
if (target_date.length) {
if (target_date) {
let button_tag = "button";
const currentUrl = window.location.href;
const domain = currentUrl.split('/')[2];

View File

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