PageSourceSearch

https://scc-csc.ca/js/datatables/2.0.3/js/dataTables.bootstrap5.scc-mod.js

js scc-csc.ca collected 2026-10-01 10:26:45 UTC 3,815 bytes, 161 lines download raw bytes

1/* 
2*   Chris M. Paradis - Kept the base dataTables and bootstrap integration
3    JS files separated because the bootstrap file overrides the pagination <button>
4    tags back to using <a> tags. For accessibility reasons, we need to use <button>'s.
5	Look for MANUAL EDITS. Not a big deal, amiright?
6*/
7
8
9/*! DataTables Bootstrap 5 integration
10 * 2020 SpryMedia Ltd - datatables.net/license
11 */
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		var jq = require('jquery');
23		var cjsRequires = function (root, $) {
24			if ( ! $.fn.dataTable ) {
25				require('datatables.net')(root, $);
26			}
27		};
28
29		if (typeof window === 'undefined') {
30			module.exports = function (root, $) {
31				if ( ! root ) {
32					// CommonJS environments without a window global must pass a
33					// root. This will give an error otherwise
34					root = window;
35				}
36
37				if ( ! $ ) {
38					$ = jq( root );
39				}
40
41				cjsRequires( root, $ );
42				return factory( $, root, root.document );
43			};
44		}
45		else {
46			cjsRequires( window, jq );
47			module.exports = factory( jq, window, window.document );
48		}
49	}
50	else {
51		// Browser
52		factory( jQuery, window, document );
53	}
54}(function( $, window, document ) {
55'use strict';
56var DataTable = $.fn.dataTable;
57
58
59
60/**
61 * DataTables integration for Bootstrap 5. This requires Bootstrap 5 and
62 * DataTables 2 or newer.
63 *
64 * This file sets the defaults and adds options to DataTables to style its
65 * controls using Bootstrap. See https://datatables.net/manual/styling/bootstrap
66 * for further information.
67 */
68
69/* Set the defaults for DataTables initialisation */
70$.extend( true, DataTable.defaults, {
71	renderer: 'bootstrap'
72} );
73
74
75/* Default class modification */
76$.extend( true, DataTable.ext.classes, {
77	container: "dt-container dt-bootstrap5",
78	search: {
79		input: "form-control form-control-sm"
80	},
81	length: {
82		select: "form-select form-select-sm"
83	},
84	processing: {
85		container: "dt-processing card"
86	}
87} );
88
89
90/* Bootstrap paging button renderer */
91DataTable.ext.renderer.pagingButton.bootstrap = function (settings, buttonType, content, active, disabled) {
92	var btnClasses = ['dt-paging-button', 'page-item'];
93
94	if (active) {
95		btnClasses.push('active');
96	}
97
98	if (disabled) {
99		btnClasses.push('disabled')
100	}
101
102	/* *** MANUAL EDITS *** */
103	var li = $('<li>').addClass(btnClasses.join(' '));
104	//var a = $('<a>', {
105    var a = $('<button>', {
106		//'href': disabled ? null : '#',
107		'class': 'page-link'
108        // +
109        , 'type': 'button',
110		'role' : 'button'
111	})
112		.html(content)
113		.appendTo(li);
114
115	return {
116		display: li,
117		clicker: a
118	};
119};
120
121DataTable.ext.renderer.pagingContainer.bootstrap = function (settings, buttonEls) {
122	return $('<ul/>').addClass('pagination').append(buttonEls);
123};
124
125DataTable.ext.renderer.layout.bootstrap = function ( settings, container, items ) {
126	var row = $( '<div/>', {
127			"class": items.full ?
128				'row mt-2 justify-content-md-center' :
129				'row mt-2 justify-content-between'
130		} )
131		.appendTo( container );
132
133	$.each( items, function (key, val) {
134		var klass;
135
136		// Apply start / end (left / right when ltr) margins
137		if (val.table) {
138			klass = 'col-12';
139		}
140		else if (key === 'start') {
141			klass = 'col-md-auto me-auto';
142		}
143		else if (key === 'end') {
144			klass = 'col-md-auto ms-auto';
145		}
146		else {
147			klass = 'col-md';
148		}
149
150		$( '<div/>', {
151				id: val.id || null,
152				"class": klass + ' ' + (val.className || '')
153			} )
154			.append( val.contents )
155			.appendTo( row );
156	} );
157};
158
159
160return DataTable;
161}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.