EVOLUTION-MANAGER
Edit File: sidebyside.js
jQuery(document).ready(function(t){t("#toolbar-target").hide(),t("#toolbar-copy").hide(),Joomla.submitbutton=function(e){if("association.cancel"===e)Joomla.submitform(e);else if("copy"===e){Joomla.loadingLayer("show");var a=document.getElementById("target-association").getAttribute("data-language"),i=window.frames["reference-association"].document.getElementById("jform_language");i.removeAttribute("disabled"),i.value=a,window.frames["reference-association"].Joomla.submitbutton(document.getElementById("adminForm").getAttribute("data-associatedview")+".save2copy")}else if("undo-association"===e){var o=document.getElementById("reference-association"),n=document.getElementById("target-association"),s=(o.getAttribute("data-id"),o.getAttribute("data-language").replace(/-/,"_"));n.getAttribute("data-id"),a=n.getAttribute("data-language").replace(/-/,"_");o=t(o).contents(),n=t(n).contents(),o.find("#jform_associations_"+a+"_id").val(""),o.find("#jform_associations_"+a+"_name").val(""),o.find("#jform_associations_"+a+"_chzn").remove(),o.find("#jform_associations_"+a).val("").change().chosen();var d="";t("#jform_itemlanguage option").each(function(){void 0!==(d=t(this).val().split("|")[0])&&(d=d.replace(/-/,"_"),n.find("#jform_associations_"+d+"_id").val(""),n.find("#jform_associations_"+d+"_chzn").remove(),n.find("#jform_associations_"+d).val("").change().chosen())}),n.find("#jform_associations_"+s+"_id").val(""),n.find("#jform_associations_"+s+"_name").val(""),n.find("#jform_associations_"+s+"_chzn").remove(),n.find("#jform_associations_"+s).val("").change().chosen();var r=t("#jform_itemlanguage").val(),c=a.replace(/_/,"-");t('#jform_itemlanguage option[value="'+r+'"]').val(c+":0:add"),t("#jform_itemlanguage").val("").change(),t("#jform_itemlanguage").trigger("liszt:updated"),Joomla.submitbutton("reference")}else t("#"+e+"-association").contents().find("#jform_language").attr("disabled",!1),window.frames[e+"-association"].Joomla.submitbutton(document.getElementById("adminForm").getAttribute("data-associatedview")+".apply");return!1},Joomla.loadingLayer("load"),t(document).on("click","#toogle-left-panel",function(){var e=this.getAttribute("data-hide-reference"),a=this.getAttribute("data-show-reference");t(this).text()===e?t(this).text(a):t(this).text(e),t("#left-panel").toggle(),t("#right-panel").toggleClass("full-width")}),t(document).on("change","#jform_itemlanguage",function(){var e=document.getElementById("target-association"),a=t(this).val();""!==a&&void 0!==a?(e.setAttribute("data-action",a.split(":")[2]),e.setAttribute("data-id",a.split(":")[1]),e.setAttribute("data-language",a.split(":")[0]),Joomla.loadingLayer("show"),e.src=e.getAttribute("data-editurl")+"&task="+e.getAttribute("data-item")+"."+e.getAttribute("data-action")+"&id="+e.getAttribute("data-id")):(t("#toolbar-target").hide(),t("#toolbar-copy").hide(),t("#select-change").addClass("hidden"),t("#remove-assoc").addClass("hidden"),e.setAttribute("data-action",""),e.setAttribute("data-id","0"),e.setAttribute("data-language",""),e.src="")}),t("#reference-association").on("load",function(){var e=Joomla.getOptions("targetSrc",!1);if(e)return e=e.split("&").join("&"),document.getElementById("target-association").setAttribute("src",e),void Joomla.loadOptions({targetSrc:!1});if(document.getElementById("target-association").setAttribute("src",document.getElementById("target-association").getAttribute("src")),t(this).contents().find("#jform_id").val()!==this.getAttribute("data-id")){var a=document.getElementById("target-association");a.src=a.getAttribute("data-editurl")+"&task="+a.getAttribute("data-item")+".edit&id="+t(this).contents().find("#jform_id").val(),this.src=this.getAttribute("data-editurl")+"&task="+this.getAttribute("data-item")+".edit&id="+this.getAttribute("data-id")}var i=t(this).contents();i.find("#jform_language_chzn").remove(),i.find("#jform_language").attr("disabled",!0).chosen(),i.find("#associations").find(".btn").remove();var o="";t("#jform_itemlanguage option").each(function(){void 0!==(o=t(this).val().split(":"))[0]&&(langAssociation=o[0].replace(/-/,"_"),""==i.find("#jform_associations_"+langAssociation+"_id").val()&&i.find("#jform_associations_"+langAssociation+"_name").val(document.getElementById("reference-association").getAttribute("data-no-assoc")))}),Joomla.loadingLayer("hide")}),t("#target-association").on("load",function(){if(""!=this.getAttribute("src")){t("#toolbar-target").show(),t("#toolbar-copy").show(),t("#select-change").removeClass("hidden");var e=this.getAttribute("data-language"),a=this.getAttribute("data-id"),i=t(this).contents().find("#jform_id").val()||"0";if(t(this).contents().find('a[href="#associations"]').parent().find(".btn").remove(),t(this).contents().find("#associations").find(".btn").remove(),t(this).contents().find("#associations").hasClass("active")&&(t(this).contents().find('a[href="#associations"]').parent().removeClass("active"),t(this).contents().find("#associations").removeClass("active"),t(this).contents().find(".nav-tabs").find("li").first().addClass("active"),t(this).contents().find(".tab-content").find(".tab-pane").first().addClass("active")),t(this).contents().find("#jform_language_chzn").remove(),t(this).contents().find("#jform_language").val(e).change().attr("disabled",!0).chosen(),"0"==i)document.getElementById("select-change-text").innerHTML=document.getElementById("select-change").getAttribute("data-select");else{document.getElementById("select-change-text").innerHTML=document.getElementById("select-change").getAttribute("data-change"),t("#remove-assoc").removeClass("hidden"),t("#toolbar-copy").hide();var o=document.getElementById("target-id").value,n=""==o?i:o+","+i;document.getElementById("target-id").value=n,i!=a&&(t('#jform_itemlanguage option[value^="'+e+":"+a+':add"]').val(e+":"+i+":edit"),this.setAttribute("data-id",i),this.setAttribute("data-action","edit"));var s=document.getElementById("reference-association"),d=e.replace(/-/,"_"),r=s.getAttribute("data-title"),c=t(this).contents().find("#jform_"+r).val();t(s).contents().find("#jform_associations_"+d+"_id").val(i),t(s).contents().find("#jform_associations_"+d+"_name").val(c),t(s).contents().find("#jform_associations_"+d+"_chzn").remove(),t(s).contents().find("#jform_associations_"+d).append('<option value="'+i+'">'+c+"</option>"),t(s).contents().find("#jform_associations_"+d).val(i).change().chosen()}var l,m=(s=document.getElementById("reference-association")).getAttribute("data-id"),g=(d=s.getAttribute("data-language").replace(/-/,"_"),(l=document.getElementById("target-association")).getAttribute("data-title"));c=t(this).contents().find("#jform_"+g).val();(l=t(this).contents()).find("#jform_associations_"+d+"_id").val(m),l.find("#jform_associations_"+d+"_name").val(c),l.find("#jform_associations_"+d+"_chzn").remove();var f,u,_=l.find("#jform_associations_"+d);_.append('<option value="'+m+'">'+c+"</option>"),_.val(m).change().chosen(),t("#jform_itemlanguage option").each(function(){void 0!==(f=t(this).val().split(":"))[1]&&"0"!==f[1]&&(u=f[0].replace(/-/,"_"),l.find("#jform_associations_"+u+"_id").val(f[1]),l.find("#jform_associations_"+u+"_chzn").remove(),(_=l.find("#jform_associations_"+u)).append('<option value="'+f[1]+'"></option>'),_.val(f[1]).change().chosen())}),Joomla.loadingLayer("hide")}})});