2024-01-18 17:35:42 +00:00
|
|
|
var myInterval = null;
|
2024-04-10 05:50:23 +00:00
|
|
|
var checkboxInterval = null;
|
2024-01-18 17:35:42 +00:00
|
|
|
//console.log("assign appear");
|
|
|
|
|
2024-03-29 09:29:39 +00:00
|
|
|
function kktix_verification_conditions(settings)
|
2024-02-07 03:29:16 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-04-10 05:50:23 +00:00
|
|
|
function kktix_agree()
|
|
|
|
{
|
|
|
|
$('input[type=checkbox]:not(:checked)').each(function() {
|
|
|
|
$(this).click();
|
|
|
|
if(checkboxInterval) clearInterval(checkboxInterval);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-05-11 04:23:43 +00:00
|
|
|
function kktix_area_keyword(settings)
|
2024-01-18 17:35:42 +00:00
|
|
|
{
|
|
|
|
let area_keyword_array = [];
|
|
|
|
if(settings) {
|
|
|
|
if(settings.area_auto_select.area_keyword.length > 0) {
|
|
|
|
if(settings.area_auto_select.area_keyword!='""') {
|
|
|
|
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(area_keyword_array);
|
2024-02-07 08:30:17 +00:00
|
|
|
let target_area = null;
|
2024-04-07 05:13:31 +00:00
|
|
|
let matched_block=[];
|
2024-04-11 09:52:16 +00:00
|
|
|
let query_string = "div.ticket-unit";
|
2024-01-18 17:35:42 +00:00
|
|
|
if(area_keyword_array.length) {
|
|
|
|
for (let i = 0; i < area_keyword_array.length; i++) {
|
2024-04-11 09:52:16 +00:00
|
|
|
$(query_string).each(function ()
|
2024-01-18 17:35:42 +00:00
|
|
|
{
|
|
|
|
let html_text=$(this).text();
|
|
|
|
if(html_text.indexOf(area_keyword_array[i])>-1) {
|
|
|
|
matched_block.push($(this));
|
|
|
|
}
|
|
|
|
target_area = get_target_area_with_order(settings, matched_block);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (matched_block.length) {
|
|
|
|
console.log("match keyword:" + area_keyword_array[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2024-04-11 09:52:16 +00:00
|
|
|
$(query_string).each(function ()
|
2024-02-07 08:30:17 +00:00
|
|
|
{
|
|
|
|
matched_block.push($(this));
|
|
|
|
});
|
2024-01-18 17:35:42 +00:00
|
|
|
target_area = get_target_area_with_order(settings, matched_block);
|
|
|
|
}
|
|
|
|
|
2024-02-07 08:30:17 +00:00
|
|
|
if (target_area) {
|
2024-01-18 17:35:42 +00:00
|
|
|
let first_node = target_area.find(":first-child");
|
|
|
|
let link_id = first_node.attr("id");
|
|
|
|
//console.log("link_id: " + link_id);
|
|
|
|
if(link_id) {
|
|
|
|
let seat_inventory_key=link_id.split("_")[1];
|
2024-02-07 03:29:16 +00:00
|
|
|
//console.log("seat_inventory_key:"+seat_inventory_key);
|
2024-01-18 17:35:42 +00:00
|
|
|
let ticket_number = settings.ticket_number;
|
|
|
|
|
|
|
|
if(ticket_number>0) {
|
|
|
|
/*
|
2024-02-07 03:29:16 +00:00
|
|
|
// trigger events by jQuery.
|
2024-01-18 17:35:42 +00:00
|
|
|
let target_input = target_area.find("input");
|
|
|
|
target_input.click();
|
|
|
|
target_input.prop("value", ticket_number);
|
|
|
|
let down = $.Event('keydown');
|
|
|
|
down.key=""+ticket_number;
|
|
|
|
target_input.trigger(down);
|
|
|
|
|
|
|
|
let up = $.Event('keyup');
|
|
|
|
up.key=""+ticket_number;
|
|
|
|
target_input.trigger(up);
|
|
|
|
*/
|
2024-02-07 03:29:16 +00:00
|
|
|
|
|
|
|
//console.log(base_info);
|
|
|
|
let is_verification_conditions_popup = false;
|
|
|
|
|
2024-01-18 17:35:42 +00:00
|
|
|
let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]');
|
|
|
|
for(let i=0; i<ticket_number; i++) {
|
|
|
|
add_button.click();
|
|
|
|
}
|
|
|
|
|
2024-04-12 08:35:46 +00:00
|
|
|
let auto_click_next_btn = settings.kktix.auto_press_next_step_button;
|
2024-03-29 09:29:39 +00:00
|
|
|
|
2024-04-12 08:35:46 +00:00
|
|
|
if(auto_click_next_btn) {
|
|
|
|
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;
|
|
|
|
}
|
2024-02-07 03:29:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-07 05:13:31 +00:00
|
|
|
let hide_other_row = false;
|
2024-02-07 03:29:16 +00:00
|
|
|
if(auto_click_next_btn) {
|
|
|
|
let $next_btn = $('div.register-new-next-button-area > button');
|
2024-03-30 03:59:49 +00:00
|
|
|
if($next_btn) {
|
|
|
|
if($next_btn.length>1) {
|
|
|
|
$next_btn.last().click();
|
|
|
|
} else {
|
|
|
|
$next_btn.click();
|
|
|
|
}
|
2024-04-07 05:13:31 +00:00
|
|
|
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();
|
|
|
|
}
|
2024-03-30 03:59:49 +00:00
|
|
|
}
|
2024-02-07 03:29:16 +00:00
|
|
|
}
|
2024-01-18 17:35:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
console.log("not target_area found.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function begin()
|
|
|
|
{
|
|
|
|
let settings = JSON.parse($("#settings").html());
|
2024-03-29 09:29:39 +00:00
|
|
|
$("#settings").remove();
|
2024-01-18 17:35:42 +00:00
|
|
|
//console.log(settings);
|
2024-03-29 09:29:39 +00:00
|
|
|
|
2024-05-11 04:23:43 +00:00
|
|
|
//kktix_area_keyword(settings);
|
2024-01-18 17:35:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function dom_ready()
|
|
|
|
{
|
|
|
|
let ret=false;
|
|
|
|
//console.log("checking...");
|
|
|
|
if($("#settings").length>0) {
|
|
|
|
ret=true;
|
|
|
|
if(myInterval) clearInterval(myInterval);
|
|
|
|
begin();
|
|
|
|
}
|
2024-02-07 03:29:16 +00:00
|
|
|
//console.log("dom_ready:"+ret);
|
2024-01-18 17:35:42 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2024-04-04 13:06:25 +00:00
|
|
|
const rootElement = document.documentElement;
|
|
|
|
if(rootElement) {
|
|
|
|
if(!dom_ready()) {
|
|
|
|
myInterval = setInterval(() => {
|
|
|
|
dom_ready();
|
2024-04-07 05:13:31 +00:00
|
|
|
}, 200);
|
2024-04-10 05:50:23 +00:00
|
|
|
|
|
|
|
checkboxInterval= setInterval(() => {
|
|
|
|
//console.log("kktix_agree")
|
|
|
|
kktix_agree();
|
|
|
|
}, 200);
|
2024-04-04 13:06:25 +00:00
|
|
|
}
|
2024-04-04 22:40:56 +00:00
|
|
|
$("footer").remove();
|
|
|
|
$("div.banner-wrapper div.img-wrapper img").remove();
|
2024-01-18 17:35:42 +00:00
|
|
|
}
|
2024-03-29 09:29:39 +00:00
|
|
|
|
|
|
|
|