source: public/vendors/dataTable/DataTables-1.10.20/js/dataTables.foundation.js@ 4952f8e

develop
Last change on this file since 4952f8e was 7304c7f, checked in by beratkjufliju <kufliju@…>, 3 years ago

added user authentication, create & forgot password methods and blades

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*! DataTables Foundation integration
2 * ©2011-2015 SpryMedia Ltd - datatables.net/license
3 */
4
5/**
6 * DataTables integration for Foundation. This requires Foundation 5 and
7 * DataTables 1.10 or newer.
8 *
9 * This file sets the defaults and adds options to DataTables to style its
10 * controls using Foundation. See http://datatables.net/manual/styling/foundation
11 * for further information.
12 */
13(function( factory ){
14 if ( typeof define === 'function' && define.amd ) {
15 // AMD
16 define( ['jquery', 'datatables.net'], function ( $ ) {
17 return factory( $, window, document );
18 } );
19 }
20 else if ( typeof exports === 'object' ) {
21 // CommonJS
22 module.exports = function (root, $) {
23 if ( ! root ) {
24 root = window;
25 }
26
27 if ( ! $ || ! $.fn.dataTable ) {
28 $ = require('datatables.net')(root, $).$;
29 }
30
31 return factory( $, root, root.document );
32 };
33 }
34 else {
35 // Browser
36 factory( jQuery, window, document );
37 }
38}(function( $, window, document, undefined ) {
39'use strict';
40var DataTable = $.fn.dataTable;
41
42// Detect Foundation 5 / 6 as they have different element and class requirements
43var meta = $('<meta class="foundation-mq"/>').appendTo('head');
44DataTable.ext.foundationVersion = meta.css('font-family').match(/small|medium|large/) ? 6 : 5;
45meta.remove();
46
47
48$.extend( DataTable.ext.classes, {
49 sWrapper: "dataTables_wrapper dt-foundation",
50 sProcessing: "dataTables_processing panel callout"
51} );
52
53
54/* Set the defaults for DataTables initialisation */
55$.extend( true, DataTable.defaults, {
56 dom:
57 "<'row grid-x'<'small-6 columns cell'l><'small-6 columns cell'f>r>"+
58 "t"+
59 "<'row grid-x'<'small-6 columns cell'i><'small-6 columns cell'p>>",
60 renderer: 'foundation'
61} );
62
63
64/* Page button renderer */
65DataTable.ext.renderer.pageButton.foundation = function ( settings, host, idx, buttons, page, pages ) {
66 var api = new DataTable.Api( settings );
67 var classes = settings.oClasses;
68 var lang = settings.oLanguage.oPaginate;
69 var aria = settings.oLanguage.oAria.paginate || {};
70 var btnDisplay, btnClass;
71 var tag;
72 var v5 = DataTable.ext.foundationVersion === 5;
73
74 var attach = function( container, buttons ) {
75 var i, ien, node, button;
76 var clickHandler = function ( e ) {
77 e.preventDefault();
78 if ( !$(e.currentTarget).hasClass('unavailable') && api.page() != e.data.action ) {
79 api.page( e.data.action ).draw( 'page' );
80 }
81 };
82
83 for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
84 button = buttons[i];
85
86 if ( $.isArray( button ) ) {
87 attach( container, button );
88 }
89 else {
90 btnDisplay = '';
91 btnClass = '';
92 tag = null;
93
94 switch ( button ) {
95 case 'ellipsis':
96 btnDisplay = '&#x2026;';
97 btnClass = 'unavailable disabled';
98 tag = null;
99 break;
100
101 case 'first':
102 btnDisplay = lang.sFirst;
103 btnClass = button + (page > 0 ?
104 '' : ' unavailable disabled');
105 tag = page > 0 ? 'a' : null;
106 break;
107
108 case 'previous':
109 btnDisplay = lang.sPrevious;
110 btnClass = button + (page > 0 ?
111 '' : ' unavailable disabled');
112 tag = page > 0 ? 'a' : null;
113 break;
114
115 case 'next':
116 btnDisplay = lang.sNext;
117 btnClass = button + (page < pages-1 ?
118 '' : ' unavailable disabled');
119 tag = page < pages-1 ? 'a' : null;
120 break;
121
122 case 'last':
123 btnDisplay = lang.sLast;
124 btnClass = button + (page < pages-1 ?
125 '' : ' unavailable disabled');
126 tag = page < pages-1 ? 'a' : null;
127 break;
128
129 default:
130 btnDisplay = button + 1;
131 btnClass = page === button ?
132 'current' : '';
133 tag = page === button ?
134 null : 'a';
135 break;
136 }
137
138 if ( v5 ) {
139 tag = 'a';
140 }
141
142 if ( btnDisplay ) {
143 node = $('<li>', {
144 'class': classes.sPageButton+' '+btnClass,
145 'aria-controls': settings.sTableId,
146 'aria-label': aria[ button ],
147 'tabindex': settings.iTabIndex,
148 'id': idx === 0 && typeof button === 'string' ?
149 settings.sTableId +'_'+ button :
150 null
151 } )
152 .append( tag ?
153 $('<'+tag+'/>', {'href': '#'} ).html( btnDisplay ) :
154 btnDisplay
155 )
156 .appendTo( container );
157
158 settings.oApi._fnBindAction(
159 node, {action: button}, clickHandler
160 );
161 }
162 }
163 }
164 };
165
166 attach(
167 $(host).empty().html('<ul class="pagination"/>').children('ul'),
168 buttons
169 );
170};
171
172
173return DataTable;
174}));
Note: See TracBrowser for help on using the repository browser.