diff --git a/docs/example-parsers-duration.html b/docs/example-parsers-duration.html index 3009f80f..dd82d043 100644 --- a/docs/example-parsers-duration.html +++ b/docs/example-parsers-duration.html @@ -1,13 +1,15 @@ - - jQuery plugin: Tablesorter - Duration parser + + jQuery plugin: Tablesorter - Duration & countdown parsers + + @@ -46,39 +48,66 @@
+

+
-

- NOTE! -

-

+

+

Notes

+
+
    +
  • Both the duration & countdown parsers are contained in the parser-duration.js file.
  • +
  • Neither parser checks for valid time settings, all it does is parse the values to make them sortable.
  • +
+
+

Duration Parser

+
+
    +
  • The duration parser will convert a duration time "####y ####d ####h ####m ####s" into a sortable value.
  • +
  • It is not designed to convert 365 days into 1 year, nor perform any other conversions.
  • +
  • Options: +
      +
    • durationLabels +
        +
      • Default: '(?:years|year|y),(?:days|day|d),(?:hours|hour|h),(?:minutes|minute|min|m),(?:seconds|second|sec|s)'
      • +
      • Add more or change the duration labels by modifying this option; separate the labels with a comma.
      • +
      • The label doesn't need to include regex. If you are only using one letter, change the label to 'y,d,h,m,s'
      • +
      +
    • +
    • durationLength +
        +
      • Default: 4
      • +
      • Modify this value so that the max length of values is included.
      • +
      • The default value of 4 will include values up to 9,999
      • +
      • Values less than or equal to 99,999 will require this option to be set to 5
      • +
      • Values less than or equal to 999,999 need this value set to 6, etc.
      • +
      +
    • +
    +
  • +
+
+

Countdown Parser

+
+
    +
  • The countdown parser will convert a countdown time "####:####:####" into a sortable value.
  • +
  • It is not designed to deal with invalid times like 65:99 (65 minutes & 99 seconds).
  • +
  • This parser also uses the durantionLength value to set the maximum length of each value used in the countdown. +
      +
    • Default: 4
    • +
    • Modify this value so that the max length of values is included.
    • +
    • The default value of 4 will include values up to 9,999
    • +
    • Values less than or equal to 99,999 will require this option to be set to 5
    • +
    • Values less than or equal to 999,999 need this value set to 6, etc.
    • +
    +
  • +
+
+

Demo

@@ -89,21 +118,22 @@ Name Duration + Countdown - Frank1y 23d 12h 44m 9s - Fred12d 12h 14m 20s - Albert12h 14m 3s - Aaron3d 11h 13m 22s - Oliver3d 11h 14s - Xavier11m 41s - Henry12m - Lucy23d 12h 44m 10s - Marsha1y 1h 1m 1s - Pat12 days 12hours 44minutes 50 seconds - George33s - Oscar24d 12h 11m 11s + Frank1y 23d 12h 44m 9s2:21:16 + Fred12d 12h 14m 20s44:25 + Albert12h 14m 3s1:9:2 + Aaron3d 11h 13m 22s1:5:5 + Oliver3d 11h 14s4:33:33 + Xavier11m 41s59:59 + Henry12m10:22:32 + Lucy23d 12h 44m 10s2:43:52 + Marsha1y 1h 1m 1s3:12:18 + Pat12 days 12hours 44minutes 50 seconds22:51 + George33s1:53:21 + Oscar24d 12h 11m 11s51:12
@@ -123,7 +153,7 @@ len = $table[0].config.durationLength, regex = new RegExp('(\\d{' + len + '})', 'g'); // add parsed values to order & value column - addParsedValues( $table, [1], function(v){ + addParsedValues( $table, [1,2], function(v){ var t = v.replace(regex, '$1|'); return t.substring(0, t.length - 1); }); diff --git a/docs/index.html b/docs/index.html index 50a2f299..6296d0f6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -524,6 +524,7 @@

Custom Parsers