1(function($) { "use strict"; 2 3 /* Login & Password & Signup */ 4 5 wpqa_forms(".login-form","login"); 6 wpqa_forms(".wpqa-lost-password","password"); 7 wpqa_forms(".signup_form","signup"); 8 9 function wpqa_forms(whatClass,whatAction) { 10 if (jQuery(whatClass).length && !jQuery(whatClass).hasClass("wpqa-no-ajax")) { 11 jQuery(whatClass).submit(function() { 12 var thisform = jQuery(this); 13 jQuery('input[type="submit"]',thisform).hide(); 14 jQuery('.load_span',thisform).show().css({"display":"block"}); 15 jQuery('.required-item',thisform).each(function () { 16 var required = jQuery(this); 17 required.css("border-color","#e1e2e3"); 18 if (required.val() == '' && required.attr("type") != "file") { 19 required.css("border-color","#F00"); 20 return false; 21 } 22 }); 23 24 if (jQuery('.wpqa_captcha',thisform).length) { 25 var wpqa_captcha = jQuery('.wpqa_captcha',thisform); 26 var url = wpqa_unlogged.wpqa_dir+"captcha/captcha.php"; 27 var postStr = wpqa_captcha.attr("name")+"="+encodeURIComponent(wpqa_captcha.val()); 28 29 wpqa_captcha.css("border-color","#e1e2e3"); 30 31 if (wpqa_captcha.val() == "") { 32 jQuery(".wpqa_error",thisform).html('<span class="required-error required-error-c">'+wpqa_unlogged.wpqa_error_text+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400); 33 wpqa_captcha.css("border-color","#F00"); 34 jQuery('.load_span',thisform).hide().css({"display":"none"}); 35 jQuery('input[type="submit"]',thisform).show(); 36 return false; 37 }else if (wpqa_captcha.hasClass("captcha_answer")) { 38 if (wpqa_captcha.val() != wpqa_unlogged.captcha_answer) { 39 jQuery(".wpqa_error",thisform).html('<span class="required-error required-error-c">'+wpqa_unlogged.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400); 40 wpqa_captcha.css("border-color","#F00"); 41 jQuery('.load_span',thisform).hide().css({"display":"none"}); 42 jQuery('input[type="submit"]',thisform).show(); 43 return false; 44 } 45 }else { 46 var message = ""; 47 jQuery.ajax({ 48 url: url, 49 type: "POST", 50 data: postStr, 51 async: false, 52 success: function(data) { 53 message = data; 54 } 55 }); 56 if (message == "wpqa_captcha_0") { 57 jQuery(".wpqa_error",thisform).html('<span class="required-error required-error-c">'+wpqa_unlogged.wpqa_error_captcha+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400); 58 wpqa_captcha.css("border-color","#F00"); 59 jQuery('.load_span',thisform).hide().css({"display":"none"}); 60 jQuery('input[type="submit"]',thisform).show(); 61 return false; 62 } 63 } 64 } 65 66 var data = thisform.serialize(); 67 68 jQuery.ajax({ 69 url: wpqa_unlogged.admin_url, 70 type: "POST", 71 dataType: "json", 72 data: data, 73 success:function(result) { 74 if (result.success == 1) { 75 if (whatAction == "password") { 76 jQuery('input[type="email"]',thisform).val(""); 77 jQuery('.wpqa_captcha',thisform).val(""); 78 jQuery(".wpqa_success",thisform).html(result.done).animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400); 79 }else { 80 window.location.href = result.redirect; 81 } 82 }else if (result.error) { 83 jQuery(".wpqa_error",thisform).html('<span class="required-error">'+result.error+'</span>').animate({opacity: 'show' , height: 'show'}, 400).delay(5000).animate({opacity: 'hide' , height: 'hide'}, 400); 84 }else { 85 return true; 86 } 87 jQuery('.load_span',thisform).hide().css({"display":"none"}); 88 jQuery('input[type="submit"]',thisform).show(); 89 }, 90 error: function(errorThrown) { 91 // Error 92 } 93 }); 94 return false; 95 }); 96 } 97 } 98 99 un_login_panel("#signup-panel",".signup-panel-un"); 100 un_login_panel("#lost-password",".main_users_only .reset-password,.lost-password-login"); 101 un_login_panel("#lost-password",".lost-passwords","no",".main_users_only"); 102 un_login_panel("#login-panel",".login-panel-un"); 103 104 function un_login_panel(whatId,whatClass,whatFrom,bodyClass) { 105 if (jQuery(whatId).length && !jQuery(whatClass).hasClass("wpqa-not-pop")) { 106 jQuery((whatFrom == "no"?(bodyClass != ""?bodyClass+" ":"")+".wpqa_form,":"")+whatClass).on("click",(whatFrom == "no"?whatClass:""),function() { 107 var data_width = jQuery(whatId).attr("data-width"); 108 jQuery(".panel-un-login").hide(10); 109 jQuery(whatId).animate({opacity: 'show' , height: 'show'}, 400); 110 return false;
111 }); 112 } 113 } 114 115})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.