MediaWiki:Gadget-fa-bid-calculator.js: Difference between revisions
Drop cap note, Salary label, new-topic link |
Show component points beside each input |
||
| Line 17: | Line 17: | ||
function money( n ) { | function money( n ) { | ||
return '$' + n.toLocaleString( 'en-US' ); | return '$' + n.toLocaleString( 'en-US' ); | ||
} | |||
function pointWord( n ) { | |||
return '= ' + pts( n ) + ( pts( n ) === 1 ? ' point' : ' points' ); | |||
} | } | ||
| Line 136: | Line 140: | ||
fillYears(); | fillYears(); | ||
row( 'Years', years ); | var yearPts = document.createElement( 'span' ); | ||
row( 'Salary', salary ); | yearPts.className = 'tc-calc-inline'; | ||
row( 'Years', years ).appendChild( yearPts ); | |||
var salaryPts = document.createElement( 'span' ); | |||
salaryPts.className = 'tc-calc-inline'; | |||
row( 'Salary', salary ).appendChild( salaryPts ); | |||
var ageRow = row( 'Player is 35 or over', age35 ); | var ageRow = row( 'Player is 35 or over', age35 ); | ||
ageRow.querySelector( 'label' ).style.fontWeight = 'normal'; | ageRow.querySelector( 'label' ).style.fontWeight = 'normal'; | ||
| Line 156: | Line 165: | ||
if ( !s || isNaN( s ) ) { | if ( !s || isNaN( s ) ) { | ||
yearPts.textContent = ''; | |||
salaryPts.textContent = ''; | |||
var empty = document.createElement( 'p' ); | var empty = document.createElement( 'p' ); | ||
empty.className = 'tc-calc-note'; | empty.className = 'tc-calc-note'; | ||
| Line 164: | Line 175: | ||
var total = points( y, s ); | var total = points( y, s ); | ||
yearPts.textContent = pointWord( y * YEAR_POINTS ); | |||
salaryPts.textContent = pointWord( s / 1000000 ); | |||
var big = document.createElement( 'div' ); | var big = document.createElement( 'div' ); | ||
| Line 170: | Line 183: | ||
out.appendChild( big ); | out.appendChild( big ); | ||
// --- validity --- | // --- validity --- | ||