PageSourceSearch

https://lijstjestijd.be/extensions/ltd/assets/ltd2022/js/dialog.js?v=20251010

js lijstjestijd.be collected 2026-10-01 16:01:32 UTC 9,193 bytes, 406 lines download raw bytes

1var Dialog = function(options) {
2
3	var conf 		= $.extend({}, $.fn.dialog.defaults, options);
4	if(conf.url && conf.multiple == false){
5		for(key in $.fn.dialog.dialogs){
6			var d = $.fn.dialog.dialogs[key];
7			if(d.attr("rel").split("?")[0] == conf.url.split("?")[0]){
8				return d;
9			}
10		}
11	}
12	var dialog		= $("<section class='dialog'></section>");
13	var container 	= $(conf.container);
14	var load		= false;
15	var initialize = function() {
16		dialog.addClass("load");
17		if(conf.classname){
18			dialog.addClass(conf.classname);
19		}
20		
21		if(conf.url && conf.url !="#"){
22			if($.isFunction(conf.onbeforeload)){
23				conf.onbeforeload(dialog);
24			}
25			
26			$.post(conf.url,conf.data,function(response){
27				var el = $(response);
28				if(el.hasClass("dialog")){
29					dialog.addClass(el.attr("class"));
30					response = el.html();
31				}
32				dialog.html(response);
33				dialog.attr("rel",conf.url);
34				container.append(dialog);
35				
36				_initDialog(false);
37				
38				if($.isFunction(conf.onload)){
39					conf.onload(dialog);
40				}
41				setTimeout(function(){
42					dialog.removeClass("load");
43				},125);
44			},'html').fail(function(err){
45				if($.isFunction(conf.onerror)){
46					conf.onerror(dialog,err);
47				}
48			});
49		}else if(conf.html){
50			
51			var el = $(conf.html);
52			if(el.hasClass("dialog")){
53				dialog.addClass(el.attr("class"));
54				response = el.html();
55			}else{
56				response = conf.html;
57			}
58			
59			dialog.html(response);
60			
61			
62			container.append(dialog);
63			_initDialog(false);
64			if($.isFunction(conf.onload)){
65				conf.onload(dialog);
66			}
67		}else if(conf.src && $(conf.src).length > 0){
68			
69			var el = $(conf.src);
70			if(el.hasClass("dialog")){
71				dialog.addClass(el.attr("class"));
72			}else if(el.data("class")){
73				dialog.addClass(el.data("class"));
74			}
75			dialog.html($(conf.src).html());
76			
77			container.append(dialog);
78			_initDialog(false);
79			if($.isFunction(conf.onload)){
80				conf.onload(dialog);
81			}
82		}
83		return false;
84	}
85	var isNumeric = function( obj ) {
86	    return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
87	}
88	var _initDialog = function(reload){
89		if($("footer",dialog).length > 0){
90			$(".dialog-body",dialog).addClass("w-foot");
91		}
92		
93		if(conf.width && isNumeric(conf.width)){
94			dialog.css({
95				width		:	(conf.width*1),
96				marginLeft	:	-((conf.width*1)/2),
97				left		:	'50%'
98			});
99		}else if(conf.width){
100			dialog.css({
101				width		:	conf.width
102			});
103		}
104		if(conf.height && isNumeric(conf.height)){
105			dialog.css({
106				height		:	(conf.height*1),
107				marginTop	:	-((conf.height*1)/2),
108				top			:	'50%'
109			});
110		}else if(conf.height){
111			dialog.css({
112				height		:	conf.height
113			});
114		}
115		
116		/** GET INPUT TYPES RUNJS **/
117		$("input[name='runjs[]']",dialog).each(function(){
118			var func = $(this).val();
119			if (typeof window[func] === "function") {
120				try{
121					window[func](dialog);
122				}catch(e){
123					
124				}
125			}
126		});
127		
128		/** BUTTONS **/
129		
130		if($(".dialog-close",dialog).length > 0){
131			$(".dialog-close",dialog).click(function(){
132				dialog.close();
133				return false;
134			});
135			$(".dialog-min",dialog).click(function(){
136				dialog.removeClass("load");
137				dialog.addClass("minimized");
138				return false;
139			});
140			$(".dialog-max",dialog).click(function(){
141				dialog.open();
142				return false;
143			});
144		}
145		container.off("click");
146		container.on("click",function(e){
147			if(container.is(e.target) && dialog.length > 0){
148				dialog.close();
149			}
150		});
151		if(!reload){
152			
153			dialog.on("remove", function () {
154				/** REMOVE FROM ARRAY **/
155				for(key in $.fn.dialog.dialogs){
156					var d = $.fn.dialog.dialogs[key];
157					if(dialog.data("guid") == d.data("guid")){
158						delete $.fn.dialog.dialogs[key];
159					}
160				}
161			});
162			dialog.data("guid",Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1));
163			if(!$.fn.dialog.dialogs)
164				$.fn.dialog.dialogs  = [];
165			$.fn.dialog.dialogs.push(dialog);
166		}
167	}
168	dialog.reload = function(url){
169		dialog.addClass("load");
170		dialog.removeClass("confirmdialog");
171		$.get(url,conf.data,function(response){
172			var el = $(response);
173			if(el.hasClass("dialog")){
174				dialog.removeClass();
175				dialog.addClass(el.attr("class"));
176				response = el.html();
177				dialog.addClass("open");
178			}
179			dialog.html(response);
180			dialog.attr("rel",conf.url);
181			_initDialog(true);
182			
183			if($.isFunction(conf.onload)){
184				conf.onload(dialog);
185			}
186			dialog.removeClass("load");
187			
188			
189			
190		},'html').fail(function(err){
191			if($.isFunction(conf.onerror)){
192				conf.onerror(dialog,err);
193			}
194		});
195		return false;
196	}
197	dialog.reloadhtml = function(html){
198		dialog.addClass("load");
199		dialog.removeClass("confirmdialog");
200		
201		var el = $(html);
202		if(el.hasClass("dialog")){
203			dialog.addClass(el.attr("class"));
204			html = el.html();
205		}
206		
207		dialog.html(html);
208		_initDialog(true);
209		if($.isFunction(conf.onload)){
210			conf.onload(dialog);
211		}
212		dialog.removeClass("load");
213		return false;
214	}
215	dialog.init = function(){
216		_initDialog();
217	}
218	dialog.get = function($key){
219		return conf[$key];
220	}
221	dialog.set = function($key,$value){
222		conf[$key] = $value;
223	}
224	dialog.setparams = function(params){
225		conf['data'] = params;
226	}
227	dialog.open = function(){
228		if(dialog.hasClass("load")){
229			//setTimeout(function(){
230				dialog.addClass("open");
231				dialog.removeClass("load");
232			//},200);
233		}else{
234			if(dialog.hasClass("open") && dialog.hasClass("minimized")){
235				dialog.removeClass("minimized");
236				dialog.addClass("load");
237				container.append(dialog);
238			}else{
239				setTimeout(function(){
240					dialog.open();
241				},150);
242			}
243		}
244		
245	}
246	dialog.close = function(){
247		if(conf.trigger)
248			conf.trigger.removeClass("opening");
249		
250		if($.isFunction(conf.onclose)){
251			conf.onclose(dialog);
252		}
253		container.off("click");
254		dialog.removeClass("open");
255		setTimeout(function(){
256			dialog.trigger("remove").remove();
257			
258		}, conf.closetimeout);
259	}
260	initialize();
261	return dialog;
262};
263
264
265/**
266**	JQUERY PLUGINS
267**/
268(function($) {	
269	$.fn.dialog = function(options) {
270		return this.each(function() {
271			var element = $(this);
272			if (element.data('dialog')) return;
273			var w = new Dialog(this, options);
274			element.data('dialog', w);
275		});
276	};
277})(jQuery);
278
279$.fn.dialog.defaults = {
280	onclose		:	false,
281	onerror		:	false,
282	container	:	"body",
283	url			:	"",
284	html		:	"",
285	data		:	{},
286	trigger		:	null,
287	multiple	:	false,
288	classname	:	'',
289	width		:	false,
290	height		:	false,
291	closetimeout:	250
292};
293
294$.fn.dialog.dialogs = [];
295
296var getDialog = function(el){
297	for(key in $.fn.dialog.dialogs){
298		var d = $.fn.dialog.dialogs[key];
299		if(el.data("guid") == d.data("guid")){
300			return d;
301		}
302	}
303	return false;
304}
305
306var initReloadDialogLinks = function(container){
307	$(".reload-dialog-link",container).off("click");
308	$(".reload-dialog-link",container).on("click",function(){
309		var link = $(this);
310		if(container.is(".dialog")){
311			var dialog = getDialog(container);
312			if(link.attr("href")){
313				container.reload(link.attr("href"));
314			}else if(link.data("href")){
315				container.reload(link.data("href"));
316			}
317			
318		}
319		return false;
320	});
321}
322
323var initDialogLink = function(link){
324	link.off("click");
325	
326	link.on("click",function(e){
327		
328		
329		if(link.hasClass("opening"))
330			return false;
331		link.addClass("opening");
332		if($(e.target).parent(0).hasClass("dropdown-toggle") || $(e.target).hasClass("dropdown-toggle") || $(e.target).hasClass("clickable")){
333			return true;
334		}
335		if($(this).hasClass("disabled"))
336			return true;
337		
338		var data = $(this).data();
339		if(data["onload"]){
340			eval("data[\"onload\"] = "+data["onload"]);
341		}
342		if(data["onclose"]){
343			eval("data[\"onclose\"] = "+data["onclose"]);
344		}
345		if(data["onbeforeload"]){
346			eval("data[\"onbeforeload\"] = "+data["onbeforeload"]);
347		}
348		if($(this).attr("href")){
349			data["url"] = $(this).attr("href");	
350		}else if($(this).data("href")){
351			data["url"] = $(this).data("href");	
352		}
353		if($(".dialog-container").length > 0){
354			data["container"] = ".dialog-container";
355		}else{
356			data["container"] = "body";
357		}
358	
359		
360		
361		data["onerror"] = function(dialog,err){
362			/*var ctr  = container;
363			if(!ctr.is(".dialog")){
364				ctr = $(".app-panel.active");
365			}
366			var resp = err.statusText;
367			
368			try{
369				var ob = {};
370				eval("ob = "+resp+";");
371				parseServerResponse(ob,ctr);
372			}catch(e){
373				alert(e);
374			}*/
375			alert(err);
376			return false;
377		}
378		data["trigger"] = $(this);
379		
380		var dialog = new Dialog(data);
381		dialog.open();
382		
383		if($(this).parents(".dropdown").length > 0){
384			$(".dropdown-toggle",$(this).parents(".dropdown")).dropdown("toggle");
385		}
386		
387		return false;
388	});
389	
390	
391	
392	if(link.data("oninit")){
393		if(link.data("oninit") == "open"){
394			link.trigger("click");
395		}
396	}
397	
398}
399var initDialogLinks = function(container){
400	$(".dialog-link",container).each(function(){
401		initDialogLink($(this));
402	});
403}
404$(document).ready(function(){
405	initDialogLinks($("body"));
406})

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.