PageSourceSearch

https://zssaldova.cz/core/libraries/cms.js?version=1.0.3

js zssaldova.cz collected 2026-10-06 23:54:13 UTC 70,617 bytes, 2,164 lines download raw bytes

1$(document).ready(function() {
2
3	if(!alertify.radio_select){
4
5		alertify.dialog('radio_select',function factory(){
6			var p = document.createElement('P');
7			return{
8				main: function (_title, _message, _array, _onok, _oncancel, _table) {
9	                var array, title, message, onok, oncancel, table;
10	                switch (arguments.length) {
11	                case 1:
12	                    message = _title;
13	                    break;
14	                case 2:
15	                    message = _title;
16	                    array = _message;
17	                    break;
18	                case 3:
19	                    message = _title;
20	                    array = _message;
21	                    onok = _array;
22	                    break;
23	                case 4:
24	                    message = _title;
25	                    array = _message;
26	                    onok = _array;
27	                    oncancel = _onok;
28	                    break;
29	                case 5:
30	                    title = _title;
31	                    message = _message;
32	                    array = _array;
33	                    onok = _onok;
34	                    oncancel = _oncancel;
35	                    break;
36					case 6:
37    	                title = _title;
38    	                message = _message;
39    	                array = _array;
40    	                onok = _onok;
41    	                oncancel = _oncancel;
42						table = _table;
43	                }
44	                this.set('title', title);
45	                this.set('message', message);
46	                this.set('onok', onok);
47	                this.set('oncancel', oncancel);
48					this.set('array', array);
49					this.set('table', table);
50					this.setting("table", table);
51	                return this;
52	            },
53				setup:function(){
54					return {
55						buttons:[
56							{text: 'Ano', key: 13, invokeOnClose: false, className: alertify.defaults.theme.ok},
57							{text: 'Zrušit', key: 27, invokeOnClose: true, className: alertify.defaults.theme.cancel}
58						],
59		            	focus: { element:0 },
60						options: {
61							title: 'Potvrdit smazání',
62							maximizable: false,
63							resizable:false
64						}
65					};
66				},
67				build: function () {
68
69	            },
70				prepare: function(){
71					this.elements.content.innerHTML = "";
72					var extra_main_div = $("<div class='row'></div>");
73					$(this.elements.content).append(extra_main_div);
74					this.elements.content.appendChild(p);
75					var gg = this;
76					var main_div = $("<div class='col-12 pt-2'></div>");
77					//console.log(settings);
78					$(this.settings.array).each(function(i,e){
79						var input_main_div = $("<div class='col-12 mb-1'></div>");
80						var input_inside_div = $("<div class='custom-control custom-radio pl-0'></div>");
81						var checked = (i==0) ? "checked" : "";
82						var input = $("<input type='radio' "+checked+" id='delete_"+gg.settings.table+"_settings_"+i+"' name='delete_"+gg.settings.table+"_settings' value='"+i+"' class='custom-control-input'>");
83						var label = $("<label class='custom-control-label' for='delete_"+gg.settings.table+"_settings_"+i+"'>"+e+"</label>");
84						input_inside_div.append(input);
85						input_inside_div.append(label);
86						input_main_div.append(input_inside_div);
87						main_div.append(input_main_div);
88						//$(gg.elements.content).append(input_main_div);
89					});
90					$(this.elements.content).append(main_div);
91				},
92				setMessage: function (message) {
93	                if (typeof message === 'string') {
94	                    p.innerHTML = message;
95	                } else if (message instanceof window.HTMLElement && p.firstChild !== message) {
96	                    p.appendChild(message);
97	                }
98	            },
99				settings: {
100	                message: undefined,
101	                labels: undefined,
102	                onok: undefined,
103	                oncancel: undefined,
104	                value: '',
105	                type:'text',
106					table: '',
107					array: '',
108	                reverseButtons: undefined,
109	            },
110				settingUpdated: function (key, oldValue, newValue) {
111	                switch (key) {
112	                case 'message':
113	                    this.setMessage(newValue);
114	                    break;
115	                case 'value':
116	                    input.value = newValue;
117	                    break;
118					case 'table':
119					    table_name = newValue;
120					    break;
121	                case 'type':
122	                    switch (newValue) {
123	                    case 'text':
124	                    case 'color':
125	                    case 'date':
126	                    case 'datetime-local':
127	                    case 'email':
128	                    case 'month':
129	                    case 'number':
130	                    case 'password':
131	                    case 'search':
132	                    case 'tel':
133	                    case 'time':
134	                    case 'week':
135	                        input.type = newValue;
136	                        break;
137	                    default:
138	                        input.type = 'text';
139	                        break;
140	                    }
141	                    break;
142	                case 'labels':
143	                    if (newValue.ok && this.__internal.buttons[0].element) {
144	                        this.__internal.buttons[0].element.innerHTML = newValue.ok;
145	                    }
146	                    if (newValue.cancel && this.__internal.buttons[1].element) {
147	                        this.__internal.buttons[1].element.innerHTML = newValue.cancel;
148	                    }
149	                    break;
150	                case 'reverseButtons':
151	                    if (newValue === true) {
152	                        this.elements.buttons.primary.appendChild(this.__internal.buttons[0].element);
153	                    } else {
154	                        this.elements.buttons.primary.appendChild(this.__internal.buttons[1].element);
155	                    }
156	                    break;
157	                }
158	            },
159				callback: function (closeEvent) {
160	                var returnValue;
161	                switch (closeEvent.index) {
162	                case 0:
163	                    var value = $(this.elements.body).find("input[name='delete_"+this.settings.table+"_settings']:checked").val();
164	                    if (typeof this.get('onok') === 'function') {
165	                        returnValue = this.get('onok').call(this, closeEvent, value);
166	                        if (typeof returnValue !== 'undefined') {
167	                            closeEvent.cancel = !returnValue;
168	                        }
169	                    }
170	                    break;
171	                case 1:
172	                    if (typeof this.get('oncancel') === 'function') {
173	                        returnValue = this.get('oncancel').call(this, closeEvent);
174	                        if (typeof returnValue !== 'undefined') {
175	                            closeEvent.cancel = !returnValue;
176	                        }
177	                    }
178	                    break;
179	                }
180	            }
181			}
182		});
183	}
184
185	if(!alertify.check_select){
186
187		alertify.dialog('check_select',function factory(){
188			var p = document.createElement('P');
189			//var array=[get_string(1490),get_string(1491),get_string(850), get_string(953), get_string(768), get_string(1492)];
190			return{
191				main: function (_title, _message, _array, _onok, _oncancel, _table) {
192	                var array, title, message, onok, oncancel, table;
193	                switch (arguments.length) {
194	                case 1:
195	                    message = _title;
196	                    break;
197	                case 2:
198	                    message = _title;
199	                    array = _message;
200	                    break;
201	                case 3:
202	                    message = _title;
203	                    array = _message;
204	                    onok = _array;
205	                    break;
206	                case 4:
207	                    message = _title;
208	                    array = _message;
209	                    onok = _array;
210	                    oncancel = _onok;
211	                    break;
212	                case 5:
213	                    title = _title;
214	                    message = _message;
215	                    array = _array;
216	                    onok = _onok;
217	                    oncancel = _oncancel;
218	                    break;
219					case 6:
220    	                title = _title;
221    	                message = _message;
222    	                array = _array;
223    	                onok = _onok;
224    	                oncancel = _oncancel;
225						table = _table;
226	                }
227	                this.set('title', title);
228	                this.set('message', message);
229	                this.set('onok', onok);
230	                this.set('oncancel', oncancel);
231					this.set('array', array);
232					this.set('table', table);
233					this.setting("table", table);
234					this.setting("array", array);
235	                return this;
236	            },
237				setup:function(){
238					return {
239						buttons:[
240							{text: 'Ano', key: 13, invokeOnClose: false, className: alertify.defaults.theme.ok},
241							{text: 'Zrušit', key: 27, invokeOnClose: true, className: alertify.defaults.theme.cancel}
242						],
243		            	focus: { element:0 },
244						options: {
245							title: 'Potvrdit smazání',
246							maximizable: false,
247							resizable:false
248						}
249					};
250				},
251				build: function () {
252
253	            },
254				prepare: function(){
255					this.elements.content.innerHTML = "";
256					var extra_main_div = $("<div class='row'></div>");
257					$(this.elements.content).append(extra_main_div);
258					this.elements.content.appendChild(p);
259					var gg = this;
260					var main_div = $("<div class='col-12 pt-2'></div>");
261					console.log(this.settings)
262					$(this.settings.array).each(function(i,e){
263
264						var input_main_div = $("<div class='col-12 mb-1'></div>");
265						var input_inside_div = $("<div class='custom-control custom-checkbox pl-0'></div>");
266						var input = $("<input type='checkbox' checked id='delete_"+gg.settings.table+"_settings_"+i+"' name='delete_"+gg.settings.table+"_settings' value='"+i+"' class='custom-control-input'>");
267						var label = $("<label class='custom-control-label' for='delete_"+gg.settings.table+"_settings_"+i+"'>"+e+"</label>");
268						input_inside_div.append(input);
269						input_inside_div.append(label);
270						input_main_div.append(input_inside_div);
271						main_div.append(input_main_div);
272						//$(gg.elements.content).append(input_main_div);
273					});
274					$(this.elements.content).append(main_div);
275				},
276				setMessage: function (message) {
277	                if (typeof message === 'string') {
278	                    p.innerHTML = message;
279	                } else if (message instanceof window.HTMLElement && p.firstChild !== message) {
280	                    p.appendChild(message);
281	                }
282	            },
283				settings: {
284	                message: undefined,
285	                labels: undefined,
286	                onok: undefined,
287	                oncancel: undefined,
288	                value: '',
289	                type:'text',
290					table: '',
291					array: '',
292	                reverseButtons: undefined,
293	            },
294				settingUpdated: function (key, oldValue, newValue) {
295	                switch (key) {
296	                case 'message':
297	                    this.setMessage(newValue);
298	                    break;
299	                case 'value':
300	                    input.value = newValue;
301	                    break;
302					case 'table':
303					    table_name = newValue;
304					    break;
305	                case 'type':
306	                    switch (newValue) {
307	                    case 'text':
308	                    case 'color':
309	                    case 'date':
310	                    case 'datetime-local':
311	                    case 'email':
312	                    case 'month':
313	                    case 'number':
314	                    case 'password':
315	                    case 'search':
316	                    case 'tel':
317	                    case 'time':
318	                    case 'week':
319	                        input.type = newValue;
320	                        break;
321	                    default:
322	                        input.type = 'text';
323	                        break;
324	                    }
325	                    break;
326	                case 'labels':
327	                    if (newValue.ok && this.__internal.buttons[0].element) {
328	                        this.__internal.buttons[0].element.innerHTML = newValue.ok;
329	                    }
330	                    if (newValue.cancel && this.__internal.buttons[1].element) {
331	                        this.__internal.buttons[1].element.innerHTML = newValue.cancel;
332	                    }
333	                    break;
334	                case 'reverseButtons':
335	                    if (newValue === true) {
336	                        this.elements.buttons.primary.appendChild(this.__internal.buttons[0].element);
337	                    } else {
338	                        this.elements.buttons.primary.appendChild(this.__internal.buttons[1].element);
339	                    }
340	                    break;
341	                }
342	            },
343				callback: function (closeEvent) {
344	                var returnValue;
345	                switch (closeEvent.index) {
346	                case 0:
347						var returnValues = [];
348	                    var values = $(this.elements.body).find("input[name='delete_"+this.settings.table+"_settings']:checked");
349						values.each(function(i,e){
350							returnValues.push($(e).val())
351						});
352	                    if (typeof this.get('onok') === 'function') {
353	                        returnValue = this.get('onok').call(this, closeEvent, returnValues);
354	                        if (typeof returnValue !== 'undefined') {
355	                            closeEvent.cancel = !returnValue;
356	                        }
357	                    }
358	                    break;
359	                case 1:
360	                    if (typeof this.get('oncancel') === 'function') {
361	                        returnValue = this.get('oncancel').call(this, closeEvent);
362	                        if (typeof returnValue !== 'undefined') {
363	                            closeEvent.cancel = !returnValue;
364	                        }
365	                    }
366	                    break;
367	                }
368	            }
369			}
370		});
371	}
372
373	alertify.dialog("closeForm", function factory(){
374
375		return {
376			main: function (message, on_ok, on_no) {
377				this.message = message;
378				this.on_ok = on_ok;
379				this.on_no = on_no;
380			},
381			setup:function(){
382				return {
383					buttons:[
384						{text: 'Ano', key: 13, invokeOnClose: false, className: "btn rounded btn-success"},
385						{text: 'Ne', invokeOnClose: false, className: "btn rounded btn-danger"},
386						{text: 'Zrušit', key: 27, invokeOnClose: true, className: "btn rounded btn-secondary"},
387					],
388					focus: { element:0 },
389					options: {
390						title: 'Chcete uložit změny?',
391						maximizable: false,
392						resizable:false
393					}
394				};
395			},
396			prepare: function(){
397				this.setContent(this.message);
398			},
399			callback: function(closeEvent){
400				if(closeEvent.index==0){
401					this.on_ok();
402				}
403				else if(closeEvent.index==1){
404					this.on_no();
405				}
406			}
407		}
408	});
409
410	// Zobrazení fronty z notifikací
411	$("#showFront").click(function(){
412		$("#adminMenuContainer").removeClass("hidden");
413		$("#adminMenuContainer-padding").load("/admin/control-panel/new.php", function(){
414			$(".posts").removeClass("active");
415			$("#posts").addClass("hidden");
416			$(".front").addClass("active");
417			$("#front").removeClass("hidden");
418			$("#front-padding").load("/admin/modules/mod_front/mod_front.php");
419			$("#notifications").slideToggle();
420		});
421	});
422
423
424  // Nastaveni datetimepickeru.
425/*  $.extend($.fn.datetimepicker.defaults, {
426    timepicker: false,
427    format: 'd.m.Y',
428	dayOfWeekStart: 1
429  });
430
431  jQuery.datetimepicker.setLocale(get("adminLangAlias"));*/
432
433	jQuery.extend(jQuery.fn.fancybox.defaults, {
434		// HTML templates
435		tpl: {
436			wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
437			image    : '<img class="fancybox-image" src="{href}" alt="" />',
438			error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
439			closeBtn : '<a title="Zavřít" class="fancybox-item fancybox-close" href="javascript:;"></a>',
440			next     : '<a title="Další" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
441			prev     : '<a title="Zpět" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
442			},
443	});
444
445	AppHandler();
446
447	jQuery('img.svg').each(function(){
448    	var $img = jQuery(this);
449	    var imgID = $img.attr('id');
450	    var imgClass = $img.attr('class');
451	    var imgURL = $img.attr('src');
452		var imgAlt = $img.attr('alt');
453
454	    jQuery.get(imgURL, function(data) {
455	        // Get the SVG tag, ignore the rest
456	        var $svg = jQuery(data).find('svg');
457
458	        // Add replaced image's ID to the new SVG
459	        if(typeof imgID !== 'undefined') {
460	            $svg = $svg.attr('id', imgID);
461	        }
462	        // Add replaced image's classes to the new SVG
463	        if(typeof imgClass !== 'undefined') {
464	            $svg = $svg.attr('class', imgClass+' replaced-svg');
465	        }
466
467			// Add replaced image's alt to the new SVG
468		   if(typeof imgAlt !== 'undefined') {
469			   $svg = $svg.attr('alt', imgAlt);
470		   }
471
472	        // Remove any invalid XML tags as per http://validator.w3.org
473	        $svg = $svg.removeAttr('xmlns:a');
474
475	        // Check if the viewport is set, if the viewport is not set the SVG wont't scale.
476	        if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
477	            $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
478	        }
479
480	        // Replace image with new SVG
481	        $img.replaceWith($svg);
482
483	    }, 'xml');
484
485	});
486
487});
488
489jQuery.extend(jQuery.fancybox.defaults, {
490  beforeClose: function () { tinyMCE.remove(); }
491});
492
493(function ( $ ) {
494$.fn.dropdownMultiselect = function(){
495		var main = $(this);
496		var list = $('<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">');
497		var button = $('<button class="btn btn-secondary dropdown-toggle dropdown-toggle-multiselect" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'+main.data("closedtext")+'</button>');
498		$(this).find("div.ddms-item").each(function(i,e){
499			var active = "";
500			var id = $(e).data("id");
501			if($(e).data("active")){
502				active = "active";
503			}
504			var mainSpan = $("<span class='dropdown-item inputPostSpan "+active+"' onclick='onCheck(\""+id+"\")' id='dropdown-item-"+id+"'>");
505			var div_form_check = $("<div class='form-check'>");
506			var span_form_check_label = $("<span class='form-check-label'>");
507			span_form_check_label.html($(e).html());
508			div_form_check.append(span_form_check_label);
509			mainSpan.append(div_form_check);
510			list.append(mainSpan);
511			$(e).remove();
512		});
513		$(this).append(button);
514		$(this).append(list);
515
516	}
517}( jQuery ));
518
519function get(what){
520	if(what=="adminLangAlias"){
521		var alias = "";
522		$.ajax({
523			url:'/admin/scripts/get.php?what=adminLangAlias',
524			dataType:"JSON",
525			async: false,
526			success:function(info){
527				alias = info.alias;
528			},
529			error: function(){
530				alias = get("defaultAdminLangAlias");
531			}
532		});
533
534		return alias;
535
536	}
537
538	else if(what=="defaultAdminLangAlias"){
539		$.ajax({
540			url:'/admin/scripts/get.php?what=defaultAdminLangAlias',
541			dataType:"JSON",
542			async: false,
543			success:function(info){
544				return info.alias;
545			},
546			error: function(){
547				return "cs";
548			}
549		});
550	}
551
552
553	else{
554		value = "";
555		$.ajax({
556			url:'/admin/scripts/get.php?what='+what+'',
557			dataType:"JSON",
558			async: false,
559			success:function(info){
560				//console.log(info.value);
561				value = info.value;
562			},
563			error: function(){
564				value = "";
565			}
566		});
567
568		return value;
569	}
570
571}
572
573function getLastId(table){
574	var number = "";
575	$.ajax({
576		url:'/admin/scripts/get.php?what=lastId&table='+table+'',
577		dataType:"JSON",
578		async: false,
579		success:function(info){
580			number = info.number;
581		}
582	});
583
584	return number;
585}
586
587function getString(number){
588	var string = "";
589	$.ajax({
590		url:'/admin/scripts/get.php?what=string&number='+number+'',
591		dataType:"JSON",
592		async: false,
593		success:function(info){
594			string = info.string;
595		}
596	});
597
598	return string;
599}
600
601function get_string(number){
602	return getString(number);
603}
604
605function get_popup_string(table, action, amount, type){
606	var string = "";
607	$.ajax({
608		url:'/admin/scripts/get.php?what=popup_string&table='+table+'&action='+action+'&amount='+amount+'&type='+type+'',
609		dataType:"JSON",
610		async: false,
611		success:function(info){
612			string = info.string;
613		}
614	});
615
616	return string;
617}
618
619var AppHandler = function(){
620
621	$(".delete-live").click(function(){
622		var table = $(this).data("table");
623		var id = $(this).data("id");
624		alertify.confirm(get_popup_string(table, "delete", "single", "title"), get_popup_string(table, "delete", "single", "text"), function(){
625			$.ajax({
626				url:"/admin/scripts/delete.php?table="+table+"&id="+id+"",
627				dataType:"JSON",
628				success:function(info){
629					if(info.status==1){
630						$("#"+table+"-front-"+id+"").fadeOut(400, function(){
631							$(this).remove();
632						});
633						alertify.success(get_popup_string(table, "delete", "single", "success"));
634					}
635					else{
636						alertify.success(get_popup_string(table, "delete", "single", "error"));
637					}
638				},
639				error:function(){
640					alertify.success(get_popup_string(table, "delete", "single", "error"));
641				}
642			});
643		},function(){
644
645		});
646	});
647
648	$(".showif-trigger").change(function(){
649		var value = $(this).val();
650		var id = $(this).prop("name");
651		$(".showif[data-showifid='"+id+"']").addClass("hidden");
652		$(".showif[data-showifid='"+id+"'][data-showifvalue='"+value+"']").removeClass("hidden");
653	});
654
655	$(".showif").each(function(i,e){
656		//console.log(e);
657		var name = $(e).data("showifid");
658		var value = $(e).data("showifvalue");
659		var element = $("[name="+name+"]");
660		if(element.val() == value){
661			$(e).removeClass("hidden");
662		}
663	});
664
665	$(".showifnot-trigger").change(function(){
666		var value = $(this).val();
667		var id = $(this).prop("name");
668		$(".showif-not[data-showifnotid='"+id+"']").removeClass("hidden");
669		$(".showif-not[data-showifnotid='"+id+"'][data-showifnotvalue='"+value+"']").addClass("hidden");
670	});
671
672	$(".showif-not").each(function(i,e){
673		var name = $(e).data("showifnotid");
674		var value = $(e).data("showifnotvalue");
675		var element = $("[name="+name+"]").eq(0);
676		if(element.val() != value){
677			$(e).removeClass("hidden");
678		}
679	});
680
681	// Fancybox
682	$(".fancy").fancybox({
683		fitToView	: false,
684		closeClick	: false,
685		padding: 0
686	});
687
688	$(".fancy-form").fancybox({
689		fitToView	: false,
690		closeClick	: false,
691		beforeClose: function () {
692			tinyMCE.remove();
693		},
694    	onCleanup: function () {
695      		tinyMCE.remove();
696    	},
697		padding: 0,
698		tpl: {
699			closeBtn : '<div class="close-form"><span class="material-icons">close</span></div>'
700		},
701	})
702
703	$(".iframe").fancybox({
704		maxWidth: 800,
705        fitToView: false,
706        width: '70%',
707        height: '70%',
708        autoSize: false,
709		closeClick	: false,
710		type:"iframe",
711	});
712
713	$(".openGallery").fancybox({
714		fitToView	: false,
715		closeClick	: false,
716		beforeClose: function () {
717			tinyMCE.remove();
718		},
719		onCleanup: function () {
720				tinyMCE.remove();
721		},
722		width: 1000,
723		height: 500,
724		autoSize: false
725	});
726
727	$(".bmf").bmf({
728
729	});
730
731	// Multiselect
732	$('.dropdown-menu').click(function(event){
733		event.stopPropagation();
734	});
735
736	// Vybírátko datumu
737	/*$('.datePicker').datetimepicker({
738
739  	});*/
740
741	$.fn.datepicker.dates['cs'] = {
742	    days: ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota"],
743	    daysShort: ["Ned", "Pon", "Úte", "Stř", "Čtv", "Pát", "Sob"],
744	    daysMin: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So"],
745	    months: ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"],
746	    monthsShort: ["Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čec", "Srp", "Zář", "Říj", "Lis", "Pro"],
747	    today: "Dnešek",
748	    clear: "Vyprázdnit",
749	    format: "mm.dd.YYY",
750	    titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */
751	    weekStart: 0
752	};
753
754	/*$('.date-picker').datepicker({
755		language: 'cs',
756		format: 'dd.mm.yyyy',
757		autoclose: true,
758		calendarWeeks : true,
759		clearBtn: true,
760		disableTouchKeyboard: true,
761	});*/
762
763	$('.datetime-picker').datepicker({
764		language: 'cs',
765		format: 'dd.mm.yyyy',
766		autoclose: true,
767		calendarWeeks : true,
768		clearBtn: true,
769		disableTouchKeyboard: true,
770	});
771
772  	// Vybírátko datumu a času
773  	/*$('.datetimePicker').datetimepicker({
774  		dayOfWeekStart:1,
775  		timepicker:true,
776  		format: "d.m.Y G:i",
777  		step: 15
778  	});*/
779
780  	// JS stránkování
781
782	$(".sortable-section").sortable({
783		axis: "y",
784		items: ">.section-sort",
785		update: function(event, ui){
786			var data = $(this).sortable('serialize');
787
788			$.ajax({
789				data: data,
790				type: 'POST',
791				url: '/admin/scripts/sort.php?table=section&cid='+$(this).data("cid")+""
792			});
793		}
794	});
795
796	$(".sortable-section-2").sortable({
797		axis: "y",
798		items: ">.section-sort",
799		update: function(event, ui){
800			var data = $(this).sortable('serialize');
801
802			$.ajax({
803				data: data,
804				type: 'POST',
805				url: '/admin/scripts/sort.php?table=section&cid='+$(this).data("cid")+""
806			});
807		}
808	});
809
810	$(".sortable-section-3").sortable({
811		axis: "y",
812		items: ">.section-sort",
813		update: function(event, ui){
814			var data = $(this).sortable('serialize');
815
816			$.ajax({
817				data: data,
818				type: 'POST',
819				url: '/admin/scripts/sort.php?table=section&cid='+$(this).data("cid")+""
820			});
821		}
822	});
823
824	$(".sortable").click(function(){
825		console.log($(this).data("handle"));
826	});
827
828  	// Sortování
829	$(".sortable").sortable({
830		axis: ""+$(this).data("axis")+"",
831		update: function(event, ui){
832			var data = $(this).sortable('serialize');
833
834			$.ajax({
835				data: data,
836				type: 'POST',
837				url: '../../admin/scripts/sort.php?table='+$(this).data("table")+'&cid='+$(this).data("cid")+""
838			});
839		}
840	});
841
842	// Sortování
843	$(".sortable-handle").sortable({
844		axis: ""+$(this).data("axis")+"",
845		handle: ".sort-handler",
846		update: function(event, ui){
847			var data = $(this).sortable('serialize');
848
849			$.ajax({
850				data: data,
851				type: 'POST',
852				url: '../../admin/scripts/sort.php?table='+$(this).data("table")+'&cid='+$(this).data("cid")+""
853			});
854		}
855	});
856
857
858	var srt = $(".sortable_widgets").sortable({
859		axis: $(this).data("axis"),
860		connectWith: '.sortable_widgets',
861		update: function(event, ui){
862			var data = $(this).sortable('serialize');
863
864			$.ajax({
865				data: data,
866				type: 'POST',
867				url: '../../admin/scripts/sort.php?table=widgets&position='+$(this).data("position")+''
868			});
869		}
870	});
871
872	var srt_h = $(".sortable_widgets_handle").sortable({
873		axis: $(this).data("axis"),
874		handle: ".sort-handler",
875		connectWith: '.sortable_widgets',
876		update: function(event, ui){
877			var data = $(this).sortable('serialize');
878
879			$.ajax({
880				data: data,
881				type: 'POST',
882				url: '../../admin/scripts/sort.php?table=widgets&position='+$(this).data("position")+''
883			});
884		}
885	});
886
887	//console.log(srt.sortable("option"));
888
889
890	// Autonačtení elementů
891	$("[data-onload=true]").each(function(){
892		$(this).load($(this).data("onload-file"));
893	});
894
895  	// Označení všech checkboxů
896	$(".select-all").change(function(){
897		var alias = $(this).data("alias");
898		if(this.checked){
899			$(".select-all-"+alias+" .group-action-check").prop("checked", true);
900		}
901
902		else{
903			$(".select-all-"+alias+" .group-action-check").prop("checked", false);
904		}
905	});
906
907    // Hromadná akce
908    $(".group-action").change(function(){
909
910   		var alias = $(this).data("alias");
911
912    	// Smazání
913    	if(this.value==1){
914
915    		// Načtení dat
916    		var confirm = $(this).data("delete-confirm");
917    		var success = $(this).data("delete-success");
918
919			if(alias=="category"){
920
921				var array=[get_string(1575),get_string(1578),get_string(1579)];
922				alertify.radio_select(get_popup_string(alias, "delete", "group", "title"), get_popup_string(alias, "delete", "group", "text"), array, function(evt, value){
923
924					var inputs =$('.select-all-'+alias+' input[type=checkbox]:checked');
925					var length = inputs.length;
926
927					if(length == 0){
928						alertify.success(get_popup_string(alias, "delete", "group", "success"));
929					}
930					else{
931						$("#postsLeft-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
932					}
933
934					// Načtení všech checkboxů a pokud je vybraný, tak smazat
935					inputs.each(function(i,e){
936						var id = $(this).data("id");
937						$.ajax({
938							url: '/admin/scripts/delete.php?id='+id+'&table='+alias+'&hard=0&type='+value+'',
939							success: function(){
940								if(i==length-1){
941									alertify.success(get_popup_string(alias, "delete", "group", "success"));
942									setTimeout(function(){
943										refresh_list(alias);
944									},1000);
945								}
946							}
947						});
948					});
949
950
951				},function(){},table).set('reverseButtons', true);
952
953			}
954
955			else if(alias=="contactcat"){
956
957				var array=[get_string(1640),get_string(1642),get_string(1643)];
958				alertify.radio_select(get_popup_string(alias, "delete", "group", "title"), get_popup_string(alias, "delete", "group", "text"), array, function(evt, value){
959
960					var inputs =$('.select-all-'+alias+' input[type=checkbox]:checked');
961					var length = inputs.length;
962
963					if(length == 0){
964						alertify.success(get_popup_string(alias, "delete", "group", "success"));
965					}
966					else{
967						$("#contactLeft-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
968					}
969
970					// Načtení všech checkboxů a pokud je vybraný, tak smazat
971					inputs.each(function(i,e){
972						var id = $(this).data("id");
973						$.ajax({
974							url: '/admin/scripts/delete.php?id='+id+'&table='+alias+'&hard=0&type='+value+'',
975							success: function(){
976								if(i==length-1){
977									setTimeout(function(){
978										$("#contactRight-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
979										setTimeout(function(){
980											$("#contactRight-padding").load(last_contacts_loaded);
981										},500);
982										$("#contactLeft-padding").load("/admin/modules/mod_contact/mod_contact.php?pg=left");
983									},1000);
984									alertify.success(get_popup_string(alias, "delete", "group", "success"));
985								}
986							}
987						});
988					});
989
990				},function(){},table).set('reverseButtons', true);
991
992			}
993
994			else if(alias=="classes"){
995				var array=[get_string(1490),get_string(1491),get_string(850), get_string(953), get_string(768), get_string(1492)];
996				alertify.check_select(get_popup_string(alias, "delete", "group", "title"), get_popup_string(alias, "delete", "group", "text"), array, function(evt, value){
997
998					var inputs =$('.select-all-'+alias+' input[type=checkbox]:checked');
999					var length = inputs.length;
1000
1001					if(length == 0){
1002						alertify.success(get_popup_string(alias, "delete", "group", "success"));
1003					}
1004					else{
1005						$("#schoolClasses-left").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1006					}
1007
1008					inputs.each(function(i,e){
1009						var id = $(this).data("id");
1010
1011						$.ajax({
1012							url:'/admin/scripts/delete.php?id='+id+'&table=classes&hard=0&type='+value+'',
1013							dataType:"JSON",
1014							success: function(info){
1015								if(i==length-1){
1016									alertify.success(get_popup_string(alias, "delete", "group", "success"));
1017									setTimeout(function(){
1018										$("#contactRight-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1019										setTimeout(function(){
1020											$("#schoolClasses-right").load("/admin/modules/mod_classes/class.php");
1021										},500);
1022										$("#schoolClasses-left").load("/admin/modules/mod_classes/mod_classes.php");
1023									},1000);
1024								}
1025							}
1026						});
1027					});
1028
1029				},function(){},table).set('reverseButtons', true);
1030			}
1031			else{
1032
1033	    		// Potvrzení
1034				alertify.confirm(get_popup_string(alias, "delete", "group", "title"), get_popup_string(alias, "delete", "group", "text"), function (e) {
1035	          		if (e) {
1036
1037						var inputs =$('.select-all-'+alias+' input[type=checkbox]:checked');
1038						var length = inputs.length;
1039
1040						if(length == 0){
1041							alertify.success(get_popup_string(alias, "delete", "group", "success"));
1042						}
1043						else{
1044							$("[data-list="+alias+"]").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1045							$("#photosList").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1046							if(alias=="gallery"){
1047								$("#galleryRight-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1048							}
1049						}
1050
1051	          			// Načtení všech checkboxů a pokud je vybraný, tak smazat
1052	            		inputs.each(function(i,e){
1053	                		var id = $(this).data("id");
1054	                		$.ajax({
1055	                			url: '/admin/scripts/delete.php?id='+id+'&table='+alias+'',
1056	                			success: function(){
1057									if(i==length-1){
1058										alertify.success(get_popup_string(alias, "delete", "group", "success"));
1059										setTimeout(function(){
1060											refresh_list(alias);
1061										},1000);
1062									}
1063	                			}
1064	                		});
1065	             		});
1066	            	}
1067
1068	              	$("#group-action-"+alias+" option[value=0]").prop('selected', true);
1069
1070	         	},"").set('reverseButtons', true);
1071
1072			}
1073      	}
1074
1075      	// Deaktivovat
1076      	else if(this.value==2){
1077
1078      		// Načtení dat
1079    		var confirm = $(this).data("demain-confirm");
1080    		var success = $(this).data("demain-success");
1081
1082			//
1083			alertify.confirm(get_popup_string(alias, "deactivate", "group", "title"), get_popup_string(alias, "deactivate", "group", "text"), function (e) {
1084          		if (e) {
1085
1086            		// Načtení všech checkboxů a pokud je vybraný, tak smazat
1087            		$('.select-all-'+alias+' input[type=checkbox]').each(function(){
1088              			if(this.checked){
1089                			var id = $(this).data("id");
1090                			deactive_u(alias, id);
1091                			$(".select-all-"+alias+" #"+alias+"-"+id+"").prop("checked", false);
1092                			$("input.select-all[data-alias="+alias+"]").prop("checked", false);
1093              			}
1094             		});
1095            		alertify.success(get_popup_string(alias, "deactivate", "group", "success"));
1096            }
1097
1098            $("#group-action-"+alias+" option[value=0]").prop('selected', true);
1099
1100         },"").set('reverseButtons', true);
1101      }
1102
1103      //Aktivovat
1104      else if(this.value==3){
1105
1106      		// Načtení dat
1107    		var confirm = $(this).data("main-confirm");
1108    		var success = $(this).data("main-success");
1109
1110			//
1111			alertify.confirm(get_popup_string(alias, "activate", "group", "title"), get_popup_string(alias, "activate", "group", "text"), function (e) {
1112          		if (e) {
1113
1114            		// Načtení všech checkboxů a pokud je vybraný, tak smazat
1115            		$('.select-all-'+alias+' input[type=checkbox]').each(function(){
1116              			if(this.checked){
1117                			var id = $(this).data("id");
1118                			active_u(alias, id);
1119                			$(".select-all-"+alias+" #"+alias+"-"+id+"").prop("checked", false);
1120                			$("input.select-all[data-alias="+alias+"]").prop("checked", false);
1121              			}
1122             		});
1123            		alertify.success(get_popup_string(alias, "activate", "group", "success"));
1124            }
1125
1126            $("#group-action-"+alias+" option[value=0]").prop('selected', true);
1127
1128         },"").set('reverseButtons', true);
1129      }
1130
1131      // Aktivovat článek ve frontě
1132      else if(this.value==4){
1133
1134      		// Načtení dat
1135    		var confirm = $(this).data("front-confirm");
1136    		var success = $(this).data("front-success");
1137
1138    		//
1139        	alertify.confirm(get_popup_string(alias, "accept", "group", "title"), get_popup_string(alias, "front", "group", "text"), function(e) {
1140        		if (e) {
1141
1142        			// Načtení všech checkboxů a pokud je vybraný, tak aktivovat
1143	          		$('.select-all-'+alias+' input[type=checkbox]').each(function(){
1144    	          		if(this.checked){
1145    	            		var id = $(this).data("id");
1146    	            		$.ajax({
1147    	            			url: '/admin/scripts/front.php?id='+id+'&table=posts',
1148    	            			success: function(){
1149    	            				$("."+alias+"-delete-"+id+"").fadeOut(1000);
1150    	            			}
1151    	            		});
1152    	          		}
1153    	         	});
1154    	         	alertify.success(get_popup_string(alias, "front", "group", "text"));
1155    	         }
1156
1157
1158         },"").set('reverseButtons', true);
1159      }
1160
1161      // Vyprázdnit kategorii
1162      else if(this.value==5){
1163
1164      	// Načtení dat
1165    	var confirm = $(this).data("empty-confirm");
1166    	var success = $(this).data("empty-success");
1167
1168         alertify.confirm(get_popup_string(alias, "empty", "group", "title"),get_popup_string(alias, "empty", "group", "text"), function (e) {
1169
1170			if(e){
1171
1172					$("#postsLeft-padding .admin-list-items").append('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1173					$("#postsLeft-padding .admin-list-item").hide();
1174
1175					// Načtení všech checkboxů a pokud je vybraný, tak aktivovat
1176	          		$('.select-all-'+alias+' input[type=checkbox]:checked').each(function(i){
1177    	            	var id = $(this).data("id");
1178    	            	$.ajax({
1179    	            		url: '/admin/scripts/empty.php?id='+id+'&table='+alias+'',
1180							dataType:"JSON",
1181    	            		success: function(info){
1182								if(info.status==true && i == $('.select-all-'+alias+' input[type=checkbox]:checked').length-1){
1183    	            				$("#postsLeft-padding").load("/admin/modules/mod_post/mod_posts.php?pg=left");
1184								}
1185    	            		}
1186    	            	});
1187    	         	});
1188    	         	alertify.success(get_popup_string(alias, "empty", "group", "success"));
1189
1190			}
1191         },"").set('reverseButtons', true);
1192      }
1193
1194      // Vynulovat počet přečtení
1195      if(this.value==6){
1196
1197      	// Načtení dat
1198    	var confirm = $(this).data("clear-confirm");
1199    	var success = $(this).data("clear-success");
1200
1201    	alertify.confirm(get_popup_string(alias, "null", "group", "title"),get_popup_string(alias, "null", "group", "text"), function(e){
1202
1203    		if(e){
1204
1205    			// Načtení všech checkboxů a pokud je vybraný, tak aktivovat
1206	          	$('.select-all-'+alias+' input[type=checkbox]').each(function(){
1207    	        	if(this.checked){
1208    	           		var id = $(this).data("id");
1209    	           		$.ajax({
1210    	           			url: '/admin/scripts/clear.php?id='+id+'&table='+alias+'',
1211    	           		});
1212						$(".select-all-"+alias+" #"+alias+"-"+id+"").prop("checked", false);
1213						$("#item-"+alias+"-"+id+" .read").text("0");
1214    	        	}
1215    	        });
1216    	        alertify.success(get_popup_string(alias, "null", "group", "success"));
1217           	}
1218         },"").set('reverseButtons', true);
1219      }
1220
1221      // Obnovit položky z koše
1222      if(this.value==8){
1223
1224		var table = $(this).data("table");
1225
1226		alertify.confirm(getString(1231),getString(1232), function (e) {
1227
1228        	if(e){
1229
1230				var inputs =$('.select-all-'+alias+' input[type=checkbox]:checked');
1231				var length = inputs.length;
1232
1233				if(length == 0){
1234					alertify.success(getString(1233));
1235				}
1236				else{
1237					$("#trashRight-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1238				}
1239
1240				// Načtení všech checkboxů a pokud je vybraný, tak smazat
1241				inputs.each(function(i,e){
1242					var id = $(this).data("id");
1243					$.ajax({
1244						url:'/admin/scripts/recovery.php?id='+id+'&table='+table+'',
1245						success: function(){
1246							if(i==length-1){
1247								alertify.success(getString(1233));
1248								setTimeout(function(){
1249									load_with_progress("#trashLeft-padding", "/admin/modules/mod_trash/mod_trash.php");
1250									$("#trashRight-padding").load("/admin/modules/mod_trash/mod_getTrash.php?type="+table+"");
1251								},1000);
1252							}
1253						}
1254					});
1255				});
1256			}
1257         },function(){
1258      		alertify.error(getString(1234));
1259		}).set({'reverseButtons': true, labels: {'ok': 'Ano', 'cancel': 'Zrušit'}});
1260      }
1261
1262      // Smazání natvrdo
1263      if(this.value==9){
1264
1265		// Načtení dat
1266    		var table = $(this).data("table");
1267
1268    		// Potvrzení
1269			alertify.confirm(get_popup_string(table, "delete", "group", "title"), get_popup_string(table, "delete", "group", "text"), function (e) {
1270          		if (e) {
1271
1272					var inputs =$('.select-all-'+alias+' input[type=checkbox]:checked');
1273					var length = inputs.length;
1274
1275					if(length == 0){
1276						alertify.success(get_popup_string(table, "delete", "group", "success"));
1277					}
1278					else{
1279						$("#trashRight-padding").html('<div class="text-center mt-5 mb-5"><div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div></div>');
1280					}
1281
1282					// Načtení všech checkboxů a pokud je vybraný, tak smazat
1283					inputs.each(function(i,e){
1284						var id = $(this).data("id");
1285						$.ajax({
1286							url: '/admin/scripts/delete.php?id='+id+'&table='+table+'&hard=1',
1287							success: function(){
1288								if(i==length-1){
1289									alertify.success(getString(1233));
1290									setTimeout(function(){
1291										load_with_progress("#trashLeft-padding", "/admin/modules/mod_trash/mod_trash.php");
1292										$("#trashRight-padding").load("/admin/modules/mod_trash/mod_getTrash.php?type="+table+"");
1293									},1000);
1294								}
1295							}
1296						});
1297					});
1298
1299					/*var len = $('.select-all-'+alias+' input[type=checkbox]:checked').length;
1300
1301          			// Načtení všech checkboxů a pokud je vybraný, tak smazat
1302            		$('.select-all-'+alias+' input[type=checkbox]').each(function(i,e){
1303              			if(this.checked){
1304                			var id = $(this).data("id");
1305                			$.ajax({
1306                				url: '/admin/scripts/delete.php?id='+id+'&table='+table
1306+'&hard=1',
1307                				success: function(){
1308                					$("."+table+"-delete-"+id+"").fadeOut(1000);
1309									if(i==len-1){
1310										load_with_progress("#trashLeft-padding", "/admin/modules/mod_trash/mod_trash.php");
1311									}
1312                				}
1313                			});
1314              			}
1315             		});
1316
1317            		alertify.success(success);*/
1318            	}
1319
1320              	$("#group-action-"+alias+" option[value=0]").prop('selected', true);
1321
1322         	},"").set('reverseButtons', true);
1323      	}
1324
1325		if(this.value==10){
1326
1327			$("#group-join-category").modal("show");
1328
1329        }
1330
1331		// Otočení o 90 stupňů doleva
1332        if(this.value==11){
1333
1334      		// Potvrzení
1335  			alertify.confirm(get_popup_string(alias, "turn_left", "group", "title"),get_popup_string(alias, "turn_left", "group", "text"), function (e) {
1336            		if (e) {
1337
1338  					var len = $('.select-all-'+alias+' input[type=checkbox]:checked').length;
1339
1340            			// Načtení všech checkboxů a pokud je vybraný, tak smazat
1341              		$('.select-all-'+alias+' input[type=checkbox]:checked').each(function(i,e){
1342                			if(this.checked){
1343                  			var id = $(this).data("id");
1344                  			$.ajax({
1345                  				url:'/admin/scripts/rotatePhoto.php?id='+id+'&deg=-90',
1346                  				success: function(){
1347                  					$("."+table+"-delete-"+id+"").fadeOut(1000);
1348  									if(i==len-1){
1349  										$("#refreshButton").trigger("click");
1350  									}
1351                  				}
1352                  			});
1353                			}
1354               		});
1355
1356              		alertify.success(success);
1357              	}
1358
1359                	$("#group-action-"+alias+" option[value=0]").prop('selected', true);
1360
1361           	},"").set('reverseButtons', true);
1362
1363		}
1364
1365		// Otočení o 90 stupňů doleva
1366        if(this.value==12){
1367
1368      		// Potvrzení
1369  			alertify.confirm(get_popup_string(alias, "turn_right", "group", "title"),get_popup_string(alias, "turn_right", "group", "text"), function (e) {
1370            		if (e) {
1371
1372  					var len = $('.select-all-'+alias+' input[type=checkbox]:checked').length;
1373
1374            			// Načtení všech checkboxů a pokud je vybraný, tak smazat
1375              		$('.select-all-'+alias+' input[type=checkbox]:checked').each(function(i,e){
1376                			if(this.checked){
1377                  			var id = $(this).data("id");
1378                  			$.ajax({
1379                  				url:'/admin/scripts/rotatePhoto.php?id='+id+'&deg=90',
1380                  				success: function(){
1381                  					$("."+table+"-delete-"+id+"").fadeOut(1000);
1382  									if(i==len-1){
1383  										$("#refreshButton").trigger("click");
1384  									}
1385                  				}
1386                  			});
1387                			}
1388               		});
1389
1390              		alertify.success(success);
1391              	}
1392
1393                	$("#group-action-"+alias+" option[value=0]").prop('selected', true);
1394
1395           	},"").set('reverseButtons', true);
1396
1397		}
1398
1399	});
1400
1401	$(".widget-button-move").click(function(){
1402		$(this).css("cursor", "grabbing");
1403	});
1404
1405	$(".widget-button-move").mouseup(function(){
1406		$(this).css("cursor", "grab");
1407	});
1408
1409	arrow_stop = false;
1410
1411	$(".admin-arrow-right").click(function(){
1412		if(!arrow_stop){
1413		arrow_stop = true;
1414		var name = $(this).data("name");
1415		var tag = $("#content-name-"+name+" .tag").eq(0);
1416		var ml = parseInt(tag.css("margin-left"));
1417
1418		var num = 100;
1419		var num1 = $("#wrapper-"+name+"").width();
1420		var num2 = $("#content-name-"+name+"").width();
1421
1422		if(num2-100 < num1){
1423			num = num2-num1;
1424		}
1425		tag.animate({marginLeft:"-="+num+"px"},400,function(){
1426			arrow_stop = false;
1427		});
1428		}
1429	});
1430
1431	$(".admin-arrow-left").click(function(){
1432		if(!arrow_stop){
1433			arrow_stop = true;
1434		var name = $(this).data("name");
1435		var tag = $("#content-name-"+name+" .tag").eq(0);
1436		var ml = parseInt(tag.css("margin-left"));
1437
1438		var num1 = $("#wrapper-"+name+"").width();
1439		var num2 = $("#content-name-"+name+"").width();
1440
1441		if(ml+100 < 0){
1442			tag.animate({marginLeft:"+=100px"},400,function(){
1443				arrow_stop = false;
1444			});
1445		}
1446		else{
1447			tag.animate({marginLeft:"0px"},400,function(){
1448				arrow_stop = false;
1449			});
1450		}
1451	}
1452	});
1453
1454	$(".vitalex-multiselect").vitalex_multiselect({
1455		multiselect: true,
1456		values: $(this).data("values")
1457	});
1458
1459	$(".vitalex-select").vitalex_multiselect({
1460		multiselect: false
1461	});
1462
1463	$(".color-picker").colorpicker({
1464		autoInputFallback:false,
1465		format:"hex"
1466	});
1467
1468	$(".disable-color-input").change(function(){
1469		var checked = $(this).is(":checked");
1470		$("#"+$(this).data("name")+"").prop("disabled", checked);
1471		$("#"+$(this).data("name")+"_t").prop("disabled", checked);
1472	})
1473
1474}
1475var TinymceHandler = function(){
1476
1477	$(document).on('focusin', function(e) {
1478  if ($(e.target).closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length) {
1479    e.stopImmediatePropagation();
1480  }
1481});
1482
1483	// Malý editor
1484	tinymce.init({
1485		selector: ".tinymce-small",
1486	    entity_encoding : "raw",
1487		height:"300",
1488	    relative_urls: false,
1489	    language : "cs",
1490
1491	    setup: function (editor) {
1492        	editor.on('change', function () {
1493				tinymce.triggerSave();
1494				var form = $(tinymce.DOM.doc.forms[0]);
1495				form.addClass("form-edited")
1496        	});
1497    	},
1498
1499		menubar: 'file edit view insert format tools table tc help',
1500	    plugins: "advlist autolink autosave link image lists charmap preview anchor pagebreak searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table directionality emoticons",
1501
1502
1503	    image_advtab: true ,
1504		file_picker_types: 'image file',
1505    	external_filemanager_path:"/core/libraries/jmpFileManager/",
1506    	filemanager_title:getString(120) ,
1507    	file_picker_callback: function(callback, value, meta) {
1508	        urltype=2;
1509	        if (meta.filetype=='image') { urltype=1; }
1510			if (meta.filetype=='media') { urltype=3; }
1511
1512	        $("body").append("<div class='modal' id='filemanager_modal' tabindex='-1'><div class='modal-dialog modal-xl'><div class='modal-content rounded-0'></div></div></div>");
1513	        if(urltype==2){
1514	    	    $("#filemanager_modal .modal-content").load("/core/libraries/jmpFileManager/files.php?fm=true&setcookies=true", function(){
1515					$("#filemanager_modal").modal("show");
1516	    	        $(document).one('click', ".fileChoose", function(){
1517						callback("/"+$(this).attr('path'));
1518	    	    	   // win.document.getElementById(id).value=$(this).attr('path');
1519	    	    	    $("#filemanager_modal").modal("hide");
1520	    	    	});
1521		        });
1522	        }
1523
1524	        else if(urltype==1){
1525	    	    $("#filemanager_modal .modal-content").load("/core/libraries/jmpFileManager/images.php?fm=true&setcookies=true", function(){
1526					$("#filemanager_modal").modal("show");
1527	    	        $(document).one('click', ".fileChoose", function(){
1528						callback("/"+$(this).attr('path'));
1529	    	    	    //win.document.getElementById(id).value=$(this).attr('path');
1530	    	    	    $("#filemanager_modal").modal("hide");
1531	    	    	});
1532		        });
1533	        }
1534
1535	    }
1536	  });
1537
1538
1539	  // Velký editor
1540	  tinymce.init({
1541		selector: ".tinymce-large",
1542
1543		height:"300",
1544
1545		menu: {
1546    		custom: { title: 'Makra', items: 'contactform categorygallery contactcat scheduler' },
1547    		insert: { title: 'Vložit', items: 'image link media ytshorts table | charmap emoticons hr | pagebreak nonbreaking anchor | inserttime' }
1548  		},
1549
1550		menubar: 'file edit insert view format table tools help custom',
1551
1552    	setup: function (editor) {
1553
1554        	editor.on('change', function () {
1555        	    tinymce.triggerSave();
1556				var form = $(tinymce.DOM.doc.forms[0]);
1557				form.addClass("form-edited")
1558			});
1559
1560        	// Vložit menu
1561        	editor.ui.registry.addMenuItem('menu', {
1562	        	text: 'Menu',
1563    	    	icon: 'menuMenu',
1564    	    	context: 'insert',
1565    	    	onclick: function() {
1566    	    	    editor.windowManager.open({
1567    	    			title: getString(817),
1568    	    			body: [
1569    	      				{type: 'listbox', name: 'idk', label: getString(819), values: get("sections"), minWidth:300},
1570    	      				{type: 'container', name: 'container', label: '', html:getString(820)}
1571    	    			],
1572    	    			onsubmit: function(e) {
1573    	      			// Insert content when the window form is submitted
1574    	      				editor.insertContent('{menu ' + e.data.idk +'}');
1575					 	    top.tinymce.activeEditor.windowManager.close();
1576    	    			}
1577    	  			});
1578    	    	}
1579    	  	});
1580    	  	
1581			editor.ui.registry.addMenuItem('ytshorts', {
1582            text: 'YT Shorts',
1583            icon: 'embed',
1584            onAction: function () {
1585                editor.windowManager.open({
1586                    title: 'Vložit YouTube Shorts',
1587                    body: {
1588                        type: 'panel',
1589                        items: [
1590                            {
1591                                type: 'input',
1592                                name: 'shortsUrl',
1593                                label: 'Zadejte URL Shorts videa'
1594                            }
1595                        ]
1596                    },
1597                    buttons: [
1598                        {
1599                            type: 'submit',
1600                            text: 'Vložit',
1601                            primary: true
1602                        },
1603                        {
1604                            type: 'cancel',
1605                            text: 'Zrušit'
1606                        }
1607                    ],
1608                    onSubmit: function (api) {
1609                        let url = api.getData().shortsUrl;
1610                        api.close();
1611                        
1612                        // Nahrazení "/shorts/" -> "/embed/"
1613                        let embedUrl = url.replace('/shorts/', '/embed/');
1614                        
1615                        // Kontrola, zda je platná URL
1616                        if (embedUrl.includes('/embed/')) {
1617                            editor.insertContent(`<iframe width="560" height="315" src="${embedUrl}" frameborder="0" allowfullscreen></iframe>`);
1618                        } else {
1619                            alert('Neplatný YouTube Shorts odkaz!');
1620                        }
1621                    }
1622                });
1623            }
1624        });
1625    	    // Vložit jídelníček
1626    	   editor.ui.registry.addMenuItem('food', {
1627    	    	text: getString(54),
1628    	    	icon: 'foodMenu',
1629    	    	context: 'insert',
1630    	    	onclick: function() {
1631    	    	    editor.windowManager.open({
1632    	    			title: getString(815),
1633    	    			body: [
1634    	      				{type: 'textbox', name: 'number', label: getString(671), value: 0, minWidth:300},
1635    	      				{type: 'container', name: 'container', label: '', html:getString(816)}
1636    	    			],
1637    	    			onsubmit: function(e) {
1638    	      			// Insert content when the window form is submitted
1639    	      				editor.insertContent('{food ' + e.data.number +'}');
1640					 	    top.tinymce.activeEditor.windowManager.close();
1641    	    			}
1642    	  			});
1643    	    	}
1644    	  	});
1645
1646    	  	// Vložit kontaktní formulář
1647    	    editor.ui.registry.addMenuItem('contactform', {
1648    	    	text: getString(812),
1649    	    	icon: 'comment',
1650    	    	onAction: function() {
1651    	    	    editor.windowManager.open({
1652    	    			title: getString(813),
1653						body: {
1654							type:"panel",
1655							items:[
1656    	      					{type: 'input', name: 'email', label: 'E-mail', value: "", minWidth:300},
1657    	      					{type: 'htmlpanel', name: 'container', label: '', html:getString(814)}
1658    	    				],
1659						},
1660						buttons:[{
1661							type:"custom",
1662							name:"insert",
1663							text:"Vložit",
1664						}],
1665						onAction: function(dialogApi, details) {
1666
1667							var data = dialogApi.getData();
1668    	      				editor.insertContent('{contactform ' + data.email +'}');
1669					 	    top.tinymce.activeEditor.windowManager.close();
1670    	    			}
1671    	  			});
1672    	    	}
1673    	  	});
1674
1675			// Vložit kategorii fotoalb
1676    	    editor.ui.registry.addMenuItem('categorygallery', {
1677    	    	text: getString(1697),
1678    	    	icon: 'gallery',
1679    	    	onAction: function() {
1680    	    	    editor.windowManager.open({
1681    	    			title: getString(1697),
1682						body: {
1683							type:"panel",
1684							items:[
1685    	      					{type: 'selectbox', name: 'cgid', label: getString(34), items: get("category_gallery"), minWidth:300}
1686    	    				],
1687						},
1688						buttons:[{
1689							type:"custom",
1690							name:"insert",
1691							text:"Vložit",
1692						}],
1693						onAction: function(dialogApi, details) {
1694
1695							var data = dialogApi.getData();
1696    	      				editor.insertContent('{categorygallery ' + data.cgid +'}');
1697					 	    top.tinymce.activeEditor.windowManager.close();
1698    	    			}
1699    	  			});
1700    	    	}
1701    	  	});
1702
1703			// Vložit kategorii kontaktů
1704    	    editor.ui.registry.addMenuItem('contactcat', {
1705    	    	text: getString(1698),
1706    	    	icon: 'user',
1707    	    	onAction: function() {
1708    	    	    editor.windowManager.open({
1709    	    			title: getString(1698),
1710						body: {
1711							type:"panel",
1712							items:[
1713    	      					{type: 'selectbox', name: 'ccid', label: getString(34), items: get("contactcats"), minWidth:300}
1714    	    				],
1715						},
1716						buttons:[{
1717							type:"custom",
1718							name:"insert",
1719							text:"Vložit",
1720						}],
1721						onAction: function(dialogApi, details) {
1722
1723							var data = dialogApi.getData();
1724    	      				editor.insertContent('{contactcategory ' + data.ccid +'}');
1725					 	    top.tinymce.activeEditor.windowManager.close();
1726    	    			}
1727    	  			});
1728    	    	}
1729    	  	});
1730
1731			// Vložit rezervační systém
1732    	    editor.ui.registry.addMenuItem('scheduler', {
1733    	    	text: getString(1707),
1734    	    	icon: 'paste',
1735    	    	onAction: function() {
1736    	    	    editor.windowManager.open({
1737    	    			title: getString(1707),
1738						body: {
1739							type:"panel",
1740							items:[
1741    	      					{type: 'selectbox', name: 'sid', label: getString(59), items: get("schedulers"), minWidth:300}
1742    	    				],
1743						},
1744						buttons:[{
1745							type:"custom",
1746							name:"insert",
1747							text:"Vložit",
1748						}],
1749						onAction: function(dialogApi, details) {
1750
1751							var data = dialogApi.getData();
1752    	      				editor.insertContent('{scheduler ' + data.sid +'}');
1753					 	    top.tinymce.activeEditor.windowManager.close();
1754    	    			}
1755    	  			});
1756    	    	}
1757    	  	});
1758
1759    	  	// Vložit složku souborů
1760    	  	editor.ui.registry.addButton('addFilesdir', {
1761    	  		text: '',
1762    	  		icon: 'copy',
1763    	  		tooltip: getString(288),
1764    	  		onAction: function () {
1765    	    		editor.windowManager.open({
1766    	    			title: getString(288),
1767						body: {
1768							type:"panel",
1769							items:[
1770    							{type: 'selectbox', name: 'fdid', label: getString(292), items: get("filesdirs"), minWidth:300}
1771    	    				],
1772						},
1773						buttons:[{
1774							type:"custom",
1775							name:"insert",
1776							text:"Vložit",
1777						}],
1778    	    			onAction: function(dialogApi, details) {
1779
1780							var data = dialogApi.getData();
1781    	      			// Insert content when the window form is submitted
1782    	      				editor.insertContent('{filesdir ' + data.fdid +'}');
1783					 	    top.tinymce.activeEditor.windowManager.close();
1784    	    			}
1785    	  			});
1786    	  		}
1787    		});
1788
1789    		// Vložit galerii
1790    		editor.ui.registry.addButton('addGallery', {
1791    	  		text: '',
1792    	  		icon: 'gallery',
1793    	  		tooltip: getString(811),
1794    	  		onAction: function () {
1795    	    		editor.windowManager.open({
1796    	    			title: getString(810),
1797						body: {
1798							type:"panel",
1799							items:[
1800    	      					{type: 'selectbox', name: 'gid', label: getString(34), items: get("galleries"), minWidth:300}
1801    	    				],
1802						},
1803						buttons:[{
1804							type:"custom",
1805							name:"insert",
1806							text:"Vložit",
1807						}],
1808    	    			onAction: function(dialogApi, details) {
1809
1810							var data = dialogApi.getData();
1811
1812    	      				editor.insertContent('{gallery ' + data.gid +'}');
1813    	      				top.tinymce.activeEditor.windowManager.close();
1814    	    			}
1815    	  			});
1816    	  		}
1817   			});
1818    	},
1819    	entity_encoding : "raw",
1820    	relative_urls: false,
1821		language_url : '/core/libraries/cs.js',
1822		language : "cs",
1823
1824    	content_css:get("css_files"),
1825
1826    	plugins: "advlist autolink autosave link image lists charmap preview anchor pagebreak searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table directionality emoticons",
1827
1828    	toolbar1: "undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright al
1828ignjustify | bullist numlist  outdent indent",
1829    	toolbar2: "table | hr removeformat | subscript superscript | charmap emoticons | unlink link media image addFilesdir addGallery",
1830    	link_list:get("link_list"),
1831		link_target_list: [
1832    		{title: 'Aktuální okno', value: ''},
1833    		{title: 'Nové okno', value: '_blank'},
1834    		{title: 'Vyskakovací okno', value: 'modal-for-link-iframe'},
1835  		],
1836		link_rel_list: [
1837			{title: 'Výchozí dle nastavení systému', value: ''},
1838   			{title: 'Bez ikony a velikosti', value: 'info-no'},
1839   			{title: 'Jen ikona', value: 'info-icon'},
1840			{title: 'Jen velikost', value: 'info-size'},
1841			{title: 'Ikona a velikost', value: 'info-all'}
1842 		],
1843    	image_advtab: true ,
1844    	file_picker_types: 'image file',
1845    	external_filemanager_path:"/core/libraries/jmpFileManager/",
1846    	filemanager_title:getString(120) ,
1847    	file_picker_callback: function(callback, value, meta) {
1848	        urltype=2;
1849	        if (meta.filetype=='image') { urltype=1; }
1850			if (meta.filetype=='media') { urltype=3; }
1851
1852	        $("body").append("<div class='modal' id='filemanager_modal' tabindex='-1'><div class='modal-dialog modal-xl'><div class='modal-content rounded-0'></div></div></div>");
1853	        if(urltype==2){
1854	    	    $("#filemanager_modal .modal-content").load("/core/libraries/jmpFileManager/files.php?fm=true&setcookies=true", function(){
1855					$("#filemanager_modal").modal("show");
1856	    	        $(document).one('click', ".fileChoose", function(){
1857						callback("/"+$(this).attr('path'));
1858	    	    	   // win.document.getElementById(id).value=$(this).attr('path');
1859	    	    	    $("#filemanager_modal").modal("hide");
1860	    	    	});
1861		        });
1862	        }
1863
1864	        else if(urltype==1){
1865	    	    $("#filemanager_modal .modal-content").load("/core/libraries/jmpFileManager/images.php?fm=true&setcookies=true", function(){
1866					$("#filemanager_modal").modal("show");
1867	    	        $(document).one('click', ".fileChoose", function(){
1868						callback("/"+$(this).attr('path'));
1869	    	    	    //win.document.getElementById(id).value=$(this).attr('path');
1870	    	    	    $("#filemanager_modal").modal("hide");
1871	    	    	});
1872		        });
1873	        }
1874
1875	    }
1876  	});
1877
1878	// Velký editor
1879	tinymce.init({
1880	  selector: ".tinymce-post",
1881
1882	  menu: {
1883		  custom: { title: 'Makra', items: 'contactform' }
1884	  },
1885
1886	  menubar: 'file edit insert view format table tools help custom',
1887
1888	  setup: function (editor) {
1889
1890		  editor.on('change', function () {
1891			  tinymce.triggerSave();
1892			  var form = $(tinymce.DOM.doc.forms[0]);
1893			  form.addClass("form-edited")
1894		  });
1895
1896		  // Vložit menu
1897		  editor.ui.registry.addMenuItem('menu', {
1898			  text: 'Menu',
1899			  icon: 'menuMenu',
1900			  context: 'insert',
1901			  onclick: function() {
1902				  editor.windowManager.open({
1903					  title: getString(817),
1904					  body: [
1905						  {type: 'listbox', name: 'idk', label: getString(819), values: get("sections"), minWidth:300},
1906						  {type: 'container', name: 'container', label: '', html:getString(820)}
1907					  ],
1908					  onsubmit: function(e) {
1909					  // Insert content when the window form is submitted
1910						  editor.insertContent('{menu ' + e.data.idk +'}');
1911						  top.tinymce.activeEditor.windowManager.close();
1912					  }
1913				  });
1914			  }
1915		  });
1916
1917		  // Vložit jídelníček
1918		 editor.ui.registry.addMenuItem('food', {
1919			  text: getString(54),
1920			  icon: 'foodMenu',
1921			  context: 'insert',
1922			  onclick: function() {
1923				  editor.windowManager.open({
1924					  title: getString(815),
1925					  body: [
1926						  {type: 'textbox', name: 'number', label: getString(671), value: 0, minWidth:300},
1927						  {type: 'container', name: 'container', label: '', html:getString(816)}
1928					  ],
1929					  onsubmit: function(e) {
1930					  // Insert content when the window form is submitted
1931						  editor.insertContent('{food ' + e.data.number +'}');
1932						  top.tinymce.activeEditor.windowManager.close();
1933					  }
1934				  });
1935			  }
1936		  });
1937
1938		  // Vložit kontaktní formulář
1939		  editor.ui.registry.addMenuItem('contactform', {
1940			  text: getString(812),
1941			  icon: 'comment',
1942			  onAction: function() {
1943				  editor.windowManager.open({
1944					  title: getString(813),
1945					  body: {
1946						  type:"panel",
1947						  items:[
1948							  {type: 'input', name: 'email', label: 'E-mail', value: "", minWidth:300},
1949							  {type: 'htmlpanel', name: 'container', label: '', html:getString(814)}
1950						  ],
1951					  },
1952					  buttons:[{
1953						  type:"custom",
1954						  name:"insert",
1955						  text:"Vložit",
1956					  }],
1957					  onAction: function(dialogApi, details) {
1958
1959						  var data = dialogApi.getData();
1960						  editor.insertContent('{contactform ' + data.email +'}');
1961						  top.tinymce.activeEditor.windowManager.close();
1962					  }
1963				  });
1964			  }
1965		  });
1966
1967		  // Vložit složku souborů
1968		  editor.ui.registry.addButton('addFilesdir', {
1969			  text: '',
1970			  icon: 'copy',
1971			  tooltip: getString(288),
1972			  onAction: function () {
1973				  editor.windowManager.open({
1974					  title: getString(288),
1975					  body: {
1976						  type:"panel",
1977						  items:[
1978							  {type: 'selectbox', name: 'fdid', label: getString(292), items: get("filesdirs"), minWidth:300}
1979						  ],
1980					  },
1981					  buttons:[{
1982						  type:"custom",
1983						  name:"insert",
1984						  text:"Vložit",
1985					  }],
1986					  onAction: function(dialogApi, details) {
1987
1988						  var data = dialogApi.getData();
1989					  // Insert content when the window form is submitted
1990						  editor.insertContent('{filesdir ' + data.fdid +'}');
1991						  top.tinymce.activeEditor.windowManager.close();
1992					  }
1993				  });
1994			  }
1995		  });
1996
1997		  // Vložit galerii
1998		  editor.ui.registry.addButton('addGallery', {
1999			  text: '',
2000			  icon: 'gallery',
2001			  tooltip: getString(811),
2002			  onAction: function () {
2003				  editor.windowManager.open({
2004					  title: getString(810),
2005					  body: {
2006						  type:"panel",
2007						  items:[
2008							  {type: 'selectbox', name: 'gid', label: getString(34), items: get("galleries"), minWidth:300}
2009						  ],
2010					  },
2011					  buttons:[{
2012						  type:"custom",
2013						  name:"insert",
2014						  text:"Vložit",
2015					  }],
2016					  onAction: function(dialogApi, details) {
2017
2018						  var data = dialogApi.getData();
2019
2020						  editor.insertContent('{gallery ' + data.gid +'}');
2021						  top.tinymce.activeEditor.windowManager.close();
2022					  }
2023				  });
2024			  }
2025		  });
2026	  },
2027	  entity_encoding : "raw",
2028	  relative_urls: false,
2029	  language_url : '/core/libraries/cs.js',
2030	  language : "cs",
2031
2032	  content_css:get("css_files"),
2033
2034	  plugins: [
2035		  "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
2036		  "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
2037		  "table directionality emoticons paste fullpage",
2038	  ],
2039
2040	  toolbar1: "undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright al
2040ignjustify | bullist numlist  outdent indent blockquote  ",
2041	  toolbar2: "table | hr removeformat | subscript superscript | charmap emoticons | insertdatetime preview | anchor unlink link media image addFilesdir addGallery",
2042	  link_list:get("link_list"),
2043	  link_class_list: [
2044		  {title: 'Normální', value: ''},
2045		  {title: 'Vyskakovací okno (obrázek)', value: 'fancy'},
2046		  {title: 'Vyskakovací okno (odkaz, soubor)', value: 'iframe'}
2047	  ],
2048	  image_advtab: true ,
2049	  file_picker_types: 'image file',
2050	  external_filemanager_path:"/core/libraries/jmpFileManager/",
2051	  filemanager_title:getString(120) ,
2052	  file_picker_callback: function(callback, value, meta) {
2053		  console.log("Ahoj");
2054		  urltype=2;
2055		  if (meta.filetype=='image') { urltype=1; }
2056		  if (meta.filetype=='media') { urltype=3; }
2057
2058		  $("body").append("<div class='jmpManagerMain jmpManager'><div class='jmpManagerContent jmpManager'></div><div id='close' class='jmpManager' onclick='clicke()'>x</div></div>");
2059		  if(urltype==2){
2060			  $(".jmpManagerContent").load("/core/libraries/jmpFileManager/files.php", function(){
2061				  $(document).one('click', ".fileChoose", function(){
2062					  callback("/"+$(this).attr('path'));
2063					 // win.document.getElementById(id).value=$(this).attr('path');
2064					  $(".jmpManagerMain").remove();
2065				  });
2066			  });
2067		  }
2068
2069		  else if(urltype==1){
2070			  $(".jmpManagerContent").load("/core/libraries/jmpFileManager/images.php", function(){
2071				  $(document).one('click', ".fileChoose", function(){
2072					  callback("/"+$(this).attr('path'));
2073					  //win.document.getElementById(id).value=$(this).attr('path');
2074					  $(".jmpManagerMain").remove();
2075				  });
2076			  });
2077		  }
2078
2079	  }
2080  });
2081
2082  $.extend($.fancybox.defaults, {
2083    helpers : {
2084      overlay : {
2085        closeClick: false,
2086      },
2087    },
2088  });
2089
2090}
2091
2092function open_filemanager(name, selected, type, header, padding, gal, cat, breadcrumb){
2093
2094	var title = (type == "images") ? getString(381) : getString(120);
2095
2096	var modal = generate_modal("fm-select", title);
2097
2098	modal.modal("show");
2099	if(type=="images"){
2100		modal.find(".modal-body").load("/core/libraries/jmpFileManager/"+type+".php?header="+header+"&padding="+padding+"&gal="+gal+"&cat="+cat+"&breadcrumb="+breadcrumb+"&name="+name+"");
2101	}
2102	else{
2103		modal.find(".modal-body").load("/core/libraries/jmpFileManager/"+type+".php?header="+header+"&padding="+padding+"&dir="+gal+"&breadcrumb="+breadcrumb+"&name="+name+"");
2104	}
2105
2106	$("#modal-fm-select").on('hidden.bs.modal', function (e) {
2107		$("#modal-fm-select").remove();
2108	});
2109
2110}
2111
2112function open_contentmanager(name, selected, type, multiselect, options){
2113
2114	var title = "Vyberte obsah";
2115
2116	var modal = generate_modal("content-select", title);
2117
2118	modal.modal("show");
2119	modal.find(".modal-body").load("/admin/modules/content_manager/main.php?name="+name+"&selected="+selected+"&type="+type+"&multiselect="+multiselect+"&options="+options);
2120
2121	modal.on('hidden.bs.modal', function (e) {
2122		modal.remove();
2123	});
2124
2125}
2126
2127function generate_modal(name, title){
2128	var modal = $('<div data-backdrop="static" class="modal fade" tabindex="-1" id="modal-'+name+'" role="dialog" aria-hidden="true"></div>');
2129  	var modal_dialog = $('<div class="modal-dialog modal-lg modal-dialog-centered" role="document"></div>');
2130    var modal_content = $('<div class="modal-content rounded-0"></div>');
2131    var modal_header = $('<div class="modal-header form-header">'+title+'</div>');
2132    var modal_title = $('<button data-dismiss="modal" aria-label="Close" class="close close-form"><span class="material-icons">close</span></button>');
2133    var modal_body = $('<div class="modal-body content_manager_body"></div>');
2134
2135	modal_title.appendTo(modal_header);
2136	modal_header.appendTo(modal_content);
2137	modal_body.appendTo(modal_content);
2138	modal_content.appendTo(modal_dialog);
2139	modal_dialog.appendTo(modal);
2140	modal.appendTo("body");
2141
2142	return $("#modal-"+name+"");
2143}
2144
2145function remove_fm_file(name){
2146	$("#input-"+name+"").val(0);
2147	$("#fm-name-"+name+"").text(get_string(349));
2148	$("#remove_fm_file-"+name+"").hide();
2149	$("#preview-"+name+"").css("visibility", "hidden");
2150}
2151
2152function remove_content_item(name){
2153	$("#input-"+name+"").val(0);
2154	$("#content-name-"+name+"").text(get_string(349));
2155	$("#remove_content_item-"+name+"").hide();
2156	$("#preview-"+name+"").css("visibility", "hidden");
2157}
2158
2159
2160//override defaults
2161alertify.defaults.transition = "slide";
2162alertify.defaults.theme.ok = "btn btn-success";
2163alertify.defaults.theme.cancel = "btn btn-danger";
2164alertify.defaults.theme.input = "form-control";

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.