PageSourceSearch

https://reading.ac.uk/sc93/js/vendor/datatables.enum.js

js reading.ac.uk collected 2026-09-24 08:26:23 UTC 2,406 bytes, 89 lines download raw bytes

1/*! © SpryMedia Ltd - datatables.net/license */
2
3(function (factory) {
4	if (typeof define === 'function' && define.amd) {
5		// AMD
6		define(['jquery', 'datatables.net'], function ($) {
7			return factory($, window, document);
8		});
9	}
10	else if (typeof exports === 'object') {
11		// CommonJS
12		var jq = require('jquery');
13		var cjsRequires = function (root, $) {
14			if (!$.fn.dataTable) {
15				require('datatables.net')(root, $);
16			}
17		};
18
19		if (typeof window !== 'undefined') {
20			module.exports = function (root, $) {
21				if (!root) {
22					// CommonJS environments without a window global must pass a
23					// root. This will give an error otherwise
24					root = window;
25				}
26
27				if (!$) {
28					$ = jq(root);
29				}
30
31				cjsRequires(root, $);
32				return factory($, root, root.document);
33			};
34		}
35		else {
36			cjsRequires(window, jq);
37			module.exports = factory(jq, window, window.document);
38		}
39	}
40	else {
41		// Browser
42		factory(jQuery, window, document);
43	}
44}(function ($, window, document, undefined) {
45	'use strict';
46	var DataTable = $.fn.dataTable;
47
48
49	/**
50	 * Sort data by a defined enumerated (enum) list. The options for the values in
51	 * the enum are defined by passing the values in an array to the method
52	 * `DataTable.enum`. Type detection and sorting plug-ins for DataTables will
53	 * automatically be generated and added to the table.
54	 *
55	 * For full details and instructions please see [this DataTables blog
56	 * post](//datatables.net/blog/2016-06-16).
57	 *
58	 * @name enum
59	 * @summary Dynamically create enum sorting options for a DataTable
60	 * @author [SpryMedia Ltd](http://datatables.net)
61	 *
62	 *  @example
63	 *    DataTable.enum( [ 'High', 'Medium', 'Low' ] );
64	 *
65	 *    new DataTable('#myTable');
66	 */
67	var unique = 0;
68	var types = DataTable.ext.type;
69	// Using form DataTable.enum breaks at least YuiCompressor since enum is
70	// a reserved word in JavaScript
71	DataTable['enum'] = function (arr) {
72		var name = 'enum-' + unique++;
73		var lookup = window.Map ? new Map() : {};
74		for (var i = 0, ien = arr.length; i < ien; i++) {
75			lookup[arr[i]] = i;
76		}
77		// Add type detection
78		types.detect.unshift(function (d) {
79			return lookup[d] !== undefined ? name : null;
80		});
81		// Add sorting method
82		types.order[name + '-pre'] = function (d) {
83			return lookup[d];
84		};
85	};
86
87
88	return DataTable;
89}));

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.