MediaWiki:Wikia.js: Difference between revisions

From Tower Defense Simulator Wiki
Jump to navigation Jump to search
Content deleted Content added
imported>WikiaColors
No edit summary
imported>WikiaColors
No edit summary
Line 24: Line 24:
borderColor: 'rgb(55,213,190)',
borderColor: 'rgb(55,213,190)',
showLine: true,
showLine: true,
data: [45, 49, 52, 56, 59, 63, 66, 70, 73, 77, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 327, 328, 330, 331, 333, 334, 336, 337, 339, 340, 342, 343, 345, 346, 348, 349, 351, 352, 354],
data: [45, 49, 52, 56, 59, 63, 66, 70, 73, 77, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 327, 328, 330, 331, 333, 334, 336, 337, 339, 340, 342, 343, 345, 346, 348, 349, 351, 352, 354, 355, 357, 358, 360, 361, 363, 364, 366, 367, 369, 370, 372, 373, 375, 376, 378, 379, 381, 382, 384, 385],
fill: false,
fill: false,
},
},

Revision as of 09:30, 18 July 2020

InactiveUsers = { months: 6 };

importScriptPage("MediaWiki:Chart.js", "dev"); // Manually load the script because ImportJS fails
;(function( $, mw, Chart ) {                   // Wait for huge script to load
    setTimeout(function() {
        clearInterval(interval);
    }, 10000);                                 // But don't wait more than 10 seconds
    
    function startCharts() {
        if ($("#expByRank").length) {
            var xbr = document.getElementById('expByRank');
            var xbr2 = document.createElement('canvas'); // Manually create a <canvas> tag from the div with id="expByRank"
            xbr.appendChild(xbr2).getContext('2d');
            xbr = xbr2.getContext('2d');

            var xbrChart = new window.Chart(xbr, {
                // The type of chart we want to create
                type: 'line',
                // The data for our dataset
                data: {
                   labels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80'],
                  datasets: [ {
                     label: 'Current EXP required to level up',
                        borderColor: 'rgb(55,213,190)',
                        showLine: true,
                        data: [45, 49, 52, 56, 59, 63, 66, 70, 73, 77, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 327, 328, 330, 331, 333, 334, 336, 337, 339, 340, 342, 343, 345, 346, 348, 349, 351, 352, 354, 355, 357, 358, 360, 361, 363, 364, 366, 367, 369, 370, 372, 373, 375, 376, 378, 379, 381, 382, 384, 385],
                        fill: false,
                 },
                      {
                       label: 'Pre-MEGA 2 EXP required to level up',
                       borderColor: 'rgb(68, 85, 90)',
                       showLine: true,
                       data: [165, 335, 660, 1490, 2645, 4130, 5950, 8000, 10100, 12200, 14300, 16400, 18500, 20600, 22700, 24800, 26900, 29000, 31100, 33200, 35300, 37400, 39500, 41600, 43700, 45800, 47900, 50000, 52100, 54200, 56300, 58400, 60500, 62600, 64700, 66800, 68900, 71000, 73100, 75200, 77300, 79400, 81500, 83600, 85700, 87800, 89900, 92000, 94100, 96200, 98300, 100400, 102500, 104600, 106700, 108800, 110900, 113000, 115100, 117200, 119300],
                      fill: false,
                   },]
              },

              // Configuration options go here
               options: {}
          });
        }

    }
    interval = setInterval(function() {
        if (window.Chart && ($("#expByRank").length)) {
            clearInterval(interval);
            startCharts();
        }
    }, 500);
})(jQuery, mediaWiki, window.Chart);