From 925056d6740c4927f18226f2ba7017650067ec2e Mon Sep 17 00:00:00 2001 From: Liwanyi Date: Sun, 3 Jul 2022 01:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- release.min.user.js | 4 ++-- wuhu-torn-helper.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/release.min.user.js b/release.min.user.js index dc8931d..32ffcb3 100644 --- a/release.min.user.js +++ b/release.min.user.js @@ -1,5 +1,5 @@ // ==UserScript== -// @lastmodified 202207030126 +// @lastmodified 202207030128 // @name 芜湖助手 // @namespace WOOH // @version 0.3.39 @@ -450,7 +450,7 @@ background:green; color:white; display:inline-block; } -`);let o=null;const Lt=document.createElement("div");Lt.id="wh-city-finder";const Nt=document.createElement("div");Nt.id="wh-city-finder-cont";const _t=document.createElement("div");_t.id="wh-city-finder-header";_t.innerHTML="捡垃圾助手";const Pt=document.createElement("div");Pt.innerHTML="已找到物品:";Nt.append(Pt);Lt.append(_t);Lt.append(Nt);j("https://jjins.github.io/item_price_raw.json").catch(e=>{Le(e);o=undefined}).then(e=>o=JSON.parse(e));d("div.leaflet-marker-pane").then(e=>{document.querySelector("#map").classList.add("wh-city-finds");document.querySelector(".content-wrapper").prepend(Lt);const i=[];e.querySelectorAll("img.map-user-item-icon").forEach(e=>{const t=e.src.split("/")[5];const n=document.createElement("span");n.id="wh-city-finder-item"+t;n.innerHTML=t;i.push({id:t,node:n,map_item:e});Nt.append(n)});if(i.length===0){Pt.innerHTML="空空如也,请大佬明天再来";return}const t=()=>{let n=0;i.forEach(e=>{const t=o[e.id]["price"];e.node.innerHTML=`${o[e.id]["name"]} ($${K(t)})`;if(t<1e5)e.node.style.backgroundColor="#9e9e9e";else if(t<1e6)e.node.style.backgroundColor="#4caf50";else if(t<25e6)e.node.style.backgroundColor="#03a9f4";else if(t<5e8)e.node.style.backgroundColor="#ffc107";else if(t>=5e8)e.node.style.backgroundColor="#f44336";n+=o[e.id]["price"]});_t.innerHTML=`捡垃圾助手 - ${i.length} 个物品,总价值 $${K(n)}`};if(o===null){let e=30;const n=window.setInterval(()=>{e--;if(o!==null){t();clearInterval(n)}if(0===e){Le("获取物品名称与价格信息超时");clearInterval(n)}},500)}else if(o===undefined){Pt.innerHTML+="(当前平台暂不支持查询价格)"}else{t()}})}if(p()["ptQuickBuy"]&&c.includes("pmarket.php")){M("一键购买已开启");const Dt=e=>{let t=e.firstElementChild;t.className+=" yes";let n=t.getAttribute("href");let i=n.replace(/=buy/,"=buy1").replace(/&points=\d{1,9}$/,"");t.setAttribute("href",i)};let e=document.querySelector(".users-point-sell");for(const Bt in e.children){"LI"===e.children[Bt].tagName&&Dt(e.children[Bt])}new MutationObserver(e=>{for(const t of e){for(const e of t.addedNodes){"LI"===e.tagName&&Dt(e)}}}).observe(e,{childList:true})}if(c.includes("gym.php")){let t=null;const $t=document.createElement("div");$t.innerHTML=``;$t.id="wh-gym-info-cont";$t.querySelector("input").onchange=e=>{t.classList.toggle("wh-display-none");m("SEProtect",e.target.checked)};d("#gymroot").then(e=>{t=e;e.classList.add("wh-display-none");e.before($t)})}if(c.includes("shops.php?step=bitsnbobs")){const Ht=document.createElement("div");Ht.id="wh-gym-info-cont";Ht.innerHTML=`

如果当前商店没有啤酒这个商品可以提前显示以省去刷新步骤,增加抢酒成功率。

