MediaWiki:SlayerPointsCalc.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
mw.hook('wikipage.content').add(function () { | |||
if (mw.config.get('wgPageName') !== "Slayer_points_calculator") return; | if (mw.config.get('wgPageName') !== "Slayer_points_calculator") return; | ||
if (document.getElementById("slayerPointsCalc")) return; | if (document.getElementById("slayerPointsCalc")) return; | ||
const container = document. | const container = document.getElementById("slayerPointsCalc"); | ||
container | if (!container) return; | ||
container.innerHTML = ` | container.innerHTML = ` | ||
| Line 27: | Line 27: | ||
</table> | </table> | ||
`; | `; | ||
const tasks = [ | const tasks = [ | ||
Revision as of 00:34, 7 March 2026
mw.hook('wikipage.content').add(function () {
if (mw.config.get('wgPageName') !== "Slayer_points_calculator") return;
if (document.getElementById("slayerPointsCalc")) return;
const container = document.getElementById("slayerPointsCalc");
if (!container) return;
container.innerHTML = `
<h3>Slayer Points Calculator</h3>
<label>Boost:</label>
<select id="boostSelect">
<option value="1">None</option>
<option value="1.75">Divine Donator (+75%)</option>
</select>
<table class="wikitable">
<thead>
<tr>
<th>Task Milestone</th>
<th>Slayer Points</th>
</tr>
</thead>
<tbody id="slayerTable"></tbody>
</table>
`;
const tasks = [
{ name: "Normal Task", points: 10 },
{ name: "Every 10th Task", points: 50 },
{ name: "Every 50th Task", points: 150 },
{ name: "Every 100th Task", points: 300 },
{ name: "Every 250th Task", points: 500 },
{ name: "Every 1000th Task", points: 1000 }
];
function updateTable() {
const multiplier = parseFloat(document.getElementById("boostSelect").value);
let html = "";
tasks.forEach(task => {
const boosted = Math.floor(task.points * multiplier);
html += `
<tr>
<td>${task.name}</td>
<td>${boosted}</td>
</tr>
`;
});
document.getElementById("slayerTable").innerHTML = html;
}
document.getElementById("boostSelect").addEventListener("change", updateTable);
updateTable();
});