Difference between revisions of "MediaWiki:Calculator.js"

m (added Player_Vendor_Fee.js)
m (Trying something.)
Line 2: Line 2:
 
  * Code for calculators.
 
  * Code for calculators.
 
  */
 
  */
var Calculator = Class.extend({
+
var Calculator = {
     init: function(content, id, title, columns) {
+
     display: function(content, id, title, columns) {
 
         var location = document.getElementById(id);
 
         var location = document.getElementById(id);
  
Line 25: Line 25:
 
         location.appendChild(table);
 
         location.appendChild(table);
 
     }
 
     }
});
+
};
  
 
switch (wgPageName) {
 
switch (wgPageName) {

Revision as of 13:16, 11 January 2011

/**
 * Code for calculators.
 */
var Calculator = {
    display: function(content, id, title, columns) {
        var location = document.getElementById(id);

        var table = document.createElement('table');
        table.className = 'uoguidetable open';

        var calcTableBody = document.createElement('tbody');
        table.appendChild(calcTableBody);

        var calcTableRow = document.createElement('tr');
        calcTableBody.appendChild(calcTableRow);

        var calcTableHeader = document.createElement('th');
        calcTableHeader.colSpan = columns;
        calcTableHeader.appendChild(document.createTextNode(title));
        calcTableRow.appendChild(calcTableHeader);

        calcTableRow = content;
        calcTableBody.appendChild(calcTableRow);

        location.appendChild(table);
    }
};

switch (wgPageName) {
    case 'Luck':
        importScript('MediaWiki:Calculator.js/Luck.js');
        break;
    case 'Mana_Regeneration':
        importScript('MediaWiki:Calculator.js/Mana_Regeneration.js');
        break;
    case 'Vendor':
        importScript('MediaWiki:Calculator.js/Player_Vendor_Fee.js');
        break;
}