Commit graph

47 commits

Author SHA1 Message Date
Antoine Musso
13b1e66dab rv table sorting of IP and fraction
I am reverting, for now, two recent additions made to the table sorting:
 - r111884 fractions
 - r111829 IP addresses

Both need to be polished a bit more before landing in trunk. Please reapply
in a branch then once reviewed we can merge it in trunk, that will avoid
us a lot of "spam".
2012-03-06 10:17:46 +00:00
Derk-Jan Hartman
4c8e201755 Add support for sorting fractions in jquery.tablesorter
Fixes bug 15404
2012-02-19 19:56:56 +00:00
Derk-Jan Hartman
9427b08d08 Add support to tablesorter to handle IP/CIDR notation
This fixes bug 34475
2012-02-18 14:35:14 +00:00
Mark A. Hershberger
c8b8f3a303 re r102301 — apply Krinkle's suggested fix. 2012-01-04 19:09:03 +00:00
Rob Moen
178af33e21 fix tablesorter unit test in ie7. Add semicolon to end of statement in tablesorter class 2011-12-30 21:30:17 +00:00
Derk-Jan Hartman
934b01c67e Fix issue with sortable headers when nesting a table INSIDE a table header cell ?
Who comes up with these usecases ? :D

Fixes bug 32888
2011-12-09 22:39:04 +00:00
Mark A. Hershberger
5ce9371f30 Fix Bug #32047: in table with class="sortable", thead is before
caption

Apply fomafix's patch for jquery.tablesorter.js (also reported upstream:
https://forum.jquery.com/topic/in-table-with-class-sortable-thead-is-before-caption
(currently in moderation)
2011-11-07 17:33:13 +00:00
Krinkle
7553ecf2f6 jquery.tablesorter: More selector fixes
* Limit to rowSpans (td or th) within tableRows that are a direct child of this table's tBody
* Follows-up r99092, r101417
2011-10-31 22:20:25 +00:00
Krinkle
57faa93023 jquery.tablesorter: Selector fixes
* Various fixes to limit the selector to the current table and avoid selecting similar elements from other, nested, tables.
* Should fix bug 32049
* Follows-up r97150 and likely some other refactoring commits
2011-10-31 22:12:26 +00:00
Roan Kattouw
d4e2a4bf57 (bug 31514) Followup r99031: allow clicking of links in table headers in a different way that doesn't break expand/collapse links. 2011-10-25 14:41:58 +00:00
Krinkle
238c103636 Fix broken test by r99321 2011-10-16 22:33:04 +00:00
Derk-Jan Hartman
6a706e93c2 Check if there is a prexisting tfoot, before creating a new one.
Follow up to r98669, though this was a problem that also could surface without tfoot emulation.
2011-10-08 19:28:10 +00:00
Roan Kattouw
08d90ea002 (bug 31420) Fix weird tablesorter bug where headers spanning multiple rows would get screwed up. Thanks to TheDJ for essentially telling me exactly how to fix this, he was spot on. 2011-10-06 12:52:26 +00:00
Roan Kattouw
28dc1840f5 Fix the bug reported on w:en:WP:VP/T where clicking on links in sortable table headers sorts the table rather than following the link 2011-10-05 19:27:55 +00:00
Derk-Jan Hartman
11da46af78 Add tfoot emulation to tablesorter. Fixes part of the complaints in bug 31060 2011-10-02 11:58:46 +00:00
Derk-Jan Hartman
3277c2bc29 Add the class jquery-tablesorter to all tables that are made sortable.
Use this classname to raise the specificity of the sortHeader, so that it is more difficult to accidently override with local css. Followup to r98069

