MediaWiki:Common.js
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ //console.log( 'Hi from Common.js' ); for ( var i in document.jj5_totals ) { var spec = document.jj5_totals[ i ]; sum_column( spec.id, spec.col ); } function sum_column( id, col ) { console.log( [ id, col ] ); var total = 0; var mytable = document.getElementById( id ); for ( var v=1; v < mytable.rows.length - 1; v++ ) { var val = mytable.rows[v].cells[col].innerHTML; console.log( val ); val = val.replace( '$', '' ); val = parseFloat( val ); if ( ! isNaN( val ) ) { total += val; } } console.log( total ); total = total.toLocaleString('en-AU'); document.getElementById( id + '_sum' ).innerHTML = total; }