PageSourceSearch

https://www.jdpecasagricolas.com.br/catalog/view/javascript/vowt.js?v=1790646284

js jdpecasagricolas.com.br collected 2026-09-29 01:45:04 UTC 9,596 bytes, 427 lines download raw bytes

1function initMask() {
2	$('.mask-postcode').mask('00000-000');
3
4	/* Mask */
5	var SPMaskBehavior = function (val) {
6		return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
7	},
8	spOptions = {
9		onKeyPress: function(val, e, field, options) {
10			field.mask(SPMaskBehavior.apply({}, arguments), options);
11		}
12	};
13		
14	$(`.mask-phone`).mask(SPMaskBehavior, spOptions);	
15	$(`.mask-telephone`).mask(SPMaskBehavior, spOptions);	
16}
17
18$(document).ready(function() {
19	initMask();
20});
21
22$.fn.button = function(state) {
23	return this.each(function() {
24		var element = this;
25
26		if (state == 'loading') {
27			this.html = $(element).html();
28			this.state = $(element).prop('disabled');
29
30			console.log(element)
31
32			$(element).prop('disabled', true).width($(element).width()).html('<i class="fa-solid fa-spinner fa-fw fa-spin"></i>');
33		}
34
35		if (state == 'reset') {
36			$(element).prop('disabled', this.state).width('').html(this.html);
37		}
38	});
39}
40
41function loadContent(url, element, toElement) {
42	fetch(url)
43		.then(response => response.text())
44		.then(html => {
45			// Parseia o HTML retornado
46			const parser = new DOMParser();
47			const doc = parser.parseFromString(html, 'text/html');
48			
49			// Extrai o conteúdo
50			let productContent = doc.getElementById(element);
51
52			if (productContent) {
53				$(toElement).html(productContent.innerHTML);
54			}
55		})
56		.catch(error => console.error('Erro ao carregar conteúdo:', error));
57}
58
59function getURLVar(key) {
60	var value = [];
61  
62	var query = String(document.location).split("?");
63  
64	if (query[1]) {
65	  var part = query[1].split("&");
66  
67	  for (i = 0; i < part.length; i++) {
68		var data = part[i].split("=");
69  
70		if (data[0] && data[1]) {
71		  value[data[0]] = data[1];
72		}
73	  }
74  
75	  if (value[key]) {
76		return value[key];
77	  } else {
78		return "";
79	  }
80	}
81}
82  
83$(document).ready(function () {
84	$(".scroll").click(function (event) {
85	  event.preventDefault();
86	  // window.history.pushState({url: "" + $(this).attr('href') + ""}, $(this).attr('title') , $(this).attr('href'));
87	  $("html,body").animate({ scrollTop: $(this.hash).offset().top - 80 }, 200);
88	});
89  
90	// Highlight any found errors
91	$(".text-danger").each(function () {
92	  var element = $(this).parent().parent();
93  
94	  if (element.hasClass("form-group")) {
95		element.addClass("has-error");
96	  }
97	});
98  
99	// Currency
100	$("#form-currency .currency-select").on("click", function (e) {
101	  e.preventDefault();
102  
103	  $("#form-currency input[name='code']").val($(this).attr("name"));
104  
105	  $("#form-currency").submit();
106	});
107  
108	// Language
109	$("#form-language .language-select").on("click", function (e) {
110	  e.preventDefault();
111  
112	  $("#form-language input[name='code']").val($(this).attr("name"));
113  
114	  $("#form-language").submit();
115	});
116  
117	/* Search */
118	$(".search button").on("click", function () {
119	  var url = $("base").attr("href") + "index.php?route=product/search";
120  
121	  var value = $(this).parents(".search").find("input").val();
122  
123	  if (value) {
124		url += "&search=" + encodeURIComponent(value);
125	  }
126  
127	  location = url;
128	});
129  
130	$(".search input[name='search']").on("keydown", function (e) {
131	  if (e.keyCode == 13) {
132		$(this).parent().find("button").trigger("click");
133	  }
134	});
135  
136	// Checkout
137	$(document).on(
138	  "keydown",
139	  "#collapse-checkout-option input[name='email'], #collapse-checkout-option input[name='password']",
140	  function (e) {
141		if (e.keyCode == 13) {
142		  $("#collapse-checkout-option #button-login").trigger("click");
143		}
144	  }
145	);
146  });
147  
148  var wishlist = {
149	add: function (product_id) {
150	  $.ajax({
151		url: "index.php?route=account/wishlist/add",
152		type: "post",
153		data: "product_id=" + product_id,
154		dataType: "json",
155		success: function (json) {
156		  $(".alert-dismissible").remove();
157  
158		  if (json["redirect"]) {
159			location = json["redirect"];
160		  }
161  
162		  if (json["success"]) {
163			Swal.fire({
164			  html: json["success"],
165			  icon: "success",
166			  confirmButtonText: "Ok"
167			});
168		  }
169  
170		  $("#wishlist-total span").html(json["total"]);
171		  $("#wishlist-total").attr("title", json["total"]);
172  
173		  $("html, body").animate({ scrollTop: 0 }, "slow");
174		},
175		error: function (xhr, ajaxOptions, thrownError) {
176		  console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
177		}
178	  });
179	},
180	remove: function () {}
181  };
182  
183  var compare = {
184	add: function (product_id) {
185	  $.ajax({
186		url: "index.php?route=product/compare/add",
187		type: "post",
188		data: "product_id=" + product_id,
189		dataType: "json",
190		success: function (json) {
191		  if (json["success"]) {
192			$("#compare-total").html(json["total"]);
193  
194			Swal.fire({
195			  html: json["success"],
196			  icon: "success",
197			  confirmButtonText: "Ok"
198			});
199		  }
200		},
201		error: function (xhr, ajaxOptions, thrownError) {
202		  console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
203		}
204	  });
205	},
206	remove: function () {}
207  };
208  
209  /* Agree to Terms */
210  $(document).delegate(".agree", "click", function (e) {
211	e.preventDefault();
212  
213	$("#modal-agree").remove();
214  
215	var element = this;
216  
217	$.ajax({
218	  url: $(element).attr("href"),
219	  type: "get",
220	  dataType: "html",
221	  success: function (data) {
222		html = '<div id="modal-agree" class="modal">';
223		html += '  <div class="modal-dialog">';
224		html += '    <div class="modal-content">';
225		html += '      <div class="modal-header">';
226		html +=
227		  '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
228		html += '        <h4 class="modal-title">' + $(element).text() + "</h4>";
229		html += "      </div>";
230		html += '      <div class="modal-body">' + data + "</div>";
231		html += "    </div>";
232		html += "  </div>";
233		html += "</div>";
234  
235		$("body").append(html);
236  
237		$("#modal-agree").modal("show");
238	  }
239	});
240  });
241  
242  // Autocomplete */
243  (function ($) {
244	$.fn.autocomplete = function (option) {
245	  return this.each(function () {
246		this.timer = null;
247		this.items = new Array();
248  
249		$.extend(this, option);
250  
251		$(this).attr("autocomplete", "off");
252  
253		// Focus
254		$(this).on("focus", function () {
255		  this.request();
256		});
257  
258		// Blur
259		$(this).on("blur", function () {
260		  setTimeout(
261			function (object) {
262			  object.hide();
263			},
264			200,
265			this
266		  );
267		});
268  
269		// Keydown
270		$(this).on("keydown", function (event) {
271		  switch (event.keyCode) {
272			case 27: // escape
273			  this.hide();
274			  break;
275			default:
276			  this.request();
277			  break;
278		  }
279		});
280  
281		// Click
282		this.click = function (event) {
283		  event.preventDefault();
284  
285		  value = $(event.target).parent().attr("data-value");
286  
287		  if (value && this.items[value]) {
288			this.select(this.items[value]);
289		  }
290		};
291  
292		// Show
293		this.show = function () {
294		  var pos = $(this).position();
295  
296		  $(this)
297			.siblings("ul.dropdown-menu")
298			.css({
299			  top: pos.top + $(this).outerHeight(),
300			  left: pos.left
301			});
302  
303		  $(this).siblings("ul.dropdown-menu").show();
304		};
305  
306		// Hide
307		this.hide = function () {
308		  $(this).siblings("ul.dropdown-menu").hide();
309		};
310  
311		// Request
312		this.request = function () {
313		  clearTimeout(this.timer);
314  
315		  this.timer = setTimeout(
316			function (object) {
317			  object.source($(object).val(), $.proxy(object.response, object));
318			},
319			200,
320			this
321		  );
322		};
323  
324		// Response
325		this.response = function (json) {
326		  html = "";
327  
328		  if (json.length) {
329			for (i = 0; i < json.length; i++) {
330			  this.items[json[i]["value"]] = json[i];
331			}
332  
333			for (i = 0; i < json.length; i++) {
334			  if (!json[i]["category"]) {
335				html +=
336				  '<li data-value="' +
337				  json[i]["value"] +
338				  '"><a href="#">' +
339				  json[i]["label"] +
340				  "</a></li>";
341			  }
342			}
343  
344			// Get all the ones with a categories
345			var category = new Array();
346  
347			for (i = 0; i < json.length; i++) {
348			  if (json[i]["category"]) {
349				if (!category[json[i]["category"]]) {
350				  category[json[i]["category"]] = new Array();
351				  category[json[i]["category"]]["name"] = json[i]["category"];
352				  category[json[i]["category"]]["item"] = new Array();
353				}
354  
355				category[json[i]["category"]]["item"].push(json[i]);
356			  }
357			}
358  
359			for (i in category) {
360			  html +=
361				'<li class="dropdown-header">' + category[i]["name"] + "</li>";
362  
363			  for (j = 0; j < category[i]["item"].length; j++) {
364				html +=
365				  '<li data-value="' +
366				  category[i]["item"][j]["value"] +
367				  '"><a href="#">&nbsp;&nbsp;&nbsp;' +
368				  category[i]["item"][j]["label"] +
369				  "</a></li>";
370			  }
371			}
372		  }
373  
374		  if (html) {
375			this.show();
376		  } else {
377			this.hide();
378		  }
379  
380		  $(this).siblings("ul.dropdown-menu").html(html);
381		};
382  
383		$(this).after('<ul class="dropdown-menu"></ul>');
384		$(this)
385		  .siblings("ul.dropdown-menu")
386		  .delegate("a", "click", $.proxy(this.click, this));
387	  });
388	};
389})(window.jQuery);
390  
391
392async function loadContentPage(url, element, to) {
393	fetch(url)
394		.then(response => response.text())
395		.then(html => {
396			// Parseia o HTML retornado
397			const parser = new DOMParser();
398			const doc = parser.parseFromString(html, 'text/html');
399			
400			// Extrai o conteúdo
401			let productContent = doc.getElementById(element);
402
403			if (productContent) {
404				$(`#${to || element}`).html(productContent.innerHTML);
405			}
406		})
407		.catch(error => console.error('Erro ao carregar conteúdo:', error));
408}
409
410function initializeLazy() {
411	lazyload = $(`img[data-src]`).lazyload({
412		// effect : "fadeIn",
413		data_attribute: 'src',
414	});
415
416	setTimeout(function() {
417		$(`img[data-src]`).lazyload('update');
418	}, 300);
419}
420
421$(document).ready(function() {
422	initializeLazy();
423
424	$('button[data-bs-toggle="tab"]').on('click', function(){
425		initializeLazy();
426	});
427});

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.