NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name 原神wiki 已完成成就筛选 // @namespace http://tampermonkey.net/ // @version 0.3 // @description add updateurl // @author You // @match https://wiki.biligame.com/ys/%E5%A4%A9%E5%9C%B0%E4%B8%87%E8%B1%A1 // @icon https://www.google.com/s2/favicons?sz=64&domain=biligame.com // @updateURL https://openuserjs.org/meta/preciousmouse/原神wiki_已完成成就筛选.meta.js // @downloadURL https://openuserjs.org/install/preciousmouse/原神wiki_已完成成就筛选.user.js // @grant none // @license MIT // ==/UserScript== function sleep(time){ return new Promise(res=>setTimeout(res,time)); } (async function() { 'use strict'; await sleep(1000); let isHided = false; const onSwitch = () => { const btnEle = document.querySelector('#cy-tampermonkey-plugin-swith-btn'); btnEle.innerText = isHided ? '-隐藏已完成项-' : '-取消隐藏-' const nextDisplayValue = isHided ? '' : 'none'; isHided = !isHided; const checkedItems = document.querySelectorAll('.bwiki-collection.checked'); [...checkedItems].map(item=>{ item.style.display = nextDisplayValue; let ptr = item.nextElementSibling; let loopCnt = 0; // 死循环防御 while(ptr && ptr.tagName!=='H2' && !ptr.className.includes('bwiki-collection') && loopCnt < 10){ ptr.style.display = nextDisplayValue; ptr = ptr.nextElementSibling; loopCnt++; } }) } const btnParent = document.querySelector('.bwiki-collection-checknum-achievement').parentNode; const btnDom = document.createElement('button'); btnDom.id = 'cy-tampermonkey-plugin-swith-btn'; btnDom.innerText = '-隐藏已完成项-'; btnDom.addEventListener('click', onSwitch); btnParent.appendChild(btnDom); })();