|
|
| Line 480: |
Line 480: |
| } | | } |
| addOnloadHook(uploadwizard_newusers); | | addOnloadHook(uploadwizard_newusers); |
|
| |
| /***** autosort_sortable ********
| |
| * Auto-sorts sortable tables by specified columns (why is this not built-in?!)
| |
| *
| |
| * Maintainers: [[User:Iritscen]]
| |
| */
| |
| function sortSortableTables()
| |
| {
| |
| // Iterate over all <div> elements
| |
| var divs = document.getElementsByTagName("div");
| |
| for (var i = 0; i < divs.length; i++)
| |
| {
| |
| var theDiv = divs[i];
| |
| // If we found a sortable table...
| |
| if (hasClass(theDiv, "sortable"))
| |
| {
| |
| alert("Found one.");
| |
| // ...Look for sort button
| |
| //for (var j = 0; j < theDiv.length; j++)
| |
| //{
| |
| var allTHs = theDiv.getElementsByTagName("th");
| |
| if (!allTHs) continue;
| |
|
| |
| for (var k = 0; k < allTHs.length; k++)
| |
| {
| |
| if (hasClass(allTHs[k], "headersort"))
| |
| {
| |
| alert("Found the arrow.");
| |
| allTHs[k].trigger(click); // use jQuery's trigger() to send click event to this arrow
| |
| }
| |
| }
| |
| //}
| |
| }
| |
| }
| |
| }
| |
|
| |
| addOnloadHook(sortSortableTables);
| |