`;Ht.querySelector("button").addEventListener("click",e=>{const t=Ht.querySelector("#wh-msg");if(qt.querySelector('span[id="180-name"]')){t.innerHTML="❌ 页面已经有啤酒了";return}const n=qt.querySelector("li.clear");const i=document.createElement("li");i.classList.add("torn-divider","divider-vertical");i.style.backgroundColor="#c8c8c8";i.innerHTML=`
+`);let o=null;const Lt=document.createElement("div");Lt.id="wh-city-finder";const Nt=document.createElement("div");Nt.id="wh-city-finder-cont";const _t=document.createElement("div");_t.id="wh-city-finder-header";_t.innerHTML="捡垃圾助手";const Pt=document.createElement("div");Pt.innerHTML="已找到物品:";Nt.append(Pt);Lt.append(_t);Lt.append(Nt);j("https://jjins.github.io/item_price_raw.json").catch(e=>{Le(e);o=undefined}).then(e=>o=JSON.parse(e));d("div.leaflet-marker-pane").then(e=>{document.querySelector("#map").classList.add("wh-city-finds");document.querySelector(".content-wrapper").prepend(Lt);const i=[];e.querySelectorAll("img.map-user-item-icon").forEach(e=>{const t=e.src.split("/")[5];const n=document.createElement("span");n.id="wh-city-finder-item"+t;n.innerHTML=t;i.push({id:t,node:n,map_item:e});Nt.append(n)});if(i.length===0){Pt.innerHTML="空空如也,请大佬明天再来";return}const t=()=>{let n=0;i.forEach(e=>{const t=o[e.id]["price"];e.node.innerHTML=`${o[e.id]["name"]} ($${K(t)})`;if(t<1e5)e.node.style.backgroundColor="#9e9e9e";else if(t<1e6)e.node.style.backgroundColor="#4caf50";else if(t<25e6)e.node.style.backgroundColor="#03a9f4";else if(t<5e8)e.node.style.backgroundColor="#ffc107";else if(t>=5e8)e.node.style.backgroundColor="#f44336";n+=o[e.id]["price"]});_t.innerHTML=`捡垃圾助手 - ${i.length} 个物品,总价值 $${K(n)}`};if(o===null){let e=30;const n=window.setInterval(()=>{e--;if(o!==null){t();clearInterval(n)}if(0===e){Le("获取物品名称与价格信息超时");clearInterval(n)}},500)}else if(o===undefined){Pt.innerHTML+="(当前平台暂不支持查询价格)"}else{t()}})}if(p()["ptQuickBuy"]&&c.includes("pmarket.php")){M("一键购买已开启");const Dt=e=>{let t=e.firstElementChild;t.className+=" yes";let n=t.getAttribute("href");let i=n.replace(/=buy/,"=buy1").replace(/&points=\d{1,9}$/,"");t.setAttribute("href",i)};let e=document.querySelector(".users-point-sell");for(const Bt in e.children){"LI"===e.children[Bt].tagName&&Dt(e.children[Bt])}new MutationObserver(e=>{for(const t of e){for(const e of t.addedNodes){"LI"===e.tagName&&Dt(e)}}}).observe(e,{childList:true})}if(c.includes("gym.php")){let t=null;const $t=document.createElement("div");$t.innerHTML=``;$t.id="wh-gym-info-cont";$t.querySelector("input").onchange=e=>{t.classList.toggle("wh-display-none");m("SEProtect",e.target.checked)};d("#gymroot").then(e=>{t=e;if(p()["SEProtect"])e.classList.add("wh-display-none");e.before($t)})}if(c.includes("shops.php?step=bitsnbobs")){const Ht=document.createElement("div");Ht.id="wh-gym-info-cont";Ht.innerHTML=`

如果当前商店没有啤酒这个商品可以提前显示以省去刷新步骤,增加抢酒成功率。

`;Ht.querySelector("button").addEventListener("click",e=>{const t=Ht.querySelector("#wh-msg");if(qt.querySelector('span[id="180-name"]')){t.innerHTML="❌ 页面已经有啤酒了";return}const n=qt.querySelector("li.clear");const i=document.createElement("li");i.classList.add("torn-divider","divider-vertical");i.style.backgroundColor="#c8c8c8";i.innerHTML=`
diff --git a/wuhu-torn-helper.js b/wuhu-torn-helper.js index 770ef20..359b103 100644 --- a/wuhu-torn-helper.js +++ b/wuhu-torn-helper.js @@ -4968,7 +4968,7 @@ display:inline-block; }; elementReady('#gymroot').then(node => { cont = node; - node.classList.add('wh-display-none'); + if(getWhSettingObj()['SEProtect'])node.classList.add('wh-display-none'); node.before(switch_node); }); }