1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-04 16:24:11 +01:00
DataTables/media/js/dataTables.foundation.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

8 lines
1.6 KiB
JavaScript

/*!
DataTables Foundation integration
©2011-2015 SpryMedia Ltd - datatables.net/license
*/
(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables"],c):"object"===typeof exports?module.exports=function(a,d){a||(a=require("jquery"));c(a,d||a.fn.dataTable||require("datatables"))}:jQuery&&c(jQuery,jQuery.fn.dataTable)})(function(c,a){c.extend(a.ext.classes,{sWrapper:"dataTables_wrapper dt-foundation",sProcessing:"dataTables_processing panel"});c.extend(!0,a.defaults,{dom:"<'row'<'small-6 columns'l><'small-6 columns'f>r>t<'row'<'small-6 columns'i><'small-6 columns'p>>",
renderer:"foundation"});a.ext.renderer.pageButton.foundation=function(d,j,q,r,g,k){var l=new a.Api(d),s=d.oClasses,h=d.oLanguage.oPaginate,e,f,p=function(a,m){var i,n,o,b,j=function(a){a.preventDefault();!c(a.currentTarget).hasClass("unavailable")&&l.page()!=a.data.action&&l.page(a.data.action).draw("page")};i=0;for(n=m.length;i<n;i++)if(b=m[i],c.isArray(b))p(a,b);else{f=e="";switch(b){case "ellipsis":e="&hellip;";f="unavailable";break;case "first":e=h.sFirst;f=b+(0<g?"":" unavailable");break;case "previous":e=
h.sPrevious;f=b+(0<g?"":" unavailable");break;case "next":e=h.sNext;f=b+(g<k-1?"":" unavailable");break;case "last":e=h.sLast;f=b+(g<k-1?"":" unavailable");break;default:e=b+1,f=g===b?"current":""}e&&(o=c("<li>",{"class":s.sPageButton+" "+f,"aria-controls":d.sTableId,tabindex:d.iTabIndex,id:0===q&&"string"===typeof b?d.sTableId+"_"+b:null}).append(c("<a>",{href:"#"}).html(e)).appendTo(a),d.oApi._fnBindAction(o,{action:b},j))}};p(c(j).empty().html('<ul class="pagination"/>').children("ul"),r)};return a});