1var wpcr3 = wpcr3 || {}; 2wpcr3.mousemove_total = 0; 3wpcr3.keypress_total = 0; 4wpcr3.mousemove_need = 5; 5wpcr3.keypress_need = 5; 6 7wpcr3.getPostUrl = function(elm) { 8 var ajaxurl = elm.attr("data-ajaxurl"); 9 ajaxurl = JSON.parse(ajaxurl); 10 ajaxurl = ajaxurl.join('.').replace(/\|/g,'/') 11 return ajaxurl; 12}; 13 14wpcr3.onhover = function() { 15 var $ = jQuery; 16 $(".wpcr3_respond_2 .wpcr3_rating_stars").unbind("click.wpcr3"); 17 $(".wpcr3_respond_2 .wpcr3_rating_style1_base").addClass('wpcr3_hide'); 18 $(".wpcr3_respond_2 .wpcr3_rating_style1_status").removeClass('wpcr3_hide'); 19}; 20 21wpcr3.set_hover = function() { 22 var $ = jQuery; 23 $(".wpcr3_frating").val(""); 24 $(".wpcr3_respond_2 .wpcr3_rating_stars").unbind("click.wpcr3"); 25 wpcr3.onhover(); 26}; 27 28wpcr3.showform = function() { 29 var $ = jQuery; 30 var t = $(this); 31 var parent = t.closest(".wpcr3_respond_1"); 32 33 var btn1 = parent.find(".wpcr3_respond_3 .wpcr3_show_btn"); 34 var resp2 = parent.find(".wpcr3_respond_2"); 35 resp2.slideToggle(400, function() { 36 parent.find(".wpcr3_table_2").find("input:text:visible:first").focus(); 37 if (resp2.is(":visible")) { 38 btn1.addClass('wpcr3_hide'); 39 } else { 40 btn1.removeClass('wpcr3_hide'); 41 } 42 }); 43}; 44 45wpcr3.ajaxPost = function(parent, data, cb) { 46 return jQuery.ajax({ 47 type : "POST", 48 url : wpcr3.getPostUrl(parent), 49 data : data, 50 dataType : "json", 51 success : function(rtn) { 52 if (rtn.err.length) { 53 rtn.err = rtn.err.join('\n'); 54 alert(rtn.err); 55 wpcr3.enableSubmit(); 56 return cb(rtn.err); 57 } 58 59 return cb(null, rtn); 60 }, 61 error : function(rtn) { 62 alert('An unknown error has occurred. E01'); 63 wpcr3.enableSubmit(); 64 } 65 }); 66}; 67 68wpcr3.submit = function(e) { 69 var $ = jQuery; 70 var t = $(this); 71 var parent = t.closest(".wpcr3_respond_1"); 72 e.preventDefault(); 73 74 var div2 = parent.find('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn'); 75 var c1 = parent.find('.wpcr3_fconfirm1'), c2 = parent.find('.wpcr3_fconfirm2'), c3 = parent.find('.wpcr3_fconfirm3'); 76 var fake_website = parent.find('.wpcr3_fake_website'); 77 78 if (submit.hasClass('wpcr3_disabled')) { return false; } 79 80 if (wpcr3.mousemove_total <= wpcr3.mousemove_need || wpcr3.keypress_total <= wpcr3.keypress_need) { 81 alert('You did not pass our human detection check. Code '+wpcr3.mousemove_total+','+wpcr3.keypress_total); 82 return false; 83 } 84 85 var c1_fail = (c1.is(':checked') === true), c2_fail = (c2.is(':checked') === false), c3_fail = (c3.is(':checked') === false); 86 var fake_fail = (fake_website.val().length > 0); 87 if (c1_fail || c3_fail || fake_fail) { 88 alert('You did not pass our bot detection check. Code '+c1_fail+','+c3_fail+','+fake_fail); 89 return false; 90 } 91 if (c2_fail) { 92 alert('You must check the box to confirm you are human.'); 93 return false; 94 } 95 96 var fields = div2.find('input,textarea'); 97 98 var req = []; 99 $.each(fields, function(i,v) { 100 v = $(v); 101 if (v.hasClass('wpcr3_required') && $.trim(v.val()).length === 0) { 102 var label = div2.find('label[for="'+v.attr('id')+'"]'), err = ''; 103 if (label.length) { 104 err = $.trim(label.text().replace(':',''))+' is required.'; 105 } else { 106 err = 'A required field has not been filled out.'; 107 } 108 req.push(err); 109 } 110 }); 111 112 if (req.length > 0) { 113 req = req.join("\n"); 114 alert(req); 115 return false; 116 } 117 118 submit.addClass('wpcr3_disabled'); 119 120 var postid = parseInt(parent.attr("data-postid"), 10); 121 div2.find('.wpcr3_checkid2').remove(); 122 div2.append('<input type="hidden" name="wpcr3_checkid2" class="wpcr3_checkid" value="'+((postid*42)-postid)+'" />'); 123 div2.append('<input type="hidden" name="wpcr3_ajaxAct2" class="wpcr3_checkid" value="form" />'); 124 fields = div2.find('input,textarea'); 125 126 var ajaxData = {}; 127 fields.each(function(i, v) { 128 v = $(v), val = v.val(); 129 if (v.attr('type') === 'checkbox' && v.is(':checked') === false) { val = '0'; } 130 ajaxData[v.attr('name')] = val; 131 }); 132 ajaxData._wpnonce = wpcr3Ajax.nonce; 133 134 wpcr3.ajaxPost(parent, ajaxData, function(err, rtn) { 135 if (err) { return; } 136 137 alert('Thank you! Your review has been received and will be posted soon.'); 138 $(window).scrollTop(0); 139 wpcr3.clearFields();
140 parent.find(".wpcr3_cancel_btn").click(); 141 }); 142}; 143 144wpcr3.clearFields = function() { 145 var $ = jQuery; 146 var div2 = $('.wpcr3_div_2'), fields = div2.find('input,textarea');; 147 wpcr3.enableSubmit(); 148 fields.attr('autocomplete', 'off').not('[type="checkbox"], [type="hidden"]').val(''); 149}; 150 151wpcr3.enableSubmit = function() { 152 var $ = jQuery; 153 var div2 = $('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn'); 154 submit.removeClass('wpcr3_disabled'); 155}; 156 157wpcr3.init = function() { 158 var $ = jQuery; 159 160 $(".wpcr3_respond_3 .wpcr3_show_btn, .wpcr3_respond_2 .wpcr3_cancel_btn").click(wpcr3.showform); 161 162 var evt_1 = 'mousemove.wpcr3 touchmove.wpcr3'; 163 $(document).bind(evt_1, function() { 164 wpcr3.mousemove_total++; if (wpcr3.mousemove_total > wpcr3.mousemove_need) { $(document).unbind(evt_1); } 165 }); 166 167 var evt_2 = 'keypress.wpcr3 keydown.wpcr3'; 168 $(document).bind(evt_2, function() { 169 wpcr3.keypress_total++; if (wpcr3.keypress_total > wpcr3.keypress_need) { $(document).unbind(evt_2); } 170 }); 171 172 $(".wpcr3_respond_2 .wpcr3_rating_style1_score > div").click(function(e) { 173 e.preventDefault(); 174 e.stopImmediatePropagation(); 175 176 var wpcr3_rating = $(this).html(), new_w = 20 * wpcr3_rating + "%"; 177 $(".wpcr3_frating").val(wpcr3_rating); 178 $(".wpcr3_respond_2 .wpcr3_rating_style1_base").removeClass('wpcr3_hide'); 179 $(".wpcr3_respond_2 .wpcr3_rating_style1_average").css("width",new_w); 180 $(".wpcr3_respond_2 .wpcr3_rating_style1_status").addClass('wpcr3_hide'); 181 182 $(".wpcr3_respond_2 .wpcr3_rating_stars").unbind("mouseover.wpcr3").bind("click.wpcr3", wpcr3.set_hover); 183 184 return false; 185 }); 186 187 $(".wpcr3_respond_2 .wpcr3_rating_stars").bind("mouseover.wpcr3", wpcr3.onhover); 188 189 var pagingCb = function(e) { 190 e.preventDefault(); 191 var t = $(this); 192 if (t.hasClass("wpcr3_disabled")) { return false; } 193 194 var parent = t.parents(".wpcr3_respond_1:first"); 195 var pager = t.parents(".wpcr3_pagination:first"); 196 var reviews = parent.find(".wpcr3_reviews_holder"); 197 var page = t.attr("data-page"); 198 var pageOpts = pager.attr("data-page-opts"); 199 var on_postid = parent.attr("data-on-postid"); 200 201 var ajaxData = { ajaxAct2 : "pager", on_postid : on_postid, page : page, pageOpts : pageOpts, _wpnonce : wpcr3Ajax.nonce }; 202 wpcr3.ajaxPost(parent, ajaxData, function(err, rtn) { 203 if (err) { return; } 204 205 reviews.html(rtn.output); 206 pager.remove(); 207 $('html,body').animate({ 208 scrollTop : (reviews.offset().top - 100) 209 }); 210 }); 211 }; 212 213 if ($("body").on !== undefined) { 214 $(".wpcr3_respond_1").on("click", ".wpcr3_pagination .wpcr3_a", pagingCb); 215 } else { 216 // support older versions of jQuery 217 $(".wpcr3_respond_1 .wpcr3_pagination .wpcr3_a").live("click", pagingCb); 218 } 219 220 var div2 = $('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn'); 221 submit.click(wpcr3.submit); 222 223 wpcr3.clearFields(); 224}; 225 226jQuery(function() { 227 wpcr3.init(); 228});
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.