Created
May 13, 2025 06:18
-
-
Save scriptease/587644d79eb7029e726bf252eabc9239 to your computer and use it in GitHub Desktop.
Method.gg WR progress.user.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Method.gg WR progress | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-05-13 | |
| // @description Adds buttons to the Warcraft Rumble progress tracker | |
| // @author Scriptease | |
| // @match https://www.method.gg/warcraft-rumble/progress-tracker | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=method.gg | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| function createButton(text, onClick) { | |
| const btn = document.createElement('button'); | |
| btn.textContent = text; | |
| btn.style.margin = '0 8px'; | |
| btn.style.padding = '6px 14px'; | |
| btn.style.cursor = 'pointer'; | |
| btn.style.fontSize = '14px'; | |
| btn.style.border = '1px solid #ccc'; | |
| btn.style.borderRadius = '4px'; | |
| btn.style.background = '#f5f5f5'; | |
| btn.style.color = '#000'; | |
| btn.onmouseenter = () => btn.style.background = '#e0e0e0'; | |
| btn.onmouseleave = () => btn.style.background = '#f5f5f5'; | |
| btn.onclick = onClick; | |
| return btn; | |
| } | |
| const totalBlock = document.querySelector('.mini-total-block'); | |
| if (!totalBlock) { | |
| alert('mini-total-block not found'); | |
| return; | |
| } | |
| const wrapper = document.createElement('div'); | |
| wrapper.style.textAlign = 'center'; | |
| wrapper.style.marginTop = '15px'; | |
| // Filter buttons | |
| const btnExp = createButton('max exp', () => { | |
| document.querySelectorAll('.mini-row').forEach(row => { | |
| const xp = row.querySelector('.output_xp')?.getAttribute('data-num'); | |
| if (xp === "0") row.style.display = 'none'; | |
| }); | |
| }); | |
| const btnStars = createButton('max stars', () => { | |
| document.querySelectorAll('.mini-row').forEach(row => { | |
| const stars = row.querySelector('.output_stars')?.getAttribute('data-num'); | |
| if (stars === "0") row.style.display = 'none'; | |
| }); | |
| }); | |
| const btnGold = createButton('maxed', () => { | |
| document.querySelectorAll('.mini-row').forEach(row => { | |
| const gold = row.querySelector('.output_gold')?.getAttribute('data-num'); | |
| if (gold === "0") row.style.display = 'none'; | |
| }); | |
| }); | |
| // Export button | |
| const btnExport = createButton('Export JSON', () => { | |
| const data = localStorage.getItem('method-MiniCalculator'); | |
| if (!data) { | |
| alert('No data found in method-MiniCalculator'); | |
| return; | |
| } | |
| const blob = new Blob([data], { type: 'application/json' }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = 'method-MiniCalculator.json'; | |
| a.click(); | |
| URL.revokeObjectURL(url); | |
| }); | |
| // Import button | |
| const btnImport = createButton('Import JSON', () => { | |
| const input = document.createElement('input'); | |
| input.type = 'file'; | |
| input.accept = 'application/json'; | |
| input.onchange = event => { | |
| const file = event.target.files[0]; | |
| if (!file) return; | |
| const reader = new FileReader(); | |
| reader.onload = function(e) { | |
| try { | |
| const json = JSON.parse(e.target.result); | |
| localStorage.setItem('method-MiniCalculator', JSON.stringify(json)); | |
| Object.entries(json).forEach(([id, entry]) => { | |
| const row = document.querySelector(`.mini-row-individual[data-id="${id}"]`); | |
| if (!row) return; | |
| const levelEl = row.querySelector('input[name="input_level"]'); | |
| if (levelEl) levelEl.value = entry.lvl; | |
| const xpEl = row.querySelector('input[name="input_xp"]'); | |
| if (xpEl) xpEl.value = entry.xp; | |
| const starsEl = row.querySelector('input[name="input_stars"]'); | |
| if (starsEl) starsEl.value = entry.stars; | |
| const tierEl = row.querySelector('select[name="input_tier"]'); | |
| if (tierEl) tierEl.value = entry.tier; | |
| const talentsEl = row.querySelector('select[name="input_talents"]'); | |
| if (talentsEl) talentsEl.value = entry.talents; | |
| levelEl.dispatchEvent(new Event('change', { bubbles: true })); | |
| }); | |
| alert('JSON imported successfully. You may need to reload the page.'); | |
| } catch (err) { | |
| alert('Invalid JSON file.'+err); | |
| } | |
| }; | |
| reader.readAsText(file); | |
| }; | |
| input.click(); | |
| }); | |
| // Add buttons | |
| wrapper.appendChild(btnExp); | |
| wrapper.appendChild(btnStars); | |
| wrapper.appendChild(btnGold); | |
| wrapper.appendChild(btnExport); | |
| wrapper.appendChild(btnImport); | |
| totalBlock.parentNode.insertBefore(wrapper, totalBlock.nextSibling); | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For: https://www.method.gg/warcraft-rumble/progress-tracker