/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
!function(){var each=tinymce.each;tinymce.PluginManager.add("effects",function(ed,url){function cleanEventAttribute(val){return val?val.replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/,"$1").replace(/^\s*|\s*$/g,""):""}function bindMouseoverEvent(ed){each(ed.dom.select("img[data-mouseover]"),function(elm){var src=elm.getAttribute("src"),mouseover=elm.getAttribute("data-mouseover");return!src||!mouseover||(elm.onmouseover=function(){elm.setAttribute("src",elm.getAttribute("data-mouseover"))},void(elm.onmouseout=function(){elm.setAttribute("src",elm.getAttribute("data-mouseout")||src)}))})}ed.onPreInit.add(function(){ed.onBeforeSetContent.add(function(ed,o){if(o.content.indexOf("onmouseover=")!==-1){var div=ed.dom.create("div",{},o.content);each(ed.dom.select("img[onmouseover]",div),function(node){var mouseover=node.getAttribute("onmouseover"),mouseout=node.getAttribute("onmouseout");if(!mouseover||0!==mouseover.indexOf("this.src"))return!0;if(mouseover=cleanEventAttribute(mouseover),node.removeAttribute("onmouseover"),!mouseover)return!0;if(node.setAttribute("data-mouseover",mouseover),mouseout&&0===mouseout.indexOf("this.src")){if(mouseout=cleanEventAttribute(mouseout),node.removeAttribute("onmouseout"),!mouseout)return;node.setAttribute("data-mouseout",mouseout)}}),o.content=div.innerHTML}}),ed.parser.addAttributeFilter("onmouseover",function(nodes){for(var i=nodes.length;i--;){var node=nodes[i];if("img"===node.name){var mouseover=node.attr("onmouseover"),mouseout=node.attr("onmouseout");mouseover&&0===mouseover.indexOf("this.src")&&(mouseover=cleanEventAttribute(mouseover),node.attr("data-mouseover",mouseover),node.attr("onmouseover",null),mouseout&&0===mouseout.indexOf("this.src")&&(mouseout=cleanEventAttribute(mouseout),node.attr("data-mouseout",mouseout),node.attr("onmouseout",null)))}}}),ed.serializer.addAttributeFilter("data-mouseover",function(nodes){for(var i=nodes.length;i--;){var node=nodes[i];if("img"===node.name){var mouseover=node.attr("data-mouseover"),mouseout=node.attr("data-mouseout");mouseover=cleanEventAttribute(mouseover),node.attr("data-mouseover",null),node.attr("data-mouseout",null),mouseover&&(node.attr("onmouseover","this.src='"+mouseover+"';"),mouseout=cleanEventAttribute(mouseout),mouseout&&node.attr("onmouseout","this.src='"+mouseout+"';"))}}}),ed.selection.onSetContent.add(function(){bindMouseoverEvent(ed)}),ed.onSetContent.add(function(){bindMouseoverEvent(ed)}),ed.onUpdateMedia.add(function(ed,o){o.before&&o.after&&each(ed.dom.select("img[data-mouseover]"),function(elm){var mouseover=elm.getAttribute("data-mouseover"),mouseout=elm.getAttribute("data-mouseout");return!mouseover||(mouseover==o.before&&elm.setAttribute("data-mouseover",o.after),void(mouseout==o.before&&elm.setAttribute("data-mouseout",o.after)))})})})})}();