diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js
index 2c63eb4..97ca49d 100644
--- a/torn-trans-zhcn.user.js
+++ b/torn-trans-zhcn.user.js
@@ -1,8 +1,8 @@
// ==UserScript==
-// @lastmodified 202112290010
+// @lastmodified 202112291622
// @name Torn翻译
// @namespace WOOH
-// @version 0.1.1229a
+// @version 0.1.1229b
// @description Torn UI翻译
// @author Woohoo-[2687093] sabrina_devil[2696209]
// @match https://www.torn.com/*
@@ -23,6 +23,11 @@
todo: true,
cont: `baza npc商店 imarket及imarket搜索结果`,
},
+ {
+ ver: '0.1.1229b',
+ date: '20211229',
+ cont: `修复小镇提示的错误`,
+ },
{
ver: '0.1.1229a',
date: '20211229',
@@ -2887,7 +2892,6 @@
quichAttIndex: 2,
isDev: false,
};
- // const quickAttArr = ['pri', 'sec', 'wea', 'gre', 'fis', 'kic'];
initIcon();
addStyle(`#wh-trans-icon{
display: inline-block;
@@ -5371,7 +5375,7 @@ padding:16px !important;
圣诞小镇
*/
if (window.location.href.contains(/christmas_town\.php/)) {
- const $root = document.querySelector('#christmastownroot');
+ let $root = document.querySelector('#christmastownroot');
if (wh_trans_settings.transEnable) {
const $title_wrapper = $root.querySelector('div[class^="appHeaderWrapper___"]');
// 标题和右边的链接
@@ -5712,12 +5716,12 @@ margin: 0 0 3px;
-
-
-
+
+
+
-
- 如果长时间不清空数据会有奇怪的bug
+
- 长时间不清空会出现奇怪的问题
@@ -5806,15 +5810,22 @@ margin: 0 0 3px;
const soundIntervalID = window.setInterval(() => {
if (soundLoopFlag) $audio.play().then();
}, 1200);
- ob.observe($ct_wrap, {childList: true, subtree: true});
+ ob.observe($root, {childList: true, subtree: true});
}
});
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 $pos = $ct_wrap.querySelector('.map-title span[class^="position___"]') || $ct_wrap.querySelector('.status-title span[class^="position___"]');
if (!$pos) {
- ob.observe($ct_wrap, {childList: true, subtree: true});
+ ob.observe($root, {childList: true, subtree: true});
return;
}
const $pos_spl = $pos.innerText.trim().split(',');
@@ -5824,7 +5835,7 @@ margin: 0 0 3px;
const $wh_loot_container = $root.querySelector('#wh-loot-container');
if (!$wh_loot_container) {
console.error('掉落助手未找到DOM容器');
- ob.observe($ct_wrap, {childList: true, subtree: true});
+ ob.observe($root, {childList: true, subtree: true});
return;
}
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
@@ -5909,7 +5920,7 @@ margin: 0 0 3px;
});
$tbody.innerHTML = table_html;
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});
}
diff --git a/torn-wh-show-loot-pos.user.js b/torn-wh-show-loot-pos.user.js
index fc18d4c..328c747 100644
--- a/torn-wh-show-loot-pos.user.js
+++ b/torn-wh-show-loot-pos.user.js
@@ -18,7 +18,7 @@
const $ = ___window___.jQuery;
if (/christmas_town\.php/.test(window.location.href)) {
- const $root = document.querySelector('#christmastownroot');
+ let $root = document.querySelector('#christmastownroot');
const chestTypeDict = {'1': '金', '2': '银', '3': '铜',};
const chestTypeColorDict = {'1': 'gold', '2': 'silver', '3': 'sandybrown',};
const lootTypeDict = {'chests': '钥匙箱', 'gifts': '礼物', 'combinationChest': '密码箱', 'keys': '钥匙',};
@@ -45,15 +45,15 @@
-
-
-
-
+
+
+
+
-
- 如果长时间不清空数据会有奇怪的bug
+
- 长时间不清空会出现奇怪的问题
-
+
@@ -64,7 +64,9 @@
#wh-loot-container-main div span img{height: 1em; width: 1em;}
#wh-loot-container-ex{padding: 0.5em;}
#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 tbody {background-color: antiquewhite;}
#wh-loot-container-ex table, #wh-loot-container-ex th, #wh-loot-container-ex td {
padding: 5px;
border: 1px solid black;
@@ -137,13 +139,24 @@
const soundIntervalID = window.setInterval(() => {
if (soundLoopFlag) $audio.play().then();
}, 1200);
- ob.observe($ct_wrap, {childList: true, subtree: true});
+ ob.observe($root, {childList: true, subtree: true});
}
});
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 $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 player_position = {};
player_position.x = parseInt($pos_spl[0]);
@@ -151,6 +164,7 @@
const $wh_loot_container = $root.querySelector('#wh-loot-container');
if (!$wh_loot_container) {
console.error('掉落助手未找到DOM容器');
+ ob.observe($root, {childList: true, subtree: true});
return;
}
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
@@ -209,7 +223,7 @@
dropHist[hist_key] = {
pos: `[${nearby_item.x},${nearby_item.y}]`,
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,
id: Object.keys(dropHist).length,
};
@@ -235,8 +249,8 @@
});
$tbody.innerHTML = table_html;
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
+ ob.observe($root, {childList: true, subtree: true});
});
getDOMOb.observe($root, {childList: true, subtree: true});
}
-
}());