if(typeof KAJONA=="undefined"){var KAJONA={util:{},portal:{lang:{}},admin:{lang:{}}}}KAJONA.admin.portaleditor={objPlaceholderWithElements:{},initPortaleditor:function(){KAJONA.admin.loader.loadFile(["/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js","/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css","/core/module_system/admin/scripts/jquery/jquery.htmlClean.min.js","/core/module_pages/admin/scripts/rangy/rangy-core.js","/core/module_pages/admin/scripts/halloeditor/hallo-min.js","/core/module_pages/admin/scripts/halloeditor/hallo.css","/core/module_pages/admin/scripts/halloeditor/fontawesome/css/font-awesome.css"],function(){KAJONA.admin.portaleditor.RTE.init()})},showActions:function(a){$("#container_"+a).attr("class","peContainerHover");$("#menu_"+a).attr("class","menuHover")},hideActions:function(a){$("#container_"+a).attr("class","peContainerOut");$("#menu_"+a).attr("class","menuOut")},switchEnabled:function(a){var b=a==true?"true":"false";var d=window.location.href;var c=d.indexOf("#");if(c!=-1){d=d.substring(0,c)}d=d.replace("&pe=false","");d=d.replace("&pe=true","");d=d.replace("?pe=false","");d=d.replace("?pe=true","");if(d.indexOf("?")==-1){window.location.replace(d+"?pe="+b)}else{window.location.replace(d+"&pe="+b)}},openDialog:function(a){peDialog.setContentIFrame(a);peDialog.init()},closeDialog:function(){var a=confirm(KAJONA.admin.lang.pe_dialog_close_warning);if(a){peDialog.hide();peDialog.setContentRaw("")}},addNewElements:function(c,b,a){this.objPlaceholderWithElements[c]={placeholderName:b,elements:a}}};KAJONA.admin.portaleditor.RTE={};KAJONA.admin.portaleditor.RTE.modifiedFields={};KAJONA.admin.portaleditor.RTE.savePage=function(){$.each(KAJONA.admin.portaleditor.RTE.modifiedFields,function(b,d){var a=b.split("#");var c={systemid:a[0],property:a[1],value:d};$.post(KAJONA_WEBPATH+"/xml.php?admin=1&module=pages_content&action=updateObjectProperty",c,function(){})});$("#savePageLink > img").attr("src",$("#savePageLink > img").attr("src").replace(".png","Disabled.png"));KAJONA.admin.portaleditor.RTE.modifiedFields={}};KAJONA.admin.portaleditor.RTE.pasteHandler=function(f){document.execCommand("enableObjectResizing",false,false);var e=$(f.currentTarget);var g=rangy.getSelection();var h=e.offset();$("body").append('<div id="pasteContainer" contentEditable="true" style="position:absolute; clip:rect(0px, 0px, 0px, 0px); width: 1px; height: 1px; top: '+h.top+"px; left: "+h.left+'px;"></div>');var d=$("#pasteContainer");var c=e.attr("data-kajona-editable").split("#");var a=(c[2]&&c[2]=="plain")?true:false;if(a){var b={allowedTags:[""]}}else{var b={allowedTags:["br","p","ul","ol","li"]}}e.blur();d.focus();window.setTimeout(function(){f.stopPropagation();var j=d.html();var l=$.htmlClean.trim($.htmlClean(j,b));d.html("");d.remove();document.execCommand("enableObjectResizing",false,true);e.focus();var k=g.anchorNode.data;var i=k.substr(0,g.anchorOffset)+l+k.substring(g.focusOffset);g.anchorNode.data=i;g.collapse(g.anchorNode,g.anchorOffset+l.length)},10)};KAJONA.admin.portaleditor.RTE.init=function(){$("*[data-kajona-editable]").each(function(){var c=$(this);var b=c.attr("data-kajona-editable").split("#");var a=(b[2]&&b[2]=="plain")?true:false;c.bind("paste",KAJONA.admin.portaleditor.RTE.pasteHandler);if(a){c.keypress(function(e){if(e.which==13){return false}})}c.bind("drop drag",function(){return false});var d={plugins:{halloreundo:{}},modified:function(f,g){var e=$(this).attr("data-kajona-editable");$("#savePageLink > img").attr("src",$("#savePageLink > img").attr("src").replace("Disabled",""));KAJONA.admin.portaleditor.RTE.modifiedFields[e]=g.content}};if(!a){d.plugins={halloformat:{},hallolists:{},halloreundo:{}}}c.hallo(d)});$(window).on("beforeunload",function(){var a=false;$.each(KAJONA.admin.portaleditor.RTE.modifiedFields,function(){a=true;return false});if(a){return KAJONA.admin.lang.pe_rte_unsavedChanges}})};KAJONA.admin.loader=new KAJONA.util.Loader();KAJONA.admin.tooltip={initTooltip:function(){KAJONA.admin.loader.loadFile(["/core/module_system/admin/scripts/qtip2/jquery.qtip.min.js","/core/module_system/admin/scripts/qtip2/jquery.qtip.min.css"],function(){$("*[rel=tooltip]").qtip({position:{viewport:$(window)},style:{classes:"ui-tooltip-youtube ui-tooltip-shadow"}})})},addTooltip:function(b,a){KAJONA.admin.loader.loadFile(["/core/module_system/admin/scripts/qtip2/jquery.qtip.min.js","/core/module_system/admin/scripts/qtip2/jquery.qtip.min.css"],function(){if(a){$(b).qtip({position:{viewport:$(window)},style:{classes:"ui-tooltip-youtube ui-tooltip-shadow"},content:{text:a}})}else{$(b).qtip({position:{viewport:$(window)},style:{classes:"ui-tooltip-youtube ui-tooltip-shadow"}})}})}};KAJONA.admin.tooltip.initTooltip();