source: public/vendors/dataTable/DataTables-1.10.20/js/dataTables.bootstrap.js@ e756bd9

develop
Last change on this file since e756bd9 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.5 KB
Line 
1/*! DataTables Bootstrap 3 integration
2 * ©2011-2015 SpryMedia Ltd - datatables.net/license
3 */
4
5/**
6 * DataTables integration for Bootstrap 3. This requires Bootstrap 3 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 Bootstrap. See http://datatables.net/manual/styling/bootstrap
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, which attaches to jQuery, including
29 // jQuery if needed and have a $ property so we can access the
30 // jQuery object that is used
31 $ = require('datatables.net')(root, $).$;
32 }
33
34 return factory( $, root, root.document );
35 };
36 }
37 else {
38 // Browser
39 factory( jQuery, window, document );
40 }
41}(function( $, window, document, undefined ) {
42'use strict';
43var DataTable = $.fn.dataTable;
44
45
46/* Set the defaults for DataTables initialisation */
47$.extend( true, DataTable.defaults, {
48 dom:
49 "<'row'<'col-sm-6'l><'col-sm-6'f>>" +
50 "<'row'<'col-sm-12'tr>>" +
51 "<'row'<'col-sm-5'i><'col-sm-7'p>>",
52 renderer: 'bootstrap'
53} );
54
55
56/* Default class modification */
57$.extend( DataTable.ext.classes, {
58 sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
59 sFilterInput: "form-control input-sm",
60 sLengthSelect: "form-control input-sm",
61 sProcessing: "dataTables_processing panel panel-default"
62} );
63
64
65/* Bootstrap paging button renderer */
66DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
67 var api = new DataTable.Api( settings );
68 var classes = settings.oClasses;
69 var lang = settings.oLanguage.oPaginate;
70 var aria = settings.oLanguage.oAria.paginate || {};
71 var btnDisplay, btnClass, counter=0;
72
73 var attach = function( container, buttons ) {
74 var i, ien, node, button;
75 var clickHandler = function ( e ) {
76 e.preventDefault();
77 if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
78 api.page( e.data.action ).draw( 'page' );
79 }
80 };
81
82 for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
83 button = buttons[i];
84
85 if ( $.isArray( button ) ) {
86 attach( container, button );
87 }
88 else {
89 btnDisplay = '';
90 btnClass = '';
91
92 switch ( button ) {
93 case 'ellipsis':
94 btnDisplay = '&#x2026;';
95 btnClass = 'disabled';
96 break;
97
98 case 'first':
99 btnDisplay = lang.sFirst;
100 btnClass = button + (page > 0 ?
101 '' : ' disabled');
102 break;
103
104 case 'previous':
105 btnDisplay = lang.sPrevious;
106 btnClass = button + (page > 0 ?
107 '' : ' disabled');
108 break;
109
110 case 'next':
111 btnDisplay = lang.sNext;
112 btnClass = button + (page < pages-1 ?
113 '' : ' disabled');
114 break;
115
116 case 'last':
117 btnDisplay = lang.sLast;
118 btnClass = button + (page < pages-1 ?
119 '' : ' disabled');
120 break;
121
122 default:
123 btnDisplay = button + 1;
124 btnClass = page === button ?
125 'active' : '';
126 break;
127 }
128
129 if ( btnDisplay ) {
130 node = $('<li>', {
131 'class': classes.sPageButton+' '+btnClass,
132 'id': idx === 0 && typeof button === 'string' ?
133 settings.sTableId +'_'+ button :
134 null
135 } )
136 .append( $('<a>', {
137 'href': '#',
138 'aria-controls': settings.sTableId,
139 'aria-label': aria[ button ],
140 'data-dt-idx': counter,
141 'tabindex': settings.iTabIndex
142 } )
143 .html( btnDisplay )
144 )
145 .appendTo( container );
146
147 settings.oApi._fnBindAction(
148 node, {action: button}, clickHandler
149 );
150
151 counter++;
152 }
153 }
154 }
155 };
156
157 // IE9 throws an 'unknown error' if document.activeElement is used
158 // inside an iframe or frame.
159 var activeEl;
160
161 try {
162 // Because this approach is destroying and recreating the paging
163 // elements, focus is lost on the select button which is bad for
164 // accessibility. So we want to restore focus once the draw has
165 // completed
166 activeEl = $(host).find(document.activeElement).data('dt-idx');
167 }
168 catch (e) {}
169
170 attach(
171 $(host).empty().html('<ul class="pagination"/>').children('ul'),
172 buttons
173 );
174
175 if ( activeEl !== undefined ) {
176 $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
177 }
178};
179
180
181return DataTable;
182}));
Note: See TracBrowser for help on using the repository browser.