PageSourceSearch

https://www.tireregistrationplus.com/js/Site.js

js tireregistrationplus.com collected 2026-10-04 13:49:46 UTC 6,425 bytes, 162 lines download raw bytes

1$(document).ready(function () {
2	$(".droppable").on('dragover', function (e) {
3		e.stopPropagation();
4		e.preventDefault();
5	});
6	$(".alert-hide").click(function () {
7		$(this).closest(".alert").hide();
8	});
9	$(".droppable").on('drop', function (e) {
10		e.stopPropagation();
11		e.preventDefault();
12		if ($(".rec-status").text().startsWith("Recognizing"))
13			return;
14		var token = $("#hdnAuthToken").val();
15		var formData = new FormData();
16		var url = "";
17		var opmlFile = e.originalEvent.dataTransfer.files[0];
18		if (!opmlFile) {
19			var dataFile = $("#hdnPrevImgData").val();
20			var name = $("#hdnPrevImgName").val();
21			$(".rec-status").addClass("recognizing").html("<h4>Recognizing</h4>");
22			if (!dataFile)
23				return;
24			dataFile = dataFile.substr(dataFile.indexOf("base64,") + 7);
25			url = 'https://inspection-staging.tireregistrationplus.com/API/Demo/GetDemoImageRecognition';
26			var data = { "Token": token, "ImageBase64": dataFile };
27			sendRequest(url, data, name);
28			return;
29		}
30		formData.append("opmlFile", opmlFile);
31		$(".rec-status").addClass("recognizing").html("<h4>Recognizing</h4>");
32		var fr = new FileReader();
33		var x;
34		fr.onload = function () {
35			x = fr.result;
36			var temp = $("#hist-template .history-item").clone();
37			var prevImg = $(temp).find("img").first();
38			$(prevImg).addClass("img-responsive");
39			$(prevImg).attr("src", x);
40			$(prevImg).attr("filename", opmlFile.name);
41			$(prevImg).on("drag", function () {
42				$("#hdnPrevImgData").val($(this).attr("src"));
43				$("#hdnPrevImgName").val($(this).attr("filename"));
44			});
45			$(temp).prependTo("#history");
46			x = x.substr(x.indexOf("base64,") + 7);
47			url = 'https://inspection-staging.tireregistrationplus.com/API/Demo/GetDemoImageRecognition';
48			var data = { "Token": token, "ImageBase64": x };
49			sendRequest(url, data, opmlFile.name);
50		};
51		fr.readAsDataURL(opmlFile);
52	});
53	$(".customFileSelect").change(function () {
54		if (this.files && this.files[0]) {
55			var opmlFile = this.files[0];
56			var token = $("#hdnAuthToken").val();
57			var formData = new FormData();
58			formData.append("opmlFile", opmlFile);
59			$(".rec-status").addClass("recognizing").html("<h4>Recognizing</h4>");
60			var fr = new FileReader();
61			var x;
62			fr.onload = function () {
63				x = fr.result;
64				var temp = $("#hist-template .history-item").clone();
65				var prevImg = $(temp).find("img").first();
66				$(prevImg).addClass("img-responsive");
67				$(prevImg).attr("src", x);
68				$(prevImg).attr("filename", opmlFile.name);
69				$(prevImg).on("drag", function () {
70					$("#hdnPrevImgData").val($(this).attr("src"));
71					$("#hdnPrevImgName").val($(this).attr("filename"));
72				});
73				$(temp).prependTo("#history");
74				x = x.substr(x.indexOf("base64,") + 7);
75				url = 'https://inspection-staging.tireregistrationplus.com/API/Demo/GetDemoImageRecognition';
76				var data = { "Token": token, "ImageBase64": x };
77				sendRequest(url, data, opmlFile.name);
78			};
79			fr.readAsDataURL(opmlFile);
80		}
81	});
82	$(".selectFile").click(function () { $(this).closest("div").find(".customFileSelect").trigger('click'); })
83	$(".tooltip").tooltip();
84});
85function showLargeImage(img) {
86	$("#modal-large-image img").attr("src", $(img).attr("src"));
87	$("#modal-large-image").modal("show");
88}
89function runImage(input) {
90	if ($(".rec-status").text().startsWith("Recognizing"))
91		return;
92	var img = $(input).closest(".history-item").find("img").first();
93	var token = $("#hdnAuthToken").val();
94	var dataFile = $(img).attr("src");
95	var name = $(img).attr("filename");
96	$(".rec-status").addClass("recognizing").html("<h4>Recognizing</h4>");
97	if (!dataFile)
98		return;
99	dataFile = dataFile.substr(dataFile.indexOf("base64,") + 7);
100	url = 'https://inspection-staging.tireregistrationplus.com/API/Demo/GetDemoImageRecognition';
101	var data = { "Token": token, "ImageBase64": dataFile };
102	sendRequest(url, data, name);
103}
104function sendRequest(url, data, filename) {
105	$(".selectFile").attr("disabled", "disabled");
106	$("#recent-images").show();
107	$("#no-history").hide();
108	$(".alert").hide();
109	$.ajax({
110		url: url,
111		type: 'POST',
112		data: data,
113		dataType: 'json',
114	}).done(function (e) {
115		var result = e;
116		var items = result.Results;
117		$("#results-body td").parent().remove();
118		if (e.Errors && e.Errors.length) {
119			var error = "Error: ";
120			for (var i = 0; i < e.Errors.length; i++)
121				error += e.Errors[i].MessageText + " (" + e.Errors[i].ErrorNumber + ")\r\n";
122			$(".error-text").html(error);
123			$(".error-text").closest(".alert").show();
124			return;
125		}
126		if (e.WarningMessages && e.WarningMessages.length) {
127			var wrn = "Warning: ";
128			for (var i = 0; i < e.WarningMessages.length; i++)
129				wrn += e.WarningMessages[i].MessageText + " (" + e.WarningMessages[i].ErrorNumber + ")\r\n";
130			$(".warning-text").html(wrn);
131			$(".warning-text").closest(".alert").show();
132		}
133		if (e.RefreshAuthToken)
134			$("#hdnAuthToken").val(e.RefreshAuthToken);
135		if (items.length > 0) {
136			formattedOutput(items[0].Input, items[0].Output, $("#results").find(".label-output"));
137			formattedOutput(items[0].Input, items[0].Input, $("#results").find(".label-theirs"));
138			$("#results").find(".label-brand").html(items[0].Brand);
139			$("#results").find(".label-model").html(items[0].Model);
140			$("#results").find(".label-size").html(items[0].Size);
141			if (items[0].ValidationResult && items[0].ValidationResult.Recalls && items[0].ValidationResult.Recalls.length > 0)
142				$(".label-recalled").removeClass("not-recalled").addClass("recalled").html("Recalled").show();
143			else
144				$(".label-recalled").removeClass("recalled").addClass("not-recalled").html("Not Recalled");
145			if (items.length > 1) {
146				$(".more-results").html("<br /><br /><p>* " + (items.length - 1) + " more dropped possibilities.</p>")
147			}
148			$("#results").show();
149		}
150		else
151			$("#results").hide();
152	}).always(function () { $(".selectFile").attr("disabled", null); $(".rec-status").removeClass("recognizing").html("<h4>Done Recognizing</h4>" + filename); $(".rec-again").html("<br />Drop another file if you wish."); });
153}
154
155function formattedOutput(orig, output, label) {
156	$.ajax({
157		url: $("#hdnSiteRoot").val() + '/API/FormatTIN',
158		type: 'POST',
159		data: { "originalTIN": orig, "possibleTIN": output },
160		dataType: 'json',
161	}).done(function (e) { $(label).html(e); });
162}

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.