PageSourceSearch

https://erus.ru/Content/js/lib/plugins-history/history.adapter.jquery.js

js erus.ru collected 2026-10-07 19:33:50 UTC 2,032 bytes, 76 lines download raw bytes

1/**
2 * History.js jQuery Adapter
3 * @author Benjamin Arthur Lupton <[email protected]>
4 * @copyright 2010-2011 Benjamin Arthur Lupton <[email protected]>
5 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
6 */
7
8// Closure
9(function(window,undefined){
10	"use strict";
11
12	// Localise Globals
13	var
14		History = window.History = window.History||{},
15		jQuery = window.jQuery;
16
17	// Check Existence
18	if ( typeof History.Adapter !== 'undefined' ) {
19		throw new Error('History.js Adapter has already been loaded...');
20	}
21
22	// Add the Adapter
23	History.Adapter = {
24		/**
25		 * History.Adapter.bind(el,event,callback)
26		 * @param {Element|string} el
27		 * @param {string} event - custom and standard events
28		 * @param {function} callback
29		 * @return {void}
30		 */
31		bind: function(el,event,callback){
32			jQuery(el).bind(event,callback);
33		},
34
35		/**
36		 * History.Adapter.trigger(el,event)
37		 * @param {Element|string} el
38		 * @param {string} event - custom and standard events
39		 * @param {Object=} extra - a object of extra event data (optional)
40		 * @return {void}
41		 */
42		trigger: function(el,event,extra){
43			jQuery(el).trigger(event,extra);
44		},
45
46		/**
47		 * History.Adapter.extractEventData(key,event,extra)
48		 * @param {string} key - key for the event data to extract
49		 * @param {string} event - custom and standard events
50		 * @param {Object=} extra - a object of extra event data (optional)
51		 * @return {mixed}
52		 */
53		extractEventData: function(key,event,extra){
54			// jQuery Native then jQuery Custom
55			var result = (event && event.originalEvent && event.originalEvent[key]) || (extra && extra[key]) || undefined;
56
57			// Return
58			return result;
59		},
60
61		/**
62		 * History.Adapter.onDomLoad(callback)
63		 * @param {function} callback
64		 * @return {void}
65		 */
66		onDomLoad: function(callback) {
67			jQuery(callback);
68		}
69	};
70
71	// Try and Initialise History
72	if ( typeof History.init !== 'undefined' ) {
73		History.init();
74	}
75
76})(window);

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.