Move the css into a seperate file and move the images for it to the jquery directory.
2011-10-02 11:08:12 +00:00
Roan Kattouw
02fead5840 Followup to r97150 per CR: use .children() instead of .find(), more efficient and prevents potential issues with nested tables. 2011-09-17 15:52:45 +00:00
Roan Kattouw
33e19958bf Update jquery.tablesorter for r97145: emulate <thead> if there is no <thead> in the HTML, by walking down the table starting at the first row and moving rows to the <thead> as long as all of its cells are <th>s (or the row is empty). Also fix and simplify the sortbottom code, which was incorrectly creating multiple <tfoot> elements if there were multiple sortbottom rows. 2011-09-15 13:15:06 +00:00
Brion Vibber
a496d501af Followup to r86108, r86854, r96384: table sorter fetch of 'data-sort-value' attribute failed on IE 6/7 due to directly using DOM methods not available in those browsers.
hasAttribute and getAttribute don't appear until IE 8 in Microsoft-land; switching to jQuery's .attr() resolves this nicely.
2011-09-07 22:03:16 +00:00
Krinkle
3c3d81a185 Add comments and fix whitespace for r90657, r86305 2011-08-24 19:35:18 +00:00
Krinkle
0e82a6cfd0 Applying whitespace conventions in core JS files.
* Mostly whitespace in callers: $('foo').bar(baz,quux) => $( 'foo' ).bar( baz, quux )
* Also several occurrences of mixes spaces and tabs in the indention in front of a line, converted to tabs.
* And double spaces -> single spaces at random.
2011-08-12 21:48:10 +00:00
Krinkle
a046427547 Revert r90678 per CR 2011-07-04 23:36:54 +00:00
Leo Koppelkamm
05135e2303 r86088: Adding legacy support for .sortbottom & a test for it per CR 2011-06-30 19:40:19 +00:00
Krinkle
65c2c5cd6c Review and clean up of jquery.tablesorter.js + applying code conventions
* Dropping redundant "new function(){}" construction, instead using the closure we already have for the local scope.
* Adding more function documentation
* Whitespace contentions
* Passing jQuery object to the $.tablesorter.construct and creating jQuery plugin function in $.fn.tablesorter (per jQuery convention, this allows $.tablesorter.construct to be used directly without having to use .apply() to get the this-context right).
* Making use of the arguments that jQuery.fn.each passes by default in $.tablesorter.construct (this/that => table)
* Renaming a few single-letter variables to something more descriptive (c => $row, r => regex etc.)
* Changed order of local functions in order of calling and dependancy (fixed JSHint potential implied globals). Also makes reading/understanding them easier.
* Removed commented out code
* Added more line breaks to separate blocks
* Merge var-statements together
* Declare 'ts' shortcut on top of the local scope, define 'ts' shortcut directly after definition of $.tablesorter
* Adding public member placeholders, populated by private functions, to the initial object instead of inside the functions. This way the members can be seen centrally (dateRegex, monthNames)


* Syntax/JSHint fixes (Passes 100% now; Globals: mw, jQuery)
- 'list' used out of scope. In function buildParserCache: "var list" was defined under an if-condition, but returned outside of it, this fails in the 'else' case. Moved var list outside the if-condition
- Strict === comparison to 0, null, undefined, false, true, '' etc.
- Require curly braces around all blocks


