bootswatch_rails 3.3.5.2 → 3.3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- /*! DataTables 1.10.9
1
+ /*! DataTables 1.10.10
2
2
  * ©2008-2015 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary DataTables
7
7
  * @description Paginate, search and order HTML tables
8
- * @version 1.10.9
8
+ * @version 1.10.10
9
9
  * @file jquery.dataTables.js
10
10
  * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
11
  * @contact www.sprymedia.co.uk/contact
@@ -24,26 +24,39 @@
24
24
  /*jslint evil: true, undef: true, browser: true */
25
25
  /*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/
26
26
 
27
- (/** @lends <global> */function( window, document, undefined ) {
28
-
29
27
  (function( factory ) {
30
28
  "use strict";
31
29
 
32
30
  if ( typeof define === 'function' && define.amd ) {
33
- // Define as an AMD module if possible
34
- define( 'datatables', ['jquery'], factory );
31
+ // AMD
32
+ define( ['jquery'], function ( $ ) {
33
+ return factory( $, window, document );
34
+ } );
35
35
  }
36
36
  else if ( typeof exports === 'object' ) {
37
- // Node/CommonJS
38
- module.exports = factory( require( 'jquery' ) );
37
+ // CommonJS
38
+ module.exports = function (root, $) {
39
+ if ( ! root ) {
40
+ // CommonJS environments without a window global must pass a
41
+ // root. This will give an error otherwise
42
+ root = window;
43
+ }
44
+
45
+ if ( ! $ ) {
46
+ $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
47
+ require('jquery') :
48
+ require('jquery')( root );
49
+ }
50
+
51
+ return factory( $, root, root.document );
52
+ };
39
53
  }
40
- else if ( jQuery && !jQuery.fn.dataTable ) {
41
- // Define using browser globals otherwise
42
- // Prevent multiple instantiations if the script is loaded twice
43
- factory( jQuery );
54
+ else {
55
+ // Browser
56
+ factory( jQuery, window, document );
44
57
  }
45
58
  }
46
- (/** @lends <global> */function( $ ) {
59
+ (function( $, window, document, undefined ) {
47
60
  "use strict";
48
61
 
49
62
  /**
@@ -471,6 +484,9 @@
471
484
  if ( typeof init.sScrollX === 'boolean' ) {
472
485
  init.sScrollX = init.sScrollX ? '100%' : '';
473
486
  }
487
+ if ( typeof init.scrollX === 'boolean' ) {
488
+ init.scrollX = init.scrollX ? '100%' : '';
489
+ }
474
490
 
475
491
  // Column search objects are in an array, so it needs to be converted
476
492
  // element by element
@@ -569,7 +585,6 @@
569
585
  // IE6/7 will oversize a width 100% element inside a scrolling element, to
570
586
  // include the width of the scrollbar, while other browsers ensure the inner
571
587
  // element is contained without forcing scrolling
572
- //console.log( inner.offsetWidth );
573
588
  browser.bScrollOversize = inner[0].offsetWidth === 100 && outer[0].clientWidth !== 100;
574
589
 
575
590
  // In rtl text layout, some browsers (most, but not all) will place the
@@ -1153,7 +1168,7 @@
1153
1168
  if ( settings.iDrawError != draw && defaultContent === null ) {
1154
1169
  _fnLog( settings, 0, "Requested unknown parameter "+
1155
1170
  (typeof col.mData=='function' ? '{function}' : "'"+col.mData+"'")+
1156
- " for row "+rowIdx, 4 );
1171
+ " for row "+rowIdx+", column "+colIdx, 4 );
1157
1172
  settings.iDrawError = draw;
1158
1173
  }
1159
1174
  return defaultContent;
@@ -1693,7 +1708,7 @@
1693
1708
  }
1694
1709
 
1695
1710
  // Read the ID from the DOM if present
1696
- var rowNode = td ? row : row.nTr;
1711
+ var rowNode = row.firstChild ? row : row.nTr;
1697
1712
 
1698
1713
  if ( rowNode ) {
1699
1714
  var id = rowNode.getAttribute( 'id' );
@@ -1748,6 +1763,11 @@
1748
1763
  oCol = oSettings.aoColumns[i];
1749
1764
 
1750
1765
  nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
1766
+ nTd._DT_CellIndex = {
1767
+ row: iRow,
1768
+ column: i
1769
+ };
1770
+
1751
1771
  cells.push( nTd );
1752
1772
 
1753
1773
  // Need to create the HTML if new, or if a rendering function is defined
@@ -3420,6 +3440,7 @@
3420
3440
  _fnAdjustColumnSizing( settings );
3421
3441
  }
3422
3442
 
3443
+ _fnCallbackFire( settings, null, 'plugin-init', [settings, json] );
3423
3444
  _fnCallbackFire( settings, 'aoInitComplete', 'init', [settings, json] );
3424
3445
  }
3425
3446
 
@@ -3696,17 +3717,6 @@
3696
3717
  return !s ? null : _fnStringToCss( s );
3697
3718
  };
3698
3719
 
3699
- // This is fairly messy, but with x scrolling enabled, if the table has a
3700
- // width attribute, regardless of any width applied using the column width
3701
- // options, the browser will shrink or grow the table as needed to fit into
3702
- // that 100%. That would make the width options useless. So we remove it.
3703
- // This is okay, under the assumption that width:100% is applied to the
3704
- // table in CSS (it is in the default stylesheet) which will set the table
3705
- // width as appropriate (the attribute and css behave differently...)
3706
- if ( scroll.sX && table.attr('width') === '100%' ) {
3707
- table.removeAttr('width');
3708
- }
3709
-
3710
3720
  if ( ! footer.length ) {
3711
3721
  footer = null;
3712
3722
  }
@@ -3881,6 +3891,20 @@
3881
3891
  style.height = 0;
3882
3892
  };
3883
3893
 
3894
+ // If the scrollbar visibility has changed from the last draw, we need to
3895
+ // adjust the column sizes as the table width will have changed to account
3896
+ // for the scrollbar
3897
+ var scrollBarVis = divBodyEl.scrollHeight > divBodyEl.clientHeight;
3898
+
3899
+ if ( settings.scrollBarVis !== scrollBarVis && settings.scrollBarVis !== undefined ) {
3900
+ settings.scrollBarVis = scrollBarVis;
3901
+ _fnAdjustColumnSizing( settings );
3902
+ return; // adjust column sizing will call this function again
3903
+ }
3904
+ else {
3905
+ settings.scrollBarVis = scrollBarVis;
3906
+ }
3907
+
3884
3908
  /*
3885
3909
  * 1. Re-create the table inside the scrolling div
3886
3910
  */
@@ -4180,7 +4204,7 @@
4180
4204
  for ( i=0 ; i<columnCount ; i++ ) {
4181
4205
  var colIdx = _fnVisibleToColumnIndex( oSettings, i );
4182
4206
 
4183
- if ( colIdx ) {
4207
+ if ( colIdx !== null ) {
4184
4208
  columns[ colIdx ].sWidth = _fnStringToCss( headerCells.eq(i).width() );
4185
4209
  }
4186
4210
  }
@@ -4219,6 +4243,19 @@
4219
4243
  headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
4220
4244
  _fnStringToCss( column.sWidthOrig ) :
4221
4245
  '';
4246
+
4247
+ // For scrollX we need to force the column width otherwise the
4248
+ // browser will collapse it. If this width is smaller than the
4249
+ // width the column requires, then it will have no effect
4250
+ if ( column.sWidthOrig && scrollX ) {
4251
+ $( headerCells[i] ).append( $('<div/>').css( {
4252
+ width: column.sWidthOrig,
4253
+ margin: 0,
4254
+ padding: 0,
4255
+ border: 0,
4256
+ height: 1
4257
+ } ) );
4258
+ }
4222
4259
  }
4223
4260
 
4224
4261
  // Find the widest cell for each column and put it into the table
@@ -4261,8 +4298,11 @@
4261
4298
  }
4262
4299
  else if ( scrollX ) {
4263
4300
  tmpTable.css( 'width', 'auto' );
4301
+ tmpTable.removeAttr('width');
4264
4302
 
4265
- if ( tmpTable.width() < tableContainer.clientWidth ) {
4303
+ // If there is no width attribute or style, then allow the table to
4304
+ // collapse
4305
+ if ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) {
4266
4306
  tmpTable.width( tableContainer.clientWidth );
4267
4307
  }
4268
4308
  }
@@ -4273,44 +4313,32 @@
4273
4313
  tmpTable.width( tableWidthAttr );
4274
4314
  }
4275
4315
 
4276
- // Browsers need a bit of a hand when a width is assigned to any columns
4277
- // when x-scrolling as they tend to collapse the table to the min-width,
4278
- // even if we sent the column widths. So we need to keep track of what
4279
- // the table width should be by summing the user given values, and the
4280
- // automatic values
4281
- if ( scrollX )
4282
- {
4283
- var total = 0;
4284
-
4285
- for ( i=0 ; i<visibleColumns.length ; i++ ) {
4286
- column = columns[ visibleColumns[i] ];
4287
-
4288
- // Much prefer to use getBoundingClientRect due to its sub-pixel
4289
- // resolution, but IE8- do not support the width property.
4290
- outerWidth = browser.bBounding ?
4291
- headerCells[i].getBoundingClientRect().width :
4292
- $(headerCells[i]).outerWidth();
4293
-
4294
- total += column.sWidthOrig === null ?
4295
- outerWidth :
4296
- parseInt( column.sWidth, 10 ) + outerWidth - $(headerCells[i]).width();
4297
- }
4316
+ // Get the width of each column in the constructed table - we need to
4317
+ // know the inner width (so it can be assigned to the other table's
4318
+ // cells) and the outer width so we can calculate the full width of the
4319
+ // table. This is safe since DataTables requires a unique cell for each
4320
+ // column, but if ever a header can span multiple columns, this will
4321
+ // need to be modified.
4322
+ var total = 0;
4323
+ for ( i=0 ; i<visibleColumns.length ; i++ ) {
4324
+ var cell = $(headerCells[i]);
4325
+ var border = cell.outerWidth() - cell.width();
4298
4326
 
4299
- tmpTable.width( _fnStringToCss( total ) );
4300
- table.style.width = _fnStringToCss( total );
4301
- }
4327
+ // Use getBounding... where possible (not IE8-) because it can give
4328
+ // sub-pixel accuracy, which we then want to round up!
4329
+ var bounding = browser.bBounding ?
4330
+ Math.ceil( headerCells[i].getBoundingClientRect().width ) :
4331
+ cell.outerWidth();
4302
4332
 
4303
- // Get the width of each column in the constructed table
4304
- for ( i=0 ; i<visibleColumns.length ; i++ ) {
4305
- column = columns[ visibleColumns[i] ];
4306
- width = $(headerCells[i]).width();
4333
+ // Total is tracked to remove any sub-pixel errors as the outerWidth
4334
+ // of the table might not equal the total given here (IE!).
4335
+ total += bounding;
4307
4336
 
4308
- if ( width ) {
4309
- column.sWidth = _fnStringToCss( width );
4310
- }
4337
+ // Width for each column to use
4338
+ columns[ visibleColumns[i] ].sWidth = _fnStringToCss( bounding - border );
4311
4339
  }
4312
4340
 
4313
- table.style.width = _fnStringToCss( tmpTable.css('width') );
4341
+ table.style.width = _fnStringToCss( total );
4314
4342
 
4315
4343
  // Finished with the table - ditch it
4316
4344
  holder.remove();
@@ -4440,6 +4468,7 @@
4440
4468
  for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
4441
4469
  s = _fnGetCellData( settings, i, colIdx, 'display' )+'';
4442
4470
  s = s.replace( __re_html_remove, '' );
4471
+ s = s.replace( /&nbsp;/g, ' ' );
4443
4472
 
4444
4473
  if ( s.length > max ) {
4445
4474
  max = s.length;
@@ -7373,7 +7402,7 @@
7373
7402
  var
7374
7403
  settings = this.context[0],
7375
7404
  start = settings._iDisplayStart,
7376
- len = settings._iDisplayLength,
7405
+ len = settings.oFeatures.bPaginate ? settings._iDisplayLength : -1,
7377
7406
  visRecords = settings.fnRecordsDisplay(),
7378
7407
  all = len === -1;
7379
7408
 
@@ -7876,13 +7905,26 @@
7876
7905
  this.iterator( 'row', function ( settings, row, thatIdx ) {
7877
7906
  var data = settings.aoData;
7878
7907
  var rowData = data[ row ];
7908
+ var i, ien, j, jen;
7909
+ var loopRow, loopCells;
7879
7910
 
7880
7911
  data.splice( row, 1 );
7881
7912
 
7882
- // Update the _DT_RowIndex parameter on all rows in the table
7883
- for ( var i=0, ien=data.length ; i<ien ; i++ ) {
7884
- if ( data[i].nTr !== null ) {
7885
- data[i].nTr._DT_RowIndex = i;
7913
+ // Update the cached indexes
7914
+ for ( i=0, ien=data.length ; i<ien ; i++ ) {
7915
+ loopRow = data[i];
7916
+ loopCells = loopRow.anCells;
7917
+
7918
+ // Rows
7919
+ if ( loopRow.nTr !== null ) {
7920
+ loopRow.nTr._DT_RowIndex = i;
7921
+ }
7922
+
7923
+ // Cells
7924
+ if ( loopCells !== null ) {
7925
+ for ( j=0, jen=loopCells.length ; j<jen ; j++ ) {
7926
+ loopCells[j]._DT_CellIndex.row = i;
7927
+ }
7886
7928
  }
7887
7929
  }
7888
7930
 
@@ -8379,7 +8421,7 @@
8379
8421
  }
8380
8422
  }
8381
8423
 
8382
- _fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis] );
8424
+ _fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis, recalc] );
8383
8425
 
8384
8426
  _fnSaveState( settings );
8385
8427
  };
@@ -8540,24 +8582,10 @@
8540
8582
  return allCells
8541
8583
  .filter( s )
8542
8584
  .map( function (i, el) {
8543
- if ( el.parentNode ) {
8544
- row = el.parentNode._DT_RowIndex;
8545
- }
8546
- else {
8547
- // If no parent node, then the cell is hidden and we'll need
8548
- // to traverse the array to find it
8549
- for ( i=0, ien=data.length ; i<ien ; i++ ) {
8550
- if ( $.inArray( el, data[i].anCells ) !== -1 ) {
8551
- row = i;
8552
- break;
8553
- }
8554
- }
8555
- }
8556
-
8557
- return {
8558
- row: row,
8559
- column: $.inArray( el, data[ row ].anCells )
8560
- };
8585
+ return { // use a new object, in case someone changes the values
8586
+ row: el._DT_CellIndex.row,
8587
+ column: el._DT_CellIndex.column
8588
+ };
8561
8589
  } )
8562
8590
  .toArray();
8563
8591
  };
@@ -8774,6 +8802,24 @@
8774
8802
  } );
8775
8803
 
8776
8804
 
8805
+ _api_register( 'order.fixed()', function ( set ) {
8806
+ if ( ! set ) {
8807
+ var ctx = this.context;
8808
+ var fixed = ctx.length ?
8809
+ ctx[0].aaSortingFixed :
8810
+ undefined;
8811
+
8812
+ return $.isArray( fixed ) ?
8813
+ { pre: fixed } :
8814
+ fixed;
8815
+ }
8816
+
8817
+ return this.iterator( 'table', function ( settings ) {
8818
+ settings.aaSortingFixed = $.extend( true, {}, set );
8819
+ } );
8820
+ } );
8821
+
8822
+
8777
8823
  // Order by the selected column(s)
8778
8824
  _api_register( [
8779
8825
  'columns().order()',
@@ -9205,6 +9251,9 @@
9205
9251
  // Add the `every()` method for rows, columns and cells in a compact form
9206
9252
  $.each( [ 'column', 'row', 'cell' ], function ( i, type ) {
9207
9253
  _api_register( type+'s().every()', function ( fn ) {
9254
+ var opts = this.selector.opts;
9255
+ var api = this;
9256
+
9208
9257
  return this.iterator( type, function ( settings, arg1, arg2, arg3, arg4 ) {
9209
9258
  // Rows and columns:
9210
9259
  // arg1 - index
@@ -9217,7 +9266,11 @@
9217
9266
  // arg3 - table counter
9218
9267
  // arg4 - loop counter
9219
9268
  fn.call(
9220
- new _Api( settings )[ type ]( arg1, type==='cell' ? arg2 : undefined ),
9269
+ api[ type ](
9270
+ arg1,
9271
+ type==='cell' ? arg2 : opts,
9272
+ type==='cell' ? opts : undefined
9273
+ ),
9221
9274
  arg1, arg2, arg3, arg4
9222
9275
  );
9223
9276
  } );
@@ -9252,7 +9305,7 @@
9252
9305
  * @type string
9253
9306
  * @default Version number
9254
9307
  */
9255
- DataTable.version = "1.10.9";
9308
+ DataTable.version = "1.10.10";
9256
9309
 
9257
9310
  /**
9258
9311
  * Private data store, containing all of the settings objects that are
@@ -13701,6 +13754,14 @@
13701
13754
  classes: {},
13702
13755
 
13703
13756
 
13757
+ /**
13758
+ * DataTables build type (expanded by the download builder)
13759
+ *
13760
+ * @type string
13761
+ */
13762
+ builder: "-source-",
13763
+
13764
+
13704
13765
  /**
13705
13766
  * Error reporting.
13706
13767
  *
@@ -14384,6 +14445,7 @@
14384
14445
  _: function ( settings, host, idx, buttons, page, pages ) {
14385
14446
  var classes = settings.oClasses;
14386
14447
  var lang = settings.oLanguage.oPaginate;
14448
+ var aria = settings.oLanguage.oAria.paginate || {};
14387
14449
  var btnDisplay, btnClass, counter=0;
14388
14450
 
14389
14451
  var attach = function( container, buttons ) {
@@ -14444,6 +14506,7 @@
14444
14506
  node = $('<a>', {
14445
14507
  'class': classes.sPageButton+' '+btnClass,
14446
14508
  'aria-controls': settings.sTableId,
14509
+ 'aria-label': aria[ button ],
14447
14510
  'data-dt-idx': counter,
14448
14511
  'tabindex': settings.iTabIndex,
14449
14512
  'id': idx === 0 && typeof button === 'string' ?
@@ -14777,6 +14840,8 @@
14777
14840
  * * `integer` - Number of decimal points to show
14778
14841
  * * `string` (optional) - Prefix.
14779
14842
  * * `string` (optional) - Postfix (/suffix).
14843
+ * * `text` - Escape HTML to help prevent XSS attacks. It has no optional
14844
+ * parameters.
14780
14845
  *
14781
14846
  * @example
14782
14847
  * // Column definition using the number renderer
@@ -14796,7 +14861,15 @@
14796
14861
  }
14797
14862
 
14798
14863
  var negative = d < 0 ? '-' : '';
14799
- d = Math.abs( parseFloat( d ) );
14864
+ var flo = parseFloat( d );
14865
+
14866
+ // If NaN then there isn't much formatting that we can do - just
14867
+ // return immediately
14868
+ if ( isNaN( flo ) ) {
14869
+ return d;
14870
+ }
14871
+
14872
+ d = Math.abs( flo );
14800
14873
 
14801
14874
  var intPart = parseInt( d, 10 );
14802
14875
  var floatPart = precision ?
@@ -14811,6 +14884,16 @@
14811
14884
  (postfix||'');
14812
14885
  }
14813
14886
  };
14887
+ },
14888
+
14889
+ text: function () {
14890
+ return {
14891
+ display: function ( d ) {
14892
+ return typeof d === 'string' ?
14893
+ d.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;') :
14894
+ d;
14895
+ }
14896
+ };
14814
14897
  }
14815
14898
  };
14816
14899
 
@@ -14943,6 +15026,9 @@
14943
15026
  // jQuery access
14944
15027
  $.fn.dataTable = DataTable;
14945
15028
 
15029
+ // Provide access to the host jQuery object (circular reference)
15030
+ DataTable.$ = $;
15031
+
14946
15032
  // Legacy aliases
14947
15033
  $.fn.dataTableSettings = DataTable.settings;
14948
15034
  $.fn.dataTableExt = DataTable.ext;
@@ -15124,6 +15210,3 @@
15124
15210
 
15125
15211
  return $.fn.dataTable;
15126
15212
  }));
15127
-
15128
- }(window, document));
15129
-