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 jQuery('.wpcr3_respond_2 .alert.alert-danger').hide(); 75 76 var div2 = parent.find('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn'); 77 var c1 = parent.find('.wpcr3_fconfirm1'), c2 = parent.find('.wpcr3_fconfirm2'), c3 = parent.find('.wpcr3_fconfirm3'); 78 var fake_website = parent.find('.wpcr3_fake_website'), fake_url = parent.find('.wpcr3_fake_url'); 79 80 if (submit.hasClass('wpcr3_disabled')) { return false; } 81 82 var error = false; 83 84 if (wpcr3.mousemove_total <= wpcr3.mousemove_need || wpcr3.keypress_total <= wpcr3.keypress_need) { 85 86 //alert('@You did not pass our human detection check.'); 87 //return false; 88 89 error = true; 90 } 91 92 var c1_fail = (c1.is(':checked') === true), c2_fail = (c2.is(':checked') === false), c3_fail = (c3.is(':checked') === false); 93 var fake_fail = (fake_website.val().length > 0); 94 if (c1_fail || c3_fail || fake_fail) { 95 //alert('You did not pass our bot detection check.'); 96 //return false; 97 error = true; 98 } 99 100 101 if (error) { 102 jQuery('.wpcr3_respond_2 .alert.alert-danger').html('<b>We couldn\'t verify your review.</b><br/>Please enter name, email, rating and review.'); 103 jQuery('.wpcr3_respond_2 .alert.alert-danger').fadeIn('slow'); 104 $('html,body').animate({ 105 scrollTop : (jQuery('.wpcr3_respond_2 .alert.alert-danger').offset().top-100) 106 }); 107 return false; 108 } 109 110 var fields = div2.find('input,textarea'); 111 112 var req = []; 113 $.each(fields, function(i,v) { 114 v = $(v); 115 if (v.hasClass('wpcr3_required') && $.trim(v.val()).length === 0) { 116 var label = div2.find('label[for="'+v.attr('id')+'"]'), err = ''; 117 if (label.length) { 118 err = $.trim(label.text().replace(':',''))+' is required.'; 119 } else { 120 err = 'A required field has not been filled out.'; 121 } 122 req.push(err); 123 } 124 }); 125 126 if (c2_fail) { 127 128 req.push('Please tick the box below to accept our Privacy Policy.'); 129 130/* jQuery('.wpcr3_respond_2 .alert.alert-danger').html('Please tick the box below to accept our Privacy Policy.'); 131 jQuery('.wpcr3_respond_2 .alert.alert-danger').fadeIn('slow'); 132 return false; 133 134 error = true; 135*/ } 136 137 if (req.length > 0) { 138 req = req.join("\n"); 139 jQuery('.wpcr3_respond_2 .alert.alert-danger').html(req); 140 jQuery('.wpcr3_respond_2 .alert.alert-danger').fadeIn('slow'); 141 return false; 142 } 143 144 submit.addClass('wpcr3_disabled'); 145 146 var postid = parent.attr("data-postid"); 147 div2.find('.wpcr3_checkid').remove(); 148 div2.append('<input type="hidden" name="wpcr3_checkid" class="wpcr3_checkid" value="'+postid+'" />'); 149 div2.append('<input type="hidden" name="wpcr3_ajaxAct" class="wpcr3_checkid" value="form" />'); 150 fields = div2.find('input,textarea'); 151 152 var ajaxData = { ajaxAct : "cookie", postid : postid }; 153 wpcr3.ajaxPost(parent, ajaxData, function() { 154 var ajaxData = {}; 155 fields.each(function(i, v) { 156 v = $(v), val = v.val(); 157 if (v.attr('type') === 'checkbox' && v.is(':checked') === false) { val = '0'; } 158 ajaxData[v.attr('name')] = val; 159 }); 160 161 wpcr3.ajaxPost(parent, ajaxData, function(err, rtn) { 162 if (err) { return; } 163 164 jQuery('.wpcr3_respond_2_form').hide(); 165 jQuery('.wpcr3_respond_2_thanks').fadeIn(); 166 $('html,body').animate({ 167 scrollTop : (jQuery('.wpcr3_respond_2_thanks').offset().top-100) 168 }); 169 170 wpcr3.clearFields(); 171 172 }); 173 }); 174}; 175 176wpcr3.clearFields = function() { 177 var $ = jQuery; 178 var div2 = $('.wpcr3_div_2'), fields = div2.find('input,textarea');; 179 wpcr3.enableSubmit(); 180 fields.attr('autocomplete', 'off').not('[type="checkbox"], [type="hidden"]').val(''); 181}; 182 183wpcr3.enableSubmit = function() { 184 var $ = jQuery; 185 var div2 = $('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn'); 186 submit.removeClass('wpcr3_disabled'); 187}; 188 189wpcr3.init = function() { 190 var $ = jQuery; 191 192 $(".wpcr3_respond_3 .wpcr3_show_btn, .wpcr3_respond_2 .wpcr3_cancel_bt
192n").click(wpcr3.showform); 193 194 var evt_1 = 'mousemove.wpcr3 touchmove.wpcr3'; 195 $(document).bind(evt_1, function() { 196 wpcr3.mousemove_total++; if (wpcr3.mousemove_total > wpcr3.mousemove_need) { $(document).unbind(evt_1); } 197 }); 198 199 var evt_2 = 'keypress.wpcr3 keydown.wpcr3'; 200 $(document).bind(evt_2, function() { 201 wpcr3.keypress_total++; if (wpcr3.keypress_total > wpcr3.keypress_need) { $(document).unbind(evt_2); } 202 }); 203 204 $(".wpcr3_respond_2 .wpcr3_rating_style1_score > a").click(function(e) { 205 e.preventDefault(); 206 e.stopImmediatePropagation(); 207 208 var wpcr3_rating = $(this).html(), new_w = 20 * wpcr3_rating + "%"; 209 $(".wpcr3_frating").val(wpcr3_rating); 210 $(".wpcr3_respond_2 .wpcr3_rating_style1_base").removeClass('wpcr3_hide'); 211 $(".wpcr3_respond_2 .wpcr3_rating_style1_average").css("width",new_w); 212 $(".wpcr3_respond_2 .wpcr3_rating_style1_status").addClass('wpcr3_hide'); 213 214 $(".wpcr3_respond_2 .wpcr3_rating_stars").unbind("mouseover.wpcr3").bind("click.wpcr3", wpcr3.set_hover); 215 216 return false; 217 }); 218 219 $(".wpcr3_respond_2 .wpcr3_rating_stars").bind("mouseover.wpcr3", wpcr3.onhover); 220 221 var pagingCb = function(e) { 222 e.preventDefault(); 223 var t = $(this); 224 if (t.hasClass("wpcr3_disabled")) { return false; } 225 226 var parent = t.parents(".wpcr3_respond_1:first"); 227 var pager = t.parents(".wpcr3_pagination:first"); 228 var reviews = parent.find(".wpcr3_reviews_holder"); 229 var page = t.attr("data-page"); 230 var pageOpts = pager.attr("data-page-opts"); 231 var on_postid = parent.attr("data-on-postid"); 232 233 var ajaxData = { ajaxAct : "pager", on_postid : on_postid, page : page, pageOpts : pageOpts }; 234 wpcr3.ajaxPost(parent, ajaxData, function(err, rtn) { 235 if (err) { return; } 236 rtn.output = rtn.output.replace(/.*<\!\-\- reviews \-\->(.*?)<\!\-\- \/reviews \-\->.*/gm,'$1'); 237 reviews.html(rtn.output); 238 pager.remove(); 239 $('html,body').animate({ 240 scrollTop : (jQuery('#customer-reviews').offset().top) 241 }); 242 }); 243 }; 244 245 if ($("body").on !== undefined) { 246 $(".wpcr3_respond_1").on("click", ".wpcr3_pagination .wpcr3_a", pagingCb); 247 } else { 248 // support older versions of jQuery 249 $(".wpcr3_respond_1 .wpcr3_pagination .wpcr3_a").live("click", pagingCb); 250 } 251 252 var div2 = $('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn'); 253 submit.click(wpcr3.submit); 254 255 wpcr3.clearFields(); 256}; 257 258jQuery(function() { 259 wpcr3.init(); 260});
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.