PageSourceSearch

https://indianahistory.org/wp-content/plugins/wp-customer-reviews/js/wp-customer-reviews.js?ver=3.7.7

js indianahistory.org collected 2026-10-02 03:23:01 UTC 6,934 bytes, 227 lines download raw bytes

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	
133	wpcr3.ajaxPost(parent, ajaxData, function(err, rtn) {
134		if (err) { return; }
135		
136		alert('Thank you! Your review has been received and will be posted soon.');
137		$(window).scrollTop(0);
138		wpcr3.clearFields();
139		parent.find(".wpcr3_cancel_btn").click();
140	});
141};
142
143wpcr3.clearFields = function() {
144	var $ = jQuery;
145	var div2 = $('.wpcr3_div_2'), fields = div2.find('input,textarea');;
146	wpcr3.enableSubmit();
147	fields.attr('autocomplete', 'off').not('[type="checkbox"], [type="hidden"]').val('');
148};
149
150wpcr3.enableSubmit = function() {
151	var $ = jQuery;
152	var div2 = $('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn');
153	submit.removeClass('wpcr3_disabled');
154};
155
156wpcr3.init = function() {
157	var $ = jQuery;
158	
159	$(".wpcr3_respond_3 .wpcr3_show_btn, .wpcr3_respond_2 .wpcr3_cancel_btn").click(wpcr3.showform);
160	
161	var evt_1 = 'mousemove.wpcr3 touchmove.wpcr3';
162	$(document).bind(evt_1, function() {
163		wpcr3.mousemove_total++; if (wpcr3.mousemove_total > wpcr3.mousemove_need) { $(document).unbind(evt_1); }
164	});
165	
166	var evt_2 = 'keypress.wpcr3 keydown.wpcr3';
167	$(document).bind(evt_2, function() {
168		wpcr3.keypress_total++; if (wpcr3.keypress_total > wpcr3.keypress_need) { $(document).unbind(evt_2); }
169	});
170	
171	$(".wpcr3_respond_2 .wpcr3_rating_style1_score > div").click(function(e) {
172		e.preventDefault();
173		e.stopImmediatePropagation();
174		
175		var wpcr3_rating = $(this).html(), new_w = 20 * wpcr3_rating + "%";
176		$(".wpcr3_frating").val(wpcr3_rating);
177		$(".wpcr3_respond_2 .wpcr3_rating_style1_base").removeClass('wpcr3_hide');
178		$(".wpcr3_respond_2 .wpcr3_rating_style1_average").css("width",new_w);
179		$(".wpcr3_respond_2 .wpcr3_rating_style1_status").addClass('wpcr3_hide');
180
181		$(".wpcr3_respond_2 .wpcr3_rating_stars").unbind("mouseover.wpcr3").bind("click.wpcr3", wpcr3.set_hover);
182		
183		return false;
184    });
185
186    $(".wpcr3_respond_2 .wpcr3_rating_stars").bind("mouseover.wpcr3", wpcr3.onhover);
187	
188	var pagingCb = function(e) {
189		e.preventDefault();
190		var t = $(this);
191		if (t.hasClass("wpcr3_disabled")) { return false; }
192		
193		var parent = t.parents(".wpcr3_respond_1:first");
194		var pager = t.parents(".wpcr3_pagination:first");
195		var reviews = parent.find(".wpcr3_reviews_holder");
196		var page = t.attr("data-page");
197		var pageOpts = pager.attr("data-page-opts");
198		var on_postid = parent.attr("data-on-postid");
199		
200		var ajaxData = { ajaxAct2 : "pager", on_postid : on_postid, page : page, pageOpts : pageOpts };
201		wpcr3.ajaxPost(parent, ajaxData, function(err, rtn) {
202			if (err) { return; }
203			
204			reviews.html(rtn.output);
205			pager.remove();
206			$('html,body').animate({
207			   scrollTop : (reviews.offset().top - 100)
208			});
209		});	
210	};
211	
212	if ($("body").on !== undefined) {
213		$(".wpcr3_respond_1").on("click", ".wpcr3_pagination .wpcr3_a", pagingCb);
214	} else {
215		// support older versions of jQuery
216		$(".wpcr3_respond_1 .wpcr3_pagination .wpcr3_a").live("click", pagingCb);
217	}
218	
219	var div2 = $('.wpcr3_div_2'), submit = div2.find('.wpcr3_submit_btn');
220	submit.click(wpcr3.submit);
221	
222	wpcr3.clearFields();
223};
224
225jQuery(function() {
226	wpcr3.init();
227});

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.