- 长时间不清空会出现奇怪的问题
@@ -5836,7 +5862,7 @@ margin: 0 0 3px;
const soundIntervalID = window.setInterval(() => {
if (soundLoopFlag) $audio.play().then();
}, 1200);
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
}
});
const ob = new MutationObserver(() => {
@@ -5845,13 +5871,13 @@ margin: 0 0 3px;
$root = document.querySelector('#christmastownroot');
$ct_wrap = $root.querySelector('#ct-wrap');
if (!$ct_wrap) {
- ob.observe($root, {childList: true, subtree: true});
+ 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($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
return;
}
const $pos_spl = $pos.innerText.trim().split(',');
@@ -5861,7 +5887,7 @@ margin: 0 0 3px;
const $wh_loot_container = $root.querySelector('#wh-loot-container');
if (!$wh_loot_container) {
console.error('掉落助手未找到DOM容器');
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
return;
}
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
@@ -5872,7 +5898,7 @@ margin: 0 0 3px;
const items = $root.querySelectorAll('div.grid-layer div.items-layer div.ct-item');
// 附近的所有物品
items.forEach(el => {
- const item_props = {x: 0, y: 0, name: '', type: '', url: '',};
+ const item_props = { x: 0, y: 0, name: '', type: '', url: '', };
item_props.x = parseInt(el.style.left.replaceAll('px', '')) / 30;
item_props.y = -parseInt(el.style.top.replaceAll('px', '')) / 30;
item_props.url = el.firstElementChild.src;
@@ -5900,15 +5926,15 @@ margin: 0 0 3px;
if (nearby_item.name === 'chests') {
chest_count++;
item_name = chestTypeDict[nearby_item.type] + lootTypeDict[nearby_item.name];
- $wh_loot_container_chests.innerHTML += `
${path}[${nearby_item.x},${nearby_item.y}] ${item_name}
`
+ $wh_loot_container_chests.innerHTML += `
${ path }[${ nearby_item.x },${ nearby_item.y }] ${ item_name }
`
} else {
item_count++;
item_name = (nearby_item.name === 'keys' ? keyTypeDict[nearby_item.type] || '' : '') + lootTypeDict[nearby_item.name] || nearby_item.name;
- $wh_loot_container_items.innerHTML += `
${path}[${nearby_item.x},${nearby_item.y}] ${item_name}
`
+ $wh_loot_container_items.innerHTML += `
${ path }[${ nearby_item.x },${ nearby_item.y }] ${ item_name }
`
}
// 确认地图坐标存在
if ($ct_title) {
- const hist_key = `[${nearby_item.x},${nearby_item.y}]"${$ct_title.firstChild.nodeValue.trim()}"${item_name}`;
+ const hist_key = `[${ nearby_item.x },${ nearby_item.y }]"${ $ct_title.firstChild.nodeValue.trim() }"${ item_name }`;
const el = dropHist[hist_key];
if (el) {
if (path === '=' && (nearby_item.name === 'keys' || nearby_item.name === 'gifts')) {
@@ -5918,9 +5944,9 @@ margin: 0 0 3px;
if (!(nearby_item.name === 'chests' && $chest.checked)) {
const now = new Date();
dropHist[hist_key] = {
- pos: `[${nearby_item.x},${nearby_item.y}]`,
+ 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,
};
@@ -5928,7 +5954,7 @@ margin: 0 0 3px;
}
}
});
- $wh_loot_container.querySelector('#wh-loot-item-count').innerText = `(${item_count})`;
+ $wh_loot_container.querySelector('#wh-loot-item-count').innerText = `(${ item_count })`;
if (item_count === 0) {
$wh_loot_container_items.innerText = '暂无';
$wh_loot_container.querySelector('#wh-loot-container-main').style.animation = '';
@@ -5937,18 +5963,18 @@ margin: 0 0 3px;
if ($blink.checked) $wh_loot_container.querySelector('#wh-loot-container-main').style.animation = 'lootFoundAlert 2s infinite';
if ($sound.checked) soundLoopFlag = true;
}
- $wh_loot_container.querySelector('#wh-loot-chest-count').innerText = `(${chest_count})`;
+ $wh_loot_container.querySelector('#wh-loot-chest-count').innerText = `(${ chest_count })`;
if (chest_count === 0) $wh_loot_container_chests.innerText = '暂无';
const history = Object.keys(dropHist).map(key => dropHist[key]).sort((a, b) => a.id - b.id);
let table_html = '';
history.forEach(e => {
- table_html += `
| ${e.pos} | ${e.map} | ${e.name} | ${e.last} | ${e.isPassed ? '已取得' : '不确定'} |
`;
+ table_html += `
| ${ e.pos } | ${ e.map } | ${ e.name } | ${ e.last } | ${ e.isPassed ? '已取得' : '不确定' } |
`;
});
$tbody.innerHTML = table_html;
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
- ob.observe($root, {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 });
}
}
@@ -6206,12 +6232,12 @@ margin: 0 0 3px;
const num = /^\$[0-9,]+\b/.test(spl[3]) ? '' : spl[3].numWordTrans();
const item = num === '' ? spl[3] : spl.slice(4, -1).join(' ');
const msg = msgSpl[1] ? msgSpl[1] : null;
- e.childNodes[0].nodeValue = `你收到了 ${num} ${item},来自 `;
+ e.childNodes[0].nodeValue = `你收到了 ${ num } ${ item },来自 `;
if (e.childNodes[2]) {
e.childNodes[2].nodeValue = `。`;
}
if (msg) {
- e.childNodes[2].nodeValue = `,附带信息:${msg}。`;
+ e.childNodes[2].nodeValue = `,附带信息:${ msg }。`;
}
return;
}
@@ -6446,13 +6472,13 @@ margin: 0 0 3px;
// 工资改变
if (e.nodeValue.contains(/wage/)) {
const money = e.nodeValue.trim().slice(27, -9);
- e.nodeValue = ` 的老板) 将你的每日工资改为 ${money}。`;
+ e.nodeValue = ` 的老板) 将你的每日工资改为 ${ money }。`;
return;
}
// 职位改变
if (e.nodeValue.contains(/rank/)) {
const pos = e.nodeValue.trim().slice(27, -1);
- e.nodeValue = ` 的老板) 将你的公司职位改为 ${pos}。`;
+ e.nodeValue = ` 的老板) 将你的公司职位改为 ${ pos }。`;
return;
}
if (e.nodeValue.contains(/assigned/)) {
@@ -6464,7 +6490,7 @@ margin: 0 0 3px;
const spl = e.nodeValue.trim().split(' ');
const pri = spl[10];
const sec = spl[13].slice(0, -1);
- e.nodeValue = ` 的老板) 从公司训练了你。你获得了 50 ${eventsDict[pri]} 和 25 ${eventsDict[sec]}。`;
+ e.nodeValue = ` 的老板) 从公司训练了你。你获得了 50 ${ eventsDict[pri] } 和 25 ${ eventsDict[sec] }。`;
}
}
}
@@ -6479,12 +6505,12 @@ margin: 0 0 3px;
$(e).contents().each((i, e) => {
if (e.nodeType === 3) {
if (eventsDict[e.nodeValue.trim()]) {
- e.nodeValue = ` ${eventsDict[e.nodeValue.trim()]} `;
+ e.nodeValue = ` ${ eventsDict[e.nodeValue.trim()] } `;
} else {
if (e.nodeValue.contains(/bounty reward/)) {
const bountyAmount = e.nodeValue.trim().split(' ')[3];
if (eventsDict['and earned your'] && eventsDict['bounty reward']) {
- e.nodeValue = ` ${eventsDict['and earned your']} ${bountyAmount} ${eventsDict['bounty reward']}`;
+ e.nodeValue = ` ${ eventsDict['and earned your'] } ${ bountyAmount } ${ eventsDict['bounty reward'] }`;
}
}
}
@@ -6509,7 +6535,7 @@ margin: 0 0 3px;
let others = e.childNodes[2].nodeValue.split(' ')[10];
others = others === 'one' ? '1' : others;
e.firstChild.nodeValue = '你被 ';
- e.childNodes[2].nodeValue = ` 选中参与一项组织犯罪(OC)。你和另外${others}人将组成一个团队,在${time}小时后进行 `;
+ e.childNodes[2].nodeValue = ` 选中参与一项组织犯罪(OC)。你和另外${ others }人将组成一个团队,在${ time }小时后进行 `;
e.childNodes[3].firstChild.nodeValue = ocList[OCName] ? ocList[OCName] : OCName;
e.childNodes[4].nodeValue = '。';
return;
@@ -6529,7 +6555,7 @@ margin: 0 0 3px;
rs = '失败';
OCName = e.firstChild.nodeValue.slice(27, -30);
}
- e.firstChild.nodeValue = `你和团队的组织犯罪(OC) ${ocList[OCName] ? ocList[OCName] : OCName} ${rs}了!`;
+ e.firstChild.nodeValue = `你和团队的组织犯罪(OC) ${ ocList[OCName] ? ocList[OCName] : OCName } ${ rs }了!`;
e.childNodes[1].firstChild.nodeValue = '点此查看详情';
e.childNodes[2].nodeValue = '!';
return;
@@ -6590,7 +6616,7 @@ margin: 0 0 3px;
const num = spl[3] === 'a' ? '1' : spl[3];
const price = reasonSpl[0].split(' ').slice(-1)[0];
const reason = reasonSpl[1] ? reasonSpl[1] : null;
- const trans = `${someone ? '某人' : ' '}对你进行了 ${num} 次赏金为 ${price} 的悬赏${reason ? ',原因:' + reason : ''}`;
+ const trans = `${ someone ? '某人' : ' ' }对你进行了 ${ num } 次赏金为 ${ price } 的悬赏${ reason ? ',原因:' + reason : '' }`;
// 匿名悬赏
if (someone) {
$(e).text(trans);
@@ -6642,7 +6668,7 @@ margin: 0 0 3px;
return spl.length === 1 ? [spl[0], null] : [spl[0], spl.slice(1).join(' ')];
})();
if (num && item) {
- e.lastChild.nodeValue = ` 从帮派军械库中借给你 ${num.numWordTrans()} ${item}。`;
+ e.lastChild.nodeValue = ` 从帮派军械库中借给你 ${ num.numWordTrans() } ${ item }。`;
}
return;
}
@@ -6705,7 +6731,7 @@ margin: 0 0 3px;
*/
if ($(e).text().contains(/You have successfully purchased membership in/)) {
const gymName = e.firstChild.nodeValue.trim().slice(46, -1);
- e.firstChild.nodeValue = `你已购买【${gymList[gymName]}】健身房会员卡。`;
+ e.firstChild.nodeValue = `你已购买【${ gymList[gymName] }】健身房会员卡。`;
return;
}
@@ -6715,7 +6741,7 @@ margin: 0 0 3px;
if ($(e).text().contains(/You are now known in the city as a/)) {
const trans = '现在你在这个城市中被称为';
const title = $(e).text().trim().split(' ').slice(9).join(' ').slice(0, -1);
- $(e).text(`${trans} ${title}。`);
+ $(e).text(`${ trans } ${ title }。`);
return;
}
@@ -6750,7 +6776,7 @@ margin: 0 0 3px;
*/
if ($(e).text().indexOf('new virus') >= 0) {
const virusName = e.firstChild.nodeValue.split(' ').slice(3, 5).join(' ');
- e.firstChild.nodeValue = `你完成了 ${virusName},它现在在你的物品库存中。你可以`;
+ e.firstChild.nodeValue = `你完成了 ${ virusName },它现在在你的物品库存中。你可以`;
e.childNodes[1].firstChild.nodeValue = '点此';
e.childNodes[2].nodeValue = '开始编程一个新的病毒。';
return;
@@ -6764,9 +6790,9 @@ margin: 0 0 3px;
const bookTitle = item2.contains(/a book titled/) ? item2.slice(15, -1) : null;
if (bookTitle) {
- $(e).text(`你在家门口发现了 ${item1.numWordTrans()} 和《${bookTitle}》。`);
+ $(e).text(`你在家门口发现了 ${ item1.numWordTrans() } 和《${ bookTitle }》。`);
} else {
- $(e).text(`你在家门口发现了 ${item1.numWordTrans()} 和 ${item2.numWordTrans()}。`);
+ $(e).text(`你在家门口发现了 ${ item1.numWordTrans() } 和 ${ item2.numWordTrans() }。`);
}
return;
}
@@ -6788,7 +6814,7 @@ margin: 0 0 3px;
if ($(e).text().contains(/accepted your proposal, you are now engaged/)) {
const spouse = $(e).children(':first').text().trim();
if (e.childNodes[1]) {
- e.childNodes[1].nodeValue = ` 接受了你的求婚,你现在和 ${spouse} 订婚了!前往`;
+ e.childNodes[1].nodeValue = ` 接受了你的求婚,你现在和 ${ spouse } 订婚了!前往`;
}
if (e.childNodes[2] && e.childNodes[2].firstChild) {
e.childNodes[2].firstChild.nodeValue = `这里`;
@@ -6816,7 +6842,7 @@ margin: 0 0 3px;
return;
}
e.firstChild.nodeValue = '你在 ';
- e.childNodes[2].nodeValue = ` 的职位从 ${prePos} 变为 ${curPos}。`;
+ e.childNodes[2].nodeValue = ` 的职位从 ${ prePos } 变为 ${ curPos }。`;
return;
}
@@ -6825,9 +6851,9 @@ margin: 0 0 3px;
*/
if ($(e).text().indexOf('join the faction') >= 0) {
const rsName = e.childNodes[2].nodeValue.trim().split(' ')[2];
- const rsDict = {'accepted': '通过', 'declined': '拒绝',};
+ const rsDict = { 'accepted': '通过', 'declined': '拒绝', };
e.firstChild.nodeValue = '加入帮派 ';
- e.childNodes[2].nodeValue = ` 的申请已${rsDict[rsName]}。`;
+ e.childNodes[2].nodeValue = ` 的申请已${ rsDict[rsName] }。`;
return;
}
});
@@ -6880,7 +6906,7 @@ margin: 0 0 3px;
* 发钱翻译
*/
function sendCashTrans(domPath = '', buttonClass = '.send-cash') {
- const sc = $(`${domPath} ${buttonClass} *`);
+ const sc = $(`${ domPath } ${ buttonClass } *`);
if (sc.length === 0) return;
sc.contents().each((i, e) => {
if (e.nodeType === 1) {
@@ -6938,7 +6964,7 @@ margin: 0 0 3px;
if (!missionDict._taskHint[task_name]) return '暂无,请联系开发者';
const task = missionDict._taskHint[task_name].task || null;
const hint = missionDict._taskHint[task_name].hint || null;
- return `${task ? '任务要求:' + task : '暂无,请联系
Woohoo'}${hint ? '
提示:' + hint : ''}`;
+ return `${ task ? '任务要求:' + task : '暂无,请联系
Woohoo' }${ hint ? '
提示:' + hint : '' }`;
}
/*
@@ -6962,7 +6988,7 @@ margin: 0 0 3px;
// 绿字 物品效果
const $item_effect = $item_info.querySelector('div.item-effect');
if (itemNameDict[the_removed]) {
- $item_name.innerText = `${itemNameDict[the_removed]}(${the_removed})`;
+ $item_name.innerText = `${ itemNameDict[the_removed] }(${ the_removed })`;
}
if (itemTypeDict[$item_type.nodeValue.trim()]) {
$item_type.nodeValue = itemTypeDict[$item_type.nodeValue.trim()];
@@ -7040,7 +7066,7 @@ margin: 0 0 3px;
芜湖助手
-
当前版本: ${version.slice(-1) === '$' ? 'DEV' : version}
+
当前版本: ${ version.slice(-1) === '$' ? 'DEV' : version }
@@ -7100,7 +7126,7 @@ margin: 0 0 3px;
// 直接复制的按钮
node.querySelector('button').onclick = async (e) => {
e.target.innerHTML = '加载中';
- const js_text = await COFetch(`https://jjins.github.io/fyfuzhi/release.min.user.js?${performance.now()}`);
+ const js_text = await COFetch(`https://jjins.github.io/fyfuzhi/release.min.user.js?${ performance.now() }`);
e.target.innerHTML = '点击复制到剪切板';
e.target.onclick = () => {
const textarea_node = document.createElement('textarea');
@@ -7120,7 +7146,7 @@ margin: 0 0 3px;
zhong_node.querySelectorAll('#wh-trans-fest-date button').forEach((el, i) => i === 0
? el.addEventListener('click', () => {
let html = '
';
- menu_list.fest_date_list.sort().forEach(date => html += `| ${1 + (date.slice(0, 2) | 0)}月${date.slice(2)}日 | ${menu_list.fest_date_dict[date].name} | ${menu_list.fest_date_dict[date].eff} |
`);
+ menu_list.fest_date_list.sort().forEach(date => html += `| ${ 1 + (date.slice(0, 2) | 0) }月${ date.slice(2) }日 | ${ menu_list.fest_date_dict[date].name } | ${ menu_list.fest_date_dict[date].eff } |
`);
popupMsg(html += '
', '节日');
})
: el.addEventListener('click', null));
@@ -7129,7 +7155,7 @@ margin: 0 0 3px;
? el.addEventListener('click', () => {
let html = '
';
menu_list.events.forEach(el =>
- html += `| ${el.name} | ${el.start[0] + 1}月${el.start[1]}日${el.start[2]}:00~${el.end[0] + 1}月${el.end[1]}日${el.end[2]}:00 |
| ${el.eff} |
`);
+ html += `| ${ el.name } | ${ el.start[0] + 1 }月${ el.start[1] }日${ el.start[2] }:00~${ el.end[0] + 1 }月${ el.end[1] }日${ el.end[2] }:00 |
| ${ el.eff } |
`);
popupMsg(html += '
更多信息请关注群聊和公众号
', '活动');
})
: el.addEventListener('click', null));
@@ -7146,7 +7172,7 @@ margin: 0 0 3px;
try {
return getWhSettingObj()['isDev'] || false;
} catch (e) {
- console.error(`[wh] dev状态错误 ${e}`);
+ console.error(`[wh] dev状态错误 ${ e }`);
return false;
}
}
@@ -7164,8 +7190,8 @@ margin: 0 0 3px;
const popup = document.createElement('div');
popup.id = 'wh-popup';
popup.innerHTML = ``;
document.body.append(popup);
const rt = popup.querySelector('#wh-popup-cont');
@@ -7202,7 +7228,7 @@ margin: 0 0 3px;
observer.disconnect();
});
})
- .observe(content.documentElement, {childList: true, subtree: true});
+ .observe(content.documentElement, { childList: true, subtree: true });
});
}
@@ -7231,12 +7257,12 @@ margin: 0 0 3px;
switch (engine) {
case UserScriptEngine.RAW: {
return new Promise((_, reject) => {
- console.error(`[wh] 跨域请求错误:${UserScriptEngine.RAW}环境下无法进行跨域请求`);
- reject(`错误:${UserScriptEngine.RAW}环境下无法进行跨域请求`);
+ console.error(`[wh] 跨域请求错误:${ UserScriptEngine.RAW }环境下无法进行跨域请求`);
+ reject(`错误:${ UserScriptEngine.RAW }环境下无法进行跨域请求`);
});
}
case UserScriptEngine.PDA: {
- const {PDA_httpGet, PDA_httpPost} = window;
+ const { PDA_httpGet, PDA_httpPost } = window;
return method === 'get' ?
// get
new Promise((resolve, reject) => {
@@ -7247,7 +7273,7 @@ margin: 0 0 3px;
PDA_httpGet(url)
.catch(e => {
console.error('[wh] 网络错误', e);
- reject(`[wh] 网络错误 ${e}`);
+ reject(`[wh] 网络错误 ${ e }`);
})
.then(res => resolve(res.responseText));
}) :
@@ -7257,10 +7283,10 @@ margin: 0 0 3px;
console.error('[wh] 跨域请求错误:PDA版本不支持');
reject('错误:PDA版本不支持');
}
- PDA_httpPost(url, {'content-type': 'application/json'}, body)
+ PDA_httpPost(url, { 'content-type': 'application/json' }, body)
.catch(e => {
console.error('[wh] 网络错误', e);
- reject(`[wh] 网络错误 ${e}`);
+ reject(`[wh] 网络错误 ${ e }`);
})
.then(res => resolve(res.responseText));
});
@@ -7275,10 +7301,10 @@ margin: 0 0 3px;
method: method,
url: url,
data: method === 'get' ? null : body,
- headers: method === 'get' ? null : {'content-type': 'application/json'},
+ headers: method === 'get' ? null : { 'content-type': 'application/json' },
onload: res => resolve(res.response),
- onerror: res => reject(`连接错误 ${JSON.stringify(res)}`),
- ontimeout: res => reject(`连接超时 ${JSON.stringify(res)}`),
+ onerror: res => reject(`连接错误 ${ JSON.stringify(res) }`),
+ ontimeout: res => reject(`连接超时 ${ JSON.stringify(res) }`),
});
});
}
@@ -7317,21 +7343,21 @@ margin: 0 0 3px;
if (!isWindowActive() || isIframe) return null;
const date = new Date();
// 通知的唯一id
- const uid = `${date.getHours()}${date.getSeconds()}${date.getMilliseconds()}${getRandomInt(1000, 9999)}`;
+ const uid = `${ date.getHours() }${ date.getSeconds() }${ date.getMilliseconds() }${ getRandomInt(1000, 9999) }`;
// 通知容器id
const node_id = 'wh-notify';
// 通知的容器
- let notify_contain = document.querySelector(`#${node_id}`);
+ let notify_contain = document.querySelector(`#${ node_id }`);
// 添加通知到容器
const add_notify = () => {
// 每条通知
const new_node = document.createElement('div');
- new_node.id = `wh-notify-${uid}`;
+ new_node.id = `wh-notify-${ uid }`;
new_node.classList.add('wh-notify-item');
new_node.innerHTML = `
`;
notify_contain.append(new_node);
notify_contain.msgInnerText = new_node.querySelector('.wh-notify-msg').innerText;
@@ -7357,7 +7383,7 @@ margin: 0 0 3px;
return;
}
progressCount--;
- progressBar.style.width = `${progressCount}%`;
+ progressBar.style.width = `${ progressCount }%`;
if (progressCount === 0) new_node.remove();
}, timeout * 1000 / 100);
new_node.querySelector('.wh-notify-close').addEventListener('click', new_node.close);
@@ -7368,7 +7394,7 @@ margin: 0 0 3px;
notify_contain = document.createElement('div');
notify_contain.id = node_id;
addStyle(`
-#${node_id} {
+#${ node_id } {
display: inline-block;
position: fixed;
top: 0;
@@ -7377,25 +7403,25 @@ margin: 0 0 3px;
z-index: 9999990;
color:#333;
}
-#${node_id} a{
+#${ node_id } a{
color:red;
text-decoration:none;
}
-#${node_id} .wh-notify-item {
+#${ node_id } .wh-notify-item {
/*height: 50px;*/
background: rgb(239 249 255 / 90%);
border-radius: 2px;
margin: 0.5em 0 0 0;
box-shadow: 0 0 5px 0px #959595;
}
-#${node_id} .wh-notify-item:hover {
+#${ node_id } .wh-notify-item:hover {
background: rgb(239 249 255 / 98%);
}
-#${node_id} .wh-notify-item .wh-notify-bar {
+#${ node_id } .wh-notify-item .wh-notify-bar {
height:2px;
background:#2196f3;
}
-#${node_id} .wh-notify-item .wh-notify-close {
+#${ node_id } .wh-notify-item .wh-notify-close {
float:right;
padding:0;
width:16px;height:16px;
@@ -7404,7 +7430,7 @@ background-size:100%;
margin: 6px 6px 0 0;
cursor: pointer;
}
-#${node_id} .wh-notify-item .wh-notify-msg {
+#${ node_id } .wh-notify-item .wh-notify-msg {
padding:12px;
}
`);
@@ -7413,7 +7439,7 @@ cursor: pointer;
const notify_obj = add_notify();
// 浏览器通知
if (window.Notification && Notification.permission === 'granted' && sysNotify) {
- const date_local_string = `[${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}]\r`;
+ const date_local_string = `[${ date.getHours() }:${ date.getMinutes() }:${ date.getSeconds() }]\r`;
notify_obj.sys_notify = new Notification('芜湖助手', {
body: date_local_string + notify_contain.msgInnerText,
requireInteraction: true,
@@ -7483,21 +7509,21 @@ z-index:100001;
});
};
notify = WHNotify('加载飞贼小助手');
- COFetch(`https://gitee.com/ameto_kasao/tornjs/raw/master/GoldenSnitch.js?${performance.now()}`)
+ COFetch(`https://gitee.com/ameto_kasao/tornjs/raw/master/GoldenSnitch.js?${ performance.now() }`)
.then(res => {
_window.eval(res.replace('http://222.160.142.50:8154/mugger', `https://api.ljs-lyt.com/mugger`));
_window.GM_setValue("gsp_x", 10);
_window.GM_setValue("gsp_y", 10);
notify.del();
- notify = WHNotify('飞贼小助手已加载', {timeout: 1});
+ notify = WHNotify('飞贼小助手已加载', { timeout: 1 });
const gsp = _docu.querySelector('#gsp');
const init = () => {
- ifr.style.height = `${gsp.offsetHeight + 10}px`;
- ifr.style.width = `${gsp.offsetWidth + 20}px`;
+ ifr.style.height = `${ gsp.offsetHeight + 10 }px`;
+ ifr.style.width = `${ gsp.offsetWidth + 20 }px`;
gsp.style.top = '10px';
gsp.style.left = '10px';
};
- new MutationObserver(init).observe(gsp, {childList: true, subtree: true});
+ new MutationObserver(init).observe(gsp, { childList: true, subtree: true });
init();
if (isDev()) _window.GM_setValue("gsp_showContent", true)
});
@@ -7524,14 +7550,14 @@ z-index:100001;
window.localStorage.setItem('wh-gs-storage', JSON.stringify(obj));
};
window.GM_xmlhttpRequest = GM_xmlhttpRequest;
- COFetch(`https://gitee.com/ameto_kasao/tornjs/raw/master/GoldenSnitch.js?${performance.now()}`)
+ COFetch(`https://gitee.com/ameto_kasao/tornjs/raw/master/GoldenSnitch.js?${ performance.now() }`)
.then(GSJS => {
window.eval(GSJS);
if (isDev()) window.GM_setValue("gsp_showContent", true);
notify.del();
notify = WHNotify('已载入飞贼助手');
})
- .catch(err => WHNotify(`PDA API错误。${Obj2Str(err)}`));
+ .catch(err => WHNotify(`PDA API错误。${ Obj2Str(err) }`));
});
} else {
WHNotify('飞贼助手已经加载了');
@@ -7574,7 +7600,7 @@ z-index:100001;
* @return {{playername: string, userID: number}}
*/
function getPlayerInfo() {
- const rs = {playername: '未知', userID: -1};
+ const rs = { playername: '未知', userID: -1 };
// const headerData = JSON.parse(sessionStorage['headerData']);
// if (!headerData['user']['state']['isLoggedIn']) return rs;
// // string
@@ -7637,7 +7663,7 @@ z-index:100001;
if (price_conf['pt'] !== -1) priceWatcherPt(apikey, price_conf['pt']).then();
if (price_conf['xan'] !== -1) priceWatcherXan(apikey, price_conf['xan']).then();
}, 10000)
- return {status: true};
+ return { status: true };
}
// pt价格监视
@@ -7659,7 +7685,7 @@ z-index:100001;
// 将id与之前存在的比较,不相同时发送通知
if (JSON.stringify(priceWatcher['watch-pt-lower-id']) !== JSON.stringify(lower_arr)) {
priceWatcher['watch-pt-lower-id'] = lower_arr;
- WHNotify(`PT新低价:$${toThousands(low)}( < $${toThousands(lower_price)}) -
点击转跳`, {
+ WHNotify(`PT新低价:$${ toThousands(low) }( < $${ toThousands(lower_price) }) -
点击转跳`, {
timeout: 6,
sysNotify: true,
sysNotifyClick: () => window.open('https://www.torn.com/pmarket.php'),
@@ -7682,7 +7708,7 @@ z-index:100001;
if (lowest_item['cost'] <= lower_price) {
if (priceWatcher['watch-xan-lower-id'] !== lowest_item['ID']) {
priceWatcher['watch-xan-lower-id'] = lowest_item['ID'];
- WHNotify(`XAN新低价:$${toThousands(lowest_item['cost'])}( < $${toThousands(lower_price)}) -
点击转跳`, {
+ WHNotify(`XAN新低价:$${ toThousands(lowest_item['cost']) }( < $${ toThousands(lower_price) }) -
点击转跳`, {
timeout: 6,
sysNotify: true,
sysNotifyClick: () => window.open('https://www.torn.com/imarket.php#/p=shop&step=shop&type=&searchname=Xanax')
@@ -7811,7 +7837,7 @@ z-index:100001;
const headerOB = new MutationObserver(_ => {
headerOB.disconnect();
headerTrans();
- headerOB.observe($('div#header-root')[0], {childList: true, subtree: true, attributes: true});
+ headerOB.observe($('div#header-root')[0], { childList: true, subtree: true, attributes: true });
});
const headerTrans = function headerTrans() {
@@ -7885,7 +7911,7 @@ z-index:100001;
});
};
headerTrans();
- headerOB.observe($('div#header-root')[0], {childList: true, subtree: true, attributes: true});
+ headerOB.observe($('div#header-root')[0], { childList: true, subtree: true, attributes: true });
}
// chatbox
@@ -7893,7 +7919,7 @@ z-index:100001;
const chatOB = new MutationObserver(_ => {
chatOB.disconnect();
chatTrans();
- chatOB.observe($('div#chatRoot').get(0), {childList: true, subtree: true, attributes: true});
+ chatOB.observe($('div#chatRoot').get(0), { childList: true, subtree: true, attributes: true });
});
const chatTrans = function chatTrans() {
// 聊天框的标题
@@ -7943,7 +7969,7 @@ z-index:100001;
}
};
chatTrans();
- chatOB.observe($('div#chatRoot').get(0), {childList: true, subtree: true, attributes: true});
+ chatOB.observe($('div#chatRoot').get(0), { childList: true, subtree: true, attributes: true });
}
// 搜索玩家的4个分类按钮
@@ -7977,7 +8003,7 @@ z-index:100001;
function travelOBInit() {
travelOB.disconnect();
travelTrans();
- travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ travelOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
}
function travelTrans() {
@@ -8002,7 +8028,7 @@ z-index:100001;
}
travelTrans();
- travelOB.observe(document.querySelector('div.content-wrapper'), {childList: true, subtree: true});
+ travelOB.observe(document.querySelector('div.content-wrapper'), { childList: true, subtree: true });
}
// 主页
@@ -8059,7 +8085,7 @@ z-index:100001;
function cityOBInit() {
cityOB.disconnect();
cityTrans();
- cityOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ cityOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
}
function cityTrans() {
@@ -8129,7 +8155,7 @@ z-index:100001;
}
cityTrans();
- cityOB.observe(document.querySelector('div.content-wrapper'), {childList: true, subtree: true});
+ cityOB.observe(document.querySelector('div.content-wrapper'), { childList: true, subtree: true });
return;
}
@@ -8140,7 +8166,7 @@ z-index:100001;
function gymOBInit() {
gymOB.disconnect();
gymTrans();
- gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true});
+ gymOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true, attributes: true });
}
function gymTrans() {
@@ -8244,7 +8270,7 @@ z-index:100001;
}
gymTrans();
- gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true});
+ gymOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true, attributes: true });
return;
}
@@ -8252,7 +8278,7 @@ z-index:100001;
if (href.contains(/item\.php/)) {
if (href.includes('item.php?temp=')) return;
// 标题和右边的链接
- initOB(document.querySelector('.content-title'), {childList: true},
+ initOB(document.querySelector('.content-title'), { childList: true },
() => {
titleTrans();
contentTitleLinksTrans();
@@ -8260,7 +8286,7 @@ z-index:100001;
// 套装预览中间的文字
const $loadouts_root = document.getElementById('loadoutsRoot');
if ($loadouts_root) {
- initOB($loadouts_root, {subtree: true, attributes: true}, () => {
+ initOB($loadouts_root, { subtree: true, attributes: true }, () => {
const el = $loadouts_root.querySelector('div[class^="type___"]');
if (el && itemPageDict[el.innerText.trim()]) {
el.innerText = itemPageDict[el.innerText.trim()];
@@ -8273,8 +8299,8 @@ z-index:100001;
subtree: true,
attributeFilter: ["aria-hidden",]
};
- const translated = {cat: '', count: -1};
- const translatedOnce = {item_opt: -1, opt_icon_count: -1};
+ const translated = { cat: '', count: -1 };
+ const translatedOnce = { item_opt: -1, opt_icon_count: -1 };
initOB(document.getElementById('category-wrap'), options, () => {
// 手机操作选项
const $item_opt = document.querySelectorAll(`ul.itemsList span.opt-name`);
@@ -8343,7 +8369,7 @@ z-index:100001;
}
// 黑框分类标题
const $items_type_name = $title_black.querySelector('span.items-name');
- initOB($items_type_name, {childList: true}, () => {
+ initOB($items_type_name, { childList: true }, () => {
if (itemPageDict[$items_type_name.innerText.trim()]) {
$items_type_name.innerText = itemPageDict[$items_type_name.innerText.trim()];
}
@@ -8363,7 +8389,7 @@ z-index:100001;
if (href.contains(/(shops|bigalgunshop)\.php/)) {
// 标题和右边的链接
const $cont_title = document.querySelector('.content-title');
- initOB($cont_title, {childList: true, subtree: true}, () => {
+ initOB($cont_title, { childList: true, subtree: true }, () => {
titleTrans();
contentTitleLinksTrans();
});
@@ -8382,7 +8408,7 @@ z-index:100001;
// 物品名
const $item_name = e.querySelector('span.desc span.name.bold');
if ($item_name && itemNameDict[$item_name.innerText.trim()]) {
- $item_name.innerText = `${itemNameDict[$item_name.innerText.trim()]}(${$item_name.innerText.trim()})`;
+ $item_name.innerText = `${ itemNameDict[$item_name.innerText.trim()] }(${ $item_name.innerText.trim() })`;
}
// 类型和存货
const $item_stock = e.querySelector('span.desc span.stock');
@@ -8408,7 +8434,7 @@ z-index:100001;
if ($amount_item_name && !$amount_item_name.nodeValue.contains(CC_set)) {
const item_name = $amount_item_name.nodeValue.trim().split(' ').slice(1, -1).join(' ');
const item_name_trans = itemNameDict[item_name] || item_name;
- $amount_item_name.nodeValue = `个[${item_name_trans}],总计$`;
+ $amount_item_name.nodeValue = `个[${ item_name_trans }],总计$`;
}
const $confirm_a = $confirm.querySelectorAll('span.confirm-act a');
$confirm_a.forEach(e => {
@@ -8416,7 +8442,7 @@ z-index:100001;
});
});
// 展开的物品详情
- initOB($wrapper, {childList: true, subtree: true}, () => {
+ initOB($wrapper, { childList: true, subtree: true }, () => {
const $item_desc = $wrapper.querySelector('.show-item-info') || $wrapper.querySelector('.view-item-info');
showItemInfoTrans($item_desc);
});
@@ -8437,7 +8463,7 @@ z-index:100001;
if (spl.length > 3) {
const shop_name = spl[2] === 'the' ? spl.slice(3).join(' ') : spl.slice(2).join(' ');
const shop_name_trans = npcShopDict[shop_name] || titleDict[shop_name] || cityDict[shop_name] || null;
- e.innerText = `物品给${shop_name_trans || shop_name}`;
+ e.innerText = `物品给${ shop_name_trans || shop_name }`;
}
} else {
if (npcShopDict[e.nodeValue.trim()]) e.nodeValue = npcShopDict[e.nodeValue.trim()];
@@ -8448,7 +8474,7 @@ z-index:100001;
const $items_name = $sell_items_wrapper.querySelectorAll('span.name');
$items_name.forEach(el => {
if (itemNameDict[el.innerText.trim()]) el.innerText +=
- ` ${itemNameDict[el.innerText.trim()]}`;
+ ` ${ itemNameDict[el.innerText.trim()] }`;
});
// 按钮
const $btn = $sell_items_wrapper.querySelectorAll('button');
@@ -8458,7 +8484,7 @@ z-index:100001;
// select btn
const $select_btn = $sell_items_wrapper.querySelector('li.select button.wai-btn');
if ($select_btn) {
- initOB($select_btn, {childList: true}, () => {
+ initOB($select_btn, { childList: true }, () => {
if ($select_btn && npcShopDict[$select_btn.innerText.trim()]) {
$select_btn.innerText = npcShopDict[$select_btn.innerText.trim()];
}
@@ -8525,7 +8551,7 @@ z-index:100001;
} else if (/[0-9]x$/.test(spl[0])) {
const itemName = spl.slice(1).join(' ');
const num = spl[0].slice(0, -1);
- $(e).text(`${num}个${itemNameDict[itemName] ? itemNameDict[itemName] : itemName}`);
+ $(e).text(`${ num }个${ itemNameDict[itemName] ? itemNameDict[itemName] : itemName }`);
}
});
// 股价详情
@@ -8567,7 +8593,7 @@ z-index:100001;
const $show_more = document.querySelector('li[class^="showMore___"] button');
if ($show_more && $show_more.innerText.trim().contains(/^Show [0-9]+ more$/)) {
const number = $show_more.innerText.trim().split(' ')[1];
- $show_more.innerText = `显示另外${number}条`;
+ $show_more.innerText = `显示另外${ number }条`;
}
// 点开bb后
$('div#panel-dividendTab div[class^="message"] *').contents().each((i, e) => {
@@ -8578,20 +8604,20 @@ z-index:100001;
}
// 第n个increment 1st 2nd 3rd 4th
else if (/[0-9][snrt][tdh]$/.test(e.nodeValue.trim())) {
- e.nodeValue = `第${e.nodeValue.trim().slice(0, -2)}个`;
+ e.nodeValue = `第${ e.nodeValue.trim().slice(0, -2) }个`;
}
// 物品
else if (/[0-9]x$/.test(e.nodeValue.trim().split(' ')[0])) {
const spl = e.nodeValue.trim().split(' ');
const itemName = spl.slice(1).join(' ');
e.nodeValue =
- ` ${spl[0].replace('x', '个')
- } ${itemNameDict[itemName] ? itemNameDict[itemName] : itemName
+ ` ${ spl[0].replace('x', '个')
+ } ${ itemNameDict[itemName] ? itemNameDict[itemName] : itemName
}`;
} else {
if (/[\u4e00-\u9fa5]/.test(e.nodeValue)) return;
if (/\b\$?[0-9,]+$/.test(e.nodeValue)) return;
- log(`未找到翻译:[${e.nodeValue.trim()}]`);
+ log(`未找到翻译:[${ e.nodeValue.trim() }]`);
}
});
};
@@ -8612,7 +8638,7 @@ z-index:100001;
function eduOBInit() {
eduOB.disconnect();
eduTrans();
- eduOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ eduOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
}
function eduTrans() {
@@ -8697,7 +8723,7 @@ z-index:100001;
}
eduTrans();
- eduOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ eduOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
return;
}
@@ -8753,11 +8779,11 @@ z-index:100001;
// 行动框的描述
const action_desc = $('#profile-container-description.profile-container-description');
if (profileDict[action_desc.text().trim()]) {
- action_desc.html(`
${profileDict[action_desc.text().trim()]}`);
+ action_desc.html(`
${ profileDict[action_desc.text().trim()] }`);
} else if (profileDict[action_desc.text().trim().replace(playerName, '{$}')]) {
action_desc.html(
- `
${profileDict[action_desc.text().trim().replace(playerName, '{$}')]
- .replace('{$}', playerName)}`
+ `
${ profileDict[action_desc.text().trim().replace(playerName, '{$}')]
+ .replace('{$}', playerName) }`
);
} else if (action_desc.text().contains(/is on your (friend|enemy) list/)) {
const spl = action_desc.text().trim().split(' ');
@@ -8768,9 +8794,9 @@ z-index:100001;
case 'friend':
if (profileDict['{$} is on your friend list']) {
action_desc.html(
- `
${profileDict['{$} is on your friend list']
+ `${ profileDict['{$} is on your friend list']
.replace('{$}', playerName)
- }${mark ? ' : ' + mark : ''
+ }${ mark ? ' : ' + mark : ''
}`
);
}
@@ -8778,9 +8804,9 @@ z-index:100001;
case 'enemy':
if (profileDict['{$} is on your enemy list']) {
action_desc.html(
- `${profileDict['{$} is on your enemy list']
+ `${ profileDict['{$} is on your enemy list']
.replace('{$}', playerName)
- }${mark ? ' : ' + mark : ''
+ }${ mark ? ' : ' + mark : ''
}`
);
}
@@ -8788,7 +8814,7 @@ z-index:100001;
}
} else {
if ($('.wh-translated').length <= 0) {
- log(`未找到翻译: “${action_desc.text().trim()}”`);
+ log(`未找到翻译: “${ action_desc.text().trim() }”`);
}
}
// 添加敌人或朋友的界面
@@ -8828,7 +8854,7 @@ z-index:100001;
const $span = e.children[0].children[0];
const pos = $span.firstChild.nodeValue.trim().split(' ').slice(0, -1).join(' ');
$span.firstChild.nodeValue = '';
- $($span).append(` 的 ${pos}`);
+ $($span).append(` 的 ${ pos }`);
return;
}
case 11: {
@@ -8852,7 +8878,7 @@ z-index:100001;
: null;
if (days) {
e.children[0].children[0].childNodes[0].nodeValue = '与 ';
- e.children[0].children[0].childNodes[2].nodeValue = ` 结婚${days}天`;
+ e.children[0].children[0].childNodes[2].nodeValue = ` 结婚${ days }天`;
} else {
$e.find('span *').contents().each((i, el) => {
if (el.nodeType === 3) {
@@ -8928,7 +8954,7 @@ z-index:100001;
const newspaperOB = new MutationObserver(() => {
newspaperOB.disconnect();
newspaperTrans();
- newspaperOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ newspaperOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
});
function newspaperTrans() {
@@ -8948,7 +8974,7 @@ z-index:100001;
if ($date_label && $date_label.innerText.trim().contains(date_reg)) {
const date_format = $date_label.innerText.trim().replaceAll(',', '');
const date_spl = date_format.split(' ');
- const date = {w: date_spl[0], m: date_spl[1], d: date_spl[2], y: date_spl[3]};
+ const date = { w: date_spl[0], m: date_spl[1], d: date_spl[2], y: date_spl[3] };
const month_trans = {
'Jan': 1,
'Feb': 2,
@@ -8963,7 +8989,7 @@ z-index:100001;
'Nov': 11,
'Dec': 12
};
- $date_label.innerText = `${date.y}年${month_trans[date.m] || date.m}月${date.d}日`;
+ $date_label.innerText = `${ date.y }年${ month_trans[date.m] || date.m }月${ date.d }日`;
}
// 菜单下的信息 工作 壁纸 广告 悬赏
$('div.help-message').find('*').contents().each((i, e) => {
@@ -9107,7 +9133,7 @@ z-index:100001;
}
newspaperTrans();
- newspaperOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ newspaperOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
return;
}
@@ -9134,7 +9160,7 @@ z-index:100001;
titleTrans();
contentTitleLinksTrans();
propertyTrans();
- propertyOB.observe($('div.content-wrapper').get(0), {childList: true, subtree: true});
+ propertyOB.observe($('div.content-wrapper').get(0), { childList: true, subtree: true });
});
const propertyTrans = function propertyTrans() {
// 从玩家处租或买
@@ -9260,7 +9286,7 @@ z-index:100001;
};
propertyTrans();
- propertyOB.observe($('div.content-wrapper').get(0), {childList: true, subtree: true});
+ propertyOB.observe($('div.content-wrapper').get(0), { childList: true, subtree: true });
return;
}
@@ -9271,10 +9297,10 @@ z-index:100001;
titleTrans();
contentTitleLinksTrans();
eventsTrans();
- ob.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ ob.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
});
eventsTrans();
- ob.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ ob.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
return;
// let events;
// const eventMutation = new MutationObserver(() => {
@@ -9302,7 +9328,7 @@ z-index:100001;
const awOB = new MutationObserver(() => {
awOB.disconnect();
awTrans();
- awOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true});
+ awOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true, attributes: true });
});
const awTrans = function awTrans() {
titleTrans();
@@ -9428,7 +9454,7 @@ z-index:100001;
});
};
awTrans();
- awOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true});
+ awOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true, attributes: true });
return;
}
@@ -9517,7 +9543,7 @@ z-index:100001;
if ($back_to_profile) {
const spl = $back_to_profile.innerText.split(/('s |s' )/);
if (spl.length === 3 && spl[2] === 'Profile') {
- $back_to_profile.innerText = `${spl[0]}的个人资料`;
+ $back_to_profile.innerText = `${ spl[0] }的个人资料`;
}
}
const $display_cabinet = $page_wrapper.querySelector('.display-cabinet');
@@ -9548,7 +9574,7 @@ z-index:100001;
function hosOBInit() {
hospitalOB.disconnect();
hospTrans();
- hospitalOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ hospitalOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
}
function hospTrans() {
@@ -9595,7 +9621,7 @@ z-index:100001;
}
hospTrans();
- hospitalOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ hospitalOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
return;
}
@@ -9606,7 +9632,7 @@ z-index:100001;
function factionOBInit() {
factionOB.disconnect();
factionTrans();
- factionOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ factionOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
}
const factionDict = {
@@ -9716,7 +9742,7 @@ z-index:100001;
}
factionTrans();
- factionOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
+ factionOB.observe($('div.content-wrapper')[0], { childList: true, subtree: true });
return;
}
@@ -9756,7 +9782,7 @@ z-index:100001;
if (href.contains(/calendar\.php/)) {
const $root = document.querySelectorAll('#calendar-root');
$root.forEach(el => {
- initOB(el, {childList: true, subtree: true}, () => {
+ initOB(el, { childList: true, subtree: true }, () => {
// 页标题
const $h4_title = el.querySelectorAll('h4[class^="title___"]');
titleTransReact($h4_title);
@@ -9780,7 +9806,7 @@ z-index:100001;
let $root = document.querySelector('#christmastownroot');
const $title_wrapper = $root.querySelector('div[class^="appHeaderWrapper___"]');
// 标题和右边的链接
- initOB($title_wrapper, {childList: true, subtree: true}, () => {
+ initOB($title_wrapper, { childList: true, subtree: true }, () => {
titleTransReact();
contentTitleLinksTransReact();
});
@@ -9935,66 +9961,66 @@ z-index:100001;
// 海外库存
async function forStock() {
if (getScriptEngine() === UserScriptEngine.RAW) {
- const insert = `
`;
+ const insert = `
`;
popupMsg(insert, '飞花库存');
} else {
- const popup = popupMsg(`请稍后${loading_gif_html()}`, '飞花库存');
+ const popup = popupMsg(`请稍后${ loading_gif_html() }`, '飞花库存');
let table = `| 目的地 - 更新时间 | 库存 |
`;
const dest = [
{
name: 'mex', show: '墨西哥',
- stocks: {'Dahlia': '花', 'Jaguar Plushie': '偶'}
+ stocks: { 'Dahlia': '花', 'Jaguar Plushie': '偶' }
},
{
name: 'cay', show: '开曼',
- stocks: {'Banana Orchid': '花', 'Stingray Plushie': '偶'}
+ stocks: { 'Banana Orchid': '花', 'Stingray Plushie': '偶' }
},
{
name: 'can', show: '加拿大',
- stocks: {'Crocus': '花', 'Wolverine Plushie': '偶'}
+ stocks: { 'Crocus': '花', 'Wolverine Plushie': '偶' }
},
{
name: 'haw', show: '夏威夷',
- stocks: {'Orchid': '花', 'Large Suitcase': '大箱'}
+ stocks: { 'Orchid': '花', 'Large Suitcase': '大箱' }
},
{
name: 'uni', show: '嘤国',
- stocks: {'Heather': '花', 'Red Fox Plushie': '赤狐', 'Nessie Plushie': '水怪'}
+ stocks: { 'Heather': '花', 'Red Fox Plushie': '赤狐', 'Nessie Plushie': '水怪' }
},
{
name: 'arg', show: '阿根廷',
- stocks: {'Ceibo Flower': '花', 'Monkey Plushie': '偶', 'Tear Gas': '催泪弹'},
+ stocks: { 'Ceibo Flower': '花', 'Monkey Plushie': '偶', 'Tear Gas': '催泪弹' },
},
{
name: 'swi', show: '瑞士',
- stocks: {'Edelweiss': '花', 'Chamois Plushie': '偶'},
+ stocks: { 'Edelweiss': '花', 'Chamois Plushie': '偶' },
},
{
name: 'jap', show: '日本',
- stocks: {'Cherry Blossom': '花'},
+ stocks: { 'Cherry Blossom': '花' },
},
{
name: 'chi', show: '祖国',
- stocks: {'Peony': '花', 'Panda Plushie': '偶'},
+ stocks: { 'Peony': '花', 'Panda Plushie': '偶' },
},
{
name: 'uae', show: '迪拜',
- stocks: {'Tribulus Omanense': '花', 'Camel Plushie': '偶'},
+ stocks: { 'Tribulus Omanense': '花', 'Camel Plushie': '偶' },
},
{
name: 'sou', show: '南非',
- stocks: {'African Violet': '花', 'Lion Plushie': '偶', 'Xanax': 'XAN'},
+ stocks: { 'African Violet': '花', 'Lion Plushie': '偶', 'Xanax': 'XAN' },
}];
const now = new Date();
const res = await fstock.get();
if (!res['stocks']) return;
dest.forEach(el => {
const update = (now - new Date(res.stocks[el.name]['update'] * 1000)) / 1000 | 0
- table += `| ${el.show} | ${update / 60 | 0}分${update % 60 | 0}秒前 | `;
+ table += `
| ${ el.show } | ${ update / 60 | 0 }分${ update % 60 | 0 }秒前 | `;
let count = 0;
res.stocks[el.name]['stocks'].forEach(stock => {
if (el.stocks[stock.name]) {
- table += `${el.stocks[stock.name]} (${stock['quantity']}) | `;
+ table += `${ el.stocks[stock.name] } (${ stock['quantity'] }) | `;
count++;
}
});
@@ -10028,12 +10054,12 @@ z-index:100001;
// 元素生成器
function elemGenerator(setting, root_node) {
- let {tip, domType} = setting;
+ let { tip, domType } = setting;
let new_node = null;
switch (domType) {
case 'checkbox': {
new_node = document.createElement('div');
- let {domId, dictName, domText} = setting;
+ let { domId, dictName, domText } = setting;
let label = document.createElement('label');
(tip) && (label.setAttribute('title', tip));
let input = document.createElement('input');
@@ -10051,7 +10077,7 @@ z-index:100001;
}
case 'button': {
new_node = document.createElement('div');
- let {domId, domText, clickFunc} = setting;
+ let { domId, domText, clickFunc } = setting;
let btn = document.createElement('button');
(tip) && (btn.setAttribute('title', tip));
btn.id = domId;
@@ -10062,14 +10088,14 @@ z-index:100001;
}
case 'select': {
new_node = document.createElement('div');
- let {domSelectOpt, dictName, domId, domText} = setting;
+ let { domSelectOpt, dictName, domId, domText } = setting;
let label = document.createElement('label');
(tip) && (label.setAttribute('title', tip));
let text = document.createTextNode(domText);
let select = document.createElement('select');
select.id = domId;
domSelectOpt.forEach((opt, i) => {
- let {domVal, domText} = opt;
+ let { domVal, domText } = opt;
let option = document.createElement('option');
option.value = domVal;
option.innerHTML = domText;
@@ -10110,7 +10136,7 @@ z-index:100001;
}
started = setInterval(() => {
// 海外取消提醒
- let {isTravelling, isAbroad} = getUserState();
+ let { isTravelling, isAbroad } = getUserState();
if (isTravelling || isAbroad) {
loop.stop();
return;
@@ -10163,12 +10189,12 @@ z-index:100001;
loop.status = () => started ? '已启动' : '未启动';
loop.is_running = () => !!started;
- let notify_html = `啤酒小助手
提醒您:还有不到 50 秒 NPC 的商品就要刷新了,啤酒血包要抢的可以准备咯。
【啤酒店】 【血包店】`
+ let notify_html = `啤酒小助手
提醒您:还有不到 50 秒 NPC 的商品就要刷新了,啤酒血包要抢的可以准备咯。
【啤酒店】 【血包店】`
loop.skip_today = () => {
const date = new Date();
setWhSetting('_15_alarm_ignore', [date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()], false);
// 通知
- const notify = WHNotify(`明早8点前将不再提醒 `);
+ const notify = WHNotify(`明早8点前将不再提醒 `);
// 通知中的取消按钮
notify.querySelector('.wh-notify-msg button').addEventListener('click', () => setWhSetting('_15_alarm_ignore', undefined));
};
@@ -10314,15 +10340,15 @@ z-index:100001;
input.attributes['data-money'].value = money;
});
$(form).trigger('submit');
- let dataStr = `ajax=true&step=armouryDonate&type=cash&amount=${money}`;
+ let dataStr = `ajax=true&step=armouryDonate&type=cash&amount=${ money }`;
let res = await (await fetch(addRFC('https://www.torn.com/factions.php'), {
method: 'POST',
body: dataStr,
- headers: {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded'}
+ headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded' }
})).json();
if (res.success === true) {
WHNotify('存钱成功');
- WHNotify(`${res.text}`);
+ WHNotify(`${ res.text }`);
}
}
@@ -10336,7 +10362,7 @@ z-index:100001;
method: 'POST',
referrer: 'companies.php',
body: 'deposit=' + money,
- headers: {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded'}
+ headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded' }
})).text();
log(res);
let node = document.createElement('div');
@@ -10394,14 +10420,14 @@ z-index:100001;
let loop_id = null;
let updateAttackersDOM = function () {
let html = '进攻者:
';
- Object.keys(attackers.obj).forEach(id => html += `[${id}]
`);
+ Object.keys(attackers.obj).forEach(id => html += `[${ id }]
`);
attackers.innerHTML = html;
};
let updateRecordsDOM = function () {
let html = '战斗记录:
';
records.list.forEach(rid => {
- let {TimeCreated, attackID, attackerID, attackerItemID, result, text} = records.details[rid];
- html += `[${TimeCreated}] [${attackerID}] [${attackerItemID}] ${result} ${text}
`;
+ let { TimeCreated, attackID, attackerID, attackerItemID, result, text } = records.details[rid];
+ html += `[${ TimeCreated }] [${ attackerID }] [${ attackerItemID }] ${ result } ${ text }
`;
});
records.innerHTML = html;
};
@@ -10416,7 +10442,7 @@ z-index:100001;
let popup_close = popup.close;
popup.close = () => {
if (loop_id === null) popup_close();
- else WHNotify('守望者运行中,请先停止', {timeout: 2});
+ else WHNotify('守望者运行中,请先停止', { timeout: 2 });
}
popup.appendChild(p);
@@ -10438,13 +10464,13 @@ z-index:100001;
// 记录当前循环的id
let that_id = loop_id;
let res = await (await fetch(url + uid.value, {
- headers: {'X-Requested-With': 'XMLHttpRequest'},
+ headers: { 'X-Requested-With': 'XMLHttpRequest' },
referrer: "loader.php?sid=attack&user2ID=" + uid.value
})).text();
if (loop_id !== that_id) return;
let data = JSON.parse(res.split(' {
@@ -10457,15 +10483,15 @@ z-index:100001;
// 攻击历史
(DB['currentFightHistory'] || []).forEach(record => {
if (records.list.includes(record['ID'])) return;
- let {ID, TimeCreated, attackID, attackerID, attackerItemID, result, text} = record;
+ let { ID, TimeCreated, attackID, attackerID, attackerItemID, result, text } = record;
records.list.push(ID);
- records.details[ID] = {TimeCreated, attackID, attackerID, attackerItemID, result, text};
+ records.details[ID] = { TimeCreated, attackID, attackerID, attackerItemID, result, text };
updateRecordsDOM();
});
// 攻击历史日志
if (histLog && histLog[uid.value]) histLog[uid.value].forEach(log => {
if (records.list.includes(log['ID'])) return;
- let {ID, TimeCreated, attackID, attackResult, userID} = log;
+ let { ID, TimeCreated, attackID, attackResult, userID } = log;
records.list.push(ID);
records.details[ID] = {
TimeCreated,
@@ -10535,22 +10561,28 @@ z-index:100001;
let sessionKeys = Object.keys(sessionStorage);
if (sessionKeys.length < 2) {
+ // dom获取
const sidebar_menu_list = document.querySelectorAll('#sidebar a span[class*="linkName___"]');
- sidebar_menu_list.forEach(node => ret[node.innerHTML.trim().toLowerCase()] = true);
+ sidebar_menu_list.forEach(node => ret[node.innerHTML.trim().toLowerCase().replaceAll(' ', '_')] = true);
} else {
- for (let key in sessionKeys) {
- if (key.startsWith('sidebarData') && key.length < 20) {
+ // session storage获取
+ for (let key of sessionKeys) {
+ if (key.startsWith('sidebarData')) {
sidebar_id = JSON.parse(sessionStorage.getItem(key));
break;
}
}
if (sidebar_id !== null) {
- for (let area in Object.keys(sidebar_id['areas'])) {
+ // Object.keys(sidebar_id['areas']).forEach(area => ret[area] = true);
+ for (let area of Object.keys(sidebar_id['areas'])) {
ret[area] = true;
}
}
}
- if (Object.keys(ret).length === 0) WHNotify('无法获取数据,建议刷新重试');
+ log({ ret, sidebar_id, sessionKeys })
+ if (Object.keys(ret).length === 0) {
+ WHNotify('无法获取数据,建议刷新重试');
+ }
return ret;
}
@@ -10607,9 +10639,9 @@ z-index:100001;
* @returns {Promise}
*/
function ajaxFetch(opt) {
- let {url, referrer, method, body = null} = opt;
+ let { url, referrer, method, body = null } = opt;
let req_params = {
- headers: {'X-Requested-With': 'XMLHttpRequest'},
+ headers: { 'X-Requested-With': 'XMLHttpRequest' },
referrer,
method,
};
@@ -10620,5 +10652,59 @@ z-index:100001;
return fetch(url, req_params);
}
- $zhongNode.initTimer.innerHTML = `助手加载时间 ${Date.now() - start_timestamp}ms`;
-}();
\ No newline at end of file
+ /**
+ * 解析 Markdown 内容
+ * @param {String} from
+ * @returns {HTMLDivElement}
+ */
+ function mdParse(from) {
+ const base = document.createElement('div');
+ let lines = from.split('\n');
+
+ let prev = '';
+ let child_cont;
+ lines.forEach(line => {
+ if (line.trim() === '') return;
+ let node;
+ let spl = line.split(' ');
+ let md_flag = spl[0];
+
+ switch (md_flag) {
+ // 标题
+ case '#':
+ case '##':
+ case '###':
+ if (prev === 'li') {
+ child_cont = null;
+ }
+ prev = 'h' + (md_flag.length + 1);
+ node = document.createElement(prev);
+ node.innerText = line.slice(md_flag.length + 1);
+ base.append(node);
+ return;
+ // 列表
+ case '-':
+ if (prev !== 'li') {
+ child_cont = document.createElement('ul');
+ if (!base.contains(child_cont)) base.append(child_cont);
+ }
+ prev = 'li';
+ node = document.createElement(prev);
+ node.innerText = line.slice(2);
+ child_cont.append(node);
+ return;
+ }
+ prev = 'p';
+ node = document.createElement(prev);
+ node.innerText = line.trim();
+ base.append(node);
+ })
+ return base;
+ }
+
+ $zhongNode.initTimer.innerHTML = `助手加载时间 ${ Date.now() - start_timestamp }ms`;
+}
+
+!function () {
+ main().then()
+}();