* Performance improvements (see also http://www.mediawiki.org/wiki/JSPERF)
- Using dot notation (obj.member = {}), instead of $.extend(obj, { member: .. }) for single additions. No need for $.extend
- Object literal {foo}, instead of new function(){ this.foo }
- Strict/fast comparison to undefined, without typeof and/or string evaluation
- cacheRegexs() is uselses if if re-creates the cache every time. Using static cache instead (which was likely the intention)
2011-06-26 04:36:02 +00:00
Krinkle
b79f2ca398 Removing console.log and other ad-hoc debugging code 2011-06-26 02:05:34 +00:00
Derk-Jan Hartman
6f225a6c16 Switch jquery.sortable to use mw-sortable and mw-unsortable classes, to be in line with makeCollapsible. Support for legacy .sortable remains.
Follow up to r86088
2011-06-23 21:26:21 +00:00
Derk-Jan Hartman
9763099ca1 Fix global var leaking that was making collationsort fail on Safari 5
Followup to r86088.
2011-06-23 17:12:36 +00:00
Leo Koppelkamm
21d8e6d2ff Adding rowspan tests to tablesorting & make it more stable 2011-06-23 08:31:00 +00:00
Leo Koppelkamm
4f28b0435d Adding a collation test to tablesorter, fixing var ref from r90630 2011-06-23 07:39:56 +00:00
Brion Vibber
f2ff5d901a Followup r86088: test cases and a correction for bug 17141 (IPv4 address sorting)
Test lists 8 randomly generated IPv4 addresses and attempts to sort them both forward and back.
Turned up a bug where single-digit octets (eg a .1 or .9) were not expanded in the sort key, causing them to mis-sort.
2011-06-23 00:37:23 +00:00
Leo Koppelkamm
debf5bcc4a Revert accidental change from r90630 2011-06-22 23:22:12 +00:00
Brion Vibber
ec84480c18 Followup r86088, r87244, r90612: fix jquery.tablesorter for null collation table on IE
Attempt to build a regex from an empty list failed when calling new RegEx('[]', 'ig') on IE 6/7/8.
Now allowing null for the object, and also not trying to create the regex even if we have an empty object just in case.
2011-06-22 23:19:00 +00:00
Leo Koppelkamm
29976ac11e Tablesorter: Remove not really necessary setTimeout. 2011-06-22 23:03:12 +00:00
Leo Koppelkamm
7a87f58615 Hopefully fix IE6 regex tablesorter issue 2011-06-22 22:21:57 +00:00
Leo Koppelkamm
3993a2d72f Fix tablesorting bug that caused weird interferences between two tables; Make regex more strict to avoid mismatches. All QUnit tests pass now 2011-06-22 21:54:18 +00:00
Derk-Jan Hartman
cc2e49d862 Fix global var leaks in jquery.tablersorter.js 2011-06-22 20:40:00 +00:00
Leo Koppelkamm
abc88c1561 Tablesorter: Add a title attribute to sort arrows ( Bug 21453 ) 2011-05-03 11:44:35 +00:00
Leo Koppelkamm
f925945977 Tablesorter: use mw.config.get() to access globals; force mdy for english contentlang 2011-05-02 11:55:45 +00:00
Leo Koppelkamm
73ea7301ec Make jquery.tablesorter more resilient by checking multiple cells before assuming a type. Fixes Bug 28775 2011-05-02 11:31:45 +00:00
Leo Koppelkamm
507ae6c45e TableSorter: Allow whitespace between digits and percent sign. Fixes Bug 28406 2011-04-27 11:02:59 +00:00
Leo Koppelkamm
5761d25008 Followup to r86854: fix $ object 2011-04-25 13:18:09 +00:00
Leo Koppelkamm
b16efcada2 Followup to r86108: jQuery tries to be too smart and converts the string to a number, which breaks the value parser 2011-04-25 13:15:26 +00:00
Leo Koppelkamm
fdd72f8271 r86088: Get rid of eval by implemting a MergeSort algorithm. It's a few ms slower on very large tables, but is stable-sorting in all browsers 2011-04-18 19:20:02 +00:00
Leo Koppelkamm
77e1e201f6 Followup r86088 per CR: Move month array builder into language; use mw.config.get(); Fix rowspans and some cleanup 2011-04-18 12:54:28 +00:00
Leo Koppelkamm
26b32c426d r86108: Fix var name 2011-04-15 08:31:05 +00:00
Leo Koppelkamm
16760162b1 Followup ro r86088: Use data-sort-type instead of classes to specify the parser-type; add support for data-sort-value; strip legacy code (CR) 2011-04-15 08:23:29 +00:00
Leo Koppelkamm
7d6ddfe836 Completely rewritten table sorting script.
Fixes Bug 8028, Bug 8115, Bug 15406, Bug 17141, Bug 8732

1. Sites can specify custom collations.
The script accepts an object "tableSorterCollation" which contains a lookup
table, how specific characters should be treated.
For example, after setting "tableSorterCollation={'ä':'ae', 'ß':'ss'};" in the
site's common.js any string containing an ä or Ä will be sorted as if it were a
'ae'.

2. Table rows can be forced to use a specific data type.
By setting class="sort-{Parsername}", the row will be parsed with the specified
algorithm. class="sort-date" would force date sorting etc.
The following parsers are available: text, IPAddress, number, url, currency,
date, isoDate, usLongDate, time

3. Execution time is reduced by half or more.

Sorting a 935 row * 8 columns table:

Browser     Before      After
--------    ------      -----
Chrome 10   90ms        42ms
Safari 5    115ms       48ms
Firefox 4   412ms       87ms
IE8         720ms       115ms

4. Based on the content language and the mdy vs dmy preference, the parser can
understand dates such as "17. März '11". wgMonthNames=[] and
wgMonthNamesShort=[] 
in the content language and the mdy vs dmy preference are exported to js; A
table containing the following dates would be sorted correctly:
17. Jan. 01
23 Feb 1992
9.02.05
13 November 2001
14 Oktober '76

Was tested in ie6-8, chrome, safari 5, ff3 & ff4
2011-04-14 21:47:00 +00:00