Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5208
wikibits_reverse_sorting.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:22 PM
2014-11-21 22:22:15 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
wikibits_reverse_sorting.diff
View Options
Index: wikibits.js
===================================================================
--- wikibits.js (revision 40943)
+++ wikibits.js (working copy)
@@ -547,8 +547,12 @@
// We have a first row: assume it's the header, and make its contents clickable links
for (var i = 0; i < firstRow.cells.length; i++) {
var cell = firstRow.cells[i];
- if ((" "+cell.className+" ").indexOf(" unsortable ") == -1) {
- cell.innerHTML += ' <a href="#" class="sortheader" onclick="ts_resortTable(this);return false;"><span class="sortarrow"><img src="'+ ts_image_path + ts_image_none + '" alt="↓"/></span></a>';
+ var cellClass = " " + cell.className + " ";
+ if (cellClass.indexOf(" unsortable ") == -1) {
+ if (cellClass.indexOf(" sortreverse ") == -1)
+ cell.innerHTML += ' <a href="#" class="sortheader" onclick="ts_resortTable(this);return false;"><span class="sortarrow" sortdir="up"><img src="'+ ts_image_path + ts_image_none + '" alt="↑"/></span></a>';
+ else
+ cell.innerHTML += ' <a href="#" class="sortheader" onclick="ts_resortTable(this);return false;"><span class="sortarrow" sortdir="down"><img src="'+ ts_image_path + ts_image_none + '" alt="↓"/></span></a>';
}
}
if (ts_alternate_row_colors) {
@@ -636,9 +640,8 @@
newRows.sort(sortfn);
- var arrowHTML;
if (reverse) {
- arrowHTML = '<img src="'+ ts_image_path + ts_image_down + '" alt="↓"/>';
+ span.innerHTML = '<img src="' + ts_image_path + ts_image_down + '" alt="↓"/>';
newRows.reverse();
span.setAttribute('sortdir','up');
} else {
@@ -661,9 +664,18 @@
// Delete any other arrows there may be showing
var spans = getElementsByClassName(tr, "span", "sortarrow");
for (var i = 0; i < spans.length; i++) {
- spans[i].innerHTML = '<img src="'+ ts_image_path + ts_image_none + '" alt="↓"/>';
+ var thisSpan = spans[i]
+ if (thisSpan != span) {
+ var cellClass = " " + thisSpan.parentNode.parentNode.className + " "
+ if (cellClass.indexOf(" sortreverse ") == -1) {
+ thisSpan.setAttribute("sortdir", "up")
+ thisSpan.innerHTML = '<img src="' + ts_image_path + ts_image_none + '" alt="Sort in ascending order."/>'
+ } else {
+ thisSpan.setAttribute("sortdir", "down")
+ thisSpan.innerHTML = '<img src="' + ts_image_path + ts_image_none + '" alt="Sort in descending order."/>'
+ }
+ }
}
- span.innerHTML = arrowHTML;
if (ts_alternate_row_colors) {
ts_alternate(table);
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4769
Default Alt Text
wikibits_reverse_sorting.diff (2 KB)
Attached To
Mode
T17403: tablesorter should provide a way to have a particular column be sorted in reverse order by default
Attached
Detach File
Event Timeline
Log In to Comment