1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-02 14:24:11 +01:00
DataTables/media/js/dataTables.bootstrap.min.js
Allan Jardine c0cb3db92f New: DataTables no longer defines itself as a named AMD module
New: CommonJS will load jQuery if it wasn't passed in
Fix: Bootstrap, Foundation and jQuery UI integration Javascript files use module.exports correctly
Dev: Change the file include "function" name to not conflict with `require`

- AMD / RequireJS - The Require documentation strongly discorages using
  a named module, but I've used this in the past as the plug-ins need a
  name to depend upon themselves. This is still `datatables` but if the
  developer is using Require and it resolves automatically to a
  different name (which it may depending upon their configuration) they
  can use a map option to map their name to `datatables`. See
  https://github.com/moment/moment/issues/1095

- CommonJS - Based on the disscussion in
  https://github.com/DataTables/Plugins/issues/199 it seems that some
  developers like to pass a certain version of jQuery in. This
  modification allows them to do so while retaining backwards
  compatiblity.

- Integration files - The UMD wrapper for these files have been
  restructured to be easier to follow. Also, based on the discussion in
  the Plugins issue noted above you can now pass in a jQuery instance or
  not and likewise a DataTables object or not.

- To avoid direct conflict with `require()` the build scripts have been
  updated to use a "function" called `_buildInclude`. Ultimatily this
  should really be updated to use grunt or similar.
2015-10-06 12:03:36 +01:00

10 lines
2.2 KiB
JavaScript

/*!
DataTables Bootstrap 3 integration
©2011-2015 SpryMedia Ltd - datatables.net/license
*/
(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables"],b):"object"===typeof exports?module.exports=function(a,d){a||(a=require("jquery"));b(a,d||a.fn.dataTable||require("datatables"))}:jQuery&&b(jQuery,jQuery.fn.dataTable)})(function(b,a){b.extend(!0,a.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"});b.extend(a.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",
sLengthSelect:"form-control input-sm",sProcessing:"dataTables_processing panel panel-default"});a.ext.renderer.pageButton.bootstrap=function(d,g,r,l,i,m){var n=new a.Api(d),s=d.oClasses,j=d.oLanguage.oPaginate,e,f,o=0,q=function(a,g){var k,h,p,c,l=function(a){a.preventDefault();!b(a.currentTarget).hasClass("disabled")&&n.page()!=a.data.action&&n.page(a.data.action).draw("page")};k=0;for(h=g.length;k<h;k++)if(c=g[k],b.isArray(c))q(a,c);else{f=e="";switch(c){case "ellipsis":e="&hellip;";f="disabled";
break;case "first":e=j.sFirst;f=c+(0<i?"":" disabled");break;case "previous":e=j.sPrevious;f=c+(0<i?"":" disabled");break;case "next":e=j.sNext;f=c+(i<m-1?"":" disabled");break;case "last":e=j.sLast;f=c+(i<m-1?"":" disabled");break;default:e=c+1,f=i===c?"active":""}e&&(p=b("<li>",{"class":s.sPageButton+" "+f,id:0===r&&"string"===typeof c?d.sTableId+"_"+c:null}).append(b("<a>",{href:"#","aria-controls":d.sTableId,"data-dt-idx":o,tabindex:d.iTabIndex}).html(e)).appendTo(a),d.oApi._fnBindAction(p,{action:c},
l),o++)}},h;try{h=b(g).find(document.activeElement).data("dt-idx")}catch(t){}q(b(g).empty().html('<ul class="pagination"/>').children("ul"),l);h&&b(g).find("[data-dt-idx="+h+"]").focus()};a.TableTools&&(b.extend(!0,a.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default",disabled:"disabled"},collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info"},select:{row:"active"}}),b.extend(!0,a.TableTools.DEFAULTS.oTags,
{collection:{container:"ul",button:"li",liner:"a"}}));return a});