Jump to content

MediaWiki:Common.js: Difference between revisions

do we have to put this on a timer to give the page time to load?
(don't need this?)
(do we have to put this on a timer to give the page time to load?)
Line 517: Line 517:
  *  Maintainers: [[User:Iritscen]]
  *  Maintainers: [[User:Iritscen]]
  */
  */
function sortTimer()
{
    setTimeout(function()
    {
        sortSortableTables();
    }, (3 * 1000));
}


function sortSortableTables()
function sortSortableTables()
{
{
    await new Promise(r => setTimeout(() => r(), 2000));
     console.log("Sorting the autosort tables.");
     console.log("Sorting the autosort tables.");
     // Iterate over all <div> elements
     // Iterate over all <div> elements
Line 547: Line 554:
                         if ($(theTable).hasClass(colOption))
                         if ($(theTable).hasClass(colOption))
                         {
                         {
                             console.log("Table " + j + " wants to sort by column " + col);
                             //console.log("Table " + j + " wants to sort by column " + col);
                             sortColumnNum = col;
                             sortColumnNum = col;


Line 559: Line 566:
                             for (var k = 0; k < allTHs.length; k++)
                             for (var k = 0; k < allTHs.length; k++)
                             {
                             {
                                 console.log("Class names for 'th' # " + k + " are " + allTHs[k].className);
                                 //console.log("Class names for 'th' # " + k + " are " + allTHs[k].className);
                                 if ($(allTHs[k]).hasClass("headerSort"))
                                 if ($(allTHs[k]).hasClass("headerSort"))
                                 {
                                 {
Line 579: Line 586:
}
}


$(sortSortableTables);
$(sortTimer);