window.quix=window.quix||{},quix=_.extend(quix,{id:null,urls:{collections:"index.php?option=com_quix&task=modal",collectionEditor:"index.php?option=com_quix&view=collection&task=collection.edit&layout=edit"},getCollectionUrl:function(){return this.id?this.urls.collectionEditor+"&id="+this.id:this.urls.collections},close:function(){quix.showSpinner(),this.id?jQuery.magnificPopup.close():document.querySelector(".mfp-iframe").contentWindow.location.href=this.urls.collections,this.id=null},expandModal:function(){document.querySelector(".mfp-content").classList.add("qx-editor")},shrinkModal:function(){document.querySelector(".mfp-content").classList.remove("qx-editor")},insertShortCode:function(e){return quixEditorID?(window.parent.Joomla&&window.parent.Joomla.editors&&window.parent.Joomla.editors.instances&&window.parent.Joomla.editors.instances.hasOwnProperty(quixEditorID)?window.parent.Joomla.editors.instances[quixEditorID].replaceSelection(e):window.parent.jInsertEditorText(e,quixEditorID),void document.querySelector(".mfp-close").click()):(console.error("Editor id not found!"),document.querySelector(".mfp-close").click(),!1)},showSpinner:function(){jQuery(".spinner-wrapper").removeClass("hide")},hideSpinner:function(){jQuery(".spinner-wrapper").addClass("hide")}}),jQuery(function(e){setTimeout(function(){e(".quix-icon").parent().addClass("qx-btn")},3e3),setTimeout(function(){"undefined"!=typeof tinymce&&null!==tinymce&&tinymce.editors.length&&(e(".quix-icon").parent().addClass("qx-btn"),e(".quix-icon").parent().parent().removeAttr("id"))},5e3)}),jQuery(document).on("click",".qx-btn",function(e){e.preventDefault(),e.stopPropagation(),void 0!==typeof tinyMCE&&(quix.id=getCurrentShortcodeItemId()),jQuery.magnificPopup.open({items:{src:quix.getCollectionUrl()},iframe:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><div class="spinner-wrapper valign-wrapper" style="position: absolute;">  <div class="spinner valign">    <div class="bounce1"/>    <div class="bounce2"/>    <div class="bounce3"/>  </div></div><iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe></div>'},type:"iframe",callbacks:{open:function(){quix.id&&(quix.hideSpinner(),quix.expandModal())}}})});