PageSourceSearch

https://gadzhievo-news.ru/themes/core/js/ajax-data-loader.js

js gadzhievo-news.ru collected 2026-10-03 18:56:59 UTC 2,065 bytes, 42 lines download raw bytes

1/**
2 * Предназначен для загрузки контента при помощи ajax ..  Крнтент представляет из себя элемент с классом  ajax-loadable .. и атрибутом data-al-params ( содержит  имя плагина и настройки плагина  данные которого нужно подтянуть по ajax )  data-al-params = сериализированный массив подвергнутый действию base64_encode  
3 * первым элементом массива должно идти имя плагина в формате cabbeb-case .. далее идут параметры таким же образом как если бы их задавали при вызове плагина из шаблна 
4 */
5$(function(){
6	// функция загрузчик .. 
7	let AjaxLoader=function(e){
8		e.preventDefault();
9		let params={};
10		let rootEl=$(this);
11		if (!rootEl.hasClass('ajax-loadable'))
12			rootEl=rootEl.parents('.ajax-loadable').eq(0);
13
14		params=rootEl.data('al-param');
15		let sendto=rootEl.data('al-trigger-to');
16		if (typeof sendto=='undefined')
17			sendto='inline';
18		
19
20
21		if (typeof window.IR.AlData == 'undefined' || typeof window.IR.AlData[params] =='undefined')
22			return ;
23
24		$.post("/?module=ajax&action=get-al-content",{params:window.IR.AlData[params]},function(ret){
25			$('body').trigger('apply-ajax-assets',[ret]);
26			// дёрнуть событие ..
27			//console.log(ret);
28			if (sendto!='this-element')
29				$(window).trigger('ajax-content-loaded.'+sendto,[ret.content,{from:ret.from,key:params}]);
30			else
31				$(e.target).replaceWith(ret.content);
32				//console.log(e.target);
33		});
34	};
35	// тыкнули на элемент с классом  .al  или сам загрузчик .. 
36	$('body').on('click','.ajax-loadable .al,.ajax-loadable.al',AjaxLoader);
37	$('body').find('.ajax-loadable .al,.ajax-loadable.al').each(function(){
38		if ($(this).data('now-load'))
39			$(this).trigger('click');
40			//console.log($(this));
41	});
42});

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.