PageSourceSearch

https://dauerblog.de/wp-content/plugins/foogallery/assets/js/foogallery.ready.264cc6ce.js?ver=3.3.7

js dauerblog.de collected 2026-10-05 03:42:47 UTC 5,274 bytes, 193 lines download raw bytes

1(function ($, _, _utils, _obj, _is) {
2
3	/**
4	 * Contains any FooBox specific integration code.
5	 *
6	 * @namespace FooGallery.__foobox__
7	 * @private
8	 */
9	_.__foobox__ = {
10		/**
11		 * Check if the element is displayed within FooBox.
12		 *
13		 * @param {jQuery} $element
14		 * @return {boolean}
15		 */
16		owns: function( $element ){
17			return $element.parents(".fbx-item").length > 0;
18		},
19		/**
20		 * Check if the template can be handled by FooBox.
21		 *
22		 * @param {FooGallery.Template} template
23		 * @return {boolean}
24		 */
25		handles: function( template ){
26			return template.$el.hasClass("fbx-instance") && _is.object( window[ 'FOOBOX' ] ) && !!$.fn[ 'foobox' ];
27		},
28		/**
29		 * Updates the template's FooBox.
30		 *
31		 * @param {FooGallery.Template} template
32		 */
33		update: function( template ){
34			const opts = [{}];
35			if ( _is.object( window[ 'FOOBOX' ][ 'o' ] ) ) {
36				opts.push( window[ 'FOOBOX' ][ 'o' ] );
37			}
38			if ( template.opt.protected ) {
39				opts.push( { images: { noRightClick: true } } );
40			}
41			if ( _is.fn( template.$el[ 'foobox' ] ) ) {
42				template.$el[ 'foobox' ]( _obj.extend.apply( null, opts ) );
43			}
44		}
45	};
46
47	/**
48	 * Handles the ready, after-page-change and after-filter-change events and conditional raises a post-load event
49	 * on the document body to notify other plugins that content has changed.
50	 * @param e
51	 * @param current
52	 * @param prev
53	 * @param isFilter
54	 */
55	_.triggerPostLoad = function (e, current, prev, isFilter) {
56		const tmpl = e.target;
57		if (tmpl instanceof _.Template){
58			if (tmpl.initialized && (e.type === "ready" || (e.type === "after-page-change" && !isFilter) || e.type === "after-filter-change")) {
59				try {
60					if ( _.__foobox__.owns( tmpl.$el ) ) return;
61
62					if ( _.__foobox__.handles( tmpl ) ){
63						_.__foobox__.update( tmpl );
64					} else {
65						$("body").trigger("post-load");
66					}
67				} catch(err) {
68					console.error(err);
69				}
70			}
71		}
72	};
73
74	/**
75	 * The options applied to all galleries initialized using the auto mechanism.
76	 *
77	 * @memberof FooGallery.
78	 * @name autoDefaults
79	 * @type {object}
80	 */
81	_.autoDefaults = {
82		on: {
83			"ready after-page-change after-filter-change": _.triggerPostLoad
84		}
85	};
86
87	/**
88	 * If set to FALSE then FooGallery will not automatically initialize itself on all valid elements
89	 * with an ID starting with 'foogallery-gallery-'.
90	 *
91	 * @memberof FooGallery.
92	 * @name autoEnabled
93	 * @type {boolean}
94	 * @default true
95	 */
96	_.autoEnabled = true;
97
98	/**
99	 * Allows you to merge options into the FooGallery.autoDefaults object.
100	 *
101	 * @memberof FooGallery.
102	 * @function auto
103	 * @param {object} options
104	 * @returns {object} The result of the merged options.
105	 */
106	_.auto = function (options) {
107		return _.autoDefaults = _obj.merge(_.autoDefaults, options);
108	};
109
110	/**
111	 * Indicates if any globally supplied variables such as the FooGallery_il8n object have been merged.
112	 *
113	 * @memberof FooGallery.
114	 * @name globalsMerged
115	 * @type {boolean}
116	 * @default false
117	 * @readonly
118	 */
119	_.globalsMerged = false;
120
121	/**
122	 * Merges any globally supplied variables such as the FooGallery_il8n object into the various component configurations for the plugin.
123	 */
124	_.mergeGlobals = function(){
125		// if this has already been done, don't do it again
126		if ( _.globalsMerged === true ) return;
127
128        if ( _is.object( window[ 'FooGallery_auto' ] ) ) {
129            _.auto( window[ 'FooGallery_auto' ] );
130        }
131		if ( _is.object( window[ 'FooGallery_il8n' ] ) ){
132			_.merge_il8n( window[ 'FooGallery_il8n' ] );
133		}
134        _.globalsMerged = true;
135	};
136
137	/**
138	 * Merges an "il8n" configuration object into the various component configurations for the plugin.
139	 * @param configuration
140	 */
141	_.merge_il8n = function( configuration ){
142		if ( !_is.object( configuration ) ) return;
143		Object.keys( configuration ).forEach( ( factoryName ) => {
144			if ( _is.object( configuration[ factoryName ] ) && _[ factoryName ] instanceof _.Factory ) {
145				const factory = /** @type FooGallery.Factory */ _[ factoryName ],
146					componentConfiguration = configuration[ factoryName ];
147
148				Object.keys( componentConfiguration ).forEach( ( componentName ) => {
149					if ( _is.object( componentConfiguration[ componentName ] ) ) {
150						factory.configure( componentName, null, null, componentConfiguration[ componentName ] );
151					}
152				} );
153			}
154		} );
155	};
156
157	_.load = _.reload = function(){
158		let jqReady = false, customReady = false;
159		// this automatically initializes all templates on page load
160		$(function () {
161			_.mergeGlobals();
162			if (_.autoEnabled){
163				$('[id^="foogallery-gallery-"]:not(.fg-ready)').foogallery(_.autoDefaults);
164			}
165			jqReady = true;
166			if ( jqReady && customReady ){
167				document.dispatchEvent( new CustomEvent( 'foogallery-loaded', { detail: _ } ) );
168			}
169		});
170
171		_utils.ready(function () {
172			_.mergeGlobals();
173			if (_.autoEnabled){
174				$('[id^="foogallery-gallery-"].fg-ready').foogallery(_.autoDefaults);
175			}
176			customReady = true;
177			if ( jqReady && customReady ){
178				document.dispatchEvent( new CustomEvent( 'foogallery-loaded', { detail: _ } ) );
179			}
180		});
181	};
182
183	document.dispatchEvent( new CustomEvent( 'foogallery-ready', { detail: _ } ) );
184
185	_.load();
186
187})(
188	FooGallery.$,
189	FooGallery,
190	FooGallery.utils,
191	FooGallery.utils.obj,
192	FooGallery.utils.is
193);

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.