View file File name : admin-popup-editor.min.js Content :var cookies;!function(n){"use strict";window.PUM_Admin=window.PUM_Admin||{},window.pum_popup_settings_editor=window.pum_popup_settings_editor||{form_args:{},current_values:{},preview_nonce:null},n(document).on("keydown","#popup-title",function(e){9===(e.keyCode||e.which)&&(e.preventDefault(),n("#title").focus())}).on("keydown","#title, #popup-title",function(e){var t=e.keyCode||e.which;e.shiftKey||9!==t||(e.preventDefault(),e="title"===n(this).attr("id")?"#popup-title":"#insert-media-button",n(e).focus())}).on("keydown","#popup-title, #insert-media-button",function(e){var t=e.keyCode||e.which;e.shiftKey&&9===t&&(e.preventDefault(),e="popup-title"===n(this).attr("id")?"#title":"#popup-title",n(e).focus())}),n(function(){n(this).trigger("pum_init"),n("#title").prop("required",!0);var e=n("#pum-popup-settings-container"),t=pum_popup_settings_editor.form_args||{},i=pum_popup_settings_editor.current_values||{};e.length&&(e.find(".pum-no-js").hide(),PUM_Admin.forms.render(t,i,e)),n("a.page-title-action").clone().attr("target","_blank").attr("href",pum_admin_vars.homeurl+"?popup_preview="+pum_popup_settings_editor.preview_nonce+"&popup="+n("#post_ID").val()).text(pum_admin_vars.I10n.preview_popup).insertAfter("a.page-title-action"),n("#pum-first-condition, #pum-first-trigger, #pum-first-cookie").val(null).trigger("change"),document.querySelector("#pum-popup-settings-container").addEventListener("change",function(e){"open_sound"!==e.target.id||-1===["none","custom"].indexOf(e.target.value)&&((e=new Audio(pum_admin_vars.pm_dir_url+"assets/sounds/"+e.target.value)).addEventListener("canplaythrough",function(){this.play().catch(function(e){console.warn("Sound was not able to play when selected. Reason: "+e)})}),e.addEventListener("error",function(){console.warn("Error occurred when trying to load popup opening sound.")}))}),n(document).on("pum_init",function(){n("#pum-default-click-trigger-class:not(.pum-click-trigger-initialized)").each(function(){n(this).addClass("pum-click-trigger-initialized").text(n("#popup-id").data("popup-id"))})}),document.querySelector("#pum-popup-settings-container").addEventListener("click",function(e){if(Array.from(e.target.classList).includes("popup-type")||Array.from(e.target.parentElement.classList).includes("popup-type")){var t=jQuery("#pum-popup-settings-container");if(1===t.length){var i={"center-popup":{size:"medium",responsive_min_width:"0%",responsive_max_width:"100%",animation_type:"fade",animation_speed:350,location:"center",position_fixed:!1,position_from_trigger:!1,overlay_disabled:!1,stackable:!1,disable_reposition:!1},"left-bottom-notice":{size:"tiny",responsive_min_width:"0%",responsive_max_width:"100%",animation_type:"fade",animation_speed:350,animation_origin:"left bottom",location:"left bottom",position_bottom:10,position_left:10,position_from_trigger:!1,position_fixed:!0,overlay_disabled:!0,stackable:!0,disable_reposition:!1},"top-bar":{size:"custom",custom_width:"100%",custom_height_auto:!0,animation_type:"fadeAndSlide",animation_speed:300,animation_origin:"top",location:"center top",position_top:0,position_from_trigger:!1,position_fixed:!0,overlay_disabled:!0,stackable:!0,disable_reposition:!1},"right-bottom-slidein":{size:"custom",custom_width:"300px",custom_height_auto:!0,animation_type:"slide",animation_speed:350,animation_origin:"bottom",location:"right bottom",position_bottom:10,position_right:10,position_from_trigger:!1,position_fixed:!0,overlay_disabled:!0,stackable:!0,disable_reposition:!1}},n=e.target.dataset.popupType||e.target.parentElement.dataset.popupType||"",o=i.hasOwnProperty(n)?i[n]:{},e=pum_popup_settings_editor.form_args||{},i=pum_popup_settings_editor.current_values||{},r=t.pumSerializeObject();if(r.popup_settings.triggers)for(var s=0;s<r.popup_settings.triggers.length;s++)r.popup_settings.triggers[s].settings=JSON.parse(r.popup_settings.triggers[s].settings);if(r.popup_settings.cookies)for(var d=0;d<r.popup_settings.cookies.length;d++)r.popup_settings.cookies[d].settings=JSON.parse(r.popup_settings.cookies[d].settings);o=Object.assign({},i,r.popup_settings,o);PUM_Admin.forms.render(e,o,t),document.querySelector('a[href="#pum-popup-settings_display"]').click();t=document.createElement("div");t.classList.add("notice","updated"),t.insertBefore(document.createElement("p"),t.firstChild),t.firstChild.innerText="Display settings have been updated with the "+n+" preset";n=document.querySelector("#pum-popup-settings-display-subtabs_preset");n.insertBefore(t,n.firstChild)}}})})}(jQuery),function(t,e){"use strict";t(e).on("click","#popup_reset_open_count",function(){var e=t(this);e.is(":checked")&&!confirm(pum_admin_vars.I10n.confirm_count_reset)&&e.prop("checked",!1)})}(jQuery,document),function(s){"use strict";var d={get_conditions:function(){return window.pum_popup_settings_editor.conditions_selectlist},not_operand_checkbox:function(e){return(e=e||s(".pum-not-operand")).each(function(){var e=s(this),t=e.find("input");t.prop("checked",!t.is(":checked")),d.toggle_not_operand(e)})},toggle_not_operand:function(e){return(e=e||s(".pum-not-operand")).each(function(){var e=s(this),t=e.find("input"),e=e.parents(".facet-target");t.is(":checked")?e.addClass("not-operand-checked"):e.removeClass("not-operand-checked")})},template:{editor:function(e){e=s.extend(!0,{},{groups:[]},e);return e.groups=PUM_Admin.utils.object_to_array(e.groups),PUM_Admin.templates.render("pum-condition-editor",e)},group:function(e){var t,i=s.extend(!0,{},{index:"",facets:[]},e);for(i.facets=PUM_Admin.utils.object_to_array(i.facets),t=0;i.facets.length>t;t++)i.facets[t].index=t,i.facets[t].group=i.index;return PUM_Admin.templates.render("pum-condition-group",i)},facet:function(e){e=s.extend(!0,{},{group:"",index:"",target:"",not_operand:!1,settings:{}},e);return PUM_Admin.templates.render("pum-condition-facet",e)},settings:function(e,i){var n=[],o=s.extend(!0,{},{index:"",group:"",target:null,fields:[]},e);return o.fields.length||void 0===pum_popup_settings_editor.conditions[e.target]||(o.fields=pum_popup_settings_editor.conditions[e.target].fields),void 0===i&&(i={}),_.each(o.fields,function(e,t){"object"!=typeof(e=PUM_Admin.models.field(e)).meta&&(e.meta={}),void 0!==i[t]&&(e.value=i[t]),e.name="popup_settings[conditions]["+o.group+"]["+o.index+"][settings]["+t+"]",""===e.id&&(e.id="popup_settings_conditions_"+o.group+"_"+o.index+"_settings_"+t),n.push(PUM_Admin.templates.field(e))}),PUM_Admin.templates.section({fields:n})},selectbox:function(e){e=s.extend(!0,{},{id:null,name:null,type:"select",group:"",index:"",value:null,select2:!0,classes:[],options:d.get_conditions()},e);return null===e.id&&(e.id="popup_settings_conditions_"+e.group+"_"+e.index+"_target"),null===e.name&&(e.name="popup_settings[conditions]["+e.group+"]["+e.index+"][target]"),PUM_Admin.templates.field(e)}},groups:{add:function(e,t,i){e=s(e),i={index:e.find(".facet-group-wrap").length,facets:[{target:t||null,not_operand:i||!1,settings:{}}]};e.find(".facet-groups").append(d.template.group(i)),e.addClass("has-conditions")},remove:function(e){var t=e.parents(".facet-builder");e.prev(".facet-group-wrap").find(".and .add-facet").removeClass("disabled"),e.remove(),d.renumber(),0===t.find(".facet-group-wrap").length&&(t.removeClass("has-conditions"),s("#pum-first-condition").val(null).trigger("change"))}},facets:{add:function(e,t,i){i={group:e.data("index"),index:e.find(".facet").length,target:t||null,not_operand:i||!1,settings:{}};e.find(".facet-list").append(d.template.facet(i))},remove:function(e){var t=e.parents(".facet-group-wrap");e.remove(),0===t.find(".facet").length?d.groups.remove(t):d.renumber()}},renumber:function(){s(".facet-builder .facet-group-wrap").each(function(){var e=s(this),i=e.parent().children().index(e);e.data("index",i).find(".facet").each(function(){var e=s(this),t=e.parent().children().index(e);e.data("index",t).find("[name]").each(function(){this.name=this.name.replace(/popup_settings\[conditions\]\[\d*?\]\[\d*?\]/,"popup_settings[conditions]["+i+"]["+t+"]"),this.id=this.id.replace(/popup_settings_conditions_\d*?_\d*?_/,"popup_settings_conditions_"+i+"_"+t+"_")})})})}};window.PUM_Admin=window.PUM_Admin||{},window.PUM_Admin.conditions=d,s(document).on("pum_init",function(){d.renumber(),d.toggle_not_operand()}).on("select2:select pumselect2:select","#pum-first-condition",function(e){var t=s(this),i=t.parents(".facet-builder").eq(0),n=t.val(),o=i.find("#pum-first-facet-operand"),r=o.is(":checked");d.groups.add(i,n,r),t.val(null).trigger("change"),o.prop("checked",!1).parents(".facet-target").removeClass("not-operand-checked"),s(document).trigger("pum_init")}).on("click",".facet-builder .pum-not-operand",function(){d.not_operand_checkbox(s(this))}).on("change",".facet-builder .facet-target select",function(e){var t=s(this),i=t.parents(".facet"),n=t.val(),t={target:n};""!==n&&n!==i.data("target")&&(i.data("target",n).find(".facet-settings").html(d.template.settings(t)),s(document).trigger("pum_init"))}).on("click",".facet-builder .facet-group-wrap:last-child .and .add-facet",function(){d.groups.add(s(this).parents(".facet-builder").eq(0)),s(document).trigger("pum_init")}).on("click",".facet-builder .add-or .add-facet:not(.disabled)",function(){d.facets.add(s(this).parents(".facet-group-wrap").eq(0)),s(document).trigger("pum_init")}).on("click",".facet-builder .remove-facet",function(){d.facets.remove(s(this).parents(".facet").eq(0)),s(document).trigger("pum_init")})}(jQuery),function(s,e){"use strict";var n,d=pum_admin_vars.I10n,p={get_cookies:function(){return window.pum_popup_settings_editor.cookies},get_cookie:function(e){var t=this.get_cookies(),e="undefined"!==t[e]&&t[e];return!!e&&(e&&"object"==typeof e&&"object"==typeof e.fields&&Object.keys(e.fields).length?this.parseFields(e):e)},getCookieDefaults:function(e){var t,i=p.get_cookie(e),n={};for(t in i.fields)if(i.fields.hasOwnProperty(t))for(var o in i.fields[t])i.fields[t].hasOwnProperty(o)&&(n[o]=i.fields[t][o].std);return n.name="pum-"+s("#post_ID").val(),n},parseFields:function(n){return _.each(n.fields,function(e,i){_.each(e,function(e,t){n.fields[i][t].name="cookie_settings["+t+"]",""===n.fields[i][t].id&&(n.fields[i][t].id="cookie_settings_"+t)})}),n},parseValues:function(e,t){return e},select_list:function(){for(var e=PUM_Admin.utils.object_to_array(p.get_cookies()),t={},i=0;i<e.length;i++)t[e[i].id]=e[i].name;return t},getLabel:function(e){e=p.get_cookie(e);return!!e&&e.name},getSettingsDesc:function(e,t){e=p.get_cookie(e);return!!e&&PUM_Admin.templates.renderInline(e.settings_column,t)},refreshDescriptions:function(){s(".pum-popup-cookie-editor table.list-table tbody tr").each(function(){var e=s(this),t=e.find(".popup_cookies_field_event").val(),i=JSON.parse(e.find(".popup_cookies_field_settings:first").val());e.find("td.settings-column").html(p.getSettingsDesc(t,i))})},insertCookie:function(e,t){var i=p.getCookieDefaults(t.event);t=s.extend(!0,{},{event:"on_popup_close",settings:i},t),p.rows.add(e,t)},template:{form:function(e,t,i){var n=p.get_cookie(e),o="pum_cookie_settings",r=Object.keys(n.fields)[0];(t=t||{}).event=e,t.index=0<=t.index?t.index:null,n.fields[r]=s.extend(!0,n.fields[r],{index:{type:"hidden",name:"index"},event:{type:"hidden",name:"event"}}),"string"==typeof t.key&&""!==t.key||delete n.fields.advanced.key,PUM_Admin.modals.reload("#"+o,PUM_Admin.templates.modal({id:o,title:n.modal_title||n.name,classes:"tabbed-content",save_button:null!==t.index?d.update:d.add,content:PUM_Admin.forms.render({id:"pum_cookie_settings_form",tabs:n.tabs||{},fields:n.fields||{}},t||{})})),s("#"+o+" form").on("submit",i||function(e){e.preventDefault(),PUM_Admin.modals.closeAll()})},editor:function(e){e=s.extend(!0,{},{cookies:[],name:""},e);return e.cookies=PUM_Admin.utils.object_to_array(e.cookies),PUM_Admin.templates.render("pum-cookie-editor",e)},row:function(e){e=s.extend(!0,{},{index:"",event:"",name:"",settings:{name:"",key:"",session:null,path:null,time:"30 days"}},e);return PUM_Admin.templates.render("pum-cookie-row",e)},selectbox:function(e){e=s.extend(!0,{},{id:null,name:null,type:"select",group:"",index:"",value:null,select2:!0,classes:[],options:p.select_list()},e);return null===e.id&&(e.id="popup_settings_cookies_"+e.index+"_event"),null===e.name&&(e.name="popup_settings[cookies]["+e.index+"][event]"),PUM_Admin.templates.field(e)}},rows:{add:function(e,t){var i=s(e),e={index:null!==t.index&&0<=t.index?t.index:i.find("table.list-table tbody tr").length,event:t.event,name:i.data("field_name"),settings:t.settings||{}},t=i.find("tbody tr").eq(e.index),e=PUM_Admin.templates.render("pum-cookie-row",e);t.length?t.replaceWith(e):i.find("tbody").append(e),i.addClass("has-list-items"),p.rows.renumber(),p.refreshDescriptions()},remove:function(e){var t=e.parents(".pum-popup-cookie-editor");e.remove(),p.rows.renumber(),0===t.find("table.list-table tbody tr").length&&(t.removeClass("has-list-items"),s("#pum-first-cookie").val(null).trigger("change"))},renumber:function(){s(".pum-popup-cookie-editor table.list-table tbody tr").each(function(){var e=s(this),t=e.parent().children().index(e);e.attr("data-index",t).data("index",t),e.find(":input, [name]").each(function(){this.name&&""!==this.name&&(this.name=this.name.replace(/\[\d*?\]/,"["+t+"]"))})})}}};window.PUM_Admin=window.PUM_Admin||{},window.PUM_Admin.cookies=p,s(e).on("pum_init",function(){p.refreshDescriptions()}).on("select2:select pumselect2:select","#pum-first-cookie",function(){var e=s(this),o=e.parents(".pum-popup-cookie-editor"),t=e.val(),i={indes:o.find("table.list-table tbody tr").length,name:"pum-"+s("#post_ID").val()};e.val(null).trigger("change"),p.template.form(t,i,function(e){var t=s(this),i=t.find("input#event").val(),n=t.find("input#index").val(),t=t.pumSerializeObject();e.preventDefault(),(!n||n<0)&&(n=o.find("tbody tr").length),p.rows.add(o,{index:n,event:i,settings:t.cookie_settings}),PUM_Admin.modals.closeAll()})}).on("click",".pum-popup-cookie-editor .pum-add-new",function(){n=s(this).parents(".pum-popup-cookie-editor");var e=wp.template("pum-cookie-add-event");PUM_Admin.modals.reload("#pum_cookie_add_event_modal",e({I10n:d}))}).on("click",".pum-popup-cookie-editor .edit",function(e){var t=s(this),o=t.parents(".pum-popup-cookie-editor"),i=t.parents("tr:first"),t=i.find(".popup_cookies_field_event").val(),i=_.extend({},JSON.parse(i.find(".popup_cookies_field_settings:first").val()),{index:i.parent().children().index(i),event:t});e.preventDefault(),p.template.form(t,i,function(e){var t=s(this),i=t.find("input#event").val(),n=t.find("input#index").val(),t=t.pumSerializeObject();e.preventDefault(),(!1===n||n<0)&&(n=o.find("tbody tr").length),p.rows.add(o,{index:n,event:i,settings:t.cookie_settings}),PUM_Admin.modals.closeAll()})}).on("click",".pum-popup-cookie-editor .remove",function(e){var t=s(this).parents("tr:first");e.preventDefault(),window.confirm(d.confirm_delete_cookie)&&p.rows.remove(t)}).on("click",".pum-field-cookie_key button.reset",function(e){var t=s(this),i=(new Date).getTime().toString(16);t.siblings('input[type="text"]:first').val(i)}).on("submit","#pum_cookie_add_event_modal .pum-form",function(e){var o=n,t=s("#popup_cookie_add_event").val(),i={index:o.find("table.list-table tbody tr").length,name:"pum-"+s("#post_ID").val(),path:"1"};e.preventDefault(),p.template.form(t,i,function(e){var t=s(this),i=t.find("input#event").val(),n=t.find("input#index").val(),t=t.pumSerializeObject();e.preventDefault(),(!1===n||n<0)&&(n=o.find("tbody tr").length),p.rows.add(o,{index:n,event:i,settings:t.cookie_settings}),PUM_Admin.modals.closeAll(),void 0!==PUM_Admin.triggers&&!1!==PUM_Admin.triggers.new_cookie&&0<=PUM_Admin.triggers.new_cookie&&(n=PUM_Admin.triggers.current_editor.find("tbody tr").eq(PUM_Admin.triggers.new_cookie).find(".popup_triggers_field_settings:first"),"string"==typeof(i=JSON.parse(n.val())).cookie_name?i.cookie_name=i.cookie_name.replace("add_new",t.cookie_settings.name):(i.cookie_name[i.cookie_name.indexOf("add_new")]=t.cookie_settings.name,i.cookie_name=i.cookie_name.filter(function(e,t,i){return!(e in this)&&(this[e]=!0)},{})),n.val(JSON.stringify(i)),PUM_Admin.triggers.new_cookie=!1,PUM_Admin.triggers.refreshDescriptions())})})}(jQuery,document),function(d,e,p){"use strict";var a=pum_admin_vars.I10n,c={current_editor:null,new_cookie:!1,get_triggers:function(){return window.pum_popup_settings_editor.triggers},get_trigger:function(e){var t=this.get_triggers(),e="undefined"!==t[e]&&t[e];return!!e&&(e&&"object"==typeof e&&"object"==typeof e.fields&&Object.keys(e.fields).length?this.parseFields(e):e)},parseFields:function(n){return _.each(n.fields,function(e,i){_.each(e,function(e,t){n.fields[i][t].name="trigger_settings["+t+"]",""===n.fields[i][t].id&&(n.fields[i][t].id="trigger_settings_"+t)})}),n},parseValues:function(e,t){for(var i in e)e.hasOwnProperty(i)&&e.hasOwnProperty(i+"_unit")&&(e[i]+=e[i+"_unit"],delete e[i+"_unit"]);return e},select_list:function(){for(var e=PUM_Admin.utils.object_to_array(c.get_triggers()),t={},i=0;i<e.length;i++)t[e[i].id]=e[i].name;return t},rows:{add:function(e,t){var i=d(e),e={index:null!==t.index&&0<=t.index?t.index:i.find("table.list-table tbody tr").length,type:t.type,name:i.data("field_name"),settings:t.settings||{}},t=i.find("tbody tr").eq(e.index),e=PUM_Admin.templates.render("pum-trigger-row",e);t.length?t.replaceWith(e):i.find("tbody").append(e),i.addClass("has-list-items"),c.renumber(),c.refreshDescriptions()},remove:function(e){var t=e.parents(".pum-popup-trigger-editor");e.remove(),c.renumber(),0===t.find("table.list-table tbody tr").length&&(t.removeClass("has-list-items"),d("#pum-first-trigger").val(null).trigger("change"))}},template:{form:function(e,t,i){var n=c.get_trigger(e),o="pum_trigger_settings",r=Object.keys(n.fields)[0],s=d(".pum-field-cookies .list-table tbody tr");(t=t||{}).type=e,t.index=0<=t.index?t.index:null,n.fields[r]=d.extend(!0,n.fields[r],{index:{type:"hidden",name:"index"},type:{type:"hidden",name:"type"}}),s.each(function(){var e=JSON.parse(d(this).find(".popup_cookies_field_settings:first").val());void 0===n.fields[r].cookie_name.options[e.name]&&(n.fields[r].cookie_name.options[e.name]=e.name)}),PUM_Admin.modals.reload("#"+o,PUM_Admin.templates.modal({id:o,title:n.modal_title||n.name,classes:"tabbed-content",save_button:null!==t.index?a.update:a.add,content:PUM_Admin.forms.render({id:"pum_trigger_settings_form",tabs:n.tabs||{},fields:n.fields||{}},t||{})})),d("#"+o+" form").on("submit",i||function(e){e.preventDefault(),PUM_Admin.modals.closeAll()})},editor:function(e){e=d.extend(!0,{},{triggers:[],name:""},e);return e.triggers=PUM_Admin.utils.object_to_array(e.triggers),PUM_Admin.templates.render("pum-trigger-editor",e)},row:function(e){e=d.extend(!0,{},{index:"",type:"",name:"",settings:{cookie_name:""}},e);return PUM_Admin.templates.render("pum-trigger-row",e)},selectbox:function(e){e=d.extend(!0,{},{id:null,name:null,type:"select",group:"",index:"",value:null,select2:!0,classes:[],options:c.select_list()},e);return null===e.id&&(e.id="popup_settings_triggers_"+e.index+"_type"),null===e.name&&(e.name="popup_settings[triggers]["+e.index+"][type]"),PUM_Admin.templates.field(e)}},getLabel:function(e){e=c.get_trigger(e);return!!e&&e.name},getSettingsDesc:function(e,t){e=c.get_trigger(e);return!!e&&PUM_Admin.templates.renderInline(e.settings_column,t)},renumber:function(){d(".pum-popup-trigger-editor table.list-table tbody tr").each(function(){var e=d(this),t=e.parent().children().index(e);e.attr("data-index",t).data("index",t),e.find(":input, [name]").each(function(){this.name&&""!==this.name&&(this.name=this.name.replace(/\[\d*?\]/,"["+t+"]"))})})},refreshDescriptions:function(){d(".pum-popup-trigger-editor table.list-table tbody tr").each(function(){var e=d(this),t=e.find(".popup_triggers_field_type").val(),i=JSON.parse(e.find(".popup_triggers_field_settings:first").val()),n=PUM_Admin.triggers.cookie_column_value(i.cookie_name);e.find("td.settings-column").html(PUM_Admin.triggers.getSettingsDesc(t,i)),e.find("td.cookie-column code").text(n)})},cookie_column_value:function(e){var t=a.no_cookie;return e instanceof Array?t=e.join(", "):null!==e&&e!==p&&""!==e&&(t=e),t},append_click_selector_presets:function(){var e,t,i=d("#extra_selectors");i.length&&!i.hasClass("pum-click-selector-presets-initialized")&&(e=PUM_Admin.templates.render("pum-click-selector-presets"),(t=i.parents(".pum-field").find(".pum-click-selector-presets")).length||(i.before(e),i.addClass("pum-click-selector-presets-initialized"),t=i.parents(".pum-field").find(".pum-click-selector-presets")),t.position({my:"right center",at:"right center",of:i}))},toggle_click_selector_presets:function(){d(this).parent().toggleClass("open")},reset_click_selector_presets:function(e){e!==p&&d(e.target).parents(".pum-click-selector-presets").length||d(".pum-click-selector-presets").removeClass("open")},insert_click_selector_preset:function(){var e=d(this),t=d("#extra_selectors"),i=t.val();""!==i&&(i+=", "),t.val(i+e.data("preset")),PUM_Admin.triggers.reset_click_selector_presets()}};window.PUM_Admin=window.PUM_Admin||{},window.PUM_Admin.triggers=c,d(e).on("pum_init",function(){PUM_Admin.triggers.append_click_selector_presets(),PUM_Admin.triggers.refreshDescriptions()}).on("click",".pum-click-selector-presets > span",PUM_Admin.triggers.toggle_click_selector_presets).on("click",".pum-click-selector-presets li",PUM_Admin.triggers.insert_click_selector_preset).on("click",PUM_Admin.triggers.reset_click_selector_presets).on("select2:select pumselect2:select","#pum-first-trigger",function(){var e=d(this),r=e.parents(".pum-popup-trigger-editor"),t=e.val(),i={};PUM_Admin.triggers.current_editor=r,"click_open"!==t&&(i.cookie_name="pum-"+d("#post_ID").val()),c.template.form(t,i,function(e){var t=d(this),i=t.find("input#type").val(),n=t.pumSerializeObject(),o=c.parseValues(n.trigger_settings||{}),t=parseInt(n.index);e.preventDefault(),(!1===t||t<0)&&(t=r.find("tbody tr").length),c.rows.add(r,{index:t,type:i,settings:o}),PUM_Admin.modals.closeAll(),o.cookie_name!==p&&null!==o.cookie_name&&("add_new"===o.cookie_name||0<=o.cookie_name.indexOf("add_new"))&&(PUM_Admin.triggers.new_cookie=n.index,d("#pum-popup-settings-container .pum-popup-cookie-editor button.pum-add-new").trigger("click"))}),e.val(null).trigger("change")}).on("click",".pum-popup-trigger-editor .pum-add-new",function(){PUM_Admin.triggers.current_editor=d(this).parents(".pum-popup-trigger-editor");var e=wp.template("pum-trigger-add-type");PUM_Admin.modals.reload("#pum_trigger_add_type_modal",e({I10n:a}))}).on("click",".pum-popup-trigger-editor .edit",function(e){var t=d(this),r=t.parents(".pum-popup-trigger-editor"),i=t.parents("tr:first"),t=i.find(".popup_triggers_field_type").val(),i=_.extend({},JSON.parse(i.find(".popup_triggers_field_settings:first").val()),{index:i.parent().children().index(i),type:t});e.preventDefault(),c.template.form(t,i,function(e){var t=d(this),i=t.find("input#type").val(),n=t.find("input#index").val(),o=t.pumSerializeObject(),t=c.parseValues(o.trigger_settings||{});PUM_Admin.triggers.current_editor=r,e.preventDefault(),(!1===n||n<0)&&(n=r.find("tbody tr").length),c.rows.add(r,{index:n,type:i,settings:t}),PUM_Admin.modals.closeAll(),t.cookie_name!==p&&null!==t.cookie_name&&("add_new"===t.cookie_name||0<=t.cookie_name.indexOf("add_new"))&&(PUM_Admin.triggers.new_cookie=o.index,d("#pum-popup-settings-container .pum-popup-cookie-editor button.pum-add-new").trigger("click"))})}).on("click",".pum-popup-trigger-editor .remove",function(e){var t=d(this),i=t.parents(".pum-popup-trigger-editor"),t=t.parents("tr:first");PUM_Admin.triggers.current_editor=i,e.preventDefault(),window.confirm(a.confirm_delete_trigger)&&c.rows.remove(t)}).on("submit","#pum_trigger_add_type_modal .pum-form",function(e){var r=PUM_Admin.triggers.current_editor,t=r.parents("#pum-popup-settings-triggers-subtabs_main").find(".pum-field-cookies .pum-popup-cookie-editor"),i=d("#popup_trigger_add_type").val(),n=d("#popup_trigger_add_cookie").is(":checked"),o=d("#popup_trigger_add_cookie_event").val(),s={};e.preventDefault(),n&&(s.cookie_name="pum-"+d("#post_ID").val(),PUM_Admin.cookies.insertCookie(t,{event:o,settings:{time:"1 month",path:"1",name:s.cookie_name}})),c.template.form(i,s,function(e){var t=d(this),i=t.find("input#type").val(),n=t.pumSerializeObject(),o=c.parseValues(n.trigger_settings||{}),t=parseInt(n.index);PUM_Admin.triggers.current_editor=r,e.preventDefault(),(!t||t<0)&&(t=r.find("tbody tr").length),c.rows.add(r,{index:t,type:i,settings:o}),PUM_Admin.modals.closeAll(),o.cookie_name!==p&&null!==o.cookie_name&&("add_new"===o.cookie_name||0<=o.cookie_name.indexOf("add_new"))&&(PUM_Admin.triggers.new_cookie=n.index,d("#pum-popup-settings-container .pum-popup-cookie-editor button.pum-add-new").trigger("click"))})})}(jQuery,document);