WP-Optimize - Version 2.2.3

Version Description

  • 04/Apr/2018 =

  • FEATURE: Added the ability to repair corrupted database tables

  • FIX: Fixed dismiss notices functionality

  • FIX: When detecting potentially unused images, exclude those found mentionned in the options table(s)

  • TWEAK: Load WPO translations (logger classes info included) when template is pulled for UpdraftCentral-WPO module

  • TWEAK: Add get_js_translation command for the UpdraftCentral WPO module

  • TWEAK: Added logging for fatal errors

Download this release

Release Info

Developer DavidAnderson
Plugin Icon 128x128 WP-Optimize
Version 2.2.3
Comparing to
See all releases

Code changes from version 2.2.2 to 2.2.3

includes/class-commands.php CHANGED
@@ -48,34 +48,67 @@ class WP_Optimize_Commands {
48
  * Pulls and return the "WP Optimize" template contents. Primarily used for UpdraftCentral
49
  * content display through ajax request.
50
  *
51
- * @return string "WP Optimize" tab's rendered contents
52
  */
53
  public function get_wp_optimize_contents() {
54
- return WP_Optimize()->include_template('optimize-table.php', true, array('optimize_db' => false));
 
 
 
 
 
55
  }
56
 
57
  /**
58
  * Pulls and return the "Table Information" template contents. Primarily used for UpdraftCentral
59
  * content display through ajax request.
60
  *
61
- * @return string "Table Information" tab's rendered contents
62
  */
63
  public function get_table_information_contents() {
64
- return WP_Optimize()->include_template('tables.php', true, array('optimize_db' => false));
 
 
 
 
 
65
  }
66
 
67
  /**
68
  * Pulls and return the "Settings" template contents. Primarily used for UpdraftCentral
69
  * content display through ajax request.
70
  *
71
- * @return string "Settings" tab's rendered contents
72
  */
73
  public function get_settings_contents() {
74
  $admin_settings = WP_Optimize()->include_template('admin-settings-general.php', true, array('optimize_db' => false));
75
  $admin_settings .= WP_Optimize()->include_template('admin-settings-auto-cleanup.php', true, array('optimize_db' => false));
76
  $admin_settings .= WP_Optimize()->include_template('admin-settings-logging.php', true, array('optimize_db' => false));
77
  $admin_settings .= WP_Optimize()->include_template('admin-settings-sidebar.php', true, array('optimize_db' => false));
78
- return $admin_settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  public function save_settings($data) {
@@ -225,10 +258,10 @@ class WP_Optimize_Commands {
225
 
226
  $results = array();
227
  $optimizations = $this->optimizer->get_optimizations();
228
- $hidden_in_optimizations_list = apply_filters('wpo_hidden_in_optimizations_list', array('images', 'attachments'));
229
 
230
  foreach ($optimizations as $optimization_id => $optimization) {
231
- if (in_array($optimization_id, $hidden_in_optimizations_list)) continue;
 
232
  $results[$optimization_id] = $optimization->get_settings_html();
233
  }
234
 
48
  * Pulls and return the "WP Optimize" template contents. Primarily used for UpdraftCentral
49
  * content display through ajax request.
50
  *
51
+ * @return array An array containing the WPO translations and the "WP Optimize" tab's rendered contents
52
  */
53
  public function get_wp_optimize_contents() {
54
+ $content = WP_Optimize()->include_template('optimize-table.php', true, array('optimize_db' => false));
55
+
56
+ return array(
57
+ 'content' => $content,
58
+ 'translations' => $this->get_js_translation()
59
+ );
60
  }
61
 
62
  /**
63
  * Pulls and return the "Table Information" template contents. Primarily used for UpdraftCentral
64
  * content display through ajax request.
65
  *
66
+ * @return array An array containing the WPO translations and the "Table Information" tab's rendered contents
67
  */
68
  public function get_table_information_contents() {
69
+ $content = WP_Optimize()->include_template('tables.php', true, array('optimize_db' => false));
70
+
71
+ return array(
72
+ 'content' => $content,
73
+ 'translations' => $this->get_js_translation()
74
+ );
75
  }
76
 
77
  /**
78
  * Pulls and return the "Settings" template contents. Primarily used for UpdraftCentral
79
  * content display through ajax request.
80
  *
81
+ * @return array An array containing the WPO translations and the "Settings" tab's rendered contents
82
  */
83
  public function get_settings_contents() {
84
  $admin_settings = WP_Optimize()->include_template('admin-settings-general.php', true, array('optimize_db' => false));
85
  $admin_settings .= WP_Optimize()->include_template('admin-settings-auto-cleanup.php', true, array('optimize_db' => false));
86
  $admin_settings .= WP_Optimize()->include_template('admin-settings-logging.php', true, array('optimize_db' => false));
87
  $admin_settings .= WP_Optimize()->include_template('admin-settings-sidebar.php', true, array('optimize_db' => false));
88
+ $content = $admin_settings;
89
+
90
+ return array(
91
+ 'content' => $content,
92
+ 'translations' => $this->get_js_translation()
93
+ );
94
+ }
95
+
96
+ /**
97
+ * Returns array of translations used by the WPO plugin. Primarily used for UpdraftCentral
98
+ * consumption.
99
+ *
100
+ * @return array The WPO translations
101
+ */
102
+ public function get_js_translation() {
103
+ $translations = WP_Optimize()->wpo_js_translations();
104
+
105
+ // Make sure that we include the loggers classes info whenever applicable before
106
+ // returning the translations to UpdraftCentral.
107
+ if (is_callable(array(WP_Optimize(), 'get_loggers_classes_info'))) {
108
+ $translations['loggers_classes_info'] = WP_Optimize()->get_loggers_classes_info();
109
+ }
110
+
111
+ return $translations;
112
  }
113
 
114
  public function save_settings($data) {
258
 
259
  $results = array();
260
  $optimizations = $this->optimizer->get_optimizations();
 
261
 
262
  foreach ($optimizations as $optimization_id => $optimization) {
263
+ if (false === $optimization->display_in_optimizations_list()) continue;
264
+
265
  $results[$optimization_id] = $optimization->get_settings_html();
266
  }
267
 
includes/class-wp-optimization.php CHANGED
@@ -103,6 +103,15 @@ abstract class WP_Optimization {
103
  return apply_filters('wp_optimize_optimization_query_result', $result, $sql, $this);
104
  }
105
 
 
 
 
 
 
 
 
 
 
106
  /**
107
  * Do actions before get_info() function.
108
  */
103
  return apply_filters('wp_optimize_optimization_query_result', $result, $sql, $this);
104
  }
105
 
106
+ /**
107
+ * Display or hide optimization in optimizations list.
108
+ *
109
+ * @return bool
110
+ */
111
+ public function display_in_optimizations_list() {
112
+ return true;
113
+ }
114
+
115
  /**
116
  * Do actions before get_info() function.
117
  */
includes/class-wp-optimizer.php CHANGED
@@ -149,6 +149,8 @@ class WP_Optimizer {
149
  return $optimization;
150
  }
151
 
 
 
152
  $optimization->init();
153
 
154
  if (apply_filters('wp_optimize_do_optimization', true, $which_optimization, $optimization)) {
@@ -189,6 +191,8 @@ class WP_Optimizer {
189
 
190
  if (is_wp_error($optimization)) return $optimization;
191
 
 
 
192
  $optimization->before_get_info();
193
 
194
  if ($optimization->run_multisite) {
@@ -220,17 +224,15 @@ class WP_Optimizer {
220
  if (empty($optimization_options)) return $results;
221
 
222
  $optimizations = $this->sort_optimizations($this->get_optimizations(), 'run_sort_order');
223
-
224
- $time_limit = (defined('WP_OPTIMIZE_SET_TIME_LIMIT') && WP_OPTIMIZE_SET_TIME_LIMIT > 15) ? WP_OPTIMIZE_SET_TIME_LIMIT : 1800;
225
-
226
  foreach ($optimizations as $optimization_id => $optimization) {
227
  $option_id = call_user_func(array($optimization, 'get_'.$which_option.'_id'));
228
 
229
  if (isset($optimization_options[$option_id])) {
230
  if ('auto' == $which_option && empty($optimization->available_for_auto)) continue;
231
-
232
- // Try to reduce the chances of PHP self-terminating via reaching max_execution_time.
233
- set_time_limit($time_limit);
234
  $results[$optimization_id] = $this->do_optimization($optimization);
235
  }
236
  }
@@ -277,7 +279,9 @@ class WP_Optimizer {
277
  $include_table = apply_filters('wp_optimize_get_tables_include_table', $include_table, $table_name, $table_prefix);
278
 
279
  $table_status[$index]->is_optimizable = WP_Optimize()->get_db_info()->is_table_optimizable($table_name);
280
- $table_status[$index]->is_type_supported = WP_Optimize()->get_db_info()->is_table_type_supported($table_name);
 
 
281
 
282
  if (!$include_table) unset($table_status[$index]);
283
  }
@@ -297,8 +301,10 @@ class WP_Optimizer {
297
  $table = WP_Optimize()->get_db_info()->get_table_status($table_name);
298
 
299
  $table->is_optimizable = WP_Optimize()->get_db_info()->is_table_optimizable($table_name);
300
- $table->is_type_supported = WP_Optimize()->get_db_info()->is_table_type_supported($table_name);
 
301
 
 
302
  return $table;
303
  }
304
 
@@ -458,4 +464,15 @@ class WP_Optimizer {
458
 
459
  return array('output' => $output);
460
  }
 
 
 
 
 
 
 
 
 
 
 
461
  }
149
  return $optimization;
150
  }
151
 
152
+ $this->change_time_limit();
153
+
154
  $optimization->init();
155
 
156
  if (apply_filters('wp_optimize_do_optimization', true, $which_optimization, $optimization)) {
191
 
192
  if (is_wp_error($optimization)) return $optimization;
193
 
194
+ $this->change_time_limit();
195
+
196
  $optimization->before_get_info();
197
 
198
  if ($optimization->run_multisite) {
224
  if (empty($optimization_options)) return $results;
225
 
226
  $optimizations = $this->sort_optimizations($this->get_optimizations(), 'run_sort_order');
227
+
 
 
228
  foreach ($optimizations as $optimization_id => $optimization) {
229
  $option_id = call_user_func(array($optimization, 'get_'.$which_option.'_id'));
230
 
231
  if (isset($optimization_options[$option_id])) {
232
  if ('auto' == $which_option && empty($optimization->available_for_auto)) continue;
233
+
234
+ $this->change_time_limit();
235
+
236
  $results[$optimization_id] = $this->do_optimization($optimization);
237
  }
238
  }
279
  $include_table = apply_filters('wp_optimize_get_tables_include_table', $include_table, $table_name, $table_prefix);
280
 
281
  $table_status[$index]->is_optimizable = WP_Optimize()->get_db_info()->is_table_optimizable($table_name);
282
+ $table_status[$index]->is_type_supported = WP_Optimize()->get_db_info()->is_table_type_optimize_supported($table_name);
283
+ // add information about corrupted tables.
284
+ $table_status[$index]->is_needing_repair = WP_Optimize()->get_db_info()->is_table_needing_repair($table_name);
285
 
286
  if (!$include_table) unset($table_status[$index]);
287
  }
301
  $table = WP_Optimize()->get_db_info()->get_table_status($table_name);
302
 
303
  $table->is_optimizable = WP_Optimize()->get_db_info()->is_table_optimizable($table_name);
304
+ $table->is_type_supported = WP_Optimize()->get_db_info()->is_table_type_optimize_supported($table_name);
305
+ $table->is_needing_repair = WP_Optimize()->get_db_info()->is_table_needing_repair($table_name);
306
 
307
+ $table = apply_filters('wp_optimize_get_table', $table);
308
  return $table;
309
  }
310
 
464
 
465
  return array('output' => $output);
466
  }
467
+
468
+ /**
469
+ * Try to change PHP script time limit.
470
+ */
471
+ private function change_time_limit() {
472
+ $time_limit = (defined('WP_OPTIMIZE_SET_TIME_LIMIT') && WP_OPTIMIZE_SET_TIME_LIMIT > 15) ? WP_OPTIMIZE_SET_TIME_LIMIT : 1800;
473
+
474
+ // Try to reduce the chances of PHP self-terminating via reaching max_execution_time.
475
+ // @codingStandardsIgnoreLine
476
+ @set_time_limit($time_limit);
477
+ }
478
  }
includes/wp-optimize-database-information.php CHANGED
@@ -15,6 +15,7 @@ class WP_Optimize_Database_Information {
15
  const MEMORY_ENGINE = 'Memory';
16
  const INNODB_ENGINE = 'InnoDB';
17
  const ARCHIVE_ENGINE = 'ARCHIVE';
 
18
  const NDB_ENGINE = 'NDB';
19
  const ARIA_ENGINE = 'Aria'; // MariaDB
20
 
@@ -86,13 +87,20 @@ class WP_Optimize_Database_Information {
86
  * Returns information about database table.
87
  *
88
  * @param string $table_name
 
89
  * @return bool|mixed
90
  */
91
- public function get_table_status($table_name) {
92
- $tables_info = $this->get_show_table_status();
 
 
 
93
 
94
- foreach ($tables_info as $table_info) {
95
- if ($table_name == $table_info->Name) return $table_info;
 
 
 
96
  }
97
 
98
  return false;
@@ -217,7 +225,7 @@ class WP_Optimize_Database_Information {
217
  * @param string $table_name Name of database table
218
  * @return bool
219
  */
220
- public function is_table_type_supported($table_name) {
221
  $table_type = $this->get_table_type($table_name);
222
 
223
  $supported_table_types = array(
@@ -230,12 +238,103 @@ class WP_Optimize_Database_Information {
230
  return in_array($table_type, $supported_table_types);
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  /**
234
  * Returns true if table needing repair.
235
  *
236
  * @param string $table_name Database table name.
237
  */
238
  public function is_table_needing_repair($table_name) {
239
- // code it later.
 
 
 
 
 
 
240
  }
241
  }
15
  const MEMORY_ENGINE = 'Memory';
16
  const INNODB_ENGINE = 'InnoDB';
17
  const ARCHIVE_ENGINE = 'ARCHIVE';
18
+ const CSV_ENGINE = 'CSV';
19
  const NDB_ENGINE = 'NDB';
20
  const ARIA_ENGINE = 'Aria'; // MariaDB
21
 
87
  * Returns information about database table.
88
  *
89
  * @param string $table_name
90
+ * @param bool $update if true, then force request to database and don't use cached values.
91
  * @return bool|mixed
92
  */
93
+ public function get_table_status($table_name, $update = false) {
94
+ global $wpdb;
95
+
96
+ if (false == $update) {
97
+ $tables_info = $this->get_show_table_status();
98
 
99
+ foreach ($tables_info as $table_info) {
100
+ if ($table_name == $table_info->Name) return $table_info;
101
+ }
102
+ } else {
103
+ return $wpdb->get_row($wpdb->prepare('SHOW TABLE STATUS LIKE %s;', $table_name));
104
  }
105
 
106
  return false;
225
  * @param string $table_name Name of database table
226
  * @return bool
227
  */
228
+ public function is_table_type_optimize_supported($table_name) {
229
  $table_type = $this->get_table_type($table_name);
230
 
231
  $supported_table_types = array(
238
  return in_array($table_type, $supported_table_types);
239
  }
240
 
241
+ /**
242
+ * Returns true if table type is supported for repair.
243
+ *
244
+ * @param string $table_name
245
+ * @return bool
246
+ */
247
+ public function is_table_type_repair_supported($table_name) {
248
+ $table_type = $this->get_table_type($table_name);
249
+
250
+ $supported_table_types = array(
251
+ self::MYISAM_ENGINE,
252
+ self::ARCHIVE_ENGINE,
253
+ self::CSV_ENGINE,
254
+ );
255
+
256
+ return in_array($table_type, $supported_table_types);
257
+ }
258
+
259
+ /**
260
+ * Run CHECK TABLE query and returns statuses for single or list of tables.
261
+ *
262
+ * @param array|string $table
263
+ */
264
+ public function check_table($table) {
265
+ global $wpdb;
266
+
267
+ if (is_array($table)) {
268
+ $table = join(',', $table);
269
+ }
270
+
271
+ $result = array();
272
+
273
+ if (empty($table)) return $result;
274
+
275
+ $query_result = $wpdb->get_results('CHECK TABLE '.$table.';');
276
+
277
+ if (empty($query_result)) return $result;
278
+
279
+ foreach ($query_result as $row) {
280
+ $table_name = array_pop(explode('.', $row->Table));
281
+
282
+ if (!array_key_exists($table_name, $result)) $result[$table_name] = array();
283
+
284
+ if ('error' == $row->Msg_type) {
285
+ $result[$table_name]['status'] = $row->Msg_type;
286
+
287
+ if (preg_match('/corrupt/i', $row->Msg_text)) {
288
+ $result[$table_name]['corrupted'] = true;
289
+ } else {
290
+ $result[$table_name]['message'] = $row->Msg_text;
291
+ }
292
+ }
293
+
294
+ if ('status' == $row->Msg_type) {
295
+ $result[$table_name]['status'] = $row->Msg_text;
296
+ }
297
+ }
298
+
299
+ return $result;
300
+ }
301
+
302
+ /**
303
+ * Check all supported for repair tables and return statuses for them.
304
+ *
305
+ * @return array
306
+ */
307
+ public function check_all_tables() {
308
+ static $result = null;
309
+
310
+ if (null !== $result) return $result;
311
+
312
+ $tables = $this->get_show_table_status();
313
+ $supported_tables = array();
314
+
315
+ foreach ($tables as $table) {
316
+ if ('' == $table->Engine || $this->is_table_type_repair_supported($table->Name)) {
317
+ $supported_tables[] = $table->Name;
318
+ }
319
+ }
320
+
321
+ $result = $this->check_table($supported_tables);
322
+
323
+ return $result;
324
+ }
325
+
326
  /**
327
  * Returns true if table needing repair.
328
  *
329
  * @param string $table_name Database table name.
330
  */
331
  public function is_table_needing_repair($table_name) {
332
+ $table_statuses = $this->check_all_tables();
333
+
334
+ if (is_array($table_statuses) && array_key_exists($table_name, $table_statuses) && $table_statuses[$table_name]['corrupted']) {
335
+ return true;
336
+ } else {
337
+ return false;
338
+ }
339
  }
340
  }
includes/wp-optimize-notices.php CHANGED
@@ -186,7 +186,7 @@ class WP_Optimize_Notices extends Updraft_Notices_1_0 {
186
  ),
187
  'spring' => array(
188
  'prefix' => '',
189
- 'title' => __('Spring sale - 20% off WP-Optimize Premium until April 31st', 'wpo-premium'),
190
  'text' => __('To benefit, use this discount code:', 'wpo-premium').' ',
191
  'image' => 'notices/spring.png',
192
  'button_link' => 'https://getwpo.com',
@@ -332,7 +332,7 @@ class WP_Optimize_Notices extends Updraft_Notices_1_0 {
332
  * This method checks to see if the notices dismiss_time parameter has been dismissed
333
  *
334
  * @param String $dismiss_time a string containing the dimiss time ID
335
- * @return Boolaen returns true if the notice has been dismissed and shouldn't be shown otherwise display it
336
  */
337
  protected function check_notice_dismissed($dismiss_time) {
338
 
@@ -340,13 +340,9 @@ class WP_Optimize_Notices extends Updraft_Notices_1_0 {
340
 
341
  $options = WP_Optimize()->get_options();
342
 
343
- $notice_dismiss = ($time_now < $options->get_option('dismiss_page_notice_until', 0));
344
 
345
- $dismiss = false;
346
-
347
- if ('dismiss_page_notice_until' == $dismiss_time) $dismiss = $notice_dismiss;
348
-
349
- return $dismiss;
350
  }
351
 
352
  /**
186
  ),
187
  'spring' => array(
188
  'prefix' => '',
189
+ 'title' => __('Spring sale - 20% off WP-Optimize Premium until April 30th', 'wpo-premium'),
190
  'text' => __('To benefit, use this discount code:', 'wpo-premium').' ',
191
  'image' => 'notices/spring.png',
192
  'button_link' => 'https://getwpo.com',
332
  * This method checks to see if the notices dismiss_time parameter has been dismissed
333
  *
334
  * @param String $dismiss_time a string containing the dimiss time ID
335
+ * @return Boolean returns true if the notice has been dismissed and shouldn't be shown otherwise display it
336
  */
337
  protected function check_notice_dismissed($dismiss_time) {
338
 
340
 
341
  $options = WP_Optimize()->get_options();
342
 
343
+ $notice_dismiss = ($time_now < $options->get_option($dismiss_time, 0));
344
 
345
+ return $notice_dismiss;
 
 
 
 
346
  }
347
 
348
  /**
js/tablesorter/jquery.tablesorter.js CHANGED
@@ -8,7 +8,7 @@
8
  }
9
  }(function(jQuery) {
10
 
11
- /*! TableSorter (FORK) v2.29.6 *//*
12
  * Client-side table sorting with ease!
13
  * @requires jQuery v1.2.6+
14
  *
@@ -32,7 +32,7 @@
32
  'use strict';
33
  var ts = $.tablesorter = {
34
 
35
- version : '2.29.6',
36
 
37
  parsers : [],
38
  widgets : [],
@@ -44,8 +44,8 @@
44
  showProcessing : false, // show an indeterminate timer icon in the header when the table is sorted or filtered.
45
 
46
  headerTemplate : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} = <i/> // class from cssIcon
47
- onRenderTemplate : null, // function( index, template ){ return template; }, // template is a string
48
- onRenderHeader : null, // function( index ){}, // nothing to return
49
 
50
  // *** functionality
51
  cancelSelection : true, // prevent text selection in the header
@@ -74,7 +74,7 @@
74
  emptyTo : 'bottom', // sort empty cell to bottom, top, none, zero, emptyMax, emptyMin
75
  stringTo : 'max', // sort strings in numerical column as max, min, top, bottom, zero
76
  duplicateSpan : true, // colspan cells in the tbody will have duplicated content in the cache for each spanned column
77
- textExtraction : 'basic', // text extraction method/function - function( node, table, cellIndex ){}
78
  textAttribute : 'data-text',// data-attribute that contains alternate cell text (used in default textExtraction function)
79
  textSorter : null, // choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText]
80
  numberSorter : null, // choose overall numeric sorter function( a, b, direction, maxColumnValue )
@@ -88,7 +88,7 @@
88
  },
89
 
90
  // *** callbacks
91
- initialized : null, // function( table ){},
92
 
93
  // *** extra css class names
94
  tableClass : '',
@@ -226,7 +226,7 @@
226
  setup : function( table, c ) {
227
  // if no thead or tbody, or tablesorter is already present, quit
228
  if ( !table || !table.tHead || table.tBodies.length === 0 || table.hasInitialized === true ) {
229
- if ( c.debug ) {
230
  if ( table.hasInitialized ) {
231
  console.warn( 'Stopping initialization. Tablesorter has already been initialized' );
232
  } else {
@@ -247,7 +247,7 @@
247
  table.config = c;
248
  // save the settings where they read
249
  $.data( table, 'tablesorter', c );
250
- if ( c.debug ) {
251
  console[ console.group ? 'group' : 'log' ]( 'Initializing tablesorter v' + ts.version );
252
  $.data( table, 'startoveralltimer', new Date() );
253
  }
@@ -308,7 +308,10 @@
308
  ts.setupParsers( c );
309
  // start total row count at zero
310
  c.totalRows = 0;
311
- ts.validateOptions( c );
 
 
 
312
  // build the cache for the tbody cells
313
  // delayInit will delay building the cache until the user starts a sort
314
  if ( !c.delayInit ) { ts.buildCache( c ); }
@@ -353,9 +356,9 @@
353
  // initialized
354
  table.hasInitialized = true;
355
  table.isProcessing = false;
356
- if ( c.debug ) {
357
  console.log( 'Overall initialization time:' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) );
358
- if ( c.debug && console.groupEnd ) { console.groupEnd(); }
359
  }
360
  $table.triggerHandler( 'tablesorter-initialized', table );
361
  if ( typeof c.initialized === 'function' ) {
@@ -552,7 +555,7 @@
552
  c.headerList = [];
553
  c.headerContent = [];
554
  c.sortVars = [];
555
- if ( c.debug ) {
556
  timer = new Date();
557
  }
558
  // children tr in tfoot - see issue #196 & #547
@@ -647,7 +650,7 @@
647
  });
648
  // enable/disable sorting
649
  ts.updateHeader( c );
650
- if ( c.debug ) {
651
  console.log( 'Built headers:' + ts.benchmark( timer ) );
652
  console.log( c.$headers );
653
  }
@@ -670,14 +673,15 @@
670
  noParser, parser, extractor, time, tbody, len,
671
  table = c.table,
672
  tbodyIndex = 0,
673
- debug = {};
 
674
  // update table bodies in case we start with an empty table
675
  c.$tbodies = c.$table.children( 'tbody:not(.' + c.cssInfoBlock + ')' );
676
  tbody = typeof $tbodies === 'undefined' ? c.$tbodies : $tbodies;
677
  len = tbody.length;
678
  if ( len === 0 ) {
679
- return c.debug ? console.warn( 'Warning: *Empty table!* Not building a parser cache' ) : '';
680
- } else if ( c.debug ) {
681
  time = new Date();
682
  console[ console.group ? 'group' : 'log' ]( 'Detecting parsers for each column' );
683
  }
@@ -719,8 +723,8 @@
719
  if ( !parser ) {
720
  parser = ts.detectParserForColumn( c, rows, -1, colIndex );
721
  }
722
- if ( c.debug ) {
723
- debug[ '(' + colIndex + ') ' + header.text() ] = {
724
  parser : parser.id,
725
  extractor : extractor ? extractor.id : 'none',
726
  string : c.strings[ colIndex ],
@@ -746,9 +750,9 @@
746
  }
747
  tbodyIndex += ( list.parsers.length ) ? len : 1;
748
  }
749
- if ( c.debug ) {
750
- if ( !ts.isEmptyObject( debug ) ) {
751
- console[ console.table ? 'table' : 'log' ]( debug );
752
  } else {
753
  console.warn( ' No parsers detected!' );
754
  }
@@ -774,7 +778,7 @@
774
  },
775
 
776
  getParserById : function( name ) {
777
- /*jshint eqeqeq:false */
778
  if ( name == 'false' ) { return false; }
779
  var indx,
780
  len = ts.parsers.length;
@@ -791,6 +795,7 @@
791
  indx = ts.parsers.length,
792
  node = false,
793
  nodeValue = '',
 
794
  keepLooking = true;
795
  while ( nodeValue === '' && keepLooking ) {
796
  rowIndex++;
@@ -801,7 +806,7 @@
801
  node = rows[ rowIndex ].cells[ cellIndex ];
802
  nodeValue = ts.getElementText( c, node, cellIndex );
803
  $node = $( node );
804
- if ( c.debug ) {
805
  console.log( 'Checking if value was empty on row ' + rowIndex + ', column: ' +
806
  cellIndex + ': "' + nodeValue + '"' );
807
  }
@@ -883,7 +888,8 @@
883
  cols, $cells, cell, cacheTime, totalRows, rowData, prevRowData,
884
  colMax, span, cacheIndex, hasParser, max, len, index,
885
  table = c.table,
886
- parsers = c.parsers;
 
887
  // update tbody variable
888
  c.$tbodies = c.$table.children( 'tbody:not(.' + c.cssInfoBlock + ')' );
889
  $tbody = typeof $tbodies === 'undefined' ? c.$tbodies : $tbodies,
@@ -891,9 +897,9 @@
891
  c.totalRows = 0;
892
  // if no parsers found, return - it's an empty table.
893
  if ( !parsers ) {
894
- return c.debug ? console.warn( 'Warning: *Empty table!* Not building a cache' ) : '';
895
  }
896
- if ( c.debug ) {
897
  cacheTime = new Date();
898
  }
899
  // processing icon
@@ -962,7 +968,7 @@
962
  cell = $row[ 0 ].cells[ colIndex ];
963
  if ( cell && cacheIndex < c.columns ) {
964
  hasParser = typeof parsers[ cacheIndex ] !== 'undefined';
965
- if ( !hasParser && c.debug ) {
966
  console.warn( 'No parser found for row: ' + rowIndex + ', column: ' + colIndex +
967
  '; cell containing: "' + $(cell).text() + '"; does it have a header?' );
968
  }
@@ -1010,7 +1016,7 @@
1010
  if ( c.showProcessing ) {
1011
  ts.isProcessing( table ); // remove processing icon
1012
  }
1013
- if ( c.debug ) {
1014
  len = Math.min( 5, c.cache[ 0 ].normalized.length );
1015
  console[ console.group ? 'group' : 'log' ]( 'Building cache for ' + c.totalRows +
1016
  ' rows (showing ' + len + ' rows in log) and ' + c.columns + ' columns' +
@@ -1041,7 +1047,7 @@
1041
  data = { raw : [], parsed: [], $cell: [] },
1042
  c = table.config;
1043
  if ( ts.isEmptyObject( c ) ) {
1044
- if ( c.debug ) {
1045
  console.warn( 'No cache found - aborting getColumnText function!' );
1046
  }
1047
  } else {
@@ -1135,8 +1141,8 @@
1135
  // direction = 2 means reset!
1136
  if ( list[ indx ][ 1 ] !== 2 ) {
1137
  // multicolumn sorting updating - see #1005
1138
- // .not(function(){}) needs jQuery 1.4
1139
- // filter(function(i, el){}) <- el is undefined in jQuery v1.2.6
1140
  $sorted = c.$headers.filter( function( i ) {
1141
  // only include headers that are in the sortList (this includes colspans)
1142
  var include = true,
@@ -1385,7 +1391,7 @@
1385
  ts.resortComplete( c, callback );
1386
  }
1387
  } else {
1388
- if ( c.debug ) {
1389
  console.error( 'updateCell aborted, tbody missing or not within the indicated table' );
1390
  }
1391
  c.table.isUpdating = false;
@@ -1408,7 +1414,7 @@
1408
  // row contained in the table?
1409
  ( ts.getClosest( $row, 'table' )[ 0 ] !== c.table )
1410
  ) {
1411
- if ( c.debug ) {
1412
  console.error( 'addRows method requires (1) a jQuery selector reference to rows that have already ' +
1413
  'been added to the table, or (2) row HTML string to be added to a table with only one tbody' );
1414
  }
@@ -1480,7 +1486,6 @@
1480
  appendCache : function( c, init ) {
1481
  var parsed, totalRows, $tbody, $curTbody, rowIndex, tbodyIndex, appendTime,
1482
  table = c.table,
1483
- wo = c.widgetOptions,
1484
  $tbodies = c.$tbodies,
1485
  rows = [],
1486
  cache = c.cache;
@@ -1490,7 +1495,7 @@
1490
  return c.appender ? c.appender( table, rows ) :
1491
  table.isUpdating ? c.$table.triggerHandler( 'updateComplete', table ) : ''; // Fixes #532
1492
  }
1493
- if ( c.debug ) {
1494
  appendTime = new Date();
1495
  }
1496
  for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
@@ -1503,7 +1508,7 @@
1503
  for ( rowIndex = 0; rowIndex < totalRows; rowIndex++ ) {
1504
  rows[rows.length] = parsed[ rowIndex ][ c.columns ].$row;
1505
  // removeRows used by the pager plugin; don't render if using ajax - fixes #411
1506
- if ( !c.appender || ( c.pager && ( !c.pager.removeRows || !wo.pager_removeRows ) && !c.pager.ajax ) ) {
1507
  $curTbody.append( parsed[ rowIndex ][ c.columns ].$row );
1508
  }
1509
  }
@@ -1514,7 +1519,7 @@
1514
  if ( c.appender ) {
1515
  c.appender( table, rows );
1516
  }
1517
- if ( c.debug ) {
1518
  console.log( 'Rebuilt table' + ts.benchmark( appendTime ) );
1519
  }
1520
  // apply table widgets; but not before ajax completes
@@ -1545,7 +1550,7 @@
1545
  initSort : function( c, cell, event ) {
1546
  if ( c.table.isUpdating ) {
1547
  // let any updates complete before initializing a sort
1548
- return setTimeout( function(){
1549
  ts.initSort( c, cell, event );
1550
  }, 50 );
1551
  }
@@ -1696,7 +1701,7 @@
1696
  // empty table - fixes #206/#346
1697
  return;
1698
  }
1699
- if ( c.debug ) { sortTime = new Date(); }
1700
  // cache textSorter to optimize speed
1701
  if ( typeof textSorter === 'object' ) {
1702
  colMax = c.columns;
@@ -1758,7 +1763,7 @@
1758
  return a[ c.columns ].order - b[ c.columns ].order;
1759
  });
1760
  }
1761
- if ( c.debug ) {
1762
  console.log( 'Applying sort ' + sortList.toString() + ts.benchmark( sortTime ) );
1763
  }
1764
  },
@@ -2011,6 +2016,7 @@
2011
  var applied, time, name,
2012
  c = table.config,
2013
  wo = c.widgetOptions,
 
2014
  widget = ts.getWidgetById( id );
2015
  if ( widget ) {
2016
  name = widget.id;
@@ -2019,7 +2025,7 @@
2019
  if ( $.inArray( name, c.widgets ) < 0 ) {
2020
  c.widgets[ c.widgets.length ] = name;
2021
  }
2022
- if ( c.debug ) { time = new Date(); }
2023
 
2024
  if ( init || !( c.widgetInit[ name ] ) ) {
2025
  // set init flag first to prevent calling init more than once (e.g. pager)
@@ -2030,7 +2036,7 @@
2030
  }
2031
  if ( typeof widget.init === 'function' ) {
2032
  applied = true;
2033
- if ( c.debug ) {
2034
  console[ console.group ? 'group' : 'log' ]( 'Initializing ' + name + ' widget' );
2035
  }
2036
  widget.init( table, widget, c, wo );
@@ -2038,12 +2044,12 @@
2038
  }
2039
  if ( !init && typeof widget.format === 'function' ) {
2040
  applied = true;
2041
- if ( c.debug ) {
2042
  console[ console.group ? 'group' : 'log' ]( 'Updating ' + name + ' widget' );
2043
  }
2044
  widget.format( table, c, wo, false );
2045
  }
2046
- if ( c.debug ) {
2047
  if ( applied ) {
2048
  console.log( 'Completed ' + ( init ? 'initializing ' : 'applying ' ) + name + ' widget' + ts.benchmark( time ) );
2049
  if ( console.groupEnd ) { console.groupEnd(); }
@@ -2056,12 +2062,13 @@
2056
  table = $( table )[ 0 ]; // in case this is called externally
2057
  var indx, len, names, widget, time,
2058
  c = table.config,
 
2059
  widgets = [];
2060
  // prevent numerous consecutive widget applications
2061
  if ( init !== false && table.hasInitialized && ( table.isApplyingWidgets || table.isUpdating ) ) {
2062
  return;
2063
  }
2064
- if ( c.debug ) { time = new Date(); }
2065
  ts.addWidgetFromClass( table );
2066
  // prevent "tablesorter-ready" from firing multiple times in a row
2067
  clearTimeout( c.timerReady );
@@ -2080,7 +2087,7 @@
2080
  // set priority to 10 if not defined
2081
  if ( !widget.priority ) { widget.priority = 10; }
2082
  widgets[ indx ] = widget;
2083
- } else if ( c.debug ) {
2084
  console.warn( '"' + names[ indx ] + '" was enabled, but the widget code has not been loaded!' );
2085
  }
2086
  }
@@ -2090,7 +2097,7 @@
2090
  });
2091
  // add/update selected widgets
2092
  len = widgets.length;
2093
- if ( c.debug ) {
2094
  console[ console.group ? 'group' : 'log' ]( 'Start ' + ( init ? 'initializing' : 'applying' ) + ' widgets' );
2095
  }
2096
  for ( indx = 0; indx < len; indx++ ) {
@@ -2099,7 +2106,7 @@
2099
  ts.applyWidgetId( table, widget.id, init );
2100
  }
2101
  }
2102
- if ( c.debug && console.groupEnd ) { console.groupEnd(); }
2103
  }
2104
  c.timerReady = setTimeout( function() {
2105
  table.isApplyingWidgets = false;
@@ -2109,7 +2116,7 @@
2109
  if ( !init && typeof callback === 'function' ) {
2110
  callback( table );
2111
  }
2112
- if ( c.debug ) {
2113
  widget = c.widgets.length;
2114
  console.log( 'Completed ' +
2115
  ( init === true ? 'initializing ' : 'applying ' ) + widget +
@@ -2146,7 +2153,7 @@
2146
  c.widgets.splice( indx, 1 );
2147
  }
2148
  if ( widget && widget.remove ) {
2149
- if ( c.debug ) {
2150
  console.log( ( refreshing ? 'Refreshing' : 'Removing' ) + ' "' + name[ index ] + '" widget' );
2151
  }
2152
  widget.remove( table, c, c.widgetOptions, refreshing );
@@ -2200,6 +2207,12 @@
2200
  log : function() {
2201
  console.log( arguments );
2202
  },
 
 
 
 
 
 
2203
 
2204
  // $.isEmptyObject from jQuery v1.4
2205
  isEmptyObject : function( obj ) {
@@ -2505,7 +2518,7 @@
2505
  ignore = 'headers sortForce sortList sortAppend widgets'.split( ' ' ),
2506
  orig = c.originalSettings;
2507
  if ( orig ) {
2508
- if ( c.debug ) {
2509
  timer = new Date();
2510
  }
2511
  for ( setting in orig ) {
@@ -2521,7 +2534,7 @@
2521
  }
2522
  }
2523
  }
2524
- if ( c.debug ) {
2525
  console.log( 'validate options time:' + ts.benchmark( timer ) );
2526
  }
2527
  }
@@ -2552,7 +2565,6 @@
2552
  var events,
2553
  $t = $( table ),
2554
  c = table.config,
2555
- debug = c.debug,
2556
  $h = $t.find( 'thead:first' ),
2557
  $r = $h.find( 'tr.' + ts.css.headerRow ).removeClass( ts.css.headerRow + ' ' + c.cssHeaderRow ),
2558
  $f = $t.find( 'tfoot:first > tr' ).children( 'th, td' );
@@ -2590,7 +2602,7 @@
2590
  if ( typeof callback === 'function' ) {
2591
  callback( table );
2592
  }
2593
- if ( debug ) {
2594
  console.log( 'tablesorter has been removed' );
2595
  }
2596
  }
@@ -2707,7 +2719,7 @@
2707
  is : function( str ) {
2708
  return ts.regex.isoDate.test( str );
2709
  },
2710
- format : function( str, table ) {
2711
  var date = str ? new Date( str.replace( ts.regex.dash, '/' ) ) : str;
2712
  return date instanceof Date && isFinite( date ) ? date.getTime() : str;
2713
  },
@@ -2750,7 +2762,7 @@
2750
  // Jan 01, 2013 12:34:56 PM or 01 Jan 2013
2751
  return ts.regex.usLongDateTest1.test( str ) || ts.regex.usLongDateTest2.test( str );
2752
  },
2753
- format : function( str, table ) {
2754
  var date = str ? new Date( str.replace( ts.regex.dateReplace, '$1 $2' ) ) : str;
2755
  return date instanceof Date && isFinite( date ) ? date.getTime() : str;
2756
  },
@@ -2811,7 +2823,7 @@
2811
  is : function( str ) {
2812
  return ts.regex.timeTest.test( str );
2813
  },
2814
- format : function( str, table ) {
2815
  // isolate time... ignore month, day and year
2816
  var temp,
2817
  timePart = ( str || '' ).match( ts.regex.timeMatch ),
@@ -2878,7 +2890,7 @@
2878
  var tbodyIndex, $tbody,
2879
  $tbodies = c.$tbodies,
2880
  toRemove = ( wo.zebra || [ 'even', 'odd' ] ).join( ' ' );
2881
- for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ){
2882
  $tbody = ts.processTbody( table, $tbodies.eq( tbodyIndex ), true ); // remove tbody
2883
  $tbody.children().removeClass( toRemove );
2884
  ts.processTbody( table, $tbody, false ); // restore tbody
8
  }
9
  }(function(jQuery) {
10
 
11
+ /*! TableSorter (FORK) v2.30.1 *//*
12
  * Client-side table sorting with ease!
13
  * @requires jQuery v1.2.6+
14
  *
32
  'use strict';
33
  var ts = $.tablesorter = {
34
 
35
+ version : '2.30.1',
36
 
37
  parsers : [],
38
  widgets : [],
44
  showProcessing : false, // show an indeterminate timer icon in the header when the table is sorted or filtered.
45
 
46
  headerTemplate : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} = <i/> // class from cssIcon
47
+ onRenderTemplate : null, // function( index, template ) { return template; }, // template is a string
48
+ onRenderHeader : null, // function( index ) {}, // nothing to return
49
 
50
  // *** functionality
51
  cancelSelection : true, // prevent text selection in the header
74
  emptyTo : 'bottom', // sort empty cell to bottom, top, none, zero, emptyMax, emptyMin
75
  stringTo : 'max', // sort strings in numerical column as max, min, top, bottom, zero
76
  duplicateSpan : true, // colspan cells in the tbody will have duplicated content in the cache for each spanned column
77
+ textExtraction : 'basic', // text extraction method/function - function( node, table, cellIndex ) {}
78
  textAttribute : 'data-text',// data-attribute that contains alternate cell text (used in default textExtraction function)
79
  textSorter : null, // choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText]
80
  numberSorter : null, // choose overall numeric sorter function( a, b, direction, maxColumnValue )
88
  },
89
 
90
  // *** callbacks
91
+ initialized : null, // function( table ) {},
92
 
93
  // *** extra css class names
94
  tableClass : '',
226
  setup : function( table, c ) {
227
  // if no thead or tbody, or tablesorter is already present, quit
228
  if ( !table || !table.tHead || table.tBodies.length === 0 || table.hasInitialized === true ) {
229
+ if ( ts.debug(c, 'core') ) {
230
  if ( table.hasInitialized ) {
231
  console.warn( 'Stopping initialization. Tablesorter has already been initialized' );
232
  } else {
247
  table.config = c;
248
  // save the settings where they read
249
  $.data( table, 'tablesorter', c );
250
+ if ( ts.debug(c, 'core') ) {
251
  console[ console.group ? 'group' : 'log' ]( 'Initializing tablesorter v' + ts.version );
252
  $.data( table, 'startoveralltimer', new Date() );
253
  }
308
  ts.setupParsers( c );
309
  // start total row count at zero
310
  c.totalRows = 0;
311
+ // only validate options while debugging. See #1528
312
+ if (c.debug) {
313
+ ts.validateOptions( c );
314
+ }
315
  // build the cache for the tbody cells
316
  // delayInit will delay building the cache until the user starts a sort
317
  if ( !c.delayInit ) { ts.buildCache( c ); }
356
  // initialized
357
  table.hasInitialized = true;
358
  table.isProcessing = false;
359
+ if ( ts.debug(c, 'core') ) {
360
  console.log( 'Overall initialization time:' + ts.benchmark( $.data( table, 'startoveralltimer' ) ) );
361
+ if ( ts.debug(c, 'core') && console.groupEnd ) { console.groupEnd(); }
362
  }
363
  $table.triggerHandler( 'tablesorter-initialized', table );
364
  if ( typeof c.initialized === 'function' ) {
555
  c.headerList = [];
556
  c.headerContent = [];
557
  c.sortVars = [];
558
+ if ( ts.debug(c, 'core') ) {
559
  timer = new Date();
560
  }
561
  // children tr in tfoot - see issue #196 & #547
650
  });
651
  // enable/disable sorting
652
  ts.updateHeader( c );
653
+ if ( ts.debug(c, 'core') ) {
654
  console.log( 'Built headers:' + ts.benchmark( timer ) );
655
  console.log( c.$headers );
656
  }
673
  noParser, parser, extractor, time, tbody, len,
674
  table = c.table,
675
  tbodyIndex = 0,
676
+ debug = ts.debug(c, 'core'),
677
+ debugOutput = {};
678
  // update table bodies in case we start with an empty table
679
  c.$tbodies = c.$table.children( 'tbody:not(.' + c.cssInfoBlock + ')' );
680
  tbody = typeof $tbodies === 'undefined' ? c.$tbodies : $tbodies;
681
  len = tbody.length;
682
  if ( len === 0 ) {
683
+ return debug ? console.warn( 'Warning: *Empty table!* Not building a parser cache' ) : '';
684
+ } else if ( debug ) {
685
  time = new Date();
686
  console[ console.group ? 'group' : 'log' ]( 'Detecting parsers for each column' );
687
  }
723
  if ( !parser ) {
724
  parser = ts.detectParserForColumn( c, rows, -1, colIndex );
725
  }
726
+ if ( debug ) {
727
+ debugOutput[ '(' + colIndex + ') ' + header.text() ] = {
728
  parser : parser.id,
729
  extractor : extractor ? extractor.id : 'none',
730
  string : c.strings[ colIndex ],
750
  }
751
  tbodyIndex += ( list.parsers.length ) ? len : 1;
752
  }
753
+ if ( debug ) {
754
+ if ( !ts.isEmptyObject( debugOutput ) ) {
755
+ console[ console.table ? 'table' : 'log' ]( debugOutput );
756
  } else {
757
  console.warn( ' No parsers detected!' );
758
  }
778
  },
779
 
780
  getParserById : function( name ) {
781
+ /*jshint eqeqeq:false */ // eslint-disable-next-line eqeqeq
782
  if ( name == 'false' ) { return false; }
783
  var indx,
784
  len = ts.parsers.length;
795
  indx = ts.parsers.length,
796
  node = false,
797
  nodeValue = '',
798
+ debug = ts.debug(c, 'core'),
799
  keepLooking = true;
800
  while ( nodeValue === '' && keepLooking ) {
801
  rowIndex++;
806
  node = rows[ rowIndex ].cells[ cellIndex ];
807
  nodeValue = ts.getElementText( c, node, cellIndex );
808
  $node = $( node );
809
+ if ( debug ) {
810
  console.log( 'Checking if value was empty on row ' + rowIndex + ', column: ' +
811
  cellIndex + ': "' + nodeValue + '"' );
812
  }
888
  cols, $cells, cell, cacheTime, totalRows, rowData, prevRowData,
889
  colMax, span, cacheIndex, hasParser, max, len, index,
890
  table = c.table,
891
+ parsers = c.parsers,
892
+ debug = ts.debug(c, 'core');
893
  // update tbody variable
894
  c.$tbodies = c.$table.children( 'tbody:not(.' + c.cssInfoBlock + ')' );
895
  $tbody = typeof $tbodies === 'undefined' ? c.$tbodies : $tbodies,
897
  c.totalRows = 0;
898
  // if no parsers found, return - it's an empty table.
899
  if ( !parsers ) {
900
+ return debug ? console.warn( 'Warning: *Empty table!* Not building a cache' ) : '';
901
  }
902
+ if ( debug ) {
903
  cacheTime = new Date();
904
  }
905
  // processing icon
968
  cell = $row[ 0 ].cells[ colIndex ];
969
  if ( cell && cacheIndex < c.columns ) {
970
  hasParser = typeof parsers[ cacheIndex ] !== 'undefined';
971
+ if ( !hasParser && debug ) {
972
  console.warn( 'No parser found for row: ' + rowIndex + ', column: ' + colIndex +
973
  '; cell containing: "' + $(cell).text() + '"; does it have a header?' );
974
  }
1016
  if ( c.showProcessing ) {
1017
  ts.isProcessing( table ); // remove processing icon
1018
  }
1019
+ if ( debug ) {
1020
  len = Math.min( 5, c.cache[ 0 ].normalized.length );
1021
  console[ console.group ? 'group' : 'log' ]( 'Building cache for ' + c.totalRows +
1022
  ' rows (showing ' + len + ' rows in log) and ' + c.columns + ' columns' +
1047
  data = { raw : [], parsed: [], $cell: [] },
1048
  c = table.config;
1049
  if ( ts.isEmptyObject( c ) ) {
1050
+ if ( ts.debug(c, 'core') ) {
1051
  console.warn( 'No cache found - aborting getColumnText function!' );
1052
  }
1053
  } else {
1141
  // direction = 2 means reset!
1142
  if ( list[ indx ][ 1 ] !== 2 ) {
1143
  // multicolumn sorting updating - see #1005
1144
+ // .not(function() {}) needs jQuery 1.4
1145
+ // filter(function(i, el) {}) <- el is undefined in jQuery v1.2.6
1146
  $sorted = c.$headers.filter( function( i ) {
1147
  // only include headers that are in the sortList (this includes colspans)
1148
  var include = true,
1391
  ts.resortComplete( c, callback );
1392
  }
1393
  } else {
1394
+ if ( ts.debug(c, 'core') ) {
1395
  console.error( 'updateCell aborted, tbody missing or not within the indicated table' );
1396
  }
1397
  c.table.isUpdating = false;
1414
  // row contained in the table?
1415
  ( ts.getClosest( $row, 'table' )[ 0 ] !== c.table )
1416
  ) {
1417
+ if ( ts.debug(c, 'core') ) {
1418
  console.error( 'addRows method requires (1) a jQuery selector reference to rows that have already ' +
1419
  'been added to the table, or (2) row HTML string to be added to a table with only one tbody' );
1420
  }
1486
  appendCache : function( c, init ) {
1487
  var parsed, totalRows, $tbody, $curTbody, rowIndex, tbodyIndex, appendTime,
1488
  table = c.table,
 
1489
  $tbodies = c.$tbodies,
1490
  rows = [],
1491
  cache = c.cache;
1495
  return c.appender ? c.appender( table, rows ) :
1496
  table.isUpdating ? c.$table.triggerHandler( 'updateComplete', table ) : ''; // Fixes #532
1497
  }
1498
+ if ( ts.debug(c, 'core') ) {
1499
  appendTime = new Date();
1500
  }
1501
  for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
1508
  for ( rowIndex = 0; rowIndex < totalRows; rowIndex++ ) {
1509
  rows[rows.length] = parsed[ rowIndex ][ c.columns ].$row;
1510
  // removeRows used by the pager plugin; don't render if using ajax - fixes #411
1511
+ if ( !c.appender || ( c.pager && !c.pager.removeRows && !c.pager.ajax ) ) {
1512
  $curTbody.append( parsed[ rowIndex ][ c.columns ].$row );
1513
  }
1514
  }
1519
  if ( c.appender ) {
1520
  c.appender( table, rows );
1521
  }
1522
+ if ( ts.debug(c, 'core') ) {
1523
  console.log( 'Rebuilt table' + ts.benchmark( appendTime ) );
1524
  }
1525
  // apply table widgets; but not before ajax completes
1550
  initSort : function( c, cell, event ) {
1551
  if ( c.table.isUpdating ) {
1552
  // let any updates complete before initializing a sort
1553
+ return setTimeout( function() {
1554
  ts.initSort( c, cell, event );
1555
  }, 50 );
1556
  }
1701
  // empty table - fixes #206/#346
1702
  return;
1703
  }
1704
+ if ( ts.debug(c, 'core') ) { sortTime = new Date(); }
1705
  // cache textSorter to optimize speed
1706
  if ( typeof textSorter === 'object' ) {
1707
  colMax = c.columns;
1763
  return a[ c.columns ].order - b[ c.columns ].order;
1764
  });
1765
  }
1766
+ if ( ts.debug(c, 'core') ) {
1767
  console.log( 'Applying sort ' + sortList.toString() + ts.benchmark( sortTime ) );
1768
  }
1769
  },
2016
  var applied, time, name,
2017
  c = table.config,
2018
  wo = c.widgetOptions,
2019
+ debug = ts.debug(c, 'core'),
2020
  widget = ts.getWidgetById( id );
2021
  if ( widget ) {
2022
  name = widget.id;
2025
  if ( $.inArray( name, c.widgets ) < 0 ) {
2026
  c.widgets[ c.widgets.length ] = name;
2027
  }
2028
+ if ( debug ) { time = new Date(); }
2029
 
2030
  if ( init || !( c.widgetInit[ name ] ) ) {
2031
  // set init flag first to prevent calling init more than once (e.g. pager)
2036
  }
2037
  if ( typeof widget.init === 'function' ) {
2038
  applied = true;
2039
+ if ( debug ) {
2040
  console[ console.group ? 'group' : 'log' ]( 'Initializing ' + name + ' widget' );
2041
  }
2042
  widget.init( table, widget, c, wo );
2044
  }
2045
  if ( !init && typeof widget.format === 'function' ) {
2046
  applied = true;
2047
+ if ( debug ) {
2048
  console[ console.group ? 'group' : 'log' ]( 'Updating ' + name + ' widget' );
2049
  }
2050
  widget.format( table, c, wo, false );
2051
  }
2052
+ if ( debug ) {
2053
  if ( applied ) {
2054
  console.log( 'Completed ' + ( init ? 'initializing ' : 'applying ' ) + name + ' widget' + ts.benchmark( time ) );
2055
  if ( console.groupEnd ) { console.groupEnd(); }
2062
  table = $( table )[ 0 ]; // in case this is called externally
2063
  var indx, len, names, widget, time,
2064
  c = table.config,
2065
+ debug = ts.debug(c, 'core'),
2066
  widgets = [];
2067
  // prevent numerous consecutive widget applications
2068
  if ( init !== false && table.hasInitialized && ( table.isApplyingWidgets || table.isUpdating ) ) {
2069
  return;
2070
  }
2071
+ if ( debug ) { time = new Date(); }
2072
  ts.addWidgetFromClass( table );
2073
  // prevent "tablesorter-ready" from firing multiple times in a row
2074
  clearTimeout( c.timerReady );
2087
  // set priority to 10 if not defined
2088
  if ( !widget.priority ) { widget.priority = 10; }
2089
  widgets[ indx ] = widget;
2090
+ } else if ( debug ) {
2091
  console.warn( '"' + names[ indx ] + '" was enabled, but the widget code has not been loaded!' );
2092
  }
2093
  }
2097
  });
2098
  // add/update selected widgets
2099
  len = widgets.length;
2100
+ if ( debug ) {
2101
  console[ console.group ? 'group' : 'log' ]( 'Start ' + ( init ? 'initializing' : 'applying' ) + ' widgets' );
2102
  }
2103
  for ( indx = 0; indx < len; indx++ ) {
2106
  ts.applyWidgetId( table, widget.id, init );
2107
  }
2108
  }
2109
+ if ( debug && console.groupEnd ) { console.groupEnd(); }
2110
  }
2111
  c.timerReady = setTimeout( function() {
2112
  table.isApplyingWidgets = false;
2116
  if ( !init && typeof callback === 'function' ) {
2117
  callback( table );
2118
  }
2119
+ if ( debug ) {
2120
  widget = c.widgets.length;
2121
  console.log( 'Completed ' +
2122
  ( init === true ? 'initializing ' : 'applying ' ) + widget +
2153
  c.widgets.splice( indx, 1 );
2154
  }
2155
  if ( widget && widget.remove ) {
2156
+ if ( ts.debug(c, 'core') ) {
2157
  console.log( ( refreshing ? 'Refreshing' : 'Removing' ) + ' "' + name[ index ] + '" widget' );
2158
  }
2159
  widget.remove( table, c, c.widgetOptions, refreshing );
2207
  log : function() {
2208
  console.log( arguments );
2209
  },
2210
+ debug : function(c, name) {
2211
+ return c && (
2212
+ c.debug === true ||
2213
+ typeof c.debug === 'string' && c.debug.indexOf(name) > -1
2214
+ );
2215
+ },
2216
 
2217
  // $.isEmptyObject from jQuery v1.4
2218
  isEmptyObject : function( obj ) {
2518
  ignore = 'headers sortForce sortList sortAppend widgets'.split( ' ' ),
2519
  orig = c.originalSettings;
2520
  if ( orig ) {
2521
+ if ( ts.debug(c, 'core') ) {
2522
  timer = new Date();
2523
  }
2524
  for ( setting in orig ) {
2534
  }
2535
  }
2536
  }
2537
+ if ( ts.debug(c, 'core') ) {
2538
  console.log( 'validate options time:' + ts.benchmark( timer ) );
2539
  }
2540
  }
2565
  var events,
2566
  $t = $( table ),
2567
  c = table.config,
 
2568
  $h = $t.find( 'thead:first' ),
2569
  $r = $h.find( 'tr.' + ts.css.headerRow ).removeClass( ts.css.headerRow + ' ' + c.cssHeaderRow ),
2570
  $f = $t.find( 'tfoot:first > tr' ).children( 'th, td' );
2602
  if ( typeof callback === 'function' ) {
2603
  callback( table );
2604
  }
2605
+ if ( ts.debug(c, 'core') ) {
2606
  console.log( 'tablesorter has been removed' );
2607
  }
2608
  }
2719
  is : function( str ) {
2720
  return ts.regex.isoDate.test( str );
2721
  },
2722
+ format : function( str ) {
2723
  var date = str ? new Date( str.replace( ts.regex.dash, '/' ) ) : str;
2724
  return date instanceof Date && isFinite( date ) ? date.getTime() : str;
2725
  },
2762
  // Jan 01, 2013 12:34:56 PM or 01 Jan 2013
2763
  return ts.regex.usLongDateTest1.test( str ) || ts.regex.usLongDateTest2.test( str );
2764
  },
2765
+ format : function( str ) {
2766
  var date = str ? new Date( str.replace( ts.regex.dateReplace, '$1 $2' ) ) : str;
2767
  return date instanceof Date && isFinite( date ) ? date.getTime() : str;
2768
  },
2823
  is : function( str ) {
2824
  return ts.regex.timeTest.test( str );
2825
  },
2826
+ format : function( str ) {
2827
  // isolate time... ignore month, day and year
2828
  var temp,
2829
  timePart = ( str || '' ).match( ts.regex.timeMatch ),
2890
  var tbodyIndex, $tbody,
2891
  $tbodies = c.$tbodies,
2892
  toRemove = ( wo.zebra || [ 'even', 'odd' ] ).join( ' ' );
2893
+ for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
2894
  $tbody = ts.processTbody( table, $tbodies.eq( tbodyIndex ), true ); // remove tbody
2895
  $tbody.children().removeClass( toRemove );
2896
  ts.processTbody( table, $tbody, false ); // restore tbody
js/tablesorter/jquery.tablesorter.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(t){"use strict";var r=t.tablesorter={version:"2.29.6",parsers:[],widgets:[],defaults:{theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,tabIndex:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,resort:!0,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortStable:!1,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",duplicateSpan:!0,textExtraction:"basic",textAttribute:"data-text",textSorter:null,numberSorter:null,initWidgets:!0,widgetClass:"widget-{name}",widgets:[],widgetOptions:{zebra:["even","odd"]},initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssInfoBlock:"tablesorter-infoOnly",cssNoSort:"tablesorter-noSort",cssIgnoreRow:"tablesorter-ignoreRow",cssIcon:"tablesorter-icon",cssIconNone:"",cssIconAsc:"",cssIconDesc:"",cssIconDisabled:"",pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[],globalize:0,imgAttr:0},css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"},language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",sortDisabled:"sorting is disabled",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i,chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i,comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/,digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g},string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1},keyCodes:{enter:13},dates:{},instanceMethods:{},setup:function(e,o){if(e&&e.tHead&&0!==e.tBodies.length&&!0!==e.hasInitialized){var s="",a=t(e),n=t.metadata;e.hasInitialized=!1,e.isProcessing=!0,e.config=o,t.data(e,"tablesorter",o),o.debug&&(console[console.group?"group":"log"]("Initializing tablesorter v"+r.version),t.data(e,"startoveralltimer",new Date)),o.supportsDataObject=function(e){return e[0]=parseInt(e[0],10),e[0]>1||1===e[0]&&parseInt(e[1],10)>=4}(t.fn.jquery.split(".")),o.emptyTo=o.emptyTo.toLowerCase(),o.stringTo=o.stringTo.toLowerCase(),o.last={sortList:[],clickedIndex:-1},/tablesorter\-/.test(a.attr("class"))||(s=""!==o.theme?" tablesorter-"+o.theme:""),o.namespace?o.namespace="."+o.namespace.replace(r.regex.nonWord,""):o.namespace=".tablesorter"+Math.random().toString(16).slice(2),o.table=e,o.$table=a.addClass(r.css.table+" "+o.tableClass+s+" "+o.namespace.slice(1)).attr("role","grid"),o.$headers=a.find(o.selectorHeaders),o.$table.children().children("tr").attr("role","row"),o.$tbodies=a.children("tbody:not(."+o.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"}),o.$table.children("caption").length&&((s=o.$table.children("caption")[0]).id||(s.id=o.namespace.slice(1)+"caption"),o.$table.attr("aria-labelledby",s.id)),o.widgetInit={},o.textExtraction=o.$table.attr("data-text-extraction")||o.textExtraction||"basic",r.buildHeaders(o),r.fixColumnWidth(e),r.addWidgetFromClass(e),r.applyWidgetOptions(e),r.setupParsers(o),o.totalRows=0,r.validateOptions(o),o.delayInit||r.buildCache(o),r.bindEvents(e,o.$headers,!0),r.bindMethods(o),o.supportsDataObject&&void 0!==a.data().sortlist?o.sortList=a.data().sortlist:n&&a.metadata()&&a.metadata().sortlist&&(o.sortList=a.metadata().sortlist),r.applyWidget(e,!0),o.sortList.length>0?r.sortOn(o,o.sortList,{},!o.initWidgets):(r.setHeadersCss(o),o.initWidgets&&r.applyWidget(e,!1)),o.showProcessing&&a.unbind("sortBegin"+o.namespace+" sortEnd"+o.namespace).bind("sortBegin"+o.namespace+" sortEnd"+o.namespace,function(t){clearTimeout(o.timerProcessing),r.isProcessing(e),"sortBegin"===t.type&&(o.timerProcessing=setTimeout(function(){r.isProcessing(e,!0)},500))}),e.hasInitialized=!0,e.isProcessing=!1,o.debug&&(console.log("Overall initialization time:"+r.benchmark(t.data(e,"startoveralltimer"))),o.debug&&console.groupEnd&&console.groupEnd()),a.triggerHandler("tablesorter-initialized",e),"function"==typeof o.initialized&&o.initialized(e)}else o.debug&&(e.hasInitialized?console.warn("Stopping initialization. Tablesorter has already been initialized"):console.error("Stopping initialization! No table, thead or tbody",e))},bindMethods:function(e){var o=e.$table,s=e.namespace,a="sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(s+" ");o.unbind(a.replace(r.regex.spaces," ")).bind("sortReset"+s,function(e,t){e.stopPropagation(),r.sortReset(this.config,function(e){e.isApplyingWidgets?setTimeout(function(){r.applyWidget(e,"",t)},100):r.applyWidget(e,"",t)})}).bind("updateAll"+s,function(e,t,o){e.stopPropagation(),r.updateAll(this.config,t,o)}).bind("update"+s+" updateRows"+s,function(e,t,o){e.stopPropagation(),r.update(this.config,t,o)}).bind("updateHeaders"+s,function(e,t){e.stopPropagation(),r.updateHeaders(this.config,t)}).bind("updateCell"+s,function(e,t,o,s){e.stopPropagation(),r.updateCell(this.config,t,o,s)}).bind("addRows"+s,function(e,t,o,s){e.stopPropagation(),r.addRows(this.config,t,o,s)}).bind("updateComplete"+s,function(){this.isUpdating=!1}).bind("sorton"+s,function(e,t,o,s){e.stopPropagation(),r.sortOn(this.config,t,o,s)}).bind("appendCache"+s,function(e,o,s){e.stopPropagation(),r.appendCache(this.config,s),t.isFunction(o)&&o(this)}).bind("updateCache"+s,function(e,t,o){e.stopPropagation(),r.updateCache(this.config,t,o)}).bind("applyWidgetId"+s,function(e,t){e.stopPropagation(),r.applyWidgetId(this,t)}).bind("applyWidgets"+s,function(e,t){e.stopPropagation(),r.applyWidget(this,!1,t)}).bind("refreshWidgets"+s,function(e,t,o){e.stopPropagation(),r.refreshWidgets(this,t,o)}).bind("removeWidget"+s,function(e,t,o){e.stopPropagation(),r.removeWidget(this,t,o)}).bind("destroy"+s,function(e,t,o){e.stopPropagation(),r.destroy(this,t,o)}).bind("resetToLoadState"+s,function(o){o.stopPropagation(),r.removeWidget(this,!0,!1);var s=t.extend(!0,{},e.originalSettings);(e=t.extend(!0,{},r.defaults,s)).originalSettings=s,this.hasInitialized=!1,r.setup(this,e)})},bindEvents:function(e,o,s){var a,n=(e=t(e)[0]).config,i=n.namespace,l=null;!0!==s&&(o.addClass(i.slice(1)+"_extra_headers"),(a=r.getClosest(o,"table")).length&&"TABLE"===a[0].nodeName&&a[0]!==e&&t(a[0]).addClass(i.slice(1)+"_extra_table")),a=(n.pointerDown+" "+n.pointerUp+" "+n.pointerClick+" sort keyup ").replace(r.regex.spaces," ").split(" ").join(i+" "),o.find(n.selectorSort).add(o.filter(n.selectorSort)).unbind(a).bind(a,function(e,s){var a,i,d,c=t(e.target),g=" "+e.type+" ";if(!(1!==(e.which||e.button)&&!g.match(" "+n.pointerClick+" | sort | keyup ")||" keyup "===g&&e.which!==r.keyCodes.enter||g.match(" "+n.pointerClick+" ")&&void 0!==e.which||g.match(" "+n.pointerUp+" ")&&l!==e.target&&!0!==s)){if(g.match(" "+n.pointerDown+" "))return l=e.target,void("1"===(d=c.jquery.split("."))[0]&&d[1]<4&&e.preventDefault());if(l=null,r.regex.formElements.test(e.target.nodeName)||c.hasClass(n.cssNoSort)||c.parents("."+n.cssNoSort).length>0||c.parents("button").length>0)return!n.cancelSelection;n.delayInit&&r.isEmptyObject(n.cache)&&r.buildCache(n),a=r.getClosest(t(this),"."+r.css.header),d=o.index(a),n.last.clickedIndex=d<0?a.attr("data-column"):d,(i=n.$headers[n.last.clickedIndex])&&!i.sortDisabled&&r.initSort(n,i,e)}}),n.cancelSelection&&o.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})},buildHeaders:function(e){var o,s,a,n;for(e.headerList=[],e.headerContent=[],e.sortVars=[],e.debug&&(a=new Date),e.columns=r.computeColumnIndex(e.$table.children("thead, tfoot").children("tr")),s=e.cssIcon?'<i class="'+(e.cssIcon===r.css.icon?r.css.icon:e.cssIcon+" "+r.css.icon)+'"></i>':"",e.$headers=t(t.map(e.$table.find(e.selectorHeaders),function(o,a){var n,i,l,d,c,g=t(o);if(!r.getClosest(g,"tr").hasClass(e.cssIgnoreRow))return/(th|td)/i.test(o.nodeName)||(c=r.getClosest(g,"th, td"),g.attr("data-column",c.attr("data-column"))),n=r.getColumnData(e.table,e.headers,a,!0),e.headerContent[a]=g.html(),""===e.headerTemplate||g.find("."+r.css.headerIn).length||(d=e.headerTemplate.replace(r.regex.templateContent,g.html()).replace(r.regex.templateIcon,g.find("."+r.css.icon).length?"":s),e.onRenderTemplate&&(i=e.onRenderTemplate.apply(g,[a,d]))&&"string"==typeof i&&(d=i),g.html('<div class="'+r.css.headerIn+'">'+d+"</div>")),e.onRenderHeader&&e.onRenderHeader.apply(g,[a,e,e.$table]),l=parseInt(g.attr("data-column"),10),o.column=l,c=r.getOrder(r.getData(g,n,"sortInitialOrder")||e.sortInitialOrder),e.sortVars[l]={count:-1,order:c?e.sortReset?[1,0,2]:[1,0]:e.sortReset?[0,1,2]:[0,1],lockedOrder:!1},void 0!==(c=r.getData(g,n,"lockedOrder")||!1)&&!1!==c&&(e.sortVars[l].lockedOrder=!0,e.sortVars[l].order=r.getOrder(c)?[1,1]:[0,0]),e.headerList[a]=o,g.addClass(r.css.header+" "+e.cssHeader),r.getClosest(g,"tr").addClass(r.css.headerRow+" "+e.cssHeaderRow).attr("role","row"),e.tabIndex&&g.attr("tabindex",0),o})),e.$headerIndexed=[],n=0;n<e.columns;n++)r.isEmptyObject(e.sortVars[n])&&(e.sortVars[n]={}),o=e.$headers.filter('[data-column="'+n+'"]'),e.$headerIndexed[n]=o.length?o.not(".sorter-false").length?o.not(".sorter-false").filter(":last"):o.filter(":last"):t();e.$table.find(e.selectorHeaders).attr({scope:"col",role:"columnheader"}),r.updateHeader(e),e.debug&&(console.log("Built headers:"+r.benchmark(a)),console.log(e.$headers))},addInstanceMethods:function(e){t.extend(r.instanceMethods,e)},setupParsers:function(e,t){var o,s,a,n,i,l,d,c,g,p,u,f,h,m,b=e.table,y=0,w={};if(e.$tbodies=e.$table.children("tbody:not(."+e.cssInfoBlock+")"),h=void 0===t?e.$tbodies:t,0===(m=h.length))return e.debug?console.warn("Warning: *Empty table!* Not building a parser cache"):"";for(e.debug&&(f=new Date,console[console.group?"group":"log"]("Detecting parsers for each column")),s={extractors:[],parsers:[]};y<m;){if((o=h[y].rows).length)for(i=0,n=e.columns,l=0;l<n;l++){if((d=e.$headerIndexed[i])&&d.length&&(c=r.getColumnData(b,e.headers,i),u=r.getParserById(r.getData(d,c,"extractor")),p=r.getParserById(r.getData(d,c,"sorter")),g="false"===r.getData(d,c,"parser"),e.empties[i]=(r.getData(d,c,"empty")||e.emptyTo||(e.emptyToBottom?"bottom":"top")).toLowerCase(),e.strings[i]=(r.getData(d,c,"string")||e.stringTo||"max").toLowerCase(),g&&(p=r.getParserById("no-parser")),u||(u=!1),p||(p=r.detectParserForColumn(e,o,-1,i)),e.debug&&(w["("+i+") "+d.text()]={parser:p.id,extractor:u?u.id:"none",string:e.strings[i],empty:e.empties[i]}),s.parsers[i]=p,s.extractors[i]=u,(a=d[0].colSpan-1)>0))for(i+=a,n+=a;a+1>0;)s.parsers[i-a]=p,s.extractors[i-a]=u,a--;i++}y+=s.parsers.length?m:1}e.debug&&(r.isEmptyObject(w)?console.warn(" No parsers detected!"):console[console.table?"table":"log"](w),console.log("Completed detecting parsers"+r.benchmark(f)),console.groupEnd&&console.groupEnd()),e.parsers=s.parsers,e.extractors=s.extractors},addParser:function(e){var t,o=r.parsers.length,s=!0;for(t=0;t<o;t++)r.parsers[t].id.toLowerCase()===e.id.toLowerCase()&&(s=!1);s&&(r.parsers[r.parsers.length]=e)},getParserById:function(e){if("false"==e)return!1;var t,o=r.parsers.length;for(t=0;t<o;t++)if(r.parsers[t].id.toLowerCase()===e.toString().toLowerCase())return r.parsers[t];return!1},detectParserForColumn:function(e,o,s,a){for(var n,i,l,d=r.parsers.length,c=!1,g="",p=!0;""===g&&p;)(l=o[++s])&&s<50?l.className.indexOf(r.cssIgnoreRow)<0&&(c=o[s].cells[a],g=r.getElementText(e,c,a),i=t(c),e.debug&&console.log("Checking if value was empty on row "+s+", column: "+a+': "'+g+'"')):p=!1;for(;--d>=0;)if((n=r.parsers[d])&&"text"!==n.id&&n.is&&n.is(g,e.table,c,i))return n;return r.getParserById("text")},getElementText:function(e,o,s){if(!o)return"";var a,n=e.textExtraction||"",i=o.jquery?o:t(o);return"string"==typeof n?"basic"===n&&void 0!==(a=i.attr(e.textAttribute))?t.trim(a):t.trim(o.textContent||i.text()):"function"==typeof n?t.trim(n(i[0],e.table,s)):"function"==typeof(a=r.getColumnData(e.table,n,s))?t.trim(a(i[0],e.table,s)):t.trim(i[0].textContent||i.text())},getParsedText:function(e,t,o,s){void 0===s&&(s=r.getElementText(e,t,o));var a=""+s,n=e.parsers[o],i=e.extractors[o];return n&&(i&&"function"==typeof i.format&&(s=i.format(s,e.table,t,o)),a="no-parser"===n.id?"":n.format(""+s,e.table,t,o),e.ignoreCase&&"string"==typeof a&&(a=a.toLowerCase())),a},buildCache:function(e,o,s){var a,n,i,l,d,c,g,p,u,f,h,m,b,y,w,x,v,C,$,I,D,R,T=e.table,L=e.parsers;if(e.$tbodies=e.$table.children("tbody:not(."+e.cssInfoBlock+")"),g=void 0===s?e.$tbodies:s,e.cache={},e.totalRows=0,!L)return e.debug?console.warn("Warning: *Empty table!* Not building a cache"):"";for(e.debug&&(m=new Date),e.showProcessing&&r.isProcessing(T,!0),c=0;c<g.length;c++){for(x=[],a=e.cache[c]={normalized:[]},b=g[c]&&g[c].rows.length||0,l=0;l<b;++l)if(y={child:[],raw:[]},p=t(g[c].rows[l]),u=[],!p.hasClass(e.selectorRemove.slice(1)))if(p.hasClass(e.cssChildRow)&&0!==l)for(D=a.normalized.length-1,(w=a.normalized[D][e.columns]).$row=w.$row.add(p),p.prev().hasClass(e.cssChildRow)||p.prev().addClass(r.css.cssHasChild),f=p.children("th, td"),D=w.child.length,w.child[D]=[],C=0,I=e.columns,d=0;d<I;d++)(h=f[d])&&(w.child[D][d]=r.getParsedText(e,h,d),(v=f[d].colSpan-1)>0&&(C+=v,I+=v)),C++;else{for(y.$row=p,y.order=l,C=0,I=e.columns,d=0;d<I;++d){if((h=p[0].cells[d])&&C<e.columns&&(!($=void 0!==L[C])&&e.debug&&console.warn("No parser found for row: "+l+", column: "+d+'; cell containing: "'+t(h).text()+'"; does it have a header?'),n=r.getElementText(e,h,C),y.raw[C]=n,i=r.getParsedText(e,h,C,n),u[C]=i,$&&"numeric"===(L[C].type||"").toLowerCase()&&(x[C]=Math.max(Math.abs(i)||0,x[C]||0)),(v=h.colSpan-1)>0)){for(R=0;R<=v;)i=e.duplicateSpan||0===R?n:"string"!=typeof e.textExtraction?r.getElementText(e,h,C+R)||"":"",y.raw[C+R]=i,u[C+R]=i,R++;C+=v,I+=v}C++}u[e.columns]=y,a.normalized[a.normalized.length]=u}a.colMax=x,e.totalRows+=a.normalized.length}if(e.showProcessing&&r.isProcessing(T),e.debug){for(D=Math.min(5,e.cache[0].normalized.length),console[console.group?"group":"log"]("Building cache for "+e.totalRows+" rows (showing "+D+" rows in log) and "+e.columns+" columns"+r.benchmark(m)),n={},d=0;d<e.columns;d++)for(C=0;C<D;C++)n["row: "+C]||(n["row: "+C]={}),n["row: "+C][e.$headerIndexed[d].text()]=e.cache[0].normalized[C][d];console[console.table?"table":"log"](n),console.groupEnd&&console.groupEnd()}t.isFunction(o)&&o(T)},getColumnText:function(e,o,s,a){var n,i,l,d,c,g,p,u,f,h,m="function"==typeof s,b="all"===o,y={raw:[],parsed:[],$cell:[]},w=(e=t(e)[0]).config;if(!r.isEmptyObject(w)){for(c=w.$tbodies.length,n=0;n<c;n++)for(g=(l=w.cache[n].normalized).length,i=0;i<g;i++)d=l[i],a&&!d[w.columns].$row.is(a)||(h=!0,u=b?d.slice(0,w.columns):d[o],d=d[w.columns],p=b?d.raw:d.raw[o],f=b?d.$row.children():d.$row.children().eq(o),m&&(h=s({tbodyIndex:n,rowIndex:i,parsed:u,raw:p,$row:d.$row,$cell:f})),!1!==h&&(y.parsed[y.parsed.length]=u,y.raw[y.raw.length]=p,y.$cell[y.$cell.length]=f));return y}w.debug&&console.warn("No cache found - aborting getColumnText function!")},setHeadersCss:function(e){var o,s,a=e.sortList,n=a.length,i=r.css.sortNone+" "+e.cssNone,l=[r.css.sortAsc+" "+e.cssAsc,r.css.sortDesc+" "+e.cssDesc],d=[e.cssIconAsc,e.cssIconDesc,e.cssIconNone],c=["ascending","descending"],g=function(e,t){e.removeClass(i).addClass(l[t]).attr("aria-sort",c[t]).find("."+r.css.icon).removeClass(d[2]).addClass(d[t])},p=e.$table.find("tfoot tr").children("td, th").add(t(e.namespace+"_extra_headers")).removeClass(l.join(" ")),u=e.$headers.add(t("thead "+e.namespace+"_extra_headers")).removeClass(l.join(" ")).addClass(i).attr("aria-sort","none").find("."+r.css.icon).removeClass(d.join(" ")).end();for(u.not(".sorter-false").find("."+r.css.icon).addClass(d[2]),e.cssIconDisabled&&u.filter(".sorter-false").find("."+r.css.icon).addClass(e.cssIconDisabled),o=0;o<n;o++)if(2!==a[o][1]){if(u=e.$headers.filter(function(t){for(var o=!0,s=e.$headers.eq(t),a=parseInt(s.attr("data-column"),10),n=a+r.getClosest(s,"th, td")[0].colSpan;a<n;a++)o=!!o&&(o||r.isValueInArray(a,e.sortList)>-1);return o}),(u=u.not(".sorter-false").filter('[data-column="'+a[o][0]+'"]'+(1===n?":last":""))).length)for(s=0;s<u.length;s++)u[s].sortDisabled||g(u.eq(s),a[o][1]);p.length&&g(p.filter('[data-column="'+a[o][0]+'"]'),a[o][1])}for(n=e.$headers.length,o=0;o<n;o++)r.setColumnAriaLabel(e,e.$headers.eq(o))},getClosest:function(e,r){return t.fn.closest?e.closest(r):e.is(r)?e:e.parents(r).filter(":first")},setColumnAriaLabel:function(e,o,s){if(o.length){var a=parseInt(o.attr("data-column"),10),n=e.sortVars[a],i=o.hasClass(r.css.sortAsc)?"sortAsc":o.hasClass(r.css.sortDesc)?"sortDesc":"sortNone",l=t.trim(o.text())+": "+r.language[i];o.hasClass("sorter-false")||!1===s?l+=r.language.sortDisabled:(i=(n.count+1)%n.order.length,s=n.order[i],l+=r.language[0===s?"nextAsc":1===s?"nextDesc":"nextNone"]),o.attr("aria-label",l)}},updateHeader:function(e){var t,o,s,a,n=e.table,i=e.$headers.length;for(t=0;t<i;t++)s=e.$headers.eq(t),a=r.getColumnData(n,e.headers,t,!0),o="false"===r.getData(s,a,"sorter")||"false"===r.getData(s,a,"parser"),r.setColumnSort(e,s,o)},setColumnSort:function(e,t,r){var o=e.table.id;t[0].sortDisabled=r,t[r?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+r),e.tabIndex&&(r?t.removeAttr("tabindex"):t.attr("tabindex","0")),o&&(r?t.removeAttr("aria-controls"):t.attr("aria-controls",o))},updateHeaderSortCount:function(e,o){var s,a,n,i,l,d,c,g,p=o||e.sortList,u=p.length;for(e.sortList=[],i=0;i<u;i++)if(c=p[i],(s=parseInt(c[0],10))<e.columns){switch(e.sortVars[s].order||(g=r.getOrder(e.sortInitialOrder)?e.sortReset?[1,0,2]:[1,0]:e.sortReset?[0,1,2]:[0,1],e.sortVars[s].order=g,e.sortVars[s].count=0),g=e.sortVars[s].order,a=(""+c[1]).match(/^(1|d|s|o|n)/),a=a?a[0]:""){case"1":case"d":a=1;break;case"s":a=l||0;break;case"o":a=0===(d=g[(l||0)%g.length])?1:1===d?0:2;break;case"n":a=g[++e.sortVars[s].count%g.length];break;default:a=0}l=0===i?a:l,n=[s,parseInt(a,10)||0],e.sortList[e.sortList.length]=n,a=t.inArray(n[1],g),e.sortVars[s].count=a>=0?a:n[1]%g.length}},updateAll:function(e,t,o){var s=e.table;s.isUpdating=!0,r.refreshWidgets(s,!0,!0),r.buildHeaders(e),r.bindEvents(s,e.$headers,!0),r.bindMethods(e),r.commonUpdate(e,t,o)},update:function(e,t,o){e.table.isUpdating=!0,r.updateHeader(e),r.commonUpdate(e,t,o)},updateHeaders:function(e,t){e.table.isUpdating=!0,r.buildHeaders(e),r.bindEvents(e.table,e.$headers,!0),r.resortComplete(e,t)},updateCell:function(e,o,s,a){if(t(o).closest("tr").hasClass(e.cssChildRow))console.warn('Tablesorter Warning! "updateCell" for child row content has been disabled, use "update" instead');else{if(r.isEmptyObject(e.cache))return r.updateHeader(e),void r.commonUpdate(e,s,a);e.table.isUpdating=!0,e.$table.find(e.selectorRemove).remove();var n,i,l,d,c,g,p=e.$tbodies,u=t(o),f=p.index(r.getClosest(u,"tbody")),h=e.cache[f],m=r.getClosest(u,"tr");if(o=u[0],p.length&&f>=0){if(l=p.eq(f).find("tr").not("."+e.cssChildRow).index(m),c=h.normalized[l],(g=m[0].cells.length)!==e.columns)for(d=0,n=!1,i=0;i<g;i++)n||m[0].cells[i]===o?n=!0:d+=m[0].cells[i].colSpan;else d=u.index();n=r.getElementText(e,o,d),c[e.columns].raw[d]=n,n=r.getParsedText(e,o,d,n),c[d]=n,"numeric"===(e.parsers[d].type||"").toLowerCase()&&(h.colMax[d]=Math.max(Math.abs(n)||0,h.colMax[d]||0)),!1!==(n="undefined"!==s?s:e.resort)?r.checkResort(e,n,a):r.resortComplete(e,a)}else e.debug&&console.error("updateCell aborted, tbody missing or not within the indicated table"),e.table.isUpdating=!1}},addRows:function(o,s,a,n){var i,l,d,c,g,p,u,f,h,m,b,y,w,x="string"==typeof s&&1===o.$tbodies.length&&/<tr/.test(s||""),v=o.table;if(x)s=t(s),o.$tbodies.append(s);else if(!(s&&s instanceof e&&r.getClosest(s,"table")[0]===o.table))return o.debug&&console.error("addRows method requires (1) a jQuery selector reference to rows that have already been added to the table, or (2) row HTML string to be added to a table with only one tbody"),!1;if(v.isUpdating=!0,r.isEmptyObject(o.cache))r.updateHeader(o),r.commonUpdate(o,a,n);else{for(g=s.filter("tr").attr("role","row").length,d=o.$tbodies.index(s.parents("tbody").filter(":first")),o.parsers&&o.parsers.length||r.setupParsers(o),c=0;c<g;c++){for(h=0,u=s[c].cells.length,f=o.cache[d].normalized.length,b=[],m={child:[],raw:[],$row:s.eq(c),order:f},p=0;p<u;p++)y=s[c].cells[p],i=r.getElementText(o,y,h),m.raw[h]=i,l=r.getParsedText(o,y,h,i),b[h]=l,"numeric"===(o.parsers[h].type||"").toLowerCase()&&(o.cache[d].colMax[h]=Math.max(Math.abs(l)||0,o.cache[d].colMax[h]||0)),(w=y.colSpan-1)>0&&(h+=w),h++;b[o.columns]=m,o.cache[d].normalized[f]=b}r.checkResort(o,a,n)}},updateCache:function(e,t,o){e.parsers&&e.parsers.length||r.setupParsers(e,o),r.buildCache(e,t,o)},appendCache:function(e,t){var o,s,a,n,i,l,d,c=e.table,g=e.widgetOptions,p=e.$tbodies,u=[],f=e.cache;if(r.isEmptyObject(f))return e.appender?e.appender(c,u):c.isUpdating?e.$table.triggerHandler("updateComplete",c):"";for(e.debug&&(d=new Date),l=0;l<p.length;l++)if((a=p.eq(l)).length){for(n=r.processTbody(c,a,!0),s=(o=f[l].normalized).length,i=0;i<s;i++)u[u.length]=o[i][e.columns].$row,e.appender&&(!e.pager||e.pager.removeRows&&g.pager_removeRows||e.pager.ajax)||n.append(o[i][e.columns].$row);r.processTbody(c,n,!1)}e.appender&&e.appender(c,u),e.debug&&console.log("Rebuilt table"+r.benchmark(d)),t||e.appender||r.applyWidget(c),c.isUpdating&&e.$table.triggerHandler("updateComplete",c)},commonUpdate:function(e,t,o){e.$table.find(e.selectorRemove).remove(),r.setupParsers(e),r.buildCache(e),r.checkResort(e,t,o)},initSort:function(e,o,s){if(e.table.isUpdating)return setTimeout(function(){r.initSort(e,o,s)},50);var a,n,i,l,d,c,g,p=!s[e.sortMultiSortKey],u=e.table,f=e.$headers.length,h=r.getClosest(t(o),"th, td"),m=parseInt(h.attr("data-column"),10),b=e.sortVars[m].order;if(h=h[0],e.$table.triggerHandler("sortStart",u),c=(e.sortVars[m].count+1)%b.length,e.sortVars[m].count=s[e.sortResetKey]?2:c,e.sortRestart)for(i=0;i<f;i++)g=e.$headers.eq(i),m!==(c=parseInt(g.attr("data-column"),10))&&(p||g.hasClass(r.css.sortNone))&&(e.sortVars[c].count=-1);if(p){if(e.sortList=[],e.last.sortList=[],null!==e.sortForce)for(a=e.sortForce,n=0;n<a.length;n++)a[n][0]!==m&&(e.sortList[e.sortList.length]=a[n]);if((l=b[e.sortVars[m].count])<2&&(e.sortList[e.sortList.length]=[m,l],h.colSpan>1))for(n=1;n<h.colSpan;n++)e.sortList[e.sortList.length]=[m+n,l],e.sortVars[m+n].count=t.inArray(l,b)}else if(e.sortList=t.extend([],e.last.sortList),r.isValueInArray(m,e.sortList)>=0)for(n=0;n<e.sortList.length;n++)(c=e.sortList[n])[0]===m&&(c[1]=b[e.sortVars[m].count],2===c[1]&&(e.sortList.splice(n,1),e.sortVars[m].count=-1));else if((l=b[e.sortVars[m].count])<2&&(e.sortList[e.sortList.length]=[m,l],h.colSpan>1))for(n=1;n<h.colSpan;n++)e.sortList[e.sortList.length]=[m+n,l],e.sortVars[m+n].count=t.inArray(l,b);if(e.last.sortList=t.extend([],e.sortList),e.sortList.length&&e.sortAppend&&(a=t.isArray(e.sortAppend)?e.sortAppend:e.sortAppend[e.sortList[0][0]],!r.isEmptyObject(a)))for(n=0;n<a.length;n++)if(a[n][0]!==m&&r.isValueInArray(a[n][0],e.sortList)<0){if(l=a[n][1],d=(""+l).match(/^(a|d|s|o|n)/))switch(c=e.sortList[0][1],d[0]){case"d":l=1;break;case"s":l=c;break;case"o":l=0===c?1:0;break;case"n":l=(c+1)%b.length;break;default:l=0}e.sortList[e.sortList.length]=[a[n][0],l]}e.$table.triggerHandler("sortBegin",u),setTimeout(function(){r.setHeadersCss(e),r.multisort(e),r.appendCache(e),e.$table.triggerHandler("sortBeforeEnd",u),e.$table.triggerHandler("sortEnd",u)},1)},multisort:function(e){var t,o,s,a,n=e.table,i=[],l=0,d=e.textSorter||"",c=e.sortList,g=c.length,p=e.$tbodies.length;if(!e.serverSideSorting&&!r.isEmptyObject(e.cache)){if(e.debug&&(o=new Date),"object"==typeof d)for(s=e.columns;s--;)"function"==typeof(a=r.getColumnData(n,d,s))&&(i[s]=a);for(t=0;t<p;t++)s=e.cache[t].colMax,e.cache[t].normalized.sort(function(t,o){var a,p,u,f,h,m,b;for(a=0;a<g;a++){if(u=c[a][0],f=c[a][1],l=0===f,e.sortStable&&t[u]===o[u]&&1===g)return t[e.columns].order-o[e.columns].order;if(p=/n/i.test(r.getSortType(e.parsers,u)),p&&e.strings[u]?(p="boolean"==typeof r.string[e.strings[u]]?(l?1:-1)*(r.string[e.strings[u]]?-1:1):e.strings[u]?r.string[e.strings[u]]||0:0,h=e.numberSorter?e.numberSorter(t[u],o[u],l,s[u],n):r["sortNumeric"+(l?"Asc":"Desc")](t[u],o[u],p,s[u],u,e)):(m=l?t:o,b=l?o:t,h="function"==typeof d?d(m[u],b[u],l,u,n):"function"==typeof i[u]?i[u](m[u],b[u],l,u,n):r["sortNatural"+(l?"Asc":"Desc")](t[u],o[u],u,e)),h)return h}return t[e.columns].order-o[e.columns].order});e.debug&&console.log("Applying sort "+c.toString()+r.benchmark(o))}},resortComplete:function(e,r){e.table.isUpdating&&e.$table.triggerHandler("updateComplete",e.table),t.isFunction(r)&&r(e.table)},checkResort:function(e,o,s){var a=t.isArray(o)?o:e.sortList;!1===(void 0===o?e.resort:o)||e.serverSideSorting||e.table.isProcessing?(r.resortComplete(e,s),r.applyWidget(e.table,!1)):a.length?r.sortOn(e,a,function(){r.resortComplete(e,s)},!0):r.sortReset(e,function(){r.resortComplete(e,s),r.applyWidget(e.table,!1)})},sortOn:function(e,o,s,a){var n=e.table;e.$table.triggerHandler("sortStart",n),r.updateHeaderSortCount(e,o),r.setHeadersCss(e),e.delayInit&&r.isEmptyObject(e.cache)&&r.buildCache(e),e.$table.triggerHandler("sortBegin",n),r.multisort(e),r.appendCache(e,a),e.$table.triggerHandler("sortBeforeEnd",n),e.$table.triggerHandler("sortEnd",n),r.applyWidget(n),t.isFunction(s)&&s(n)},sortReset:function(e,o){e.sortList=[],r.setHeadersCss(e),r.multisort(e),r.appendCache(e);var s;for(s=0;s<e.columns;s++)e.sortVars[s].count=-1;t.isFunction(o)&&o(e.table)},getSortType:function(e,t){return e&&e[t]?e[t].type||"":""},getOrder:function(e){return/^d/i.test(e)||1===e},sortNatural:function(e,t){if(e===t)return 0;e=e.toString(),t=t.toString();var o,s,a,n,i,l,d=r.regex;if(d.hex.test(t)){if(o=parseInt((e||"").match(d.hex),16),s=parseInt((t||"").match(d.hex),16),o<s)return-1;if(o>s)return 1}for(o=(e||"").replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0"),s=(t||"").replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0"),l=Math.max(o.length,s.length),i=0;i<l;i++){if(a=isNaN(o[i])?o[i]||0:parseFloat(o[i])||0,n=isNaN(s[i])?s[i]||0:parseFloat(s[i])||0,isNaN(a)!==isNaN(n))return isNaN(a)?1:-1;if(typeof a!=typeof n&&(a+="",n+=""),a<n)return-1;if(a>n)return 1}return 0},sortNaturalAsc:function(e,t,o,s){if(e===t)return 0;var a=r.string[s.empties[o]||s.emptyTo];return""===e&&0!==a?"boolean"==typeof a?a?-1:1:-a||-1:""===t&&0!==a?"boolean"==typeof a?a?1:-1:a||1:r.sortNatural(e,t)},sortNaturalDesc:function(e,t,o,s){if(e===t)return 0;var a=r.string[s.empties[o]||s.emptyTo];return""===e&&0!==a?"boolean"==typeof a?a?-1:1:a||1:""===t&&0!==a?"boolean"==typeof a?a?1:-1:-a||-1:r.sortNatural(t,e)},sortText:function(e,t){return e>t?1:e<t?-1:0},getTextValue:function(e,t,r){if(r){var o,s=e?e.length:0,a=r+t;for(o=0;o<s;o++)a+=e.charCodeAt(o);return t*a}return 0},sortNumericAsc:function(e,t,o,s,a,n){if(e===t)return 0;var i=r.string[n.empties[a]||n.emptyTo];return""===e&&0!==i?"boolean"==typeof i?i?-1:1:-i||-1:""===t&&0!==i?"boolean"==typeof i?i?1:-1:i||1:(isNaN(e)&&(e=r.getTextValue(e,o,s)),isNaN(t)&&(t=r.getTextValue(t,o,s)),e-t)},sortNumericDesc:function(e,t,o,s,a,n){if(e===t)return 0;var i=r.string[n.empties[a]||n.emptyTo];return""===e&&0!==i?"boolean"==typeof i?i?-1:1:i||1:""===t&&0!==i?"boolean"==typeof i?i?1:-1:-i||-1:(isNaN(e)&&(e=r.getTextValue(e,o,s)),isNaN(t)&&(t=r.getTextValue(t,o,s)),t-e)},sortNumeric:function(e,t){return e-t},addWidget:function(e){e.id&&!r.isEmptyObject(r.getWidgetById(e.id))&&console.warn('"'+e.id+'" widget was loaded more than once!'),r.widgets[r.widgets.length]=e},hasWidget:function(e,r){return(e=t(e)).length&&e[0].config&&e[0].config.widgetInit[r]||!1},getWidgetById:function(e){var t,o,s=r.widgets.length;for(t=0;t<s;t++)if((o=r.widgets[t])&&o.id&&o.id.toLowerCase()===e.toLowerCase())return o},applyWidgetOptions:function(e){var o,s,a,n=e.config,i=n.widgets.length;if(i)for(o=0;o<i;o++)(s=r.getWidgetById(n.widgets[o]))&&s.options&&(a=t.extend(!0,{},s.options),n.widgetOptions=t.extend(!0,a,n.widgetOptions),t.extend(!0,r.defaults.widgetOptions,s.options))},addWidgetFromClass:function(e){var t,o,s=e.config,a="^"+s.widgetClass.replace(r.regex.templateName,"(\\S+)+")+"$",n=new RegExp(a,"g"),i=(e.className||"").split(r.regex.spaces);if(i.length)for(t=i.length,o=0;o<t;o++)i[o].match(n)&&(s.widgets[s.widgets.length]=i[o].replace(n,"$1"))},applyWidgetId:function(e,o,s){var a,n,i,l=(e=t(e)[0]).config,d=l.widgetOptions,c=r.getWidgetById(o);c&&(i=c.id,a=!1,t.inArray(i,l.widgets)<0&&(l.widgets[l.widgets.length]=i),l.debug&&(n=new Date),!s&&l.widgetInit[i]||(l.widgetInit[i]=!0,e.hasInitialized&&r.applyWidgetOptions(e),"function"==typeof c.init&&(a=!0,l.debug&&console[console.group?"group":"log"]("Initializing "+i+" widget"),c.init(e,c,l,d))),s||"function"!=typeof c.format||(a=!0,l.debug&&console[console.group?"group":"log"]("Updating "+i+" widget"),c.format(e,l,d,!1)),l.debug&&a&&(console.log("Completed "+(s?"initializing ":"applying ")+i+" widget"+r.benchmark(n)),console.groupEnd&&console.groupEnd()))},applyWidget:function(e,o,s){var a,n,i,l,d,c=(e=t(e)[0]).config,g=[];if(!1===o||!e.hasInitialized||!e.isApplyingWidgets&&!e.isUpdating){if(c.debug&&(d=new Date),r.addWidgetFromClass(e),clearTimeout(c.timerReady),c.widgets.length){for(e.isApplyingWidgets=!0,c.widgets=t.grep(c.widgets,function(e,r){return t.inArray(e,c.widgets)===r}),n=(i=c.widgets||[]).length,a=0;a<n;a++)(l=r.getWidgetById(i[a]))&&l.id?(l.priority||(l.priority=10),g[a]=l):c.debug&&console.warn('"'+i[a]+'" was enabled, but the widget code has not been loaded!');for(g.sort(function(e,t){return e.priority<t.priority?-1:e.priority===t.priority?0:1}),n=g.length,c.debug&&console[console.group?"group":"log"]("Start "+(o?"initializing":"applying")+" widgets"),a=0;a<n;a++)(l=g[a])&&l.id&&r.applyWidgetId(e,l.id,o);c.debug&&console.groupEnd&&console.groupEnd()}c.timerReady=setTimeout(function(){e.isApplyingWidgets=!1,t.data(e,"lastWidgetApplication",new Date),c.$table.triggerHandler("tablesorter-ready"),o||"function"!=typeof s||s(e),c.debug&&(l=c.widgets.length,console.log("Completed "+(!0===o?"initializing ":"applying ")+l+" widget"+(1!==l?"s":"")+r.benchmark(d)))},10)}},removeWidget:function(e,o,s){var a,n,i,l,d=(e=t(e)[0]).config;if(!0===o)for(o=[],l=r.widgets.length,i=0;i<l;i++)(n=r.widgets[i])&&n.id&&(o[o.length]=n.id);else o=(t.isArray(o)?o.join(","):o||"").toLowerCase().split(/[\s,]+/);for(l=o.length,a=0;a<l;a++)n=r.getWidgetById(o[a]),(i=t.inArray(o[a],d.widgets))>=0&&!0!==s&&d.widgets.splice(i,1),n&&n.remove&&(d.debug&&console.log((s?"Refreshing":"Removing")+' "'+o[a]+'" widget'),n.remove(e,d,d.widgetOptions,s),d.widgetInit[o[a]]=!1);d.$table.triggerHandler("widgetRemoveEnd",e)},refreshWidgets:function(e,o,s){var a,n,i=(e=t(e)[0]).config.widgets,l=r.widgets,d=l.length,c=[],g=function(e){t(e).triggerHandler("refreshComplete")};for(a=0;a<d;a++)(n=l[a])&&n.id&&(o||t.inArray(n.id,i)<0)&&(c[c.length]=n.id);r.removeWidget(e,c.join(","),!0),!0!==s?(r.applyWidget(e,o||!1,g),o&&r.applyWidget(e,!1,g)):g(e)},benchmark:function(e){return" ("+((new Date).getTime()-e.getTime())+" ms)"},log:function(){console.log(arguments)},isEmptyObject:function(e){for(var t in e)return!1;return!0},isValueInArray:function(e,t){var r,o=t&&t.length||0;for(r=0;r<o;r++)if(t[r][0]===e)return r;return-1},formatFloat:function(e,o){if("string"!=typeof e||""===e)return e;var s;return e=(o&&o.config?!1!==o.config.usNumberFormat:void 0===o||o)?e.replace(r.regex.comma,""):e.replace(r.regex.digitNonUS,"").replace(r.regex.comma,"."),r.regex.digitNegativeTest.test(e)&&(e=e.replace(r.regex.digitNegativeReplace,"-$1")),s=parseFloat(e),isNaN(s)?t.trim(e):s},isDigit:function(e){return isNaN(e)?r.regex.digitTest.test(e.toString().replace(r.regex.digitReplace,"")):""!==e},computeColumnIndex:function(e,o){var s,a,n,i,l,d,c,g,p,u,f=o&&o.columns||0,h=[],m=new Array(f);for(s=0;s<e.length;s++)for(d=e[s].cells,a=0;a<d.length;a++){for(c=s,g=(l=d[a]).rowSpan||1,p=l.colSpan||1,void 0===h[c]&&(h[c]=[]),n=0;n<h[c].length+1;n++)if(void 0===h[c][n]){u=n;break}for(f&&l.cellIndex===u||(l.setAttribute?l.setAttribute("data-column",u):t(l).attr("data-column",u)),n=c;n<c+g;n++)for(void 0===h[n]&&(h[n]=[]),m=h[n],i=u;i<u+p;i++)m[i]="x"}return r.checkColumnCount(e,h,m.length),m.length},checkColumnCount:function(e,t,r){var o,s,a=!0,n=[];for(o=0;o<t.length;o++)if(t[o]&&(s=t[o].length,t[o].length!==r)){a=!1;break}a||(e.each(function(e,t){var r=t.parentElement.nodeName;n.indexOf(r)<0&&n.push(r)}),console.error("Invalid or incorrect number of columns in the "+n.join(" or ")+"; expected "+r+", but found "+s+" columns"))},fixColumnWidth:function(e){var o,s,a,n,i,l=(e=t(e)[0]).config,d=l.$table.children("colgroup");if(d.length&&d.hasClass(r.css.colgroup)&&d.remove(),l.widthFixed&&0===l.$table.children("colgroup").length){for(d=t('<colgroup class="'+r.css.colgroup+'">'),o=l.$table.width(),n=(a=l.$tbodies.find("tr:first").children(":visible")).length,i=0;i<n;i++)s=parseInt(a.eq(i).width()/o*1e3,10)/10+"%",d.append(t("<col>").css("width",s));l.$table.prepend(d)}},getData:function(e,r,o){var s,a,n="",i=t(e);return i.length?(s=!!t.metadata&&i.metadata(),a=" "+(i.attr("class")||""),void 0!==i.data(o)||void 0!==i.data(o.toLowerCase())?n+=i.data(o)||i.data(o.toLowerCase()):s&&void 0!==s[o]?n+=s[o]:r&&void 0!==r[o]?n+=r[o]:" "!==a&&a.match(" "+o+"-")&&(n=a.match(new RegExp("\\s"+o+"-([\\w-]+)"))[1]||""),t.trim(n)):""},getColumnData:function(e,r,o,s,a){if("object"!=typeof r||null===r)return r;var n,i=(e=t(e)[0]).config,l=a||i.$headers,d=i.$headerIndexed&&i.$headerIndexed[o]||l.find('[data-column="'+o+'"]:last');if(void 0!==r[o])return s?r[o]:r[l.index(d)];for(n in r)if("string"==typeof n&&d.filter(n).add(d.find(n)).length)return r[n]},isProcessing:function(e,o,s){var a=(e=t(e))[0].config,n=s||e.find("."+r.css.header);o?(void 0!==s&&a.sortList.length>0&&(n=n.filter(function(){return!this.sortDisabled&&r.isValueInArray(parseFloat(t(this).attr("data-column")),a.sortList)>=0})),e.add(n).addClass(r.css.processing+" "+a.cssProcessing)):e.add(n).removeClass(r.css.processing+" "+a.cssProcessing)},processTbody:function(e,r,o){if(e=t(e)[0],o)return e.isProcessing=!0,r.before('<colgroup class="tablesorter-savemyplace"/>'),t.fn.detach?r.detach():r.remove();var s=t(e).find("colgroup.tablesorter-savemyplace");r.insertAfter(s),s.remove(),e.isProcessing=!1},clearTableBody:function(e){t(e)[0].config.$tbodies.children().detach()},characterEquivalents:{a:"áàâãäąå",A:"ÁÀÂÃÄĄÅ",c:"çćč",C:"ÇĆČ",e:"éèêëěę",E:"ÉÈÊËĚĘ",i:"íìİîïı",I:"ÍÌİÎÏ",o:"óòôõöō",O:"ÓÒÔÕÖŌ",ss:"ß",SS:"ẞ",u:"úùûüů",U:"ÚÙÛÜŮ"},replaceAccents:function(e){var t,o="[",s=r.characterEquivalents;if(!r.characterRegex){r.characterRegexArray={};for(t in s)"string"==typeof t&&(o+=s[t],r.characterRegexArray[t]=new RegExp("["+s[t]+"]","g"));r.characterRegex=new RegExp(o+"]")}if(r.characterRegex.test(e))for(t in s)"string"==typeof t&&(e=e.replace(r.characterRegexArray[t],t));return e},validateOptions:function(e){var o,s,a,n,i="headers sortForce sortList sortAppend widgets".split(" "),l=e.originalSettings;if(l){e.debug&&(n=new Date);for(o in l)if("undefined"===(a=typeof r.defaults[o]))console.warn('Tablesorter Warning! "table.config.'+o+'" option not recognized');else if("object"===a)for(s in l[o])a=r.defaults[o]&&typeof r.defaults[o][s],t.inArray(o,i)<0&&"undefined"===a&&console.warn('Tablesorter Warning! "table.config.'+o+"."+s+'" option not recognized');e.debug&&console.log("validate options time:"+r.benchmark(n))}},restoreHeaders:function(e){var o,s,a=t(e)[0].config,n=a.$table.find(a.selectorHeaders),i=n.length;for(o=0;o<i;o++)(s=n.eq(o)).find("."+r.css.headerIn).length&&s.html(a.headerContent[o])},destroy:function(e,o,s){if((e=t(e)[0]).hasInitialized){r.removeWidget(e,!0,!1);var a,n=t(e),i=e.config,l=i.debug,d=n.find("thead:first"),c=d.find("tr."+r.css.headerRow).removeClass(r.css.headerRow+" "+i.cssHeaderRow),g=n.find("tfoot:first > tr").children("th, td");!1===o&&t.inArray("uitheme",i.widgets)>=0&&(n.triggerHandler("applyWidgetId",["uitheme"]),n.triggerHandler("applyWidgetId",["zebra"])),d.find("tr").not(c).remove(),a="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets removeWidget destroy mouseup mouseleave "+"keypress sortBegin sortEnd resetToLoadState ".split(" ").join(i.namespace+" "),n.removeData("tablesorter").unbind(a.replace(r.regex.spaces," ")),i.$headers.add(g).removeClass([r.css.header,i.cssHeader,i.cssAsc,i.cssDesc,r.css.sortAsc,r.css.sortDesc,r.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),c.find(i.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(i.namespace+" ").replace(r.regex.spaces," ")),r.restoreHeaders(e),n.toggleClass(r.css.table+" "+i.tableClass+" tablesorter-"+i.theme,!1===o),n.removeClass(i.namespace.slice(1)),e.hasInitialized=!1,delete e.config.cache,"function"==typeof s&&s(e),l&&console.log("tablesorter has been removed")}}};t.fn.tablesorter=function(e){return this.each(function(){var o=this,s=t.extend(!0,{},r.defaults,e,r.instanceMethods);s.originalSettings=e,!o.hasInitialized&&r.buildTable&&"TABLE"!==this.nodeName?r.buildTable(o,s):r.setup(o,s)})},window.console&&window.console.log||(r.logs=[],console={},console.log=console.warn=console.error=console.table=function(){var e=arguments.length>1?arguments:arguments[0];r.logs[r.logs.length]={date:Date.now(),log:e}}),r.addParser({id:"no-parser",is:function(){return!1},format:function(){return""},type:"text"}),r.addParser({id:"text",is:function(){return!0},format:function(e,o){var s=o.config;return e&&(e=t.trim(s.ignoreCase?e.toLocaleLowerCase():e),e=s.sortLocaleCompare?r.replaceAccents(e):e),e},type:"text"}),r.regex.nondigit=/[^\w,. \-()]/g,r.addParser({id:"digit",is:function(e){return r.isDigit(e)},format:function(e,o){var s=r.formatFloat((e||"").replace(r.regex.nondigit,""),o);return e&&"number"==typeof s?s:e?t.trim(e&&o.config.ignoreCase?e.toLocaleLowerCase():e):e},type:"numeric"}),r.regex.currencyReplace=/[+\-,. ]/g,r.regex.currencyTest=/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/,r.addParser({id:"currency",is:function(e){return e=(e||"").replace(r.regex.currencyReplace,""),r.regex.currencyTest.test(e)},format:function(e,o){var s=r.formatFloat((e||"").replace(r.regex.nondigit,""),o);return e&&"number"==typeof s?s:e?t.trim(e&&o.config.ignoreCase?e.toLocaleLowerCase():e):e},type:"numeric"}),r.regex.urlProtocolTest=/^(https?|ftp|file):\/\//,r.regex.urlProtocolReplace=/(https?|ftp|file):\/\/(www\.)?/,r.addParser({id:"url",is:function(e){return r.regex.urlProtocolTest.test(e)},format:function(e){return e?t.trim(e.replace(r.regex.urlProtocolReplace,"")):e},type:"text"}),r.regex.dash=/-/g,r.regex.isoDate=/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,r.addParser({id:"isoDate",is:function(e){return r.regex.isoDate.test(e)},format:function(e,t){var o=e?new Date(e.replace(r.regex.dash,"/")):e;return o instanceof Date&&isFinite(o)?o.getTime():e},type:"numeric"}),r.regex.percent=/%/g,r.regex.percentTest=/(\d\s*?%|%\s*?\d)/,r.addParser({id:"percent",is:function(e){return r.regex.percentTest.test(e)&&e.length<15},format:function(e,t){return e?r.formatFloat(e.replace(r.regex.percent,""),t):e},type:"numeric"}),r.addParser({id:"image",is:function(e,t,r,o){return o.find("img").length>0},format:function(e,r,o){return t(o).find("img").attr(r.config.imgAttr||"alt")||e},parsed:!0,type:"text"}),r.regex.dateReplace=/(\S)([AP]M)$/i,r.regex.usLongDateTest1=/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i,r.regex.usLongDateTest2=/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i,r.addParser({id:"usLongDate",is:function(e){return r.regex.usLongDateTest1.test(e)||r.regex.usLongDateTest2.test(e)},format:function(e,t){var o=e?new Date(e.replace(r.regex.dateReplace,"$1 $2")):e;return o instanceof Date&&isFinite(o)?o.getTime():e},type:"numeric"}),r.regex.shortDateTest=/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/,r.regex.shortDateReplace=/[\-.,]/g,r.regex.shortDateXXY=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,r.regex.shortDateYMD=/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,r.convertFormat=function(e,t){e=(e||"").replace(r.regex.spaces," ").replace(r.regex.shortDateReplace,"/"),"mmddyyyy"===t?e=e.replace(r.regex.shortDateXXY,"$3/$1/$2"):"ddmmyyyy"===t?e=e.replace(r.regex.shortDateXXY,"$3/$2/$1"):"yyyymmdd"===t&&(e=e.replace(r.regex.shortDateYMD,"$1/$2/$3"));var o=new Date(e);return o instanceof Date&&isFinite(o)?o.getTime():""},r.addParser({id:"shortDate",is:function(e){return e=(e||"").replace(r.regex.spaces," ").replace(r.regex.shortDateReplace,"/"),r.regex.shortDateTest.test(e)},format:function(e,t,o,s){if(e){var a=t.config,n=a.$headerIndexed[s],i=n.length&&n.data("dateFormat")||r.getData(n,r.getColumnData(t,a.headers,s),"dateFormat")||a.dateFormat;return n.length&&n.data("dateFormat",i),r.convertFormat(e,i)||e}return e},type:"numeric"}),r.regex.timeTest=/^(0?[1-9]|1[0-2]):([0-5]\d)(\s[AP]M)$|^((?:[01]\d|[2][0-4]):[0-5]\d)$/i,r.regex.timeMatch=/(0?[1-9]|1[0-2]):([0-5]\d)(\s[AP]M)|((?:[01]\d|[2][0-4]):[0-5]\d)/i,r.addParser({id:"time",is:function(e){return r.regex.timeTest.test(e)},format:function(e,t){var o,s=(e||"").match(r.regex.timeMatch),a=new Date(e),n=e&&(null!==s?s[0]:"00:00 AM"),i=n?new Date("2000/01/01 "+n.replace(r.regex.dateReplace,"$1 $2")):n;return i instanceof Date&&isFinite(i)?(o=a instanceof Date&&isFinite(a)?a.getTime():0,o?parseFloat(i.getTime()+"."+a.getTime()):i.getTime()):e},type:"numeric"}),r.addParser({id:"metadata",is:function(){return!1},format:function(e,r,o){var s=r.config,a=s.parserMetadataName?s.parserMetadataName:"sortValue";return t(o).metadata()[a]},type:"numeric"}),r.addWidget({id:"zebra",priority:90,format:function(e,r,o){var s,a,n,i,l,d,c,g=new RegExp(r.cssChildRow,"i"),p=r.$tbodies.add(t(r.namespace+"_extra_table").children("tbody:not(."+r.cssInfoBlock+")"));for(l=0;l<p.length;l++)for(n=0,c=(s=p.eq(l).children("tr:visible").not(r.selectorRemove)).length,d=0;d<c;d++)a=s.eq(d),g.test(a[0].className)||n++,i=n%2==0,a.removeClass(o.zebra[i?1:0]).addClass(o.zebra[i?0:1])},remove:function(e,t,o,s){if(!s){var a,n,i=t.$tbodies,l=(o.zebra||["even","odd"]).join(" ");for(a=0;a<i.length;a++)(n=r.processTbody(e,i.eq(a),!0)).children().removeClass(l),r.processTbody(e,n,!1)}}})}(e),e.tablesorter});
1
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(t){"use strict";var r=t.tablesorter={version:"2.30.1",parsers:[],widgets:[],defaults:{theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,tabIndex:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,resort:!0,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortStable:!1,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",duplicateSpan:!0,textExtraction:"basic",textAttribute:"data-text",textSorter:null,numberSorter:null,initWidgets:!0,widgetClass:"widget-{name}",widgets:[],widgetOptions:{zebra:["even","odd"]},initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssInfoBlock:"tablesorter-infoOnly",cssNoSort:"tablesorter-noSort",cssIgnoreRow:"tablesorter-ignoreRow",cssIcon:"tablesorter-icon",cssIconNone:"",cssIconAsc:"",cssIconDesc:"",cssIconDisabled:"",pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[],globalize:0,imgAttr:0},css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"},language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",sortDisabled:"sorting is disabled",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i,chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i,comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/,digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g},string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1},keyCodes:{enter:13},dates:{},instanceMethods:{},setup:function(e,o){if(e&&e.tHead&&0!==e.tBodies.length&&!0!==e.hasInitialized){var s="",a=t(e),n=t.metadata;e.hasInitialized=!1,e.isProcessing=!0,e.config=o,t.data(e,"tablesorter",o),r.debug(o,"core")&&(console[console.group?"group":"log"]("Initializing tablesorter v"+r.version),t.data(e,"startoveralltimer",new Date)),o.supportsDataObject=function(e){return e[0]=parseInt(e[0],10),e[0]>1||1===e[0]&&parseInt(e[1],10)>=4}(t.fn.jquery.split(".")),o.emptyTo=o.emptyTo.toLowerCase(),o.stringTo=o.stringTo.toLowerCase(),o.last={sortList:[],clickedIndex:-1},/tablesorter\-/.test(a.attr("class"))||(s=""!==o.theme?" tablesorter-"+o.theme:""),o.namespace?o.namespace="."+o.namespace.replace(r.regex.nonWord,""):o.namespace=".tablesorter"+Math.random().toString(16).slice(2),o.table=e,o.$table=a.addClass(r.css.table+" "+o.tableClass+s+" "+o.namespace.slice(1)).attr("role","grid"),o.$headers=a.find(o.selectorHeaders),o.$table.children().children("tr").attr("role","row"),o.$tbodies=a.children("tbody:not(."+o.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"}),o.$table.children("caption").length&&((s=o.$table.children("caption")[0]).id||(s.id=o.namespace.slice(1)+"caption"),o.$table.attr("aria-labelledby",s.id)),o.widgetInit={},o.textExtraction=o.$table.attr("data-text-extraction")||o.textExtraction||"basic",r.buildHeaders(o),r.fixColumnWidth(e),r.addWidgetFromClass(e),r.applyWidgetOptions(e),r.setupParsers(o),o.totalRows=0,o.debug&&r.validateOptions(o),o.delayInit||r.buildCache(o),r.bindEvents(e,o.$headers,!0),r.bindMethods(o),o.supportsDataObject&&void 0!==a.data().sortlist?o.sortList=a.data().sortlist:n&&a.metadata()&&a.metadata().sortlist&&(o.sortList=a.metadata().sortlist),r.applyWidget(e,!0),o.sortList.length>0?r.sortOn(o,o.sortList,{},!o.initWidgets):(r.setHeadersCss(o),o.initWidgets&&r.applyWidget(e,!1)),o.showProcessing&&a.unbind("sortBegin"+o.namespace+" sortEnd"+o.namespace).bind("sortBegin"+o.namespace+" sortEnd"+o.namespace,function(t){clearTimeout(o.timerProcessing),r.isProcessing(e),"sortBegin"===t.type&&(o.timerProcessing=setTimeout(function(){r.isProcessing(e,!0)},500))}),e.hasInitialized=!0,e.isProcessing=!1,r.debug(o,"core")&&(console.log("Overall initialization time:"+r.benchmark(t.data(e,"startoveralltimer"))),r.debug(o,"core")&&console.groupEnd&&console.groupEnd()),a.triggerHandler("tablesorter-initialized",e),"function"==typeof o.initialized&&o.initialized(e)}else r.debug(o,"core")&&(e.hasInitialized?console.warn("Stopping initialization. Tablesorter has already been initialized"):console.error("Stopping initialization! No table, thead or tbody",e))},bindMethods:function(e){var o=e.$table,s=e.namespace,a="sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(s+" ");o.unbind(a.replace(r.regex.spaces," ")).bind("sortReset"+s,function(e,t){e.stopPropagation(),r.sortReset(this.config,function(e){e.isApplyingWidgets?setTimeout(function(){r.applyWidget(e,"",t)},100):r.applyWidget(e,"",t)})}).bind("updateAll"+s,function(e,t,o){e.stopPropagation(),r.updateAll(this.config,t,o)}).bind("update"+s+" updateRows"+s,function(e,t,o){e.stopPropagation(),r.update(this.config,t,o)}).bind("updateHeaders"+s,function(e,t){e.stopPropagation(),r.updateHeaders(this.config,t)}).bind("updateCell"+s,function(e,t,o,s){e.stopPropagation(),r.updateCell(this.config,t,o,s)}).bind("addRows"+s,function(e,t,o,s){e.stopPropagation(),r.addRows(this.config,t,o,s)}).bind("updateComplete"+s,function(){this.isUpdating=!1}).bind("sorton"+s,function(e,t,o,s){e.stopPropagation(),r.sortOn(this.config,t,o,s)}).bind("appendCache"+s,function(e,o,s){e.stopPropagation(),r.appendCache(this.config,s),t.isFunction(o)&&o(this)}).bind("updateCache"+s,function(e,t,o){e.stopPropagation(),r.updateCache(this.config,t,o)}).bind("applyWidgetId"+s,function(e,t){e.stopPropagation(),r.applyWidgetId(this,t)}).bind("applyWidgets"+s,function(e,t){e.stopPropagation(),r.applyWidget(this,!1,t)}).bind("refreshWidgets"+s,function(e,t,o){e.stopPropagation(),r.refreshWidgets(this,t,o)}).bind("removeWidget"+s,function(e,t,o){e.stopPropagation(),r.removeWidget(this,t,o)}).bind("destroy"+s,function(e,t,o){e.stopPropagation(),r.destroy(this,t,o)}).bind("resetToLoadState"+s,function(o){o.stopPropagation(),r.removeWidget(this,!0,!1);var s=t.extend(!0,{},e.originalSettings);(e=t.extend(!0,{},r.defaults,s)).originalSettings=s,this.hasInitialized=!1,r.setup(this,e)})},bindEvents:function(e,o,s){var a,n=(e=t(e)[0]).config,i=n.namespace,l=null;!0!==s&&(o.addClass(i.slice(1)+"_extra_headers"),(a=r.getClosest(o,"table")).length&&"TABLE"===a[0].nodeName&&a[0]!==e&&t(a[0]).addClass(i.slice(1)+"_extra_table")),a=(n.pointerDown+" "+n.pointerUp+" "+n.pointerClick+" sort keyup ").replace(r.regex.spaces," ").split(" ").join(i+" "),o.find(n.selectorSort).add(o.filter(n.selectorSort)).unbind(a).bind(a,function(e,s){var a,i,d,c=t(e.target),g=" "+e.type+" ";if(!(1!==(e.which||e.button)&&!g.match(" "+n.pointerClick+" | sort | keyup ")||" keyup "===g&&e.which!==r.keyCodes.enter||g.match(" "+n.pointerClick+" ")&&void 0!==e.which||g.match(" "+n.pointerUp+" ")&&l!==e.target&&!0!==s)){if(g.match(" "+n.pointerDown+" "))return l=e.target,void("1"===(d=c.jquery.split("."))[0]&&d[1]<4&&e.preventDefault());if(l=null,r.regex.formElements.test(e.target.nodeName)||c.hasClass(n.cssNoSort)||c.parents("."+n.cssNoSort).length>0||c.parents("button").length>0)return!n.cancelSelection;n.delayInit&&r.isEmptyObject(n.cache)&&r.buildCache(n),a=r.getClosest(t(this),"."+r.css.header),d=o.index(a),n.last.clickedIndex=d<0?a.attr("data-column"):d,(i=n.$headers[n.last.clickedIndex])&&!i.sortDisabled&&r.initSort(n,i,e)}}),n.cancelSelection&&o.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})},buildHeaders:function(e){var o,s,a,n;for(e.headerList=[],e.headerContent=[],e.sortVars=[],r.debug(e,"core")&&(a=new Date),e.columns=r.computeColumnIndex(e.$table.children("thead, tfoot").children("tr")),s=e.cssIcon?'<i class="'+(e.cssIcon===r.css.icon?r.css.icon:e.cssIcon+" "+r.css.icon)+'"></i>':"",e.$headers=t(t.map(e.$table.find(e.selectorHeaders),function(o,a){var n,i,l,d,c,g=t(o);if(!r.getClosest(g,"tr").hasClass(e.cssIgnoreRow))return/(th|td)/i.test(o.nodeName)||(c=r.getClosest(g,"th, td"),g.attr("data-column",c.attr("data-column"))),n=r.getColumnData(e.table,e.headers,a,!0),e.headerContent[a]=g.html(),""===e.headerTemplate||g.find("."+r.css.headerIn).length||(d=e.headerTemplate.replace(r.regex.templateContent,g.html()).replace(r.regex.templateIcon,g.find("."+r.css.icon).length?"":s),e.onRenderTemplate&&(i=e.onRenderTemplate.apply(g,[a,d]))&&"string"==typeof i&&(d=i),g.html('<div class="'+r.css.headerIn+'">'+d+"</div>")),e.onRenderHeader&&e.onRenderHeader.apply(g,[a,e,e.$table]),l=parseInt(g.attr("data-column"),10),o.column=l,c=r.getOrder(r.getData(g,n,"sortInitialOrder")||e.sortInitialOrder),e.sortVars[l]={count:-1,order:c?e.sortReset?[1,0,2]:[1,0]:e.sortReset?[0,1,2]:[0,1],lockedOrder:!1},void 0!==(c=r.getData(g,n,"lockedOrder")||!1)&&!1!==c&&(e.sortVars[l].lockedOrder=!0,e.sortVars[l].order=r.getOrder(c)?[1,1]:[0,0]),e.headerList[a]=o,g.addClass(r.css.header+" "+e.cssHeader),r.getClosest(g,"tr").addClass(r.css.headerRow+" "+e.cssHeaderRow).attr("role","row"),e.tabIndex&&g.attr("tabindex",0),o})),e.$headerIndexed=[],n=0;n<e.columns;n++)r.isEmptyObject(e.sortVars[n])&&(e.sortVars[n]={}),o=e.$headers.filter('[data-column="'+n+'"]'),e.$headerIndexed[n]=o.length?o.not(".sorter-false").length?o.not(".sorter-false").filter(":last"):o.filter(":last"):t();e.$table.find(e.selectorHeaders).attr({scope:"col",role:"columnheader"}),r.updateHeader(e),r.debug(e,"core")&&(console.log("Built headers:"+r.benchmark(a)),console.log(e.$headers))},addInstanceMethods:function(e){t.extend(r.instanceMethods,e)},setupParsers:function(e,t){var o,s,a,n,i,l,d,c,g,p,u,f,h,m,b=e.table,y=0,w=r.debug(e,"core"),x={};if(e.$tbodies=e.$table.children("tbody:not(."+e.cssInfoBlock+")"),h=void 0===t?e.$tbodies:t,0===(m=h.length))return w?console.warn("Warning: *Empty table!* Not building a parser cache"):"";for(w&&(f=new Date,console[console.group?"group":"log"]("Detecting parsers for each column")),s={extractors:[],parsers:[]};y<m;){if((o=h[y].rows).length)for(i=0,n=e.columns,l=0;l<n;l++){if((d=e.$headerIndexed[i])&&d.length&&(c=r.getColumnData(b,e.headers,i),u=r.getParserById(r.getData(d,c,"extractor")),p=r.getParserById(r.getData(d,c,"sorter")),g="false"===r.getData(d,c,"parser"),e.empties[i]=(r.getData(d,c,"empty")||e.emptyTo||(e.emptyToBottom?"bottom":"top")).toLowerCase(),e.strings[i]=(r.getData(d,c,"string")||e.stringTo||"max").toLowerCase(),g&&(p=r.getParserById("no-parser")),u||(u=!1),p||(p=r.detectParserForColumn(e,o,-1,i)),w&&(x["("+i+") "+d.text()]={parser:p.id,extractor:u?u.id:"none",string:e.strings[i],empty:e.empties[i]}),s.parsers[i]=p,s.extractors[i]=u,(a=d[0].colSpan-1)>0))for(i+=a,n+=a;a+1>0;)s.parsers[i-a]=p,s.extractors[i-a]=u,a--;i++}y+=s.parsers.length?m:1}w&&(r.isEmptyObject(x)?console.warn(" No parsers detected!"):console[console.table?"table":"log"](x),console.log("Completed detecting parsers"+r.benchmark(f)),console.groupEnd&&console.groupEnd()),e.parsers=s.parsers,e.extractors=s.extractors},addParser:function(e){var t,o=r.parsers.length,s=!0;for(t=0;t<o;t++)r.parsers[t].id.toLowerCase()===e.id.toLowerCase()&&(s=!1);s&&(r.parsers[r.parsers.length]=e)},getParserById:function(e){if("false"==e)return!1;var t,o=r.parsers.length;for(t=0;t<o;t++)if(r.parsers[t].id.toLowerCase()===e.toString().toLowerCase())return r.parsers[t];return!1},detectParserForColumn:function(e,o,s,a){for(var n,i,l,d=r.parsers.length,c=!1,g="",p=r.debug(e,"core"),u=!0;""===g&&u;)(l=o[++s])&&s<50?l.className.indexOf(r.cssIgnoreRow)<0&&(c=o[s].cells[a],g=r.getElementText(e,c,a),i=t(c),p&&console.log("Checking if value was empty on row "+s+", column: "+a+': "'+g+'"')):u=!1;for(;--d>=0;)if((n=r.parsers[d])&&"text"!==n.id&&n.is&&n.is(g,e.table,c,i))return n;return r.getParserById("text")},getElementText:function(e,o,s){if(!o)return"";var a,n=e.textExtraction||"",i=o.jquery?o:t(o);return"string"==typeof n?"basic"===n&&void 0!==(a=i.attr(e.textAttribute))?t.trim(a):t.trim(o.textContent||i.text()):"function"==typeof n?t.trim(n(i[0],e.table,s)):"function"==typeof(a=r.getColumnData(e.table,n,s))?t.trim(a(i[0],e.table,s)):t.trim(i[0].textContent||i.text())},getParsedText:function(e,t,o,s){void 0===s&&(s=r.getElementText(e,t,o));var a=""+s,n=e.parsers[o],i=e.extractors[o];return n&&(i&&"function"==typeof i.format&&(s=i.format(s,e.table,t,o)),a="no-parser"===n.id?"":n.format(""+s,e.table,t,o),e.ignoreCase&&"string"==typeof a&&(a=a.toLowerCase())),a},buildCache:function(e,o,s){var a,n,i,l,d,c,g,p,u,f,h,m,b,y,w,x,v,C,$,I,D,R,T=e.table,L=e.parsers,A=r.debug(e,"core");if(e.$tbodies=e.$table.children("tbody:not(."+e.cssInfoBlock+")"),g=void 0===s?e.$tbodies:s,e.cache={},e.totalRows=0,!L)return A?console.warn("Warning: *Empty table!* Not building a cache"):"";for(A&&(m=new Date),e.showProcessing&&r.isProcessing(T,!0),c=0;c<g.length;c++){for(x=[],a=e.cache[c]={normalized:[]},b=g[c]&&g[c].rows.length||0,l=0;l<b;++l)if(y={child:[],raw:[]},p=t(g[c].rows[l]),u=[],!p.hasClass(e.selectorRemove.slice(1)))if(p.hasClass(e.cssChildRow)&&0!==l)for(D=a.normalized.length-1,(w=a.normalized[D][e.columns]).$row=w.$row.add(p),p.prev().hasClass(e.cssChildRow)||p.prev().addClass(r.css.cssHasChild),f=p.children("th, td"),D=w.child.length,w.child[D]=[],C=0,I=e.columns,d=0;d<I;d++)(h=f[d])&&(w.child[D][d]=r.getParsedText(e,h,d),(v=f[d].colSpan-1)>0&&(C+=v,I+=v)),C++;else{for(y.$row=p,y.order=l,C=0,I=e.columns,d=0;d<I;++d){if((h=p[0].cells[d])&&C<e.columns&&(!($=void 0!==L[C])&&A&&console.warn("No parser found for row: "+l+", column: "+d+'; cell containing: "'+t(h).text()+'"; does it have a header?'),n=r.getElementText(e,h,C),y.raw[C]=n,i=r.getParsedText(e,h,C,n),u[C]=i,$&&"numeric"===(L[C].type||"").toLowerCase()&&(x[C]=Math.max(Math.abs(i)||0,x[C]||0)),(v=h.colSpan-1)>0)){for(R=0;R<=v;)i=e.duplicateSpan||0===R?n:"string"!=typeof e.textExtraction?r.getElementText(e,h,C+R)||"":"",y.raw[C+R]=i,u[C+R]=i,R++;C+=v,I+=v}C++}u[e.columns]=y,a.normalized[a.normalized.length]=u}a.colMax=x,e.totalRows+=a.normalized.length}if(e.showProcessing&&r.isProcessing(T),A){for(D=Math.min(5,e.cache[0].normalized.length),console[console.group?"group":"log"]("Building cache for "+e.totalRows+" rows (showing "+D+" rows in log) and "+e.columns+" columns"+r.benchmark(m)),n={},d=0;d<e.columns;d++)for(C=0;C<D;C++)n["row: "+C]||(n["row: "+C]={}),n["row: "+C][e.$headerIndexed[d].text()]=e.cache[0].normalized[C][d];console[console.table?"table":"log"](n),console.groupEnd&&console.groupEnd()}t.isFunction(o)&&o(T)},getColumnText:function(e,o,s,a){var n,i,l,d,c,g,p,u,f,h,m="function"==typeof s,b="all"===o,y={raw:[],parsed:[],$cell:[]},w=(e=t(e)[0]).config;if(!r.isEmptyObject(w)){for(c=w.$tbodies.length,n=0;n<c;n++)for(g=(l=w.cache[n].normalized).length,i=0;i<g;i++)d=l[i],a&&!d[w.columns].$row.is(a)||(h=!0,u=b?d.slice(0,w.columns):d[o],d=d[w.columns],p=b?d.raw:d.raw[o],f=b?d.$row.children():d.$row.children().eq(o),m&&(h=s({tbodyIndex:n,rowIndex:i,parsed:u,raw:p,$row:d.$row,$cell:f})),!1!==h&&(y.parsed[y.parsed.length]=u,y.raw[y.raw.length]=p,y.$cell[y.$cell.length]=f));return y}r.debug(w,"core")&&console.warn("No cache found - aborting getColumnText function!")},setHeadersCss:function(e){var o,s,a=e.sortList,n=a.length,i=r.css.sortNone+" "+e.cssNone,l=[r.css.sortAsc+" "+e.cssAsc,r.css.sortDesc+" "+e.cssDesc],d=[e.cssIconAsc,e.cssIconDesc,e.cssIconNone],c=["ascending","descending"],g=function(e,t){e.removeClass(i).addClass(l[t]).attr("aria-sort",c[t]).find("."+r.css.icon).removeClass(d[2]).addClass(d[t])},p=e.$table.find("tfoot tr").children("td, th").add(t(e.namespace+"_extra_headers")).removeClass(l.join(" ")),u=e.$headers.add(t("thead "+e.namespace+"_extra_headers")).removeClass(l.join(" ")).addClass(i).attr("aria-sort","none").find("."+r.css.icon).removeClass(d.join(" ")).end();for(u.not(".sorter-false").find("."+r.css.icon).addClass(d[2]),e.cssIconDisabled&&u.filter(".sorter-false").find("."+r.css.icon).addClass(e.cssIconDisabled),o=0;o<n;o++)if(2!==a[o][1]){if(u=e.$headers.filter(function(t){for(var o=!0,s=e.$headers.eq(t),a=parseInt(s.attr("data-column"),10),n=a+r.getClosest(s,"th, td")[0].colSpan;a<n;a++)o=!!o&&(o||r.isValueInArray(a,e.sortList)>-1);return o}),(u=u.not(".sorter-false").filter('[data-column="'+a[o][0]+'"]'+(1===n?":last":""))).length)for(s=0;s<u.length;s++)u[s].sortDisabled||g(u.eq(s),a[o][1]);p.length&&g(p.filter('[data-column="'+a[o][0]+'"]'),a[o][1])}for(n=e.$headers.length,o=0;o<n;o++)r.setColumnAriaLabel(e,e.$headers.eq(o))},getClosest:function(e,r){return t.fn.closest?e.closest(r):e.is(r)?e:e.parents(r).filter(":first")},setColumnAriaLabel:function(e,o,s){if(o.length){var a=parseInt(o.attr("data-column"),10),n=e.sortVars[a],i=o.hasClass(r.css.sortAsc)?"sortAsc":o.hasClass(r.css.sortDesc)?"sortDesc":"sortNone",l=t.trim(o.text())+": "+r.language[i];o.hasClass("sorter-false")||!1===s?l+=r.language.sortDisabled:(i=(n.count+1)%n.order.length,s=n.order[i],l+=r.language[0===s?"nextAsc":1===s?"nextDesc":"nextNone"]),o.attr("aria-label",l)}},updateHeader:function(e){var t,o,s,a,n=e.table,i=e.$headers.length;for(t=0;t<i;t++)s=e.$headers.eq(t),a=r.getColumnData(n,e.headers,t,!0),o="false"===r.getData(s,a,"sorter")||"false"===r.getData(s,a,"parser"),r.setColumnSort(e,s,o)},setColumnSort:function(e,t,r){var o=e.table.id;t[0].sortDisabled=r,t[r?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+r),e.tabIndex&&(r?t.removeAttr("tabindex"):t.attr("tabindex","0")),o&&(r?t.removeAttr("aria-controls"):t.attr("aria-controls",o))},updateHeaderSortCount:function(e,o){var s,a,n,i,l,d,c,g,p=o||e.sortList,u=p.length;for(e.sortList=[],i=0;i<u;i++)if(c=p[i],(s=parseInt(c[0],10))<e.columns){switch(e.sortVars[s].order||(g=r.getOrder(e.sortInitialOrder)?e.sortReset?[1,0,2]:[1,0]:e.sortReset?[0,1,2]:[0,1],e.sortVars[s].order=g,e.sortVars[s].count=0),g=e.sortVars[s].order,a=(""+c[1]).match(/^(1|d|s|o|n)/),a=a?a[0]:""){case"1":case"d":a=1;break;case"s":a=l||0;break;case"o":a=0===(d=g[(l||0)%g.length])?1:1===d?0:2;break;case"n":a=g[++e.sortVars[s].count%g.length];break;default:a=0}l=0===i?a:l,n=[s,parseInt(a,10)||0],e.sortList[e.sortList.length]=n,a=t.inArray(n[1],g),e.sortVars[s].count=a>=0?a:n[1]%g.length}},updateAll:function(e,t,o){var s=e.table;s.isUpdating=!0,r.refreshWidgets(s,!0,!0),r.buildHeaders(e),r.bindEvents(s,e.$headers,!0),r.bindMethods(e),r.commonUpdate(e,t,o)},update:function(e,t,o){e.table.isUpdating=!0,r.updateHeader(e),r.commonUpdate(e,t,o)},updateHeaders:function(e,t){e.table.isUpdating=!0,r.buildHeaders(e),r.bindEvents(e.table,e.$headers,!0),r.resortComplete(e,t)},updateCell:function(e,o,s,a){if(t(o).closest("tr").hasClass(e.cssChildRow))console.warn('Tablesorter Warning! "updateCell" for child row content has been disabled, use "update" instead');else{if(r.isEmptyObject(e.cache))return r.updateHeader(e),void r.commonUpdate(e,s,a);e.table.isUpdating=!0,e.$table.find(e.selectorRemove).remove();var n,i,l,d,c,g,p=e.$tbodies,u=t(o),f=p.index(r.getClosest(u,"tbody")),h=e.cache[f],m=r.getClosest(u,"tr");if(o=u[0],p.length&&f>=0){if(l=p.eq(f).find("tr").not("."+e.cssChildRow).index(m),c=h.normalized[l],(g=m[0].cells.length)!==e.columns)for(d=0,n=!1,i=0;i<g;i++)n||m[0].cells[i]===o?n=!0:d+=m[0].cells[i].colSpan;else d=u.index();n=r.getElementText(e,o,d),c[e.columns].raw[d]=n,n=r.getParsedText(e,o,d,n),c[d]=n,"numeric"===(e.parsers[d].type||"").toLowerCase()&&(h.colMax[d]=Math.max(Math.abs(n)||0,h.colMax[d]||0)),!1!==(n="undefined"!==s?s:e.resort)?r.checkResort(e,n,a):r.resortComplete(e,a)}else r.debug(e,"core")&&console.error("updateCell aborted, tbody missing or not within the indicated table"),e.table.isUpdating=!1}},addRows:function(o,s,a,n){var i,l,d,c,g,p,u,f,h,m,b,y,w,x="string"==typeof s&&1===o.$tbodies.length&&/<tr/.test(s||""),v=o.table;if(x)s=t(s),o.$tbodies.append(s);else if(!(s&&s instanceof e&&r.getClosest(s,"table")[0]===o.table))return r.debug(o,"core")&&console.error("addRows method requires (1) a jQuery selector reference to rows that have already been added to the table, or (2) row HTML string to be added to a table with only one tbody"),!1;if(v.isUpdating=!0,r.isEmptyObject(o.cache))r.updateHeader(o),r.commonUpdate(o,a,n);else{for(g=s.filter("tr").attr("role","row").length,d=o.$tbodies.index(s.parents("tbody").filter(":first")),o.parsers&&o.parsers.length||r.setupParsers(o),c=0;c<g;c++){for(h=0,u=s[c].cells.length,f=o.cache[d].normalized.length,b=[],m={child:[],raw:[],$row:s.eq(c),order:f},p=0;p<u;p++)y=s[c].cells[p],i=r.getElementText(o,y,h),m.raw[h]=i,l=r.getParsedText(o,y,h,i),b[h]=l,"numeric"===(o.parsers[h].type||"").toLowerCase()&&(o.cache[d].colMax[h]=Math.max(Math.abs(l)||0,o.cache[d].colMax[h]||0)),(w=y.colSpan-1)>0&&(h+=w),h++;b[o.columns]=m,o.cache[d].normalized[f]=b}r.checkResort(o,a,n)}},updateCache:function(e,t,o){e.parsers&&e.parsers.length||r.setupParsers(e,o),r.buildCache(e,t,o)},appendCache:function(e,t){var o,s,a,n,i,l,d,c=e.table,g=e.$tbodies,p=[],u=e.cache;if(r.isEmptyObject(u))return e.appender?e.appender(c,p):c.isUpdating?e.$table.triggerHandler("updateComplete",c):"";for(r.debug(e,"core")&&(d=new Date),l=0;l<g.length;l++)if((a=g.eq(l)).length){for(n=r.processTbody(c,a,!0),s=(o=u[l].normalized).length,i=0;i<s;i++)p[p.length]=o[i][e.columns].$row,e.appender&&(!e.pager||e.pager.removeRows||e.pager.ajax)||n.append(o[i][e.columns].$row);r.processTbody(c,n,!1)}e.appender&&e.appender(c,p),r.debug(e,"core")&&console.log("Rebuilt table"+r.benchmark(d)),t||e.appender||r.applyWidget(c),c.isUpdating&&e.$table.triggerHandler("updateComplete",c)},commonUpdate:function(e,t,o){e.$table.find(e.selectorRemove).remove(),r.setupParsers(e),r.buildCache(e),r.checkResort(e,t,o)},initSort:function(e,o,s){if(e.table.isUpdating)return setTimeout(function(){r.initSort(e,o,s)},50);var a,n,i,l,d,c,g,p=!s[e.sortMultiSortKey],u=e.table,f=e.$headers.length,h=r.getClosest(t(o),"th, td"),m=parseInt(h.attr("data-column"),10),b=e.sortVars[m].order;if(h=h[0],e.$table.triggerHandler("sortStart",u),c=(e.sortVars[m].count+1)%b.length,e.sortVars[m].count=s[e.sortResetKey]?2:c,e.sortRestart)for(i=0;i<f;i++)g=e.$headers.eq(i),m!==(c=parseInt(g.attr("data-column"),10))&&(p||g.hasClass(r.css.sortNone))&&(e.sortVars[c].count=-1);if(p){if(e.sortList=[],e.last.sortList=[],null!==e.sortForce)for(a=e.sortForce,n=0;n<a.length;n++)a[n][0]!==m&&(e.sortList[e.sortList.length]=a[n]);if((l=b[e.sortVars[m].count])<2&&(e.sortList[e.sortList.length]=[m,l],h.colSpan>1))for(n=1;n<h.colSpan;n++)e.sortList[e.sortList.length]=[m+n,l],e.sortVars[m+n].count=t.inArray(l,b)}else if(e.sortList=t.extend([],e.last.sortList),r.isValueInArray(m,e.sortList)>=0)for(n=0;n<e.sortList.length;n++)(c=e.sortList[n])[0]===m&&(c[1]=b[e.sortVars[m].count],2===c[1]&&(e.sortList.splice(n,1),e.sortVars[m].count=-1));else if((l=b[e.sortVars[m].count])<2&&(e.sortList[e.sortList.length]=[m,l],h.colSpan>1))for(n=1;n<h.colSpan;n++)e.sortList[e.sortList.length]=[m+n,l],e.sortVars[m+n].count=t.inArray(l,b);if(e.last.sortList=t.extend([],e.sortList),e.sortList.length&&e.sortAppend&&(a=t.isArray(e.sortAppend)?e.sortAppend:e.sortAppend[e.sortList[0][0]],!r.isEmptyObject(a)))for(n=0;n<a.length;n++)if(a[n][0]!==m&&r.isValueInArray(a[n][0],e.sortList)<0){if(l=a[n][1],d=(""+l).match(/^(a|d|s|o|n)/))switch(c=e.sortList[0][1],d[0]){case"d":l=1;break;case"s":l=c;break;case"o":l=0===c?1:0;break;case"n":l=(c+1)%b.length;break;default:l=0}e.sortList[e.sortList.length]=[a[n][0],l]}e.$table.triggerHandler("sortBegin",u),setTimeout(function(){r.setHeadersCss(e),r.multisort(e),r.appendCache(e),e.$table.triggerHandler("sortBeforeEnd",u),e.$table.triggerHandler("sortEnd",u)},1)},multisort:function(e){var t,o,s,a,n=e.table,i=[],l=0,d=e.textSorter||"",c=e.sortList,g=c.length,p=e.$tbodies.length;if(!e.serverSideSorting&&!r.isEmptyObject(e.cache)){if(r.debug(e,"core")&&(o=new Date),"object"==typeof d)for(s=e.columns;s--;)"function"==typeof(a=r.getColumnData(n,d,s))&&(i[s]=a);for(t=0;t<p;t++)s=e.cache[t].colMax,e.cache[t].normalized.sort(function(t,o){var a,p,u,f,h,m,b;for(a=0;a<g;a++){if(u=c[a][0],f=c[a][1],l=0===f,e.sortStable&&t[u]===o[u]&&1===g)return t[e.columns].order-o[e.columns].order;if(p=/n/i.test(r.getSortType(e.parsers,u)),p&&e.strings[u]?(p="boolean"==typeof r.string[e.strings[u]]?(l?1:-1)*(r.string[e.strings[u]]?-1:1):e.strings[u]?r.string[e.strings[u]]||0:0,h=e.numberSorter?e.numberSorter(t[u],o[u],l,s[u],n):r["sortNumeric"+(l?"Asc":"Desc")](t[u],o[u],p,s[u],u,e)):(m=l?t:o,b=l?o:t,h="function"==typeof d?d(m[u],b[u],l,u,n):"function"==typeof i[u]?i[u](m[u],b[u],l,u,n):r["sortNatural"+(l?"Asc":"Desc")](t[u],o[u],u,e)),h)return h}return t[e.columns].order-o[e.columns].order});r.debug(e,"core")&&console.log("Applying sort "+c.toString()+r.benchmark(o))}},resortComplete:function(e,r){e.table.isUpdating&&e.$table.triggerHandler("updateComplete",e.table),t.isFunction(r)&&r(e.table)},checkResort:function(e,o,s){var a=t.isArray(o)?o:e.sortList;!1===(void 0===o?e.resort:o)||e.serverSideSorting||e.table.isProcessing?(r.resortComplete(e,s),r.applyWidget(e.table,!1)):a.length?r.sortOn(e,a,function(){r.resortComplete(e,s)},!0):r.sortReset(e,function(){r.resortComplete(e,s),r.applyWidget(e.table,!1)})},sortOn:function(e,o,s,a){var n=e.table;e.$table.triggerHandler("sortStart",n),r.updateHeaderSortCount(e,o),r.setHeadersCss(e),e.delayInit&&r.isEmptyObject(e.cache)&&r.buildCache(e),e.$table.triggerHandler("sortBegin",n),r.multisort(e),r.appendCache(e,a),e.$table.triggerHandler("sortBeforeEnd",n),e.$table.triggerHandler("sortEnd",n),r.applyWidget(n),t.isFunction(s)&&s(n)},sortReset:function(e,o){e.sortList=[],r.setHeadersCss(e),r.multisort(e),r.appendCache(e);var s;for(s=0;s<e.columns;s++)e.sortVars[s].count=-1;t.isFunction(o)&&o(e.table)},getSortType:function(e,t){return e&&e[t]?e[t].type||"":""},getOrder:function(e){return/^d/i.test(e)||1===e},sortNatural:function(e,t){if(e===t)return 0;e=e.toString(),t=t.toString();var o,s,a,n,i,l,d=r.regex;if(d.hex.test(t)){if(o=parseInt((e||"").match(d.hex),16),s=parseInt((t||"").match(d.hex),16),o<s)return-1;if(o>s)return 1}for(o=(e||"").replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0"),s=(t||"").replace(d.chunk,"\\0$1\\0").replace(d.chunks,"").split("\\0"),l=Math.max(o.length,s.length),i=0;i<l;i++){if(a=isNaN(o[i])?o[i]||0:parseFloat(o[i])||0,n=isNaN(s[i])?s[i]||0:parseFloat(s[i])||0,isNaN(a)!==isNaN(n))return isNaN(a)?1:-1;if(typeof a!=typeof n&&(a+="",n+=""),a<n)return-1;if(a>n)return 1}return 0},sortNaturalAsc:function(e,t,o,s){if(e===t)return 0;var a=r.string[s.empties[o]||s.emptyTo];return""===e&&0!==a?"boolean"==typeof a?a?-1:1:-a||-1:""===t&&0!==a?"boolean"==typeof a?a?1:-1:a||1:r.sortNatural(e,t)},sortNaturalDesc:function(e,t,o,s){if(e===t)return 0;var a=r.string[s.empties[o]||s.emptyTo];return""===e&&0!==a?"boolean"==typeof a?a?-1:1:a||1:""===t&&0!==a?"boolean"==typeof a?a?1:-1:-a||-1:r.sortNatural(t,e)},sortText:function(e,t){return e>t?1:e<t?-1:0},getTextValue:function(e,t,r){if(r){var o,s=e?e.length:0,a=r+t;for(o=0;o<s;o++)a+=e.charCodeAt(o);return t*a}return 0},sortNumericAsc:function(e,t,o,s,a,n){if(e===t)return 0;var i=r.string[n.empties[a]||n.emptyTo];return""===e&&0!==i?"boolean"==typeof i?i?-1:1:-i||-1:""===t&&0!==i?"boolean"==typeof i?i?1:-1:i||1:(isNaN(e)&&(e=r.getTextValue(e,o,s)),isNaN(t)&&(t=r.getTextValue(t,o,s)),e-t)},sortNumericDesc:function(e,t,o,s,a,n){if(e===t)return 0;var i=r.string[n.empties[a]||n.emptyTo];return""===e&&0!==i?"boolean"==typeof i?i?-1:1:i||1:""===t&&0!==i?"boolean"==typeof i?i?1:-1:-i||-1:(isNaN(e)&&(e=r.getTextValue(e,o,s)),isNaN(t)&&(t=r.getTextValue(t,o,s)),t-e)},sortNumeric:function(e,t){return e-t},addWidget:function(e){e.id&&!r.isEmptyObject(r.getWidgetById(e.id))&&console.warn('"'+e.id+'" widget was loaded more than once!'),r.widgets[r.widgets.length]=e},hasWidget:function(e,r){return(e=t(e)).length&&e[0].config&&e[0].config.widgetInit[r]||!1},getWidgetById:function(e){var t,o,s=r.widgets.length;for(t=0;t<s;t++)if((o=r.widgets[t])&&o.id&&o.id.toLowerCase()===e.toLowerCase())return o},applyWidgetOptions:function(e){var o,s,a,n=e.config,i=n.widgets.length;if(i)for(o=0;o<i;o++)(s=r.getWidgetById(n.widgets[o]))&&s.options&&(a=t.extend(!0,{},s.options),n.widgetOptions=t.extend(!0,a,n.widgetOptions),t.extend(!0,r.defaults.widgetOptions,s.options))},addWidgetFromClass:function(e){var t,o,s=e.config,a="^"+s.widgetClass.replace(r.regex.templateName,"(\\S+)+")+"$",n=new RegExp(a,"g"),i=(e.className||"").split(r.regex.spaces);if(i.length)for(t=i.length,o=0;o<t;o++)i[o].match(n)&&(s.widgets[s.widgets.length]=i[o].replace(n,"$1"))},applyWidgetId:function(e,o,s){var a,n,i,l=(e=t(e)[0]).config,d=l.widgetOptions,c=r.debug(l,"core"),g=r.getWidgetById(o);g&&(i=g.id,a=!1,t.inArray(i,l.widgets)<0&&(l.widgets[l.widgets.length]=i),c&&(n=new Date),!s&&l.widgetInit[i]||(l.widgetInit[i]=!0,e.hasInitialized&&r.applyWidgetOptions(e),"function"==typeof g.init&&(a=!0,c&&console[console.group?"group":"log"]("Initializing "+i+" widget"),g.init(e,g,l,d))),s||"function"!=typeof g.format||(a=!0,c&&console[console.group?"group":"log"]("Updating "+i+" widget"),g.format(e,l,d,!1)),c&&a&&(console.log("Completed "+(s?"initializing ":"applying ")+i+" widget"+r.benchmark(n)),console.groupEnd&&console.groupEnd()))},applyWidget:function(e,o,s){var a,n,i,l,d,c=(e=t(e)[0]).config,g=r.debug(c,"core"),p=[];if(!1===o||!e.hasInitialized||!e.isApplyingWidgets&&!e.isUpdating){if(g&&(d=new Date),r.addWidgetFromClass(e),clearTimeout(c.timerReady),c.widgets.length){for(e.isApplyingWidgets=!0,c.widgets=t.grep(c.widgets,function(e,r){return t.inArray(e,c.widgets)===r}),n=(i=c.widgets||[]).length,a=0;a<n;a++)(l=r.getWidgetById(i[a]))&&l.id?(l.priority||(l.priority=10),p[a]=l):g&&console.warn('"'+i[a]+'" was enabled, but the widget code has not been loaded!');for(p.sort(function(e,t){return e.priority<t.priority?-1:e.priority===t.priority?0:1}),n=p.length,g&&console[console.group?"group":"log"]("Start "+(o?"initializing":"applying")+" widgets"),a=0;a<n;a++)(l=p[a])&&l.id&&r.applyWidgetId(e,l.id,o);g&&console.groupEnd&&console.groupEnd()}c.timerReady=setTimeout(function(){e.isApplyingWidgets=!1,t.data(e,"lastWidgetApplication",new Date),c.$table.triggerHandler("tablesorter-ready"),o||"function"!=typeof s||s(e),g&&(l=c.widgets.length,console.log("Completed "+(!0===o?"initializing ":"applying ")+l+" widget"+(1!==l?"s":"")+r.benchmark(d)))},10)}},removeWidget:function(e,o,s){var a,n,i,l,d=(e=t(e)[0]).config;if(!0===o)for(o=[],l=r.widgets.length,i=0;i<l;i++)(n=r.widgets[i])&&n.id&&(o[o.length]=n.id);else o=(t.isArray(o)?o.join(","):o||"").toLowerCase().split(/[\s,]+/);for(l=o.length,a=0;a<l;a++)n=r.getWidgetById(o[a]),(i=t.inArray(o[a],d.widgets))>=0&&!0!==s&&d.widgets.splice(i,1),n&&n.remove&&(r.debug(d,"core")&&console.log((s?"Refreshing":"Removing")+' "'+o[a]+'" widget'),n.remove(e,d,d.widgetOptions,s),d.widgetInit[o[a]]=!1);d.$table.triggerHandler("widgetRemoveEnd",e)},refreshWidgets:function(e,o,s){var a,n,i=(e=t(e)[0]).config.widgets,l=r.widgets,d=l.length,c=[],g=function(e){t(e).triggerHandler("refreshComplete")};for(a=0;a<d;a++)(n=l[a])&&n.id&&(o||t.inArray(n.id,i)<0)&&(c[c.length]=n.id);r.removeWidget(e,c.join(","),!0),!0!==s?(r.applyWidget(e,o||!1,g),o&&r.applyWidget(e,!1,g)):g(e)},benchmark:function(e){return" ("+((new Date).getTime()-e.getTime())+" ms)"},log:function(){console.log(arguments)},debug:function(e,t){return e&&(!0===e.debug||"string"==typeof e.debug&&e.debug.indexOf(t)>-1)},isEmptyObject:function(e){for(var t in e)return!1;return!0},isValueInArray:function(e,t){var r,o=t&&t.length||0;for(r=0;r<o;r++)if(t[r][0]===e)return r;return-1},formatFloat:function(e,o){if("string"!=typeof e||""===e)return e;var s;return e=(o&&o.config?!1!==o.config.usNumberFormat:void 0===o||o)?e.replace(r.regex.comma,""):e.replace(r.regex.digitNonUS,"").replace(r.regex.comma,"."),r.regex.digitNegativeTest.test(e)&&(e=e.replace(r.regex.digitNegativeReplace,"-$1")),s=parseFloat(e),isNaN(s)?t.trim(e):s},isDigit:function(e){return isNaN(e)?r.regex.digitTest.test(e.toString().replace(r.regex.digitReplace,"")):""!==e},computeColumnIndex:function(e,o){var s,a,n,i,l,d,c,g,p,u,f=o&&o.columns||0,h=[],m=new Array(f);for(s=0;s<e.length;s++)for(d=e[s].cells,a=0;a<d.length;a++){for(c=s,g=(l=d[a]).rowSpan||1,p=l.colSpan||1,void 0===h[c]&&(h[c]=[]),n=0;n<h[c].length+1;n++)if(void 0===h[c][n]){u=n;break}for(f&&l.cellIndex===u||(l.setAttribute?l.setAttribute("data-column",u):t(l).attr("data-column",u)),n=c;n<c+g;n++)for(void 0===h[n]&&(h[n]=[]),m=h[n],i=u;i<u+p;i++)m[i]="x"}return r.checkColumnCount(e,h,m.length),m.length},checkColumnCount:function(e,t,r){var o,s,a=!0,n=[];for(o=0;o<t.length;o++)if(t[o]&&(s=t[o].length,t[o].length!==r)){a=!1;break}a||(e.each(function(e,t){var r=t.parentElement.nodeName;n.indexOf(r)<0&&n.push(r)}),console.error("Invalid or incorrect number of columns in the "+n.join(" or ")+"; expected "+r+", but found "+s+" columns"))},fixColumnWidth:function(e){var o,s,a,n,i,l=(e=t(e)[0]).config,d=l.$table.children("colgroup");if(d.length&&d.hasClass(r.css.colgroup)&&d.remove(),l.widthFixed&&0===l.$table.children("colgroup").length){for(d=t('<colgroup class="'+r.css.colgroup+'">'),o=l.$table.width(),n=(a=l.$tbodies.find("tr:first").children(":visible")).length,i=0;i<n;i++)s=parseInt(a.eq(i).width()/o*1e3,10)/10+"%",d.append(t("<col>").css("width",s));l.$table.prepend(d)}},getData:function(e,r,o){var s,a,n="",i=t(e);return i.length?(s=!!t.metadata&&i.metadata(),a=" "+(i.attr("class")||""),void 0!==i.data(o)||void 0!==i.data(o.toLowerCase())?n+=i.data(o)||i.data(o.toLowerCase()):s&&void 0!==s[o]?n+=s[o]:r&&void 0!==r[o]?n+=r[o]:" "!==a&&a.match(" "+o+"-")&&(n=a.match(new RegExp("\\s"+o+"-([\\w-]+)"))[1]||""),t.trim(n)):""},getColumnData:function(e,r,o,s,a){if("object"!=typeof r||null===r)return r;var n,i=(e=t(e)[0]).config,l=a||i.$headers,d=i.$headerIndexed&&i.$headerIndexed[o]||l.find('[data-column="'+o+'"]:last');if(void 0!==r[o])return s?r[o]:r[l.index(d)];for(n in r)if("string"==typeof n&&d.filter(n).add(d.find(n)).length)return r[n]},isProcessing:function(e,o,s){var a=(e=t(e))[0].config,n=s||e.find("."+r.css.header);o?(void 0!==s&&a.sortList.length>0&&(n=n.filter(function(){return!this.sortDisabled&&r.isValueInArray(parseFloat(t(this).attr("data-column")),a.sortList)>=0})),e.add(n).addClass(r.css.processing+" "+a.cssProcessing)):e.add(n).removeClass(r.css.processing+" "+a.cssProcessing)},processTbody:function(e,r,o){if(e=t(e)[0],o)return e.isProcessing=!0,r.before('<colgroup class="tablesorter-savemyplace"/>'),t.fn.detach?r.detach():r.remove();var s=t(e).find("colgroup.tablesorter-savemyplace");r.insertAfter(s),s.remove(),e.isProcessing=!1},clearTableBody:function(e){t(e)[0].config.$tbodies.children().detach()},characterEquivalents:{a:"áàâãäąå",A:"ÁÀÂÃÄĄÅ",c:"çćč",C:"ÇĆČ",e:"éèêëěę",E:"ÉÈÊËĚĘ",i:"íìİîïı",I:"ÍÌİÎÏ",o:"óòôõöō",O:"ÓÒÔÕÖŌ",ss:"ß",SS:"ẞ",u:"úùûüů",U:"ÚÙÛÜŮ"},replaceAccents:function(e){var t,o="[",s=r.characterEquivalents;if(!r.characterRegex){r.characterRegexArray={};for(t in s)"string"==typeof t&&(o+=s[t],r.characterRegexArray[t]=new RegExp("["+s[t]+"]","g"));r.characterRegex=new RegExp(o+"]")}if(r.characterRegex.test(e))for(t in s)"string"==typeof t&&(e=e.replace(r.characterRegexArray[t],t));return e},validateOptions:function(e){var o,s,a,n,i="headers sortForce sortList sortAppend widgets".split(" "),l=e.originalSettings;if(l){r.debug(e,"core")&&(n=new Date);for(o in l)if("undefined"===(a=typeof r.defaults[o]))console.warn('Tablesorter Warning! "table.config.'+o+'" option not recognized');else if("object"===a)for(s in l[o])a=r.defaults[o]&&typeof r.defaults[o][s],t.inArray(o,i)<0&&"undefined"===a&&console.warn('Tablesorter Warning! "table.config.'+o+"."+s+'" option not recognized');r.debug(e,"core")&&console.log("validate options time:"+r.benchmark(n))}},restoreHeaders:function(e){var o,s,a=t(e)[0].config,n=a.$table.find(a.selectorHeaders),i=n.length;for(o=0;o<i;o++)(s=n.eq(o)).find("."+r.css.headerIn).length&&s.html(a.headerContent[o])},destroy:function(e,o,s){if((e=t(e)[0]).hasInitialized){r.removeWidget(e,!0,!1);var a,n=t(e),i=e.config,l=n.find("thead:first"),d=l.find("tr."+r.css.headerRow).removeClass(r.css.headerRow+" "+i.cssHeaderRow),c=n.find("tfoot:first > tr").children("th, td");!1===o&&t.inArray("uitheme",i.widgets)>=0&&(n.triggerHandler("applyWidgetId",["uitheme"]),n.triggerHandler("applyWidgetId",["zebra"])),l.find("tr").not(d).remove(),a="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets removeWidget destroy mouseup mouseleave "+"keypress sortBegin sortEnd resetToLoadState ".split(" ").join(i.namespace+" "),n.removeData("tablesorter").unbind(a.replace(r.regex.spaces," ")),i.$headers.add(c).removeClass([r.css.header,i.cssHeader,i.cssAsc,i.cssDesc,r.css.sortAsc,r.css.sortDesc,r.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),d.find(i.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(i.namespace+" ").replace(r.regex.spaces," ")),r.restoreHeaders(e),n.toggleClass(r.css.table+" "+i.tableClass+" tablesorter-"+i.theme,!1===o),n.removeClass(i.namespace.slice(1)),e.hasInitialized=!1,delete e.config.cache,"function"==typeof s&&s(e),r.debug(i,"core")&&console.log("tablesorter has been removed")}}};t.fn.tablesorter=function(e){return this.each(function(){var o=this,s=t.extend(!0,{},r.defaults,e,r.instanceMethods);s.originalSettings=e,!o.hasInitialized&&r.buildTable&&"TABLE"!==this.nodeName?r.buildTable(o,s):r.setup(o,s)})},window.console&&window.console.log||(r.logs=[],console={},console.log=console.warn=console.error=console.table=function(){var e=arguments.length>1?arguments:arguments[0];r.logs[r.logs.length]={date:Date.now(),log:e}}),r.addParser({id:"no-parser",is:function(){return!1},format:function(){return""},type:"text"}),r.addParser({id:"text",is:function(){return!0},format:function(e,o){var s=o.config;return e&&(e=t.trim(s.ignoreCase?e.toLocaleLowerCase():e),e=s.sortLocaleCompare?r.replaceAccents(e):e),e},type:"text"}),r.regex.nondigit=/[^\w,. \-()]/g,r.addParser({id:"digit",is:function(e){return r.isDigit(e)},format:function(e,o){var s=r.formatFloat((e||"").replace(r.regex.nondigit,""),o);return e&&"number"==typeof s?s:e?t.trim(e&&o.config.ignoreCase?e.toLocaleLowerCase():e):e},type:"numeric"}),r.regex.currencyReplace=/[+\-,. ]/g,r.regex.currencyTest=/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/,r.addParser({id:"currency",is:function(e){return e=(e||"").replace(r.regex.currencyReplace,""),r.regex.currencyTest.test(e)},format:function(e,o){var s=r.formatFloat((e||"").replace(r.regex.nondigit,""),o);return e&&"number"==typeof s?s:e?t.trim(e&&o.config.ignoreCase?e.toLocaleLowerCase():e):e},type:"numeric"}),r.regex.urlProtocolTest=/^(https?|ftp|file):\/\//,r.regex.urlProtocolReplace=/(https?|ftp|file):\/\/(www\.)?/,r.addParser({id:"url",is:function(e){return r.regex.urlProtocolTest.test(e)},format:function(e){return e?t.trim(e.replace(r.regex.urlProtocolReplace,"")):e},type:"text"}),r.regex.dash=/-/g,r.regex.isoDate=/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,r.addParser({id:"isoDate",is:function(e){return r.regex.isoDate.test(e)},format:function(e){var t=e?new Date(e.replace(r.regex.dash,"/")):e;return t instanceof Date&&isFinite(t)?t.getTime():e},type:"numeric"}),r.regex.percent=/%/g,r.regex.percentTest=/(\d\s*?%|%\s*?\d)/,r.addParser({id:"percent",is:function(e){return r.regex.percentTest.test(e)&&e.length<15},format:function(e,t){return e?r.formatFloat(e.replace(r.regex.percent,""),t):e},type:"numeric"}),r.addParser({id:"image",is:function(e,t,r,o){return o.find("img").length>0},format:function(e,r,o){return t(o).find("img").attr(r.config.imgAttr||"alt")||e},parsed:!0,type:"text"}),r.regex.dateReplace=/(\S)([AP]M)$/i,r.regex.usLongDateTest1=/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i,r.regex.usLongDateTest2=/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i,r.addParser({id:"usLongDate",is:function(e){return r.regex.usLongDateTest1.test(e)||r.regex.usLongDateTest2.test(e)},format:function(e){var t=e?new Date(e.replace(r.regex.dateReplace,"$1 $2")):e;return t instanceof Date&&isFinite(t)?t.getTime():e},type:"numeric"}),r.regex.shortDateTest=/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/,r.regex.shortDateReplace=/[\-.,]/g,r.regex.shortDateXXY=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,r.regex.shortDateYMD=/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,r.convertFormat=function(e,t){e=(e||"").replace(r.regex.spaces," ").replace(r.regex.shortDateReplace,"/"),"mmddyyyy"===t?e=e.replace(r.regex.shortDateXXY,"$3/$1/$2"):"ddmmyyyy"===t?e=e.replace(r.regex.shortDateXXY,"$3/$2/$1"):"yyyymmdd"===t&&(e=e.replace(r.regex.shortDateYMD,"$1/$2/$3"));var o=new Date(e);return o instanceof Date&&isFinite(o)?o.getTime():""},r.addParser({id:"shortDate",is:function(e){return e=(e||"").replace(r.regex.spaces," ").replace(r.regex.shortDateReplace,"/"),r.regex.shortDateTest.test(e)},format:function(e,t,o,s){if(e){var a=t.config,n=a.$headerIndexed[s],i=n.length&&n.data("dateFormat")||r.getData(n,r.getColumnData(t,a.headers,s),"dateFormat")||a.dateFormat;return n.length&&n.data("dateFormat",i),r.convertFormat(e,i)||e}return e},type:"numeric"}),r.regex.timeTest=/^(0?[1-9]|1[0-2]):([0-5]\d)(\s[AP]M)$|^((?:[01]\d|[2][0-4]):[0-5]\d)$/i,r.regex.timeMatch=/(0?[1-9]|1[0-2]):([0-5]\d)(\s[AP]M)|((?:[01]\d|[2][0-4]):[0-5]\d)/i,r.addParser({id:"time",is:function(e){return r.regex.timeTest.test(e)},format:function(e){var t,o=(e||"").match(r.regex.timeMatch),s=new Date(e),a=e&&(null!==o?o[0]:"00:00 AM"),n=a?new Date("2000/01/01 "+a.replace(r.regex.dateReplace,"$1 $2")):a;return n instanceof Date&&isFinite(n)?(t=s instanceof Date&&isFinite(s)?s.getTime():0,t?parseFloat(n.getTime()+"."+s.getTime()):n.getTime()):e},type:"numeric"}),r.addParser({id:"metadata",is:function(){return!1},format:function(e,r,o){var s=r.config,a=s.parserMetadataName?s.parserMetadataName:"sortValue";return t(o).metadata()[a]},type:"numeric"}),r.addWidget({id:"zebra",priority:90,format:function(e,r,o){var s,a,n,i,l,d,c,g=new RegExp(r.cssChildRow,"i"),p=r.$tbodies.add(t(r.namespace+"_extra_table").children("tbody:not(."+r.cssInfoBlock+")"));for(l=0;l<p.length;l++)for(n=0,c=(s=p.eq(l).children("tr:visible").not(r.selectorRemove)).length,d=0;d<c;d++)a=s.eq(d),g.test(a[0].className)||n++,i=n%2==0,a.removeClass(o.zebra[i?1:0]).addClass(o.zebra[i?0:1])},remove:function(e,t,o,s){if(!s){var a,n,i=t.$tbodies,l=(o.zebra||["even","odd"]).join(" ");for(a=0;a<i.length;a++)(n=r.processTbody(e,i.eq(a),!0)).children().removeClass(l),r.processTbody(e,n,!1)}}})}(e),e.tablesorter});
js/tablesorter/jquery.tablesorter.widgets.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! tablesorter (FORK) - updated 2018-02-25 (v2.29.6)*/
2
  /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
3
  (function(factory) {
4
  if (typeof define === 'function' && define.amd) {
@@ -10,7 +10,7 @@
10
  }
11
  }(function(jQuery) {
12
 
13
- /*! Widget: storage - updated 4/18/2017 (v2.28.8) */
14
  /*global JSON:false */
15
  ;(function ($, window, document) {
16
  'use strict';
@@ -56,6 +56,7 @@
56
  values = {},
57
  c = table.config,
58
  wo = c && c.widgetOptions,
 
59
  storageType = (
60
  ( options && options.storageType ) || ( wo && wo.storage_storageType )
61
  ).toString().charAt(0).toLowerCase(),
@@ -84,14 +85,12 @@
84
  hasStorage = true;
85
  window[storageType].removeItem('_tmptest');
86
  } catch (error) {
87
- if (c && c.debug) {
88
- console.warn( storageType + ' is not supported in this browser' );
89
- }
90
  }
91
  }
92
  }
93
- if (c.debug) {
94
- console.log('Storage widget using', hasStorage ? storageType : 'cookies');
95
  }
96
  // *** get value ***
97
  if ($.parseJSON) {
@@ -127,7 +126,7 @@
127
 
128
  })(jQuery, window, document);
129
 
130
- /*! Widget: uitheme - updated 9/27/2017 (v2.29.0) */
131
  ;(function ($) {
132
  'use strict';
133
  var ts = $.tablesorter || {};
@@ -192,8 +191,9 @@
192
  theme = c.theme || 'jui',
193
  themes = themesAll[theme] || {},
194
  remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
195
- iconRmv = $.trim( [ themes.iconSortNone, themes.iconSortDesc, themes.iconSortAsc ].join( ' ' ) );
196
- if (c.debug) { time = new Date(); }
 
197
  // initialization code - run once
198
  if (!$table.hasClass('tablesorter-' + theme) || c.theme !== c.appliedTheme || !wo.uitheme_applied) {
199
  wo.uitheme_applied = true;
@@ -238,7 +238,7 @@
238
  $(this)[ event.type === 'mouseenter' ? 'addClass' : 'removeClass' ](themes.hover || '');
239
  });
240
 
241
- $headers.each(function(){
242
  var $this = $(this);
243
  if (!$this.find('.' + ts.css.wrapper).length) {
244
  // Firefox needs this inner div to position the icon & resizer correctly
@@ -296,8 +296,8 @@
296
  }
297
  }
298
  }
299
- if (c.debug) {
300
- console.log('Applying ' + theme + ' theme' + ts.benchmark(time));
301
  }
302
  },
303
  remove: function(table, c, wo, refreshing) {
@@ -402,7 +402,7 @@
402
 
403
  })(jQuery);
404
 
405
- /*! Widget: filter - updated 2018-01-30 (v2.29.5) *//*
406
  * Requires tablesorter v2.8+ and jQuery 1.7+
407
  * by Rob Garrison
408
  */
@@ -684,6 +684,7 @@
684
  if ( tsfRegex.exact.test( data.iFilter ) ) {
685
  var txt = data.iFilter.replace( tsfRegex.exact, '' ),
686
  filter = tsf.parseFilter( c, txt, data ) || '';
 
687
  return data.anyMatch ? $.inArray( filter, data.rowArray ) >= 0 : filter == data.iExact;
688
  }
689
  return null;
@@ -857,7 +858,7 @@
857
  c.lastCombinedFilter = null;
858
  c.lastSearch = [];
859
  // update filterFormatters after update (& small delay) - Fixes #1237
860
- setTimeout(function(){
861
  c.$table.triggerHandler( 'filterFomatterUpdate' );
862
  }, 100);
863
  }
@@ -951,7 +952,7 @@
951
 
952
  // show processing icon
953
  if ( c.showProcessing ) {
954
- txt = 'filterStart filterEnd '.split( ' ' ).join( c.namespace + 'filter ' );
955
  c.$table
956
  .unbind( txt.replace( ts.regex.spaces, ' ' ) )
957
  .bind( txt, function( event, columns ) {
@@ -1030,6 +1031,9 @@
1030
  c.lastSearch = c.$table.data( 'lastSearch' );
1031
  c.$table.triggerHandler( 'filterInit', c );
1032
  tsf.findRows( c.table, c.lastSearch || [] );
 
 
 
1033
  };
1034
  if ( $.isEmptyObject( wo.filter_formatter ) ) {
1035
  completed();
@@ -1730,6 +1734,7 @@
1730
  storedFilters = $.extend( [], filters ),
1731
  c = table.config,
1732
  wo = c.widgetOptions,
 
1733
  // data object passed to filters; anyMatch is a flag for the filters
1734
  data = {
1735
  anyMatch: false,
@@ -1746,7 +1751,6 @@
1746
  defaultColFilter : [],
1747
  defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
1748
  };
1749
-
1750
  // parse columns after formatter, in case the class is added at that point
1751
  data.parsed = [];
1752
  for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
@@ -1768,8 +1772,8 @@
1768
  ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split( /\s+/ );
1769
  }
1770
 
1771
- if ( c.debug ) {
1772
- console.log( 'Filter: Starting filter widget search', filters );
1773
  time = new Date();
1774
  }
1775
  // filtered rows count
@@ -1867,8 +1871,8 @@
1867
  notFiltered = $rows.not( '.' + wo.filter_filteredRow ).length;
1868
  // can't search when all rows are hidden - this happens when looking for exact matches
1869
  if ( searchFiltered && notFiltered === 0 ) { searchFiltered = false; }
1870
- if ( c.debug ) {
1871
- console.log( 'Filter: Searching through ' +
1872
  ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
1873
  }
1874
  if ( data.anyMatchFlag ) {
@@ -1971,8 +1975,8 @@
1971
  if ( wo.filter_saveFilters && ts.storage ) {
1972
  ts.storage( table, 'tablesorter-filters', tsf.processFilters( storedFilters, true ) );
1973
  }
1974
- if ( c.debug ) {
1975
- console.log( 'Completed filter widget search' + ts.benchmark(time) );
1976
  }
1977
  if ( wo.filter_initialized ) {
1978
  c.$table.triggerHandler( 'filterBeforeEnd', c );
@@ -2187,13 +2191,13 @@
2187
  options += '<option';
2188
  for ( val in option ) {
2189
  if ( option.hasOwnProperty( val ) && val !== 'text' ) {
2190
- options += ' ' + val + '="' + option[ val ] + '"';
2191
  }
2192
  }
2193
  if ( !option.value ) {
2194
- options += ' value="' + option.text + '"';
2195
  }
2196
- options += '>' + option.text + '</option>';
2197
  // above code is needed in jQuery < v1.8
2198
 
2199
  // make sure we don't turn an object into a string (objects without a "text" property)
@@ -2477,7 +2481,7 @@
2477
  $stickyThead = $stickyTable.children('thead:first'),
2478
  $stickyCells,
2479
  laststate = '',
2480
- setWidth = function($orig, $clone){
2481
  var index, width, border, $cell, $this,
2482
  $cells = $orig.filter(':visible'),
2483
  len = $cells.length;
@@ -2618,7 +2622,7 @@
2618
  });
2619
  c.$table
2620
  .unbind('stickyHeadersUpdate' + namespace)
2621
- .bind('stickyHeadersUpdate' + namespace, function(){
2622
  scrollSticky( true );
2623
  });
2624
 
@@ -2694,7 +2698,7 @@
2694
  });
2695
 
2696
  // Add extra scroller css
2697
- $(function(){
2698
  var s = '<style>' +
2699
  'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
2700
  '-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
@@ -2839,7 +2843,7 @@
2839
 
2840
  if ( ts.hasWidget( c.table, 'scroller' ) ) {
2841
  tableHeight = 0;
2842
- c.$table.closest( '.' + ts.css.scrollerWrap ).children().each(function(){
2843
  var $this = $(this);
2844
  // center table has a max-height set
2845
  tableHeight += $this.filter('[style*="height"]').length ? $this.height() : $this.children('table').height();
@@ -3061,7 +3065,7 @@
3061
  });
3062
 
3063
  ts.resizableReset = function( table, refreshing ) {
3064
- $( table ).each(function(){
3065
  var index, $t,
3066
  c = this.config,
3067
  wo = c && c.widgetOptions,
@@ -3095,7 +3099,7 @@
3095
 
3096
  })( jQuery, window );
3097
 
3098
- /*! Widget: saveSort - updated 10/31/2015 (v2.24.0) *//*
3099
  * Requires tablesorter v2.16+
3100
  * by Rob Garrison
3101
  */
@@ -3103,6 +3107,15 @@
3103
  'use strict';
3104
  var ts = $.tablesorter || {};
3105
 
 
 
 
 
 
 
 
 
 
3106
  // this widget saves the last sort only if the
3107
  // saveSort widget option is true AND the
3108
  // $.tablesorter.storage function is included
@@ -3118,18 +3131,19 @@
3118
  thisWidget.format(table, c, wo, true);
3119
  },
3120
  format: function(table, c, wo, init) {
3121
- var stored, time,
3122
  $table = c.$table,
3123
  saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
3124
- sortList = { 'sortList' : c.sortList };
3125
- if (c.debug) {
 
3126
  time = new Date();
3127
  }
3128
  if ($table.hasClass('hasSaveSort')) {
3129
- if (saveSort && table.hasInitialized && ts.storage) {
3130
  ts.storage( table, 'tablesorter-savesort', sortList );
3131
- if (c.debug) {
3132
- console.log('saveSort widget: Saving last sort: ' + c.sortList + ts.benchmark(time));
3133
  }
3134
  }
3135
  } else {
@@ -3138,10 +3152,9 @@
3138
  sortList = '';
3139
  // get data
3140
  if (ts.storage) {
3141
- stored = ts.storage( table, 'tablesorter-savesort' );
3142
- sortList = (stored && stored.hasOwnProperty('sortList') && $.isArray(stored.sortList)) ? stored.sortList : '';
3143
- if (c.debug) {
3144
- console.log('saveSort: Last sort loaded: "' + sortList + '"' + ts.benchmark(time));
3145
  }
3146
  $table.bind('saveSortReset', function(event) {
3147
  event.stopPropagation();
@@ -3154,7 +3167,9 @@
3154
  c.sortList = sortList;
3155
  } else if (table.hasInitialized && sortList && sortList.length > 0) {
3156
  // update sort change
3157
- ts.sortOn( c, sortList );
 
 
3158
  }
3159
  }
3160
  },
1
+ /*! tablesorter (FORK) - updated 2018-03-19 (v2.30.1)*/
2
  /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
3
  (function(factory) {
4
  if (typeof define === 'function' && define.amd) {
10
  }
11
  }(function(jQuery) {
12
 
13
+ /*! Widget: storage - updated 2018-03-18 (v2.30.0) */
14
  /*global JSON:false */
15
  ;(function ($, window, document) {
16
  'use strict';
56
  values = {},
57
  c = table.config,
58
  wo = c && c.widgetOptions,
59
+ debug = ts.debug(c, 'storage'),
60
  storageType = (
61
  ( options && options.storageType ) || ( wo && wo.storage_storageType )
62
  ).toString().charAt(0).toLowerCase(),
85
  hasStorage = true;
86
  window[storageType].removeItem('_tmptest');
87
  } catch (error) {
88
+ console.warn( storageType + ' is not supported in this browser' );
 
 
89
  }
90
  }
91
  }
92
+ if (debug) {
93
+ console.log('Storage >> Using', hasStorage ? storageType : 'cookies');
94
  }
95
  // *** get value ***
96
  if ($.parseJSON) {
126
 
127
  })(jQuery, window, document);
128
 
129
+ /*! Widget: uitheme - updated 2018-03-18 (v2.30.0) */
130
  ;(function ($) {
131
  'use strict';
132
  var ts = $.tablesorter || {};
191
  theme = c.theme || 'jui',
192
  themes = themesAll[theme] || {},
193
  remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
194
+ iconRmv = $.trim( [ themes.iconSortNone, themes.iconSortDesc, themes.iconSortAsc ].join( ' ' ) ),
195
+ debug = ts.debug(c, 'uitheme');
196
+ if (debug) { time = new Date(); }
197
  // initialization code - run once
198
  if (!$table.hasClass('tablesorter-' + theme) || c.theme !== c.appliedTheme || !wo.uitheme_applied) {
199
  wo.uitheme_applied = true;
238
  $(this)[ event.type === 'mouseenter' ? 'addClass' : 'removeClass' ](themes.hover || '');
239
  });
240
 
241
+ $headers.each(function() {
242
  var $this = $(this);
243
  if (!$this.find('.' + ts.css.wrapper).length) {
244
  // Firefox needs this inner div to position the icon & resizer correctly
296
  }
297
  }
298
  }
299
+ if (debug) {
300
+ console.log('uitheme >> Applied ' + theme + ' theme' + ts.benchmark(time));
301
  }
302
  },
303
  remove: function(table, c, wo, refreshing) {
402
 
403
  })(jQuery);
404
 
405
+ /*! Widget: filter - updated 2018-03-18 (v2.30.0) *//*
406
  * Requires tablesorter v2.8+ and jQuery 1.7+
407
  * by Rob Garrison
408
  */
684
  if ( tsfRegex.exact.test( data.iFilter ) ) {
685
  var txt = data.iFilter.replace( tsfRegex.exact, '' ),
686
  filter = tsf.parseFilter( c, txt, data ) || '';
687
+ // eslint-disable-next-line eqeqeq
688
  return data.anyMatch ? $.inArray( filter, data.rowArray ) >= 0 : filter == data.iExact;
689
  }
690
  return null;
858
  c.lastCombinedFilter = null;
859
  c.lastSearch = [];
860
  // update filterFormatters after update (& small delay) - Fixes #1237
861
+ setTimeout(function() {
862
  c.$table.triggerHandler( 'filterFomatterUpdate' );
863
  }, 100);
864
  }
952
 
953
  // show processing icon
954
  if ( c.showProcessing ) {
955
+ txt = 'filterStart filterEnd '.split( ' ' ).join( c.namespace + 'filter-sp ' );
956
  c.$table
957
  .unbind( txt.replace( ts.regex.spaces, ' ' ) )
958
  .bind( txt, function( event, columns ) {
1031
  c.lastSearch = c.$table.data( 'lastSearch' );
1032
  c.$table.triggerHandler( 'filterInit', c );
1033
  tsf.findRows( c.table, c.lastSearch || [] );
1034
+ if (ts.debug(c, 'filter')) {
1035
+ console.log('Filter >> Widget initialized');
1036
+ }
1037
  };
1038
  if ( $.isEmptyObject( wo.filter_formatter ) ) {
1039
  completed();
1734
  storedFilters = $.extend( [], filters ),
1735
  c = table.config,
1736
  wo = c.widgetOptions,
1737
+ debug = ts.debug(c, 'filter'),
1738
  // data object passed to filters; anyMatch is a flag for the filters
1739
  data = {
1740
  anyMatch: false,
1751
  defaultColFilter : [],
1752
  defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
1753
  };
 
1754
  // parse columns after formatter, in case the class is added at that point
1755
  data.parsed = [];
1756
  for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
1772
  ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split( /\s+/ );
1773
  }
1774
 
1775
+ if ( debug ) {
1776
+ console.log( 'Filter >> Starting filter widget search', filters );
1777
  time = new Date();
1778
  }
1779
  // filtered rows count
1871
  notFiltered = $rows.not( '.' + wo.filter_filteredRow ).length;
1872
  // can't search when all rows are hidden - this happens when looking for exact matches
1873
  if ( searchFiltered && notFiltered === 0 ) { searchFiltered = false; }
1874
+ if ( debug ) {
1875
+ console.log( 'Filter >> Searching through ' +
1876
  ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
1877
  }
1878
  if ( data.anyMatchFlag ) {
1975
  if ( wo.filter_saveFilters && ts.storage ) {
1976
  ts.storage( table, 'tablesorter-filters', tsf.processFilters( storedFilters, true ) );
1977
  }
1978
+ if ( debug ) {
1979
+ console.log( 'Filter >> Completed search' + ts.benchmark(time) );
1980
  }
1981
  if ( wo.filter_initialized ) {
1982
  c.$table.triggerHandler( 'filterBeforeEnd', c );
2191
  options += '<option';
2192
  for ( val in option ) {
2193
  if ( option.hasOwnProperty( val ) && val !== 'text' ) {
2194
+ options += ' ' + val + '="' + option[ val ].replace( tsfRegex.quote, '&quot;' ) + '"';
2195
  }
2196
  }
2197
  if ( !option.value ) {
2198
+ options += ' value="' + option.text.replace( tsfRegex.quote, '&quot;' ) + '"';
2199
  }
2200
+ options += '>' + option.text.replace( tsfRegex.quote, '&quot;' ) + '</option>';
2201
  // above code is needed in jQuery < v1.8
2202
 
2203
  // make sure we don't turn an object into a string (objects without a "text" property)
2481
  $stickyThead = $stickyTable.children('thead:first'),
2482
  $stickyCells,
2483
  laststate = '',
2484
+ setWidth = function($orig, $clone) {
2485
  var index, width, border, $cell, $this,
2486
  $cells = $orig.filter(':visible'),
2487
  len = $cells.length;
2622
  });
2623
  c.$table
2624
  .unbind('stickyHeadersUpdate' + namespace)
2625
+ .bind('stickyHeadersUpdate' + namespace, function() {
2626
  scrollSticky( true );
2627
  });
2628
 
2698
  });
2699
 
2700
  // Add extra scroller css
2701
+ $(function() {
2702
  var s = '<style>' +
2703
  'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
2704
  '-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
2843
 
2844
  if ( ts.hasWidget( c.table, 'scroller' ) ) {
2845
  tableHeight = 0;
2846
+ c.$table.closest( '.' + ts.css.scrollerWrap ).children().each(function() {
2847
  var $this = $(this);
2848
  // center table has a max-height set
2849
  tableHeight += $this.filter('[style*="height"]').length ? $this.height() : $this.children('table').height();
3065
  });
3066
 
3067
  ts.resizableReset = function( table, refreshing ) {
3068
+ $( table ).each(function() {
3069
  var index, $t,
3070
  c = this.config,
3071
  wo = c && c.widgetOptions,
3099
 
3100
  })( jQuery, window );
3101
 
3102
+ /*! Widget: saveSort - updated 2018-03-19 (v2.30.1) *//*
3103
  * Requires tablesorter v2.16+
3104
  * by Rob Garrison
3105
  */
3107
  'use strict';
3108
  var ts = $.tablesorter || {};
3109
 
3110
+ function getStoredSortList(c) {
3111
+ var stored = ts.storage( c.table, 'tablesorter-savesort' );
3112
+ return (stored && stored.hasOwnProperty('sortList') && $.isArray(stored.sortList)) ? stored.sortList : [];
3113
+ }
3114
+
3115
+ function sortListChanged(c, sortList) {
3116
+ return (sortList || getStoredSortList(c)).join(',') !== c.sortList.join(',');
3117
+ }
3118
+
3119
  // this widget saves the last sort only if the
3120
  // saveSort widget option is true AND the
3121
  // $.tablesorter.storage function is included
3131
  thisWidget.format(table, c, wo, true);
3132
  },
3133
  format: function(table, c, wo, init) {
3134
+ var time,
3135
  $table = c.$table,
3136
  saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
3137
+ sortList = { 'sortList' : c.sortList },
3138
+ debug = ts.debug(c, 'saveSort');
3139
+ if (debug) {
3140
  time = new Date();
3141
  }
3142
  if ($table.hasClass('hasSaveSort')) {
3143
+ if (saveSort && table.hasInitialized && ts.storage && sortListChanged(c)) {
3144
  ts.storage( table, 'tablesorter-savesort', sortList );
3145
+ if (debug) {
3146
+ console.log('saveSort >> Saving last sort: ' + c.sortList + ts.benchmark(time));
3147
  }
3148
  }
3149
  } else {
3152
  sortList = '';
3153
  // get data
3154
  if (ts.storage) {
3155
+ sortList = getStoredSortList(c);
3156
+ if (debug) {
3157
+ console.log('saveSort >> Last sort loaded: "' + sortList + '"' + ts.benchmark(time));
 
3158
  }
3159
  $table.bind('saveSortReset', function(event) {
3160
  event.stopPropagation();
3167
  c.sortList = sortList;
3168
  } else if (table.hasInitialized && sortList && sortList.length > 0) {
3169
  // update sort change
3170
+ if (sortListChanged(c, sortList)) {
3171
+ ts.sortOn(c, sortList);
3172
+ }
3173
  }
3174
  }
3175
  },
js/tablesorter/jquery.tablesorter.widgets.min.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! tablesorter (FORK) - updated 2018-02-25 (v2.29.6)*/
2
- !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(e,t,r){"use strict";var i=e.tablesorter||{};e.extend(!0,i.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_storageType:"",storage_tableId:"",storage_useSessionStorage:""}}),i.storage=function(i,a,l,s){var n,o,c,d=!1,f={},h=(i=e(i)[0]).config,u=h&&h.widgetOptions,p=(s&&s.storageType||u&&u.storage_storageType).toString().charAt(0).toLowerCase(),g=p?"":s&&s.useSessionStorage||u&&u.storage_useSessionStorage,m=e(i),b=s&&s.id||m.attr(s&&s.group||u&&u.storage_group||"data-table-group")||u&&u.storage_tableId||i.id||e(".tablesorter").index(m),y=s&&s.url||m.attr(s&&s.page||u&&u.storage_page||"data-table-page")||u&&u.storage_fixedUrl||h&&h.fixedUrl||t.location.pathname;if("c"!==p&&(p="s"===p||g?"sessionStorage":"localStorage")in t)try{t[p].setItem("_tmptest","temp"),d=!0,t[p].removeItem("_tmptest")}catch(e){h&&h.debug&&console.warn(p+" is not supported in this browser")}if(h.debug&&console.log("Storage widget using",d?p:"cookies"),e.parseJSON&&(d?f=e.parseJSON(t[p][a]||"null")||{}:(o=r.cookie.split(/[;\s|=]/),f=0!==(n=e.inArray(a,o)+1)?e.parseJSON(o[n]||"null")||{}:{})),void 0===l||!t.JSON||!JSON.hasOwnProperty("stringify"))return f&&f[y]?f[y][b]:"";f[y]||(f[y]={}),f[y][b]=l,d?t[p][a]=JSON.stringify(f):((c=new Date).setTime(c.getTime()+31536e6),r.cookie=a+"="+JSON.stringify(f).replace(/\"/g,'"')+"; expires="+c.toGMTString()+"; path=/")}}(e,window,document),function(e){"use strict";var t=e.tablesorter||{};t.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"glyphicon glyphicon-chevron-up",iconSortDesc:"glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s ui-icon-caret-2-n-s",iconSortAsc:"ui-icon-carat-1-n ui-icon-caret-1-n",iconSortDesc:"ui-icon-carat-1-s ui-icon-caret-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}},e.extend(t.css,{wrapper:"tablesorter-wrapper"}),t.addWidget({id:"uitheme",priority:10,format:function(r,i,a){var l,s,n,o,c,d,f,h,u,p,g,m,b,y=t.themes,_=i.$table.add(e(i.namespace+"_extra_table")),v=i.$headers.add(e(i.namespace+"_extra_headers")),w=i.theme||"jui",x=y[w]||{},S=e.trim([x.sortNone,x.sortDesc,x.sortAsc,x.active].join(" ")),C=e.trim([x.iconSortNone,x.iconSortDesc,x.iconSortAsc].join(" "));for(i.debug&&(c=new Date),_.hasClass("tablesorter-"+w)&&i.theme===i.appliedTheme&&a.uitheme_applied||(a.uitheme_applied=!0,p=y[i.appliedTheme]||{},g=(b=!e.isEmptyObject(p))?[p.sortNone,p.sortDesc,p.sortAsc,p.active].join(" "):"",m=b?[p.iconSortNone,p.iconSortDesc,p.iconSortAsc].join(" "):"",b&&(a.zebra[0]=e.trim(" "+a.zebra[0].replace(" "+p.even,"")),a.zebra[1]=e.trim(" "+a.zebra[1].replace(" "+p.odd,"")),i.$tbodies.children().removeClass([p.even,p.odd].join(" "))),x.even&&(a.zebra[0]+=" "+x.even),x.odd&&(a.zebra[1]+=" "+x.odd),_.children("caption").removeClass(p.caption||"").addClass(x.caption),h=_.removeClass((i.appliedTheme?"tablesorter-"+(i.appliedTheme||""):"")+" "+(p.table||"")).addClass("tablesorter-"+w+" "+(x.table||"")).children("tfoot"),i.appliedTheme=i.theme,h.length&&h.children("tr").removeClass(p.footerRow||"").addClass(x.footerRow).children("th, td").removeClass(p.footerCells||"").addClass(x.footerCells),v.removeClass((b?[p.header,p.hover,g].join(" "):"")||"").addClass(x.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(t){e(this)["mouseenter"===t.type?"addClass":"removeClass"](x.hover||"")}),v.each(function(){var r=e(this);r.find("."+t.css.wrapper).length||r.wrapInner('<div class="'+t.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>')}),i.cssIcon&&v.find("."+t.css.icon).removeClass(b?[p.icons,m].join(" "):"").addClass(x.icons||""),t.hasWidget(i.table,"filter")&&(s=function(){_.children("thead").children("."+t.css.filterRow).removeClass(b?p.filterRow||"":"").addClass(x.filterRow||"")},a.filter_initialized?s():_.one("filterInit",function(){s()}))),l=0;l<i.columns;l++)d=i.$headers.add(e(i.namespace+"_extra_headers")).not(".sorter-false").filter('[data-column="'+l+'"]'),f=t.css.icon?d.find("."+t.css.icon):e(),(u=v.not(".sorter-false").filter('[data-column="'+l+'"]:last')).length&&(d.removeClass(S),f.removeClass(C),u[0].sortDisabled?f.removeClass(x.icons||""):(n=x.sortNone,o=x.iconSortNone,u.hasClass(t.css.sortAsc)?(n=[x.sortAsc,x.active].join(" "),o=x.iconSortAsc):u.hasClass(t.css.sortDesc)&&(n=[x.sortDesc,x.active].join(" "),o=x.iconSortDesc),d.addClass(n),f.addClass(o||"")));i.debug&&console.log("Applying "+w+" theme"+t.benchmark(c))},remove:function(e,r,i,a){if(i.uitheme_applied){var l=r.$table,s=r.appliedTheme||"jui",n=t.themes[s]||t.themes.jui,o=l.children("thead").children(),c=n.sortNone+" "+n.sortDesc+" "+n.sortAsc,d=n.iconSortNone+" "+n.iconSortDesc+" "+n.iconSortAsc;l.removeClass("tablesorter-"+s+" "+n.table),i.uitheme_applied=!1,a||(l.find(t.css.header).removeClass(n.header),o.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(n.hover+" "+c+" "+n.active).filter("."+t.css.filterRow).removeClass(n.filterRow),o.find("."+t.css.icon).removeClass(n.icons+" "+d))}}})}(e),function(e){"use strict";var t=e.tablesorter||{};t.addWidget({id:"columns",priority:65,options:{columns:["primary","secondary","tertiary"]},format:function(r,i,a){var l,s,n,o,c,d,f,h,u=i.$table,p=i.$tbodies,g=i.sortList,m=g.length,b=a&&a.columns||["primary","secondary","tertiary"],y=b.length-1;for(f=b.join(" "),s=0;s<p.length;s++)(n=(l=t.processTbody(r,p.eq(s),!0)).children("tr")).each(function(){if(c=e(this),"none"!==this.style.display&&(d=c.children().removeClass(f),g&&g[0]&&(d.eq(g[0][0]).addClass(b[0]),m>1)))for(h=1;h<m;h++)d.eq(g[h][0]).addClass(b[h]||b[y])}),t.processTbody(r,l,!1);if(o=!1!==a.columns_thead?["thead tr"]:[],!1!==a.columns_tfoot&&o.push("tfoot tr"),o.length&&(n=u.find(o.join(",")).children().removeClass(f),m))for(h=0;h<m;h++)n.filter('[data-column="'+g[h][0]+'"]').addClass(b[h]||b[y])},remove:function(r,i,a){var l,s,n=i.$tbodies,o=(a.columns||["primary","secondary","tertiary"]).join(" ");for(i.$headers.removeClass(o),i.$table.children("tfoot").children("tr").children("th, td").removeClass(o),l=0;l<n.length;l++)(s=t.processTbody(r,n.eq(l),!0)).children("tr").each(function(){e(this).children().removeClass(o)}),t.processTbody(r,s,!1)}})}(e),function(e){"use strict";var t,r,i=e.tablesorter||{},a=i.css,l=i.keyCodes;e.extend(a,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),e.extend(l,{backSpace:8,escape:27,space:32,left:37,down:40}),i.addWidget({id:"filter",priority:50,options:{filter_cellFilter:"",filter_childRows:!1,filter_childByColumn:!1,filter_childWithSibs:!0,filter_columnAnyMatch:!0,filter_columnFilters:!0,filter_cssFilter:"",filter_defaultAttrib:"data-value",filter_defaultFilter:{},filter_excludeFilter:{},filter_external:"",filter_filteredRow:"filtered",filter_filterLabel:'Filter "{{label}}" column by...',filter_formatter:null,filter_functions:null,filter_hideEmpty:!0,filter_hideFilters:!1,filter_ignoreCase:!0,filter_liveSearch:!0,filter_matchType:{input:"exact",select:"exact"},filter_onlyAvail:"filter-onlyAvail",filter_placeholder:{search:"",select:""},filter_reset:null,filter_resetOnEsc:!0,filter_saveFilters:!1,filter_searchDelay:300,filter_searchFiltered:!0,filter_selectSource:null,filter_selectSourceSeparator:"|",filter_serversideFiltering:!1,filter_startsWith:!1,filter_useParsedData:!1},format:function(e,r,i){r.$table.hasClass("hasFilters")||t.init(e,r,i)},remove:function(t,r,l,s){var n,o,c=r.$table,d=r.$tbodies,f="addRows updateCell update updateRows updateComplete appendCache filterReset filterAndSortReset filterFomatterUpdate filterEnd search stickyHeadersInit ".split(" ").join(r.namespace+"filter ");if(c.removeClass("hasFilters").unbind(f.replace(i.regex.spaces," ")).find("."+a.filterRow).remove(),l.filter_initialized=!1,!s){for(n=0;n<d.length;n++)(o=i.processTbody(t,d.eq(n),!0)).children().removeClass(l.filter_filteredRow).show(),i.processTbody(t,o,!1);l.filter_reset&&e(document).undelegate(l.filter_reset,"click"+r.namespace+"filter")}}}),t=i.filter={regex:{regex:/^\/((?:\\\/|[^\/])+)\/([migyu]{0,5})?$/,child:/tablesorter-childRow/,filtered:/filtered/,type:/undefined|number/,exact:/(^[\"\'=]+)|([\"\'=]+$)/g,operators:/[<>=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(i,a,l){if((r.orTest.test(a.iFilter)||r.orSplit.test(a.filter))&&!r.regex.test(a.filter)){var s,n,o,c,d=e.extend({},a),f=a.filter.split(r.orSplit),h=a.iFilter.split(r.orSplit),u=f.length;for(s=0;s<u;s++){d.nestedFilters=!0,d.filter=""+(t.parseFilter(i,f[s],a)||""),d.iFilter=""+(t.parseFilter(i,h[s],a)||""),o="("+(t.parseFilter(i,d.filter,a)||"")+")";try{if(c=new RegExp(a.isMatch?o:"^"+o+"$",i.widgetOptions.filter_ignoreCase?"i":""),n=c.test(d.exact)||t.processTypes(i,d,l))return n}catch(e){return null}}return n||!1}return null},and:function(i,a,l){if(r.andTest.test(a.filter)){var s,n,o,c,d=e.extend({},a),f=a.filter.split(r.andSplit),h=a.iFilter.split(r.andSplit),u=f.length;for(s=0;s<u;s++){d.nestedFilters=!0,d.filter=""+(t.parseFilter(i,f[s],a)||""),d.iFilter=""+(t.parseFilter(i,h[s],a)||""),c=("("+(t.parseFilter(i,d.filter,a)||"")+")").replace(r.wild01,"\\S{1}").replace(r.wild0More,"\\S*");try{o=new RegExp(a.isMatch?c:"^"+c+"$",i.widgetOptions.filter_ignoreCase?"i":"").test(d.exact)||t.processTypes(i,d,l),n=0===s?o:n&&o}catch(e){return null}}return n||!1}return null},regex:function(e,t){if(r.regex.test(t.filter)){var i,a=t.filter_regexCache[t.index]||r.regex.exec(t.filter),l=a instanceof RegExp;try{l||(t.filter_regexCache[t.index]=a=new RegExp(a[1],a[2])),i=a.test(t.exact)}catch(e){i=!1}return i}return null},operators:function(a,l){if(r.operTest.test(l.iFilter)&&""!==l.iExact){var s,n,o,c=a.table,d=l.parsed[l.index],f=i.formatFloat(l.iFilter.replace(r.operators,""),c),h=a.parsers[l.index]||{},u=f;return(d||"numeric"===h.type)&&(o=e.trim(""+l.iFilter.replace(r.operators,"")),f="number"!=typeof(n=t.parseFilter(a,o,l,!0))||""===n||isNaN(n)?f:n),!d&&"numeric"!==h.type||isNaN(f)||void 0===l.cache?(o=isNaN(l.iExact)?l.iExact.replace(i.regex.nondigit,""):l.iExact,s=i.formatFloat(o,c)):s=l.cache,r.gtTest.test(l.iFilter)?n=r.gteTest.test(l.iFilter)?s>=f:s>f:r.ltTest.test(l.iFilter)&&(n=r.lteTest.test(l.iFilter)?s<=f:s<f),n||""!==u||(n=!0),n}return null},notMatch:function(i,a){if(r.notTest.test(a.iFilter)){var l,s=a.iFilter.replace("!",""),n=t.parseFilter(i,s,a)||"";return r.exact.test(n)?""===(n=n.replace(r.exact,""))||e.trim(n)!==a.iExact:(l=a.iExact.search(e.trim(n)),""===n||(a.anyMatch?l<0:!(i.widgetOptions.filter_startsWith?0===l:l>=0)))}return null},exact:function(i,a){if(r.exact.test(a.iFilter)){var l=a.iFilter.replace(r.exact,""),s=t.parseFilter(i,l,a)||"";return a.anyMatch?e.inArray(s,a.rowArray)>=0:s==a.iExact}return null},range:function(e,a){if(r.toTest.test(a.iFilter)){var l,s,n,o,c=e.table,d=a.index,f=a.parsed[d],h=a.iFilter.split(r.toSplit);return s=h[0].replace(i.regex.nondigit,"")||"",n=i.formatFloat(t.parseFilter(e,s,a),c),s=h[1].replace(i.regex.nondigit,"")||"",o=i.formatFloat(t.parseFilter(e,s,a),c),(f||"numeric"===e.parsers[d].type)&&(n=""===(l=e.parsers[d].format(""+h[0],c,e.$headers.eq(d),d))||isNaN(l)?n:l,o=""===(l=e.parsers[d].format(""+h[1],c,e.$headers.eq(d),d))||isNaN(l)?o:l),!f&&"numeric"!==e.parsers[d].type||isNaN(n)||isNaN(o)?(s=isNaN(a.iExact)?a.iExact.replace(i.regex.nondigit,""):a.iExact,l=i.formatFloat(s,c)):l=a.cache,n>o&&(s=n,n=o,o=s),l>=n&&l<=o||""===n||""===o}return null},wild:function(e,i){if(r.wildOrTest.test(i.iFilter)){var a=""+(t.parseFilter(e,i.iFilter,i)||"");!r.wildTest.test(a)&&i.nestedFilters&&(a=i.isMatch?a:"^("+a+")$");try{return new RegExp(a.replace(r.wild01,"\\S{1}").replace(r.wild0More,"\\S*"),e.widgetOptions.filter_ignoreCase?"i":"").test(i.exact)}catch(e){return null}}return null},fuzzy:function(e,i){if(r.fuzzyTest.test(i.iFilter)){var a,l=0,s=i.iExact.length,n=i.iFilter.slice(1),o=t.parseFilter(e,n,i)||"";for(a=0;a<s;a++)i.iExact[a]===o[l]&&(l+=1);return l===o.length}return null}},init:function(l){i.language=e.extend(!0,{},{to:"to",or:"or",and:"and"},i.language);var s,n,o,c,d,f,h,u,p=l.config,g=p.widgetOptions,m=function(e,t,r){return t=t.trim(),""===t?"":(e||"")+t+(r||"")};if(p.$table.addClass("hasFilters"),p.lastSearch=[],g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',f="\\{"+r.query+"\\}",e.extend(r,{child:new RegExp(p.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+(-"+m("|",i.language.or)+m("|",i.language.to)+")\\s+)","i"),toTest:new RegExp("\\s+(-"+m("|",i.language.to)+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-"+m("|",i.language.to)+")\\s+)","gi"),andTest:new RegExp("\\s+("+m("",i.language.and,"|")+"&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+m("",i.language.and,"|")+"&&)\\s+)","gi"),orTest:new RegExp("(\\|"+m("|\\s+",i.language.or,"\\s+")+")","i"),orSplit:new RegExp("(?:\\|"+m("|\\s+(?:",i.language.or,")\\s+")+")","gi"),iQuery:new RegExp(f,"i"),igQuery:new RegExp(f,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/</,lteTest:/<=/,notTest:/^\!/,wildOrTest:/[\?\*\|]/,wildTest:/\?\*/,fuzzyTest:/^~/,exactTest:/[=\"\|!]/}),f=p.$headers.filter(".filter-false, .parser-false").length,!1!==g.filter_columnFilters&&f!==p.$headers.length&&t.buildRow(l,p,g),o="addRows updateCell update updateRows updateComplete appendCache filterReset "+"filterAndSortReset filterResetSaved filterEnd search ".split(" ").join(p.namespace+"filter "),p.$table.bind(o,function(r,s){return f=g.filter_hideEmpty&&e.isEmptyObject(p.cache)&&!(p.delayInit&&"appendCache"===r.type),p.$table.find("."+a.filterRow).toggleClass(g.filter_filteredRow,f),/(search|filter)/.test(r.type)||(r.stopPropagation(),t.buildDefault(l,!0)),"filterReset"===r.type||"filterAndSortReset"===r.type?(p.$table.find("."+a.filter).add(g.filter_$externalFilters).val(""),"filterAndSortReset"===r.type?i.sortReset(this.config,function(){t.searching(l,[])}):t.searching(l,[])):"filterResetSaved"===r.type?i.storage(l,"tablesorter-filters",""):"filterEnd"===r.type?t.buildDefault(l,!0):(s="search"===r.type?s:"updateComplete"===r.type?p.$table.data("lastSearch"):"",/(update|add)/.test(r.type)&&"updateComplete"!==r.type&&(p.lastCombinedFilter=null,p.lastSearch=[],setTimeout(function(){p.$table.triggerHandler("filterFomatterUpdate")},100)),t.searching(l,s,!0)),!1}),g.filter_reset&&(g.filter_reset instanceof e?g.filter_reset.click(function(){p.$table.triggerHandler("filterReset")}):e(g.filter_reset).length&&e(document).undelegate(g.filter_reset,"click"+p.namespace+"filter").delegate(g.filter_reset,"click"+p.namespace+"filter",function(){p.$table.triggerHandler("filterReset")})),g.filter_functions)for(d=0;d<p.columns;d++)if(h=i.getColumnData(l,g.filter_functions,d))if(c=p.$headerIndexed[d].removeClass("filter-select"),u=!(c.hasClass("filter-false")||c.hasClass("parser-false")),s="",!0===h&&u)t.buildSelect(l,d);else if("object"==typeof h&&u){for(n in h)"string"==typeof n&&(s+=""===s?'<option value="">'+(c.data("placeholder")||c.attr("data-placeholder")||g.filter_placeholder.select||"")+"</option>":"",f=n,o=n,n.indexOf(g.filter_selectSourceSeparator)>=0&&(o=(f=n.split(g.filter_selectSourceSeparator))[1],f=f[0]),s+="<option "+(o===f?"":'data-function-name="'+n+'" ')+'value="'+f+'">'+o+"</option>");p.$table.find("thead").find("select."+a.filter+'[data-column="'+d+'"]').append(s),(h="function"==typeof(o=g.filter_selectSource)||i.getColumnData(l,o,d))&&t.buildSelect(p.table,d,"",!0,c.hasClass(g.filter_onlyAvail))}t.buildDefault(l,!0),t.bindSearch(l,p.$table.find("."+a.filter),!0),g.filter_external&&t.bindSearch(l,g.filter_external),g.filter_hideFilters&&t.hideFilters(p),p.showProcessing&&(o="filterStart filterEnd ".split(" ").join(p.namespace+"filter "),p.$table.unbind(o.replace(i.regex.spaces," ")).bind(o,function(t,r){c=r?p.$table.find("."+a.header).filter("[data-column]").filter(function(){return""!==r[e(this).data("column")]}):"",i.isProcessing(l,"filterStart"===t.type,r?c:"")})),p.filteredRows=p.totalRows,o="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(p.namespace+"filter "),p.$table.unbind(o.replace(i.regex.spaces," ")).bind(o,function(){t.completeInit(this)}),p.pager&&p.pager.initialized&&!g.filter_initialized?(p.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){t.filterInitComplete(p)},100)):g.filter_initialized||t.completeInit(l)},completeInit:function(e){var r=e.config,a=r.widgetOptions,l=t.setDefaults(e,r,a)||[];l.length&&(r.delayInit&&""===l.join("")||i.setFilters(e,l,!0)),r.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||t.filterInitComplete(r)},100)},formatterUpdated:function(e,t){var r=e&&e.closest("table"),i=r.length&&r[0].config,a=i&&i.widgetOptions;a&&!a.filter_initialized&&(a.filter_formatterInit[t]=1)},filterInitComplete:function(r){var i,a,l=r.widgetOptions,s=0,n=function(){l.filter_initialized=!0,r.lastSearch=r.$table.data("lastSearch"),r.$table.triggerHandler("filterInit",r),t.findRows(r.table,r.lastSearch||[])};if(e.isEmptyObject(l.filter_formatter))n();else{for(a=l.filter_formatterInit.length,i=0;i<a;i++)1===l.filter_formatterInit[i]&&s++;clearTimeout(l.filter_initTimer),l.filter_initialized||s!==l.filter_formatterCount?l.filter_initialized||(l.filter_initTimer=setTimeout(function(){n()},500)):n()}},processFilters:function(e,t){var r,i=[],a=t?encodeURIComponent:decodeURIComponent,l=e.length;for(r=0;r<l;r++)e[r]&&(i[r]=a(e[r]));return i},setDefaults:function(r,a,l){var s,n,o,c,d,f=i.getFilters(r)||[];if(l.filter_saveFilters&&i.storage&&(n=i.storage(r,"tablesorter-filters")||[],(s=e.isArray(n))&&""===n.join("")||!s||(f=t.processFilters(n))),""===f.join(""))for(d=a.$headers.add(l.filter_$externalFilters).filter("["+l.filter_defaultAttrib+"]"),o=0;o<=a.columns;o++)c=o===a.columns?"all":o,f[o]=d.filter('[data-column="'+c+'"]').attr(l.filter_defaultAttrib)||f[o]||"";return a.$table.data("lastSearch",f),f},parseFilter:function(e,t,r,i){return i||r.parsed[r.index]?e.parsers[r.index].format(t,e.table,[],r.index):t},buildRow:function(r,l,s){var n,o,c,d,f,h,u,p,g,m=s.filter_cellFilter,b=l.columns,y=e.isArray(m),_='<tr role="search" class="'+a.filterRow+" "+l.cssIgnoreRow+'">';for(c=0;c<b;c++)l.$headerIndexed[c].length&&(_+=(g=l.$headerIndexed[c]&&l.$headerIndexed[c][0].colSpan||0)>1?'<td data-column="'+c+"-"+(c+g-1)+'" colspan="'+g+'"':'<td data-column="'+c+'"',_+=y?m[c]?' class="'+m[c]+'"':"":""!==m?' class="'+m+'"':"",_+="></td>");for(l.$filters=e(_+="</tr>").appendTo(l.$table.children("thead").eq(0)).children("td"),c=0;c<b;c++)h=!1,(d=l.$headerIndexed[c])&&d.length&&(n=t.getColumnElm(l,l.$filters,c),p=i.getColumnData(r,s.filter_functions,c),f=s.filter_functions&&p&&"function"!=typeof p||d.hasClass("filter-select"),o=i.getColumnData(r,l.headers,c),h="false"===i.getData(d[0],o,"filter")||"false"===i.getData(d[0],o,"parser"),f?_=e("<select>").appendTo(n):((p=i.getColumnData(r,s.filter_formatter,c))?(s.filter_formatterCount++,(_=p(n,c))&&0===_.length&&(_=n.children("input")),_&&(0===_.parent().length||_.parent().length&&_.parent()[0]!==n[0])&&n.append(_)):_=e('<input type="search">').appendTo(n),_&&(g=d.data("placeholder")||d.attr("data-placeholder")||s.filter_placeholder.search||"",_.attr("placeholder",g))),_&&(u=(e.isArray(s.filter_cssFilter)?void 0!==s.filter_cssFilter[c]?s.filter_cssFilter[c]||"":"":s.filter_cssFilter)||"",_.addClass(a.filter+" "+u),(g=(u=s.filter_filterLabel).match(/{{([^}]+?)}}/g))||(g=["{{label}}"]),e.each(g,function(t,r){var i=new RegExp(r,"g"),a=d.attr("data-"+r.replace(/{{|}}/g,"")),l=void 0===a?d.text():a;u=u.replace(i,e.trim(l))}),_.attr({"data-column":n.attr("data-column"),"aria-label":u}),h&&(_.attr("placeholder","").addClass(a.filterDisabled)[0].disabled=!0)))},bindSearch:function(r,a,s){if(r=e(r)[0],(a=e(a)).length){var n,o=r.config,c=o.widgetOptions,d=o.namespace+"filter",f=c.filter_$externalFilters;!0!==s&&(n=c.filter_anyColumnSelector+","+c.filter_multipleColumnSelector,c.filter_$anyMatch=a.filter(n),f&&f.length?c.filter_$externalFilters=c.filter_$externalFilters.add(a):c.filter_$externalFilters=a,i.setFilters(r,o.$table.data("lastSearch")||[],!1===s)),n="keypress keyup keydown search change input ".split(" ").join(d+" "),a.attr("data-lastSearchTime",(new Date).getTime()).unbind(n.replace(i.regex.spaces," ")).bind("keydown"+d,function(e){if(e.which===l.escape&&!r.config.widgetOptions.filter_resetOnEsc)return!1}).bind("keyup"+d,function(a){c=r.config.widgetOptions;var s=parseInt(e(this).attr("data-column"),10),n="boolean"==typeof c.filter_liveSearch?c.filter_liveSearch:i.getColumnData(r,c.filter_liveSearch,s);if(void 0===n&&(n=c.filter_liveSearch.fallback||!1),e(this).attr("data-lastSearchTime",(new Date).getTime()),a.which===l.escape)this.value=c.filter_resetOnEsc?"":o.lastSearch[s];else{if(""!==this.value&&("number"==typeof n&&this.value.length<n||a.which!==l.enter&&a.which!==l.backSpace&&(a.which<l.space||a.which>=l.left&&a.which<=l.down)))return;if(!1===n&&""!==this.value&&a.which!==l.enter)return}t.searching(r,!0,!0,s)}).bind("search change keypress input blur ".split(" ").join(d+" "),function(a){var s=parseInt(e(this).attr("data-column"),10),n=a.type,d="boolean"==typeof c.filter_liveSearch?c.filter_liveSearch:i.getColumnData(r,c.filter_liveSearch,s);!r.config.widgetOptions.filter_initialized||a.which!==l.enter&&"search"!==n&&"blur"!==n&&("change"!==n&&"input"!==n||!0!==d&&(!0===d||"INPUT"===a.target.nodeName)||this.value===o.lastSearch[s])||(a.preventDefault(),e(this).attr("data-lastSearchTime",(new Date).getTime()),t.searching(r,"keypress"!==n,!0,s))})}},searching:function(e,r,a,l){var s,n=e.config.widgetOptions;void 0===l?s=!1:void 0===(s="boolean"==typeof n.filter_liveSearch?n.filter_liveSearch:i.getColumnData(e,n.filter_liveSearch,l))&&(s=n.filter_liveSearch.fallback||!1),clearTimeout(n.filter_searchTimer),void 0===r||!0===r?n.filter_searchTimer=setTimeout(function(){t.checkFilters(e,r,a)},s?n.filter_searchDelay:10):t.checkFilters(e,r,a)},equalFilters:function(t,r,i){var a,l=[],s=[],n=t.columns+1;for(r=e.isArray(r)?r:[],i=e.isArray(i)?i:[],a=0;a<n;a++)l[a]=r[a]||"",s[a]=i[a]||"";return l.join(",")===s.join(",")},checkFilters:function(r,l,s){var n=r.config,o=n.widgetOptions,c=e.isArray(l),d=c?l:i.getFilters(r,!0),f=d||[];if(e.isEmptyObject(n.cache))n.delayInit&&(!n.pager||n.pager&&n.pager.initialized)&&i.updateCache(n,function(){t.checkFilters(r,!1,s)});else if(c&&(i.setFilters(r,d,!1,!0!==s),o.filter_initialized||(n.lastSearch=[],n.lastCombinedFilter="")),o.filter_hideFilters&&n.$table.find("."+a.filterRow).triggerHandler(t.hideFiltersCheck(n)?"mouseleave":"mouseenter"),!t.equalFilters(n,n.lastSearch,f)||!1===l){if(!1===l&&(n.lastCombinedFilter="",n.lastSearch=[]),d=d||[],d=Array.prototype.map?d.map(String):d.join("�").split("�"),o.filter_initialized&&n.$table.triggerHandler("filterStart",[d]),!n.showProcessing)return t.findRows(r,d,f),!1;setTimeout(function(){return t.findRows(r,d,f),!1},30)}},hideFiltersCheck:function(e){if("function"==typeof e.widgetOptions.filter_hideFilters){var t=e.widgetOptions.filter_hideFilters(e);if("boolean"==typeof t)return t}return""===i.getFilters(e.$table).join("")},hideFilters:function(r,i){var l;(i||r.$table).find("."+a.filterRow).addClass(a.filterRowHide).bind("mouseenter mouseleave",function(i){var s=i,n=e(this);clearTimeout(l),l=setTimeout(function(){/enter|over/.test(s.type)?n.removeClass(a.filterRowHide):e(document.activeElement).closest("tr")[0]!==n[0]&&n.toggleClass(a.filterRowHide,t.hideFiltersCheck(r))},200)}).find("input, select").bind("focus blur",function(i){var s=i,n=e(this).closest("tr");clearTimeout(l),l=setTimeout(function(){clearTimeout(l),n.toggleClass(a.filterRowHide,t.hideFiltersCheck(r)&&"focus"!==s.type)},200)})},defaultFilter:function(t,i){if(""===t)return t;var a=r.iQuery,l=i.match(r.igQuery).length,s=l>1?e.trim(t).split(/\s/):[e.trim(t)],n=s.length-1,o=0,c=i;for(n<1&&l>1&&(s[1]=s[0]);a.test(c);)c=c.replace(a,s[o++]||""),a.test(c)&&o<n&&""!==(s[o]||"")&&(c=i.replace(a,c));return c},getLatestSearch:function(t){return t?t.sort(function(t,r){return e(r).attr("data-lastSearchTime")-e(t).attr("data-lastSearchTime")}):t||e()},findRange:function(e,t,r){var i,a,l,s,n,o,c,d,f,h=[];if(/^[0-9]+$/.test(t))return[parseInt(t,10)];if(!r&&/-/.test(t))for(f=(a=t.match(/(\d+)\s*-\s*(\d+)/g))?a.length:0,d=0;d<f;d++){for(l=a[d].split(/\s*-\s*/),(s=parseInt(l[0],10)||0)>(n=parseInt(l[1],10)||e.columns-1)&&(i=s,s=n,n=i),n>=e.columns&&(n=e.columns-1);s<=n;s++)h[h.length]=s;t=t.replace(a[d],"")}if(!r&&/,/.test(t))for(f=(o=t.split(/\s*,\s*/)).length,c=0;c<f;c++)""!==o[c]&&(d=parseInt(o[c],10))<e.columns&&(h[h.length]=d);if(!h.length)for(d=0;d<e.columns;d++)h[h.length]=d;return h},getColumnElm:function(r,i,a){return i.filter(function(){var i=t.findRange(r,e(this).attr("data-column"));return e.inArray(a,i)>-1})},multipleColumns:function(r,i){var a=r.widgetOptions,l=a.filter_initialized||!i.filter(a.filter_anyColumnSelector).length,s=e.trim(t.getLatestSearch(i).attr("data-column")||"");return t.findRange(r,s,!l)},processTypes:function(r,i,a){var l,s=null,n=null;for(l in t.types)e.inArray(l,a.excludeMatch)<0&&null===n&&null!==(n=t.types[l](r,i,a))&&(i.matchedOn=l,s=n);return s},matchType:function(e,t){var r,i=e.widgetOptions,l=e.$headerIndexed[t];return l.hasClass("filter-exact")?r=!1:l.hasClass("filter-match")?r=!0:(i.filter_columnFilters?l=e.$filters.find("."+a.filter).add(i.filter_$externalFilters).filter('[data-column="'+t+'"]'):i.filter_$externalFilters&&(l=i.filter_$externalFilters.filter('[data-column="'+t+'"]')),r=!!l.length&&"match"===e.widgetOptions.filter_matchType[(l[0].nodeName||"").toLowerCase()]),r},processRow:function(a,l,s){var n,o,c,d,f,h=a.widgetOptions,u=!0,p=h.filter_$anyMatch&&h.filter_$anyMatch.length,g=h.filter_$anyMatch&&h.filter_$anyMatch.length?t.multipleColumns(a,h.filter_$anyMatch):[];if(l.$cells=l.$row.children(),l.matchedOn=null,l.anyMatchFlag&&g.length>1||l.anyMatchFilter&&!p){if(l.anyMatch=!0,l.isMatch=!0,l.rowArray=l.$cells.map(function(t){if(e.inArray(t,g)>-1||l.anyMatchFilter&&!p)return l.parsed[t]?f=l.cacheArray[t]:(f=l.rawArray[t],f=e.trim(h.filter_ignoreCase?f.toLowerCase():f),a.sortLocaleCompare&&(f=i.replaceAccents(f))),f}).get(),l.filter=l.anyMatchFilter,l.iFilter=l.iAnyMatchFilter,l.exact=l.rowArray.join(" "),l.iExact=h.filter_ignoreCase?l.exact.toLowerCase():l.exact,l.cache=l.cacheArray.slice(0,-1).join(" "),s.excludeMatch=s.noAnyMatch,null!==(o=t.processTypes(a,l,s)))u=o;else if(h.filter_startsWith)for(u=!1,g=Math.min(a.columns,l.rowArray.length);!u&&g>0;)g--,u=u||0===l.rowArray[g].indexOf(l.iFilter);else u=(l.iExact+l.childRowText).indexOf(l.iFilter)>=0;if(l.anyMatch=!1,l.filters.join("")===l.filter)return u}for(g=0;g<a.columns;g++)l.filter=l.filters[g],l.index=g,s.excludeMatch=s.excludeFilter[g],l.filter&&(l.cache=l.cacheArray[g],n=l.parsed[g]?l.cache:l.rawArray[g]||"",l.exact=a.sortLocaleCompare?i.replaceAccents(n):n,l.iExact=!r.type.test(typeof l.exact)&&h.filter_ignoreCase?l.exact.toLowerCase():l.exact,l.isMatch=t.matchType(a,g),n=u,d=h.filter_columnFilters?a.$filters.add(h.filter_$externalFilters).filter('[data-column="'+g+'"]').find("select option:selected").attr("data-function-name")||"":"",a.sortLocaleCompare&&(l.filter=i.replaceAccents(l.filter)),h.filter_defaultFilter&&r.iQuery.test(s.defaultColFilter[g])&&(l.filter=t.defaultFilter(l.filter,s.defaultColFilter[g])),l.iFilter=h.filter_ignoreCase?(l.filter||"").toLowerCase():l.filter,o=null,(c=s.functions[g])&&("function"==typeof c?o=c(l.exact,l.cache,l.filter,g,l.$row,a,l):"function"==typeof c[d||l.filter]&&(o=c[f=d||l.filter](l.exact,l.cache,l.filter,g,l.$row,a,l))),null===o?(o=t.processTypes(a,l,s),f=!0===c&&("and"===l.matchedOn||"or"===l.matchedOn),null===o||f?!0===c?n=l.isMatch?(""+l.iExact).search(l.iFilter)>=0:l.filter===l.exact:(f=(l.iExact+l.childRowText).indexOf(t.parseFilter(a,l.iFilter,l)),n=!h.filter_startsWith&&f>=0||h.filter_startsWith&&0===f):n=o):n=o,u=!!n&&u);return u},findRows:function(a,l,s){if(!t.equalFilters(a.config,a.config.lastSearch,s)&&a.config.widgetOptions.filter_initialized){var n,o,c,d,f,h,u,p,g,m,b,y,_,v,w,x,S,C,z,$,F,R,T,k=e.extend([],l),H=a.config,A=H.widgetOptions,I={anyMatch:!1,filters:l,filter_regexCache:[]},O={noAnyMatch:["range","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:i.getColumnData(a,A.filter_defaultFilter,H.columns,!0)||""};for(I.parsed=[],g=0;g<H.columns;g++)I.parsed[g]=A.filter_useParsedData||H.parsers&&H.parsers[g]&&H.parsers[g].parsed||i.getData&&"parsed"===i.getData(H.$headerIndexed[g],i.getColumnData(a,H.headers,g),"filter")||H.$headerIndexed[g].hasClass("filter-parsed"),O.functions[g]=i.getColumnData(a,A.filter_functions,g)||H.$headerIndexed[g].hasClass("filter-select"),O.defaultColFilter[g]=i.getColumnData(a,A.filter_defaultFilter,g)||"",O.excludeFilter[g]=(i.getColumnData(a,A.filter_excludeFilter,g,!0)||"").split(/\s+/);for(H.debug&&(console.log("Filter: Starting filter widget search",l),v=new Date),H.filteredRows=0,H.totalRows=0,s=k||[],u=0;u<H.$tbodies.length;u++){if(p=i.processTbody(a,H.$tbodies.eq(u),!0),g=H.columns,o=H.cache[u].normalized,d=e(e.map(o,function(e){return e[g].$row.get()})),""===s.join("")||A.filter_serversideFiltering)d.removeClass(A.filter_filteredRow).not("."+H.cssChildRow).css("display","");else{if(d=d.not("."+H.cssChildRow),n=d.length,(A.filter_$anyMatch&&A.filter_$anyMatch.length||void 0!==l[H.columns])&&(I.anyMatchFlag=!0,I.anyMatchFilter=""+(l[H.columns]||A.filter_$anyMatch&&t.getLatestSearch(A.filter_$anyMatch).val()||""),A.filter_columnAnyMatch)){for(z=I.anyMatchFilter.split(r.andSplit),$=!1,x=0;x<z.length;x++)(F=z[x].split(":")).length>1&&(isNaN(F[0])?e.each(H.headerContent,function(e,t){t.toLowerCase().indexOf(F[0])>-1&&(l[R=e]=F[1])}):R=parseInt(F[0],10)-1,R>=0&&R<H.columns&&(l[R]=F[1],z.splice(x,1),x--,$=!0));$&&(I.anyMatchFilter=z.join(" && "))}if(C=A.filter_searchFiltered,b=H.lastSearch||H.$table.data("lastSearch")||[],C)for(x=0;x<g+1;x++)w=l[x]||"",C||(x=g),C=C&&b.length&&0===w.indexOf(b[x]||"")&&!r.alreadyFiltered.test(w)&&!r.exactTest.test(w)&&!(r.isNeg1.test(w)||r.isNeg2.test(w))&&!(""!==w&&H.$filters&&H.$filters.filter('[data-column="'+x+'"]').find("select").length&&!t.matchType(H,x));for(S=d.not("."+A.filter_filteredRow).length,C&&0===S&&(C=!1),H.debug&&console.log("Filter: Searching through "+(C&&S<n?S:"all")+" rows"),I.anyMatchFlag&&(H.sortLocaleCompare&&(I.anyMatchFilter=i.replaceAccents(I.anyMatchFilter)),A.filter_defaultFilter&&r.iQuery.test(O.defaultAnyFilter)&&(I.anyMatchFilter=t.defaultFilter(I.anyMatchFilter,O.defaultAnyFilter),C=!1),I.iAnyMatchFilter=A.filter_ignoreCase&&H.ignoreCase?I.anyMatchFilter.toLowerCase():I.anyMatchFilter),h=0;h<n;h++)if(T=d[h].className,!(h&&r.child.test(T)||C&&r.filtered.test(T))){if(I.$row=d.eq(h),I.rowIndex=h,I.cacheArray=o[h],c=I.cacheArray[H.columns],I.rawArray=c.raw,I.childRowText="",!A.filter_childByColumn){for(T="",m=c.child,x=0;x<m.length;x++)T+=" "+m[x].join(" ")||"";I.childRowText=A.filter_childRows?A.filter_ignoreCase?T.toLowerCase():T:""}if(y=!1,_=t.processRow(H,I,O),f=c.$row,w=!!_,m=c.$row.filter(":gt(0)"),A.filter_childRows&&m.length){if(A.filter_childByColumn)for(A.filter_childWithSibs||(m.addClass(A.filter_filteredRow),f=f.eq(0)),x=0;x<m.length;x++)I.$row=m.eq(x),I.cacheArray=c.child[x],I.rawArray=I.cacheArray,w=t.processRow(H,I,O),y=y||w,!A.filter_childWithSibs&&w&&m.eq(x).removeClass(A.filter_filteredRow);y=y||_}else y=w;f.toggleClass(A.filter_filteredRow,!y)[0].display=y?"":"none"}}H.filteredRows+=d.not("."+A.filter_filteredRow).length,H.totalRows+=d.length,i.processTbody(a,p,!1)}H.lastCombinedFilter=k.join(""),H.lastSearch=k,H.$table.data("lastSearch",k),A.filter_saveFilters&&i.storage&&i.storage(a,"tablesorter-filters",t.processFilters(k,!0)),H.debug&&console.log("Completed filter widget search"+i.benchmark(v)),A.filter_initialized&&(H.$table.triggerHandler("filterBeforeEnd",H),H.$table.triggerHandler("filterEnd",H)),setTimeout(function(){i.applyWidget(H.table)},0)}},getOptionSource:function(r,a,l){var s=(r=e(r)[0]).config,n=!1,o=s.widgetOptions.filter_selectSource,c=s.$table.data("lastSearch")||[],d="function"==typeof o||i.getColumnData(r,o,a);if(l&&""!==c[a]&&(l=!1),!0===d)n=o(r,a,l);else{if(d instanceof e||"string"===e.type(d)&&d.indexOf("</option>")>=0)return d;if(e.isArray(d))n=d;else if("object"===e.type(o)&&d&&null===(n=d(r,a,l)))return null}return!1===n&&(n=t.getOptions(r,a,l)),t.processOptions(r,a,n)},processOptions:function(t,r,a){if(!e.isArray(a))return!1;var l,s,n,o,c,d,f=(t=e(t)[0]).config,h=void 0!==r&&null!==r&&r>=0&&r<f.columns,u=!!h&&f.$headerIndexed[r].hasClass("filter-select-sort-desc"),p=[];if(a=e.grep(a,function(t,r){return!!t.text||e.inArray(t,a)===r}),h&&f.$headerIndexed[r].hasClass("filter-select-nosort"))return a;for(o=a.length,n=0;n<o;n++)d=(s=a[n]).text?s.text:s,c=(h&&f.parsers&&f.parsers.length&&f.parsers[r].format(d,t,[],r)||d).toString(),c=f.widgetOptions.filter_ignoreCase?c.toLowerCase():c,s.text?(s.parsed=c,p[p.length]=s):p[p.length]={text:s,parsed:c};for(l=f.textSorter||"",p.sort(function(e,a){var s=u?a.parsed:e.parsed,n=u?e.parsed:a.parsed;return h&&"function"==typeof l?l(s,n,!0,r,t):h&&"object"==typeof l&&l.hasOwnProperty(r)?l[r](s,n,!0,r,t):!i.sortNatural||i.sortNatural(s,n)}),a=[],o=p.length,n=0;n<o;n++)a[a.length]=p[n];return a},getOptions:function(t,r,a){var l,s,n,o,c,d,f,h,u=(t=e(t)[0]).config,p=u.widgetOptions,g=[];for(s=0;s<u.$tbodies.length;s++)for(c=u.cache[s],n=u.cache[s].normalized.length,l=0;l<n;l++)if(o=c.row?c.row[l]:c.normalized[l][u.columns].$row[0],!a||!o.className.match(p.filter_filteredRow))if(p.filter_useParsedData||u.parsers[r].parsed||u.$headerIndexed[r].hasClass("filter-parsed")){if(g[g.length]=""+c.normalized[l][r],p.filter_childRows&&p.filter_childByColumn)for(h=c.normalized[l][u.columns].$row.length-1,d=0;d<h;d++)g[g.length]=""+c.normalized[l][u.columns].child[d][r]}else if(g[g.length]=c.normalized[l][u.columns].raw[r],p.filter_childRows&&p.filter_childByColumn)for(h=c.normalized[l][u.columns].$row.length,d=1;d<h;d++)f=c.normalized[l][u.columns].$row.eq(d).children().eq(r),g[g.length]=""+i.getElementText(u,f,r);return g},buildSelect:function(i,l,s,n,o){if(i=e(i)[0],l=parseInt(l,10),i.config.cache&&!e.isEmptyObject(i.config.cache)){var c,d,f,h,u,p,g,m=i.config,b=m.widgetOptions,y=m.$headerIndexed[l],_='<option value="">'+(y.data("placeholder")||y.attr("data-placeholder")||b.filter_placeholder.select||"")+"</option>",v=m.$table.find("thead").find("select."+a.filter+'[data-column="'+l+'"]').val();if(void 0!==s&&""!==s||null!==(s=t.getOptionSource(i,l,o))){if(e.isArray(s)){for(c=0;c<s.length;c++)if((g=s[c]).text){g["data-function-name"]=void 0===g.value?g.text:g.value,_+="<option";for(d in g)g.hasOwnProperty(d)&&"text"!==d&&(_+=" "+d+'="'+g[d]+'"');g.value||(_+=' value="'+g.text+'"'),_+=">"+g.text+"</option>"}else""+g!="[object Object]"&&(d=f=g=(""+g).replace(r.quote,"&quot;"),f.indexOf(b.filter_selectSourceSeparator)>=0&&(d=(h=f.split(b.filter_selectSourceSeparator))[0],f=h[1]),_+=""!==g?"<option "+(d===f?"":'data-function-name="'+g+'" ')+'value="'+d+'">'+f+"</option>":"");s=[]}u=(m.$filters?m.$filters:m.$table.children("thead")).find("."+a.filter),b.filter_$externalFilters&&(u=u&&u.length?u.add(b.filter_$externalFilters):b.filter_$externalFilters),(p=u.filter('select[data-column="'+l+'"]')).length&&(p[n?"html":"append"](_),e.isArray(s)||p.append(s).val(v),p.val(v))}}},buildDefault:function(e,r){var a,l,s,n=e.config,o=n.widgetOptions,c=n.columns;for(a=0;a<c;a++)s=!((l=n.$headerIndexed[a]).hasClass("filter-false")||l.hasClass("parser-false")),(l.hasClass("filter-select")||!0===i.getColumnData(e,o.filter_functions,a))&&s&&t.buildSelect(e,a,"",r,l.hasClass(o.filter_onlyAvail))}},r=t.regex,i.getFilters=function(r,i,l,s){var n,o,c,d,f=[],h=r?e(r)[0].config:"",u=h?h.widgetOptions:"";if(!0!==i&&u&&!u.filter_columnFilters||e.isArray(l)&&t.equalFilters(h,l,h.lastSearch))return e(r).data("lastSearch")||[];if(h&&(h.$filters&&(o=h.$filters.find("."+a.filter)),u.filter_$externalFilters&&(o=o&&o.length?o.add(u.filter_$externalFilters):u.filter_$externalFilters),o&&o.length))for(f=l||[],n=0;n<h.columns+1;n++)d=n===h.columns?u.filter_anyColumnSelector+","+u.filter_multipleColumnSelector:'[data-column="'+n+'"]',(c=o.filter(d)).length&&(c=t.getLatestSearch(c),e.isArray(l)?(s&&c.length>1&&(c=c.slice(1)),n===h.columns&&(c=(d=c.filter(u.filter_anyColumnSelector)).length?d:c),c.val(l[n]).trigger("change"+h.namespace)):(f[n]=c.val()||"",n===h.columns?c.slice(1).filter('[data-column*="'+c.attr("data-column")+'"]').val(f[n]):c.slice(1).val(f[n])),n===h.columns&&c.length&&(u.filter_$anyMatch=c));return f},i.setFilters=function(r,a,l,s){var n=r?e(r)[0].config:"",o=i.getFilters(r,!0,a,s);return void 0===l&&(l=!0),n&&l&&(n.lastCombinedFilter=null,n.lastSearch=[],t.searching(n.table,a,s),n.$table.triggerHandler("filterFomatterUpdate")),0!==o.length}}(e),function(e,t){"use strict";function r(t,r){var i=isNaN(r.stickyHeaders_offset)?e(r.stickyHeaders_offset):[];return i.length?i.height()||0:parseInt(r.stickyHeaders_offset,10)||0}var i=e.tablesorter||{};e.extend(i.css,{sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible",stickyHide:"tablesorter-sticky-hidden",stickyWrap:"tablesorter-sticky-wrapper"}),i.addHeaderResizeEvent=function(t,r,i){if((t=e(t)[0]).config){var a={timer:250},l=e.extend({},a,i),s=t.config,n=s.widgetOptions,o=function(e){var t,r,i,a,l,o,c=s.$headers.length;for(n.resize_flag=!0,r=[],t=0;t<c;t++)a=(i=s.$headers.eq(t)).data("savedSizes")||[0,0],l=i[0].offsetWidth,o=i[0].offsetHeight,l===a[0]&&o===a[1]||(i.data("savedSizes",[l,o]),r.push(i[0]));r.length&&!1!==e&&s.$table.triggerHandler("resize",[r]),n.resize_flag=!1};if(clearInterval(n.resize_timer),r)return n.resize_flag=!1,!1;o(!1),n.resize_timer=setInterval(function(){n.resize_flag||o()},l.timer)}},i.addWidget({id:"stickyHeaders",priority:54,options:{stickyHeaders:"",stickyHeaders_appendTo:null,stickyHeaders_attachTo:null,stickyHeaders_xScroll:null,stickyHeaders_yScroll:null,stickyHeaders_offset:0,stickyHeaders_filteredToTop:!0,stickyHeaders_cloneId:"-sticky",stickyHeaders_addResizeEvent:!0,stickyHeaders_includeCaption:!0,stickyHeaders_zIndex:2},format:function(a,l,s){if(!(l.$table.hasClass("hasStickyHeaders")||e.inArray("filter",l.widgets)>=0&&!l.$table.hasClass("hasFilters"))){var n,o,c,d,f=l.$table,h=e(s.stickyHeaders_attachTo||s.stickyHeaders_appendTo),u=l.namespace+"stickyheaders ",p=e(s.stickyHeaders_yScroll||s.stickyHeaders_attachTo||t),g=e(s.stickyHeaders_xScroll||s.stickyHeaders_attachTo||t),m=f.children("thead:first").children("tr").not(".sticky-false").children(),b=f.children("tfoot"),y=r(l,s),_=f.parent().closest("."+i.css.table).hasClass("hasStickyHeaders")?f.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],v=_.length?_.height():0,w=s.$sticky=f.clone().addClass("containsStickyHeaders "+i.css.sticky+" "+s.stickyHeaders+" "+l.namespace.slice(1)+"_extra_table").wrap('<div class="'+i.css.stickyWrap+'">'),x=w.parent().addClass(i.css.stickyHide).css({position:h.length?"absolute":"fixed",padding:parseInt(w.parent().parent().css("padding-left"),10),top:y+v,left:0,visibility:"hidden",zIndex:s.stickyHeaders_zIndex||2}),S=w.children("thead:first"),C="",z=function(e,r){var i,a,l,s,n,o=e.filter(":visible"),c=o.length;for(i=0;i<c;i++)s=r.filter(":visible").eq(i),"border-box"===(n=o.eq(i)).css("box-sizing")?a=n.outerWidth():"collapse"===s.css("border-collapse")?t.getComputedStyle?a=parseFloat(t.getComputedStyle(n[0],null).width):(l=parseFloat(n.css("border-width")),a=n.outerWidth()-parseFloat(n.css("padding-left"))-parseFloat(n.css("padding-right"))-l):a=n.width(),s.css({width:a,"min-width":a,"max-width":a})},$=function(r){return!1===r&&_.length?f.position().left:h.length?parseInt(h.css("padding-left"),10)||0:f.offset().left-parseInt(f.css("margin-left"),10)-e(t).scrollLeft()},F=function(){x.css({left:$(),width:f.outerWidth()}),z(f,w),z(m,d)},R=function(t){if(f.is(":visible")){v=_.length?_.offset().top-p.scrollTop()+_.height():0;var a,n=f.offset(),o=r(l,s),c=e.isWindow(p[0]),d=c?p.scrollTop():_.length?parseInt(_[0].style.top,10):p.offset().top,u=h.length?d:p.scrollTop(),g=s.stickyHeaders_includeCaption?0:f.children("caption").height()||0,m=u+o+v-g,y=f.height()-(x.height()+(b.height()||0))-g,w=m>n.top&&m<n.top+y?"visible":"hidden",S="visible"===w?i.css.stickyVis:i.css.stickyHide,z=!x.hasClass(S),R={visibility:w};h.length&&(z=!0,R.top=c?m-h.offset().top:h.scrollTop()),(a=$(c))!==parseInt(x.css("left"),10)&&(z=!0,R.left=a),R.top=(R.top||0)+(!c&&_.length?_.height():o+v),z&&x.removeClass(i.css.stickyVis+" "+i.css.stickyHide).addClass(S).css(R),(w!==C||t)&&(F(),C=w)}};if(h.length&&!h.css("position")&&h.css("position","relative"),w.attr("id")&&(w[0].id+=s.stickyHeaders_cloneId),w.find("> thead:gt(0), tr.sticky-false").hide(),w.find("> tbody, > tfoot").remove(),w.find("caption").toggle(s.stickyHeaders_includeCaption),d=S.children().children(),w.css({height:0,width:0,margin:0}),d.find("."+i.css.resizer).remove(),f.addClass("hasStickyHeaders").bind("pagerComplete"+u,function(){F()}),i.bindEvents(a,S.children().children("."+i.css.header)),s.stickyHeaders_appendTo?e(s.stickyHeaders_appendTo).append(x):f.after(x),l.onRenderHeader)for(o=(c=S.children("tr").children()).length,n=0;n<o;n++)l.onRenderHeader.apply(c.eq(n),[n,l,w]);g.add(p).unbind("scroll resize ".split(" ").join(u).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(u),function(e){R("resize"===e.type)}),l.$table.unbind("stickyHeadersUpdate"+u).bind("stickyHeadersUpdate"+u,function(){R(!0)}),s.stickyHeaders_addResizeEvent&&i.addHeaderResizeEvent(a),f.hasClass("hasFilters")&&s.filter_columnFilters&&(f.bind("filterEnd"+u,function(){var r=e(document.activeElement).closest("td"),a=r.parent().children().index(r);x.hasClass(i.css.stickyVis)&&s.stickyHeaders_filteredToTop&&(t.scrollTo(0,f.position().top),a>=0&&l.$filters&&l.$filters.eq(a).find("a, select, input").filter(":visible").focus())}),i.filter.bindSearch(f,d.find("."+i.css.filter)),s.filter_hideFilters&&i.filter.hideFilters(l,w)),s.stickyHeaders_addResizeEvent&&f.bind("resize"+l.namespace+"stickyheaders",function(){F()}),R(!0),f.triggerHandler("stickyHeadersInit")}},remove:function(r,a,l){var s=a.namespace+"stickyheaders ";a.$table.removeClass("hasStickyHeaders").unbind("pagerComplete resize filterEnd stickyHeadersUpdate ".split(" ").join(s).replace(/\s+/g," ")).next("."+i.css.stickyWrap).remove(),l.$sticky&&l.$sticky.length&&l.$sticky.remove(),e(t).add(l.stickyHeaders_xScroll).add(l.stickyHeaders_yScroll).add(l.stickyHeaders_attachTo).unbind("scroll resize ".split(" ").join(s).replace(/\s+/g," ")),i.addHeaderResizeEvent(r,!0)}})}(e,window),function(e,t){"use strict";var r=e.tablesorter||{};e.extend(r.css,{resizableContainer:"tablesorter-resizable-container",resizableHandle:"tablesorter-resizable-handle",resizableNoSelect:"tablesorter-disableSelection",resizableStorage:"tablesorter-resizable"}),e(function(){var t="<style>body."+r.css.resizableNoSelect+" { -ms-user-select: none; -moz-user-select: -moz-none;-khtml-user-select: none; -webkit-user-select: none; user-select: none; }."+r.css.resizableContainer+" { position: relative; height: 1px; }."+r.css.resizableHandle+" { position: absolute; display: inline-block; width: 8px;top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }</style>";e("head").append(t)}),r.resizable={init:function(t,i){if(!t.$table.hasClass("hasResizable")){t.$table.addClass("hasResizable");var a,l,s,n,o=t.$table,c=o.parent(),d=parseInt(o.css("margin-top"),10),f=i.resizable_vars={useStorage:r.storage&&!1!==i.resizable,$wrap:c,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===c.css("overflow")||"scroll"===c.css("overflow")||"auto"===c.css("overflow-x")||"scroll"===c.css("overflow-x"),storedSizes:[]};for(r.resizableReset(t.table,!0),f.tableWidth=o.width(),f.fullWidth=Math.abs(c.width()-f.tableWidth)<20,f.useStorage&&f.overflow&&(r.storage(t.table,"tablesorter-table-original-css-width",f.tableWidth),n=r.storage(t.table,"tablesorter-table-resized-width")||"auto",r.resizable.setWidth(o,n,!0)),i.resizable_vars.storedSizes=s=(f.useStorage?r.storage(t.table,r.css.resizableStorage):[])||[],r.resizable.setWidths(t,i,s),r.resizable.updateStoredSizes(t,i),i.$resizable_container=e('<div class="'+r.css.resizableContainer+'">').css({top:d}).insertBefore(o),l=0;l<t.columns;l++)a=t.$headerIndexed[l],n=r.getColumnData(t.table,t.headers,l),"false"===r.getData(a,n,"resizable")||e('<div class="'+r.css.resizableHandle+'">').appendTo(i.$resizable_container).attr({"data-column":l,unselectable:"on"}).data("header",a).bind("selectstart",!1);r.resizable.bindings(t,i)}},updateStoredSizes:function(e,t){var r,i,a=e.columns,l=t.resizable_vars;for(l.storedSizes=[],r=0;r<a;r++)i=e.$headerIndexed[r],l.storedSizes[r]=i.is(":visible")?i.width():0},setWidth:function(e,t,r){e.css({width:t,"min-width":r?t:"","max-width":r?t:""})},setWidths:function(t,i,a){var l,s,n=i.resizable_vars,o=e(t.namespace+"_extra_headers"),c=t.$table.children("colgroup").children("col");if((a=a||n.storedSizes||[]).length){for(l=0;l<t.columns;l++)r.resizable.setWidth(t.$headerIndexed[l],a[l],n.overflow),o.length&&(s=o.eq(l).add(c.eq(l)),r.resizable.setWidth(s,a[l],n.overflow));(s=e(t.namespace+"_extra_table")).length&&!r.hasWidget(t.table,"scroller")&&r.resizable.setWidth(s,t.$table.outerWidth(),n.overflow)}},setHandlePosition:function(t,i){var a,l=t.$table.height(),s=i.$resizable_container.children(),n=Math.floor(s.width()/2);r.hasWidget(t.table,"scroller")&&(l=0,t.$table.closest("."+r.css.scrollerWrap).children().each(function(){var t=e(this);l+=t.filter('[style*="height"]').length?t.height():t.children("table").height()})),!i.resizable_includeFooter&&t.$table.children("tfoot").length&&(l-=t.$table.children("tfoot").height()),a=t.$table.position().left,s.each(function(){var s=e(this),o=parseInt(s.attr("data-column"),10),c=t.columns-1,d=s.data("header");d&&(!d.is(":visible")||!i.resizable_addLastColumn&&r.resizable.checkVisibleColumns(t,o)?s.hide():(o<c||o===c&&i.resizable_addLastColumn)&&s.css({display:"inline-block",height:l,left:d.position().left-a+d.outerWidth()-n}))})},checkVisibleColumns:function(e,t){var r,i=0;for(r=t+1;r<e.columns;r++)i+=e.$headerIndexed[r].is(":visible")?1:0;return 0===i},toggleTextSelection:function(t,i,a){var l=t.namespace+"tsresize";i.resizable_vars.disabled=a,e("body").toggleClass(r.css.resizableNoSelect,a),a?e("body").attr("unselectable","on").bind("selectstart"+l,!1):e("body").removeAttr("unselectable").unbind("selectstart"+l)},bindings:function(i,a){var l=i.namespace+"tsresize";a.$resizable_container.children().bind("mousedown",function(t){var l,s=a.resizable_vars,n=e(i.namespace+"_extra_headers"),o=e(t.target).data("header");l=parseInt(o.attr("data-column"),10),s.$target=o=o.add(n.filter('[data-column="'+l+'"]')),s.target=l,s.$next=t.shiftKey||a.resizable_targetLast?o.parent().children().not(".resizable-false").filter(":last"):o.nextAll(":not(.resizable-false)").eq(0),l=parseInt(s.$next.attr("data-column"),10),s.$next=s.$next.add(n.filter('[data-column="'+l+'"]')),s.next=l,s.mouseXPosition=t.pageX,r.resizable.updateStoredSizes(i,a),r.resizable.toggleTextSelection(i,a,!0)}),e(document).bind("mousemove"+l,function(e){var t=a.resizable_vars;t.disabled&&0!==t.mouseXPosition&&t.$target&&(a.resizable_throttle?(clearTimeout(t.timer),t.timer=setTimeout(function(){r.resizable.mouseMove(i,a,e)},isNaN(a.resizable_throttle)?5:a.resizable_throttle)):r.resizable.mouseMove(i,a,e))}).bind("mouseup"+l,function(){a.resizable_vars.disabled&&(r.resizable.toggleTextSelection(i,a,!1),r.resizable.stopResize(i,a),r.resizable.setHandlePosition(i,a))}),e(t).bind("resize"+l+" resizeEnd"+l,function(){r.resizable.setHandlePosition(i,a)}),i.$table.bind("columnUpdate pagerComplete resizableUpdate ".split(" ").join(l+" "),function(){r.resizable.setHandlePosition(i,a)}).bind("resizableReset"+l,function(){r.resizableReset(i.table)}).find("thead:first").add(e(i.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+l,function(){var e=0===a.resizable_vars.storedSizes.length;return r.resizableReset(i.table),r.resizable.setHandlePosition(i,a),a.resizable_vars.storedSizes=[],e})},mouseMove:function(t,i,a){if(0!==i.resizable_vars.mouseXPosition&&i.resizable_vars.$target){var l,s=0,n=i.resizable_vars,o=n.$next,c=n.storedSizes[n.target],d=a.pageX-n.mouseXPosition;if(n.overflow){if(c+d>0){for(n.storedSizes[n.target]+=d,r.resizable.setWidth(n.$target,n.storedSizes[n.target],!0),l=0;l<t.columns;l++)s+=n.storedSizes[l];r.resizable.setWidth(t.$table.add(e(t.namespace+"_extra_table")),s)}o.length||(n.$wrap[0].scrollLeft=t.$table.width())}else n.fullWidth?(n.storedSizes[n.target]+=d,n.storedSizes[n.next]-=d,r.resizable.setWidths(t,i)):(n.storedSizes[n.target]+=d,r.resizable.setWidths(t,i));n.mouseXPosition=a.pageX,t.$table.triggerHandler("stickyHeadersUpdate")}},stopResize:function(e,t){var i=t.resizable_vars;r.resizable.updateStoredSizes(e,t),i.useStorage&&(r.storage(e.table,r.css.resizableStorage,i.storedSizes),r.storage(e.table,"tablesorter-table-resized-width",e.$table.width())),i.mouseXPosition=0,i.$target=i.$next=null,e.$table.triggerHandler("stickyHeadersUpdate"),e.$table.triggerHandler("resizableComplete")}},r.addWidget({id:"resizable",priority:40,options:{resizable:!0,resizable_addLastColumn:!1,resizable_includeFooter:!0,resizable_widths:[],resizable_throttle:!1,resizable_targetLast:!1},init:function(e,t,i,a){r.resizable.init(i,a)},format:function(e,t,i){r.resizable.setHandlePosition(t,i)},remove:function(t,i,a,l){if(a.$resizable_container){var s=i.namespace+"tsresize";i.$table.add(e(i.namespace+"_extra_table")).removeClass("hasResizable").children("thead").unbind("contextmenu"+s),a.$resizable_container.remove(),r.resizable.toggleTextSelection(i,a,!1),r.resizableReset(t,l),e(document).unbind("mousemove"+s+" mouseup"+s)}}}),r.resizableReset=function(t,i){e(t).each(function(){var e,a,l=this.config,s=l&&l.widgetOptions,n=s.resizable_vars;if(t&&l&&l.$headerIndexed.length){for(n.overflow&&n.tableWidth&&(r.resizable.setWidth(l.$table,n.tableWidth,!0),n.useStorage&&r.storage(t,"tablesorter-table-resized-width",n.tableWidth)),e=0;e<l.columns;e++)a=l.$headerIndexed[e],s.resizable_widths&&s.resizable_widths[e]?r.resizable.setWidth(a,s.resizable_widths[e],n.overflow):a.hasClass("resizable-false")||r.resizable.setWidth(a,"",n.overflow);l.$table.triggerHandler("stickyHeadersUpdate"),r.storage&&!i&&r.storage(this,r.css.resizableStorage,[])}})}}(e,window),function(e){"use strict";var t=e.tablesorter||{};t.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(e,t,r,i){t.format(e,r,i,!0)},format:function(r,i,a,l){var s,n,o=i.$table,c=!1!==a.saveSort,d={sortList:i.sortList};i.debug&&(n=new Date),o.hasClass("hasSaveSort")?c&&r.hasInitialized&&t.storage&&(t.storage(r,"tablesorter-savesort",d),i.debug&&console.log("saveSort widget: Saving last sort: "+i.sortList+t.benchmark(n))):(o.addClass("hasSaveSort"),d="",t.storage&&(d=(s=t.storage(r,"tablesorter-savesort"))&&s.hasOwnProperty("sortList")&&e.isArray(s.sortList)?s.sortList:"",i.debug&&console.log('saveSort: Last sort loaded: "'+d+'"'+t.benchmark(n)),o.bind("saveSortReset",function(e){e.stopPropagation(),t.storage(r,"tablesorter-savesort","")})),l&&d&&d.length>0?i.sortList=d:r.hasInitialized&&d&&d.length>0&&t.sortOn(i,d))},remove:function(e,r){r.$table.removeClass("hasSaveSort"),t.storage&&t.storage(e,"tablesorter-savesort","")}})}(e),e.tablesorter});
1
+ /*! tablesorter (FORK) - updated 2018-03-19 (v2.30.1)*/
2
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(e,t,r){"use strict";var i=e.tablesorter||{};e.extend(!0,i.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_storageType:"",storage_tableId:"",storage_useSessionStorage:""}}),i.storage=function(a,l,s,n){var o,c,d,f=!1,h={},u=(a=e(a)[0]).config,p=u&&u.widgetOptions,g=i.debug(u,"storage"),m=(n&&n.storageType||p&&p.storage_storageType).toString().charAt(0).toLowerCase(),b=m?"":n&&n.useSessionStorage||p&&p.storage_useSessionStorage,y=e(a),_=n&&n.id||y.attr(n&&n.group||p&&p.storage_group||"data-table-group")||p&&p.storage_tableId||a.id||e(".tablesorter").index(y),v=n&&n.url||y.attr(n&&n.page||p&&p.storage_page||"data-table-page")||p&&p.storage_fixedUrl||u&&u.fixedUrl||t.location.pathname;if("c"!==m&&(m="s"===m||b?"sessionStorage":"localStorage")in t)try{t[m].setItem("_tmptest","temp"),f=!0,t[m].removeItem("_tmptest")}catch(e){console.warn(m+" is not supported in this browser")}if(g&&console.log("Storage >> Using",f?m:"cookies"),e.parseJSON&&(f?h=e.parseJSON(t[m][l]||"null")||{}:(c=r.cookie.split(/[;\s|=]/),h=0!==(o=e.inArray(l,c)+1)?e.parseJSON(c[o]||"null")||{}:{})),void 0===s||!t.JSON||!JSON.hasOwnProperty("stringify"))return h&&h[v]?h[v][_]:"";h[v]||(h[v]={}),h[v][_]=s,f?t[m][l]=JSON.stringify(h):((d=new Date).setTime(d.getTime()+31536e6),r.cookie=l+"="+JSON.stringify(h).replace(/\"/g,'"')+"; expires="+d.toGMTString()+"; path=/")}}(e,window,document),function(e){"use strict";var t=e.tablesorter||{};t.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"glyphicon glyphicon-chevron-up",iconSortDesc:"glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s ui-icon-caret-2-n-s",iconSortAsc:"ui-icon-carat-1-n ui-icon-caret-1-n",iconSortDesc:"ui-icon-carat-1-s ui-icon-caret-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}},e.extend(t.css,{wrapper:"tablesorter-wrapper"}),t.addWidget({id:"uitheme",priority:10,format:function(r,i,a){var l,s,n,o,c,d,f,h,u,p,g,m,b,y=t.themes,_=i.$table.add(e(i.namespace+"_extra_table")),v=i.$headers.add(e(i.namespace+"_extra_headers")),w=i.theme||"jui",x=y[w]||{},S=e.trim([x.sortNone,x.sortDesc,x.sortAsc,x.active].join(" ")),C=e.trim([x.iconSortNone,x.iconSortDesc,x.iconSortAsc].join(" ")),z=t.debug(i,"uitheme");for(z&&(c=new Date),_.hasClass("tablesorter-"+w)&&i.theme===i.appliedTheme&&a.uitheme_applied||(a.uitheme_applied=!0,p=y[i.appliedTheme]||{},g=(b=!e.isEmptyObject(p))?[p.sortNone,p.sortDesc,p.sortAsc,p.active].join(" "):"",m=b?[p.iconSortNone,p.iconSortDesc,p.iconSortAsc].join(" "):"",b&&(a.zebra[0]=e.trim(" "+a.zebra[0].replace(" "+p.even,"")),a.zebra[1]=e.trim(" "+a.zebra[1].replace(" "+p.odd,"")),i.$tbodies.children().removeClass([p.even,p.odd].join(" "))),x.even&&(a.zebra[0]+=" "+x.even),x.odd&&(a.zebra[1]+=" "+x.odd),_.children("caption").removeClass(p.caption||"").addClass(x.caption),h=_.removeClass((i.appliedTheme?"tablesorter-"+(i.appliedTheme||""):"")+" "+(p.table||"")).addClass("tablesorter-"+w+" "+(x.table||"")).children("tfoot"),i.appliedTheme=i.theme,h.length&&h.children("tr").removeClass(p.footerRow||"").addClass(x.footerRow).children("th, td").removeClass(p.footerCells||"").addClass(x.footerCells),v.removeClass((b?[p.header,p.hover,g].join(" "):"")||"").addClass(x.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(t){e(this)["mouseenter"===t.type?"addClass":"removeClass"](x.hover||"")}),v.each(function(){var r=e(this);r.find("."+t.css.wrapper).length||r.wrapInner('<div class="'+t.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>')}),i.cssIcon&&v.find("."+t.css.icon).removeClass(b?[p.icons,m].join(" "):"").addClass(x.icons||""),t.hasWidget(i.table,"filter")&&(s=function(){_.children("thead").children("."+t.css.filterRow).removeClass(b?p.filterRow||"":"").addClass(x.filterRow||"")},a.filter_initialized?s():_.one("filterInit",function(){s()}))),l=0;l<i.columns;l++)d=i.$headers.add(e(i.namespace+"_extra_headers")).not(".sorter-false").filter('[data-column="'+l+'"]'),f=t.css.icon?d.find("."+t.css.icon):e(),(u=v.not(".sorter-false").filter('[data-column="'+l+'"]:last')).length&&(d.removeClass(S),f.removeClass(C),u[0].sortDisabled?f.removeClass(x.icons||""):(n=x.sortNone,o=x.iconSortNone,u.hasClass(t.css.sortAsc)?(n=[x.sortAsc,x.active].join(" "),o=x.iconSortAsc):u.hasClass(t.css.sortDesc)&&(n=[x.sortDesc,x.active].join(" "),o=x.iconSortDesc),d.addClass(n),f.addClass(o||"")));z&&console.log("uitheme >> Applied "+w+" theme"+t.benchmark(c))},remove:function(e,r,i,a){if(i.uitheme_applied){var l=r.$table,s=r.appliedTheme||"jui",n=t.themes[s]||t.themes.jui,o=l.children("thead").children(),c=n.sortNone+" "+n.sortDesc+" "+n.sortAsc,d=n.iconSortNone+" "+n.iconSortDesc+" "+n.iconSortAsc;l.removeClass("tablesorter-"+s+" "+n.table),i.uitheme_applied=!1,a||(l.find(t.css.header).removeClass(n.header),o.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(n.hover+" "+c+" "+n.active).filter("."+t.css.filterRow).removeClass(n.filterRow),o.find("."+t.css.icon).removeClass(n.icons+" "+d))}}})}(e),function(e){"use strict";var t=e.tablesorter||{};t.addWidget({id:"columns",priority:65,options:{columns:["primary","secondary","tertiary"]},format:function(r,i,a){var l,s,n,o,c,d,f,h,u=i.$table,p=i.$tbodies,g=i.sortList,m=g.length,b=a&&a.columns||["primary","secondary","tertiary"],y=b.length-1;for(f=b.join(" "),s=0;s<p.length;s++)(n=(l=t.processTbody(r,p.eq(s),!0)).children("tr")).each(function(){if(c=e(this),"none"!==this.style.display&&(d=c.children().removeClass(f),g&&g[0]&&(d.eq(g[0][0]).addClass(b[0]),m>1)))for(h=1;h<m;h++)d.eq(g[h][0]).addClass(b[h]||b[y])}),t.processTbody(r,l,!1);if(o=!1!==a.columns_thead?["thead tr"]:[],!1!==a.columns_tfoot&&o.push("tfoot tr"),o.length&&(n=u.find(o.join(",")).children().removeClass(f),m))for(h=0;h<m;h++)n.filter('[data-column="'+g[h][0]+'"]').addClass(b[h]||b[y])},remove:function(r,i,a){var l,s,n=i.$tbodies,o=(a.columns||["primary","secondary","tertiary"]).join(" ");for(i.$headers.removeClass(o),i.$table.children("tfoot").children("tr").children("th, td").removeClass(o),l=0;l<n.length;l++)(s=t.processTbody(r,n.eq(l),!0)).children("tr").each(function(){e(this).children().removeClass(o)}),t.processTbody(r,s,!1)}})}(e),function(e){"use strict";var t,r,i=e.tablesorter||{},a=i.css,l=i.keyCodes;e.extend(a,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),e.extend(l,{backSpace:8,escape:27,space:32,left:37,down:40}),i.addWidget({id:"filter",priority:50,options:{filter_cellFilter:"",filter_childRows:!1,filter_childByColumn:!1,filter_childWithSibs:!0,filter_columnAnyMatch:!0,filter_columnFilters:!0,filter_cssFilter:"",filter_defaultAttrib:"data-value",filter_defaultFilter:{},filter_excludeFilter:{},filter_external:"",filter_filteredRow:"filtered",filter_filterLabel:'Filter "{{label}}" column by...',filter_formatter:null,filter_functions:null,filter_hideEmpty:!0,filter_hideFilters:!1,filter_ignoreCase:!0,filter_liveSearch:!0,filter_matchType:{input:"exact",select:"exact"},filter_onlyAvail:"filter-onlyAvail",filter_placeholder:{search:"",select:""},filter_reset:null,filter_resetOnEsc:!0,filter_saveFilters:!1,filter_searchDelay:300,filter_searchFiltered:!0,filter_selectSource:null,filter_selectSourceSeparator:"|",filter_serversideFiltering:!1,filter_startsWith:!1,filter_useParsedData:!1},format:function(e,r,i){r.$table.hasClass("hasFilters")||t.init(e,r,i)},remove:function(t,r,l,s){var n,o,c=r.$table,d=r.$tbodies,f="addRows updateCell update updateRows updateComplete appendCache filterReset filterAndSortReset filterFomatterUpdate filterEnd search stickyHeadersInit ".split(" ").join(r.namespace+"filter ");if(c.removeClass("hasFilters").unbind(f.replace(i.regex.spaces," ")).find("."+a.filterRow).remove(),l.filter_initialized=!1,!s){for(n=0;n<d.length;n++)(o=i.processTbody(t,d.eq(n),!0)).children().removeClass(l.filter_filteredRow).show(),i.processTbody(t,o,!1);l.filter_reset&&e(document).undelegate(l.filter_reset,"click"+r.namespace+"filter")}}}),t=i.filter={regex:{regex:/^\/((?:\\\/|[^\/])+)\/([migyu]{0,5})?$/,child:/tablesorter-childRow/,filtered:/filtered/,type:/undefined|number/,exact:/(^[\"\'=]+)|([\"\'=]+$)/g,operators:/[<>=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(i,a,l){if((r.orTest.test(a.iFilter)||r.orSplit.test(a.filter))&&!r.regex.test(a.filter)){var s,n,o,c,d=e.extend({},a),f=a.filter.split(r.orSplit),h=a.iFilter.split(r.orSplit),u=f.length;for(s=0;s<u;s++){d.nestedFilters=!0,d.filter=""+(t.parseFilter(i,f[s],a)||""),d.iFilter=""+(t.parseFilter(i,h[s],a)||""),o="("+(t.parseFilter(i,d.filter,a)||"")+")";try{if(c=new RegExp(a.isMatch?o:"^"+o+"$",i.widgetOptions.filter_ignoreCase?"i":""),n=c.test(d.exact)||t.processTypes(i,d,l))return n}catch(e){return null}}return n||!1}return null},and:function(i,a,l){if(r.andTest.test(a.filter)){var s,n,o,c,d=e.extend({},a),f=a.filter.split(r.andSplit),h=a.iFilter.split(r.andSplit),u=f.length;for(s=0;s<u;s++){d.nestedFilters=!0,d.filter=""+(t.parseFilter(i,f[s],a)||""),d.iFilter=""+(t.parseFilter(i,h[s],a)||""),c=("("+(t.parseFilter(i,d.filter,a)||"")+")").replace(r.wild01,"\\S{1}").replace(r.wild0More,"\\S*");try{o=new RegExp(a.isMatch?c:"^"+c+"$",i.widgetOptions.filter_ignoreCase?"i":"").test(d.exact)||t.processTypes(i,d,l),n=0===s?o:n&&o}catch(e){return null}}return n||!1}return null},regex:function(e,t){if(r.regex.test(t.filter)){var i,a=t.filter_regexCache[t.index]||r.regex.exec(t.filter),l=a instanceof RegExp;try{l||(t.filter_regexCache[t.index]=a=new RegExp(a[1],a[2])),i=a.test(t.exact)}catch(e){i=!1}return i}return null},operators:function(a,l){if(r.operTest.test(l.iFilter)&&""!==l.iExact){var s,n,o,c=a.table,d=l.parsed[l.index],f=i.formatFloat(l.iFilter.replace(r.operators,""),c),h=a.parsers[l.index]||{},u=f;return(d||"numeric"===h.type)&&(o=e.trim(""+l.iFilter.replace(r.operators,"")),f="number"!=typeof(n=t.parseFilter(a,o,l,!0))||""===n||isNaN(n)?f:n),!d&&"numeric"!==h.type||isNaN(f)||void 0===l.cache?(o=isNaN(l.iExact)?l.iExact.replace(i.regex.nondigit,""):l.iExact,s=i.formatFloat(o,c)):s=l.cache,r.gtTest.test(l.iFilter)?n=r.gteTest.test(l.iFilter)?s>=f:s>f:r.ltTest.test(l.iFilter)&&(n=r.lteTest.test(l.iFilter)?s<=f:s<f),n||""!==u||(n=!0),n}return null},notMatch:function(i,a){if(r.notTest.test(a.iFilter)){var l,s=a.iFilter.replace("!",""),n=t.parseFilter(i,s,a)||"";return r.exact.test(n)?""===(n=n.replace(r.exact,""))||e.trim(n)!==a.iExact:(l=a.iExact.search(e.trim(n)),""===n||(a.anyMatch?l<0:!(i.widgetOptions.filter_startsWith?0===l:l>=0)))}return null},exact:function(i,a){if(r.exact.test(a.iFilter)){var l=a.iFilter.replace(r.exact,""),s=t.parseFilter(i,l,a)||"";return a.anyMatch?e.inArray(s,a.rowArray)>=0:s==a.iExact}return null},range:function(e,a){if(r.toTest.test(a.iFilter)){var l,s,n,o,c=e.table,d=a.index,f=a.parsed[d],h=a.iFilter.split(r.toSplit);return s=h[0].replace(i.regex.nondigit,"")||"",n=i.formatFloat(t.parseFilter(e,s,a),c),s=h[1].replace(i.regex.nondigit,"")||"",o=i.formatFloat(t.parseFilter(e,s,a),c),(f||"numeric"===e.parsers[d].type)&&(n=""===(l=e.parsers[d].format(""+h[0],c,e.$headers.eq(d),d))||isNaN(l)?n:l,o=""===(l=e.parsers[d].format(""+h[1],c,e.$headers.eq(d),d))||isNaN(l)?o:l),!f&&"numeric"!==e.parsers[d].type||isNaN(n)||isNaN(o)?(s=isNaN(a.iExact)?a.iExact.replace(i.regex.nondigit,""):a.iExact,l=i.formatFloat(s,c)):l=a.cache,n>o&&(s=n,n=o,o=s),l>=n&&l<=o||""===n||""===o}return null},wild:function(e,i){if(r.wildOrTest.test(i.iFilter)){var a=""+(t.parseFilter(e,i.iFilter,i)||"");!r.wildTest.test(a)&&i.nestedFilters&&(a=i.isMatch?a:"^("+a+")$");try{return new RegExp(a.replace(r.wild01,"\\S{1}").replace(r.wild0More,"\\S*"),e.widgetOptions.filter_ignoreCase?"i":"").test(i.exact)}catch(e){return null}}return null},fuzzy:function(e,i){if(r.fuzzyTest.test(i.iFilter)){var a,l=0,s=i.iExact.length,n=i.iFilter.slice(1),o=t.parseFilter(e,n,i)||"";for(a=0;a<s;a++)i.iExact[a]===o[l]&&(l+=1);return l===o.length}return null}},init:function(l){i.language=e.extend(!0,{},{to:"to",or:"or",and:"and"},i.language);var s,n,o,c,d,f,h,u,p=l.config,g=p.widgetOptions,m=function(e,t,r){return t=t.trim(),""===t?"":(e||"")+t+(r||"")};if(p.$table.addClass("hasFilters"),p.lastSearch=[],g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',f="\\{"+r.query+"\\}",e.extend(r,{child:new RegExp(p.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+(-"+m("|",i.language.or)+m("|",i.language.to)+")\\s+)","i"),toTest:new RegExp("\\s+(-"+m("|",i.language.to)+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-"+m("|",i.language.to)+")\\s+)","gi"),andTest:new RegExp("\\s+("+m("",i.language.and,"|")+"&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+m("",i.language.and,"|")+"&&)\\s+)","gi"),orTest:new RegExp("(\\|"+m("|\\s+",i.language.or,"\\s+")+")","i"),orSplit:new RegExp("(?:\\|"+m("|\\s+(?:",i.language.or,")\\s+")+")","gi"),iQuery:new RegExp(f,"i"),igQuery:new RegExp(f,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/</,lteTest:/<=/,notTest:/^\!/,wildOrTest:/[\?\*\|]/,wildTest:/\?\*/,fuzzyTest:/^~/,exactTest:/[=\"\|!]/}),f=p.$headers.filter(".filter-false, .parser-false").length,!1!==g.filter_columnFilters&&f!==p.$headers.length&&t.buildRow(l,p,g),o="addRows updateCell update updateRows updateComplete appendCache filterReset "+"filterAndSortReset filterResetSaved filterEnd search ".split(" ").join(p.namespace+"filter "),p.$table.bind(o,function(r,s){return f=g.filter_hideEmpty&&e.isEmptyObject(p.cache)&&!(p.delayInit&&"appendCache"===r.type),p.$table.find("."+a.filterRow).toggleClass(g.filter_filteredRow,f),/(search|filter)/.test(r.type)||(r.stopPropagation(),t.buildDefault(l,!0)),"filterReset"===r.type||"filterAndSortReset"===r.type?(p.$table.find("."+a.filter).add(g.filter_$externalFilters).val(""),"filterAndSortReset"===r.type?i.sortReset(this.config,function(){t.searching(l,[])}):t.searching(l,[])):"filterResetSaved"===r.type?i.storage(l,"tablesorter-filters",""):"filterEnd"===r.type?t.buildDefault(l,!0):(s="search"===r.type?s:"updateComplete"===r.type?p.$table.data("lastSearch"):"",/(update|add)/.test(r.type)&&"updateComplete"!==r.type&&(p.lastCombinedFilter=null,p.lastSearch=[],setTimeout(function(){p.$table.triggerHandler("filterFomatterUpdate")},100)),t.searching(l,s,!0)),!1}),g.filter_reset&&(g.filter_reset instanceof e?g.filter_reset.click(function(){p.$table.triggerHandler("filterReset")}):e(g.filter_reset).length&&e(document).undelegate(g.filter_reset,"click"+p.namespace+"filter").delegate(g.filter_reset,"click"+p.namespace+"filter",function(){p.$table.triggerHandler("filterReset")})),g.filter_functions)for(d=0;d<p.columns;d++)if(h=i.getColumnData(l,g.filter_functions,d))if(c=p.$headerIndexed[d].removeClass("filter-select"),u=!(c.hasClass("filter-false")||c.hasClass("parser-false")),s="",!0===h&&u)t.buildSelect(l,d);else if("object"==typeof h&&u){for(n in h)"string"==typeof n&&(s+=""===s?'<option value="">'+(c.data("placeholder")||c.attr("data-placeholder")||g.filter_placeholder.select||"")+"</option>":"",f=n,o=n,n.indexOf(g.filter_selectSourceSeparator)>=0&&(o=(f=n.split(g.filter_selectSourceSeparator))[1],f=f[0]),s+="<option "+(o===f?"":'data-function-name="'+n+'" ')+'value="'+f+'">'+o+"</option>");p.$table.find("thead").find("select."+a.filter+'[data-column="'+d+'"]').append(s),(h="function"==typeof(o=g.filter_selectSource)||i.getColumnData(l,o,d))&&t.buildSelect(p.table,d,"",!0,c.hasClass(g.filter_onlyAvail))}t.buildDefault(l,!0),t.bindSearch(l,p.$table.find("."+a.filter),!0),g.filter_external&&t.bindSearch(l,g.filter_external),g.filter_hideFilters&&t.hideFilters(p),p.showProcessing&&(o="filterStart filterEnd ".split(" ").join(p.namespace+"filter-sp "),p.$table.unbind(o.replace(i.regex.spaces," ")).bind(o,function(t,r){c=r?p.$table.find("."+a.header).filter("[data-column]").filter(function(){return""!==r[e(this).data("column")]}):"",i.isProcessing(l,"filterStart"===t.type,r?c:"")})),p.filteredRows=p.totalRows,o="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(p.namespace+"filter "),p.$table.unbind(o.replace(i.regex.spaces," ")).bind(o,function(){t.completeInit(this)}),p.pager&&p.pager.initialized&&!g.filter_initialized?(p.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){t.filterInitComplete(p)},100)):g.filter_initialized||t.completeInit(l)},completeInit:function(e){var r=e.config,a=r.widgetOptions,l=t.setDefaults(e,r,a)||[];l.length&&(r.delayInit&&""===l.join("")||i.setFilters(e,l,!0)),r.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||t.filterInitComplete(r)},100)},formatterUpdated:function(e,t){var r=e&&e.closest("table"),i=r.length&&r[0].config,a=i&&i.widgetOptions;a&&!a.filter_initialized&&(a.filter_formatterInit[t]=1)},filterInitComplete:function(r){var a,l,s=r.widgetOptions,n=0,o=function(){s.filter_initialized=!0,r.lastSearch=r.$table.data("lastSearch"),r.$table.triggerHandler("filterInit",r),t.findRows(r.table,r.lastSearch||[]),i.debug(r,"filter")&&console.log("Filter >> Widget initialized")};if(e.isEmptyObject(s.filter_formatter))o();else{for(l=s.filter_formatterInit.length,a=0;a<l;a++)1===s.filter_formatterInit[a]&&n++;clearTimeout(s.filter_initTimer),s.filter_initialized||n!==s.filter_formatterCount?s.filter_initialized||(s.filter_initTimer=setTimeout(function(){o()},500)):o()}},processFilters:function(e,t){var r,i=[],a=t?encodeURIComponent:decodeURIComponent,l=e.length;for(r=0;r<l;r++)e[r]&&(i[r]=a(e[r]));return i},setDefaults:function(r,a,l){var s,n,o,c,d,f=i.getFilters(r)||[];if(l.filter_saveFilters&&i.storage&&(n=i.storage(r,"tablesorter-filters")||[],(s=e.isArray(n))&&""===n.join("")||!s||(f=t.processFilters(n))),""===f.join(""))for(d=a.$headers.add(l.filter_$externalFilters).filter("["+l.filter_defaultAttrib+"]"),o=0;o<=a.columns;o++)c=o===a.columns?"all":o,f[o]=d.filter('[data-column="'+c+'"]').attr(l.filter_defaultAttrib)||f[o]||"";return a.$table.data("lastSearch",f),f},parseFilter:function(e,t,r,i){return i||r.parsed[r.index]?e.parsers[r.index].format(t,e.table,[],r.index):t},buildRow:function(r,l,s){var n,o,c,d,f,h,u,p,g,m=s.filter_cellFilter,b=l.columns,y=e.isArray(m),_='<tr role="search" class="'+a.filterRow+" "+l.cssIgnoreRow+'">';for(c=0;c<b;c++)l.$headerIndexed[c].length&&(_+=(g=l.$headerIndexed[c]&&l.$headerIndexed[c][0].colSpan||0)>1?'<td data-column="'+c+"-"+(c+g-1)+'" colspan="'+g+'"':'<td data-column="'+c+'"',_+=y?m[c]?' class="'+m[c]+'"':"":""!==m?' class="'+m+'"':"",_+="></td>");for(l.$filters=e(_+="</tr>").appendTo(l.$table.children("thead").eq(0)).children("td"),c=0;c<b;c++)h=!1,(d=l.$headerIndexed[c])&&d.length&&(n=t.getColumnElm(l,l.$filters,c),p=i.getColumnData(r,s.filter_functions,c),f=s.filter_functions&&p&&"function"!=typeof p||d.hasClass("filter-select"),o=i.getColumnData(r,l.headers,c),h="false"===i.getData(d[0],o,"filter")||"false"===i.getData(d[0],o,"parser"),f?_=e("<select>").appendTo(n):((p=i.getColumnData(r,s.filter_formatter,c))?(s.filter_formatterCount++,(_=p(n,c))&&0===_.length&&(_=n.children("input")),_&&(0===_.parent().length||_.parent().length&&_.parent()[0]!==n[0])&&n.append(_)):_=e('<input type="search">').appendTo(n),_&&(g=d.data("placeholder")||d.attr("data-placeholder")||s.filter_placeholder.search||"",_.attr("placeholder",g))),_&&(u=(e.isArray(s.filter_cssFilter)?void 0!==s.filter_cssFilter[c]?s.filter_cssFilter[c]||"":"":s.filter_cssFilter)||"",_.addClass(a.filter+" "+u),(g=(u=s.filter_filterLabel).match(/{{([^}]+?)}}/g))||(g=["{{label}}"]),e.each(g,function(t,r){var i=new RegExp(r,"g"),a=d.attr("data-"+r.replace(/{{|}}/g,"")),l=void 0===a?d.text():a;u=u.replace(i,e.trim(l))}),_.attr({"data-column":n.attr("data-column"),"aria-label":u}),h&&(_.attr("placeholder","").addClass(a.filterDisabled)[0].disabled=!0)))},bindSearch:function(r,a,s){if(r=e(r)[0],(a=e(a)).length){var n,o=r.config,c=o.widgetOptions,d=o.namespace+"filter",f=c.filter_$externalFilters;!0!==s&&(n=c.filter_anyColumnSelector+","+c.filter_multipleColumnSelector,c.filter_$anyMatch=a.filter(n),f&&f.length?c.filter_$externalFilters=c.filter_$externalFilters.add(a):c.filter_$externalFilters=a,i.setFilters(r,o.$table.data("lastSearch")||[],!1===s)),n="keypress keyup keydown search change input ".split(" ").join(d+" "),a.attr("data-lastSearchTime",(new Date).getTime()).unbind(n.replace(i.regex.spaces," ")).bind("keydown"+d,function(e){if(e.which===l.escape&&!r.config.widgetOptions.filter_resetOnEsc)return!1}).bind("keyup"+d,function(a){c=r.config.widgetOptions;var s=parseInt(e(this).attr("data-column"),10),n="boolean"==typeof c.filter_liveSearch?c.filter_liveSearch:i.getColumnData(r,c.filter_liveSearch,s);if(void 0===n&&(n=c.filter_liveSearch.fallback||!1),e(this).attr("data-lastSearchTime",(new Date).getTime()),a.which===l.escape)this.value=c.filter_resetOnEsc?"":o.lastSearch[s];else{if(""!==this.value&&("number"==typeof n&&this.value.length<n||a.which!==l.enter&&a.which!==l.backSpace&&(a.which<l.space||a.which>=l.left&&a.which<=l.down)))return;if(!1===n&&""!==this.value&&a.which!==l.enter)return}t.searching(r,!0,!0,s)}).bind("search change keypress input blur ".split(" ").join(d+" "),function(a){var s=parseInt(e(this).attr("data-column"),10),n=a.type,d="boolean"==typeof c.filter_liveSearch?c.filter_liveSearch:i.getColumnData(r,c.filter_liveSearch,s);!r.config.widgetOptions.filter_initialized||a.which!==l.enter&&"search"!==n&&"blur"!==n&&("change"!==n&&"input"!==n||!0!==d&&(!0===d||"INPUT"===a.target.nodeName)||this.value===o.lastSearch[s])||(a.preventDefault(),e(this).attr("data-lastSearchTime",(new Date).getTime()),t.searching(r,"keypress"!==n,!0,s))})}},searching:function(e,r,a,l){var s,n=e.config.widgetOptions;void 0===l?s=!1:void 0===(s="boolean"==typeof n.filter_liveSearch?n.filter_liveSearch:i.getColumnData(e,n.filter_liveSearch,l))&&(s=n.filter_liveSearch.fallback||!1),clearTimeout(n.filter_searchTimer),void 0===r||!0===r?n.filter_searchTimer=setTimeout(function(){t.checkFilters(e,r,a)},s?n.filter_searchDelay:10):t.checkFilters(e,r,a)},equalFilters:function(t,r,i){var a,l=[],s=[],n=t.columns+1;for(r=e.isArray(r)?r:[],i=e.isArray(i)?i:[],a=0;a<n;a++)l[a]=r[a]||"",s[a]=i[a]||"";return l.join(",")===s.join(",")},checkFilters:function(r,l,s){var n=r.config,o=n.widgetOptions,c=e.isArray(l),d=c?l:i.getFilters(r,!0),f=d||[];if(e.isEmptyObject(n.cache))n.delayInit&&(!n.pager||n.pager&&n.pager.initialized)&&i.updateCache(n,function(){t.checkFilters(r,!1,s)});else if(c&&(i.setFilters(r,d,!1,!0!==s),o.filter_initialized||(n.lastSearch=[],n.lastCombinedFilter="")),o.filter_hideFilters&&n.$table.find("."+a.filterRow).triggerHandler(t.hideFiltersCheck(n)?"mouseleave":"mouseenter"),!t.equalFilters(n,n.lastSearch,f)||!1===l){if(!1===l&&(n.lastCombinedFilter="",n.lastSearch=[]),d=d||[],d=Array.prototype.map?d.map(String):d.join("�").split("�"),o.filter_initialized&&n.$table.triggerHandler("filterStart",[d]),!n.showProcessing)return t.findRows(r,d,f),!1;setTimeout(function(){return t.findRows(r,d,f),!1},30)}},hideFiltersCheck:function(e){if("function"==typeof e.widgetOptions.filter_hideFilters){var t=e.widgetOptions.filter_hideFilters(e);if("boolean"==typeof t)return t}return""===i.getFilters(e.$table).join("")},hideFilters:function(r,i){var l;(i||r.$table).find("."+a.filterRow).addClass(a.filterRowHide).bind("mouseenter mouseleave",function(i){var s=i,n=e(this);clearTimeout(l),l=setTimeout(function(){/enter|over/.test(s.type)?n.removeClass(a.filterRowHide):e(document.activeElement).closest("tr")[0]!==n[0]&&n.toggleClass(a.filterRowHide,t.hideFiltersCheck(r))},200)}).find("input, select").bind("focus blur",function(i){var s=i,n=e(this).closest("tr");clearTimeout(l),l=setTimeout(function(){clearTimeout(l),n.toggleClass(a.filterRowHide,t.hideFiltersCheck(r)&&"focus"!==s.type)},200)})},defaultFilter:function(t,i){if(""===t)return t;var a=r.iQuery,l=i.match(r.igQuery).length,s=l>1?e.trim(t).split(/\s/):[e.trim(t)],n=s.length-1,o=0,c=i;for(n<1&&l>1&&(s[1]=s[0]);a.test(c);)c=c.replace(a,s[o++]||""),a.test(c)&&o<n&&""!==(s[o]||"")&&(c=i.replace(a,c));return c},getLatestSearch:function(t){return t?t.sort(function(t,r){return e(r).attr("data-lastSearchTime")-e(t).attr("data-lastSearchTime")}):t||e()},findRange:function(e,t,r){var i,a,l,s,n,o,c,d,f,h=[];if(/^[0-9]+$/.test(t))return[parseInt(t,10)];if(!r&&/-/.test(t))for(f=(a=t.match(/(\d+)\s*-\s*(\d+)/g))?a.length:0,d=0;d<f;d++){for(l=a[d].split(/\s*-\s*/),(s=parseInt(l[0],10)||0)>(n=parseInt(l[1],10)||e.columns-1)&&(i=s,s=n,n=i),n>=e.columns&&(n=e.columns-1);s<=n;s++)h[h.length]=s;t=t.replace(a[d],"")}if(!r&&/,/.test(t))for(f=(o=t.split(/\s*,\s*/)).length,c=0;c<f;c++)""!==o[c]&&(d=parseInt(o[c],10))<e.columns&&(h[h.length]=d);if(!h.length)for(d=0;d<e.columns;d++)h[h.length]=d;return h},getColumnElm:function(r,i,a){return i.filter(function(){var i=t.findRange(r,e(this).attr("data-column"));return e.inArray(a,i)>-1})},multipleColumns:function(r,i){var a=r.widgetOptions,l=a.filter_initialized||!i.filter(a.filter_anyColumnSelector).length,s=e.trim(t.getLatestSearch(i).attr("data-column")||"");return t.findRange(r,s,!l)},processTypes:function(r,i,a){var l,s=null,n=null;for(l in t.types)e.inArray(l,a.excludeMatch)<0&&null===n&&null!==(n=t.types[l](r,i,a))&&(i.matchedOn=l,s=n);return s},matchType:function(e,t){var r,i=e.widgetOptions,l=e.$headerIndexed[t];return l.hasClass("filter-exact")?r=!1:l.hasClass("filter-match")?r=!0:(i.filter_columnFilters?l=e.$filters.find("."+a.filter).add(i.filter_$externalFilters).filter('[data-column="'+t+'"]'):i.filter_$externalFilters&&(l=i.filter_$externalFilters.filter('[data-column="'+t+'"]')),r=!!l.length&&"match"===e.widgetOptions.filter_matchType[(l[0].nodeName||"").toLowerCase()]),r},processRow:function(a,l,s){var n,o,c,d,f,h=a.widgetOptions,u=!0,p=h.filter_$anyMatch&&h.filter_$anyMatch.length,g=h.filter_$anyMatch&&h.filter_$anyMatch.length?t.multipleColumns(a,h.filter_$anyMatch):[];if(l.$cells=l.$row.children(),l.matchedOn=null,l.anyMatchFlag&&g.length>1||l.anyMatchFilter&&!p){if(l.anyMatch=!0,l.isMatch=!0,l.rowArray=l.$cells.map(function(t){if(e.inArray(t,g)>-1||l.anyMatchFilter&&!p)return l.parsed[t]?f=l.cacheArray[t]:(f=l.rawArray[t],f=e.trim(h.filter_ignoreCase?f.toLowerCase():f),a.sortLocaleCompare&&(f=i.replaceAccents(f))),f}).get(),l.filter=l.anyMatchFilter,l.iFilter=l.iAnyMatchFilter,l.exact=l.rowArray.join(" "),l.iExact=h.filter_ignoreCase?l.exact.toLowerCase():l.exact,l.cache=l.cacheArray.slice(0,-1).join(" "),s.excludeMatch=s.noAnyMatch,null!==(o=t.processTypes(a,l,s)))u=o;else if(h.filter_startsWith)for(u=!1,g=Math.min(a.columns,l.rowArray.length);!u&&g>0;)g--,u=u||0===l.rowArray[g].indexOf(l.iFilter);else u=(l.iExact+l.childRowText).indexOf(l.iFilter)>=0;if(l.anyMatch=!1,l.filters.join("")===l.filter)return u}for(g=0;g<a.columns;g++)l.filter=l.filters[g],l.index=g,s.excludeMatch=s.excludeFilter[g],l.filter&&(l.cache=l.cacheArray[g],n=l.parsed[g]?l.cache:l.rawArray[g]||"",l.exact=a.sortLocaleCompare?i.replaceAccents(n):n,l.iExact=!r.type.test(typeof l.exact)&&h.filter_ignoreCase?l.exact.toLowerCase():l.exact,l.isMatch=t.matchType(a,g),n=u,d=h.filter_columnFilters?a.$filters.add(h.filter_$externalFilters).filter('[data-column="'+g+'"]').find("select option:selected").attr("data-function-name")||"":"",a.sortLocaleCompare&&(l.filter=i.replaceAccents(l.filter)),h.filter_defaultFilter&&r.iQuery.test(s.defaultColFilter[g])&&(l.filter=t.defaultFilter(l.filter,s.defaultColFilter[g])),l.iFilter=h.filter_ignoreCase?(l.filter||"").toLowerCase():l.filter,o=null,(c=s.functions[g])&&("function"==typeof c?o=c(l.exact,l.cache,l.filter,g,l.$row,a,l):"function"==typeof c[d||l.filter]&&(o=c[f=d||l.filter](l.exact,l.cache,l.filter,g,l.$row,a,l))),null===o?(o=t.processTypes(a,l,s),f=!0===c&&("and"===l.matchedOn||"or"===l.matchedOn),null===o||f?!0===c?n=l.isMatch?(""+l.iExact).search(l.iFilter)>=0:l.filter===l.exact:(f=(l.iExact+l.childRowText).indexOf(t.parseFilter(a,l.iFilter,l)),n=!h.filter_startsWith&&f>=0||h.filter_startsWith&&0===f):n=o):n=o,u=!!n&&u);return u},findRows:function(a,l,s){if(!t.equalFilters(a.config,a.config.lastSearch,s)&&a.config.widgetOptions.filter_initialized){var n,o,c,d,f,h,u,p,g,m,b,y,_,v,w,x,S,C,z,$,F,R,T,k=e.extend([],l),H=a.config,A=H.widgetOptions,I=i.debug(H,"filter"),O={anyMatch:!1,filters:l,filter_regexCache:[]},E={noAnyMatch:["range","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:i.getColumnData(a,A.filter_defaultFilter,H.columns,!0)||""};for(O.parsed=[],g=0;g<H.columns;g++)O.parsed[g]=A.filter_useParsedData||H.parsers&&H.parsers[g]&&H.parsers[g].parsed||i.getData&&"parsed"===i.getData(H.$headerIndexed[g],i.getColumnData(a,H.headers,g),"filter")||H.$headerIndexed[g].hasClass("filter-parsed"),E.functions[g]=i.getColumnData(a,A.filter_functions,g)||H.$headerIndexed[g].hasClass("filter-select"),E.defaultColFilter[g]=i.getColumnData(a,A.filter_defaultFilter,g)||"",E.excludeFilter[g]=(i.getColumnData(a,A.filter_excludeFilter,g,!0)||"").split(/\s+/);for(I&&(console.log("Filter >> Starting filter widget search",l),v=new Date),H.filteredRows=0,H.totalRows=0,s=k||[],u=0;u<H.$tbodies.length;u++){if(p=i.processTbody(a,H.$tbodies.eq(u),!0),g=H.columns,o=H.cache[u].normalized,d=e(e.map(o,function(e){return e[g].$row.get()})),""===s.join("")||A.filter_serversideFiltering)d.removeClass(A.filter_filteredRow).not("."+H.cssChildRow).css("display","");else{if(d=d.not("."+H.cssChildRow),n=d.length,(A.filter_$anyMatch&&A.filter_$anyMatch.length||void 0!==l[H.columns])&&(O.anyMatchFlag=!0,O.anyMatchFilter=""+(l[H.columns]||A.filter_$anyMatch&&t.getLatestSearch(A.filter_$anyMatch).val()||""),A.filter_columnAnyMatch)){for(z=O.anyMatchFilter.split(r.andSplit),$=!1,x=0;x<z.length;x++)(F=z[x].split(":")).length>1&&(isNaN(F[0])?e.each(H.headerContent,function(e,t){t.toLowerCase().indexOf(F[0])>-1&&(l[R=e]=F[1])}):R=parseInt(F[0],10)-1,R>=0&&R<H.columns&&(l[R]=F[1],z.splice(x,1),x--,$=!0));$&&(O.anyMatchFilter=z.join(" && "))}if(C=A.filter_searchFiltered,b=H.lastSearch||H.$table.data("lastSearch")||[],C)for(x=0;x<g+1;x++)w=l[x]||"",C||(x=g),C=C&&b.length&&0===w.indexOf(b[x]||"")&&!r.alreadyFiltered.test(w)&&!r.exactTest.test(w)&&!(r.isNeg1.test(w)||r.isNeg2.test(w))&&!(""!==w&&H.$filters&&H.$filters.filter('[data-column="'+x+'"]').find("select").length&&!t.matchType(H,x));for(S=d.not("."+A.filter_filteredRow).length,C&&0===S&&(C=!1),I&&console.log("Filter >> Searching through "+(C&&S<n?S:"all")+" rows"),O.anyMatchFlag&&(H.sortLocaleCompare&&(O.anyMatchFilter=i.replaceAccents(O.anyMatchFilter)),A.filter_defaultFilter&&r.iQuery.test(E.defaultAnyFilter)&&(O.anyMatchFilter=t.defaultFilter(O.anyMatchFilter,E.defaultAnyFilter),C=!1),O.iAnyMatchFilter=A.filter_ignoreCase&&H.ignoreCase?O.anyMatchFilter.toLowerCase():O.anyMatchFilter),h=0;h<n;h++)if(T=d[h].className,!(h&&r.child.test(T)||C&&r.filtered.test(T))){if(O.$row=d.eq(h),O.rowIndex=h,O.cacheArray=o[h],c=O.cacheArray[H.columns],O.rawArray=c.raw,O.childRowText="",!A.filter_childByColumn){for(T="",m=c.child,x=0;x<m.length;x++)T+=" "+m[x].join(" ")||"";O.childRowText=A.filter_childRows?A.filter_ignoreCase?T.toLowerCase():T:""}if(y=!1,_=t.processRow(H,O,E),f=c.$row,w=!!_,m=c.$row.filter(":gt(0)"),A.filter_childRows&&m.length){if(A.filter_childByColumn)for(A.filter_childWithSibs||(m.addClass(A.filter_filteredRow),f=f.eq(0)),x=0;x<m.length;x++)O.$row=m.eq(x),O.cacheArray=c.child[x],O.rawArray=O.cacheArray,w=t.processRow(H,O,E),y=y||w,!A.filter_childWithSibs&&w&&m.eq(x).removeClass(A.filter_filteredRow);y=y||_}else y=w;f.toggleClass(A.filter_filteredRow,!y)[0].display=y?"":"none"}}H.filteredRows+=d.not("."+A.filter_filteredRow).length,H.totalRows+=d.length,i.processTbody(a,p,!1)}H.lastCombinedFilter=k.join(""),H.lastSearch=k,H.$table.data("lastSearch",k),A.filter_saveFilters&&i.storage&&i.storage(a,"tablesorter-filters",t.processFilters(k,!0)),I&&console.log("Filter >> Completed search"+i.benchmark(v)),A.filter_initialized&&(H.$table.triggerHandler("filterBeforeEnd",H),H.$table.triggerHandler("filterEnd",H)),setTimeout(function(){i.applyWidget(H.table)},0)}},getOptionSource:function(r,a,l){var s=(r=e(r)[0]).config,n=!1,o=s.widgetOptions.filter_selectSource,c=s.$table.data("lastSearch")||[],d="function"==typeof o||i.getColumnData(r,o,a);if(l&&""!==c[a]&&(l=!1),!0===d)n=o(r,a,l);else{if(d instanceof e||"string"===e.type(d)&&d.indexOf("</option>")>=0)return d;if(e.isArray(d))n=d;else if("object"===e.type(o)&&d&&null===(n=d(r,a,l)))return null}return!1===n&&(n=t.getOptions(r,a,l)),t.processOptions(r,a,n)},processOptions:function(t,r,a){if(!e.isArray(a))return!1;var l,s,n,o,c,d,f=(t=e(t)[0]).config,h=void 0!==r&&null!==r&&r>=0&&r<f.columns,u=!!h&&f.$headerIndexed[r].hasClass("filter-select-sort-desc"),p=[];if(a=e.grep(a,function(t,r){return!!t.text||e.inArray(t,a)===r}),h&&f.$headerIndexed[r].hasClass("filter-select-nosort"))return a;for(o=a.length,n=0;n<o;n++)d=(s=a[n]).text?s.text:s,c=(h&&f.parsers&&f.parsers.length&&f.parsers[r].format(d,t,[],r)||d).toString(),c=f.widgetOptions.filter_ignoreCase?c.toLowerCase():c,s.text?(s.parsed=c,p[p.length]=s):p[p.length]={text:s,parsed:c};for(l=f.textSorter||"",p.sort(function(e,a){var s=u?a.parsed:e.parsed,n=u?e.parsed:a.parsed;return h&&"function"==typeof l?l(s,n,!0,r,t):h&&"object"==typeof l&&l.hasOwnProperty(r)?l[r](s,n,!0,r,t):!i.sortNatural||i.sortNatural(s,n)}),a=[],o=p.length,n=0;n<o;n++)a[a.length]=p[n];return a},getOptions:function(t,r,a){var l,s,n,o,c,d,f,h,u=(t=e(t)[0]).config,p=u.widgetOptions,g=[];for(s=0;s<u.$tbodies.length;s++)for(c=u.cache[s],n=u.cache[s].normalized.length,l=0;l<n;l++)if(o=c.row?c.row[l]:c.normalized[l][u.columns].$row[0],!a||!o.className.match(p.filter_filteredRow))if(p.filter_useParsedData||u.parsers[r].parsed||u.$headerIndexed[r].hasClass("filter-parsed")){if(g[g.length]=""+c.normalized[l][r],p.filter_childRows&&p.filter_childByColumn)for(h=c.normalized[l][u.columns].$row.length-1,d=0;d<h;d++)g[g.length]=""+c.normalized[l][u.columns].child[d][r]}else if(g[g.length]=c.normalized[l][u.columns].raw[r],p.filter_childRows&&p.filter_childByColumn)for(h=c.normalized[l][u.columns].$row.length,d=1;d<h;d++)f=c.normalized[l][u.columns].$row.eq(d).children().eq(r),g[g.length]=""+i.getElementText(u,f,r);return g},buildSelect:function(i,l,s,n,o){if(i=e(i)[0],l=parseInt(l,10),i.config.cache&&!e.isEmptyObject(i.config.cache)){var c,d,f,h,u,p,g,m=i.config,b=m.widgetOptions,y=m.$headerIndexed[l],_='<option value="">'+(y.data("placeholder")||y.attr("data-placeholder")||b.filter_placeholder.select||"")+"</option>",v=m.$table.find("thead").find("select."+a.filter+'[data-column="'+l+'"]').val();if(void 0!==s&&""!==s||null!==(s=t.getOptionSource(i,l,o))){if(e.isArray(s)){for(c=0;c<s.length;c++)if((g=s[c]).text){g["data-function-name"]=void 0===g.value?g.text:g.value,_+="<option";for(d in g)g.hasOwnProperty(d)&&"text"!==d&&(_+=" "+d+'="'+g[d].replace(r.quote,"&quot;")+'"');g.value||(_+=' value="'+g.text.replace(r.quote,"&quot;")+'"'),_+=">"+g.text.replace(r.quote,"&quot;")+"</option>"}else""+g!="[object Object]"&&(d=f=g=(""+g).replace(r.quote,"&quot;"),f.indexOf(b.filter_selectSourceSeparator)>=0&&(d=(h=f.split(b.filter_selectSourceSeparator))[0],f=h[1]),_+=""!==g?"<option "+(d===f?"":'data-function-name="'+g+'" ')+'value="'+d+'">'+f+"</option>":"");s=[]}u=(m.$filters?m.$filters:m.$table.children("thead")).find("."+a.filter),b.filter_$externalFilters&&(u=u&&u.length?u.add(b.filter_$externalFilters):b.filter_$externalFilters),(p=u.filter('select[data-column="'+l+'"]')).length&&(p[n?"html":"append"](_),e.isArray(s)||p.append(s).val(v),p.val(v))}}},buildDefault:function(e,r){var a,l,s,n=e.config,o=n.widgetOptions,c=n.columns;for(a=0;a<c;a++)s=!((l=n.$headerIndexed[a]).hasClass("filter-false")||l.hasClass("parser-false")),(l.hasClass("filter-select")||!0===i.getColumnData(e,o.filter_functions,a))&&s&&t.buildSelect(e,a,"",r,l.hasClass(o.filter_onlyAvail))}},r=t.regex,i.getFilters=function(r,i,l,s){var n,o,c,d,f=[],h=r?e(r)[0].config:"",u=h?h.widgetOptions:"";if(!0!==i&&u&&!u.filter_columnFilters||e.isArray(l)&&t.equalFilters(h,l,h.lastSearch))return e(r).data("lastSearch")||[];if(h&&(h.$filters&&(o=h.$filters.find("."+a.filter)),u.filter_$externalFilters&&(o=o&&o.length?o.add(u.filter_$externalFilters):u.filter_$externalFilters),o&&o.length))for(f=l||[],n=0;n<h.columns+1;n++)d=n===h.columns?u.filter_anyColumnSelector+","+u.filter_multipleColumnSelector:'[data-column="'+n+'"]',(c=o.filter(d)).length&&(c=t.getLatestSearch(c),e.isArray(l)?(s&&c.length>1&&(c=c.slice(1)),n===h.columns&&(c=(d=c.filter(u.filter_anyColumnSelector)).length?d:c),c.val(l[n]).trigger("change"+h.namespace)):(f[n]=c.val()||"",n===h.columns?c.slice(1).filter('[data-column*="'+c.attr("data-column")+'"]').val(f[n]):c.slice(1).val(f[n])),n===h.columns&&c.length&&(u.filter_$anyMatch=c));return f},i.setFilters=function(r,a,l,s){var n=r?e(r)[0].config:"",o=i.getFilters(r,!0,a,s);return void 0===l&&(l=!0),n&&l&&(n.lastCombinedFilter=null,n.lastSearch=[],t.searching(n.table,a,s),n.$table.triggerHandler("filterFomatterUpdate")),0!==o.length}}(e),function(e,t){"use strict";function r(t,r){var i=isNaN(r.stickyHeaders_offset)?e(r.stickyHeaders_offset):[];return i.length?i.height()||0:parseInt(r.stickyHeaders_offset,10)||0}var i=e.tablesorter||{};e.extend(i.css,{sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible",stickyHide:"tablesorter-sticky-hidden",stickyWrap:"tablesorter-sticky-wrapper"}),i.addHeaderResizeEvent=function(t,r,i){if((t=e(t)[0]).config){var a={timer:250},l=e.extend({},a,i),s=t.config,n=s.widgetOptions,o=function(e){var t,r,i,a,l,o,c=s.$headers.length;for(n.resize_flag=!0,r=[],t=0;t<c;t++)a=(i=s.$headers.eq(t)).data("savedSizes")||[0,0],l=i[0].offsetWidth,o=i[0].offsetHeight,l===a[0]&&o===a[1]||(i.data("savedSizes",[l,o]),r.push(i[0]));r.length&&!1!==e&&s.$table.triggerHandler("resize",[r]),n.resize_flag=!1};if(clearInterval(n.resize_timer),r)return n.resize_flag=!1,!1;o(!1),n.resize_timer=setInterval(function(){n.resize_flag||o()},l.timer)}},i.addWidget({id:"stickyHeaders",priority:54,options:{stickyHeaders:"",stickyHeaders_appendTo:null,stickyHeaders_attachTo:null,stickyHeaders_xScroll:null,stickyHeaders_yScroll:null,stickyHeaders_offset:0,stickyHeaders_filteredToTop:!0,stickyHeaders_cloneId:"-sticky",stickyHeaders_addResizeEvent:!0,stickyHeaders_includeCaption:!0,stickyHeaders_zIndex:2},format:function(a,l,s){if(!(l.$table.hasClass("hasStickyHeaders")||e.inArray("filter",l.widgets)>=0&&!l.$table.hasClass("hasFilters"))){var n,o,c,d,f=l.$table,h=e(s.stickyHeaders_attachTo||s.stickyHeaders_appendTo),u=l.namespace+"stickyheaders ",p=e(s.stickyHeaders_yScroll||s.stickyHeaders_attachTo||t),g=e(s.stickyHeaders_xScroll||s.stickyHeaders_attachTo||t),m=f.children("thead:first").children("tr").not(".sticky-false").children(),b=f.children("tfoot"),y=r(l,s),_=f.parent().closest("."+i.css.table).hasClass("hasStickyHeaders")?f.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],v=_.length?_.height():0,w=s.$sticky=f.clone().addClass("containsStickyHeaders "+i.css.sticky+" "+s.stickyHeaders+" "+l.namespace.slice(1)+"_extra_table").wrap('<div class="'+i.css.stickyWrap+'">'),x=w.parent().addClass(i.css.stickyHide).css({position:h.length?"absolute":"fixed",padding:parseInt(w.parent().parent().css("padding-left"),10),top:y+v,left:0,visibility:"hidden",zIndex:s.stickyHeaders_zIndex||2}),S=w.children("thead:first"),C="",z=function(e,r){var i,a,l,s,n,o=e.filter(":visible"),c=o.length;for(i=0;i<c;i++)s=r.filter(":visible").eq(i),"border-box"===(n=o.eq(i)).css("box-sizing")?a=n.outerWidth():"collapse"===s.css("border-collapse")?t.getComputedStyle?a=parseFloat(t.getComputedStyle(n[0],null).width):(l=parseFloat(n.css("border-width")),a=n.outerWidth()-parseFloat(n.css("padding-left"))-parseFloat(n.css("padding-right"))-l):a=n.width(),s.css({width:a,"min-width":a,"max-width":a})},$=function(r){return!1===r&&_.length?f.position().left:h.length?parseInt(h.css("padding-left"),10)||0:f.offset().left-parseInt(f.css("margin-left"),10)-e(t).scrollLeft()},F=function(){x.css({left:$(),width:f.outerWidth()}),z(f,w),z(m,d)},R=function(t){if(f.is(":visible")){v=_.length?_.offset().top-p.scrollTop()+_.height():0;var a,n=f.offset(),o=r(l,s),c=e.isWindow(p[0]),d=c?p.scrollTop():_.length?parseInt(_[0].style.top,10):p.offset().top,u=h.length?d:p.scrollTop(),g=s.stickyHeaders_includeCaption?0:f.children("caption").height()||0,m=u+o+v-g,y=f.height()-(x.height()+(b.height()||0))-g,w=m>n.top&&m<n.top+y?"visible":"hidden",S="visible"===w?i.css.stickyVis:i.css.stickyHide,z=!x.hasClass(S),R={visibility:w};h.length&&(z=!0,R.top=c?m-h.offset().top:h.scrollTop()),(a=$(c))!==parseInt(x.css("left"),10)&&(z=!0,R.left=a),R.top=(R.top||0)+(!c&&_.length?_.height():o+v),z&&x.removeClass(i.css.stickyVis+" "+i.css.stickyHide).addClass(S).css(R),(w!==C||t)&&(F(),C=w)}};if(h.length&&!h.css("position")&&h.css("position","relative"),w.attr("id")&&(w[0].id+=s.stickyHeaders_cloneId),w.find("> thead:gt(0), tr.sticky-false").hide(),w.find("> tbody, > tfoot").remove(),w.find("caption").toggle(s.stickyHeaders_includeCaption),d=S.children().children(),w.css({height:0,width:0,margin:0}),d.find("."+i.css.resizer).remove(),f.addClass("hasStickyHeaders").bind("pagerComplete"+u,function(){F()}),i.bindEvents(a,S.children().children("."+i.css.header)),s.stickyHeaders_appendTo?e(s.stickyHeaders_appendTo).append(x):f.after(x),l.onRenderHeader)for(o=(c=S.children("tr").children()).length,n=0;n<o;n++)l.onRenderHeader.apply(c.eq(n),[n,l,w]);g.add(p).unbind("scroll resize ".split(" ").join(u).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(u),function(e){R("resize"===e.type)}),l.$table.unbind("stickyHeadersUpdate"+u).bind("stickyHeadersUpdate"+u,function(){R(!0)}),s.stickyHeaders_addResizeEvent&&i.addHeaderResizeEvent(a),f.hasClass("hasFilters")&&s.filter_columnFilters&&(f.bind("filterEnd"+u,function(){var r=e(document.activeElement).closest("td"),a=r.parent().children().index(r);x.hasClass(i.css.stickyVis)&&s.stickyHeaders_filteredToTop&&(t.scrollTo(0,f.position().top),a>=0&&l.$filters&&l.$filters.eq(a).find("a, select, input").filter(":visible").focus())}),i.filter.bindSearch(f,d.find("."+i.css.filter)),s.filter_hideFilters&&i.filter.hideFilters(l,w)),s.stickyHeaders_addResizeEvent&&f.bind("resize"+l.namespace+"stickyheaders",function(){F()}),R(!0),f.triggerHandler("stickyHeadersInit")}},remove:function(r,a,l){var s=a.namespace+"stickyheaders ";a.$table.removeClass("hasStickyHeaders").unbind("pagerComplete resize filterEnd stickyHeadersUpdate ".split(" ").join(s).replace(/\s+/g," ")).next("."+i.css.stickyWrap).remove(),l.$sticky&&l.$sticky.length&&l.$sticky.remove(),e(t).add(l.stickyHeaders_xScroll).add(l.stickyHeaders_yScroll).add(l.stickyHeaders_attachTo).unbind("scroll resize ".split(" ").join(s).replace(/\s+/g," ")),i.addHeaderResizeEvent(r,!0)}})}(e,window),function(e,t){"use strict";var r=e.tablesorter||{};e.extend(r.css,{resizableContainer:"tablesorter-resizable-container",resizableHandle:"tablesorter-resizable-handle",resizableNoSelect:"tablesorter-disableSelection",resizableStorage:"tablesorter-resizable"}),e(function(){var t="<style>body."+r.css.resizableNoSelect+" { -ms-user-select: none; -moz-user-select: -moz-none;-khtml-user-select: none; -webkit-user-select: none; user-select: none; }."+r.css.resizableContainer+" { position: relative; height: 1px; }."+r.css.resizableHandle+" { position: absolute; display: inline-block; width: 8px;top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }</style>";e("head").append(t)}),r.resizable={init:function(t,i){if(!t.$table.hasClass("hasResizable")){t.$table.addClass("hasResizable");var a,l,s,n,o=t.$table,c=o.parent(),d=parseInt(o.css("margin-top"),10),f=i.resizable_vars={useStorage:r.storage&&!1!==i.resizable,$wrap:c,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===c.css("overflow")||"scroll"===c.css("overflow")||"auto"===c.css("overflow-x")||"scroll"===c.css("overflow-x"),storedSizes:[]};for(r.resizableReset(t.table,!0),f.tableWidth=o.width(),f.fullWidth=Math.abs(c.width()-f.tableWidth)<20,f.useStorage&&f.overflow&&(r.storage(t.table,"tablesorter-table-original-css-width",f.tableWidth),n=r.storage(t.table,"tablesorter-table-resized-width")||"auto",r.resizable.setWidth(o,n,!0)),i.resizable_vars.storedSizes=s=(f.useStorage?r.storage(t.table,r.css.resizableStorage):[])||[],r.resizable.setWidths(t,i,s),r.resizable.updateStoredSizes(t,i),i.$resizable_container=e('<div class="'+r.css.resizableContainer+'">').css({top:d}).insertBefore(o),l=0;l<t.columns;l++)a=t.$headerIndexed[l],n=r.getColumnData(t.table,t.headers,l),"false"===r.getData(a,n,"resizable")||e('<div class="'+r.css.resizableHandle+'">').appendTo(i.$resizable_container).attr({"data-column":l,unselectable:"on"}).data("header",a).bind("selectstart",!1);r.resizable.bindings(t,i)}},updateStoredSizes:function(e,t){var r,i,a=e.columns,l=t.resizable_vars;for(l.storedSizes=[],r=0;r<a;r++)i=e.$headerIndexed[r],l.storedSizes[r]=i.is(":visible")?i.width():0},setWidth:function(e,t,r){e.css({width:t,"min-width":r?t:"","max-width":r?t:""})},setWidths:function(t,i,a){var l,s,n=i.resizable_vars,o=e(t.namespace+"_extra_headers"),c=t.$table.children("colgroup").children("col");if((a=a||n.storedSizes||[]).length){for(l=0;l<t.columns;l++)r.resizable.setWidth(t.$headerIndexed[l],a[l],n.overflow),o.length&&(s=o.eq(l).add(c.eq(l)),r.resizable.setWidth(s,a[l],n.overflow));(s=e(t.namespace+"_extra_table")).length&&!r.hasWidget(t.table,"scroller")&&r.resizable.setWidth(s,t.$table.outerWidth(),n.overflow)}},setHandlePosition:function(t,i){var a,l=t.$table.height(),s=i.$resizable_container.children(),n=Math.floor(s.width()/2);r.hasWidget(t.table,"scroller")&&(l=0,t.$table.closest("."+r.css.scrollerWrap).children().each(function(){var t=e(this);l+=t.filter('[style*="height"]').length?t.height():t.children("table").height()})),!i.resizable_includeFooter&&t.$table.children("tfoot").length&&(l-=t.$table.children("tfoot").height()),a=t.$table.position().left,s.each(function(){var s=e(this),o=parseInt(s.attr("data-column"),10),c=t.columns-1,d=s.data("header");d&&(!d.is(":visible")||!i.resizable_addLastColumn&&r.resizable.checkVisibleColumns(t,o)?s.hide():(o<c||o===c&&i.resizable_addLastColumn)&&s.css({display:"inline-block",height:l,left:d.position().left-a+d.outerWidth()-n}))})},checkVisibleColumns:function(e,t){var r,i=0;for(r=t+1;r<e.columns;r++)i+=e.$headerIndexed[r].is(":visible")?1:0;return 0===i},toggleTextSelection:function(t,i,a){var l=t.namespace+"tsresize";i.resizable_vars.disabled=a,e("body").toggleClass(r.css.resizableNoSelect,a),a?e("body").attr("unselectable","on").bind("selectstart"+l,!1):e("body").removeAttr("unselectable").unbind("selectstart"+l)},bindings:function(i,a){var l=i.namespace+"tsresize";a.$resizable_container.children().bind("mousedown",function(t){var l,s=a.resizable_vars,n=e(i.namespace+"_extra_headers"),o=e(t.target).data("header");l=parseInt(o.attr("data-column"),10),s.$target=o=o.add(n.filter('[data-column="'+l+'"]')),s.target=l,s.$next=t.shiftKey||a.resizable_targetLast?o.parent().children().not(".resizable-false").filter(":last"):o.nextAll(":not(.resizable-false)").eq(0),l=parseInt(s.$next.attr("data-column"),10),s.$next=s.$next.add(n.filter('[data-column="'+l+'"]')),s.next=l,s.mouseXPosition=t.pageX,r.resizable.updateStoredSizes(i,a),r.resizable.toggleTextSelection(i,a,!0)}),e(document).bind("mousemove"+l,function(e){var t=a.resizable_vars;t.disabled&&0!==t.mouseXPosition&&t.$target&&(a.resizable_throttle?(clearTimeout(t.timer),t.timer=setTimeout(function(){r.resizable.mouseMove(i,a,e)},isNaN(a.resizable_throttle)?5:a.resizable_throttle)):r.resizable.mouseMove(i,a,e))}).bind("mouseup"+l,function(){a.resizable_vars.disabled&&(r.resizable.toggleTextSelection(i,a,!1),r.resizable.stopResize(i,a),r.resizable.setHandlePosition(i,a))}),e(t).bind("resize"+l+" resizeEnd"+l,function(){r.resizable.setHandlePosition(i,a)}),i.$table.bind("columnUpdate pagerComplete resizableUpdate ".split(" ").join(l+" "),function(){r.resizable.setHandlePosition(i,a)}).bind("resizableReset"+l,function(){r.resizableReset(i.table)}).find("thead:first").add(e(i.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+l,function(){var e=0===a.resizable_vars.storedSizes.length;return r.resizableReset(i.table),r.resizable.setHandlePosition(i,a),a.resizable_vars.storedSizes=[],e})},mouseMove:function(t,i,a){if(0!==i.resizable_vars.mouseXPosition&&i.resizable_vars.$target){var l,s=0,n=i.resizable_vars,o=n.$next,c=n.storedSizes[n.target],d=a.pageX-n.mouseXPosition;if(n.overflow){if(c+d>0){for(n.storedSizes[n.target]+=d,r.resizable.setWidth(n.$target,n.storedSizes[n.target],!0),l=0;l<t.columns;l++)s+=n.storedSizes[l];r.resizable.setWidth(t.$table.add(e(t.namespace+"_extra_table")),s)}o.length||(n.$wrap[0].scrollLeft=t.$table.width())}else n.fullWidth?(n.storedSizes[n.target]+=d,n.storedSizes[n.next]-=d,r.resizable.setWidths(t,i)):(n.storedSizes[n.target]+=d,r.resizable.setWidths(t,i));n.mouseXPosition=a.pageX,t.$table.triggerHandler("stickyHeadersUpdate")}},stopResize:function(e,t){var i=t.resizable_vars;r.resizable.updateStoredSizes(e,t),i.useStorage&&(r.storage(e.table,r.css.resizableStorage,i.storedSizes),r.storage(e.table,"tablesorter-table-resized-width",e.$table.width())),i.mouseXPosition=0,i.$target=i.$next=null,e.$table.triggerHandler("stickyHeadersUpdate"),e.$table.triggerHandler("resizableComplete")}},r.addWidget({id:"resizable",priority:40,options:{resizable:!0,resizable_addLastColumn:!1,resizable_includeFooter:!0,resizable_widths:[],resizable_throttle:!1,resizable_targetLast:!1},init:function(e,t,i,a){r.resizable.init(i,a)},format:function(e,t,i){r.resizable.setHandlePosition(t,i)},remove:function(t,i,a,l){if(a.$resizable_container){var s=i.namespace+"tsresize";i.$table.add(e(i.namespace+"_extra_table")).removeClass("hasResizable").children("thead").unbind("contextmenu"+s),a.$resizable_container.remove(),r.resizable.toggleTextSelection(i,a,!1),r.resizableReset(t,l),e(document).unbind("mousemove"+s+" mouseup"+s)}}}),r.resizableReset=function(t,i){e(t).each(function(){var e,a,l=this.config,s=l&&l.widgetOptions,n=s.resizable_vars;if(t&&l&&l.$headerIndexed.length){for(n.overflow&&n.tableWidth&&(r.resizable.setWidth(l.$table,n.tableWidth,!0),n.useStorage&&r.storage(t,"tablesorter-table-resized-width",n.tableWidth)),e=0;e<l.columns;e++)a=l.$headerIndexed[e],s.resizable_widths&&s.resizable_widths[e]?r.resizable.setWidth(a,s.resizable_widths[e],n.overflow):a.hasClass("resizable-false")||r.resizable.setWidth(a,"",n.overflow);l.$table.triggerHandler("stickyHeadersUpdate"),r.storage&&!i&&r.storage(this,r.css.resizableStorage,[])}})}}(e,window),function(e){"use strict";function t(t){var r=i.storage(t.table,"tablesorter-savesort");return r&&r.hasOwnProperty("sortList")&&e.isArray(r.sortList)?r.sortList:[]}function r(e,r){return(r||t(e)).join(",")!==e.sortList.join(",")}var i=e.tablesorter||{};i.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(e,t,r,i){t.format(e,r,i,!0)},format:function(e,a,l,s){var n,o=a.$table,c=!1!==l.saveSort,d={sortList:a.sortList},f=i.debug(a,"saveSort");f&&(n=new Date),o.hasClass("hasSaveSort")?c&&e.hasInitialized&&i.storage&&r(a)&&(i.storage(e,"tablesorter-savesort",d),f&&console.log("saveSort >> Saving last sort: "+a.sortList+i.benchmark(n))):(o.addClass("hasSaveSort"),d="",i.storage&&(d=t(a),f&&console.log('saveSort >> Last sort loaded: "'+d+'"'+i.benchmark(n)),o.bind("saveSortReset",function(t){t.stopPropagation(),i.storage(e,"tablesorter-savesort","")})),s&&d&&d.length>0?a.sortList=d:e.hasInitialized&&d&&d.length>0&&r(a,d)&&i.sortOn(a,d))},remove:function(e,t){t.$table.removeClass("hasSaveSort"),i.storage&&i.storage(e,"tablesorter-savesort","")}})}(e),e.tablesorter});
js/wpadmin.js CHANGED
@@ -1054,23 +1054,98 @@ var WP_Optimize = function (send_command) {
1054
  });
1055
  });
1056
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1057
  /**
1058
- * Send check_overdue_crons command and output warning if need.
 
 
1059
  */
1060
- setTimeout(function() {
1061
- send_command('check_overdue_crons', null, function (resp) {
1062
- if (resp && resp.hasOwnProperty('m')) {
1063
- $('#wpo_settings_warnings').append(resp.m);
 
 
 
 
 
 
 
1064
  }
1065
  });
1066
- }, 11000);
1067
 
1068
- return {
1069
- send_command: send_command,
1070
- optimization_get_info: optimization_get_info,
1071
- take_a_backup_with_updraftplus: take_a_backup_with_updraftplus,
1072
- save_auto_backup_options: save_auto_backup_options
 
 
 
 
 
1073
  }
 
1074
  /**
1075
  * Validate loggers settings.
1076
  *
@@ -1166,6 +1241,7 @@ var WP_Optimize = function (send_command) {
1166
 
1167
  return {
1168
  send_command: send_command,
 
1169
  take_a_backup_with_updraftplus: take_a_backup_with_updraftplus,
1170
  save_auto_backup_options: save_auto_backup_options
1171
  }
1054
  });
1055
  });
1056
 
1057
+ // Handle repair table click
1058
+ $('#wpoptimize_table_list').on('click', '.run-single-table-repair', function() {
1059
+ var btn = $(this),
1060
+ spinner = btn.next(),
1061
+ action_done_icon = spinner.next(),
1062
+ table_name = btn.data('table'),
1063
+ data = {
1064
+ optimization_id: 'repairtables',
1065
+ optimization_table: table_name
1066
+ };
1067
+
1068
+ spinner.removeClass('visibility-hidden');
1069
+
1070
+ send_command('do_optimization', { optimization_id: 'repairtables', data: data }, function (response) {
1071
+ if (response.result.meta.success) {
1072
+ var row = btn.closest('tr'),
1073
+ tableinfo = response.result.meta.tableinfo;
1074
+
1075
+ btn.prop('disabled', false);
1076
+ spinner.addClass('visibility-hidden');
1077
+ action_done_icon.show().removeClass('visibility-hidden');
1078
+
1079
+ // update table information in row.
1080
+ $('td:eq(2)', row).text(tableinfo.rows);
1081
+ $('td:eq(3)', row).text(tableinfo.data_size);
1082
+ $('td:eq(4)', row).text(tableinfo.index_size);
1083
+ $('td:eq(5)', row).text(tableinfo.type);
1084
+
1085
+ if (tableinfo.is_optimizable) {
1086
+ $('td:eq(6)', row).html(['<span color="', tableinfo.overhead > 0 ? '#0000FF' : '#004600', '">', tableinfo.overhead,'</span>'].join(''));
1087
+ } else {
1088
+ $('td:eq(6)', row).html('<span color="#0000FF">-</span>');
1089
+ }
1090
+
1091
+ // keep visible results from previous operation for one second and show optimize button if possible.
1092
+ setTimeout(function() {
1093
+ var parent_td = btn.closest('td'),
1094
+ btn_wrap = btn.closest('.wpo_button_wrap');
1095
+
1096
+ // remove Repair button and show Optimize button.
1097
+ btn_wrap.fadeOut('fast', function() {
1098
+ btn_wrap.closest('.wpo_button_wrap').remove();
1099
+
1100
+ // if table is optimizable then show OPTIMIZE button.
1101
+ if (tableinfo.is_optimizable) {
1102
+ $('.wpo_button_wrap', parent_td).removeClass('wpo_hidden');
1103
+ }
1104
+ });
1105
+
1106
+ change_actions_column_visibility();
1107
+ }, 1000);
1108
+ } else {
1109
+ btn.prop('disabled', false);
1110
+ spinner.addClass('visibility-hidden');
1111
+ alert(wpoptimize.table_was_not_repaired.replace('%s', table_name));
1112
+ }
1113
+ });
1114
+ });
1115
+
1116
+ change_actions_column_visibility();
1117
+
1118
  /**
1119
+ * Show or hide actions column if need.
1120
+ *
1121
+ * @return void
1122
  */
1123
+ function change_actions_column_visibility() {
1124
+ var table = $('#wpoptimize_table_list'),
1125
+ hideLastColumn = true;
1126
+
1127
+ // check if any button exists in the actions column.
1128
+ $('tr', table).each(function() {
1129
+ var row = $(this);
1130
+
1131
+ if ($('button', row).length > 0) {
1132
+ hideLastColumn = false;
1133
+ return false;
1134
  }
1135
  });
 
1136
 
1137
+ // hide or show last column
1138
+ $('tr', table).each(function() {
1139
+ var row = $(this);
1140
+
1141
+ if (hideLastColumn) {
1142
+ $('td:last, th:last', row).hide();
1143
+ } else {
1144
+ $('td:last, th:last', row).show();
1145
+ }
1146
+ });
1147
  }
1148
+
1149
  /**
1150
  * Validate loggers settings.
1151
  *
1241
 
1242
  return {
1243
  send_command: send_command,
1244
+ optimization_get_info: optimization_get_info,
1245
  take_a_backup_with_updraftplus: take_a_backup_with_updraftplus,
1246
  save_auto_backup_options: save_auto_backup_options
1247
  }
js/wpadmin.min.js CHANGED
@@ -1 +1 @@
1
- wp_optimize_send_command_admin_ajax=function(t,i,e,o){o="undefined"==typeof o||o;var n={action:"wp_optimize_ajax",subaction:t,nonce:wp_optimize_ajax_nonce,data:i};jQuery.post(ajaxurl,n,function(t){if(o){try{var i=JSON.parse(t)}catch(n){return console.log(n),console.log(t),void alert(wpoptimize.error_unexpected_response)}"undefined"!=typeof e&&e(i)}else"undefined"!=typeof e&&e(t)})},jQuery(document).ready(function(t){WP_Optimize=WP_Optimize(wp_optimize_send_command_admin_ajax)});var WP_Optimize=function(t){function i(){if(k("#enable-schedule").length){var t=k("#enable-schedule").is(":checked");t?k("#wp-optimize-auto-options").css("opacity","1"):k("#wp-optimize-auto-options").css("opacity","0.5")}}function e(t,i,e){i="undefined"==typeof i?"#wp-optimize-wrap":i,e="undefined"==typeof e?15:e,k(t).hide().prependTo(i).slideDown("slow").delay(1e3*e).slideUp("slow",function(){k(this).remove()})}function o(i,o){var n={type:i,enable:o?1:0};k("#"+i+"_spinner").show(),t("enable_or_disable_feature",n,function(t){if(k("#"+i+"_spinner").hide(),t&&t.hasOwnProperty("output"))for(var o=0,n=t.output.length;o<n;o++){var a='<div class="updated">'+t.output[o]+"</div>";e(a,"#actions-results-area")}})}function n(t){var i="",t="undefined"==typeof t?"string":t;return"object"==t?i=k("#wp-optimize-nav-tab-contents-settings form input[name!='action'], #wp-optimize-nav-tab-contents-settings form textarea, #wp-optimize-nav-tab-contents-settings form select, #wp-optimize-nav-tab-contents-optimize input[type='checkbox'], .wp-optimize-nav-tab-contents input[name^='enable-auto-backup-']").serializeJSON({useIntKeysAsArrayIndex:!0}):(i=k("#wp-optimize-nav-tab-contents-settings form input[name!='action'], #wp-optimize-nav-tab-contents-settings form textarea, #wp-optimize-nav-tab-contents-settings form select, #wp-optimize-nav-tab-contents-optimize input[type='checkbox'], .wp-optimize-nav-tab-contents input[name^='enable-auto-backup-']").serialize(),k.each(k('#wp-optimize-nav-tab-contents-settings form input[type=checkbox], .wp-optimize-nav-tab-contents input[name^="enable-auto-backup-"]').filter(function(t){return 0==k(this).prop("checked")}),function(t,e){var o="0";i+="&"+k(e).attr("name")+"="+o})),i}function a(){t("optimizations_done",{},function(){})}function s(){if(!j.get_lock())return void(x>0&&console.log("WP-Optimize: process_queue(): queue is currently locked - exiting"));x>0&&console.log("WP-Optimize: process_queue(): got queue lock");var i=j.peek();return"object"==typeof i?(data=i,i=i.optimization_id):data={},"undefined"==typeof i?(x>0&&console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting"),j.unlock(),void a()):(x>0&&console.log("WP-Optimize: process_queue(): processing item: "+i),j.dequeue(),k(document).trigger(["do_optimization_",i,"_start"].join("")),void t("do_optimization",{optimization_id:i,data:data},function(t){if(k("#optimization_spinner_"+i).hide(),k("#optimization_checkbox_"+i).show(),k(".optimization_button_"+i).prop("disabled",!1),k(document).trigger(["do_optimization_",i,"_done"].join(""),t),t){for(var e="",o=0,n=t.errors.length;o<n;o++)e+='<span class="error">'+t.errors[o]+"</span><br>";for(var o=0,n=t.messages.length;o<n;o++)e+=t.errors[o]+"<br>";for(var o=0,n=t.result.output.length;o<n;o++)e+=t.result.output[o]+"<br>";if(k("#optimization_info_"+i).html(e),t.hasOwnProperty("status_box_contents")&&k("#wp_optimize_status_box").css("opacity","1").find(".inside").html(t.status_box_contents),t.hasOwnProperty("table_list")&&k("#wpoptimize_table_list tbody").html(k(t.table_list).find("tbody").html()),t.hasOwnProperty("total_size")&&k("#optimize_current_db_size").html(t.total_size),"optimizetables"==i&&data.optimization_table&&(j.is_empty()?(k("#optimization_spinner_"+i).hide(),k("#optimization_checkbox_"+i).show(),k(".optimization_button_"+i).prop("disabled",!1),k("#optimization_info_"+i).html(wpoptimize.optimization_complete)):(k("#optimization_checkbox_"+i).hide(),k("#optimization_spinner_"+i).show(),k(".optimization_button_"+i).prop("disabled",!0))),t.result.meta&&t.result.meta.hasOwnProperty("awaiting_mod")){var a=t.result.meta.awaiting_mod;a>0?k("#adminmenu .awaiting-mod .pending-count").remove(a):k("#adminmenu .awaiting-mod").remove()}}setTimeout(function(){j.unlock(),s()},10)}))}function p(t){var i=k("#wp-optimize-nav-tab-contents-optimize .wp-optimize-settings-"+t);if(i||console.log("do_optimization: row corresponding to this optimization ("+t+") not found"),1!=k(".optimization_button_"+t).prop("disabled")){if(k("#optimization_checkbox_"+t).hide(),k("#optimization_spinner_"+t).show(),k(".optimization_button_"+t).prop("disabled",!0),k("#optimization_info_"+t).html("..."),"optimizetables"==t){var e=k("#wpoptimize_table_list #the-list tr");k(e).each(function(i){var e=k(this).find("td");if(table_type=e.eq(5).text(),table=e.eq(1).text(),optimizable=e.eq(5).data("optimizable"),""!=table&&("1"==optimizable||R)){var o={optimization_id:t,optimization_table:e.eq(1).text(),optimization_table_type:table_type,optimization_force:R};j.enqueue(o)}})}else j.enqueue(t);s()}}function r(i){k("#wpo_settings_sites_list").length?t("save_site_settings",{"wpo-sites":_()},function(){i&&i()}):i&&i()}function _(){var t=[];return k('#wpo_settings_sites_list input[type="checkbox"]').each(function(){var i=k(this);i.is(":checked")&&t.push(i.attr("value"))}),t}function l(){var t=!1;k("#enable-auto-backup").is(":checked")&&(t=!0),u(),1==t?c(f):f()}function c(t){"function"==typeof updraft_backupnow_inpage_go?updraft_backupnow_inpage_go(function(){k("#updraft-backupnow-inpage-modal").dialog("close"),t&&t()},"","autobackup",0,1,0,wpoptimize.automatic_backup_before_optimizations):t&&t()}function u(){var i=n("object");i.auto_backup=k("#enable-auto-backup").is(":checked"),t("save_auto_backup_option",i)}function d(t,i,e,o){t.on("click",function(){return i.hasClass("wpo_always_visible")||i.toggleClass("wpo_hidden"),!1}),e.on("change",function(){e.is(":checked")?o.prop("checked",!0):o.prop("checked",!1),m(e,o)}),o.on("change",function(){m(e,o)}),m(e,o)}function m(t,i){var e=0,o=0;if(i.each(function(){k(this).is(":checked")&&o++,e++}),t.next().is("label")&&t.next().data("label")){var n=t.next(),a=n.data("label");e==o?n.text(a):n.text(a.replace("all",[o," of ",e].join("")))}e==o?t.prop("checked",!0):t.prop("checked",!1)}function f(){$optimizations=k("#optimizations_list .optimization_checkbox:checked"),$optimizations.sort(function(t,i){return t=k(t).closest(".wp-optimize-settings").data("optimization_run_sort_order"),i=k(i).closest(".wp-optimize-settings").data("optimization_run_sort_order"),t>i?1:t<i?-1:0});var i={};$optimizations.each(function(t){var e=k(this).closest(".wp-optimize-settings").data("optimization_id");return e?(i[e]={active:1},void p(e)):void console.log("Optimization ID corresponding to pressed button not found")}),t("save_manual_run_optimization_options",i)}function g(t){k(".run-single-table-optimization").each(function(){var i=k(this);i.data("disabled")&&(t?i.prop("disabled",!1):i.prop("disabled",!0))})}function w(t){var i,e,o;if(t)for(i in t)t.hasOwnProperty(i)&&(e=["#wp-optimize-settings-",t[i].dom_id].join(""),o=t[i].info?t[i].info.join("<br>"):"",k(e+" .wp-optimize-settings-optimization-info").html(o))}function b(){var i=["",_().join("_")].join("");Y.hasOwnProperty(i)?w(Y[i]):t("get_optimizations_info",{"wpo-sites":_()},function(t){t&&(Y[i]=t,w(t))})}function h(i){var e=k("#wpo_import_spinner"),o=k("#wpo_import_success_message"),n=k("#wpo_import_error_message");e.show(),t("import_settings",{settings:i},function(t){e.hide(),t&&t.errors&&t.errors.length?(n.text(t.errors.join("<br>")),n.slideDown()):t&&t.messages&&t.messages.length&&(o.text(t.messages.join("<br>")),o.slideDown(),setTimeout(function(){window.location.reload()},500)),k("#wpo_import_settings_btn").prop("disabled",!1)})}function z(t,i){var e=document.body.appendChild(document.createElement("a")),o=new Date,n=o.getFullYear(),a=o.getMonth()<10?["0",o.getMonth()].join(""):o.getMonth(),s=o.getDay()<10?["0",o.getDay()].join(""):o.getDay();i=i?i:["wpo-settings-",n,"-",a,"-",s,".json"].join(""),e.setAttribute("download",i),e.setAttribute("style","display:none;"),e.setAttribute("href","data:text/json;charset=UTF-8,"+encodeURIComponent(JSON.stringify(t))),e.click()}function v(){var t=!0;return k(".wpo_logger_addition_option, .wpo_logger_type").each(function(){y(k(this),!0)?k(this).removeClass("wpo_error_field"):(t=!1,k(this).addClass("wpo_error_field"))}),t?k("#wp-optimize-logger-settings .save_settings_reminder").slideUp():k("#wp-optimize-settings-save-results").show().addClass("wpo_alert_notice").text(wpoptimize.fill_all_settings_fields).delay(5e3).fadeOut(3e3,function(){k(this).removeClass("wpo_alert_notice")}),t}function y(t,i){var e=t.val(),o=t.data("validate");if(!o&&i)return""!=k.trim(e);if(o&&!i&&""==k.trim(e))return!0;var n=!0;switch(o){case"email":for(var a=/\S+@\S+\.\S+/,s=e.split(","),p="",r=0;r<s.length;r++)p=k.trim(s[r]),""!=p&&a.test(p)||(n=!1);break;case"url":var a=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i;n=a.test(e)}return n}var k=jQuery,x=0,j=new Updraft_Queue;i(),k("#enable-schedule").change(function(){i()});var O=k("#wpoptimize_table_list_filter"),P=k("#wpoptimize_table_list"),D=k("#wpoptimize_table_list tbody:last"),q=k("#wpoptimize_table_list_tables_not_found");k(function(){P.tablesorter({theme:"default",widgets:["zebra","rows","filter"],cssInfoBlock:"tablesorter-no-sort",headers:{7:{sorter:!1}},widgetOptions:{filter_external:O,filter_defaultFilter:{2:"~{query}"}}}),P.on("filterEnd",function(){var t=k.trim(O.val());""==t?D.show():D.hide(),0==k("#the-list tr:visible",P).length?q.show():q.hide()})}),k("#wp-optimize-disable-enable-trackbacks-enable").click(function(){o("trackbacks",!0)}),k("#wp-optimize-disable-enable-trackbacks-disable").click(function(){o("trackbacks",!1)}),k("#wp-optimize-disable-enable-comments-enable").click(function(){o("comments",!0)}),k("#wp-optimize-disable-enable-comments-disable").click(function(){o("comments",!1)}),k("#wp-optimize-nav-tab-wrapper .nav-tab").click(function(t){var i=k(this).attr("id");if(i&&"wp-optimize-nav-tab-"==i.substring(0,20)){var i=i.substring(20);t.preventDefault(),k("#wp-optimize-nav-tab-wrapper .nav-tab:not(#wp-optimize-nav-tab-"+i+")").removeClass("nav-tab-active"),k(this).addClass("nav-tab-active"),k("#wp-optimize-wrap .wp-optimize-nav-tab-contents:not(#wp-optimize-nav-tab-contents-"+i+")").hide(),k("#wp-optimize-nav-tab-contents-"+i).show(),"tables"==i&&k("#wpoptimize_table_list").trigger("applyWidgets")}}),k("#wp-optimize-nav-tab-contents-optimize").on("click","button.wp-optimize-settings-optimization-run-button",function(){var t=k(this).closest(".wp-optimize-settings").data("optimization_id");return t?void(1!=k(".optimization_button_"+t).prop("disabled")&&(k(".optimization_button_"+t).prop("disabled",!0),r(function(){k(".optimization_button_"+t).prop("disabled",!1),p(t)}))):void console.log("Optimization ID corresponding to pressed button not found")}),k("#wp-optimize-nav-tab-contents-optimize").on("click","#wp-optimize",function(t){var i=k(this);t.preventDefault(),i.prop("disabled",!0),r(function(){i.prop("disabled",!1),l()})});var C=k("#wpo_settings_sites_list"),S=C.find("ul").first(),T=k('input[type="checkbox"]',S),W=C.find("#wpo_all_sites"),A=k("#wpo_sitelist_show_moreoptions"),I=k("#wpo_sitelist_moreoptions"),U=k("#wpo_settings_sites_list_cron"),Q=U.find("ul").first(),$=k('input[type="checkbox"]',Q),F=U.find("#wpo_all_sites_cron"),J=k("#wpo_sitelist_show_moreoptions_cron"),M=k("#wpo_sitelist_moreoptions_cron");d(A,I,W,T);var N=0;k([W,T]).each(function(){k(this).on("change",function(){N++,setTimeout(function(){N--,0==N&&b()},1e3)})}),d(J,M,F,$),k("#wp_optimize_table_list_refresh").click(function(){k("#wpoptimize_table_list tbody").css("opacity","0.5"),t("get_table_list",!1,function(t){if(t.hasOwnProperty("table_list")){var i=!0,e=function(t){k("#wpoptimize_table_list tbody").css("opacity","1")};k("#wpoptimize_table_list").trigger("updateAll",[i,e])}t.hasOwnProperty("total_size")&&k("#optimize_current_db_size").html(t.total_size),g(K.is(":checked"))})}),k("#settings_form").on("click","#wp-optimize-settings-save",function(i){if(!v())return!1;i.preventDefault(),k("#save_spinner").show();var o=n();t("save_settings",o,function(t){if(k("#save_spinner").hide(),k("#save_done").show().delay(5e3).fadeOut(),t&&t.hasOwnProperty("save_results")&&t.save_results&&t.save_results.hasOwnProperty("errors")){for(var i=0,o=t.save_results.errors.length;i<o;i++){var n='<div class="error">'+t.errors[i]+"</div>";e(n,"#wp-optimize-settings-save-results")}console.log(t.save_results.messages)}t&&t.hasOwnProperty("status_box_contents")&&k("#wp_optimize_status_box .inside").html(t.status_box_contents),t&&t.hasOwnProperty("optimizations_table")&&k("#optimizations_list").replaceWith(t.optimizations_table),t.save_results.refresh&&location.reload()})}),k("#wp_optimize_status_box").on("click","#wp_optimize_status_box_refresh",function(i){i.preventDefault(),k("#wp_optimize_status_box").css("opacity","0.5"),t("get_status_box_contents",null,function(t){k("#wp_optimize_status_box").css("opacity","1").find(".inside").html(t)})});var E=k("#innodb_force_optimize"),R=E.is(":checked"),B=E.closest("tr"),K=k("#innodb_force_optimize_single");E.on("change",function(){k('button, input[type="checkbox"]',B).each(function(){R=E.is(":checked");var t=k(this);t.data("disabled")&&(R?t.prop("disabled",!1):t.prop("disabled",!0))})}),k("#wpoptimize_table_list").on("click",".run-single-table-optimization",function(){var i=k(this),e=i.next(),o=e.next(),n=i.data("table"),a=i.data("type"),s={optimization_id:"optimizetables",optimization_table:n,optimization_table_type:a};K.is(":checked")&&(s.optimization_force=!0),e.removeClass("visibility-hidden"),t("do_optimization",{optimization_id:"optimizetables",data:s},function(){i.prop("disabled",!1),e.addClass("visibility-hidden"),o.show().removeClass("visibility-hidden").delay(3e3).fadeOut("slow")})}),K.change(function(){g(K.is(":checked"))}),g(K.is(":checked"));var Y={};setTimeout(function(){t("check_overdue_crons",null,function(t){t&&t.hasOwnProperty("m")&&k("#wpo_settings_warnings").append(t.m)})},11e3),k("#wpo_import_settings_btn").on("click",function(t){var i=k("#wpo_import_settings_file"),e=i.val(),o=i[0].files[0],n=new FileReader;return k("#wpo_import_settings_btn").prop("disabled",!0),/\.json$/.test(e)?(n.onload=function(){h(this.result)},n.readAsText(o),!1):(t.preventDefault(),k("#wpo_import_settings_btn").prop("disabled",!1),k("#wpo_import_error_message").text(wpoptimize.please_select_settings_file).slideDown(),!1)}),k("#wpo_import_settings_file").on("change",function(){k("#wpo_import_error_message").slideUp()}),k("#wpo_export_settings_btn").on("click",function(t){return z(n("object")),!1});var G=function(i,e,o){t("get_optimization_info",{optimization_id:e,data:o},function(t){var o=t&&t.result&&t.result.meta?t.result.meta:{},n=t&&t.result&&t.result.output?t.result.output.join("<br>"):"...";k(document).trigger(["optimization_get_info_",e].join(""),n),i.html(n),o.finished?k(document).trigger(["optimization_get_info_",e,"_done"].join(""),t):setTimeout(function(){G(i,e,o)},1)})};return k(document).ready(function(){k(".wp-optimize-optimization-info-ajax").each(function(){var t=k(this),i=t.parent(),e=t.data("id");k(document).trigger(["optimization_get_info_",e,"_start"].join("")),G(i,e,{support_ajax_get_info:!0})})}),setTimeout(function(){t("check_overdue_crons",null,function(t){t&&t.hasOwnProperty("m")&&k("#wpo_settings_warnings").append(t.m)})},11e3),{send_command:t,optimization_get_info:G,take_a_backup_with_updraftplus:c,save_auto_backup_options:u}};jQuery(document).ready(function(t){function i(i){var e=["#",i.data("additional")].join("");i.is(":checked")?t(e).show():t(e).hide()}function e(){var i=t("#wp-optimize-logger-settings .save_settings_reminder");i.is(":visible")||i.slideDown("normal")}function o(){t(".wpo_logger_type").each(function(){n(t(this))})}function n(i){var e,o,n=a();for(e in n)o=n[e],wpoptimize.loggers_classes_info[o].allow_multiple?t('option[value="'+o+'"]',i).show():t('option[value="'+o+'"]',i).hide()}function a(){var i=[];return t(".wpo_logging_row, .wpo_logger_type").each(function(){var e=t(this).is("select")?t(this).val():t(this).data("id");e&&i.push(e)}),i}function s(){var t,i=['<option value="">Select destination</option>'];for(t in wpoptimize.loggers_classes_info)wpoptimize.loggers_classes_info.hasOwnProperty(t)&&i.push(['<option value="',t,'">',wpoptimize.loggers_classes_info[t].description,"</option>"].join(""));return['<div class="wpo_add_logger_form">','<select class="wpo_logger_type" name="wpo-logger-type[]">',i.join(""),"<select>",'<a href="#" class="wpo_delete_logger dashicons dashicons-no-alt"></a>','<div class="wpo_additional_logger_options"></div>',"</div>"].join("")}function p(i){if(!wpoptimize.loggers_classes_info[i].options)return"";var e,o=wpoptimize.loggers_classes_info[i].options,n=[],a="",s="";for(e in o)o.hasOwnProperty(e)&&(t.isArray(o[e])?(a=t.trim(o[e][0]),s=t.trim(o[e][1])):(a=t.trim(o[e]),s=""),n.push(['<input class="wpo_logger_addition_option" type="text" name="wpo-logger-options[',e,'][]" value="" ','placeholder="',a,'" ',""!==s?'data-validate="'+s+'"':"","/>"].join("")));return n.push('<input type="hidden" name="wpo-logger-options[active][]" value="1" />'),n.join("")}t(".wp-optimize-logging-settings").each(function(){var e=t(this);i(e),e.on("change",function(){i(e)})});var r=t("#wpo_add_logger_link");r.on("click",function(){t("#wp-optimize-logger-settings .save_settings_reminder").after(s()),n(t(".wpo_logger_type").first())}),t("#wp-optimize-nav-tab-contents-settings").on("change",".wpo_logger_type",function(){var i=t(this),o=i.val(),n=i.parent().find(".wpo_additional_logger_options");n.html(p(o)),i.val()&&e()}),t(".wpo_logging_actions_row .dashicons-edit").on("click",function(){var i=t(this),e=i.closest(".wpo_logging_row");return t(".wpo_additional_logger_options",e).removeClass("wpo_hidden"),t(".wpo_logging_options_row",e).text(""),t(".wpo_logging_status_row",e).text(""),i.hide(),!1}),t("#wp-optimize-logger-settings").on("change",".wpo_logger_addition_option",function(){e()}),t(".wpo_logger_active_checkbox").on("change",function(){var i=t(this),e=i.closest("label").find('input[type="hidden"]');e.val(i.is(":checked")?"1":"0")}),t("#wp-optimize-nav-tab-contents-settings").on("click",".wpo_delete_logger",function(){if(!confirm(wpoptimize.are_you_sure_you_want_to_remove_logging_destination))return!1;var i=t(this);return i.closest(".wpo_logging_row, .wpo_add_logger_form").remove(),o(),0==t("#wp-optimize-logging-options .wpo_logging_row").length&&t("#wp-optimize-logging-options").hide(),e(),!1})});
1
+ wp_optimize_send_command_admin_ajax=function(t,i,e,o){o="undefined"==typeof o||o;var n={action:"wp_optimize_ajax",subaction:t,nonce:wp_optimize_ajax_nonce,data:i};jQuery.post(ajaxurl,n,function(t){if(o){try{var i=JSON.parse(t)}catch(n){return console.log(n),console.log(t),void alert(wpoptimize.error_unexpected_response)}"undefined"!=typeof e&&e(i)}else"undefined"!=typeof e&&e(t)})},jQuery(document).ready(function(t){WP_Optimize=WP_Optimize(wp_optimize_send_command_admin_ajax)});var WP_Optimize=function(t){function i(){if(x("#enable-schedule").length){var t=x("#enable-schedule").is(":checked");t?x("#wp-optimize-auto-options").css("opacity","1"):x("#wp-optimize-auto-options").css("opacity","0.5")}}function e(t,i,e){i="undefined"==typeof i?"#wp-optimize-wrap":i,e="undefined"==typeof e?15:e,x(t).hide().prependTo(i).slideDown("slow").delay(1e3*e).slideUp("slow",function(){x(this).remove()})}function o(i,o){var n={type:i,enable:o?1:0};x("#"+i+"_spinner").show(),t("enable_or_disable_feature",n,function(t){if(x("#"+i+"_spinner").hide(),t&&t.hasOwnProperty("output"))for(var o=0,n=t.output.length;o<n;o++){var a='<div class="updated">'+t.output[o]+"</div>";e(a,"#actions-results-area")}})}function n(t){var i="",t="undefined"==typeof t?"string":t;return"object"==t?i=x("#wp-optimize-nav-tab-contents-settings form input[name!='action'], #wp-optimize-nav-tab-contents-settings form textarea, #wp-optimize-nav-tab-contents-settings form select, #wp-optimize-nav-tab-contents-optimize input[type='checkbox'], .wp-optimize-nav-tab-contents input[name^='enable-auto-backup-']").serializeJSON({useIntKeysAsArrayIndex:!0}):(i=x("#wp-optimize-nav-tab-contents-settings form input[name!='action'], #wp-optimize-nav-tab-contents-settings form textarea, #wp-optimize-nav-tab-contents-settings form select, #wp-optimize-nav-tab-contents-optimize input[type='checkbox'], .wp-optimize-nav-tab-contents input[name^='enable-auto-backup-']").serialize(),x.each(x('#wp-optimize-nav-tab-contents-settings form input[type=checkbox], .wp-optimize-nav-tab-contents input[name^="enable-auto-backup-"]').filter(function(t){return 0==x(this).prop("checked")}),function(t,e){var o="0";i+="&"+x(e).attr("name")+"="+o})),i}function a(){t("optimizations_done",{},function(){})}function s(){if(!O.get_lock())return void(j>0&&console.log("WP-Optimize: process_queue(): queue is currently locked - exiting"));j>0&&console.log("WP-Optimize: process_queue(): got queue lock");var i=O.peek();return"object"==typeof i?(data=i,i=i.optimization_id):data={},"undefined"==typeof i?(j>0&&console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting"),O.unlock(),void a()):(j>0&&console.log("WP-Optimize: process_queue(): processing item: "+i),O.dequeue(),x(document).trigger(["do_optimization_",i,"_start"].join("")),void t("do_optimization",{optimization_id:i,data:data},function(t){if(x("#optimization_spinner_"+i).hide(),x("#optimization_checkbox_"+i).show(),x(".optimization_button_"+i).prop("disabled",!1),x(document).trigger(["do_optimization_",i,"_done"].join(""),t),t){for(var e="",o=0,n=t.errors.length;o<n;o++)e+='<span class="error">'+t.errors[o]+"</span><br>";for(var o=0,n=t.messages.length;o<n;o++)e+=t.errors[o]+"<br>";for(var o=0,n=t.result.output.length;o<n;o++)e+=t.result.output[o]+"<br>";if(x("#optimization_info_"+i).html(e),t.hasOwnProperty("status_box_contents")&&x("#wp_optimize_status_box").css("opacity","1").find(".inside").html(t.status_box_contents),t.hasOwnProperty("table_list")&&x("#wpoptimize_table_list tbody").html(x(t.table_list).find("tbody").html()),t.hasOwnProperty("total_size")&&x("#optimize_current_db_size").html(t.total_size),"optimizetables"==i&&data.optimization_table&&(O.is_empty()?(x("#optimization_spinner_"+i).hide(),x("#optimization_checkbox_"+i).show(),x(".optimization_button_"+i).prop("disabled",!1),x("#optimization_info_"+i).html(wpoptimize.optimization_complete)):(x("#optimization_checkbox_"+i).hide(),x("#optimization_spinner_"+i).show(),x(".optimization_button_"+i).prop("disabled",!0))),t.result.meta&&t.result.meta.hasOwnProperty("awaiting_mod")){var a=t.result.meta.awaiting_mod;a>0?x("#adminmenu .awaiting-mod .pending-count").remove(a):x("#adminmenu .awaiting-mod").remove()}}setTimeout(function(){O.unlock(),s()},10)}))}function p(t){var i=x("#wp-optimize-nav-tab-contents-optimize .wp-optimize-settings-"+t);if(i||console.log("do_optimization: row corresponding to this optimization ("+t+") not found"),1!=x(".optimization_button_"+t).prop("disabled")){if(x("#optimization_checkbox_"+t).hide(),x("#optimization_spinner_"+t).show(),x(".optimization_button_"+t).prop("disabled",!0),x("#optimization_info_"+t).html("..."),"optimizetables"==t){var e=x("#wpoptimize_table_list #the-list tr");x(e).each(function(i){var e=x(this).find("td");if(table_type=e.eq(5).text(),table=e.eq(1).text(),optimizable=e.eq(5).data("optimizable"),""!=table&&("1"==optimizable||B)){var o={optimization_id:t,optimization_table:e.eq(1).text(),optimization_table_type:table_type,optimization_force:B};O.enqueue(o)}})}else O.enqueue(t);s()}}function r(i){x("#wpo_settings_sites_list").length?t("save_site_settings",{"wpo-sites":l()},function(){i&&i()}):i&&i()}function l(){var t=[];return x('#wpo_settings_sites_list input[type="checkbox"]').each(function(){var i=x(this);i.is(":checked")&&t.push(i.attr("value"))}),t}function _(){var t=!1;x("#enable-auto-backup").is(":checked")&&(t=!0),d(),1==t?c(f):f()}function c(t){"function"==typeof updraft_backupnow_inpage_go?updraft_backupnow_inpage_go(function(){x("#updraft-backupnow-inpage-modal").dialog("close"),t&&t()},"","autobackup",0,1,0,wpoptimize.automatic_backup_before_optimizations):t&&t()}function d(){var i=n("object");i.auto_backup=x("#enable-auto-backup").is(":checked"),t("save_auto_backup_option",i)}function u(t,i,e,o){t.on("click",function(){return i.hasClass("wpo_always_visible")||i.toggleClass("wpo_hidden"),!1}),e.on("change",function(){e.is(":checked")?o.prop("checked",!0):o.prop("checked",!1),m(e,o)}),o.on("change",function(){m(e,o)}),m(e,o)}function m(t,i){var e=0,o=0;if(i.each(function(){x(this).is(":checked")&&o++,e++}),t.next().is("label")&&t.next().data("label")){var n=t.next(),a=n.data("label");e==o?n.text(a):n.text(a.replace("all",[o," of ",e].join("")))}e==o?t.prop("checked",!0):t.prop("checked",!1)}function f(){$optimizations=x("#optimizations_list .optimization_checkbox:checked"),$optimizations.sort(function(t,i){return t=x(t).closest(".wp-optimize-settings").data("optimization_run_sort_order"),i=x(i).closest(".wp-optimize-settings").data("optimization_run_sort_order"),t>i?1:t<i?-1:0});var i={};$optimizations.each(function(t){var e=x(this).closest(".wp-optimize-settings").data("optimization_id");return e?(i[e]={active:1},void p(e)):void console.log("Optimization ID corresponding to pressed button not found")}),t("save_manual_run_optimization_options",i)}function g(t){x(".run-single-table-optimization").each(function(){var i=x(this);i.data("disabled")&&(t?i.prop("disabled",!1):i.prop("disabled",!0))})}function w(t){var i,e,o;if(t)for(i in t)t.hasOwnProperty(i)&&(e=["#wp-optimize-settings-",t[i].dom_id].join(""),o=t[i].info?t[i].info.join("<br>"):"",x(e+" .wp-optimize-settings-optimization-info").html(o))}function b(){var i=["",l().join("_")].join("");G.hasOwnProperty(i)?w(G[i]):t("get_optimizations_info",{"wpo-sites":l()},function(t){t&&(G[i]=t,w(t))})}function h(i){var e=x("#wpo_import_spinner"),o=x("#wpo_import_success_message"),n=x("#wpo_import_error_message");e.show(),t("import_settings",{settings:i},function(t){e.hide(),t&&t.errors&&t.errors.length?(n.text(t.errors.join("<br>")),n.slideDown()):t&&t.messages&&t.messages.length&&(o.text(t.messages.join("<br>")),o.slideDown(),setTimeout(function(){window.location.reload()},500)),x("#wpo_import_settings_btn").prop("disabled",!1)})}function z(t,i){var e=document.body.appendChild(document.createElement("a")),o=new Date,n=o.getFullYear(),a=o.getMonth()<10?["0",o.getMonth()].join(""):o.getMonth(),s=o.getDay()<10?["0",o.getDay()].join(""):o.getDay();i=i?i:["wpo-settings-",n,"-",a,"-",s,".json"].join(""),e.setAttribute("download",i),e.setAttribute("style","display:none;"),e.setAttribute("href","data:text/json;charset=UTF-8,"+encodeURIComponent(JSON.stringify(t))),e.click()}function v(){var t=x("#wpoptimize_table_list"),i=!0;x("tr",t).each(function(){var t=x(this);if(x("button",t).length>0)return i=!1,!1}),x("tr",t).each(function(){var t=x(this);i?x("td:last, th:last",t).hide():x("td:last, th:last",t).show()})}function y(){var t=!0;return x(".wpo_logger_addition_option, .wpo_logger_type").each(function(){k(x(this),!0)?x(this).removeClass("wpo_error_field"):(t=!1,x(this).addClass("wpo_error_field"))}),t?x("#wp-optimize-logger-settings .save_settings_reminder").slideUp():x("#wp-optimize-settings-save-results").show().addClass("wpo_alert_notice").text(wpoptimize.fill_all_settings_fields).delay(5e3).fadeOut(3e3,function(){x(this).removeClass("wpo_alert_notice")}),t}function k(t,i){var e=t.val(),o=t.data("validate");if(!o&&i)return""!=x.trim(e);if(o&&!i&&""==x.trim(e))return!0;var n=!0;switch(o){case"email":for(var a=/\S+@\S+\.\S+/,s=e.split(","),p="",r=0;r<s.length;r++)p=x.trim(s[r]),""!=p&&a.test(p)||(n=!1);break;case"url":var a=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i;n=a.test(e)}return n}var x=jQuery,j=0,O=new Updraft_Queue;i(),x("#enable-schedule").change(function(){i()});var P=x("#wpoptimize_table_list_filter"),q=x("#wpoptimize_table_list"),C=x("#wpoptimize_table_list tbody:last"),D=x("#wpoptimize_table_list_tables_not_found");x(function(){q.tablesorter({theme:"default",widgets:["zebra","rows","filter"],cssInfoBlock:"tablesorter-no-sort",headers:{7:{sorter:!1}},widgetOptions:{filter_external:P,filter_defaultFilter:{2:"~{query}"}}}),q.on("filterEnd",function(){var t=x.trim(P.val());""==t?C.show():C.hide(),0==x("#the-list tr:visible",q).length?D.show():D.hide()})}),x("#wp-optimize-disable-enable-trackbacks-enable").click(function(){o("trackbacks",!0)}),x("#wp-optimize-disable-enable-trackbacks-disable").click(function(){o("trackbacks",!1)}),x("#wp-optimize-disable-enable-comments-enable").click(function(){o("comments",!0)}),x("#wp-optimize-disable-enable-comments-disable").click(function(){o("comments",!1)}),x("#wp-optimize-nav-tab-wrapper .nav-tab").click(function(t){var i=x(this).attr("id");if(i&&"wp-optimize-nav-tab-"==i.substring(0,20)){var i=i.substring(20);t.preventDefault(),x("#wp-optimize-nav-tab-wrapper .nav-tab:not(#wp-optimize-nav-tab-"+i+")").removeClass("nav-tab-active"),x(this).addClass("nav-tab-active"),x("#wp-optimize-wrap .wp-optimize-nav-tab-contents:not(#wp-optimize-nav-tab-contents-"+i+")").hide(),x("#wp-optimize-nav-tab-contents-"+i).show(),"tables"==i&&x("#wpoptimize_table_list").trigger("applyWidgets")}}),x("#wp-optimize-nav-tab-contents-optimize").on("click","button.wp-optimize-settings-optimization-run-button",function(){var t=x(this).closest(".wp-optimize-settings").data("optimization_id");return t?void(1!=x(".optimization_button_"+t).prop("disabled")&&(x(".optimization_button_"+t).prop("disabled",!0),r(function(){x(".optimization_button_"+t).prop("disabled",!1),p(t)}))):void console.log("Optimization ID corresponding to pressed button not found")}),x("#wp-optimize-nav-tab-contents-optimize").on("click","#wp-optimize",function(t){var i=x(this);t.preventDefault(),i.prop("disabled",!0),r(function(){i.prop("disabled",!1),_()})});var S=x("#wpo_settings_sites_list"),T=S.find("ul").first(),W=x('input[type="checkbox"]',T),A=S.find("#wpo_all_sites"),F=x("#wpo_sitelist_show_moreoptions"),I=x("#wpo_sitelist_moreoptions"),U=x("#wpo_settings_sites_list_cron"),Q=U.find("ul").first(),$=x('input[type="checkbox"]',Q),J=U.find("#wpo_all_sites_cron"),M=x("#wpo_sitelist_show_moreoptions_cron"),N=x("#wpo_sitelist_moreoptions_cron");u(F,I,A,W);var E=0;x([A,W]).each(function(){x(this).on("change",function(){E++,setTimeout(function(){E--,0==E&&b()},1e3)})}),u(M,N,J,$),x("#wp_optimize_table_list_refresh").click(function(){x("#wpoptimize_table_list tbody").css("opacity","0.5"),t("get_table_list",!1,function(t){if(t.hasOwnProperty("table_list")){var i=!0,e=function(t){x("#wpoptimize_table_list tbody").css("opacity","1")};x("#wpoptimize_table_list").trigger("updateAll",[i,e])}t.hasOwnProperty("total_size")&&x("#optimize_current_db_size").html(t.total_size),g(Y.is(":checked"))})}),x("#settings_form").on("click","#wp-optimize-settings-save",function(i){if(!y())return!1;i.preventDefault(),x("#save_spinner").show();var o=n();t("save_settings",o,function(t){if(x("#save_spinner").hide(),x("#save_done").show().delay(5e3).fadeOut(),t&&t.hasOwnProperty("save_results")&&t.save_results&&t.save_results.hasOwnProperty("errors")){for(var i=0,o=t.save_results.errors.length;i<o;i++){var n='<div class="error">'+t.errors[i]+"</div>";e(n,"#wp-optimize-settings-save-results")}console.log(t.save_results.messages)}t&&t.hasOwnProperty("status_box_contents")&&x("#wp_optimize_status_box .inside").html(t.status_box_contents),t&&t.hasOwnProperty("optimizations_table")&&x("#optimizations_list").replaceWith(t.optimizations_table),t.save_results.refresh&&location.reload()})}),x("#wp_optimize_status_box").on("click","#wp_optimize_status_box_refresh",function(i){i.preventDefault(),x("#wp_optimize_status_box").css("opacity","0.5"),t("get_status_box_contents",null,function(t){x("#wp_optimize_status_box").css("opacity","1").find(".inside").html(t)})});var R=x("#innodb_force_optimize"),B=R.is(":checked"),K=R.closest("tr"),Y=x("#innodb_force_optimize_single");R.on("change",function(){x('button, input[type="checkbox"]',K).each(function(){B=R.is(":checked");var t=x(this);t.data("disabled")&&(B?t.prop("disabled",!1):t.prop("disabled",!0))})}),x("#wpoptimize_table_list").on("click",".run-single-table-optimization",function(){var i=x(this),e=i.next(),o=e.next(),n=i.data("table"),a=i.data("type"),s={optimization_id:"optimizetables",optimization_table:n,optimization_table_type:a};Y.is(":checked")&&(s.optimization_force=!0),e.removeClass("visibility-hidden"),t("do_optimization",{optimization_id:"optimizetables",data:s},function(){i.prop("disabled",!1),e.addClass("visibility-hidden"),o.show().removeClass("visibility-hidden").delay(3e3).fadeOut("slow")})}),Y.change(function(){g(Y.is(":checked"))}),g(Y.is(":checked"));var G={};setTimeout(function(){t("check_overdue_crons",null,function(t){t&&t.hasOwnProperty("m")&&x("#wpo_settings_warnings").append(t.m)})},11e3),x("#wpo_import_settings_btn").on("click",function(t){var i=x("#wpo_import_settings_file"),e=i.val(),o=i[0].files[0],n=new FileReader;return x("#wpo_import_settings_btn").prop("disabled",!0),/\.json$/.test(e)?(n.onload=function(){h(this.result)},n.readAsText(o),!1):(t.preventDefault(),x("#wpo_import_settings_btn").prop("disabled",!1),x("#wpo_import_error_message").text(wpoptimize.please_select_settings_file).slideDown(),!1)}),x("#wpo_import_settings_file").on("change",function(){x("#wpo_import_error_message").slideUp()}),x("#wpo_export_settings_btn").on("click",function(t){return z(n("object")),!1});var H=function(i,e,o){t("get_optimization_info",{optimization_id:e,data:o},function(t){var o=t&&t.result&&t.result.meta?t.result.meta:{},n=t&&t.result&&t.result.output?t.result.output.join("<br>"):"...";x(document).trigger(["optimization_get_info_",e].join(""),n),i.html(n),o.finished?x(document).trigger(["optimization_get_info_",e,"_done"].join(""),t):setTimeout(function(){H(i,e,o)},1)})};return x(document).ready(function(){x(".wp-optimize-optimization-info-ajax").each(function(){var t=x(this),i=t.parent(),e=t.data("id");x(document).trigger(["optimization_get_info_",e,"_start"].join("")),H(i,e,{support_ajax_get_info:!0})})}),x("#wpoptimize_table_list").on("click",".run-single-table-repair",function(){var i=x(this),e=i.next(),o=e.next(),n=i.data("table"),a={optimization_id:"repairtables",optimization_table:n};e.removeClass("visibility-hidden"),t("do_optimization",{optimization_id:"repairtables",data:a},function(t){if(t.result.meta.success){var a=i.closest("tr"),s=t.result.meta.tableinfo;i.prop("disabled",!1),e.addClass("visibility-hidden"),o.show().removeClass("visibility-hidden"),x("td:eq(2)",a).text(s.rows),x("td:eq(3)",a).text(s.data_size),x("td:eq(4)",a).text(s.index_size),x("td:eq(5)",a).text(s.type),s.is_optimizable?x("td:eq(6)",a).html(['<span color="',s.overhead>0?"#0000FF":"#004600",'">',s.overhead,"</span>"].join("")):x("td:eq(6)",a).html('<span color="#0000FF">-</span>'),setTimeout(function(){var t=i.closest("td"),e=i.closest(".wpo_button_wrap");e.fadeOut("fast",function(){e.closest(".wpo_button_wrap").remove(),s.is_optimizable&&x(".wpo_button_wrap",t).removeClass("wpo_hidden")}),v()},1e3)}else i.prop("disabled",!1),e.addClass("visibility-hidden"),alert(wpoptimize.table_was_not_repaired.replace("%s",n))})}),v(),setTimeout(function(){t("check_overdue_crons",null,function(t){t&&t.hasOwnProperty("m")&&x("#wpo_settings_warnings").append(t.m)})},11e3),{send_command:t,optimization_get_info:H,take_a_backup_with_updraftplus:c,save_auto_backup_options:d}};jQuery(document).ready(function(t){function i(i){var e=["#",i.data("additional")].join("");i.is(":checked")?t(e).show():t(e).hide()}function e(){var i=t("#wp-optimize-logger-settings .save_settings_reminder");i.is(":visible")||i.slideDown("normal")}function o(){t(".wpo_logger_type").each(function(){n(t(this))})}function n(i){var e,o,n=a();for(e in n)o=n[e],wpoptimize.loggers_classes_info[o].allow_multiple?t('option[value="'+o+'"]',i).show():t('option[value="'+o+'"]',i).hide()}function a(){var i=[];return t(".wpo_logging_row, .wpo_logger_type").each(function(){var e=t(this).is("select")?t(this).val():t(this).data("id");e&&i.push(e)}),i}function s(){var t,i=['<option value="">Select destination</option>'];for(t in wpoptimize.loggers_classes_info)wpoptimize.loggers_classes_info.hasOwnProperty(t)&&i.push(['<option value="',t,'">',wpoptimize.loggers_classes_info[t].description,"</option>"].join(""));return['<div class="wpo_add_logger_form">','<select class="wpo_logger_type" name="wpo-logger-type[]">',i.join(""),"<select>",'<a href="#" class="wpo_delete_logger dashicons dashicons-no-alt"></a>','<div class="wpo_additional_logger_options"></div>',"</div>"].join("")}function p(i){if(!wpoptimize.loggers_classes_info[i].options)return"";var e,o=wpoptimize.loggers_classes_info[i].options,n=[],a="",s="";for(e in o)o.hasOwnProperty(e)&&(t.isArray(o[e])?(a=t.trim(o[e][0]),s=t.trim(o[e][1])):(a=t.trim(o[e]),s=""),n.push(['<input class="wpo_logger_addition_option" type="text" name="wpo-logger-options[',e,'][]" value="" ','placeholder="',a,'" ',""!==s?'data-validate="'+s+'"':"","/>"].join("")));return n.push('<input type="hidden" name="wpo-logger-options[active][]" value="1" />'),n.join("")}t(".wp-optimize-logging-settings").each(function(){var e=t(this);i(e),e.on("change",function(){i(e)})});var r=t("#wpo_add_logger_link");r.on("click",function(){t("#wp-optimize-logger-settings .save_settings_reminder").after(s()),n(t(".wpo_logger_type").first())}),t("#wp-optimize-nav-tab-contents-settings").on("change",".wpo_logger_type",function(){var i=t(this),o=i.val(),n=i.parent().find(".wpo_additional_logger_options");n.html(p(o)),i.val()&&e()}),t(".wpo_logging_actions_row .dashicons-edit").on("click",function(){var i=t(this),e=i.closest(".wpo_logging_row");return t(".wpo_additional_logger_options",e).removeClass("wpo_hidden"),t(".wpo_logging_options_row",e).text(""),t(".wpo_logging_status_row",e).text(""),i.hide(),!1}),t("#wp-optimize-logger-settings").on("change",".wpo_logger_addition_option",function(){e()}),t(".wpo_logger_active_checkbox").on("change",function(){var i=t(this),e=i.closest("label").find('input[type="hidden"]');e.val(i.is(":checked")?"1":"0")}),t("#wp-optimize-nav-tab-contents-settings").on("click",".wpo_delete_logger",function(){if(!confirm(wpoptimize.are_you_sure_you_want_to_remove_logging_destination))return!1;var i=t(this);return i.closest(".wpo_logging_row, .wpo_add_logger_form").remove(),o(),0==t("#wp-optimize-logging-options .wpo_logging_row").length&&t("#wp-optimize-logging-options").hide(),e(),!1})});
languages/wp-optimize.pot CHANGED
@@ -17,11 +17,11 @@ msgstr ""
17
  "X-Poedit-SearchPathExcluded-0: *.js\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
 
20
- #: src/includes/class-commands.php:127, src/includes/class-commands.php:170
21
  msgid "No optimization was indicated."
22
  msgstr ""
23
 
24
- #: src/includes/class-commands.php:279, src/includes/class-commands.php:288
25
  msgid "Please upload a valid settings file."
26
  msgstr ""
27
 
@@ -61,19 +61,19 @@ msgstr ""
61
  msgid "No such optimization"
62
  msgstr ""
63
 
64
- #: src/includes/class-wp-optimizer.php:442
65
  msgid "Comments have now been disabled on all current and previously published posts."
66
  msgstr ""
67
 
68
- #: src/includes/class-wp-optimizer.php:445
69
  msgid "Comments have now been enabled on all current and previously published posts."
70
  msgstr ""
71
 
72
- #: src/includes/class-wp-optimizer.php:452
73
  msgid "Trackbacks have now been disabled on all current and previously published posts."
74
  msgstr ""
75
 
76
- #: src/includes/class-wp-optimizer.php:455
77
  msgid "Trackbacks have now been enabled on all current and previously published posts."
78
  msgstr ""
79
 
@@ -161,29 +161,29 @@ msgstr ""
161
  msgid "Summer sale - 20% off WP-Optimize Premium until July 31st"
162
  msgstr ""
163
 
164
- #: src/optimizations/attachments.php:21
165
  msgid "%s orphaned attachment deleted"
166
  msgid_plural "%s orphaned attachments deleted"
167
  msgstr[0] ""
168
  msgstr[1] ""
169
 
170
- #: src/optimizations/attachments.php:24, src/optimizations/attachments.php:64, src/optimizations/autodraft.php:28, src/optimizations/autodraft.php:63, src/optimizations/commentmeta.php:33, src/optimizations/commentmeta.php:90, src/optimizations/orphandata.php:16, src/optimizations/orphandata.php:45, src/optimizations/pingbacks.php:16, src/optimizations/pingbacks.php:44, src/optimizations/postmeta.php:20, src/optimizations/postmeta.php:48, src/optimizations/revisions.php:24, src/optimizations/revisions.php:59, src/optimizations/spam.php:48, src/optimizations/spam.php:117, src/optimizations/trackbacks.php:16, src/optimizations/trackbacks.php:44, src/optimizations/transient.php:30, src/optimizations/transient.php:160, src/optimizations/trash.php:31, src/optimizations/trash.php:94, src/optimizations/unapproved.php:24, src/optimizations/unapproved.php:65
171
  msgid "across %s site"
172
  msgid_plural "across %s sites"
173
  msgstr[0] ""
174
  msgstr[1] ""
175
 
176
- #: src/optimizations/attachments.php:58
177
  msgid "%s orphaned attachment found"
178
  msgid_plural "%s orphaned attachments found"
179
  msgstr[0] ""
180
  msgstr[1] ""
181
 
182
- #: src/optimizations/attachments.php:60
183
  msgid "No orphaned attachments found"
184
  msgstr ""
185
 
186
- #: src/optimizations/attachments.php:88, src/optimizations/attachments.php:98
187
  msgid "Remove orphaned attachments"
188
  msgstr ""
189
 
@@ -347,6 +347,14 @@ msgstr ""
347
  msgid "Remove orphaned post meta"
348
  msgstr ""
349
 
 
 
 
 
 
 
 
 
350
  #: src/optimizations/revisions.php:21
351
  msgid "%s post revision deleted"
352
  msgid_plural "%s post revisions deleted"
@@ -651,7 +659,7 @@ msgstr ""
651
  msgid "Status"
652
  msgstr ""
653
 
654
- #: src/templates/admin-settings-logging.php:25
655
  msgid "Actions"
656
  msgstr ""
657
 
@@ -1029,11 +1037,11 @@ msgstr ""
1029
  msgid "Notes"
1030
  msgstr ""
1031
 
1032
- #: src/templates/optimizations-table.php:72
1033
  msgid "Run optimization"
1034
  msgstr ""
1035
 
1036
- #: src/templates/optimizations-table.php:74
1037
  msgid "Go"
1038
  msgstr ""
1039
 
@@ -1151,12 +1159,6 @@ msgid_plural "%s Tables"
1151
  msgstr[0] ""
1152
  msgstr[1] ""
1153
 
1154
- #: src/templates/tables-body.php:69
1155
- msgid "%s Record"
1156
- msgid_plural "%s Records"
1157
- msgstr[0] ""
1158
- msgstr[1] ""
1159
-
1160
  #: src/templates/tables.php:3
1161
  msgid "Database name:"
1162
  msgstr ""
@@ -1233,126 +1235,134 @@ msgstr ""
1233
  msgid "Please update UpdraftPlus to the latest version."
1234
  msgstr ""
1235
 
1236
- #: src/wp-optimize.php:262
1237
  msgid "WP-Optimize (Free) has been de-activated, because WP-Optimize Premium is active."
1238
  msgstr ""
1239
 
1240
- #: src/wp-optimize.php:272
1241
  msgid "New feature: WP-Optimize Premium can now optimize all sites within a multisite install, not just the main one."
1242
  msgstr ""
1243
 
1244
- #: src/wp-optimize.php:387
1245
  msgid "Table information"
1246
  msgstr ""
1247
 
1248
- #: src/wp-optimize.php:387, src/wp-optimize.php:572
1249
  msgid "Settings"
1250
  msgstr ""
1251
 
1252
- #: src/wp-optimize.php:387
1253
  msgid "Premium / Plugin family"
1254
  msgstr ""
1255
 
1256
- #: src/wp-optimize.php:516
1257
  msgid "Automatic backup before optimizations"
1258
  msgstr ""
1259
 
1260
- #: src/wp-optimize.php:517
1261
  msgid "An unexpected response was received."
1262
  msgstr ""
1263
 
1264
- #: src/wp-optimize.php:518
1265
  msgid "Optimization complete"
1266
  msgstr ""
1267
 
1268
- #: src/wp-optimize.php:519
1269
  msgid "Run optimizations"
1270
  msgstr ""
1271
 
1272
- #: src/wp-optimize.php:520
1273
  msgid "Cancel"
1274
  msgstr ""
1275
 
1276
- #: src/wp-optimize.php:521
1277
  msgid "Please, select settings file."
1278
  msgstr ""
1279
 
1280
- #: src/wp-optimize.php:522
1281
  msgid "Are you sure you want to remove this logging destination?"
1282
  msgstr ""
1283
 
1284
- #: src/wp-optimize.php:523
1285
  msgid "Before saving, you need to complete the currently incomplete settings (or remove them)."
1286
  msgstr ""
1287
 
1288
- #: src/wp-optimize.php:553
 
 
 
 
1289
  msgid "Optimize"
1290
  msgstr ""
1291
 
1292
- #: src/wp-optimize.php:575
1293
  msgid "Optimizer"
1294
  msgstr ""
1295
 
1296
- #: src/wp-optimize.php:678
 
 
 
 
1297
  msgid "Warning"
1298
  msgstr ""
1299
 
1300
- #: src/wp-optimize.php:678
1301
  msgid "WordPress has a number (%d) of scheduled tasks which are overdue. Unless this is a development site, this probably means that the scheduler in your WordPress install is not working."
1302
  msgstr ""
1303
 
1304
- #: src/wp-optimize.php:678
1305
  msgid "Read this page for a guide to possible causes and how to fix it."
1306
  msgstr ""
1307
 
1308
- #: src/wp-optimize.php:745
1309
  msgid "Error:"
1310
  msgstr ""
1311
 
1312
- #: src/wp-optimize.php:745
1313
  msgid "template not found"
1314
  msgstr ""
1315
 
1316
- #: src/wp-optimize.php:797
1317
  msgid "Automatic Operation Completed"
1318
  msgstr ""
1319
 
1320
- #: src/wp-optimize.php:799
1321
  msgid "Scheduled optimization was executed at"
1322
  msgstr ""
1323
 
1324
- #: src/wp-optimize.php:800
1325
  msgid "You can safely delete this email."
1326
  msgstr ""
1327
 
1328
- #: src/wp-optimize.php:802
1329
  msgid "Regards,"
1330
  msgstr ""
1331
 
1332
- #: src/wp-optimize.php:803
1333
  msgid "WP-Optimize Plugin"
1334
  msgstr ""
1335
 
1336
- #: src/wp-optimize.php:825
1337
  msgid "GB"
1338
  msgstr ""
1339
 
1340
- #: src/wp-optimize.php:827
1341
  msgid "MB"
1342
  msgstr ""
1343
 
1344
- #: src/wp-optimize.php:829
1345
  msgid "KB"
1346
  msgstr ""
1347
 
1348
- #: src/wp-optimize.php:831
1349
  msgid "bytes"
1350
  msgstr ""
1351
 
1352
- #: src/wp-optimize.php:1210
1353
  msgid "Only Network Administrator can activate WP-Optimize plugin."
1354
  msgstr ""
1355
 
1356
- #: src/wp-optimize.php:1211
1357
  msgid "go back"
1358
  msgstr ""
17
  "X-Poedit-SearchPathExcluded-0: *.js\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
 
20
+ #: src/includes/class-commands.php:160, src/includes/class-commands.php:203
21
  msgid "No optimization was indicated."
22
  msgstr ""
23
 
24
+ #: src/includes/class-commands.php:312, src/includes/class-commands.php:321
25
  msgid "Please upload a valid settings file."
26
  msgstr ""
27
 
61
  msgid "No such optimization"
62
  msgstr ""
63
 
64
+ #: src/includes/class-wp-optimizer.php:448
65
  msgid "Comments have now been disabled on all current and previously published posts."
66
  msgstr ""
67
 
68
+ #: src/includes/class-wp-optimizer.php:451
69
  msgid "Comments have now been enabled on all current and previously published posts."
70
  msgstr ""
71
 
72
+ #: src/includes/class-wp-optimizer.php:458
73
  msgid "Trackbacks have now been disabled on all current and previously published posts."
74
  msgstr ""
75
 
76
+ #: src/includes/class-wp-optimizer.php:461
77
  msgid "Trackbacks have now been enabled on all current and previously published posts."
78
  msgstr ""
79
 
161
  msgid "Summer sale - 20% off WP-Optimize Premium until July 31st"
162
  msgstr ""
163
 
164
+ #: src/optimizations/attachments.php:30
165
  msgid "%s orphaned attachment deleted"
166
  msgid_plural "%s orphaned attachments deleted"
167
  msgstr[0] ""
168
  msgstr[1] ""
169
 
170
+ #: src/optimizations/attachments.php:33, src/optimizations/attachments.php:73, src/optimizations/autodraft.php:28, src/optimizations/autodraft.php:63, src/optimizations/commentmeta.php:33, src/optimizations/commentmeta.php:90, src/optimizations/orphandata.php:16, src/optimizations/orphandata.php:45, src/optimizations/pingbacks.php:16, src/optimizations/pingbacks.php:44, src/optimizations/postmeta.php:20, src/optimizations/postmeta.php:48, src/optimizations/revisions.php:24, src/optimizations/revisions.php:59, src/optimizations/spam.php:48, src/optimizations/spam.php:117, src/optimizations/trackbacks.php:16, src/optimizations/trackbacks.php:44, src/optimizations/transient.php:30, src/optimizations/transient.php:160, src/optimizations/trash.php:31, src/optimizations/trash.php:94, src/optimizations/unapproved.php:24, src/optimizations/unapproved.php:65
171
  msgid "across %s site"
172
  msgid_plural "across %s sites"
173
  msgstr[0] ""
174
  msgstr[1] ""
175
 
176
+ #: src/optimizations/attachments.php:67
177
  msgid "%s orphaned attachment found"
178
  msgid_plural "%s orphaned attachments found"
179
  msgstr[0] ""
180
  msgstr[1] ""
181
 
182
+ #: src/optimizations/attachments.php:69
183
  msgid "No orphaned attachments found"
184
  msgstr ""
185
 
186
+ #: src/optimizations/attachments.php:97, src/optimizations/attachments.php:107
187
  msgid "Remove orphaned attachments"
188
  msgstr ""
189
 
347
  msgid "Remove orphaned post meta"
348
  msgstr ""
349
 
350
+ #: src/optimizations/repairtables.php:123
351
+ msgid "No corrupted tables found"
352
+ msgstr ""
353
+
354
+ #: src/optimizations/repairtables.php:135
355
+ msgid "Repair database tables"
356
+ msgstr ""
357
+
358
  #: src/optimizations/revisions.php:21
359
  msgid "%s post revision deleted"
360
  msgid_plural "%s post revisions deleted"
659
  msgid "Status"
660
  msgstr ""
661
 
662
+ #: src/templates/admin-settings-logging.php:25, src/templates/tables-body.php:81, src/templates/tables.php:28
663
  msgid "Actions"
664
  msgstr ""
665
 
1037
  msgid "Notes"
1038
  msgstr ""
1039
 
1040
+ #: src/templates/optimizations-table.php:71
1041
  msgid "Run optimization"
1042
  msgstr ""
1043
 
1044
+ #: src/templates/optimizations-table.php:73
1045
  msgid "Go"
1046
  msgstr ""
1047
 
1159
  msgstr[0] ""
1160
  msgstr[1] ""
1161
 
 
 
 
 
 
 
1162
  #: src/templates/tables.php:3
1163
  msgid "Database name:"
1164
  msgstr ""
1235
  msgid "Please update UpdraftPlus to the latest version."
1236
  msgstr ""
1237
 
1238
+ #: src/wp-optimize.php:267
1239
  msgid "WP-Optimize (Free) has been de-activated, because WP-Optimize Premium is active."
1240
  msgstr ""
1241
 
1242
+ #: src/wp-optimize.php:277
1243
  msgid "New feature: WP-Optimize Premium can now optimize all sites within a multisite install, not just the main one."
1244
  msgstr ""
1245
 
1246
+ #: src/wp-optimize.php:392
1247
  msgid "Table information"
1248
  msgstr ""
1249
 
1250
+ #: src/wp-optimize.php:392, src/wp-optimize.php:578
1251
  msgid "Settings"
1252
  msgstr ""
1253
 
1254
+ #: src/wp-optimize.php:392
1255
  msgid "Premium / Plugin family"
1256
  msgstr ""
1257
 
1258
+ #: src/wp-optimize.php:521
1259
  msgid "Automatic backup before optimizations"
1260
  msgstr ""
1261
 
1262
+ #: src/wp-optimize.php:522
1263
  msgid "An unexpected response was received."
1264
  msgstr ""
1265
 
1266
+ #: src/wp-optimize.php:523
1267
  msgid "Optimization complete"
1268
  msgstr ""
1269
 
1270
+ #: src/wp-optimize.php:524
1271
  msgid "Run optimizations"
1272
  msgstr ""
1273
 
1274
+ #: src/wp-optimize.php:525
1275
  msgid "Cancel"
1276
  msgstr ""
1277
 
1278
+ #: src/wp-optimize.php:526
1279
  msgid "Please, select settings file."
1280
  msgstr ""
1281
 
1282
+ #: src/wp-optimize.php:527
1283
  msgid "Are you sure you want to remove this logging destination?"
1284
  msgstr ""
1285
 
1286
+ #: src/wp-optimize.php:528
1287
  msgid "Before saving, you need to complete the currently incomplete settings (or remove them)."
1288
  msgstr ""
1289
 
1290
+ #: src/wp-optimize.php:529
1291
+ msgid "%s was not repaired. For more details, please check your logs configured in logging destinations settings."
1292
+ msgstr ""
1293
+
1294
+ #: src/wp-optimize.php:559
1295
  msgid "Optimize"
1296
  msgstr ""
1297
 
1298
+ #: src/wp-optimize.php:581
1299
  msgid "Optimizer"
1300
  msgstr ""
1301
 
1302
+ #: src/wp-optimize.php:597
1303
+ msgid "Repair"
1304
+ msgstr ""
1305
+
1306
+ #: src/wp-optimize.php:704
1307
  msgid "Warning"
1308
  msgstr ""
1309
 
1310
+ #: src/wp-optimize.php:704
1311
  msgid "WordPress has a number (%d) of scheduled tasks which are overdue. Unless this is a development site, this probably means that the scheduler in your WordPress install is not working."
1312
  msgstr ""
1313
 
1314
+ #: src/wp-optimize.php:704
1315
  msgid "Read this page for a guide to possible causes and how to fix it."
1316
  msgstr ""
1317
 
1318
+ #: src/wp-optimize.php:771
1319
  msgid "Error:"
1320
  msgstr ""
1321
 
1322
+ #: src/wp-optimize.php:771
1323
  msgid "template not found"
1324
  msgstr ""
1325
 
1326
+ #: src/wp-optimize.php:823
1327
  msgid "Automatic Operation Completed"
1328
  msgstr ""
1329
 
1330
+ #: src/wp-optimize.php:825
1331
  msgid "Scheduled optimization was executed at"
1332
  msgstr ""
1333
 
1334
+ #: src/wp-optimize.php:826
1335
  msgid "You can safely delete this email."
1336
  msgstr ""
1337
 
1338
+ #: src/wp-optimize.php:828
1339
  msgid "Regards,"
1340
  msgstr ""
1341
 
1342
+ #: src/wp-optimize.php:829
1343
  msgid "WP-Optimize Plugin"
1344
  msgstr ""
1345
 
1346
+ #: src/wp-optimize.php:851
1347
  msgid "GB"
1348
  msgstr ""
1349
 
1350
+ #: src/wp-optimize.php:853
1351
  msgid "MB"
1352
  msgstr ""
1353
 
1354
+ #: src/wp-optimize.php:855
1355
  msgid "KB"
1356
  msgstr ""
1357
 
1358
+ #: src/wp-optimize.php:857
1359
  msgid "bytes"
1360
  msgstr ""
1361
 
1362
+ #: src/wp-optimize.php:1248
1363
  msgid "Only Network Administrator can activate WP-Optimize plugin."
1364
  msgstr ""
1365
 
1366
+ #: src/wp-optimize.php:1249
1367
  msgid "go back"
1368
  msgstr ""
optimizations/attachments.php CHANGED
@@ -13,6 +13,15 @@ class WP_Optimization_attachments extends WP_Optimization {
13
 
14
  public $auto_default = false;
15
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Do actions after optimize() function.
18
  */
13
 
14
  public $auto_default = false;
15
 
16
+ /**
17
+ * Display or hide optimization in optimizations list.
18
+ *
19
+ * @return bool
20
+ */
21
+ public function display_in_optimizations_list() {
22
+ return false;
23
+ }
24
+
25
  /**
26
  * Do actions after optimize() function.
27
  */
optimizations/repairtables.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('WPO_VERSION')) die('No direct access allowed');
4
+
5
+ class WP_Optimization_repairtables extends WP_Optimization {
6
+
7
+ public $available_for_auto = false;
8
+
9
+ public $setting_default = true;
10
+
11
+ public $changes_table_data = true;
12
+
13
+ public $run_multisite = false;
14
+
15
+ /**
16
+ * Display or hide optimization in optimizations list.
17
+ *
18
+ * @return bool
19
+ */
20
+ public function display_in_optimizations_list() {
21
+ return false;
22
+ }
23
+
24
+ /**
25
+ * Run optimization.
26
+ */
27
+ public function optimize() {
28
+ // check if single table name posted or optimize all tables.
29
+ if (isset($this->data['optimization_table']) && '' != $this->data['optimization_table']) {
30
+ $table = $this->optimizer->get_table($this->data['optimization_table']);
31
+
32
+ $result = $this->repair_table($table);
33
+
34
+ if ($result) {
35
+ $wp_optimize = WP_Optimize();
36
+ $tablestatus = $wp_optimize->get_db_info()->get_table_status($table->Name, true);
37
+
38
+ $is_optimizable = $wp_optimize->get_db_info()->is_table_optimizable($table->Name);
39
+
40
+ $tableinfo = array(
41
+ 'rows' => number_format_i18n($tablestatus->Rows),
42
+ 'data_size' => $wp_optimize->format_size($tablestatus->Data_length),
43
+ 'index_size' => $wp_optimize->format_size($tablestatus->Index_length),
44
+ 'overhead' => $is_optimizable ? $wp_optimize->format_size($tablestatus->Data_free) : '-',
45
+ 'type' => $table->Engine,
46
+ 'is_optimizable' => $is_optimizable,
47
+ );
48
+
49
+ $this->register_meta('tableinfo', $tableinfo);
50
+ }
51
+
52
+ $this->register_meta('success', $result);
53
+ } else {
54
+ $tables = $this->optimizer->get_tables();
55
+ $repaired = $corrupted = 0;
56
+
57
+ foreach ($tables as $table) {
58
+ if (false == $table->is_needing_repair) continue;
59
+
60
+ if ($this->repair_table($table)) {
61
+ $repaired++;
62
+ } else {
63
+ $corrupted++;
64
+ }
65
+ }
66
+
67
+ $this->register_output(sprintf(_n('%s table repaired', '%s tables repaired', $repaired), $repaired));
68
+
69
+ if ($corrupted > 0) {
70
+ $this->register_output(sprintf(_n('Repairing %s table was unsuccessful', 'Repairing %s tables were unsuccessful', $corrupted), $corrupted));
71
+ }
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Repair table.
77
+ *
78
+ * @param object $table_obj object contains information about database table.
79
+ *
80
+ * @return bool
81
+ */
82
+ private function repair_table($table_obj) {
83
+ global $wpdb;
84
+
85
+ $success = false;
86
+
87
+ if (false == $table_obj->is_needing_repair) return true;
88
+
89
+ $this->logger->info('REPAIR TABLE '.$table_obj->Name);
90
+
91
+ $results = $wpdb->get_results('REPAIR TABLE '.$table_obj->Name);
92
+
93
+ if (!empty($results)) {
94
+ foreach ($results as $row) {
95
+ if ('status' == strtolower($row->Msg_type) && 'ok' == strtolower($row->Msg_text)) {
96
+ $success = true;
97
+ }
98
+
99
+ $this->logger->info($row->Msg_text);
100
+ }
101
+ }
102
+
103
+ return $success;
104
+ }
105
+
106
+ /**
107
+ * Register info about optimization.
108
+ */
109
+ public function get_info() {
110
+ $tablesinfo = $this->optimizer->get_tables();
111
+
112
+ $corrupted_tables = 0;
113
+
114
+ if (!empty($tablesinfo)) {
115
+ foreach ($tablesinfo as $tableinfo) {
116
+ if ($tableinfo->is_needing_repair) {
117
+ $corrupted_tables++;
118
+ }
119
+ }
120
+ }
121
+
122
+ if (0 == $corrupted_tables) {
123
+ $this->register_output(__('No corrupted tables found', 'wp-optimize'));
124
+ } else {
125
+ $this->register_output(sprintf(_n('%s corrupted table found', '%s corrupted tables found', $corrupted_tables), $corrupted_tables));
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Returns settings label.
131
+ *
132
+ * @return string
133
+ */
134
+ public function settings_label() {
135
+ return __('Repair database tables', 'wp-optimize');
136
+ }
137
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://david.dw-perspective.org.uk/donate
4
  Tags: comments, spam, optimize, database, revisions, users, posts, trash, schedule, automatic, clean, phpmyadmin, meta, postmeta, responsive, mobile
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
- Stable tag: 2.2.2
8
  License: GPLv2+
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -138,6 +138,15 @@ Please check your database for corrupted tables. That can happen, usually your w
138
 
139
  == Changelog ==
140
 
 
 
 
 
 
 
 
 
 
141
  = 2.2.2 - 28/Feb/2018 =
142
 
143
  * TWEAK: Prevent possible PHP notice when parsing logger options
@@ -388,4 +397,4 @@ Please check your database for corrupted tables. That can happen, usually your w
388
  * Fix Interface
389
 
390
  == Upgrade Notice ==
391
- * 2.2.2 : 2.2 has lots of new features, tweaks and fixes; including the introduction of a Premium version with even more features. 2.2.2 fixes bugs in the initial 2.2.0 release.
4
  Tags: comments, spam, optimize, database, revisions, users, posts, trash, schedule, automatic, clean, phpmyadmin, meta, postmeta, responsive, mobile
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
+ Stable tag: 2.2.3
8
  License: GPLv2+
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
138
 
139
  == Changelog ==
140
 
141
+ = 2.2.3 - 04/Apr/2018 =
142
+
143
+ * FEATURE: Added the ability to repair corrupted database tables
144
+ * FIX: Fixed dismiss notices functionality
145
+ * FIX: When detecting potentially unused images, exclude those found mentionned in the options table(s)
146
+ * TWEAK: Load WPO translations (logger classes info included) when template is pulled for UpdraftCentral-WPO module
147
+ * TWEAK: Add get_js_translation command for the UpdraftCentral WPO module
148
+ * TWEAK: Added logging for fatal errors
149
+
150
  = 2.2.2 - 28/Feb/2018 =
151
 
152
  * TWEAK: Prevent possible PHP notice when parsing logger options
397
  * Fix Interface
398
 
399
  == Upgrade Notice ==
400
+ * 2.2.3 : 2.2 has lots of new features, tweaks and fixes; including the introduction of a Premium version with even more features. 2.2.3 adds a feature for detecting and fixing MySQL corruption, plus some fixes and tweaks.
templates/optimizations-table.php CHANGED
@@ -13,11 +13,10 @@
13
  <tbody>
14
  <?php
15
  $optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
16
- $hidden_in_optimizations_list = apply_filters('wpo_hidden_in_optimizations_list', array('images', 'attachments'));
17
 
18
  foreach ($optimizations as $id => $optimization) {
19
  // If we don't want to show optimization on the first tab.
20
- if (in_array($id, $hidden_in_optimizations_list)) continue;
21
  // This is an array, with attributes dom_id, activated, settings_label, info; all values are strings.
22
  $use_ajax = defined('WP_OPTIMIZE_DEBUG_OPTIMIZATIONS') && WP_OPTIMIZE_DEBUG_OPTIMIZATIONS ? false : true;
23
  $html = $optimization->get_settings_html($use_ajax);
13
  <tbody>
14
  <?php
15
  $optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
 
16
 
17
  foreach ($optimizations as $id => $optimization) {
18
  // If we don't want to show optimization on the first tab.
19
+ if (false === $optimization->display_in_optimizations_list()) continue;
20
  // This is an array, with attributes dom_id, activated, settings_label, info; all values are strings.
21
  $use_ajax = defined('WP_OPTIMIZE_DEBUG_OPTIMIZATIONS') && WP_OPTIMIZE_DEBUG_OPTIMIZATIONS ? false : true;
22
  $html = $optimization->get_settings_html($use_ajax);
templates/tables-body.php CHANGED
@@ -49,7 +49,7 @@
49
  $inno_db_tables++;
50
  }
51
 
52
- do_action('wpo_tables_list_additional_column_data', $tablestatus);
53
 
54
  $row_usage += $tablestatus->Rows;
55
  $data_usage += $tablestatus->Data_length;
@@ -66,7 +66,7 @@
66
  echo '<tr class="thead">'."\n";
67
  echo '<th>'.__('Total:', 'wp-optimize').'</th>'."\n";
68
  echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no)).'</th>'."\n";
69
- echo '<th>'.sprintf(_n('%s Record', '%s Records', $row_usage, 'wp-optimize'), number_format_i18n($row_usage)).'</th>'."\n";
70
  echo '<th>'.$wp_optimize->format_size($data_usage).'</th>'."\n";
71
  echo '<th>'.$wp_optimize->format_size($index_usage).'</th>'."\n";
72
  echo '<th>'.'-'.'</th>'."\n";
@@ -78,6 +78,6 @@
78
 
79
  ?>
80
  </th>
81
- <?php do_action('wpo_tables_list_additional_column_footer'); ?>
82
  </tr>
83
  </tbody>
49
  $inno_db_tables++;
50
  }
51
 
52
+ echo '<td>'.apply_filters('wpo_tables_list_additional_column_data', '', $tablestatus).'</td>';
53
 
54
  $row_usage += $tablestatus->Rows;
55
  $data_usage += $tablestatus->Data_length;
66
  echo '<tr class="thead">'."\n";
67
  echo '<th>'.__('Total:', 'wp-optimize').'</th>'."\n";
68
  echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no)).'</th>'."\n";
69
+ echo '<th>'.number_format_i18n($row_usage).'</th>'."\n";
70
  echo '<th>'.$wp_optimize->format_size($data_usage).'</th>'."\n";
71
  echo '<th>'.$wp_optimize->format_size($index_usage).'</th>'."\n";
72
  echo '<th>'.'-'.'</th>'."\n";
78
 
79
  ?>
80
  </th>
81
+ <th><?php _e('Actions', 'wp-optimize'); ?></th>
82
  </tr>
83
  </tbody>
templates/tables.php CHANGED
@@ -25,7 +25,7 @@ do_action('wpo_tables_list_before', $table_information);
25
  <th><?php _e('Index Size', 'wp-optimize'); ?></th>
26
  <th><?php _e('Type', 'wp-optimize'); ?></th>
27
  <th><?php _e('Overhead', 'wp-optimize'); ?></th>
28
- <?php do_action('wpo_tables_list_additional_column_header'); ?>
29
  </tr>
30
  </thead>
31
 
25
  <th><?php _e('Index Size', 'wp-optimize'); ?></th>
26
  <th><?php _e('Type', 'wp-optimize'); ?></th>
27
  <th><?php _e('Overhead', 'wp-optimize'); ?></th>
28
+ <th><?php _e('Actions', 'wp-optimize'); ?></th>
29
  </tr>
30
  </thead>
31
 
wp-optimize.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Optimize
4
  Plugin URI: https://getwpo.com
5
  Description: WP-Optimize is WordPress's #1 most installed optimization plugin. With it, you can clean up your database easily and safely, without manual queries.
6
- Version: 2.2.2
7
  Author: David Anderson, Ruhani Rabin, Team Updraft
8
  Author URI: https://updraftplus.com
9
  Text Domain: wp-optimize
@@ -15,7 +15,7 @@ if (!defined('ABSPATH')) die('No direct access allowed');
15
 
16
  // Check to make sure if WP_Optimize is already call and returns.
17
  if (!class_exists('WP_Optimize')) :
18
- define('WPO_VERSION', '2.2.2');
19
  define('WPO_PLUGIN_URL', plugin_dir_url(__FILE__));
20
  define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path(__FILE__));
21
  define('WPO_PREMIUM_NOTIFICATION', false);
@@ -66,8 +66,13 @@ class WP_Optimize {
66
  // Show update to Premium notice for non-premium multisite.
67
  add_action('wpo_additional_options', array($this, 'show_multisite_update_to_premium_notice'));
68
 
 
 
 
69
  include_once(WPO_PLUGIN_MAIN_PATH.'/includes/updraftcentral.php');
70
 
 
 
71
  }
72
 
73
  public static function instance() {
@@ -318,10 +323,10 @@ class WP_Optimize {
318
  $results = array();
319
 
320
  // Some commands that are available via AJAX only.
321
- if ('dismiss_dash_notice_until' == $subaction) {
322
- $options->update_option('dismiss_dash_notice_until', (time() + 366 * 86400));
323
- } elseif ('dismiss_page_notice_until' == $subaction) {
324
- $options->update_option('dismiss_page_notice_until', (time() + 84 * 86400));
325
  } else {
326
  // Other commands, available for any remote method.
327
  if (!class_exists('WP_Optimize_Commands')) include_once(WPO_PLUGIN_MAIN_PATH . 'includes/class-commands.php');
@@ -521,6 +526,7 @@ class WP_Optimize {
521
  'please_select_settings_file' => __('Please, select settings file.', 'wp-optimize'),
522
  'are_you_sure_you_want_to_remove_logging_destination' => __('Are you sure you want to remove this logging destination?', 'wp-optimize'),
523
  'fill_all_settings_fields' => __('Before saving, you need to complete the currently incomplete settings (or remove them).', 'wp-optimize'),
 
524
  ));
525
  }
526
 
@@ -577,6 +583,26 @@ class WP_Optimize {
577
  return $links;
578
  }
579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  /**
581
  * Schedules cron event based on selected schedule type
582
  *
@@ -1198,6 +1224,18 @@ class WP_Optimize {
1198
 
1199
  return $val;
1200
  }
 
 
 
 
 
 
 
 
 
 
 
 
1201
  }
1202
 
1203
  /**
3
  Plugin Name: WP-Optimize
4
  Plugin URI: https://getwpo.com
5
  Description: WP-Optimize is WordPress's #1 most installed optimization plugin. With it, you can clean up your database easily and safely, without manual queries.
6
+ Version: 2.2.3
7
  Author: David Anderson, Ruhani Rabin, Team Updraft
8
  Author URI: https://updraftplus.com
9
  Text Domain: wp-optimize
15
 
16
  // Check to make sure if WP_Optimize is already call and returns.
17
  if (!class_exists('WP_Optimize')) :
18
+ define('WPO_VERSION', '2.2.3');
19
  define('WPO_PLUGIN_URL', plugin_dir_url(__FILE__));
20
  define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path(__FILE__));
21
  define('WPO_PREMIUM_NOTIFICATION', false);
66
  // Show update to Premium notice for non-premium multisite.
67
  add_action('wpo_additional_options', array($this, 'show_multisite_update_to_premium_notice'));
68
 
69
+ // Action column (show repair button if need).
70
+ add_filter('wpo_tables_list_additional_column_data', array($this, 'tables_list_additional_column_data'), 15, 2);
71
+
72
  include_once(WPO_PLUGIN_MAIN_PATH.'/includes/updraftcentral.php');
73
 
74
+ register_shutdown_function(array($this, 'log_fatal_errors'));
75
+
76
  }
77
 
78
  public static function instance() {
323
  $results = array();
324
 
325
  // Some commands that are available via AJAX only.
326
+ if (in_array($subaction, array('dismiss_dash_notice_until', 'dismiss_season'))) {
327
+ $options->update_option($subaction, (time() + 366 * 86400));
328
+ } elseif (in_array($subaction, array('dismiss_page_notice_until', 'dismiss_notice'))) {
329
+ $options->update_option($subaction, (time() + 84 * 86400));
330
  } else {
331
  // Other commands, available for any remote method.
332
  if (!class_exists('WP_Optimize_Commands')) include_once(WPO_PLUGIN_MAIN_PATH . 'includes/class-commands.php');
526
  'please_select_settings_file' => __('Please, select settings file.', 'wp-optimize'),
527
  'are_you_sure_you_want_to_remove_logging_destination' => __('Are you sure you want to remove this logging destination?', 'wp-optimize'),
528
  'fill_all_settings_fields' => __('Before saving, you need to complete the currently incomplete settings (or remove them).', 'wp-optimize'),
529
+ 'table_was_not_repaired' => __('%s was not repaired. For more details, please check your logs configured in logging destinations settings.', 'wp-optimize'),
530
  ));
531
  }
532
 
583
  return $links;
584
  }
585
 
586
+ /**
587
+ * Action wpo_tables_list_additional_column_data. Output button Optimize in the action column.
588
+ *
589
+ * @param string $content String for output to column
590
+ * @param object $table_info Object with table info.
591
+ *
592
+ * @return string
593
+ */
594
+ public function tables_list_additional_column_data($content, $table_info) {
595
+ if ($table_info->is_needing_repair) {
596
+ $content .= '<div class="wpo_button_wrap">'
597
+ .'<button class="button button-secondary run-single-table-repair" data-table="'.esc_attr($table_info->Name).'">'.__('Repair', 'wp-optimize').'</button>'
598
+ .'<img class="optimization_spinner visibility-hidden" src="'.esc_attr(admin_url('images/spinner-2x.gif')).'" width="20" height="20" alt="...">'
599
+ .'<span class="optimization_done_icon dashicons dashicons-yes visibility-hidden"></span>'
600
+ .'</div>';
601
+ }
602
+
603
+ return $content;
604
+ }
605
+
606
  /**
607
  * Schedules cron event based on selected schedule type
608
  *
1224
 
1225
  return $val;
1226
  }
1227
+
1228
+ /**
1229
+ * Log fatal errors to defined log destinations.
1230
+ */
1231
+ public function log_fatal_errors() {
1232
+ $last_error = error_get_last();
1233
+
1234
+ if (E_ERROR === $last_error['type']) {
1235
+ $this->get_logger()->critical($last_error['message']);
1236
+ die();
1237
+ }
1238
+ }
1239
  }
1240
 
1241
  /**