MediaWiki:SwingSpeed.js
MediaWiki interface page
More actions
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
function calculateSwingSpeed() {
var Speed = 0;
var SpeedRoundUp = 0;
var myStamina = parseFloat(document.SwingSpeed.Stamina.value);
var myWeaponSpeed = parseFloat(document.SwingSpeed.WeaponSpeed.value);
Speed = 15000 / ((myStamina + 100) * myWeaponSpeed);
SpeedRoundUp = Math.ceil(Speed / 0.25) * 0.25
document.SwingSpeed.Speed.value = SpeedRoundUp;
}
(function () {
var myElement = document.getElementById('swing-speed');
myElement.innerHTML = '<form name=\"SwingSpeed\" action=\"\"><span style=\"clear: both;\">Stamina:</span> <input type=\"text\" name=\"Stamina\" size=\"3\" style=\"float: right; text-align: center;\"> <br style=\"clear: both;\"/><span style=\"clear: both;\">Weapon Speed: </span><input type=\"text\" name=\"WeaponSpeed\" size=\"3\" style=\"float: right; text-align: center;\"> <br style=\"clear: both;\"/> <input type=\"button\" value=\"Calculate Swing Speed\" onclick=\"calculateSwingSpeed()\" style=\"font-weight: bold;\"><br style=\"clear: both;\"/><span style=\"clear: both; font-weight: bold;\">Resulting Swing Speed:</span> <input type=\"text\" disabled name=\"Speed\" size=\"4\" style=\"float: right; text-align: right;\"> <br style=\"clear: both;\"/></form>';
}());