Difference between revisions of "MediaWiki:Calculator.js/Mana Regeneration.js"
m |
m |
||
Line 4: | Line 4: | ||
var ManaPerSecondCalculator = Calculator.extend({ | var ManaPerSecondCalculator = Calculator.extend({ | ||
init: function() { | init: function() { | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
var calcTableRow = document.createElement('tr'); | var calcTableRow = document.createElement('tr'); | ||
var calcTableCell = document.createElement('td'); | var calcTableCell = document.createElement('td'); | ||
Line 31: | Line 17: | ||
calcTableRow.appendChild(calcTableCell); | calcTableRow.appendChild(calcTableCell); | ||
− | meditationInput.maxLength = 5; | + | meditationInput.maxLength = '5'; |
meditationInput.type = 'text'; | meditationInput.type = 'text'; | ||
meditationInput.style.width = '45px'; | meditationInput.style.width = '45px'; | ||
− | |||
− | |||
− | |||
calcTableCell = document.createElement('td'); | calcTableCell = document.createElement('td'); | ||
calcTableCell.appendChild(meditationInput); | calcTableCell.appendChild(meditationInput); | ||
Line 43: | Line 26: | ||
calculateButton.type = 'button'; | calculateButton.type = 'button'; | ||
calculateButton.value = 'Calculate >>'; | calculateButton.value = 'Calculate >>'; | ||
− | |||
− | |||
− | |||
calcTableCell = document.createElement('td'); | calcTableCell = document.createElement('td'); | ||
calcTableCell.appendChild(calculateButton); | calcTableCell.appendChild(calculateButton); |
Revision as of 11:58, 4 May 2010
/** * Calculator that calculates your mana regenerated per second based on Meditation, Focus, Intelligence, and equipped MR. */ var ManaPerSecondCalculator = Calculator.extend({ init: function() { var calcTableRow = document.createElement('tr'); var calcTableCell = document.createElement('td'); var meditationInput = document.createElement('input'); var focusInput = document.createElement('input'); var intInput = document.createElement('input'); var mrInput = document.createElement('input'); var calculateButton = document.createElement('input'); var manaPerSecondLabel = document.createElement('div'); calcTableCell.style.textAlign = 'right'; calcTableCell.appendChild(document.createTextNode('Meditation:')); calcTableRow.appendChild(calcTableCell); meditationInput.maxLength = '5'; meditationInput.type = 'text'; meditationInput.style.width = '45px'; calcTableCell = document.createElement('td'); calcTableCell.appendChild(meditationInput); calcTableRow.appendChild(calcTableCell); calculateButton.type = 'button'; calculateButton.value = 'Calculate >>'; calcTableCell = document.createElement('td'); calcTableCell.appendChild(calculateButton); calcTableRow.appendChild(calcTableCell); manaPerSecondLabel.appendChild(document.createTextNode('0 Mana Per Second')); manaPerSecondLabel.style.textAlign = 'right'; manaPerSecondLabel.style.width = '120px'; calcTableCell = document.createElement('td'); calcTableCell.appendChild(percentChanceLabel); calcTableRow.appendChild(calcTableCell); this._super(calcTableRow, 'ManaPerSecond', 'Mana Per Second', 4); } }); function searchForCalculators() { var calculators = document.getElementsByTagName('div'); for (var i in calculators) { if (calculators[i].id == 'ManaPerSecond') { new ManaPerSecondCalculator(); } } } addOnloadHook(searchForCalculators);