1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-12 00:08:48 +01:00
DataTables/media/js/dataTables.foundation.min.js
Allan Jardine b36cbc745b Update: Allow a window to be passed in for CommonJS factory which gives DataTables the ability to be used in a headless environment (server-side rendering for example)
- Factory builder redesigned to pass in window and document to the
  factory method, mandating a small update to the AMD and Browser
  loaders
- Main change in is the CommonJS loader which can now optionally have a
  window object passed in - if it is not passed in `window` will be used
  (if this is the case in a CommonJS environment without a root object
  being passed in an error will occur).
- DataTables caches a reference to the jQuery instance so the plug-ins
  can easily reference jQuery while retaining their current return of
  the module they define. This basically means that DataTables core will
  include jQuery for the plug-ins.
- This does increase the core library size by ~160 bytes which is rather
  frustrating, but I think this is the correct way to go about it
- With thanks to Evan Carroll for input on this:
  https://github.com/DataTables/Plugins/issues/199
2015-11-03 16:32:39 +00:00

9 lines
1.7 KiB
JavaScript

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