修复小镇提示的错误
This commit is contained in:
parent
e79f094fce
commit
b98663abb9
@ -1,8 +1,8 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @lastmodified 202112290010
|
// @lastmodified 202112291622
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1229a
|
// @version 0.1.1229b
|
||||||
// @description Torn UI翻译
|
// @description Torn UI翻译
|
||||||
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
@ -23,6 +23,11 @@
|
|||||||
todo: true,
|
todo: true,
|
||||||
cont: `baza npc商店 imarket及imarket搜索结果`,
|
cont: `baza npc商店 imarket及imarket搜索结果`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ver: '0.1.1229b',
|
||||||
|
date: '20211229',
|
||||||
|
cont: `修复小镇提示的错误`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ver: '0.1.1229a',
|
ver: '0.1.1229a',
|
||||||
date: '20211229',
|
date: '20211229',
|
||||||
@ -2887,7 +2892,6 @@
|
|||||||
quichAttIndex: 2,
|
quichAttIndex: 2,
|
||||||
isDev: false,
|
isDev: false,
|
||||||
};
|
};
|
||||||
// const quickAttArr = ['pri', 'sec', 'wea', 'gre', 'fis', 'kic'];
|
|
||||||
initIcon();
|
initIcon();
|
||||||
addStyle(`#wh-trans-icon{
|
addStyle(`#wh-trans-icon{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -5371,7 +5375,7 @@ padding:16px !important;
|
|||||||
圣诞小镇
|
圣诞小镇
|
||||||
*/
|
*/
|
||||||
if (window.location.href.contains(/christmas_town\.php/)) {
|
if (window.location.href.contains(/christmas_town\.php/)) {
|
||||||
const $root = document.querySelector('#christmastownroot');
|
let $root = document.querySelector('#christmastownroot');
|
||||||
if (wh_trans_settings.transEnable) {
|
if (wh_trans_settings.transEnable) {
|
||||||
const $title_wrapper = $root.querySelector('div[class^="appHeaderWrapper___"]');
|
const $title_wrapper = $root.querySelector('div[class^="appHeaderWrapper___"]');
|
||||||
// 标题和右边的链接
|
// 标题和右边的链接
|
||||||
@ -5712,12 +5716,12 @@ margin: 0 0 3px;
|
|||||||
<div id="wh-loot-container-chests"></div>
|
<div id="wh-loot-container-chests"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="wh-loot-container-ex" class="cont-gray wh-hide">
|
<div id="wh-loot-container-ex" class="cont-gray wh-hide">
|
||||||
<div><input type="checkbox" id="wh-loot-setting-blink" ${alertSettings.blink === 'y' ? 'checked' : ''} /><label for="wh-loot-setting-blink">闪烁提示</label></div>
|
<div><label><input type="checkbox" id="wh-loot-setting-blink" ${alertSettings.blink === 'y' ? 'checked' : ''} /> 闪烁提示</label></div>
|
||||||
<div><input type="checkbox" id="wh-loot-setting-sound" ${alertSettings.sound === 'y' ? 'checked' : ''} /><label for="wh-loot-setting-sound">声音提示(不支持iOS)</label></div>
|
<div><label><input type="checkbox" id="wh-loot-setting-sound" ${alertSettings.sound === 'y' ? 'checked' : ''} /> 声音提示 <del>(iOS)</del></label></div>
|
||||||
<div><input type="checkbox" id="wh-loot-setting-chest" ${alertSettings.chest === 'y' ? 'checked' : ''} /><label for="wh-loot-setting-chest">不记录需要钥匙的宝箱</label></div>
|
<div><label><input type="checkbox" id="wh-loot-setting-chest" ${alertSettings.chest === 'y' ? 'checked' : ''} /> 不记录需要钥匙的宝箱</label></div>
|
||||||
<div id="wh-hist">
|
<div id="wh-hist">
|
||||||
<div id="wh-hist-clear">
|
<div id="wh-hist-clear">
|
||||||
<p><button>清空数据</button>- 如果长时间不清空数据会有奇怪的bug</p>
|
<p><button>清空数据</button>- 长时间不清空会出现奇怪的问题</p>
|
||||||
</div>
|
</div>
|
||||||
<table><thead><tr><th colspan="5">历史记录</th></tr><tr><th>坐标</th><th>地图</th><th>类型</th><th>发现</th><th>获取</th></tr></thead><tbody></tbody></table>
|
<table><thead><tr><th colspan="5">历史记录</th></tr><tr><th>坐标</th><th>地图</th><th>类型</th><th>发现</th><th>获取</th></tr></thead><tbody></tbody></table>
|
||||||
</div>
|
</div>
|
||||||
@ -5806,15 +5810,22 @@ margin: 0 0 3px;
|
|||||||
const soundIntervalID = window.setInterval(() => {
|
const soundIntervalID = window.setInterval(() => {
|
||||||
if (soundLoopFlag) $audio.play().then();
|
if (soundLoopFlag) $audio.play().then();
|
||||||
}, 1200);
|
}, 1200);
|
||||||
ob.observe($ct_wrap, {childList: true, subtree: true});
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const ob = new MutationObserver(() => {
|
const ob = new MutationObserver(() => {
|
||||||
ob.disconnect();
|
ob.disconnect();
|
||||||
|
// 页面刷新重新获取dom
|
||||||
|
$root = document.querySelector('#christmastownroot');
|
||||||
|
$ct_wrap = $root.querySelector('#ct-wrap');
|
||||||
|
if (!$ct_wrap) {
|
||||||
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const $ct_title = $ct_wrap.querySelector('.status-title');
|
const $ct_title = $ct_wrap.querySelector('.status-title');
|
||||||
const $pos = $ct_wrap.querySelector('.map-title span[class^="position___"]') || $ct_wrap.querySelector('.status-title span[class^="position___"]');
|
const $pos = $ct_wrap.querySelector('.map-title span[class^="position___"]') || $ct_wrap.querySelector('.status-title span[class^="position___"]');
|
||||||
if (!$pos) {
|
if (!$pos) {
|
||||||
ob.observe($ct_wrap, {childList: true, subtree: true});
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const $pos_spl = $pos.innerText.trim().split(',');
|
const $pos_spl = $pos.innerText.trim().split(',');
|
||||||
@ -5824,7 +5835,7 @@ margin: 0 0 3px;
|
|||||||
const $wh_loot_container = $root.querySelector('#wh-loot-container');
|
const $wh_loot_container = $root.querySelector('#wh-loot-container');
|
||||||
if (!$wh_loot_container) {
|
if (!$wh_loot_container) {
|
||||||
console.error('掉落助手未找到DOM容器');
|
console.error('掉落助手未找到DOM容器');
|
||||||
ob.observe($ct_wrap, {childList: true, subtree: true});
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
|
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
|
||||||
@ -5909,7 +5920,7 @@ margin: 0 0 3px;
|
|||||||
});
|
});
|
||||||
$tbody.innerHTML = table_html;
|
$tbody.innerHTML = table_html;
|
||||||
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
|
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
|
||||||
ob.observe($ct_wrap, {childList: true, subtree: true});
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
});
|
});
|
||||||
getDOMOb.observe($root, {childList: true, subtree: true});
|
getDOMOb.observe($root, {childList: true, subtree: true});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
const $ = ___window___.jQuery;
|
const $ = ___window___.jQuery;
|
||||||
|
|
||||||
if (/christmas_town\.php/.test(window.location.href)) {
|
if (/christmas_town\.php/.test(window.location.href)) {
|
||||||
const $root = document.querySelector('#christmastownroot');
|
let $root = document.querySelector('#christmastownroot');
|
||||||
const chestTypeDict = {'1': '金', '2': '银', '3': '铜',};
|
const chestTypeDict = {'1': '金', '2': '银', '3': '铜',};
|
||||||
const chestTypeColorDict = {'1': 'gold', '2': 'silver', '3': 'sandybrown',};
|
const chestTypeColorDict = {'1': 'gold', '2': 'silver', '3': 'sandybrown',};
|
||||||
const lootTypeDict = {'chests': '钥匙箱', 'gifts': '礼物', 'combinationChest': '密码箱', 'keys': '钥匙',};
|
const lootTypeDict = {'chests': '钥匙箱', 'gifts': '礼物', 'combinationChest': '密码箱', 'keys': '钥匙',};
|
||||||
@ -45,12 +45,12 @@
|
|||||||
<div id="wh-loot-container-chests"></div>
|
<div id="wh-loot-container-chests"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="wh-loot-container-ex" class="cont-gray wh-hide">
|
<div id="wh-loot-container-ex" class="cont-gray wh-hide">
|
||||||
<div><input type="checkbox" id="wh-loot-setting-blink" ${alertSettings.blink === 'y' ? 'checked' : ''} /><label for="wh-loot-setting-blink">闪烁提示</label></div>
|
<div><label><input type="checkbox" id="wh-loot-setting-blink" ${alertSettings.blink === 'y' ? 'checked' : ''} /> 闪烁提示</label></div>
|
||||||
<div><input type="checkbox" id="wh-loot-setting-sound" ${alertSettings.sound === 'y' ? 'checked' : ''} /><label for="wh-loot-setting-sound">声音提示(不支持iOS)</label></div>
|
<div><label><input type="checkbox" id="wh-loot-setting-sound" ${alertSettings.sound === 'y' ? 'checked' : ''} /> 声音提示 <del>(iOS)</del></label></div>
|
||||||
<div><input type="checkbox" id="wh-loot-setting-chest" ${alertSettings.chest === 'y' ? 'checked' : ''} /><label for="wh-loot-setting-chest">不记录需要钥匙的宝箱</label></div>
|
<div><label><input type="checkbox" id="wh-loot-setting-chest" ${alertSettings.chest === 'y' ? 'checked' : ''} /> 不记录需要钥匙的宝箱</label></div>
|
||||||
<div>
|
<div id="wh-hist">
|
||||||
<div id="wh-hist-clear">
|
<div id="wh-hist-clear">
|
||||||
<p><button>清空数据</button>- 如果长时间不清空数据会有奇怪的bug</p>
|
<p><button>清空数据</button>- 长时间不清空会出现奇怪的问题</p>
|
||||||
</div>
|
</div>
|
||||||
<table><thead><tr><th colspan="5">历史记录</th></tr><tr><th>坐标</th><th>地图</th><th>类型</th><th>发现</th><th>获取</th></tr></thead><tbody></tbody></table>
|
<table><thead><tr><th colspan="5">历史记录</th></tr><tr><th>坐标</th><th>地图</th><th>类型</th><th>发现</th><th>获取</th></tr></thead><tbody></tbody></table>
|
||||||
</div>
|
</div>
|
||||||
@ -64,7 +64,9 @@
|
|||||||
#wh-loot-container-main div span img{height: 1em; width: 1em;}
|
#wh-loot-container-main div span img{height: 1em; width: 1em;}
|
||||||
#wh-loot-container-ex{padding: 0.5em;}
|
#wh-loot-container-ex{padding: 0.5em;}
|
||||||
#wh-loot-container-ex.wh-hide{display: none;}
|
#wh-loot-container-ex.wh-hide{display: none;}
|
||||||
|
#wh-loot-container-ex #wh-hist{overflow-x: auto;}
|
||||||
#wh-loot-container-ex table {margin-top: 0.5em;}
|
#wh-loot-container-ex table {margin-top: 0.5em;}
|
||||||
|
#wh-loot-container-ex tbody {background-color: antiquewhite;}
|
||||||
#wh-loot-container-ex table, #wh-loot-container-ex th, #wh-loot-container-ex td {
|
#wh-loot-container-ex table, #wh-loot-container-ex th, #wh-loot-container-ex td {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
@ -137,13 +139,24 @@
|
|||||||
const soundIntervalID = window.setInterval(() => {
|
const soundIntervalID = window.setInterval(() => {
|
||||||
if (soundLoopFlag) $audio.play().then();
|
if (soundLoopFlag) $audio.play().then();
|
||||||
}, 1200);
|
}, 1200);
|
||||||
ob.observe($ct_wrap, {childList: true, subtree: true});
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const ob = new MutationObserver(() => {
|
const ob = new MutationObserver(() => {
|
||||||
|
ob.disconnect();
|
||||||
|
// 页面刷新重新获取dom
|
||||||
|
$root = document.querySelector('#christmastownroot');
|
||||||
|
$ct_wrap = $root.querySelector('#ct-wrap');
|
||||||
|
if (!$ct_wrap) {
|
||||||
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const $ct_title = $ct_wrap.querySelector('.status-title');
|
const $ct_title = $ct_wrap.querySelector('.status-title');
|
||||||
const $pos = $ct_wrap.querySelector('.map-title span[class^="position___"]') || $ct_wrap.querySelector('.status-title span[class^="position___"]');
|
const $pos = $ct_wrap.querySelector('.map-title span[class^="position___"]') || $ct_wrap.querySelector('.status-title span[class^="position___"]');
|
||||||
if (!$pos) return;
|
if (!$pos) {
|
||||||
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const $pos_spl = $pos.innerText.trim().split(',');
|
const $pos_spl = $pos.innerText.trim().split(',');
|
||||||
const player_position = {};
|
const player_position = {};
|
||||||
player_position.x = parseInt($pos_spl[0]);
|
player_position.x = parseInt($pos_spl[0]);
|
||||||
@ -151,6 +164,7 @@
|
|||||||
const $wh_loot_container = $root.querySelector('#wh-loot-container');
|
const $wh_loot_container = $root.querySelector('#wh-loot-container');
|
||||||
if (!$wh_loot_container) {
|
if (!$wh_loot_container) {
|
||||||
console.error('掉落助手未找到DOM容器');
|
console.error('掉落助手未找到DOM容器');
|
||||||
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
|
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
|
||||||
@ -209,7 +223,7 @@
|
|||||||
dropHist[hist_key] = {
|
dropHist[hist_key] = {
|
||||||
pos: `[${nearby_item.x},${nearby_item.y}]`,
|
pos: `[${nearby_item.x},${nearby_item.y}]`,
|
||||||
map: $ct_title.firstChild.nodeValue.trim(),
|
map: $ct_title.firstChild.nodeValue.trim(),
|
||||||
last: `${now.getFullYear()}-${now.getMonth()+1}-${now.getDate()} ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`,
|
last: `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()} ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`,
|
||||||
name: item_name,
|
name: item_name,
|
||||||
id: Object.keys(dropHist).length,
|
id: Object.keys(dropHist).length,
|
||||||
};
|
};
|
||||||
@ -235,8 +249,8 @@
|
|||||||
});
|
});
|
||||||
$tbody.innerHTML = table_html;
|
$tbody.innerHTML = table_html;
|
||||||
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
|
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
|
||||||
|
ob.observe($root, {childList: true, subtree: true});
|
||||||
});
|
});
|
||||||
getDOMOb.observe($root, {childList: true, subtree: true});
|
getDOMOb.observe($root, {childList: true, subtree: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user