PageSourceSearch

https://pymesbalta.org/wp-content/themes/directory2/ait-theme/assets/ait/ait.js?ver=4.0.29

js pymesbalta.org collected 2026-10-02 20:08:06 UTC 3,669 bytes, 127 lines download raw bytes

1
2
3/*
4 jQuery pub/sub plugin by Peter Higgins ([email protected])
5 Loosely based on Dojo publish/subscribe API, limited in scope. Rewritten blindly.
6 Original is (c) Dojo Foundation 2004-2010. Released under either AFL or new BSD, see:
7 http://dojofoundation.org/license for more information.
8*/
9;(function(d){var cache={};d.publish=function(topic,args){cache[topic]&&d.each(cache[topic],function(){this.apply(d,args||[])})};d.subscribe=function(topic,callback){if(!cache[topic]){cache[topic]=[]}cache[topic].push(callback);return[topic,callback]};d.unsubscribe=function(handle){var t=handle[0];cache[t]&&d.each(cache[t],function(idx){if(this==handle[1]){cache[t].splice(idx,1)}})}})(jQuery);
10
11
12/**
13 * Ait JS Lib
14 */
15
16var ait = ait || {};
17ait.ajax = ait.ajax || {};
18
19;(function($, undefined){
20
21	"use strict";
22
23	var _settings = typeof AitSettings === 'undefined' ? {} : AitSettings;
24
25
26	// ================================
27	// Ait JS Lib
28	// --------------------------------
29
30	ait = $.extend(ait, _settings, {
31
32
33		/**
34		 * Publish some data on a named topic.
35		 * @param  {string} topic The channel to publish on
36		 * @param  {Array?} args  The data to publish. Each array item is converted into an ordered arguments on the subscribed functions.
37		 * @return {void}
38		 */
39		publish: function(topic, args) {
40			$.publish(topic, args);
41		},
42
43
44
45		/**
46		 * Register a callback on a named topic.
47		 * @param  {string}   topic The channel to subscribe to
48		 * @param  {Function} cb    The handler event. Anytime something is $.publish'ed on a subscribed channel, the callback will be called with the published array as ordered arguments.
49		 * @return {Array}          A handle which can be used to unsubscribe this particular subscription.
50		 */
51		subscribe: function(topic, cb) {
52			$.subscribe(topic, cb);
53		}
54
55	});
56
57
58
59	// ================================
60	// Ait JS Utils
61	// --------------------------------
62
63	ait.utils = $.extend(ait.utils || {}, {
64		/**
65		 * Helper getter for data-ait-* attributes
66		 * @param  {jQuery} $el    jQuery object of the element which has data-ait-* attribute
67		 * @param  {string} name   Rest of the name of data atribute
68		 * @return {mixed}         Object or scalar
69		 */
70		getDataAttr: function($el, name){
71			return $el.data('ait-' + name);
72		},
73
74		/**
75		 * Helper setter for data-ait-* attributes
76		 * @param {jQuery} $el    jQuery object of the element which has data-ait-* attribute
77		 * @param {string} name   Rest of the name of data atribute
78		 * @param {mixed}  data   Data to be set
79		 * @return {void}
80		 */
81		setDataAttr: function($el, name, data){
82			$el.attr('data-ait-' + name, JSON.stringify(data));
83		}
84	});
85
86
87
88	// ================================
89	// Ait Ajax Utils
90	// --------------------------------
91
92	ait.ajax = ait.ajax || {};
93
94	/**
95	 * Load data from the server using a HTTP POST or GET request.
96	 * Same as $.post, $.get jQuery methods, but instead of URL in the first parameter
97	 * it is used wp ajax action hook
98	 */
99	$.each(["get", "post"], function(i, method){
100		ait.ajax[method] = function(action, data){
101			var _action;
102			var a = action.split(":");
103
104			// ait.ajax.post("theme:getPosts", data)
105			// ait.ajax.post("<controller>:<method>", data)
106			if(a.length > 1 && (action in ait.ajax.actions)){
107				_action = ait.ajax.actions[action];
108			}else{
109				_action = action;
110			}
111
112			if(typeof data === "object")
113				data = $.param($.extend(data, {action: _action}));
114			else if(typeof data === "string")
115				data = $.param({action: _action}) + '&' + data;
116			else
117				data = $.param({action: _action});
118
119			return $.ajax({
120				url: ait.ajax.url,
121				type: method,
122				data: data
123			});
124		};
125	});
126
127})(jQuery);

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.