(function(a){a(function(){var g=a("#wp_rp_ajax_nonce").val(),h=function(c,b,e){a.ajax({url:ajaxurl,data:{action:"wprp_subscribe",subscription:b,_wpnonce:g,email:c||"0"},success:e,type:"POST"})},i=function(){var c=1!==a("#wp_rp_desktop_custom_theme_enabled:checked").length;a("#wp_rp_desktop_theme_custom_css").prop("readonly",c)};i();a("#wp_rp_desktop_custom_theme_enabled").click(i);a("#wp_rp_subscribe_email").length&&(a("#wp_rp_subscribe_email").val().length?a("#wp_rp_subscribe_button").hide():a("#wp_rp_unsubscribe_button").hide());
a("#wp_rp_subscribe_button").on("click",function(c){var b=a("#wp_rp_subscribe_email").val();c.preventDefault();b&&(a("#wp_rp_subscribe_button").attr("disabled",!0),h(b,"activityreport,newsletter",function(b){a("#wp_rp_subscribe_button").attr("disabled",!1);parseInt(b)&&(a("#wp_rp_subscribe_button").prop("disabled",!1),a("#wp_rp_subscribe_button").hide(),a("#wp_rp_unsubscribe_button").show(),alert("Subscription successful!"))}))});a("#wp_rp_unsubscribe_button").on("click",function(c){c.preventDefault();
a("#wp_rp_unsubscribe_button").attr("disabled",!0);h(!1,!1,function(b){a("#wp_rp_unsubscribe_button").attr("disabled",!1);parseInt(b)&&(a("#wp_rp_subscribe_email").val(""),a("#wp_rp_unsubscribe_button").hide(),a("#wp_rp_subscribe_button").show())})});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",function(c){var b=a(this).closest(".collapsible"),e=b.find(".container"),f=b.hasClass("collapsed"),d=b.attr("block");f?(e.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+d,show:!0,_wpnonce:g})):
(e.slideUp(),a.post(ajaxurl,{action:"rp_show_hide_"+d,hide:!0,_wpnonce:g}));b.toggleClass("collapsed");"statistics"===d&&(d="statistics_"+(f?"on":"off"),b=void 0,e=new Image,f="https:"===location.protocol?"https://":"http://",d={"zem-habit-platform":"wordpress-wprp","zem-habit-action":d,"zem-habit-timestamp":(new Date).getTime()},b=b||{},d=a.extend(b,d),e.src=f+"eyepatch.zemanta.com/log/?"+object_to_query(d));c.preventDefault()})})})(jQuery);
