2024-01-18, update for kktix verification
parent
d79bd8dfa3
commit
04d2d8c171
|
@ -41,7 +41,7 @@ try:
|
|||
except Exception as exc:
|
||||
pass
|
||||
|
||||
CONST_APP_VERSION = "MaxBot (2024.01.17)"
|
||||
CONST_APP_VERSION = "MaxBot (2024.01.18)"
|
||||
|
||||
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||
|
@ -4583,13 +4583,27 @@ def get_kktix_control_label_text(driver):
|
|||
|
||||
captcha_inner_div = None
|
||||
try:
|
||||
captcha_inner_div = driver.find_element(By.CSS_SELECTOR, 'div.ticket-unit > div.code-input > div.control-group > label.control-label')
|
||||
captcha_inner_div = driver.find_element(By.CSS_SELECTOR, 'div > div.code-input > div.control-group > label.control-label')
|
||||
if not captcha_inner_div is None:
|
||||
question_text = remove_html_tags(captcha_inner_div.get_attribute('innerHTML'))
|
||||
except Exception as exc:
|
||||
pass
|
||||
return question_text
|
||||
|
||||
def set_kktix_control_label_text(driver, config_dict):
|
||||
fail_list = []
|
||||
answer_list = get_answer_list_from_user_guess_string(config_dict)
|
||||
inferred_answer_string = ""
|
||||
for answer_item in answer_list:
|
||||
if not answer_item in fail_list:
|
||||
inferred_answer_string = answer_item
|
||||
break
|
||||
input_text_css = 'div > div.code-input > div.control-group > div.controls > label > input[type="text"]'
|
||||
next_step_button_css = '#registrationsNewApp div.form-actions button.btn-primary'
|
||||
submit_by_enter = False
|
||||
check_input_interval = 0.2
|
||||
is_answer_sent, fail_list = fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_list, input_text_css, next_step_button_css, submit_by_enter, check_input_interval)
|
||||
|
||||
def get_kktix_question_text(driver):
|
||||
question_text = ""
|
||||
|
||||
|
@ -4720,6 +4734,10 @@ def kktix_reg_new_main(driver, config_dict, fail_list, captcha_sound_played, is_
|
|||
print("control_text:", control_text)
|
||||
if len(control_text) == 0:
|
||||
click_ret = kktix_press_next_button(driver)
|
||||
else:
|
||||
#set_kktix_control_label_text(driver, config_dict)
|
||||
# input by maxbox plus extension.
|
||||
pass
|
||||
else:
|
||||
if is_need_refresh:
|
||||
try:
|
||||
|
|
|
@ -22,7 +22,7 @@ import sys
|
|||
import threading
|
||||
import webbrowser
|
||||
|
||||
CONST_APP_VERSION = "MaxBot (2024.01.17)"
|
||||
CONST_APP_VERSION = "MaxBot (2024.01.18)"
|
||||
|
||||
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
|
||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||
|
|
|
@ -40,7 +40,7 @@ try:
|
|||
except Exception as exc:
|
||||
pass
|
||||
|
||||
CONST_APP_VERSION = "MaxBot (2024.01.17)"
|
||||
CONST_APP_VERSION = "MaxBot (2024.01.18)"
|
||||
|
||||
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
|
||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||
|
|
|
@ -1,7 +1,40 @@
|
|||
var myInterval = null;
|
||||
//console.log("assign appear");
|
||||
|
||||
function kktix_area_keyword(settings, register_info)
|
||||
function kktix_verification_conditions(settings)
|
||||
{
|
||||
let is_text_sent = false;
|
||||
let user_guess_string_array = [];
|
||||
if(settings) {
|
||||
if(settings.advanced.user_guess_string.length > 0) {
|
||||
if(settings.advanced.user_guess_string!='""') {
|
||||
user_guess_string_array = JSON.parse('[' + settings.advanced.user_guess_string +']');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let target_row=null;
|
||||
let all_row = $("div.control-group > div.controls > label > input[type='text']");
|
||||
if (all_row.length > 0 && user_guess_string_array.length > 0)
|
||||
{
|
||||
//console.log("input count:" + all_row.length);
|
||||
let travel_index=0;
|
||||
all_row.each(function ()
|
||||
{
|
||||
let current_index = all_row.index(this);
|
||||
//console.log("current_index:" + current_index);
|
||||
if(current_index+1 <= user_guess_string_array.length) {
|
||||
//console.log("input data:" + user_guess_string_array[current_index]);
|
||||
$(this).val(user_guess_string_array[current_index]);
|
||||
is_text_sent = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return is_text_sent;
|
||||
}
|
||||
|
||||
function kktix_area_keyword(settings, base_info, register_info)
|
||||
{
|
||||
let area_keyword_array = [];
|
||||
if(settings) {
|
||||
|
@ -50,6 +83,7 @@ function kktix_area_keyword(settings, register_info)
|
|||
});
|
||||
|
||||
let seat_inventory_key=link_id.split("_")[1];
|
||||
//console.log("seat_inventory_key:"+seat_inventory_key);
|
||||
let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key];
|
||||
let ticket_number = settings.ticket_number;
|
||||
if(seat_inventory_number<ticket_number) {
|
||||
|
@ -58,6 +92,7 @@ function kktix_area_keyword(settings, register_info)
|
|||
|
||||
if(ticket_number>0) {
|
||||
/*
|
||||
// trigger events by jQuery.
|
||||
let target_input = target_area.find("input");
|
||||
target_input.click();
|
||||
target_input.prop("value", ticket_number);
|
||||
|
@ -69,13 +104,51 @@ function kktix_area_keyword(settings, register_info)
|
|||
up.key=""+ticket_number;
|
||||
target_input.trigger(up);
|
||||
*/
|
||||
|
||||
//console.log(base_info);
|
||||
let is_verification_conditions_popup = false;
|
||||
if(base_info && base_info.eventData.hasOwnProperty("order_qualifications")) {
|
||||
//console.log(base_info.eventData.order_qualifications.length);
|
||||
for (let i = 0; i < base_info.eventData.order_qualifications.length; i++) {
|
||||
let rs = base_info.eventData.order_qualifications[i];
|
||||
//console.log(rs);
|
||||
for(let j=0; j < rs.conditions.length; j++) {
|
||||
let rs_j = JSON.parse(rs.conditions[j]);
|
||||
//console.log(rs_j);
|
||||
if(rs_j.hasOwnProperty("ticket_ids")) {
|
||||
//console.log(rs_j.ticket_ids.length);
|
||||
for(let k=0; k < rs_j.ticket_ids.length; k++) {
|
||||
let rs_k = rs_j.ticket_ids[k]
|
||||
//console.log(rs_k);
|
||||
if(""+rs_k==seat_inventory_key) {
|
||||
is_verification_conditions_popup = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
let auto_click_next_btn = true;
|
||||
|
||||
if(is_verification_conditions_popup) {
|
||||
auto_click_next_btn = false;
|
||||
let is_text_sent = kktix_verification_conditions(settings);
|
||||
if(is_text_sent) {
|
||||
auto_click_next_btn = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(auto_click_next_btn) {
|
||||
let $next_btn = $('div.register-new-next-button-area > button');
|
||||
$next_btn.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -86,10 +159,11 @@ function kktix_area_keyword(settings, register_info)
|
|||
function begin()
|
||||
{
|
||||
let settings = JSON.parse($("#settings").html());
|
||||
let base_info = JSON.parse($("#base_info").html());
|
||||
let register_info = JSON.parse($("#register_info").html());
|
||||
//console.log(settings);
|
||||
//console.log(register_info);
|
||||
kktix_area_keyword(settings, register_info);
|
||||
kktix_area_keyword(settings, base_info, register_info);
|
||||
}
|
||||
|
||||
function dom_ready()
|
||||
|
@ -101,7 +175,7 @@ function dom_ready()
|
|||
if(myInterval) clearInterval(myInterval);
|
||||
begin();
|
||||
}
|
||||
console.log("dom_ready:"+ret);
|
||||
//console.log("dom_ready:"+ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function kktix_clean_exclude(settings, register_info)
|
|||
}
|
||||
}
|
||||
|
||||
function clean_sold_out_row(register_info)
|
||||
function clean_sold_out_row(register_info, base_info)
|
||||
{
|
||||
//console.log("clean_sold_out_row");
|
||||
|
||||
|
@ -61,13 +61,25 @@ function clean_sold_out_row(register_info)
|
|||
$("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);
|
||||
let base_info_div="<div style='display:none' id='base_info'>" + JSON.stringify(base_info) + "</div>";
|
||||
$("body").append(base_info_div);
|
||||
kktix_clean_exclude(settings, register_info);
|
||||
//kktix_area_keyword(settings, register_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function kktix_ajax_done(register_info)
|
||||
function kktix_ajax_return_base_info(base_info, register_info)
|
||||
{
|
||||
//console.log(base_info.eventData.order_qualifications);
|
||||
$(function() {
|
||||
myInterval = setInterval(() => {
|
||||
clean_sold_out_row(register_info, base_info);
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
function kktix_ajax_return_register_info(register_info)
|
||||
{
|
||||
let reload=false;
|
||||
console.log(register_info.inventory.registerStatus);
|
||||
|
@ -92,15 +104,35 @@ function kktix_ajax_done(register_info)
|
|||
}
|
||||
}
|
||||
else {
|
||||
$(function() {
|
||||
myInterval = setInterval(() => {
|
||||
clean_sold_out_row(register_info);
|
||||
}, 200);
|
||||
kktix_event_base_info(register_info);
|
||||
}
|
||||
}
|
||||
|
||||
function kktix_event_base_info(register_info)
|
||||
{
|
||||
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 +"/base_info";
|
||||
$.get( api_url, function() {
|
||||
//alert( "success" );
|
||||
})
|
||||
.done(function(data) {
|
||||
//alert( "second success" );
|
||||
kktix_ajax_return_base_info(data, register_info);
|
||||
})
|
||||
.fail(function() {
|
||||
//alert( "error" );
|
||||
})
|
||||
.always(function() {
|
||||
//alert( "finished" );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function kktix_event_status_check()
|
||||
function kktix_event_register_info()
|
||||
{
|
||||
const currentUrl = window.location.href;
|
||||
const event_code = currentUrl.split('/')[4];
|
||||
|
@ -113,7 +145,7 @@ function kktix_event_status_check()
|
|||
})
|
||||
.done(function(data) {
|
||||
//alert( "second success" );
|
||||
kktix_ajax_done(data);
|
||||
kktix_ajax_return_register_info(data);
|
||||
})
|
||||
.fail(function() {
|
||||
//alert( "error" );
|
||||
|
@ -136,7 +168,7 @@ storage.get('status', function (items)
|
|||
{
|
||||
if (items.status && items.status=='ON')
|
||||
{
|
||||
kktix_event_status_check();
|
||||
kktix_event_register_info();
|
||||
} else {
|
||||
console.log('no status found');
|
||||
}
|
||||
|
|
|
@ -391,5 +391,5 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"version": "1.0.9"
|
||||
"version": "1.0.10"
|
||||
}
|
Loading…
Reference in New Issue