MediaWiki:Gadget-fa-bid-calculator.js: Difference between revisions
Drop add-a-year, 35 or older, copy on new-topic click |
35+ wording, Use-this-salary button |
||
| Line 154: | Line 154: | ||
salaryPts.className = 'tc-calc-inline'; | salaryPts.className = 'tc-calc-inline'; | ||
row( 'Salary', salary ).appendChild( salaryPts ); | row( 'Salary', salary ).appendChild( salaryPts ); | ||
var ageRow = row( 'Player is 35 | var ageRow = row( 'Player is 35+', age35 ); | ||
ageRow.querySelector( 'label' ).style.fontWeight = 'normal'; | ageRow.querySelector( 'label' ).style.fontWeight = 'normal'; | ||
row( 'Bid to beat (optional)', beat ); | row( 'Bid to beat (optional)', beat ); | ||
| Line 198: | Line 198: | ||
if ( y > max ) { | if ( y > max ) { | ||
problems.push( 'Maximum length is ' + max + ' years' + | problems.push( 'Maximum length is ' + max + ' years' + | ||
( age35.checked ? ' for a player 35 | ( age35.checked ? ' for a player 35+' : '' ) + '.' ); | ||
} | } | ||
if ( problems.length ) { | if ( problems.length ) { | ||
| Line 225: | Line 225: | ||
box.textContent = 'To beat ' + pts( target ) + ' points at ' + y + | box.textContent = 'To beat ' + pts( target ) + ' points at ' + y + | ||
( y === 1 ? ' year' : ' years' ) + ': ' + money( newSalary ) + | ( y === 1 ? ' year' : ' years' ) + ': ' + money( newSalary ) + | ||
' (' + pts( points( y, newSalary ) ) + ' points).'; | ' (' + pts( points( y, newSalary ) ) + ' points). '; | ||
var use = document.createElement( 'button' ); | |||
use.type = 'button'; | |||
use.className = 'tc-calc-use'; | |||
use.textContent = 'Use ' + money( newSalary ); | |||
use.addEventListener( 'click', function () { | |||
salary.value = String( newSalary ); | |||
render(); | |||
} ); | |||
box.appendChild( use ); | |||
} | } | ||
out.appendChild( box ); | out.appendChild( box ); | ||