From 03d5132fc8acdedf61bdfeb231929dffdfc6907a Mon Sep 17 00:00:00 2001 From: Jack Reed Date: Tue, 5 Aug 2014 17:39:50 -0700 Subject: [PATCH] updates datatables to 1.10.2 --- .../dataTables/jquery.dataTables.js | 4389 +++++++++-------- 1 file changed, 2314 insertions(+), 2075 deletions(-) diff --git a/app/assets/javascripts/dataTables/jquery.dataTables.js b/app/assets/javascripts/dataTables/jquery.dataTables.js index fce3d1a..8a09f2d 100644 --- a/app/assets/javascripts/dataTables/jquery.dataTables.js +++ b/app/assets/javascripts/dataTables/jquery.dataTables.js @@ -1,11 +1,11 @@ -/*! DataTables 1.10.0 +/*! DataTables 1.10.2 * ©2008-2014 SpryMedia Ltd - datatables.net/license */ /** * @summary DataTables * @description Paginate, search and order HTML tables - * @version 1.10.0 + * @version 1.10.2 * @file jquery.dataTables.js * @author SpryMedia Ltd (www.sprymedia.co.uk) * @contact www.sprymedia.co.uk/contact @@ -80,7 +80,7 @@ */ var DataTable; - + /* * It is useful to have variables which are scoped locally so only the * DataTables functions can access them and they don't leak into global space. @@ -89,42 +89,43 @@ * by DataTables as private variables here. This also ensures that there is no * clashing of variable names and that they can easily referenced for reuse. */ - - + + // Defined else where // _selector_run // _selector_opts // _selector_first // _selector_row_indexes - + var _ext; // DataTable.ext var _Api; // DataTable.Api var _api_register; // DataTable.Api.register var _api_registerPlural; // DataTable.Api.registerPlural - + var _re_dic = {}; var _re_new_lines = /[\r\n]/g; var _re_html = /<.*?>/g; - var _re_date_start = /^[\d\+\-a-zA-Z]/; - + var _re_date_start = /^[\w\+\-]/; + var _re_date_end = /[\w\+\-]$/; + // Escape regular expression special characters var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' ); - + // U+2009 is thin space and U+202F is narrow no-break space, both used in many // standards as thousands separators var _re_formatted_numeric = /[',$£€¥%\u2009\u202F]/g; - - + + var _empty = function ( d ) { - return !d || d === '-' ? true : false; + return !d || d === true || d === '-' ? true : false; }; - - + + var _intVal = function ( s ) { var integer = parseInt( s, 10 ); return !isNaN(integer) && isFinite(s) ? integer : null; }; - + // Convert from a formatted number with characters other than `.` as the // decimal place, to a Javascript number var _numToDecimal = function ( num, decimalPoint ) { @@ -136,34 +137,34 @@ num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) : num; }; - - + + var _isNumber = function ( d, decimalPoint, formatted ) { var strType = typeof d === 'string'; - + if ( decimalPoint && strType ) { d = _numToDecimal( d, decimalPoint ); } - + if ( formatted && strType ) { d = d.replace( _re_formatted_numeric, '' ); } - - return !d || d==='-' || (!isNaN( parseFloat(d) ) && isFinite( d )); + + return _empty( d ) || (!isNaN( parseFloat(d) ) && isFinite( d )); }; - - + + // A string without HTML in it can be considered to be HTML still var _isHtml = function ( d ) { - return !d || typeof d === 'string'; + return _empty( d ) || typeof d === 'string'; }; - - + + var _htmlNumeric = function ( d, decimalPoint, formatted ) { if ( _empty( d ) ) { return true; } - + var html = _isHtml( d ); return ! html ? null : @@ -171,12 +172,12 @@ true : null; }; - - + + var _pluck = function ( a, prop, prop2 ) { var out = []; var i=0, ien=a.length; - + // Could have the test in the loop for slightly smaller code, but speed // is essential here if ( prop2 !== undefined ) { @@ -193,18 +194,18 @@ } } } - + return out; }; - - + + // Basically the same as _pluck, but rather than looping over `a` we use `order` // as the indexes to pick from `a` var _pluck_order = function ( a, order, prop, prop2 ) { var out = []; var i=0, ien=order.length; - + // Could have the test in the loop for slightly smaller code, but speed // is essential here if ( prop2 !== undefined ) { @@ -217,16 +218,16 @@ out.push( a[ order[i] ][ prop ] ); } } - + return out; }; - - + + var _range = function ( len, start ) { var out = []; var end; - + if ( start === undefined ) { start = 0; end = len; @@ -235,20 +236,20 @@ end = start; start = len; } - + for ( var i=start ; i') .css( { @@ -490,22 +503,22 @@ ) ) .appendTo( 'body' ); - + var test = n.find('.test'); - + // IE6/7 will oversize a width 100% element inside a scrolling element, to // include the width of the scrollbar, while other browsers ensure the inner // element is contained without forcing scrolling browser.bScrollOversize = test[0].offsetWidth === 100; - + // In rtl text layout, some browsers (most, but not all) will place the // scrollbar on the left, rather than the right. browser.bScrollbarLeft = test.offset().left !== 1; - + n.remove(); } - - + + /** * Array.prototype reduce[Right] method, used for browsers which don't support * JS 1.6. Done this way to reduce code size, since we iterate either way @@ -518,28 +531,28 @@ i = start, value, isSet = false; - + if ( init !== undefined ) { value = init; isSet = true; } - + while ( i !== end ) { if ( ! that.hasOwnProperty(i) ) { continue; } - + value = isSet ? fn( value, that[i], i, that ) : that[i]; - + isSet = true; i += inc; } - + return value; } - + /** * Add a column to the list used for the table with default values * @param {object} oSettings dataTables settings object @@ -559,18 +572,18 @@ idx: iCol } ); oSettings.aoColumns.push( oCol ); - + // Add search object for column specific search. Note that the `searchCols[ iCol ]` // passed into extend can be undefined. This allows the user to give a default // with only some of the parameters defined, and also not give a default var searchCols = oSettings.aoPreSearchCols; searchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch, searchCols[ iCol ] ); - + // Use the default column options function to initialise classes etc _fnColumnOptions( oSettings, iCol, null ); } - - + + /** * Apply options for a column * @param {object} oSettings dataTables settings object @@ -583,50 +596,50 @@ var oCol = oSettings.aoColumns[ iCol ]; var oClasses = oSettings.oClasses; var th = $(oCol.nTh); - + // Try to get width information from the DOM. We can't get it from CSS // as we'd need to parse the CSS stylesheet. `width` option can override if ( ! oCol.sWidthOrig ) { // Width attribute oCol.sWidthOrig = th.attr('width') || null; - + // Style attribute - var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%])/); + var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%]+)/); if ( t ) { oCol.sWidthOrig = t[1]; } } - + /* User specified column options */ if ( oOptions !== undefined && oOptions !== null ) { // Backwards compatibility _fnCompatCols( oOptions ); - + // Map camel case parameters to their Hungarian counterparts _fnCamelToHungarian( DataTable.defaults.column, oOptions ); - + /* Backwards compatibility for mDataProp */ if ( oOptions.mDataProp !== undefined && !oOptions.mData ) { oOptions.mData = oOptions.mDataProp; } - + if ( oOptions.sType ) { oCol._sManualType = oOptions.sType; } - + // `class` is a reserved word in Javascript, so we need to provide // the ability to use a valid name for the camel case input if ( oOptions.className && ! oOptions.sClass ) { oOptions.sClass = oOptions.className; } - + $.extend( oCol, oOptions ); _fnMap( oCol, oOptions, "sWidth", "sWidthOrig" ); - + /* iDataSort to be applied (backwards compatibility), but aDataSort will take * priority if defined */ @@ -636,37 +649,37 @@ } _fnMap( oCol, oOptions, "aDataSort" ); } - + /* Cache the data get and set functions for speed */ var mDataSrc = oCol.mData; var mData = _fnGetObjectDataFn( mDataSrc ); var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null; - + var attrTest = function( src ) { return typeof src === 'string' && src.indexOf('@') !== -1; }; oCol._bAttrSrc = $.isPlainObject( mDataSrc ) && ( attrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc.filter) ); - - oCol.fnGetData = function (oData, sSpecific) { - var innerData = mData( oData, sSpecific ); - - if ( oCol.mRender && (sSpecific && sSpecific !== '') ) - { - return mRender( innerData, sSpecific, oData ); - } - return innerData; + + oCol.fnGetData = function (rowData, type, meta) { + var innerData = mData( rowData, type, undefined, meta ); + + return mRender && type ? + mRender( innerData, type, rowData, meta ) : + innerData; + }; + oCol.fnSetData = function ( rowData, val, meta ) { + return _fnSetObjectDataFn( mDataSrc )( rowData, val, meta ); }; - oCol.fnSetData = _fnSetObjectDataFn( mDataSrc ); - + /* Feature sorting overrides column specific when off */ if ( !oSettings.oFeatures.bSort ) { oCol.bSortable = false; th.addClass( oClasses.sSortableNone ); // Have to add class here as order event isn't called } - + /* Check that the class assignment is correct for sorting */ var bAsc = $.inArray('asc', oCol.asSorting) !== -1; var bDesc = $.inArray('desc', oCol.asSorting) !== -1; @@ -691,8 +704,8 @@ oCol.sSortingClassJUI = oClasses.sSortJUI; } } - - + + /** * Adjust the table column widths for new data. Note: you would probably want to * do a redraw after calling this function! @@ -705,24 +718,24 @@ if ( settings.oFeatures.bAutoWidth !== false ) { var columns = settings.aoColumns; - + _fnCalculateColumnWidths( settings ); for ( var i=0 , iLen=columns.length ; i