新增 pokemon_cafe.js
This commit is contained in:
88
pokemon_cafe.js
Normal file
88
pokemon_cafe.js
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name pokemon
|
||||||
|
// @namespace http://tampermonkey.net/
|
||||||
|
// @version 2024-01-25
|
||||||
|
// @description try to take over the world!
|
||||||
|
// @author You
|
||||||
|
// @match https://reserve.pokemon-cafe.jp/*
|
||||||
|
// @match file:///*
|
||||||
|
// @icon https://reserve.pokemon-cafe.jp/assets/favicon-fa237093863d556ccbcc35094a79472be555cd11f4a1a7e16dc7a0a5cd71675c.ico
|
||||||
|
// @grant GM_setValue
|
||||||
|
// @grant GM_getValue
|
||||||
|
// @run-at document-end
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
const guest = 4;
|
||||||
|
// Your code here...
|
||||||
|
if ($('.button.arrow-down') != null && $('.button.arrow-down').length != 0) {
|
||||||
|
if (Array.isArray($('.button.arrow-down'))) {
|
||||||
|
if ($('.button.arrow-down')[0].text.includes('Reloading')) {
|
||||||
|
$('.button.arrow-down')[0].click();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($('.button.arrow-down').text.length != 1 && $('.button.arrow-down').text.includes('Reloading')) {
|
||||||
|
$('.button.arrow-down').click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if('/' == location.pathname) {
|
||||||
|
$('#agreeChecked')[0].click();
|
||||||
|
$('.button-container-agree > button')[0].click();
|
||||||
|
} else if ('/reserve/auth_confirm' == location.pathname) {
|
||||||
|
$('.button.arrow-down')[0].click();
|
||||||
|
//location.href = 'https://reserve.pokemon-cafe.jp/reserve/step1';
|
||||||
|
} else if ('/reserve/step1' == location.pathname) {
|
||||||
|
if ($('select')[0].value == 0) {
|
||||||
|
$('select')[0].options[guest].selected = true;
|
||||||
|
$('select')[0].onchange();
|
||||||
|
} else {
|
||||||
|
let dt = new Date();
|
||||||
|
dt.setDate(dt.getDate() + 31);
|
||||||
|
dt.setHours(17);
|
||||||
|
dt.setMinutes(0);
|
||||||
|
$('input[name=date]')[0].value = dt;
|
||||||
|
$('input[name=commit]')[0].click();
|
||||||
|
}
|
||||||
|
} else if ('/reserve/step2' == location.pathname) {
|
||||||
|
const seatId = chooseSeat();
|
||||||
|
if (seatId != -1) {
|
||||||
|
$('input[name=seat_id]')[0].value = chooseSeat();
|
||||||
|
$('input[name=guest]')[0].value = guest;
|
||||||
|
$('#hidden-form')[0].submit();
|
||||||
|
} else {
|
||||||
|
console.log('no seat');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(GM_getValue('seat'));
|
||||||
|
console.log(GM_getValue('seatId'));
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
function chooseSeat() {
|
||||||
|
if ($('.post-link').length && $('.post-link').length > 0) {
|
||||||
|
var seatId = -1;
|
||||||
|
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 a_seats = Array.from($('.post-link')).filter((element) => element.text.includes('A'));
|
||||||
|
if (c_seats.length > 0) {
|
||||||
|
GM_setValue('seat', c_seats[0]);
|
||||||
|
seatId = c_seats[0].getAttribute('data-seat-id');
|
||||||
|
} else if (d_seats.length > 0) {
|
||||||
|
GM_setValue('seat', d_seats[0]);
|
||||||
|
seatId = d_seats[0].getAttribute('data-seat-id');
|
||||||
|
} else if (a_seats.length > 0) {
|
||||||
|
GM_setValue('seat', a_seats[0]);
|
||||||
|
seatId = a_seats[0].getAttribute('data-seat-id');
|
||||||
|
} else {
|
||||||
|
GM_setValue('seat', $('.post-link')[0]);
|
||||||
|
seatId = $('.post-link')[0].getAttribute('data-seat-id');
|
||||||
|
}
|
||||||
|
GM_setValue('seatId', seatId);
|
||||||
|
return seatId;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user