2024-03-25, update for kktix racing with web drver

master
CHUN YU YAO 2024-04-07 13:13:31 +08:00
parent a5aca31d7a
commit 949d192b36
7 changed files with 38 additions and 14 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc)
pass
CONST_APP_VERSION = "MaxBot (2024.03.24)"
CONST_APP_VERSION = "MaxBot (2024.03.25)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -24,7 +24,7 @@ import webbrowser
import util
CONST_APP_VERSION = "MaxBot (2024.03.24)"
CONST_APP_VERSION = "MaxBot (2024.03.25)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -29,7 +29,7 @@ from datetime import datetime
import util
CONST_APP_VERSION = "MaxBot (2024.03.24)"
CONST_APP_VERSION = "MaxBot (2024.03.25)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc)
pass
CONST_APP_VERSION = "MaxBot (2024.03.24)"
CONST_APP_VERSION = "MaxBot (2024.03.25)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

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

View File

@ -5,7 +5,12 @@ function get_target_area_with_order(settings, matched_block)
if(matched_block.length) {
let last_index = matched_block.length-1
let center_index = parseInt(last_index/2);
let center_index = 0;
let random_index = 0;
if(matched_block.length>1) {
center_index = parseInt(last_index/2);
random_index = getRandom(0,last_index)
}
if(settings.area_auto_select.mode=="from top to bottom")
target_area = matched_block[0];
if(settings.area_auto_select.mode=="from bottom to top")
@ -13,7 +18,7 @@ function get_target_area_with_order(settings, matched_block)
if(settings.area_auto_select.mode=="center")
target_area = matched_block[center_index];
if(settings.area_auto_select.mode=="random")
target_area = matched_block[0];
target_area = matched_block[random_index];
}
return target_area;
}
@ -25,7 +30,12 @@ function get_target_date_with_order(settings, matched_block)
if(matched_block.length) {
let last_index = matched_block.length-1
let center_index = parseInt(last_index/2);
let center_index = 0;
let random_index = 0;
if(matched_block.length>1) {
center_index = parseInt(last_index/2);
random_index = getRandom(0,last_index)
}
if(settings.date_auto_select.mode=="from top to bottom")
target_area = matched_block[0];
if(settings.date_auto_select.mode=="from bottom to top")
@ -33,8 +43,12 @@ function get_target_date_with_order(settings, matched_block)
if(settings.date_auto_select.mode=="center")
target_area = matched_block[center_index];
if(settings.date_auto_select.mode=="random")
target_area = matched_block[0];
target_area = matched_block[random_index];
}
return target_area;
}
function getRandom(min,max){
return Math.floor(Math.random()*(max-min+1))+min;
};

View File

@ -46,9 +46,9 @@ function kktix_area_keyword(settings, base_info, register_info)
}
// console.log(area_keyword_array);
let target_area = null;
let matched_block=[];
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();
@ -64,7 +64,6 @@ function kktix_area_keyword(settings, base_info, register_info)
}
}
} else {
let matched_block=[];
$("div.ticket-unit").each(function ()
{
matched_block.push($(this));
@ -147,6 +146,7 @@ function kktix_area_keyword(settings, base_info, register_info)
}
}
let hide_other_row = false;
if(auto_click_next_btn) {
let $next_btn = $('div.register-new-next-button-area > button');
if($next_btn) {
@ -155,6 +155,17 @@ function kktix_area_keyword(settings, base_info, register_info)
} else {
$next_btn.click();
}
hide_other_row = true;
}
}
// due to racing with web driver.
if(hide_other_row) {
for (let i = 0; i < matched_block.length; i++) {
if(target_area!=matched_block[i])
{
matched_block[i].remove();
}
}
}
}
@ -196,9 +207,8 @@ if(rootElement) {
if(!dom_ready()) {
myInterval = setInterval(() => {
dom_ready();
}, 400);
}, 200);
}
$("footer").remove();
$("div.banner-wrapper div.img-wrapper img").remove();
}