|
|
| (47 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| document.addEventListener("DOMContentLoaded", function() {
| | mw.loader.load('/index.php?title=MediaWiki:DropCalc.js&action=raw&ctype=text/javascript'); |
| // Only run if container exists
| | mw.loader.load('/index.php?title=MediaWiki:SlayerPointsCalc.js&action=raw&ctype=text/javascript'); |
| var container = document.getElementById("calcContainer");
| | mw.loader.load('/index.php?title=MediaWiki:BingoSheet.js&action=raw&ctype=text/javascript'); |
| if (!container) return;
| |
| | |
| // Build HTML via JS (CSP-safe)
| |
| container.innerHTML = `
| |
| <label>Base Drop Rate: <input type="number" id="baseRate" value="1000" style="width:80px;"></label><br><br>
| |
| <label>Donator Bonus:
| |
| <select id="donatorBonus">
| |
| <option value="0">None</option>
| |
| <option value="0.10">Bronze (10%)</option>
| |
| <option value="0.25">Divine (25%)</option>
| |
| <option value="0.50">Legendary (50%)</option>
| |
| </select>
| |
| </label><br><br>
| |
| <button id="calcButton">Calculate Drop Rate</button><br><br>
| |
| <div>Final Drop Rate: <span id="finalRate">0</span></div>
| |
| `;
| |
| | |
| var btn = document.getElementById("calcButton");
| |
| btn.addEventListener("click", function() {
| |
| var base = parseFloat(document.getElementById("baseRate").value) || 0;
| |
| var donator = parseFloat(document.getElementById("donatorBonus").value) || 0;
| |
| var finalRate = base * (1 - donator);
| |
| document.getElementById("finalRate").textContent = finalRate.toFixed(2);
| |
| });
| |
| });
| |