更新 pokemon_cafe.js

This commit is contained in:
2024-03-06 10:27:32 +00:00
parent b905ca1b31
commit c588533656

View File

@@ -5,6 +5,7 @@
// @description try to take over the world! // @description try to take over the world!
// @author You // @author You
// @match https://reserve.pokemon-cafe.jp/* // @match https://reserve.pokemon-cafe.jp/*
// @match https://osaka.pokemon-cafe.jp/*
// @match file:///* // @match file:///*
// @icon https://reserve.pokemon-cafe.jp/assets/favicon-fa237093863d556ccbcc35094a79472be555cd11f4a1a7e16dc7a0a5cd71675c.ico // @icon https://reserve.pokemon-cafe.jp/assets/favicon-fa237093863d556ccbcc35094a79472be555cd11f4a1a7e16dc7a0a5cd71675c.ico
// @grant GM_setValue // @grant GM_setValue
@@ -16,7 +17,7 @@
'use strict'; 'use strict';
const guest = 4; const guest = 4;
// Your code here... // Your code here...
if ($('.button.arrow-down') != null && $('.button.arrow-down').length != 0) { /*if ($('.button.arrow-down') != null && $('.button.arrow-down').length != 0) {
if (Array.isArray($('.button.arrow-down'))) { if (Array.isArray($('.button.arrow-down'))) {
if ($('.button.arrow-down')[0].text.includes('Reloading')) { if ($('.button.arrow-down')[0].text.includes('Reloading')) {
$('.button.arrow-down')[0].click(); $('.button.arrow-down')[0].click();
@@ -26,6 +27,11 @@
$('.button.arrow-down').click(); $('.button.arrow-down').click();
} }
} }
}*/
if (document.getElementsByClassName('button arrow-down').length == 1) {
if (document.getElementsByClassName('button arrow-down')[0].text.includes('Reloading')) {
document.getElementsByClassName('button arrow-down')[0].click();
}
} }
if('/' == location.pathname) { if('/' == location.pathname) {
@@ -41,6 +47,8 @@
} else { } else {
let dt = new Date(); let dt = new Date();
dt.setDate(dt.getDate() + 31); dt.setDate(dt.getDate() + 31);
//dt.setMonth(2);
//dt.setDate(1);
dt.setHours(17); dt.setHours(17);
dt.setMinutes(0); dt.setMinutes(0);
$('input[name=date]')[0].value = dt; $('input[name=date]')[0].value = dt;
@@ -54,35 +62,41 @@
$('#hidden-form')[0].submit(); $('#hidden-form')[0].submit();
} else { } else {
console.log('no seat'); console.log('no seat');
$('.button.button-secondary')[0].click();
} }
} else { } else {
/*if (GM_getValue('seatId') != -1) {
alert('快!!');
}*/
console.log(GM_getValue('seat')); console.log(GM_getValue('seat'));
console.log(GM_getValue('seatId')); console.log(GM_getValue('seatId'));
} }
})(); })();
function chooseSeat() { function chooseSeat() {
var seatId = -1;
if ($('.post-link').length && $('.post-link').length > 0) { if ($('.post-link').length && $('.post-link').length > 0) {
var seatId = -1; //var seats_1450 = Array.from($('.post-link')).filter((element) => element.text.includes('14:50'));
var c_seats = Array.from($('.post-link')).filter((element) => element.text.includes('C')); var c_seats = Array.from($('.post-link')).filter((element) => element.text.includes('C'));
var d_seats = Array.from($('.post-link')).filter((element) => element.text.includes('D')); var d_seats = Array.from($('.post-link')).filter((element) => element.text.includes('D'));
var a_seats = Array.from($('.post-link')).filter((element) => element.text.includes('A')); var a_seats = Array.from($('.post-link')).filter((element) => element.text.includes('A'));
if (c_seats.length > 0) { /*if (seats_1450.length > 0) {
GM_setValue('seat', c_seats[0]); GM_setValue('seat', seats_1450[0].text);
seatId = seats_1450[0].getAttribute('data-seat-id');
} else*/ if (c_seats.length > 0) {
GM_setValue('seat', c_seats[0].text);
seatId = c_seats[0].getAttribute('data-seat-id'); seatId = c_seats[0].getAttribute('data-seat-id');
} else if (d_seats.length > 0) { } else if (d_seats.length > 0) {
GM_setValue('seat', d_seats[0]); GM_setValue('seat', d_seats[0].text);
seatId = d_seats[0].getAttribute('data-seat-id'); seatId = d_seats[0].getAttribute('data-seat-id');
} else if (a_seats.length > 0) { } else if (a_seats.length > 0) {
GM_setValue('seat', a_seats[0]); GM_setValue('seat', a_seats[0].text);
seatId = a_seats[0].getAttribute('data-seat-id'); seatId = a_seats[0].getAttribute('data-seat-id');
} else { } else {
GM_setValue('seat', $('.post-link')[0]); GM_setValue('seat', $('.post-link')[0].text);
seatId = $('.post-link')[0].getAttribute('data-seat-id'); seatId = $('.post-link')[0].getAttribute('data-seat-id');
} }
GM_setValue('seatId', seatId); GM_setValue('seatId', seatId);
return seatId;
} else {
return -1;
} }
return seatId;
} }