更新 pokemon_cafe.js

This commit is contained in:
2024-03-07 07:29:24 +00:00
parent c588533656
commit eae1847ac5

View File

@@ -1,9 +1,9 @@
// ==UserScript==
// @name pokemon
// @namespace http://tampermonkey.net/
// @version 2024-01-25
// @name pokemon_cafe_script
// @namespace https://git.moonjuice.tw/moonjuice/pokemon_script
// @version 2024-03-07
// @description try to take over the world!
// @author You
// @author moonjuice
// @match https://reserve.pokemon-cafe.jp/*
// @match https://osaka.pokemon-cafe.jp/*
// @match file:///*
@@ -11,6 +11,8 @@
// @grant GM_setValue
// @grant GM_getValue
// @run-at document-end
// @downloadURL https://git.moonjuice.tw/moonjuice/pokemon_script/raw/branch/main/pokemon_cafe.js
// @updateURL https://git.moonjuice.tw/moonjuice/pokemon_script/raw/branch/main/pokemon_cafe.js
// ==/UserScript==
(function() {
@@ -75,11 +77,14 @@
function chooseSeat() {
var seatId = -1;
GM_setValue('seat', '0');
GM_setValue('seatId', seatId);
if ($('.post-link').length && $('.post-link').length > 0) {
//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 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 (location.hostname.startsWith('reserve')) { // tokyo => c seat first
var seats_1450 = Array.from($('.post-link')).filter((element) => element.text.includes('14:50'));
/*if (seats_1450.length > 0) {
GM_setValue('seat', seats_1450[0].text);
seatId = seats_1450[0].getAttribute('data-seat-id');
@@ -96,7 +101,19 @@ function chooseSeat() {
GM_setValue('seat', $('.post-link')[0].text);
seatId = $('.post-link')[0].getAttribute('data-seat-id');
}
GM_setValue('seatId', seatId);
} else { // osaka => A seat first
var seats_1350 = Array.from($('.post-link')).filter((element) => element.text.includes('13:50'));
/*if (seats_1350.length > 0) {
GM_setValue('seat', seats_1350[0].text);
seatId = seats_1350[0].getAttribute('data-seat-id');
} else*/ if (a_seats.length > 0) {
GM_setValue('seat', a_seats[0].text);
seatId = a_seats[0].getAttribute('data-seat-id');
} else {
GM_setValue('seat', $('.post-link')[0].text);
seatId = $('.post-link')[0].getAttribute('data-seat-id');
}
}
}
return seatId;
}