laipower/wp-content/plugins/subscribe2/include/s2-ajax.min.js

1 line
1.3 KiB
JavaScript

var s2jQuery=jQuery.noConflict();s2jQuery(document).ready(function(){var t=s2jQuery("<div></div>"),a=s2AjaxScriptStrings.ajaxurl;s2jQuery("a.s2popup").click(function(e){var i={action:"subscribe2_form",data:s2jQuery("a.s2popup").attr("id")};e.preventDefault(),jQuery.post(a,i,function(a){t.html(a)}),t.dialog({modal:!0,zIndex:1e4,minWidth:350,minHeight:300,title:s2AjaxScriptStrings.title}),t.dialog("open")}),s2jQuery(document).on("submit","#s2ajaxform",function(e){var i,n=s2jQuery("#s2ajaxform input[name=email]").val(),r=s2jQuery("#s2ajaxform input[name=ip]").val(),u=s2jQuery("#s2ajaxform input[name=firstname]").val(),s=s2jQuery("#s2ajaxform input[name=lastname]").val(),o=s2jQuery("#s2ajaxform input[name=uri]").val(),m=s2jQuery(this).find("input[type=submit][clicked=true]");e.preventDefault(),void 0===u&&(u=""),void 0===s&&(s=""),void 0===o&&(o="http://"),m.length&&s2jQuery("#s2ajaxform").has(m)&&(i={action:"subscribe2_submit",nonce:s2AjaxScriptStrings.nonce,data:{email:n,ip:r,firstname:u,lastname:s,uri:o,button:m.attr("name")}},jQuery.post(a,i,function(a){t.html(a)}))}),s2jQuery(document).on("click","#s2ajaxform input[type=submit]",function(){s2jQuery("#s2ajaxform input[type=submit]").removeAttr("clicked"),s2jQuery(this).attr("clicked","true")}),s2jQuery(document).on("dialogclose",function(){t.html(t)})});