NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Silph something // @namespace Violentmonkey Scripts // @match https://thesilphroad.com/* // @grant none // @version 1.0 // @author yomilala // @description this does something // @copyright pending // @license Apache-2.0 // ==/UserScript== let cups=document.querySelectorAll("#arenaHistory .cupBadge"),types=[],reg=/https:\/\/silph.gg\/img\/badges\/([\w-]+)\.png/,priority={participation:0,bronze:1,silver:2,gold:3,platinum:4,uranium:5};for(let e of cups){let t=reg.exec(e.childNodes?e.childNodes[1].firstElementChild.src:""),r=t?t[1]:"",p=e.classList.value.replace("cupBadge ","");if(""!=r){let e=types.find(e=>e.cupType==r);e?e.priority<priority[p]&&(e.medal=p,e.priority=priority[p]):types.push({cupType:r,medal:p,priority:priority[p]})}}let h3Trophy=document.querySelector("#trophyCase > h3");h3Trophy.style.width="100%";let hrTrophy=document.querySelector("#trophyCase > hr");hrTrophy.style.width="100%";let textTrophy=document.querySelector("#trophyCase > p");textTrophy.style.width="100%";let trophyCase=document.querySelector("#trophyCase");trophyCase.style.display="flex",trophyCase.style["flex-wrap"]="wrap",trophyCase.style["align-items"]="center",trophyCase.innerHTML="",trophyCase.appendChild(h3Trophy),trophyCase.appendChild(hrTrophy),types.reverse();for(let e of types){let t=document.createElement("div"),r=document.createElement("img");r.src="https://silph.gg/img/badges/"+e.cupType+".png",t.appendChild(r),t.classList.add("cupBadge"),""!=e.medal&&t.classList.add(e.medal),t.style.margin="1%",trophyCase.appendChild(t)}trophyCase.appendChild(textTrophy);let cssSheet=document.querySelector("style").sheet,rules=cssSheet.rules;for(let e=rules.length-1;e>=0;e--)"#trophyCase .cupBadge:nth-child(2n+1)"==rules[e].selectorText&&(console.log(e,rules[e].selectorText),cssSheet.removeRule(e));