File Editor
Directories:
.. (Back)
Files:
admin.min.js
campaign-selector.min.js
campaign-selector.min.js.LICENSE.txt
editor.min.js
elementor.min.js
global.min.js
helper.min.js
metabox.min.js
om-format.min.js
om-settings.min.js
plugininstall.min.js
wc-marketing.min.js
Create New File
Create
Edit File: editor.min.js
!function(){"use strict";const n=n=>OMAPI.monsterlink+n+"/";window.OMAPI_Editor=window.OMAPI_Editor||{},function(t,e,o,i,l){t.OMAPI=t.OMAPI||{},OMAPI.monsterlink=i.monsterlink,i.getActiveEditorId=function(){let{wpActiveEditor:n,tinymce:e}=t;return wp.media.editor.activeEditor&&(n=wp.media.editor.activeEditor),!n&&e&&e.activeEditor&&(n=e.activeEditor.id),n},i.getActiveEditor=function(){const n=i.getActiveEditorId();return n&&t.tinymce?t.tinymce.get(n):null},i.mceLinkifyText=function(){const t=i.$select.val();t&&i.getActiveEditor().execCommand("mceInsertLink",!1,{href:n(t),target:"_blank",rel:"noopener noreferrer"})},i.modalOpenLink=function(){i.$toToggle.addClass("optin-monster-modal-monsterlink").removeClass("optin-monster-modal-inline"),i.$body.addClass("modal-open om-modal-open-monsterlink"),i.$modalWrap.show(),i.updateLinkSelectOptions(i.$select),o(".wp-link-input").parent().find(".dashicons-admin-generic").parent().click(),o(e).trigger("om-modal-open-monsterlink")},i.modalOpenInline=function(){i.$toToggle.addClass("optin-monster-modal-inline").removeClass("optin-monster-modal-monsterlink").show(),i.$body.addClass("modal-open om-modal-open-inline"),i.updateInlineSelectOptions(),o(e).trigger("om-modal-open-inline")},i.modalClose=function(){["$select","$linkSelect","$inlineSelect"].forEach((n=>{i[n]&&i[n].length&&i[n].val("")})),i.$toToggle.hide();const n=i.$body.hasClass("om-modal-open-monsterlink")?"monsterlink":"inline";i.$body.removeClass("modal-open om-modal-open-monsterlink om-modal-open-inline"),o(e).trigger(`om-modal-close-${n}`)},i.insertShortcode=function(){const n=i.$inlineSelect.val();n&&wp.media.editor.insert(`[optin-monster slug="${n}" followrules="true"]`)},i.updateLinkSelectOptions=function(t){const e=o("#wp-link-wrap #link-selector"),i=e.find("#search-panel"),l=i.offset().top+i.outerHeight()-e.offset().top+12;o(".has-text-field #wp-link .query-results").css({top:l});const s=o(".wp-link-input input.ui-autocomplete-input").val();s&&t.find("option").each((function(){const e=o(this).val();e&&s===n(e)&&t.val(e)}))},i.updateInlineSelectOptions=function(){const n=i.getActiveEditorId();if(!n)return;const t=i.getActiveEditor(),l=t&&!t.isHidden()?t.getContent():e.getElementById(n).value;i.$inlineSelect.find("option").each((function(){const n=o(this),t=l.indexOf(`optin-monster slug="${n.val()}"`)>=0;n.attr("disabled",t)}))},i.initLinkButton=function(){o(".wp-link-input").each((function(){const n=o(this).parent();if(!n.find(".optin-monster-insert-monsterlink").length){const t=o('<div class="mce-widget mce-btn mce-last" tabindex="-1" role="button" aria-label="OptinMonster" style="margin-left:-3px;"></div>'),e=o('<button role="presentation" type="button" tabindex="-1" class="optin-monster-insert-monsterlink"></button>');e.append(o(".wp-media-buttons-icon.optin-monster-menu-icon").first().clone()),t.append(e),n.find(".mce-last").removeClass("mce-last"),n.append(t)}}))},i.initAdvancedSettings=function(){const e=o(`\n\t\t\t<p class="howto" id="om-link-campaign-label">${i.i18n.or_monsterlink}</p>\n\t\t\t<div style="margin-bottom: -8px;">\n\t\t\t\t${i.canMonsterlink?'<label><span>Select</span>\n\t\t\t\t\t\t<select name="om-link-class" id="om-link-campaign" aria-describedby="om-link-campaign-label">\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</label>':`<p class="om-monsterlink-upgrade"><span>${i.i18n.upgrade_monsterlink}</span> <a href="${i.upgradeUri.replace("--FEATURE--","monster-link")}" target="_blank" rel="noopener">${i.i18n.upgrade}</a></p>`}\n\t\t\t</div>\n\t\t`);if(e.find("select").html(i.$select.find("option").clone()),e.find(".om-monsterlink-upgrade").length){const n=o("#om-monsterlink-upgrade").clone();e.find(".om-monsterlink-upgrade span").html(n.html())}if(o("#link-options").append(e),i.$linkSelect=o("#om-link-campaign"),void 0!==t.wpLink){const t=wpLink.getAttrs;wpLink.getAttrs=function(){const e=t(),o=n(i.$linkSelect.val());return e.href===o&&(e.target="_blank",e.rel="noopener noreferrer"),e}}},i.initEditorMods=function(n){n&&!n.hasInitiatedOm&&(n.hasInitiatedOm=!0,n.on("ExecCommand",(function(n){"WP_Link"===n.command&&i.initLinkButton()})),i.$linkSelect||i.initAdvancedSettings())},i.setupListeners=function(){o(e).on("click",".optin-monster-insert-campaign-button",(function(n){n.preventDefault(),i.modalOpenInline()})).on("click",".optin-monster-insert-monsterlink",(function(n){n.preventDefault(),i.modalOpenLink()})).on("click","#optin-monster-modal-backdrop, #optin-monster-modal-close, #optin-monster-modal-cancel a",(function(n){n.preventDefault(),i.modalClose()})).on("click","#optin-monster-modal-submit-inline",(function(n){n.preventDefault(),i.insertShortcode(),i.modalClose()})).on("click","#optin-monster-modal-submit",(function(n){n.preventDefault(),i.mceLinkifyText(),i.modalClose()})).on("change","#om-link-campaign",(function(){const t=i.$linkSelect.val();t&&(o("#wp-link-url").val(n(t)),o("#wp-link-target").prop("checked",!0))})).on("wplink-open",(function(n){i.updateLinkSelectOptions(i.$linkSelect)})).on("wplink-close",(function(n){i.modalClose()})).on("om-modal-close-monsterlink",(function(n){if(wpLink){const n=i.getActiveEditor();n&&!n.isHidden()&&wpLink.close()}}))},i.init=function(){i.$body=o(e.body),i.$modalWrap=o("#optin-monster-modal-wrap"),i.$toToggle=o("#optin-monster-modal-backdrop, #optin-monster-modal-wrap"),i.$select=o("#optin-monster-modal-select-campaign"),i.$inlineSelect=o("#optin-monster-modal-select-inline-campaign"),i.$linkSelect=null,i.setupListeners(),i.initEditorMods(i.getActiveEditor()),"undefined"!=typeof tinymce&&tinymce.on("SetupEditor",(function(n){let{editor:t}=n;i.initEditorMods(t)}))},o(i.init)}(window,document,jQuery,window.OMAPI_Editor)}();
Save Changes
Rename File
Rename