PageSourceSearch

https://www.treston.us/sites/default/modules/treston_ajax_block_render/js/dist/loadBlocks.js?v=1.1.1

js treston.us collected 2026-10-04 22:49:41 UTC 2,397 bytes, 73 lines download raw bytes

1'use strict';
2
3((jQuery,Drupal,drupalSettings) => {
4  Drupal.behaviors.ajaxBlock = {
5
6    ajaxRegions: [],
7  	combineRequests: [],
8  	combineBlocks: [],
9
10  	addBlockToStack: ( id, setting ) => {
11  		//console.log("Block added: " + id);
12  		Drupal.behaviors.ajaxBlock.combineBlocks.push({b: id, s: setting});
13  	},
14
15  	addRegionToStack: id => {
16  		//console.log("Region added: " + id);
17  		Drupal.behaviors.ajaxBlock.combineRequests.push(id);
18  	},
19
20  	createRequestObject: (url, obj) => {
21  		var ajaxObject = Drupal.ajax({ url: "/" + drupalSettings.path.pathPrefix + drupalSettings.renderCacheUrl +"/" + url });
22  		const ajaxOptions = {
23  			data:{
24  					...obj,
25  					url: window.location.pathname+decodeURIComponent(window.location.search)
26  			},
27  			type: "GET",
28  			withCredentials: false,
29  		};
30
31  		//console.log(ajaxObject.options.data.url);
32
33  		ajaxObject.options = {
34  			...ajaxObject.options,
35  			...ajaxOptions,
36  		};
37
38			ajaxObject.execute().done( e => {
39        e.forEach(cmd => {
40          if (cmd.command === 'insert' && cmd.method === 'replaceWith'){
41            window.Drupal.attachBehaviors(document.querySelector(cmd.selector), null);
42          }
43        })
44      });
45  	},
46
47  	sendStack: () => {
48  		if( Drupal.behaviors.ajaxBlock.combineRequests.length !== 0 ){
49  			Drupal.behaviors.ajaxBlock.createRequestObject('regions',{regions: Drupal.behaviors.ajaxBlock.combineRequests });
50				Drupal.behaviors.ajaxBlock.combineRequests = [];
51			}
52			if( Drupal.behaviors.ajaxBlock.combineBlocks.length > 0 ){
53				Drupal.behaviors.ajaxBlock.createRequestObject("blocks",{blocks: Drupal.behaviors.ajaxBlock.combineBlocks });
54				Drupal.behaviors.ajaxBlock.combineBlocks = [];
55			}
56  	},
57
58    attach: (context, settings) => {
59
60    	jQuery('span[data-after-block-render]',context).each( function ( index, item ){
61    		Drupal.behaviors.ajaxBlock.addBlockToStack(jQuery(item).data('after-block-render'),jQuery(item).data('after-render-configuration'));
62    	});
63
64		  jQuery('span[data-after-region-render]',context).each( function ( index, item ){
65		  	Drupal.behaviors.ajaxBlock.addRegionToStack(jQuery(item).data('after-region-render'));
66        Drupal.behaviors.ajaxBlock.ajaxRegions.push(jQuery(item).data('after-region-render'));
67		  });
68		  Drupal.behaviors.ajaxBlock.sendStack();
69    }
70  };
71
72})(jQuery,Drupal,drupalSettings);
73//# sourceMappingURL=loadBlocks.es6.js.map

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.