This commit is contained in:
Liwanyi 2022-07-03 01:28:47 +08:00
parent 9537013886
commit 925056d674
2 changed files with 3 additions and 3 deletions

View File

@ -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=`<img src="${e.map_item.src}" alt="" />${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=`<label><input type="checkbox" ${p()["SEProtect"]?"checked":""}/> 叠E保护</label>`;$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=`<button style="color:white;">👉</button><p></p><p id="wh-msg"></p>`;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=`<div class="acc-title">
`);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=`<img src="${e.map_item.src}" alt="" />${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=`<label><input type="checkbox" ${p()["SEProtect"]?"checked":""}/> 叠E保护</label>`;$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=`<button style="color:white;">👉</button><p></p><p id="wh-msg"></p>`;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=`<div class="acc-title">
<span class="item-desc">
<span tabindex="0" aria-labelledby="180-name 180-price 180-stock" class="item Alcohol" itemid="180" loaded="0">
<img class="torn-item item-plate" data-size="large" src="/images/items/180/large.png" alt="Bottle of Beer" style="opacity: 0;" id="item-1bea9f66-a6c4-475c-accb-41dcb67af64f" data-converted="1" aria-hidden="true">

View File

@ -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);
});
}