From 8e1068e603d67b088c4fa45fea46c4e12d7b2527 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Sun, 7 Oct 2012 18:13:16 +0100 Subject: [PATCH] Dev fix: Fix issue highlighted by JSHint - The DataTable object is addressed in the private methods so it needs to be defined before them, but the contracturo needs to come after the priavte methods! --- media/js/jquery.dataTables.js | 91 +++++++++++++++++------------------ media/src/DataTables.js | 38 ++++++++------- 2 files changed, 64 insertions(+), 65 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 59108f2f..003f04e8 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -44,6 +44,40 @@ (/** @lends */function( $ ) { "use strict"; + /** + * DataTables is a plug-in for the jQuery Javascript library. It is a + * highly flexible tool, based upon the foundations of progressive + * enhancement, which will add advanced interaction controls to any + * HTML table. For a full list of features please refer to + * DataTables.net. + * + * Note that the DataTable object is not a global variable but is + * aliased to jQuery.fn.DataTable and jQuery.fn.dataTable through which + * it may be accessed. + * + * @class + * @param {object} [oInit={}] Configuration object for DataTables. Options + * are defined by {@link DataTable.defaults} + * @requires jQuery 1.3+ + * + * @example + * // Basic initialisation + * $(document).ready( function { + * $('#example').dataTable(); + * } ); + * + * @example + * // Initialisation with configuration options - in this case, disable + * // pagination and sorting. + * $(document).ready( function { + * $('#example').dataTable( { + * "bPaginate": false, + * "bSort": false + * } ); + * } ); + */ + var DataTable; + /** @@ -2017,7 +2051,6 @@ } - /** * Generate the node required for filtering text * @returns {node} Filter control element @@ -2354,22 +2387,19 @@ */ function _fnFilterCreateSearch( sSearch, bRegex, bSmart, bCaseInsensitive ) { - var asSearch, sRegExpString; + var asSearch, + sRegExpString = bRegex ? sSearch : _fnEscapeRegex( sSearch ); if ( bSmart ) { /* Generate the regular expression to use. Something along the lines of: * ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$ */ - asSearch = bRegex ? sSearch.split( ' ' ) : _fnEscapeRegex( sSearch ).split( ' ' ); + asSearch = sRegExpString.split( ' ' ); sRegExpString = '^(?=.*?'+asSearch.join( ')(?=.*?' )+').*$'; - return new RegExp( sRegExpString, bCaseInsensitive ? "i" : "" ); - } - else - { - sSearch = bRegex ? sSearch : _fnEscapeRegex( sSearch ); - return new RegExp( sSearch, bCaseInsensitive ? "i" : "" ); } + + return new RegExp( sRegExpString, bCaseInsensitive ? "i" : "" ); } @@ -4920,40 +4950,8 @@ document.body.removeChild( n ); } - - /** - * DataTables is a plug-in for the jQuery Javascript library. It is a - * highly flexible tool, based upon the foundations of progressive - * enhancement, which will add advanced interaction controls to any - * HTML table. For a full list of features please refer to - * DataTables.net. - * - * Note that the DataTable object is not a global variable but is - * aliased to jQuery.fn.DataTable and jQuery.fn.dataTable through which - * it may be accessed. - * - * @class - * @param {object} [oInit={}] Configuration object for DataTables. Options - * are defined by {@link DataTable.defaults} - * @requires jQuery 1.3+ - * - * @example - * // Basic initialisation - * $(document).ready( function { - * $('#example').dataTable(); - * } ); - * - * @example - * // Initialisation with configuration options - in this case, disable - * // pagination and sorting. - * $(document).ready( function { - * $('#example').dataTable( { - * "bPaginate": false, - * "bSort": false - * } ); - * } ); - */ - var DataTable = function( oInit ) + + DataTable = function( oInit ) { /** * Perform a jQuery selector action on the table's TR elements (from the tbody) and @@ -6811,7 +6809,6 @@ return this; }; - /** * Provide a common method for plug-ins to check the version of DataTables being used, in order * to ensure compatibility. @@ -6829,7 +6826,7 @@ { var aThis = DataTable.ext.sVersion.split('.'); var aThat = sVersion.split('.'); - var iThis, sThat; + var iThis, iThat; for ( var i=0, iLen=aThat.length ; i */function( $ ) { "use strict"; - require('core.compat.js'); - require('core.columns.js'); - require('core.data.js'); - require('core.draw.js'); - require('core.ajax.js'); - require('core.filter.js'); - require('core.info.js'); - require('core.init.js'); - require('core.length.js'); - require('core.page.js'); - require('core.processing.js'); - require('core.scrolling.js'); - require('core.sizing.js'); - require('core.sort.js'); - require('core.state.js'); - require('core.support.js'); - /** * DataTables is a plug-in for the jQuery Javascript library. It is a * highly flexible tool, based upon the foundations of progressive @@ -93,7 +76,26 @@ * } ); * } ); */ - var DataTable = function( oInit ) + var DataTable; + + require('core.compat.js'); + require('core.columns.js'); + require('core.data.js'); + require('core.draw.js'); + require('core.ajax.js'); + require('core.filter.js'); + require('core.info.js'); + require('core.init.js'); + require('core.length.js'); + require('core.page.js'); + require('core.processing.js'); + require('core.scrolling.js'); + require('core.sizing.js'); + require('core.sort.js'); + require('core.state.js'); + require('core.support.js'); + + DataTable = function( oInit ) { require('api.methods.js'); require('api.internal.js');