diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index 12b3629..176b313 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -1,8 +1,8 @@ // ==UserScript== -// @lastmodified 202203110851 +// @lastmodified 202203311604 // @name 芜湖助手 // @namespace WOOH -// @version 0.3.27 +// @version 0.3.28 // @description 托恩,起飞! // @author Woohoo[2687093] Sabrina_Devil[2696209] // @match https://www.torn.com/* @@ -23,13 +23,18 @@ if (window.WHTRANS) return; window.WHTRANS = true; // 版本 - const version = '0.3.27'; + const version = '0.3.28'; // 修改历史 const changelist = [ { todo: true, cont: `翻译:baza npc商店、imarket、imarket搜索结果`, }, + { + ver: '0.3.28', + date: '20220331', + cont: `增加pt一键购买(NS抄来的)`, + }, { ver: '0.3.27', date: '20220311', @@ -3106,6 +3111,7 @@ return keywords.test(this); } }; + console.log('href') // 原始fetch const ori_fetch = window.fetch; @@ -3920,9 +3926,9 @@ height:30px; }); // 其他设置 if (isDev()) settingsArr.push({ - domType: 'button', domId: 'wh-otherBtn', domText: '其他设置',clickFunc: () =>{ + domType: 'button', domId: 'wh-otherBtn', domText: '其他设置', clickFunc: () => { const html = `清空设置数据、请求通知权限、测试跨域请求`; - const popup = popupMsg(html,'其他设置'); + const popup = popupMsg(html, '其他设置'); }, }); // 测试按钮 @@ -4944,6 +4950,31 @@ display:inline-block; }) } + // pt一键购买 + if (href.includes('pmarket.php')) { + WHNotify('一键购买已开启'); + // ns脚本 + const rmv_cfm = (e) => { + let el = e.firstElementChild; + el.className += ' yes'; + let old_href = el.getAttribute('href'); + let new_href = old_href.replace(/=buy/, '=buy1').replace(/&points=\d{1,9}$/, ''); + el.setAttribute('href', new_href); + }; + + let points_sales = document.querySelector('.users-point-sell'); + for (const index in points_sales.children) { + 'LI' === points_sales.children[index].tagName && rmv_cfm(points_sales.children[index]) + } + new MutationObserver(e => { + for (const t of e) { + for (const e of t.addedNodes) { + 'LI' === e.tagName && rmv_cfm(e) + } + } + }).observe(points_sales, {childList: true}); + } + // 叠e助手 if (href.includes('gym.php')) { const switch_node = document.createElement('div'); @@ -4973,7 +5004,7 @@ display:inline-block; const clear_node = node.querySelector('li.clear'); const beer = document.createElement('li'); beer.classList.add('torn-divider', 'divider-vertical'); - beer.style.backgroundColor='#c8c8c8'; + beer.style.backgroundColor = '#c8c8c8'; beer.innerHTML = `
| 123 | 456 |
|---|---|
| 789 | 012 |