Jump to content

MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 556: Line 556:
             if (hasClass(theTable, "sortable") && hasClass(theTable, "autosort"))
             if (hasClass(theTable, "sortable") && hasClass(theTable, "autosort"))
             {
             {
              var sortColumnNum = 1, curColumnNum = 0;
                var sortColumnNum = 1, curColumnNum = 0;
              if (hasClass(theTable, "by-column.."))
 
                  sortColumnNum = 4;
                // Take advantage of fact that hasClass() uses regex; if there is any by-column-x class at all,
                // then take the time to figure out the value of x
                if (hasClass(theTable, "by-column.."))
                {
                    for (var col = 1; col < 10; col++)
                    {
                        var colOption = "by-column-" + col;
                        if (hasClass(theTable, colOption))
                        {
                            sortColumnNum = col;
                            break;
                        }
                    }
                }


                 // ...Look for sort button and click it
                 // ...Look for sort button and click it
Line 570: Line 583:
                         if (curColumnNum == sortColumnNum)
                         if (curColumnNum == sortColumnNum)
                         {
                         {
                          $(allTHs[k]).trigger("click"); // use jQuery's trigger() to send click event to this arrow
                            $(allTHs[k]).trigger("click"); // use jQuery's trigger() to send click event to this arrow
                          return;
                            return;
                         }
                         }
                     }
                     }