From 83e561fe7432402b648547d717910567c966f4b6 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Fri, 26 Dec 2008 22:00:15 +0000 Subject: [PATCH] =?utf8?q?*=20(bug=2016754)=20Making=20arbitrary=20rows=20?= =?utf8?q?of=20sortable=20tables=20sticky:=20=20=20|-=20class=3D"unsortabl?= =?utf8?q?e"=20Patch=20by=20Ren=C3=A9=20Kijewski?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CREDITS | 1 + RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 2 +- skins/common/wikibits.js | 16 ++++++++++++---- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CREDITS b/CREDITS index 9a51f84d02..6590f090e8 100644 --- a/CREDITS +++ b/CREDITS @@ -74,6 +74,7 @@ following names for their contribution to the product. * Olaf Lenz * Paul Copperman * RememberTheDot +* René Kijewski * ST47 == Translators == diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 70ad4bf672..2c04efc972 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -250,6 +250,8 @@ The following extensions are migrated into MediaWiki 1.14: * Special:Log: Add 'change protection' link for unprotected pages too * Special:Log: Add log type specific CSS classes 'mw-logline-$logtype' to 'li' elements +* (bug 16754) Making arbitrary rows of sortable tables sticky: + |- class="unsortable" === Bug fixes in 1.14 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2b12f1c1ea..efe1b2f0df 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1444,7 +1444,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '192'; +$wgStyleVersion = '193'; # Server-side caching: diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 8ad57c02e3..3421aeec20 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -637,13 +637,16 @@ function ts_resortTable(lnk) { var reverse = (span.getAttribute("sortdir") == 'down'); var newRows = new Array(); + var staticRows = new Array(); for (var j = rowStart; j < table.rows.length; j++) { var row = table.rows[j]; - var keyText = ts_getInnerText(row.cells[column]); - var oldIndex = (reverse ? -j : j); - var preprocessed = preprocessor( keyText ); + if((" "+row.className+" ").indexOf(" unsortable ") < 0) { + var keyText = ts_getInnerText(row.cells[column]); + var oldIndex = (reverse ? -j : j); + var preprocessed = preprocessor( keyText ); - newRows[newRows.length] = new Array(row, preprocessed, oldIndex); + newRows[newRows.length] = new Array(row, preprocessed, oldIndex); + } else staticRows[staticRows.length] = new Array(row, false, j-rowStart); } newRows.sort(sortfn); @@ -658,6 +661,11 @@ function ts_resortTable(lnk) { span.setAttribute('sortdir','down'); } + for(var i in staticRows) { + var row = staticRows[i]; + newRows.splice(row[2], 0, row); + } + // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones // don't do sortbottom rows for (var i = 0; i < newRows.length; i++) { -- 2.20.1