all more rules for maxbot plus

master
Your Name 2024-04-08 14:09:30 +08:00
parent 06fb4e25ce
commit 487de32b9c
4 changed files with 81 additions and 12 deletions

View File

@ -1,3 +1,62 @@
const storage = chrome.storage.local;
var settings = null;
var myInterval = null;
// price row. // price row.
$("#salesTable > tbody > tr.Soldout").remove(); $("#salesTable > tbody > tr.Soldout").remove();
$("div.footer").remove(); $("div.footer").remove();
function kham_clean_exclude(settings)
{
console.log("kham_clean_exclude");
let exclude_keyword_array = [];
if(settings) {
if(settings.keyword_exclude.length > 0) {
if(settings.keyword_exclude != '""') {
exclude_keyword_array = JSON.parse('[' + settings.keyword_exclude +']');
}
}
}
for (let i = 0; i < exclude_keyword_array.length; i++) {
$("#salesTable > tbody > tr").each(function ()
{
let html_text=$(this).text();
let is_match_keyword=false;
if(html_text.indexOf(exclude_keyword_array[i])>-1) {
is_match_keyword=true;
}
if(is_match_keyword) {
$(this).remove();
}
}
);
}
}
function kktix_area_main() {
if(settings) {
kham_clean_exclude(settings);
}
}
storage.get('settings', function (items)
{
if (items.settings)
{
settings = items.settings;
}
});
storage.get('status', function (items)
{
if (items.status && items.status=='ON')
{
kktix_area_main();
} else {
//console.log('maxbot status is not ON');
}
});

View File

@ -2,7 +2,7 @@ const storage = chrome.storage.local;
var settings = null; var settings = null;
var myInterval = null; var myInterval = null;
function kktix_clean_exclude(settings, register_info) function kktix_clean_exclude(settings)
{ {
let exclude_keyword_array = []; let exclude_keyword_array = [];
if(settings) { if(settings) {
@ -63,7 +63,7 @@ function clean_sold_out_row(register_info, base_info)
$("body").append(register_info_div); $("body").append(register_info_div);
let base_info_div="<div style='display:none' id='base_info'>" + JSON.stringify(base_info) + "</div>"; let base_info_div="<div style='display:none' id='base_info'>" + JSON.stringify(base_info) + "</div>";
$("body").append(base_info_div); $("body").append(base_info_div);
kktix_clean_exclude(settings, register_info); kktix_clean_exclude(settings);
//kktix_area_keyword(settings, register_info); //kktix_area_keyword(settings, register_info);
} }
} }

View File

@ -52,12 +52,12 @@ chrome.runtime.onMessage.addListener((message) => {
function ticket_set_ocr_answer(answer) function ticket_set_ocr_answer(answer)
{ {
console.log("answer:"+answer); //console.log("answer:"+answer);
if(answer.length > 0) { if(answer.length > 0) {
const currentUrl = window.location.href; const currentUrl = window.location.href;
const domain = currentUrl.split('/')[2]; const domain = currentUrl.split('/')[2];
const scrip_page = currentUrl.split('/')[5]; const scrip_page = currentUrl.split('/')[5];
if(answer.length == 4) { if(answer.length == 4) {
answer = answer.toUpperCase(); answer = answer.toUpperCase();
let query_string = "div.form-group input[autocomplete='off']"; let query_string = "div.form-group input[autocomplete='off']";
@ -82,11 +82,11 @@ function ticket_set_ocr_answer(answer)
if(ocr_type && ocr_type.length > 0) { if(ocr_type && ocr_type.length > 0) {
let new_image_src = "/pic.aspx?TYPE="+ ocr_type +"&ts=" + new Date().getTime(); let new_image_src = "/pic.aspx?TYPE="+ ocr_type +"&ts=" + new Date().getTime();
$("#chk_pic").attr("src", new_image_src); $("#chk_pic").attr("src", new_image_src);
let remote_url_string = get_remote_url(settings); let remote_url_string = get_remote_url(settings);
myInterval = setInterval(() => { myInterval = setInterval(() => {
ticket_orc_image_ready(remote_url_string); ticket_orc_image_ready(remote_url_string);
}, 400); }, 400);
} }
} }
@ -102,7 +102,7 @@ async function ticket_get_ocr_answer(api_url, image_data)
'image_data':image_data, 'image_data':image_data,
} }
}; };
let bundle_string = JSON.stringify(bundle); let bundle_string = JSON.stringify(bundle);
const return_answer = await chrome.runtime.sendMessage(bundle); const return_answer = await chrome.runtime.sendMessage(bundle);
//console.log(return_answer); //console.log(return_answer);
@ -155,13 +155,22 @@ function get_remote_url(settings)
return remote_url_string; return remote_url_string;
} }
function ticket_assign_ticket(settings)
{
if(settings) {
$('div.qty-select input[type="text"]').val(settings.ticket_number);
}
}
storage.get('status', function (items) storage.get('status', function (items)
{ {
if (items.status && items.status=='ON') if (items.status && items.status=='ON')
{ {
//console.log("ticket_number:"+ settings.ticket_number); //console.log("ticket_number:"+ settings.ticket_number);
//ticket_assign_adjacent_seat(settings.advanced.disable_adjacent_seat); //ticket_assign_adjacent_seat(settings.advanced.disable_adjacent_seat);
ticket_assign_ticket(settings);
// ocr // ocr
if(settings.ocr_captcha.enable) { if(settings.ocr_captcha.enable) {
let remote_url_string = get_remote_url(settings); let remote_url_string = get_remote_url(settings);
@ -174,7 +183,7 @@ storage.get('status', function (items)
// no orc, just focus; // no orc, just focus;
ticket_focus_on_captcha(); ticket_focus_on_captcha();
} }
} else { } else {
console.log('no status found'); console.log('no status found');
} }
}); });

View File

@ -209,7 +209,8 @@
}, },
{ {
"matches": [ "matches": [
"https://kham.com.tw/application/UTK02/UTK0204_.aspx?*" "https://kham.com.tw/application/UTK02/UTK0204_.aspx?*",
"https://kham.com.tw/application/UTK02/UTK0201_000.aspx?PERFORMANCE_ID=*&PRODUCT_ID=*"
], ],
"run_at": "document_end", "run_at": "document_end",
"js": [ "js": [