0byt3m1n1
Path:
/
home1
/
aserty
/
public_html
/
bonniescraftygifts.com
/
iFzj4
/
configCHM
/
Jump
/
0-aserty
/
natureultra.com
/
wp-content
/
plugins
/
thrive-visual-editor
/
editor
/
js
/
util
/
[
Home
]
File: events.min.js
/*! Thrive Content Builder - 2015-04-15 * http://www.thrivethemes.com/ * Copyright (c) 2015 Thrive Themes */ var TVE_Content_Builder=TVE_Content_Builder||{};!function(a){var b={start:"__TCB_EVENT_",end:"_TNEVE_BCT__"},c=function(b,c,e,f){TVE_Editor_Page.overlay();var g={};a.each(c,function(a,b){g[a]=b}),g.action="tve_event_manager",g.security=tve_path_params.tve_ajax_nonce,g.route=b,g.post_id=tve_path_params.post_id,g.scope=d.current_scope,tve_path_params.custom_post_data&&jQuery.each(tve_path_params.custom_post_data,function(a,b){g[a]=b}),jQuery.post(tve_path_params.ajax_url,g,function(f){"function"!=typeof e?d.lightbox(f):e.call(d,f),TVE_Editor_Page.overlay("close"),a(d).trigger("tve-event-ajax-response",b,c)})},d={current_scope:"",$element:null,config:[],init_done:!1,$lf:null,$lo:null,current_event:null,init:function(){return this.init_done?this:(this.init_done=!0,this.$lo=a("#tve_lightbox_overlay"),this.$lf=a("#tve_lightbox_frame").on("click",".tve_event_onclick",function(){var b=a(this),c=b.attr("data-action");d[c](b)}).on("change",".tve_event_onchange",function(){var b=a(this),c=b.attr("data-action");d[c](b)}).on("click",".tve_custom_event_action",function(){d.custom_action(a(this).attr("data-action"))}),this)},locate_element:function(a){this.$element=a.hasClass("thrv_button_shortcode")?a.find(".tve_btnLink"):a.hasClass("thrv_calltoaction_shortcode")?a.find(".tve_btnLink"):a.is(text_elements)?a.find("a.tve_active_hyperlink"):a.hasClass("thrv_icon")?a.find(".tve_sc_icon"):a},open:function(a,b){return"undefined"==typeof b&&(b=""),this.current_scope=b,this.init(),"page"==b?(this.read_page_events(),void this.list()):(this.locate_element(a),this.config_read(),void this.list())},close:function(){this.$lf.fadeOut(),this.$lo.fadeOut()},add:function(){c("form",{}),this.current_event=null},edit:function(a){this.current_event=a.attr("data-index");var b=this.config[this.current_event];b.edit_page=1,c("form",b)},remove:function(a){this.config.splice(parseInt(a.attr("data-index")),1),this.config_write(),this.list()},save:function(){if(TVE_Content_Builder.validator.isValid(this.$lf)){for(var a,b=this.get_event_settings(),c=0;a=this.config[c++];)if(a.t==b.t&&a.a==b.a&&c-1!=this.current_event)return void alert("An Event is already registered for this Trigger and Action. Please choose a different configuration.");this.current_event?this.config[this.current_event]=b:this.config.push(b),this.config_write(),this.list()}},list:function(){var b=this;c("list",{events:this.config},function(c){b.lightbox(c);var d=a("#tve_event_list_errors");if(d.length){d=d.val().split(",");for(var e,f=0;e=d[f++];)b.config[parseInt(e)]=null;var g=b.config;b.config=[],a.each(g,function(a,c){null!==c&&b.config.push(c)}),b.config_write()}}),this.current_event=null},get_event_settings:function(){return{t:this.$lf.find("#tve_event_trigger").val(),a:this.$lf.find("#tve_event_action").val(),config:this.$lf.find("#tve_event_settings").find("input,select,textarea").serializeObject()}},action_settings:function(b){var e=this.$lf.find("#tve_event_save"),f=a("#tve_event_action").val(),g=a("#tve_event_trigger").val();c("settings",this.get_event_settings(),function(a){d.$lf.find("#tve_event_settings").html(a),f&&g&&e.show(),(!f||!g)&&e.hide()})},custom_action:function(b){switch(b){case"add_lightbox":var e=this.$lf.find("#tve_event_save"),f=a("#tve_event_action").val();c("add_lightbox",this.get_event_settings(),function(a){d.$lf.find("#tve_event_settings").html(a),f&&e.show(),!f&&e.hide()},!0)}},lightbox:function(a){return this.$lf.find("#tve_lightbox_content").html(a),this.$lf.add(this.$lo).removeClass("tve_link_lightbox").fadeIn(),this.$lf.find("#tve_lightbox_buttons").hide(),this},config_read:function(){this.config=this.$element.attr("data-tcb-events"),this.config=this.config?JSON.parse(this.config.replace(b.start,"").replace(b.end,"")):[],a(this).trigger("tve-event-read",[this.config,this.$element])},read_page_events:function(){this.config=tve_path_params.page_events?tve_path_params.page_events:[],a(this).trigger("tve-page-event-read",[this.config])},config_write:function(){return"page"==this.current_scope?(tve_path_params.page_events=this.config,a(this).trigger("tve-page-event-write",[this.config]),this):(this.config.length?this.$element.addClass("tve_evt_manager_listen"):this.$element.removeClass("tve_evt_manager_listen"),a(this).trigger("tve-event-write",[this.config,this.$element]),this.$element.attr("data-tcb-events",b.start+JSON.stringify(this.config)+b.end),this)}};TVE_Content_Builder.event_manager=d,a(TVE_Content_Builder.event_manager).bind("tve-event-write",function(b,c,d){var e=d,f=d.closest(".thrv_wrapper").length?d.closest(".thrv_wrapper"):d,g=function(b,c){var d=c.split(" "),e=[];return a.each(d,function(a,b){(0===b.indexOf("tve_et_")||0===b.indexOf("tve_ea_")||0===b.indexOf("tve_anim"))&&e.push(b)}),e.join(" ")};e.removeClass(g),f.removeClass(g);for(var h,i=0;h=c[i++];)e.addClass("tve_et_"+h.t),f.addClass("tve_ea_"+h.a),"thrive_animation"==h.a&&f.addClass("tve_anim_"+h.config.anim)})}(jQuery);