// ==UserScript==
// @name 待合室ページの画面フリーズ回避
// @namespace https://twitter.com/nyanyanya919/
// @version 0.1
// @author にゃにゃにゃ
// @description 待合室のページの表示で画面が固まり操作できなくなる問題を可能な限り回避する
// @run-at document-start
// @match https://reserve-q.tokyodisneyresort.jp/?*
// @downloadURL https://nya3.pages.dev/tools/userscripts/prevent_queue_freeze.js
// @updateURL https://nya3.pages.dev/tools/userscripts/prevent_queue_freeze.js
// @supportURL https://twitter.com/nyanyanya919/
// ==/UserScript==
(function () {
// チャレンジ中のアニメーションエリアが見えない かつ body.challenge以外のbodyが見えない
if (!document.querySelector('#divChallenge') && !document.querySelector('body:not(.challenge)')) {
// チャレンジアニメーションエリアを直接挿入
const html = `<div id="divChallenge_Content">
<div id="challenge-widget-container">
<div id="challenge-container"></div>
<div class="hidden" id="three-bar-loader-container">
<div class="three-bar-loader"></div>
<div class="three-bar-loader"></div>
<div class="three-bar-loader"></div>
</div>
</div>
</div>
`
const el = document.createElement('div');
el.id = 'divChallenge_dummy';
el.innerHTML = html;
if (document.body) {
document.body.appendChild(el);
} else {
const body = document.createElement('body');
body.appendChild(el);
document.body = body;
}
// ページ読み込み後、ダミーの内容を本来のエリアに移して削除する
window.addEventListener('load', () => {
// 本体が見えたらダミー内容をコピーしダミーを削除する
const org_el = document.querySelector('#divChallenge');
if (org_el) {
// HTMLをコピー
const dummy_el = document.querySelector('#divChallenge_dummy');
org_el.innerHTML = dummy_el.innerHTML;
// ダミーを削除
dummy_el.remove();
}
});
} else {
// 対処不要
};
})();
簡単な解説
// ==UserScript==
// @name ホテル日付指定検索エラー時のアラート表示
// @namespace https://twitter.com/nyanyanya919/
// @version 0.1
// @author にゃにゃにゃ
// @description ホテルの日付指定での検索時、空室検索処理がエラーの場合にアラートで表示する
// @run-at document-start
// @match https://reserve.tokyodisneyresort.jp/hotel/list/*
// @match https://reserve.tokyodisneyresort.jp/sp/hotel/list/*
// @downloadURL https://nya3.pages.dev/tools/userscripts/hotel_search_error_alert.js
// @updateURL https://nya3.pages.dev/tools/userscripts/hotel_search_error_alert.js
// @supportURL https://twitter.com/nyanyanya919/
// ==/UserScript==
(function () {
const checkTimeout = 5000;
const checkInterval = 100;
let startTime = new Date();
let intervalId;
// インターセプトタイミングを調整中
intervalId = setInterval(() => {
const now = new Date();
if ((now - startTime) > checkTimeout) {
clearInterval(intervalId);
return;
}
if (typeof HotelPriceStockQuery !== 'undefined') {
if (Hotel.Util.handleError) {
const orig_handleError = Hotel.Util.handleError;
Hotel.Util.handleError = function (data) {
alert('空室検索でデータエラーが発生しました\n\n再検索またはページをリロードしてください');
return orig_handleError(data);
}
}
if ($ && $.lifeobs.ajax) {
const orig_ajax = $.lifeobs.ajax;
$.lifeobs.ajax = function (e) {
// errorコールバックを定義
if (e.url.endsWith('/hotel/api/queryHotelPriceStock/') && !('stockQueryType' in (e.data ?? {})) && !(e.error)) {
e.error = function (xhr, status, error) {
if (xhr.readyState == 4) {
alert(`空室検索でエラーが発生しました\n${xhr.status} ${error}\n\n再検索またはページをリロードしてください`);
}
}
}
return orig_ajax(e);
}
}
clearInterval(intervalId);
}
}, checkInterval);
// ページ読み込み完了時に対象外ページの場合(混雑ページ等)は即終了する
window.addEventListener('load', () => {
if (!document.querySelector('form#reserveSearchForm')) {
clearInterval(intervalId);
return;
}
});
})();