1 setTimeout(function () { 2 $('video').each(function (i, elm) { 3 if ($(elm).attr('autoplay') != undefined) { 4 $(elm).get(0).play(); 5 } 6 }) 7 }, 3000); 8 9 window.isLoading = 0; 10function showLoading() { 11 window.isLoading = 1; 12 swal.fire({ 13 title: 'Loading ...', 14 allowEscapeKey: false, 15 allowOutsideClick: false, 16 timer: 20000, 17 onOpen: () => { 18 swal.showLoading(); 19 } 20 }) 21}; 22function closeLoading() { 23 window.isLoading = 0; 24 swal.close(); 25}; 26window.tabsStatus = []; 27if (typeof window.t_hours !== "function") { 28 29 window.t_hours = function () { 30 if (typeof window.website_settings.set_sunday_hours !== 'undefined') { 31 32 var d = new Date(); 33 var weekday = new Array(7); 34 weekday[0] = "Sunday " + window.website_settings.set_sunday_hours; 35 weekday[1] = "Monday " + window.website_settings.set_monday_hours; 36 weekday[2] = "Tuesday " + window.website_settings.set_tuesday_hours; 37 weekday[3] = "Wednesday " + window.website_settings.set_wednesday_hours; 38 weekday[4] = "Thursday " + window.website_settings.set_thursday_hours; 39 weekday[5] = "Friday " + window.website_settings.set_friday_hours; 40 weekday[6] = "Saturday " + window.website_settings.set_saturday_hours; 41 42 var n = weekday[d.getDay()]; 43 if ($('#t_hour').size()) { 44 $('#t_hour').html(n); 45 } 46 47 } 48 return true; 49 } 50} 51if (typeof window.header_scroll !== "function") { 52 53 window.header_scroll = function () { 54 return true; 55 } 56} 57if (typeof window.changeSRPLable !== "function") { 58 59 window.changeSRPLable = function () { 60 return true; 61 } 62} 63 64if (typeof window.allFormsCallback !== "function") { 65 66 window.allFormsCallback = function () { 67 if (typeof parent.allFormsCallback == "function") { 68 return parent.allFormsCallback(); 69 } else { 70 console.log('allFormsCallback Not Found'); 71 } 72 } 73} 74if (typeof window.static_filter_after_load_data !== "function") { 75 76 window.static_filter_after_load_data = function () { 77 return true; 78 } 79} 80 81if (typeof window.stickymenu !== "function") { 82 83 window.stickymenu = function () { 84 return true; 85 } 86} 87if (typeof window.animatedcollapse !== "function") { 88 89 window.animatedcollapse = function () { 90 return true; 91 } 92} 93if (typeof window.animatedcollapse.addDiv !== "function") { 94 window.animatedcollapse.addDiv = function () { 95 return true; 96 } 97} 98if (typeof window.animatedcollapse.init !== "function") { 99 window.animatedcollapse.init = function () { 100 return true; 101 } 102} 103 104/*if (typeof window.header_scroll === 'undefined') { 105window.header_scroll = function() { 106return false; 107} 108} 109function undefined() { 110//console.log('undefined'); 111return false; 112} 113header_scroll20();*/ 114//console.log(window.pageName); 115 116if (typeof $.fn.lightSlider == 'undefined') { 117 $.fn.lightSlider = function () { 118 119 return this; 120 }; 121} 122if (typeof $.fn.multislider == 'undefined') { 123 $.fn.multislider = function () { 124 125 return this; 126 }; 127} 128if (window.pageName == undefined || !window.pageName) { 129 130 var pagename = location.pathname.split("/"); 131 132 window.pageName = pagename[1]; 133 if (pagename[2] != undefined && pagename[2].indexOf('adid') == -1 && pagename[2].indexOf('rand') == -1) 134 window.pageName = window.pageName + '/' + pagename[2]; 135} 136var CaptchaCallback = function () { 137 $('.g-recaptcha').each(function (i, elm) { 138 if (typeof grecaptcha.render == 'function' && $(elm).data('sitekey') && !$.trim($(elm).html())) { 139 var widgetId = grecaptcha.render(elm, { 140 'sitekey': $(elm).data('sitekey') 141 }); 142 $(elm).data('widgetId', widgetId); 143 } 144 }) 145}; 146window.reset = false; 147window.modalSrc = false; 148 149window.customDetailsDisplay = ''; 150 151$(document).mouseup(function (e) { 152 var isBackOrderBtn = $(e.target).hasClass('backorder-btn'); 153 if (isBackOrderBtn) 154 return; 155 156 var container = $(".backorder-elements"); 157 if (!container.is(e.target) && container.has(e.target).length === 0) 158 container.hide(); 159}); 160 161function backOrderDropdown(btn, qty = 1) { 162 $(btn).closest('div').find('.qty_needs').val(qty); 163 $(btn).closest('div').children('.backorder-elements').toggle(); 164} 165 166function backOrder(btn, sheetId, sheetName, obj) { 167 obj = obj || {}; 168 obj.token = 'ekf3eqwo2384872'; 169 obj.sheetId = sheetId; 170 obj.sheetName = sheetName; 171 var url = 'https://equipmentsearch.com/admintools/google/api.php'; 172 obj.qty = $(btn).closest('div').children('.qty_needs').val() ?? 1; 173 $(btn).closest('div').hide(); 174 var orderBtn = $(btn).closest('.backorder-container').find('.backorder-btn'); 175 orderBtn.html('Requested'); 176 orderBtn.attr('disabled', true); 177 $.post(url, obj); 178} 179function genricSubmit($form) { 180 181 var formData = $form.serializeObject(); 182 formData.sid = window.sid > 0 ? window.sid : formData.sid; 183 formData.href = location.href; 184 if ($form[0].checkValidity()) { 185 Swal.showLoading(); 186 $.post('/helper/esc-lead-form/', formData, function (data) { 187 188 var res; 189 allFormsCallback(); 190 if (typeof window.gtag === 'function') { 191 res = window.gtag('event', 'submit', { 192 send_to: window.send_to['GAGT'], 193 event_category: 'form', 194 event_label: formData.lead_type_ignore + ' Form' 195 }); 196 197 if (window.website_settings.google_tag) { 198 res = window.gtag('event', 'conversion', { 199 'send_to': window.send_to['GT'] 200 }); 201 } 202 203 } else if (typeof window.ga === 'function') { 204 window.ga('send', 'event', { 205 eventCategory: 'form', 206 eventAction: 'submit', 207 send_to: window.send_to['GA'], 208 }); 209 } 210 211 if (data.error) { 212 Swal.fire({ 213 icon: 'error', 214 title: data.msg, 215 timerProgressBar: true, 216 showConfirmButton: true, 217 allowOutsideClick: true, 218 timer: 1500 219 }) 220 } else { 221 222 Swal.fire({ 223 icon: 'success', 224 title: data.msg, 225 showConfirmButton: true, 226 timer: 1500, 227 width: 400 228 }) 229 } 230 231 }) 232 233 } else { 234 var _req_text = window.translate("all fields are required"); 235 Swal.fire({ 236 icon: 'error', 237 title: _req_text, 238 timerProgressBar: true,
239 showConfirmButton: false, 240 allowOutsideClick: false, 241 timer: 2000 242 }) 243 } 244 return false; 245} 246function showIframeModal(src, title, width, height) { 247 248 title = title ? title : ''; 249 width = width ? parseInt(width.replace('px', '')) : 750; 250 height = height ? parseInt(height.replace('px', '')) : 650; 251 252 var dialog = bootbox.dialog({ 253 message: '<iframe id="dialogFrame" style="width:' + width + 'px;min-height:' + height + 'px;" src="' + src + '" frameborder="0" allowfullscreen ></iframe>', 254 title: title, 255 callback: function () { 256 dialog.find('iframe').remove(); 257 }, 258 show: true, 259 backdrop: true 260 }).find("div.modal-dialog").addClass('text-center').css({ 261 width: (width + 50) + 'px', 262 height: height + 'px' 263 }); 264 return false; 265} 266function showAjaxModal(src, title, width, height) { 267 268 title = title ? title : ''; 269 width = width ? parseInt(width.replace('px', '')) : 750; 270 height = height ? parseInt(height.replace('px', '')) : 650; 271 272 $.get(src, function (res) { 273 setTimeout(function () { 274 CaptchaCallback(); 275 }, 1000); 276 277 var dialog = bootbox.dialog({ 278 message: res, 279 title: title, 280 callback: function () {}, 281 show: true, 282 backdrop: true 283 }).find("div.modal-dialog").addClass('text-center').css({ 284 width: (width + 50) + 'px', 285 height: height + 'px' 286 }) 287 return false; 288 289 }) 290 291} 292function showNormalModal(src, title, width, height) { 293 294 title = title ? title : ''; 295 width = width ? parseInt(width.replace('px', '')) + 'px' : 750; 296 height = height ? parseInt(height.replace('px', '')) + 'px' : 'auto'; 297 window.modalSrc = src; 298 bootbox.dialog({ 299 'message': $(src).html(), 300 'title': title, 301 'show': true, 302 backdrop: true, 303 'className': 'normalModal' 304 }).find("div.modal-dialog").addClass('text-center').css({ 305 width: (width + 50), 306 height: height 307 }); 308 309 return false; 310} 311 312function launchIntoFullscreen(element) { 313 if (element.requestFullscreen) { 314 element.requestFullscreen(); 315 } else if (element.mozRequestFullScreen) { 316 element.mozRequestFullScreen(); 317 } else if (element.webkitRequestFullscreen) { 318 element.webkitRequestFullscreen(); 319 } else if (element.msRequestFullscreen) { 320 element.msRequestFullscreen(); 321 } 322} 323 324function exitFullscreen() { 325 if (document.exitFullscreen) { 326 document.exitFullscreen(); 327 } else if (document.mozCancelFullScreen) { 328 document.mozCancelFullScreen(); 329 } else if (document.webkitExitFullscreen) { 330 document.webkitExitFullscreen(); 331 } 332} 333 334function getCookie(name) { 335 var value = "; " + document.cookie; 336 var parts = value.split("; " + name + "="); 337 if (parts.length == 2) 338 return parts.pop().split(";").shift(); 339} 340 341function setCookie(c_name, value, exhours = 24) { 342 var exhours = 24; 343 var exdate = new Date(); 344 exdate.setHours(exdate.getHours() + exhours); 345 var c_value = escape(value) + ((exhours == null) ? "" : "; expires=" + exdate.toUTCString()) + "; path=/"; 346 document.cookie = c_name + "=" + c_value; 347} 348 349$.fn.serializeObject = function () { 350 var o = {}; 351 var a = this.serializeArray(); 352 $.each(a, function () { 353 if (o[this.name] !== undefined) { 354 if (!o[this.name].push) { 355 o[this.name] = [o[this.name]]; //detailsFormSubmit 356 } 357 o[this.name].push(this.value || ''); 358 } else { 359 o[this.name] = this.value || ''; 360 } 361 }); 362 return o; 363}; 364$(function () { 365 $('#searchButton, #searchReset ,.searchReset').click(function () { 366 $('#searchLoading').show(); 367 }); 368 369 static_filter_gather_data(); 370}); 371 372function searchByEnterKey(e) { 373 e = e || window.event; 374 //console.log( e ); 375 return; 376 if (e.keyCode == 13) { 377 $('#searchButton').click(); 378 return false; 379 } 380 return true; 381} 382var loadReCaptcha = function () { 383
384 if ($('#grecaptcha').length > 0) { 385 var sitekey = ''; 386 387 $('#grecaptcha').each(function (i, elm) { 388 if (!sitekey && $(elm).data('sitekey')) { 389 var sitekey = $(elm).data('sitekey'); 390 } 391 392 console.log(sitekey); 393 grecaptcha.render('grecaptcha', { 394 sitekey: sitekey 395 }); 396 397 if (window.self !== window.top) { 398 grecaptcha.reset($(elm)); 399 } 400 }) 401 402 } 403 404}; 405 406function htmlEncode(value) { 407 if (value) { 408 return $('<div/>').text(value).html(); 409 } else { 410 return ''; 411 } 412} 413 414function setPageTitle(title) { 415 title = title.replace('-', ' ').replace('--', '/'); 416 var curTitle = $.trim($('title').text()); 417 if (curTitle.indexOf('|') != -1) { 418 if ($.trim(title)) 419 $('title').text(curTitle.replace(/([^\|]+)\|.+/, '$1 | ' + title)); 420 else 421 $('title').text(curTitle.replace(/([^\|]+)\|.+/, '$1')); 422 } else { 423 if ($.trim(title)) 424 $('title').text(curTitle + ' | ' + title); 425 } 426} 427 428function setPageDescription(title) { 429 title = title.replace('-', ' ').replace('--', '/'); 430 var curTitle = $.trim($('meta[name=description]').attr("content")); 431 if (curTitle.indexOf('|') != -1) { 432 if ($.trim(title)) 433 $('meta[name=description]').attr("content", curTitle.replace(/([^\|]*)\|.+/, '$1 | ' + title)); 434 else 435 $('meta[name=description]').attr("content", curTitle.replace(/([^\|]*)\|.+/, '$1')); 436 } else { 437 if ($.trim(title)) 438 $('meta[name=description]').attr("content", curTitle + ' | ' + title); 439 } 440} 441 442function setCanonical(href) { 443 href = $.trim(href); 444 if (href) { 445 $('link[rel=canonical]').attr("href", href); 446 } else { 447 var newHref = "http://" + window.location.hostname + (window.redirctPageName ? window.redirctPageName : location.pathname); 448 $('link[rel=canonical]').attr("href", newHref); 449 } 450 451} 452function genericLoginForm(form) { 453 var data = $(form).serializeObject(); 454 console.log(data); 455 $.post('/page/generic-login', 456 data, function (res) { 457 if (res.error == 1) { 458 Swal.fire({ 459 icon: 'error', 460 title: res.msg,
461 showConfirmButton: false, 462 timer: 3500, 463 width: 400 464 }) 465 $(form)[0].reset(); 466 } else if (res.error == 0) { 467 Swal.fire({ 468 icon: 'success', 469 title: res.msg, 470 showConfirmButton: false, 471 timer: 3500, 472 width: 400 473 }) 474 setTimeout(function () { 475 location.href = '/'; 476 }, 2000); 477 478 } 479 }, 'json'); 480 481 return false; 482} 483 484function saveTabsStatus() { 485 486 $('#filters .collapse').each(function (i, elm) { 487 if ($(elm).attr('id')) { 488 window.tabsStatus[$(elm).attr('id')] = $(elm).hasClass('in') ? 1 : 0; 489 } 490 491 }) 492} 493 494function restoreTabsStatus() { 495 for (var key in window.tabsStatus) { 496 var value = window.tabsStatus[key]; 497 498 if ($('#' + key).length) { 499 if (value > 0) { 500 $('#' + key).addClass("in"); 501 } else { 502 $('#' + key).removeClass("in"); 503 } 504 } 505 506 } 507 508} 509function parseQuery(queryString) { 510 var query = {}; 511 var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&'); 512 for (var i = 0; i < pairs.length; i++) { 513 var pair = pairs[i].split('='); 514 pair[1] = decodeURIComponent(pair[1] || ''); 515 //pair[1] = pair[1].replace('[','').replace(']','').split(','); 516 query[decodeURIComponent(pair[0])] = pair[1]; 517 } 518 // console.log(query); 519 return query; 520} 521function modernFilters(formData, div) { 522 if (window.isLoading == 1) { 523 return; 524 } 525 showLoading(); 526 saveTabsStatus();
527 528 formData = parseQuery(formData.replace(/[^\?]*\?/, '')); 529 //console.log(formData); 530 $('html,body').css({ 531 'cursor': 'wait' 532 }); 533 534 $('#ESCAdsResponse' + div).css('min-height', ""); 535 $('#ESCAdsResponse' + div).css("overflow", "visible"); 536 $.post('/helper/apply-filters/?sid=1001644&pcompid=' + $('#ESCAdsResponse' + div).attr('rel'), formData, function (data) { 537 538 var jsFile = $(data).find('inject').html(); 539 if ($.trim(jsFile)) { 540 $.getScript($.trim(jsFile), function () { 541 console.log('JS-LOADED'); 542 closeLoading(); 543 }); 544 } 545 546 $('#ESCAdsResponse' + div).find('#products').html($(data).find('#products').html()); 547 $('#ESCAdsResponse' + div).find('#filters').html($(data).find('#filters').html()); 548 549 $.fn.matchHeight._update(); 550 551 setTimeout(function () { 552 onAdsListLoad(); 553 }, 2000) 554 $('html,body').css({ 555 'cursor': 'default' 556 }); 557 $('#ESCAdsResponse' + div).removeAttr("style"); 558 559 restoreTabsStatus();
560 561 }); 562} 563 564function modernFilterEvent_Static_DetectChanges(sender, isSlider = false, input = null) { 565 var isChanged = true; 566 567 if (isSlider) { 568 var a1 = $(input).slider("option", "values").join('-'); 569 var a2 = $('.staticFilterContainer').data($(input).attr('id').replaceAll('-', '_'))?.val; 570 isChanged = a1 != a2; 571 //console.log('ttttttttttt', $(input).attr('id').replaceAll('-', '_'), a1, a2, isChanged); 572 } else { 573 isChanged = $('.staticFilterContainer').data($(input).attr('id'))?.status != $(input).is(':checked'); 574 //$('.staticFilterContainer').data($(input).attr('id'), {status: $(input).is(':checked'), val: $(input).val()}); 575 576 $.each($('.staticFilterContainer').data(), (e, i) => { 577 //console.log(e, i); 578 }); 579 } 580 581 isChanged = true; // TODO:: 582 modernFilterEvent_Static(sender); 583 //$('.apply_btn_' + sender).css({visibility: isChanged ? 'visible':'hidden'}); 584 585} 586 587function modernFilterEvent_Static(sender, isSlider = false, input = null) { 588 $('.apply_btn_' + sender).css({ 589 visibility: 'hidden' 590 }); 591 static_filter_gather_data(); 592 modernFilterEvent(sender, isSlider, true); 593} 594 595function static_filter_gather_data() { 596 setTimeout(() => { 597 $('.staticFilterContainer').removeData(); 598 $('[class*="static_filter_gather_data"] input').each((i, e) => { 599 $('.staticFilterContainer').data($(e).attr('id'), { 600 status: $(e).is(':checked'), 601 val: $(e).val() 602 }); 603 }); 604 605 $('[id*="slider-range-"]').each((i, e) => { 606 //console.log($(e).attr('id').replaceAll('-', '_'), $(e).slider( "option", "values" )); 607 //$('.staticFilterContainer').data($(e).attr('id').replaceAll('-', '_'), {status: 'slider', val: $(e).slider( "option", "values").join('-')}); 608 }); 609 //console.log($('.staticFilterContainer').data()); 610 }, 500); 611} 612 613function static_filter_after_load_data($keywords = '') { 614 fill_active_filters($keywords); 615} 616 617function activeFilterRemove(elem, cat, itemId, type, id) { 618 // console.log([elem, cat, itemId, type,id]); 619 var id = id ? id : itemId; 620 if (id) { 621 $(elem).closest('.static-filter-active-item').hide(); 622 } else { 623 $(elem).closest('.static-filter-active-container').find('.static-filter-active-item').hide(); 624 } 625 626 const $cat = $(elem).closest('.static-filter-active-container').find('.static-filter-active-item:visible'); 627 628 if ($cat.length <= 0) 629 $(elem).closest('.static-filter-active-container').hide(); 630 631 const $parent = $(`.filter-collapse-container.${cat}`); 632 var $items = null; 633 634 if (type == 'checkbox') { 635 //$items = id ? $(`#${id}`) : $parent.find(`input:checked`); 636 $items = id ? $("#" + $.escapeSelector(id)) : $parent.find(`input:checked`); 637 $items.prop("checked", false); 638 } else if (type == 'slider') { 639 if (id) { 640 // Sender = Item 641 elem = $(`#${id}`); 642 const min = $(elem).slider("option", "min"); 643 const max = $(elem).slider("option", "max"); 644 $(elem).slider("values", [min, max]); 645 } else { 646 // Sender = Category 647 elem = $(elem).closest('.static-filter-active-container').find('.static-filter-active-item span.icon').click(); 648 } 649 } else if (type == 'keywords') { 650 $('#search').val(''); 651 } 652 653 // $('#'+id).prop('checked',false);//.trigger('change'); 654 modernFilterEvent(""); 655 //modernFilterEvent_Static('bodyStyle') 656} 657 658function fill_active_filters($keywords = "") { 659 var activeFilters = {}; 660 661 // Keywords filter 662 if ($keywords) { 663 const label = 'keywords'; 664 if (!activeFilters[label]) { 665 activeFilters[label] = []; 666 } 667 activeFilters[label].push({ 668 label: $keywords.trim(), 669 id: 'search', 670 type: label 671 }); 672 } 673 674 // Checkbox filters 675 $.each($('.modernFilterCheckBox'), (index, elem) => { 676 const label = $(elem).closest('.filter-collapse-container')?.find('a')?.text()?.trim(); 677 $.each($('input:checked', elem), (i, e) => { 678 const item = $(e).parent('label'); 679 //console.log(item); 680 if (item?.length) { 681 if (!activeFilters[label]) { 682 activeFilters[label] = []; 683 } 684 activeFilters[label].push({ 685 label: item.text()?.trim(), 686 id: item.find('input').attr('id'), 687 type: 'checkbox' 688 }); 689 } 690 }); 691 });
692 693 // Sliders filters 694 $('[id*="slider-range-"]').each((i, elem) => { 695 const label = $(elem).attr('name')?.trim(); 696 const min = $(elem).slider("option", "min"); 697 const max = $(elem).slider("option", "max"); 698 const selected_min = $(elem).slider("values", 0); 699 const selected_max = $(elem).slider("values", 1); 700 // console.log(selected_min, selected_max, min, max); 701 702 if (min != selected_min || max != selected_max) { 703 if (!activeFilters[label]) { 704 activeFilters[label] = []; 705 } 706 707 activeFilters[label].push({ 708 //${SellableItems.paymentsCurrency} 709 label: `${selected_min} - ${selected_max}`, 710 id: $(elem).attr('id'), 711 type: 'slider' 712 }); 713 } 714 }); 715 716 //console.log(activeFilters); 717 $('.static-filter-active-main').empty(); 718 719 if ($.isEmptyObject(activeFilters)) { 720 $('.active-filter-container').hide(); 721 } else { 722 $('.active-filter-container').show(); 723 var tmp = ''; 724 var childCount = 0; 725 726 $.each(activeFilters, (_index, _elem) => { 727 tmp += ` 728 <div class="row static-filter-active-container"> 729 <div class="static-filter-active-grp"> 730 <span class="static-filter-active-title">${_index}</span> 731 <span class="pull-right active-filter-category"> 732 <i class="fal fa-times-circle" title="Remove" onclick="activeFilterRemove(this, '${_index}', false, '${_elem[0].type}', '${_elem[0].id}')"></i> 733 </span> 734 </div> 735 `; 736 737 $.each(_elem, (_index2, _filter) => { 738 childCount += 1; 739 tmp += ` 740 <div class="static-filter-active-item"> 741 <div class="icon"> 742 <span class="glyphicon glyphicon-remove icon" title="Remove" onclick="activeFilterRemove(this, '${_index}', '${_filter.id}', '${_filter.type}', '${_filter.id}')"></span> 743 </div> 744 <div class="col-xs-10">${_filter.label}</div> 745 </div> 746 `; 747 }); 748 749 tmp += ` 750 </div> 751 `; 752 }); 753 754 $("#static-filter-count").text(childCount); 755 $(".static-filter-active-main").append(tmp); 756 } 757} 758 759function modernFilterEvent(sender = '', isSlider = false, isStaticFilter = false) { 760 761 window.reset = false; 762 if (window?.customFilter?.search != undefined && window?.customFilter?.search == 'all') { 763 window.customFilter.search = ''; 764 window.reset = true; 765 window.filtersOrder = []; 766 var div = $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 767 modernFilters('/' + window.pageName + '/', div); 768 769 } else { 770 //console.log(filterParams); 771 var filterParams = []; 772 //console.log(filterParams); 773 if (sender != '' && window?.customFilter?.page && window?.customFilter?.page > 1) { 774 window.customFilter.page = 1; 775 } 776 //console.log(window.customFilter); 777 //console.log(filterParams); 778 $('.modernFilter').each((index, elem) => { 779 var selected = $(elem).find('input:checked').toArray(); 780 if (selected.length) { 781 filterParams.push('filters[' + $(elem).attr('name') + ']=' + selected.map(item => { 782 return encodeURI($(item).val().replaceAll(',', '%7C')) 783 }).join(",").replaceAll('&', '%26') + ''); 784 } 785 }); 786 //console.log(filterParams); 787 $('.modernFilterSelect').each((index, elem) => { 788 // var selected = $(elem).val(); 789 filterParams.push('filters[' + $(elem).attr('name') + ']=' + $(elem).val() + ''); 790 }); 791 //console.log(filterParams); 792 $.each(window.fitmentItems, (index, elem) => { 793 filterParams.push('filters[fitment][' + index + ']=' + elem); 794 }); 795 //console.log(filterParams); 796 $.each(window?.customFilter, (index, elem) => { 797 filterParams.push('filters[' + index + ']=' + elem); 798 }); 799 //console.log(filterParams); 800 $('[id*="slider-range-"]').each((index, elem) => { 801 const min = $(elem).slider("option", "min"); 802 const max = $(elem).slider("option", "max"); 803 const selected_min = $(elem).slider("values", 0); 804 const selected_max = $(elem).slider("values", 1); 805 // console.log(selected_min, selected_max, min, max); 806 807 if (min != selected_min || max != selected_max) { 808 filterParams.push('filters[' + $(elem).attr('name') + ']=' + encodeURI(selected_min + ',' + selected_max)); 809 } 810 }); 811 //console.log(filterParams); 812 $('.modernFilterText').each((index, elem) => { 813 //console.log($(elem).val(),$(elem)); 814 $(elem).val() && filterParams.push('filters[' + $(elem).attr('name') + ']=' + encodeURI($(elem).val())); 815 }); 816 817 //console.log(filterParams); 818 var url = filterParams.length ? '/' + window.pageName + '/?filters[lastFilter]=' + sender + '&modernFilter=true&isStaticFilter=' + isStaticFilter + '&' + filterParams.join('&') : '/' + window.pageName + '/'; 819 //console.log(url); 820 callLoadContent(url); 821 } 822} 823 824function loadContent(locHash) { 825 826 if (locHash.indexOf('?') !== -1) { 827 828 var div = $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 829 //console.log(locHash); 830 modernFilters(locHash, div); 831 } else { 832 tlocHash = locHash.split("/"); 833 834 if (window.escComps == "escComp" && isNumeric(locHash.replace("#", ""))) { 835 836 if (locHash.length > 1) { 837 838 if (locHash.search("RANDOM") >= 0) { 839 adId = locHash.replace("#RANDOM", "");
840 getRandomAdDetails(adId, window.detailsStyle); 841 } else if (locHash.search("POS") >= 0) { 842 adId = locHash.replace("#", ""); 843 location.hash = ""; 844 //alert(adId); 845 $("." + adId).click(); 846 } else { 847 adId = locHash.replace("#", ""); 848 getAdDetails(adId, window.detailsStyle, window.quantityShow, window.odometerShow); 849 } 850 } 851 } else if (locHash.indexOf('subname') != -1) { 852 locHash = locHash.split("/"); 853 if (isNumeric(locHash[1])) { 854 setPageTitle(locHash[3] + " for Sale"); 855 setPageDescription(locHash[3] + " for Sale"); 856 var subid = locHash[1]; 857 var div = $('#sub_' + subid).size() > 0 ? $('#sub_' + subid).attr('rel') : $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 858 //console.log(div); 859 filterAds("subcategoryId", subid, div); 860 } 861 862 } else if (locHash.indexOf('search') != -1) { 863 864 locHash = locHash.split("/"); 865 //alert(locHash[1]); 866 if (locHash[1]) { 867 $('.adsSearchKeywords').val(decodeURIComponent(locHash[1])); 868 searchAds('', locHash[1]); 869 return; 870 } 871 872 } else if (locHash.indexOf('categoryId') != -1) { 873 locHash = locHash.split("/"); 874 if (isNumeric(locHash[1])) { 875 var div = $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 876 var catid = locHash[1]; 877 if (catid == 0) { 878 filterAds("categoryId", 0, div); 879 setPageTitle(''); 880 setPageDescription(''); 881 } else { 882 setPageTitle(locHash[3]); 883 setPageDescription(locHash[3]); 884 //console.log(div); 885 filterAds("categoryId", catid, div); 886 } 887 } 888 889 } else if (locHash.indexOf('page') != -1) { 890 locHash = locHash.split("/"); 891 //console.log(locHash); 892 if (isNumeric(locHash[1])) { 893 var pagenum = locHash[1]; 894 setPageTitle('Page :' + pagenum); 895 filterAds("page", pagenum, window.responseDiv); 896 } 897 } else if (locHash.indexOf('adid') != -1) { 898 locHashAr = locHash.split("/"); 899 900 var adId = locHashAr[1];
901 getAdDetails(adId, window.detailsStyle, window.quantityShow, window.odometerShow); 902 903 } else if (locHash.indexOf('randad') != -1) { 904 locHashAr = locHash.split("/"); 905 906 var adId = locHashAr[1]; 907 getRandomAdDetails(adId, window.detailsStyle); 908 909 } else if (tlocHash[0] != undefined && tlocHash[1] != undefined && tlocHash[3] != undefined) { 910 locHash = locHash.split("/"); 911 var div = $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 912 var catid = locHash[1]; 913 setPageTitle(locHash[3]); 914 setPageDescription(locHash[3]); 915 //console.log(div); 916 filterAds(locHash[0], locHash[1], div); 917 918 } else if ((locHash == '/' || locHash == "" || window.reset == true) && $('.ESCAdsResponse').size() > 0) { 919 var div = $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 920 filterAds("search", 'all', div); 921 setPageTitle(''); 922 setPageDescription(''); 923 $('select').removeClass('selectBorder'); 924 } 925 } 926} 927 928function onAdsListLoad() { 929 if ($('.single_row').size() > 0) 930 return; 931 var new_container_height = 0; 932 $('.thumbnail').each(function (i, elm) { 933 if ($(elm).outerHeight() > new_container_height) 934 new_container_height = $(elm).height(); 935 936 }) 937 if (new_container_height > 0) 938 $('.thumbnail').css('height', (new_container_height + 25) + "px"); 939 940 //alert(new_container_height); 941 //console.log( new_container_height ); 942 modernFilterHideUlItemsFun(); 943} 944 945function postSize(height) { 946 var target = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined); 947 948 if (document.body && typeof target != undefined && document.body.scrollHeight) { 949 target.postMessage(height, "*"); 950 } 951} 952if (window.self !== window.top) { 953 setInterval(function () { 954 //$('html, body', window.parent.document).animate({scrollTop:0}, 'slow'); 955 var contentHeight = $("#CenterDiv").height() + 100; 956 //console.log(contentHeight); 957 postSize(contentHeight); 958 }, 500); 959 960} 961 962window.addEventListener('hashchange', function () { 963 var locHash = location.hash.replace("#", ""); 964 loadContent(locHash); 965 966}); 967 968function callLoadContent(href) { 969 //console.log(href); 970 971 var newHref = href.split('/'); 972 newHref.splice(0, 1); 973 newHref.splice(0, 1); 974 if (window.redirctPageName) { 975 newHref.splice(0, 1); 976 } 977 newHref = newHref.join('/'); 978 ///console.log(newHref); 979 if (window.reset == true && location.href.indexOf('fitment') !== -1) { 980 location.href = location.href.replace(/\?.*/, ''); 981 } else { 982 //console.log(newHref); 983 //console.log(href); 984 loadContent(newHref); 985 // HISTORY.PUSHSTATE 986 history.pushState(null, href, href); 987 } 988 989} 990$(window).on('load', function () { 991 992 setTimeout(function () { 993 $('iframe').each(function (i, elm) { 994 if ($(elm).data('src') != undefined && !$(elm).hasClass("skip")) { 995 $(elm).attr('src', $(elm).data('src')); 996 } 997 }) 998 }, 1500); 999 1000 $('iframe.skip').each(function (i, elm) { 1001 if ($(elm).data('src') != undefined) { 1002 $(elm).attr('src', $(elm).data('src')); 1003 } 1004 }); 1005 1006 setTimeout(function () { 1007 // THIS EVENT MAKES SURE THAT THE BACK/FORWARD BUTTONS WORK AS WELL 1008 window.onpopstate = function (event) { 1009 //console.log( "pathname: " + location.pathname ); 1010 var newHref = location.pathname; 1011 newHref = newHref.split('/'); 1012 newHref.splice(0, 1); 1013 newHref.splice(0, 1); 1014 if (window.redirctPageName) { 1015 newHref.splice(0, 1); 1016 } 1017 newHref = newHref.join('/'); 1018 //console.log( "newHref: " + newHref ); 1019 if (!newHref) 1020 location.reload(); 1021 else 1022 loadContent(newHref); 1023 }; 1024 1025 }, 2000); 1026}); 1027 1028function modernFilterHideUlItemsFun() { 1029 $('ul.modernFilterHideUlItems').each(function () { 1030 if ($(this).children('li').length > 5 && !$('.loadMore', this).length) { 1031 $(this).children('li:lt(5)').css({ 1032 display: 'flex' 1033 });
1034 $(this).append('<button class="loadMore">Load More</button>'); 1035 } 1036 }); 1037 $('ul.modernFilterHideUlItems').on("click", '.loadMore', function () { 1038 $(this).parent('.modernFilterHideUlItems').children('li:gt(4)').css({ 1039 display : 'flex' 1040 }); // use gt instead of lt 1041 $(this).removeClass('loadMore').addClass('loadLess').text('Load Less'); 1042 }); 1043 $('ul.modernFilterHideUlItems').on("click", '.loadLess', function () { 1044 $(this).parent('.modernFilterHideUlItems').children('li:gt(4)').css({ 1045 display : 'none' 1046 }); // use gt instead of lt 1047 $(this).removeClass('loadLess').addClass('loadMore').text('Load More'); 1048 }); 1049} 1050 1051$(function () { 1052 if ($('#t_hour').size() > 0) { 1053 t_hours(); 1054 } 1055 $(document).on('hidden.bs.modal', function (e) { 1056 if (window.modalSrc) { 1057 $(window.modalSrc).html($(e.target).find('.bootbox-body').html()); 1058 window.modalSrc = false; 1059 } 1060 }); 1061 1062 $(document).on('click', '.pushstate', function (e) { 1063 1064 e.preventDefault(); 1065 if ($(this).parents('.pagination').size() && window.paramUrl.indexOf('legacy') == -1) { 1066 var pageNum = $(this).attr('href').replace(/.+\/page\/(\d+).*/, '$1'); 1067 window.customFilter['page'] = pageNum; 1068 return modernFilterEvent(); 1069 } else { 1070 if ($('.ESCAdsResponse').size() && $(this).parents('.pagination.dark').size()) { 1071 $('html,body').animate({ 1072 scrollTop: $('.ESCAdsResponse').offset().top 1073 }, 1000); 1074 } 1075 1076 var href = $(this).attr("href"); 1077 if (href.indexOf('/adid/') !== -1) { 1078 location.href = href; 1079 } else { 1080 callLoadContent(href); 1081 } 1082 return false; 1083 } 1084 1085 }); 1086 1087 /*window.addEventListener('popstate', function(event) { 1088 1089 1090 //console.log( "pathname: " + location.pathname,event ); 1091 var newHref = location.pathname; 1092 newHref = newHref.split( '/' ); 1093 newHref.splice( 0, 1 ); 1094 newHref.splice( 0, 1 ); 1095 if ( window.redirctPageName ) { 1096 newHref.splice( 0, 1 ); 1097 } 1098 newHref = newHref.join( '/' ); 1099 //console.log( "newHref: " + newHref ); 1100 if ( !newHref ) 1101 location.reload(); 1102 else 1103 loadContent( newHref ); 1104 }, false);*/ 1105 if ($('#LeftDiv,#RightDiv,#CenterDiv').length) { 1106 $('#LeftDiv,#RightDiv,#CenterDiv').matchHeight(); 1107 } 1108 1109 // Basem 1110 $('#topPanel textarea').css({ 1111 'color' : '#000' 1112 }); 1113 1114 $.ajaxSetup({ 1115 cache : false 1116 }); 1117 //window.ADDOC = new Array(); 1118 $("img[src$='.pdf'],img[src$='.pptx']").each(function (i, elm) { 1119 1120 var href = $(elm).attr('src'); 1121 $(elm).attr('src', 'https://equipmentsearch.com/images/downloads3.png'); 1122 /* adId = $(elm).parent().attr('rel').replace("RANDOM",""); 1123 window.ADDOC[adId]=href;*/ 1124 }) 1125 1126 $(".youtube").click(function () { 1127 var $this = $(this); 1128 if ($this.attr('vwidth')) { 1129 var width = $this.attr('vwidth'); 1130 } else { 1131 var width = 680; 1132 } 1133 if ($this.attr('vheight')) { 1134 var height = $this.attr('vheight'); 1135 } else { 1136 height = 495; 1137 } 1138 $.fancybox({ 1139 'padding': 0, 1140 'autoScale': false, 1141 'transitionIn': 'none', 1142 'transitionOut': 'none', 1143 'title': this.title, 1144 'width': width, 1145 'height': height, 1146 'href': $this.attr('href').replace(new RegExp("watch\\?v=", "i"), 'v/'), 1147 'type': 'swf', 1148 'swf': { 1149 'wmode': 'transparent', 1150 'allowfullscreen': 'true' 1151 } 1152 }); 1153 1154 return false; 1155 }); 1156 1157 $(document).on('click', '.lightboxs', function () { 1158 var src = $(this).attr('href'); 1159 var title = $(this).attr('title'); 1160 var popuptype = $(this).data('popuptype'); 1161 var width = '850'; 1162 var height = '800'; 1163 console.log(popuptype); 1164 if (popuptype == "ajax") {
1165 showAjaxModal(src, title, width, height); 1166 } else { 1167 showIframeModal(src, title, width, height); 1168 } 1169 1170 return false; 1171 }); 1172 1173 $(document).on('click', '.lightbox', function () { 1174 var src = $(this).attr('href'); 1175 var title = $(this).attr('title') ? $(this).attr('title') : $(this)[0].innerText; 1176 var width = '1500'; 1177 var height = '800'; 1178 var popuptype = $(this).data('popuptype'); 1179 console.log(popuptype); 1180 if (popuptype == "ajax") { 1181 showAjaxModal(src, title, width, height); 1182 } else { 1183 showIframeModal(src, title, width, height); 1184 } 1185 //console.log([src, title, width, height]); 1186 return false; 1187 }); 1188 1189 /*var border = RUZEE.ShadedBorder.create({ corner:8, shadow:16, border:2 }); 1190 border.render('siteMenu');*/ 1191 1192 $('ul.mainMenu').css('background-color', $('.mainMenu > li:first').css('background-color')); 1193 1194 //$(".curved").corner(); 1195 //$("ul.sf-menu > li:last").corner("round 15px tr br"); 1196 1197 1198 window.sid = 1001644 ; 1199 window.pageId = 77843 ; 1200 1201 $('.insertedcss').css('width', 'auto'); 1202 // $('.curved').cornerz(); 1203 if (!$.browser.msie) { 1204 $('object').append('<param name="wmode" value="transparent">').find('embed').attr('wmode', 'transparent') 1205 } else { 1206 1207 if ($('iframe').size() > 0) { 1208 $('iframe').each(function (i, elm) { 1209 1210 var src = $(elm).attr('src'); 1211 var add = src.indexOf('?') == -1 ? src + '?wmode=transparent' : src + '&wmode=transparent'; 1212 $(elm).attr('src', add); 1213 1214 }) 1215 } 1216 } 1217 1218 if ($('#theForm').size() > 0) { 1219 $('input,select,textarea,radio').each(function (i, elm) { 1220 1221 //$(this).attr('class',''); 1222 var meta = $(elm).clone().metadata({ 1223 type: 'attr', 1224 name: 'json' 1225 }) 1226 1227 $(this).attr('name', $(this).parent().parent('tr').find('th').find('label').html()); 1228 if ($(this).attr('name')) { 1229 if (meta.required !== '0') { 1230 1231 $(this).addClass('required'); 1232 } 1233 if (meta.rule !== '0') { 1234 1235 $(this).addClass(meta.rule); 1236 1237 } 1238 if (meta.rule == 'numberic') { 1239 1240 $(this).addClass('number'); 1241 } 1242 if (meta.err_msg) { 1243 1244 $(this).attr('title', meta.err_msg) 1245 } 1246 if (meta.init_val) { 1247 1248 $(this).val(meta.init_val) 1249 } 1250 } 1251 1252 }); 1253 1254 var formMeta = $("#theForm").clone().metadata({ 1255 type: 'attr', 1256 name: 'json' 1257 }) 1258 1259 if (formMeta.font_color) { 1260 // alert(formMeta.font_color); 1261 $("#theForm").css('color', formMeta.font_color); 1262 } 1263 if (formMeta.back_color) { 1264 1265 $("#theForm").css('background-color', formMeta.back_color); 1266 1267 } 1268 $("#theForm").validate({ 1269 submitHandler: function () { 1270 var g_recaptcha_response = ''; 1271 if ($("[data-size='invisible']").length > 0 ) { 1272 grecaptcha.execute(); 1273 } 1274 setTimeout(function () { 1275 $.each($('.g-recaptcha-response'), function (i, elm) { 1276 if ($(elm).val()) { 1277 g_recaptcha_response = $(elm).val(); 1278 } 1279 }) 1280 1281 1282 if (!g_recaptcha_response && $('#theForm').find('#grecaptcha').size() > 0) { 1283//this 1284 Swal.fire({ 1285 icon: 'error', 1286 title: "You must verfiy the CAPTCHA", 1287 timerProgressBar: true, 1288 showConfirmButton: true, 1289 allowOutsideClick: true, 1290 timer: 1500 1291 }) 1292 return false; 1293 } 1294 1295 $('#theForm').ajaxSubmit({ 1296 type: 'POST',
1297 url: '/helper/mailformtraget', 1298 success: function (data) { 1299 allFormsCallback(); 1300 alert("Your message has been sent"); 1301 }, 1302 iframe: true, 1303 data: { 1304 subject: formMeta.email_subject, 1305 email_from: formMeta.email_from, 1306 email_to: formMeta.email_to, 1307 g_recaptcha_response: g_recaptcha_response 1308 } 1309 }); 1310 1311 }, 500) 1312 1313 } 1314 }) 1315 1316 $('#form1Submit').removeAttr('onclick'); 1317 1318 } 1319 1320 if ($('.mailForm').size() > 0 && $('.mailForm').attr('json')) { 1321 $form = $(".mailForm"); 1322 $form.validate({ 1323 submitHandler: function () { 1324 var formMeta = $form.clone().metadata({ 1325 type: 'attr', 1326 name: 'json' 1327 }) 1328 $form.ajaxSubmit({ 1329 type: 'POST', 1330 url: '/helper/mailformtraget', 1331 1332 success: function (data) { 1333 allFormsCallback(); 1334 Swal.fire({ 1335 icon: 'success', 1336 title: 'Sent Successfully', 1337 timerProgressBar: true,
1338 showConfirmButton: false, 1339 allowOutsideClick: false, 1340 timer: 2000 1341 }) 1342 }, 1343 iframe: false, 1344 data: { 1345 subject: formMeta.email_subject, 1346 email_from: formMeta.email_from, 1347 email_to: formMeta.email_to 1348 } 1349 }); 1350 return false; 1351 } 1352 }) 1353 1354 } 1355 1356 if ($('.mailForm').size() > 0 && $('.mailForm').attr('json')) { 1357 $form = $(".mailForm"); 1358 $form.validate({ 1359 submitHandler: function () { 1360 var formMeta = $form.clone().metadata({ 1361 type: 'attr', 1362 name: 'json' 1363 }) 1364 $form.ajaxSubmit({ 1365 type: 'POST', 1366 url: '/helper/mailformtraget', 1367 1368 success: function (data) { 1369 allFormsCallback(); 1370 Swal.fire({ 1371 icon: 'success', 1372 title: 'Sent Successfully', 1373 timerProgressBar: true,
1374 showConfirmButton: false, 1375 allowOutsideClick: false, 1376 timer: 2000 1377 }) 1378 }, 1379 iframe: false, 1380 data: { 1381 subject: formMeta.email_subject, 1382 email_from: formMeta.email_from, 1383 email_to: formMeta.email_to 1384 } 1385 }); 1386 return false; 1387 } 1388 }) 1389 1390 } 1391 1392 if ($("#TrilliumForm").size() > 0) { 1393 1394 $("#TrilliumForm").validate(); 1395 $("#CalcLoan").click(function () { 1396 1397 if ($("#TrilliumForm").valid()) { 1398 $.post("/cgi-bin/newcalc.cgi", $("#TrilliumForm").serialize(), function (data) { 1399 $(".loanCalcResult").html(data); 1400 1401 }) 1402 } else { 1403 return false; 1404 } 1405 1406 }) 1407 } 1408}) 1409 1410/*Rollover by Dapina*/ 1411 1412function isNumeric(n) { 1413 return !isNaN(parseFloat(n)) && isFinite(n); 1414} 1415 1416function imageholderclass() { 1417 this.over = new Array(); 1418 this.down = new Array(); 1419 this.src = new Array(); 1420 this.store = store; 1421 1422 function store(src, down, over) { 1423 var AL = this.src.length; 1424 this.src[AL] = new Image(); 1425 1426 this.src[AL].src = src; 1427 this.over[AL] = new Image(); 1428 this.over[AL].src = over; 1429 this.down[AL] = new Image(); 1430 this.down[AL].src = down; 1431 } 1432} 1433 1434var ih = new imageholderclass(); 1435var mouseisdown = 0; 1436 1437function preloader(t) { 1438 for (i = 0; i < t.length; i++) { 1439 if (t[i].getAttribute('srcover') || t[i].getAttribute('srcdown')) { 1440 1441 storeimages(t[i]); 1442 var checker = ''; 1443 checker = (t[i].getAttribute('srcover')) ? checker + 'A' : checker + ''; 1444 checker = (t[i].getAttribute('srcdown')) ? checker + 'B' : checker + ''; 1445 1446 switch (checker) { 1447 case 'A': 1448 mouseover(t[i]); 1449 mouseout(t[i]); 1450 break; 1451 case 'B': 1452 mousedown(t[i]); 1453 mouseup2(t[i]); 1454 break; 1455 case 'AB': 1456 mouseover(t[i]); 1457 mouseout(t[i]); 1458 mousedown(t[i]); 1459 mouseup(t[i]); 1460 break; 1461 default: 1462 return; 1463 } 1464 1465 if (t[i].src) { 1466 t[i].setAttribute("oldsrc", t[i].src); 1467 } 1468 } 1469 } 1470} 1471 1472function mouseup(t) { 1473 var newmouseup; 1474 if (t.onmouseup) { 1475 t.oldmouseup = t.onmouseup; 1476 newmouseup = function () { 1477 mouseisdown = 0; 1478 this.src = this.getAttribute("srcover"); 1479 this.oldmouseup(); 1480 } 1481 1482 } else { 1483 newmouseup = function () { 1484 mouseisdown = 0; 1485 this.src = this.getAttribute("srcover"); 1486 } 1487 } 1488 t.onmouseup = newmouseup; 1489} 1490 1491function mouseup2(t) { 1492 var newmouseup; 1493 if (t.onmouseup) { 1494 t.oldmouseup = t.onmouseup; 1495 newmouseup = function () { 1496 mouseisdown = 0; 1497 this.src = this.getAttribute("oldsrc"); 1498 this.oldmouseup(); 1499 } 1500 } else { 1501 newmouseup = function () { 1502 mouseisdown = 0; 1503 this.src = this.getAttribute("oldsrc"); 1504 } 1505 } 1506 t.onmouseup = newmouseup; 1507} 1508 1509function mousedown(t) { 1510 var newmousedown; 1511 if (t.onmousedown) { 1512 t.oldmousedown = t.onmousedown; 1513 newmousedown = function () { 1514 if (mouseisdown == 0) { 1515 this.src = this.getAttribute("srcdown"); 1516 this.oldmousedown(); 1517 } 1518 } 1519 } else { 1520 newmousedown = function () { 1521 if (mouseisdown == 0) { 1522 this.src = this.getAttribute("srcdown"); 1523 } 1524 } 1525 } 1526 t.onmousedown = newmousedown; 1527} 1528 1529function mouseover(t) { 1530 var newmouseover; 1531 if (t.onmouseover) { 1532 t.oldmouseover = t.onmouseover; 1533 newmouseover = function () { 1534 this.src = this.getAttribute("srcover"); 1535 this.oldmouseover(); 1536 } 1537 } else { 1538 newmouseover = function () { 1539 this.src = this.getAttribute("srcover"); 1540 } 1541 } 1542 t.onmouseover = newmouseover; 1543} 1544 1545function mouseout(t) { 1546 var newmouseout; 1547 if (t.onmouseout) { 1548 t.oldmouseout = t.onmouseout; 1549 newmouseout = function () { 1550 this.src = this.getAttribute("oldsrc"); 1551 this.oldmouseout(); 1552 } 1553 } else { 1554 newmouseout = function () { 1555 this.src = this.getAttribute("oldsrc"); 1556 } 1557 } 1558 t.onmouseout = newmouseout; 1559} 1560 1561function storeimages(t) { 1562 var s = (t.getAttribute('src')) ? t.getAttribute('src') : ''; 1563 var d = (t.getAttribute('srcdown')) ? t.getAttribute('srcdown') : ''; 1564 var o = (t.getAttribute('srcover')) ? t.getAttribute('srcover') : ''; 1565 ih.store(s, d, o); 1566} 1567 1568function preloadimgsrc() { 1569 if (!document.getElementById) 1570 return; 1571 var it = document.getElementsByTagName('IMG'); 1572 var it2 = document.getElementsByTagName('INPUT'); 1573 preloader(it); 1574 preloader(it2); 1575} 1576 1577if (window.addEventListener) { 1578 window.addEventListener("load", preloadimgsrc, false); 1579} else { 1580 if (window.attachEvent) { 1581 window.attachEvent("onload", preloadimgsrc); 1582 } else { 1583 if (document.getElementById) { 1584 window.onload = preloadimgsrc; 1585 } 1586 } 1587} 1588 1589function compareSelected(id) { 1590 $('.compareButtonDiv').show(); 1591 window.compare = String(id); 1592 window.compareItems = 1; 1593 $('.adsCompareDiv').each(function (i) { 1594 if ($(this).attr('AdId') != id) { 1595 $(this).html('<input type="button" value="Add" onClick="addCompare(' + $(this).attr('AdId') + ')" />'); 1596 } else { 1597 $(this).html('<input type="button" value="Remove" onClick="removeCompare(' + id + ')" />'); 1598 } 1599 });
1600} 1601 1602function addCompare(id) { 1603 var compare = window.compare; 1604 compare += "-" + id; 1605 window.compare = compare; 1606 window.compareItems++; 1607 $('.adsCompareDiv').each(function (i) { 1608 if ($(this).attr('AdId') == id) { 1609 $(this).html('<input type="button" value="Remove" onClick="removeCompare(' + id + ')" />'); 1610 } 1611 }); 1612} 1613 1614function removeCompare(id) { 1615 var compare = window.compare; 1616 compare = compare.replace("-" + id, ""); 1617 window.compare = compare; 1618 window.compareItems--; 1619 //alert(window.compareItems); 1620 if (window.compareItems == 0) { 1621 $('.compareButtonDiv').hide(); 1622 window.compare = ""; 1623 $('.adsCompareDiv').each(function (i) { 1624 $(this).html('<input type="checkbox" style="border:0px" value="' + $(this).attr('AdId') + '" name="compare[]" class="adsSelectCheckbox" onChange="compareSelected(' + $(this).attr('AdId') + ')"/>'); 1625 }); 1626 } else { 1627 $('.adsCompareDiv').each(function (i) { 1628 if ($(this).attr('AdId') == id) { 1629 $(this).html('<input type="button" value="Add" onClick="addCompare(' + $(this).attr('AdId') + ')" />'); 1630 } 1631 }); 1632 } 1633 1634} 1635 1636function doCompare() { 1637 //return; 1638 var compare = window.compare; 1639 //alert(compare); 1640 var pos = compare.search("-"); 1641 if (pos >= 0) { 1642 window.compare = ""; 1643 location.href = location.href + "#" + compare;
1644 getAdDetails(compare, window.detailsStyle); 1645 } else { 1646 alert('You Have to Select 2 Ads or more'); 1647 } 1648 1649} 1650 1651function pickCompareAd(id) { 1652 //return; 1653 location.href = window.hRef + "#" + id; 1654 getAdDetails(id, window.detailsStyle); 1655} 1656 1657function changeBack(div, color) { 1658 //alert(color); 1659 $("." + div + "Back").css('background-color', color); 1660} 1661 1662function goToPage(x, div) { 1663 //alert('#ESCAdsResponse'+div); 1664 $('#ESCAdsResponse' + div).css('min-height', ""); 1665 $('#ESCAdsResponse' + div).css("overflow", "visible"); 1666 1667 $('#ESCAdsResponse' + div).load('/helper/escadspaging/page/' + x) 1668} 1669 1670function searchAds(div, value) { 1671 //alert(div); 1672 div = div || $('.ESCAdsResponse').attr('id').replace('ESCAdsResponse', ''); 1673 1674 value = $('.adsSearchKeywords').size() > 0 ? encodeURIComponent(htmlEncode($.trim($('.adsSearchKeywords').val()))) : encodeURIComponent(htmlEncode($.trim(value))); 1675 if (!$.trim(value)) 1676 return; 1677 1678 if (window.sid == 1000709 && window.pageName.toLowerCase().indexOf('equipment') == -1 && window.pageName.toLowerCase().indexOf('all-used-items') == -1) { 1679 location.href = '/All-Used-Items/search/' + value + '/'; 1680 return; 1681 } else if (window.sid == 1000754 && window.pageName.toLowerCase().indexOf('all-used-items') == -1) { 1682 location.href = '/all-used-items/search/' + value + '/'; 1683 return; 1684 } 1685 var href = '/' + window.pageName + '/search/' + value + '/'; 1686 //callLoadContent(href); 1687 history.pushState(null, href, href); 1688 1689 var locHash = href; //.replace(window.pageName,''); 1690 locHash = locHash.split("/"); 1691 //console.log( locHash ); 1692 1693 if ($.trim(value)) { 1694 setPageTitle("Search Result for :" + value); 1695 setPageDescription("Search Result for :" + value); 1696 var query = locHash[1]; 1697 if (value && $('.adsSearchKeywords').val() != 'Enter search terms separated by comma') { 1698 var formData = $('#ESCAdsResponse' + div).find('select').serializeObject(); 1699 window.searchValue = htmlEncode(decodeURIComponent(value)); 1700 filterAds("search", value, div, formData); 1701 } else { 1702 window.searchValue = ''; 1703 filterAds("search", "all", div); 1704 } 1705 1706 } 1707 1708} 1709 1710function cLoan(randDivId) { 1711 var $target = $('#' + randDivId); 1712 var $form = $target.find('form'); 1713 var formData = $form.serializeObject(); 1714 if (formData.amount > 100) { 1715 $.post('/helper/loan-Schedule-Comp', formData, function (res) { 1716 $target.find('.response').html(res); 1717 }) 1718 } 1719 1720} 1721 1722function filterAds(filter, value, div, formData) { 1723 if (window.paramUrl.indexOf('legacy') === -1) { 1724 window.customFilter[filter] = value; 1725 // console.log([filter, value, div, window.customFilter]); 1726 modernFilterEvent(); 1727 return; 1728 } else { 1729 window.hRefHash = location.hash; 1730 formData = formData || $('#ESCAdsResponse' + div).find('select').serializeObject(); 1731 if (jQuery.trim(value) != "" && jQuery.trim(value) != undefined && value != "Entersearchtermsseparatedbycomma") { 1732 $('html,body').css({ 1733 'cursor': 'wait' 1734 }); 1735 var order = $('#order').val() == undefined ? '' : $('#order').val(); 1736 if (window.reset == true) { 1737 filter = 'reset'; 1738 value = 1; 1739 window.reset = false; 1740 formData = {}; 1741 window.searchValue = ''; 1742 } 1743 value = String(value); 1744 //var url = '/helper/escadsfilter/?' + filter + '=' + value.replace( /\./g, '%2E' ) + '&filters[order]=' + order + '&pcompid=' + $( '#ESCAdsResponse' + div ).attr( 'rel' ) + ( window.searchValue ? '&search=' + window.searchValue : '&search=' ); 1745 var url = '/helper/escadsfilter/?' + filter + '=' + value.replace(/\./g, '%2E') + '&order=' + order + '&pcompid=' + $('#ESCAdsResponse' + div).attr('rel') + (window.searchValue ? '&search=' + window.searchValue : '&search='); 1746 $('#ESCAdsResponse' + div).css('min-height', ""); 1747 $('#ESCAdsResponse' + div).css("overflow", "visible"); 1748 $.post(url, formData, function (data) { 1749 1750 $('#ESCAdsResponse' + div).parents('.contentComp').html(data); 1751 1752 $.fn.matchHeight._update(); 1753 1754 setTimeout(function () { 1755 onAdsListLoad(); 1756 }, 2000) 1757 $('html,body').css({ 1758 'cursor': 'default' 1759 }); 1760 $('#ESCAdsResponse' + div).removeAttr("style"); 1761 if (filter == "search") { 1762 window.filterType = "Search"; 1763 if (value == "all") { 1764 window.searchValue = ""; 1765 } 1766 } else { 1767 window.filterType = ""; 1768 } 1769 1770 $('.adsSearchKeywords').val(window.searchValue); 1771 $("select[name='" + filter + "']").addClass('selectBorder'); 1772 1773 }); 1774 } else {
1775 alert("Please enter at least 1 word in the search field."); 1776 } 1777 //console.log('URL From font_end.js.php', url); 1778 } 1779} 1780 1781function highlightValues(value, div) { 1782 // $('#ESCAdsResponse'+div).text($('#ESCAdsResponse'+div).text().replace((new RegExp(value, 'gi')),'adsSearchResults'+value)); 1783 $('#ESCAdsResponse' + div).html($('#ESCAdsResponse' + div).html().replace((new RegExp(value, 'gi')), '<span class="adsSearchResults">' + value + '</span>')); 1784} 1785 1786function unloadEscAds() { 1787 return; 1788 $('.unload').load("/helper/unloadescitems"); 1789} 1790 1791function ScrollToElement(theElement) { 1792 1793 var selectedPosX = 0; 1794 var selectedPosY = 0; 1795 1796 while (theElement != null) { 1797 selectedPosX += theElement.offsetLeft; 1798 selectedPosY += theElement.offsetTop; 1799 theElement = theElement.offsetParent; 1800 } 1801 1802 window.scrollTo(selectedPosX, selectedPosY); 1803 1804} 1805 1806function backTo(url) { 1807 /*history.back(); //replaced wiht my code below -Abdallah 24-8-2025 */ 1808 1809 // Check if there's history to go back to 1810 if (document.referrer && document.referrer.indexOf(window.location.host) !== -1) { 1811 1812 // If referrer is from same domain, go back 1813 history.back(); 1814 } else if (document.referrer.length> 0 && window.history.length > 1) { 1815 1816 // Try going back if there's history 1817 history.back(); 1818 } else if (window.pageName == "items") { 1819 1820 // No history - navigate to the provided URL (likely SRP) 1821 window.location.href = '/'; 1822 } 1823 else{ 1824 window.location.href = '/'+pageName; 1825 } 1826 return; 1827 var newHref = location.pathname; 1828 //console.log( location.pathname, history.length ); 1829 //console.log( newHref, newHref.split( '/' ) ); 1830 //setPageTitle(''); 1831 //setPageDescription(''); 1832 1833 if (newHref.indexOf('adid') != -1) { 1834 var newHref = location.pathname; 1835 newHref = newHref.split('/'); 1836 newHref = '/' + newHref[1] + '/'; 1837 1838 location.href = newHref; 1839 } else if (history.length > 1 && newHref.indexOf('randad') == -1) { 1840 1841 history.back(); 1842 } else { 1843 var newHref = location.pathname; 1844 newHref = newHref.split('/'); 1845 newHref = '/' + newHref[1] + '/'; 1846 1847 location.href = newHref; 1848 } 1849 return; 1850 if (location.href != window.hRef && window.hRef != undefined) 1851 location.href = window.hRef; 1852 else 1853 location.hash = window.hRefHash != undefined ? window.hRefHash : ''; 1854 return; 1855 /*history.back(); 1856 return;*/ 1857 var pageType = window.pageType; 1858 url = encode64(url); 1859 url = "/helper/backtoprev/url/" + url + "/pageType/" + pageType; 1860 document.title = window.pageTitle; 1861 $(window).unbind('hashchange'); 1862 location.hash = ''; 1863 1864 var responseDiv = window.responseDiv; 1865 if (responseDiv === undefined) { 1866 responseDiv = "CenterDiv"; 1867 } else { 1868 responseDiv = "ESCAdsResponse" + responseDiv; 1869 } 1870 1871 $('#' + responseDiv).load(url, function () { 1872 if (window.hashPos != '' || window.hashPos != undefined) { 1873 //ScrollToElement(document.getElementById(window.hashPos)); 1874 window.scrollTo(0, window.divTop); 1875 //window.hashPos = ''; 1876 } 1877 1878 }); 1879 1880} 1881 1882function clearMeCheck(theClass, value) { 1883 if ($("." + theClass).val() == value) { 1884 $("." + theClass).val(""); 1885 } 1886} 1887 1888function emptyCheck(theClass, value) { 1889 //return; 1890 if ($("." + theClass).val() == "") { 1891 $("." + theClass).attr('placeholder', value); 1892 } 1893} 1894 1895function emptyCheck2(e, value) { 1896 return; 1897 if (e.val() == "") { 1898 e.attr('placeholder', value); 1899 } 1900} 1901 1902$(document).on('click', ".adsSearchKeywords", function () { 1903 if ($(".adsSearchKeywords").val() == "Enter search terms separated by comma") { 1904 $(".adsSearchKeywords").val(""); 1905 } 1906}); 1907 1908$(document).on('focusout', ".adsSearchKeywords", function () { 1909 //if($(".adsSearchKeywords").val() == ""){ 1910 //emptyCheck('adsSearchKeywords','Enter search terms separated by comma'); 1911 //} 1912 var e = $(this); 1913 if (e.val() == "") { 1914 emptyCheck2(e, 'Enter search terms separated by comma') 1915 } 1916}); 1917 1918$(document).on('focusout', ".firstName", function () { 1919 //if($(".firstName").val() == ""){ 1920 //emptyCheck('firstName','First Name*') 1921 //} 1922 var e = $(this); 1923 if (e.val() == "") { 1924 emptyCheck2(e, 'First Name*') 1925 } 1926}); 1927$(document).on('focusout', ".lastName", function () { 1928 //if($(".lastName").val() == ""){ 1929 //emptyCheck('lastName','Last Name*') 1930 //} 1931 var e = $(this); 1932 if (e.val() == "") { 1933 emptyCheck2(e, 'Last Name*') 1934 } 1935}); 1936$(document).on('focusout', ".phone", function () { 1937 //if($(".phone").val() == ""){ 1938 //emptyCheck('phone','Telephone*') 1939 //} 1940 var e = $(this); 1941 if (e.val() == "") { 1942 emptyCheck2(e, 'Telephone*') 1943 } 1944}); 1945$(document).on('focusout', ".email", function () { 1946 var e = $(this); 1947 if (e.val() == "") { 1948 emptyCheck2(e, 'Email*') 1949 } 1950}); 1951$(document).on('focusout', ".comment", function () { 1952 //if($(".comment").val() == ""){ 1953 //emptyCheck('comment','Comments*') 1954 //} 1955 var e = $(this); 1956 if (e.val() == "") { 1957 emptyCheck2(e, 'Comments*') 1958 } 1959}); 1960 1961function changeView(view, div) { 1962 //$('#ESCAdsFiltering').remove(); 1963 var url = '/helper/changeview/view/' + view; 1964 //alert(url); 1965 1966 $('#ESCAdsResponse' + div).load(url, function (data) { 1967 1968 $('#ESCAdsResponse' + div).removeAttr("style"); 1969 1970 });
1971} 1972 1973function refreshCaptcha(div) { 1974 var url = '/helper/createnewcaptcha'; 1975 //alert(url); 1976 1977 $('.captcha' + div).load(url); 1978} 1979 1980function getAdDetails(id, style, quantityShow, odometerShow) { 1981 $('#' + responseDiv).css('height', "").css("overflow", "visible") 1982 .css('min-height', "").css("overflow", "visible"); 1983 1984 //$('.parentDiv').css("height",""); 1985 //$('.parentDiv').css('min-height',""); 1986 var taxesDisplay = window.taxesDisplay; 1987 var newWindow = window.newWindow; 1988 var responseDiv = window.responseDiv; 1989 //console.log('ddd333334444', responseDiv); 1990 if (responseDiv === undefined) { 1991 responseDiv = "CenterDiv"; 1992 } else { 1993 responseDiv = "ESCAdsResponse" + responseDiv; 1994 } 1995 1996 var price_d = $('#price_d').val(); 1997 var show_msrp_details = $('#show_msrp_details').val(); 1998 1999 var categoryName = window.categoryName; 2000 var subCatName = window.subCatName; 2001 if (categoryName === undefined) { 2002 categoryName = "Previous"; 2003 } 2004 if (id.search("-") >= 0) { 2005 $('#' + responseDiv).load('/helper/addetails/', { 2006 compare: id, 2007 style: style, 2008 quantityShow: quantityShow, 2009 odometerShow: odometerShow, 2010 categoryName: categoryName, 2011 subCatName: subCatName, 2012 paramDetailsHeader: window.paramDetailsHeader, 2013 dealerId: window.ESCADSdealerId, 2014 logo: window.logo, 2015 taxesDisplay: taxesDisplay, 2016 price_d: price_d, 2017 pageName: window.pageName, 2018 show_msrp_details: show_msrp_details 2019 }, function () { 2020 2021 CaptchaCallback(); 2022 $.fn.matchHeight._update(); 2023 2024 /* $( ".lightbox" ).fancybox( { 2025 'overlayShow': false, 2026 'width': 570, 2027 'height': 600, 2028 'autoScale': false, 2029 'autoDimensions': true, 2030 'centerOnScroll': false 2031 } );*/ 2032 $(".lightbox2").fancybox({ 2033 'overlayShow': false, 2034 'width': 650, 2035 'height': 600, 2036 'autoScale': false, 2037 'autoDimensions': true, 2038 'centerOnScroll': false 2039 }); 2040 2041 window.scrollTo(0, 0); 2042 FixImagesHeightDetailsView(); 2043 2044 }); 2045 } else { 2046 //alert(window.logo); 2047 if (window.escComps == 'escComp' && window.escCompsResponsive && window.escCompsResponsive == 'responsive1') { 2048 //window.detailsDisplay = 'responsive1_vertical'; 2049 window.detailsDisplay = 'responsive1_vertical_escComp'; 2050 } 2051 //console.log('object before sending', window.detailsDisplay, window.escComps); 2052 2053 $('#' + responseDiv).load('/helper/addetails/', { 2054 adId: id, 2055 style: style, 2056 quantityShow: quantityShow, 2057 odometerShow: odometerShow, 2058 categoryName: categoryName, 2059 subCatName: subCatName, 2060 view: window.view, 2061 detailsDisplay: window.customDetailsDisplay ? window.customDetailsDisplay : window.detailsDisplay, 2062 paramDetailsHeader: window.paramDetailsHeader, 2063 dealerId: window.ESCADSdealerId, 2064 logo: window.logo, 2065 taxesDisplay: taxesDisplay, 2066 price_d: price_d, 2067 pageName: window.pageName, 2068 show_msrp_details: show_msrp_details 2069 }, function (res) { 2070 //console.log(res); 2071 if ($('.breadcrumbParent').size()) { 2072 var $last = $('.breadcrumbParent').find('li').last(); 2073 $last.removeClass('active').html('<a href="' + $last.data('url') + '">' + $last.text() + '</a>'); 2074 $('.breadcrumbParent ol.breadcrumb').append('<li class="breadcrumb-item active" aria-current="page" >' + $('title').html().split('|')[1] + '</li>'); 2075 2076 } 2077 if ($('.ShowReadMore').length) { 2078 2079 var oldHeight = 0; 2080 $('.ShowReadMore').readmore({ 2081 speed: 250, 2082 heightMargin: 20, 2083 collapsedHeight: CalcRightHeights(), 2084 moreLink: '<a href="#" style="margin-top: 15px;">Read more ...</a>', 2085 lessLink: '<a href="#" style="margin-top: 15px;" >Read less</a>', 2086 beforeToggle: function () { 2087 $.fn.matchHeight._update(); 2088 }, 2089 afterToggle: function () { 2090 $.fn.matchHeight._update(); 2091 } 2092 }); 2093 } 2094 window.scrollTo(0, 0); 2095 /*if ( $( ".lightbox" ).size() ) { 2096 $( ".lightbox" ).fancybox( { 2097 'overlayShow': false, 2098 'width': 570, 2099 'height': 600, 2100 'autoScale': false, 2101 'autoDimensions': true, 2102 'centerOnScroll': false 2103 } ); 2104 }*/ 2105 if ($(".lightbox2").size()) { 2106 $(".lightbox2").fancybox({ 2107 'overlayShow': false, 2108 'width': 650, 2109 'height': 600, 2110 'autoScale': false, 2111 'autoDimensions': true, 2112 'centerOnScroll': false 2113 }); 2114 } 2115 if ($(".lightbox3").size()) { 2116 $(".lightbox3").fancybox({ 2117 'overlayShow': false, 2118 'width': 550, 2119 'height': 420, 2120 'autoScale': false, 2121 'autoDimensions': true, 2122 'centerOnScroll': false 2123 }); 2124 } 2125 FixImagesHeightDetailsView(); 2126 CaptchaCallback(); 2127 $.fn.matchHeight._update(); 2128 2129 $("img[onmouseover*='.pdf'],img[onmouseover*='.pptx']").each(function (i, elm) { 2130 2131 var plink = $(elm).attr('onmouseover').match(/'([^']+)',/); 2132 var FileName = plink[1].split('/'); 2133 //console.log( plink, FileName ); 2134 FileName = FileName[FileName.length - 1]; 2135 //var ShortFileName = FileName.length > 10 ? FileName.substr(0, 10) + '' : FileName; 2136 var ShortFileName = $(elm).attr('title') ? $(elm).attr('title') : FileName.replace('.pdf', '').replace('.pptx', '').replace('-', ' ').replace('_', ' '); 2137 if (plink[1].indexOf('equipmentsearch.com') == -1) { 2138 2139 plink[1] = "https://equipmentsearch.com" + plink[1]; 2140 var Icon = 'https://equipmentsearch.com/images/downloads3.png'; 2141 } 2142 if (plink[1].indexOf('.pdf') != -1) { 2143 2144 //plink[ 1 ] = "/helper/viewpdf/tar/" + btoa( plink[ 1 ] ); 2145 var Icon = '/images/pdf-icon2.png'; 2146 } 2147 2148 $(elm).remove(); 2149 var _html = '<div class="col-lg-4 col-md-3 text-left"><a href="' + plink[1] + '" target="_blank" title="' + FileName + '"><img src="' + Icon + '" width="72" alt="' + FileName + '" class="img-thumbnail" style="margin:10px" /><br />' + ShortFileName + '</a></div>'; 2150 if ($('#DocumentsDiv').size() == 0) { 2151 $("div:contains('Click on photo for gallery')").parent('td').append('<div id="DocumentsDiv" style="padding:5px;margin:5px"><b>Documents : </b><br /> <a href="' + plink[1] + '" target="_blank" style="text-align:center;float:left;over-flow:hidden;margin:5px" title="' + FileName + '"><img src="' + Icon + '" width="72" alt="' + FileName + '" /><br />' + ShortFileName + '</a></div>'); 2152 if (isResponsiveMode) { 2153 $("#DocumentsDiv_responsive").append('<div id="DocumentsDiv" class="col-lg-12" style="margin-top: 15px;"><strong>Documents :</strong></div>'); 2154 $('#DocumentsDiv').append('<div class="row">' + _html + '</div>'); 2155 } 2156 } else { 2157 if (isResponsiveMode) { 2158 $('#DocumentsDiv .row').append(_html); 2159 } else { 2160 $('#DocumentsDiv .row').append('<a href="' + plink[1] + '" target="_blank" style="text-align:center;float:left;over-flow:hidden;margin:5px" title="' + FileName + '"><img src="' + Icon + '" width="64" alt="' + FileName + '" class="img-thumbnail"/><br />' + ShortFileName + '</a>'); 2161 } 2162 } 2163 2164 }) 2165 }); 2166 } 2167 2168} 2169
2170function getRandomAdDetails(id, style) { 2171 var menuPos = $("#siteMenu").attr("pos"); //$('#CenterDiv').height(500); 2172 //console.log("menu pos is : ", menuPos); 2173 $('#CenterDiv').css('height', ""); 2174 $('#CenterDiv').css("overflow", "visible"); 2175 if (menuPos == 2) { 2176 //$('#CenterDiv').width($('#CenterDiv').width()+$('#LeftDiv').width()-10); 2177 var leftWidth = $('#LeftDiv').width(); 2178 var centerWidth = $('#CenterDiv').width(); 2179 centerWidth += leftWidth - 4; 2180 $('#LeftDiv').hide(); 2181 $('#LeftDiv').width('0'); 2182 $('#CenterDiv').width(centerWidth); 2183 } else if (menuPos == 4) { 2184 //$('#CenterDiv').width($('#CenterDiv').width()+$('#RightDiv').width()-$('#LeftDiv').width()); 2185 var rightWidth = $('#RightDiv').width(); 2186 var centerWidth = $('#CenterDiv').width(); 2187 centerWidth += rightWidth - 2; 2188 $('#RightDiv').hide(); 2189 $('#RightDiv').width('0'); 2190 $('#CenterDiv').width(centerWidth); 2191 } else { 2192 2193 $('#LeftDiv').width('0'); 2194 $('#RightDiv').width('0'); 2195 $('#LeftDiv').hide(); 2196 $('#RightDiv').hide(); 2197 $('#CenterDiv').width('100%'); 2198 } 2199 //Basem 2200 if ($('#CenterDiv').width() > $('#parent').width()) { 2201 $('#CenterDiv').width($('#parent').width()); 2202 } 2203 var details_width_style = $('#details_width_style').val(); 2204 //console.log('details_width_style is :', details_width_style); 2205 //console.log('CenterDiv width is :', $('#CenterDiv').width()); 2206 $('#CenterDiv').load('/helper/addetails/', { 2207 adId : id, 2208 style : style, 2209 categoryName : 'Previous', 2210 view : window.view, 2211 detailsDisplay: window.detailsDisplay, 2212 paramDetailsHeader: window.paramDetailsHeader, 2213 dealerId: window.ESCADSdealerId, 2214 taxesDisplay: taxesDisplay, 2215 pageName: window.pageName, 2216 details_width_style: details_width_style 2217 }, function () { 2218 2219 /*$( ".lightbox" ).fancybox( { 2220 'overlayShow': false, 2221 'width': 570, 2222 'height': 600, 2223 'autoScale': false, 2224 'autoDimensions': true, 2225 'centerOnScroll': false 2226 } );*/ 2227 $(".lightbox2").fancybox({ 2228 'overlayShow': false, 2229 'width': 650, 2230 'height': 600, 2231 'autoScale': false, 2232 'autoDimensions': true, 2233 'centerOnScroll': false 2234 }); 2235 $(".lightbox3").fancybox({ 2236 'overlayShow': false, 2237 'width': 550, 2238 'height': 420, 2239 'autoScale': false, 2240 'autoDimensions': true, 2241 'centerOnScroll': false 2242 }); 2243 2244 FixImagesHeightDetailsView(); 2245 window.scrollTo(0, 0); 2246 CaptchaCallback(); 2247 $.fn.matchHeight._update(); 2248 2249 }); 2250 2251} 2252 2253function encode64(input) { 2254 var keyStr = "ABCDEFGHIJKLMNOP" + 2255 "QRSTUVWXYZabcdef" + 2256 "ghijklmnopqrstuv" + 2257 "wxyz0123456789+/" + 2258 "="; 2259 input = escape(input); 2260 var output = ""; 2261 var chr1, 2262 chr2, 2263 chr3 = ""; 2264 var enc1, 2265 enc2, 2266 enc3, 2267 enc4 = ""; 2268 var i = 0; 2269 2270 do { 2271 chr1 = input.charCodeAt(i++); 2272 chr2 = input.charCodeAt(i++); 2273 chr3 = input.charCodeAt(i++); 2274 2275 enc1 = chr1 >> 2; 2276 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); 2277 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); 2278 enc4 = chr3 & 63; 2279 2280 if (isNaN(chr2)) { 2281 enc3 = enc4 = 64; 2282 } else if (isNaN(chr3)) { 2283 enc4 = 64; 2284 } 2285 2286 output = output + 2287 keyStr.charAt(enc1) + 2288 keyStr.charAt(enc2) + 2289 keyStr.charAt(enc3) + 2290 keyStr.charAt(enc4); 2291 chr1 = chr2 = chr3 = ""; 2292 enc1 = enc2 = enc3 = enc4 = ""; 2293 } while (i < input.length); 2294 2295 return output; 2296} 2297 2298function FixImagesHeightDetailsView() { 2299 /*console.log("After Loading .......", new Date()); 2300 window._max_height_thumbnail = 0; 2301 $('[class*="hidden_img_"]').each(function(i, e){ 2302 2303 if(window._max_height_thumbnail < $(e).height()){ 2304 window._max_height_thumbnail = $(e).height(); 2305 } 2306 });
2307 var _new_height = $('#imgWidth').closest('.img-parent').height(); 2308 2309 width = 1024; 2310 height = 768; 2311 2312 ratio_orig = width_orig/height_orig; 2313 2314 if (width/height > ratio_orig) { 2315 width = height*ratio_orig; 2316 } else { 2317 height = width/ratio_orig; 2318 } 2319 */ 2320 2321 var _new_height = 0; 2322 var _new_width = 0; 2323 2324 $('.img-thumbnail').each(function (i, elm) { 2325 if (_new_height < parseInt($(elm).attr('oheight'))) 2326 _new_height = parseInt($(elm).attr('oheight')); 2327 2328 if (_new_width < parseInt($(elm).attr('owidth'))) 2329 _new_width = parseInt($(elm).attr('owidth')); 2330 2331 }) 2332 var ratio_orig = _new_width / _new_height; 2333 2334 /*if(window._max_height_thumbnail < _new_height){ 2335 window._max_width_thumbnail = $('#imgWidth').closest('.img-parent').width(); 2336 //console.log($('#imgWidth').closest('.img-parent').width()); 2337 window._max_height_thumbnail = _new_height; 2338 }*/ 2339 window._max_width_thumbnail = $('#imgWidth').closest('.img-parent').width(); 2340 2341 //console.log(ratio_orig,window._max_width_thumbnail/ratio_orig); 2342 2343 2344 $('[class*="hidden_img_"]').css({ 2345 'height': '75px', 2346 'visibility': 'visible' 2347 }); 2348 $('#bigImageDiv img').css({ 2349 'visibility': 'visible' 2350 }); 2351 if (_new_height > 0) { 2352 window._max_height_thumbnail = (window._max_width_thumbnail / ratio_orig); 2353 window._max_height_thumbnail = window._max_height_thumbnail > _new_height ? _new_height : window._max_height_thumbnail; 2354 //console.log(_new_height,_max_height_thumbnail); 2355 $('#bigImageDiv').css({ 2356 'height': _max_height_thumbnail + 'px' 2357 }); 2358 2359 $('.img-parent').css({ 2360 'min-height': _max_height_thumbnail + 'px' 2361 }); 2362 } 2363} 2364 2365function loadPhoto(url, div) { 2366 url = url.replace("t_", "_"); 2367 url = url.replace("t.", "."); 2368 div = div == 'bigImageDiv' ? '.bigImageDiv' : '#' + div; 2369 2370 if (window.detailsDisplay == "vertical" || window.detailsDisplay == "vertical2") { 2371 $(div).html('<img src="http://www.equipmentsearch.com/resize.php?image=' + url + '" width="580" style="max-height:450px" class="thumb" border="0" alt="Listing image" />'); 2372 } else if (window.detailsDisplay == "new1" || window.detailsDisplay == "Sideways2") { 2373 $(div).html('<img src="http://www.equipmentsearch.com/resize.php?image=' + url + '" width="344" style="max-height:300px" class="thumb" border="0" alt="Listing image" /><br />'); 2374 } else if (window.detailsDisplay == "responsive1_normal" || window.detailsDisplay == "responsive1_vertical") { 2375 var _max_width = window._max_width_thumbnail; 2376 var _max_height = window._max_height_thumbnail; 2377 $(div).html('<img src="http://www.equipmentsearch.com/resize.php?image=' + url + '" style="max-height:' + _max_height + 'px; max-width:' + _max_width + 'px" class="thumb" border="0" alt="Listing image" /><br />'); 2378 2379 } else { 2380 $(div).html('<img src="http://www.equipmentsearch.com/resize.php?image=' + url + '" width="400" style="max-height:350px" class="thumb" border="0" alt="Listing image" />'); 2381 } 2382} 2383 2384$(document).ready(function () { 2385 if ($('.ShowReadMore').length) { 2386 2387 var oldHeight = 0; 2388 $('.ShowReadMore').readmore({ 2389 speed: 250, 2390 heightMargin: 20, 2391 collapsedHeight: 400, 2392 moreLink: '<a href="#" style="margin-top: 15px;">Read more ...</a>', 2393 lessLink: '<a href="#" style="margin-top: 15px;" >Read less</a>', 2394 beforeToggle: function () { 2395 $.fn.matchHeight._update(); 2396 }, 2397 afterToggle: function () { 2398 $.fn.matchHeight._update(); 2399 } 2400 }); 2401 } 2402 //alert($('#FooterDiv').height()); 2403 //$('#LeftDiv,#RightDiv,#CenterDiv').addClass('parentDiv'); 2404 2405 if ($('.encrypted').size() > 0) { 2406 2407 //document.addEventListener('contextmenu', event => event.preventDefault()); 2408 $('.encrypted').each(function (i, elm) { 2409 $(elm).html(window.atob($(elm).html())).show(); 2410 }) 2411 } 2412 2413 $('.adsSearchKeywords').val(window.searchValue); 2414 2415 var locHash = location.hash; 2416 if ($.trim(locHash) && locHash.indexOf('#') != -1) { 2417 /*var newHref = locHash.split( '/' ); 2418 newHref.splice( 0, 1 ); 2419 newHref = newHref.join( '/' ); 2420 loadContent( newHref ); */ 2421 } else { 2422 if (location.hash.indexOf('modernFilter') !== -1) { 2423 loadContent(location.hash); 2424 } 2425 var newHref = location.pathname; 2426 newHref = newHref.split('/'); 2427 newHref.splice(0, 1); 2428 newHref.splice(0, 1); 2429 if (window.redirctPageName) { 2430 newHref.splice(0, 1); 2431 } 2432 /*if ( newHref.length > 1 ) { 2433 newHref = newHref.join( '/' ); 2434 if( location.pathname.indexOf('adid/') == -1 ){ 2435 loadContent( newHref ); 2436 } 2437 2438 }*/ 2439 } 2440 var counter = 1; 2441 $(document).on("click", '.loanCalc', function () { 2442 var prin = $("input[name='prin']").val(); 2443 var theInt = $("input[name='theInt']").val(); 2444 var years = $("select[name='years']").val(); 2445 var howoften = $("select[name='howoften']").val(); 2446 var show_amort = $("input:radio[name='show_amort']:checked").val(); 2447 //alert(url); 2448 if ($("input[name='counter']").val() == "first") { 2449 //alert(counter); 2450 var menuPos = $("#siteMenu").attr("pos"); 2451 //alert(menuPos); 2452 if (menuPos == 2) { 2453 //$('#CenterDiv').width($('#CenterDiv').width()+$('#LeftDiv').width()-10); 2454 $('#LeftDiv').hide(); 2455 } else if (menuPos == 4) { 2456 //$('#CenterDiv').width($('#CenterDiv').width()+$('#RightDiv').width()-$('#LeftDiv').width()); 2457 $('#RightDiv').hide(); 2458 } else { 2459 $('#LeftDiv').hide(); 2460 $('#RightDiv').hide(); 2461 $('#CenterDiv').width($('#CenterDiv').width() + $('#RightDiv').width() + $('#LeftDiv').width()); 2462 } 2463 } 2464 var url = '/cgi-bin/calculator.cgi?prin=' + prin + '&theInt=' + theInt + '&years=' + years + '&howoften=' + howoften + '&show_amort=' + show_amort + '&width=' + $('#CenterDiv').width(); 2465 2466 //$('.loanCalcContainerDiv').width($('#CenterDiv').width()-10); 2467 $('.loanCalcResponse').load("/helper/calc", { 2468 url: url 2469 }, function (responseText, textStatus, XMLHttpRequest) { 2470 //alert($("input:radio[name='show_amort']").val()); 2471 $("select[name='years']").val(years).select(); 2472 $("select[name='howoften']").val(howoften).select(); 2473 //$("input:radio").val(show_amort).attr("checked", "checked"); 2474 $("input:radio[name='show_amort']").each(function () { 2475 //alert($(this).val()); 2476 if ($(this).val() == show_amort) { 2477 2478 $(this).attr("checked", "checked"); 2479 } 2480 }); 2481 }); 2482 2483 });
2484 2485 /*$(document).on("click", "a[href^='tel']", function () { 2486 2487 window.gtag('event', 'PhoneLinkClick', { 2488 'send_to': window.send_to['GT'] 2489 }); 2490 })*/ /*Commented becuase it was already added below at line 2655, and the even fire twice on click */ 2491 $(document).on("click", 'td.adDetails,div.adDetails', function () { 2492 if ($(this).parents('a').size() > 0) { 2493 return; 2494 } else { 2495 var href = $(this).attr('rel'); 2496 if (!href) 2497 return false; 2498 else { 2499 callLoadContent(href); 2500 return; 2501 } 2502 2503 divTop = $("#floatdiv").offset(); 2504 window.divTop = parseInt(divTop.top); 2505 var newWindow = window.newWindow; 2506 if (newWindow !== 'show') { 2507 location.hash = adId; 2508 //getAdDetails(adId, window.detailsStyle, window.quantityShow, window.odometerShow); 2509 } else { 2510 //alert(newWindow); 2511 var categoryName = window.categoryName; 2512 var pos = location.hash + "POS"; 2513 pos = pos.replace("#", ""); 2514 if (categoryName === undefined) { 2515 categoryName = "Previous"; 2516 } 2517 if (window.detailsDisplay == "vertical2") { 2518 window.detailsDisplay = "vertical"; 2519 } 2520 if (window.detailsDisplay == "normal2") { 2521 window.detailsDisplay = "normal"; 2522 } 2523 window.detailsUrl = '/helper/newaddetails/adId/' + adId + '/style/' + window.detailsStyle + '/quantityShow/' + window.quantityShow + '/odometerShow/' + window.odometerShow + '/categoryName/' + categoryName + '/view/' + window.view + '/detail
2523sDisplay/' + window.detailsDisplay + '/paramDetailsHeader/' + window.paramDetailsHeader + '/dealerId/' + window.ESCADSdealerId + '/taxesDisplay/' + window.taxesDisplay; 2524 //var sData = ""; 2525 OpenWindow = window.open('/helper/newwindowdetails/adId/' + adId, 'AdDetails', 'width=1000,height=800,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no'); 2526 //OpenWindow.document.write(sData); 2527 location.hash = ""; 2528 2529 } 2530 } 2531 }); 2532 2533 /* $(document).on("click", '.randomAdDetails', function() { 2534 var adId = $(this).attr('rel'); 2535 2536 adId = adId.replace("RANDOM", ""); 2537 location.hash = adId; 2538 //getRandomAdDetails(adId, window.detailsStyle); 2539 });*/ 2540 2541 $(document).on("click", "a[href^='tel']", function () { 2542 window.gtag('event', 'PhoneLinkClick', { 2543 'send_to': window.send_to['GT'] 2544 }); 2545 }) 2546 $(document).on("click", '.detailsFormSubmit', function () { 2547 var id = 1; 2548 var recaptcha_challenge_field = '', 2549 recaptcha_response_field = ''; 2550 var $form = $(this).parents('form'); 2551 //Basem 2552 isResponsiveMode = true; 2553 recaptcha_challenge_field = $form.find('#recaptcha_challenge_field').val(); 2554 recaptcha_response_field = $form.find('#recaptcha_response_field').val(); 2555 var captchaVal = 'true'; 2556 //alert(captchaVal); 2557 2558 if ($form.validate().form()) { 2559 if (((typeof($form.find('#captchaWrapper').find('.captchaSuccess').val()) != 'undefined' || $form.find('.adCaptcha').size() == 0) && isResponsiveMode == false) || isResponsiveMode == true) { 2560 2561 var AdId = $form.find('.detailsFormAdId' + id).val() ? $form.find('.detailsFormAdId' + id).val() : location.hash.replace('#', ''); 2562 AdId = AdId > 0 ? AdId : window.adId; 2563 2564 var g_recaptcha_response = ''; 2565 if ($("[data-size='invisible']").length > 0 ) { 2566 grecaptcha.execute(); 2567 } 2568 setTimeout(function () { 2569 $.each($form.find('.g-recaptcha-response'), function (i, elm) { 2570 if ($(elm).val()) { 2571 g_recaptcha_response = $(elm).val(); 2572 } 2573 }) 2574 2575 if (reCaptchaVersion == 2) { 2576 //console.log(g_recaptcha_response, $form.find('#grecaptcha').size()); 2577 if (!g_recaptcha_response && $form.find('#grecaptcha').size() > 0) { 2578 2579 //alert('You must verfiy the CAPTCHA first'); 2580 2581 Swal.fire({ 2582 icon: 'error', //this 2583 title: "You must verfiy the CAPTCHA first", 2584 timerProgressBar: true, 2585 showConfirmButton: true, 2586 allowOutsideClick: true, 2587 timer: 1500 2588 }) 2589 return; 2590 } 2591 } 2592 $form.find('#detailsFormResponseDiv' + id).html("<img src='/images/loader.gif' />"); 2593 2594 var postData = $form.serializeObject(); 2595 postData.adId = AdId; 2596 postData.PreferredStartDate = $form.find('[name=PreferredStartDate]').val() ? $form.find('[name=PreferredStartDate]').val().toString().replace('/', '-').replace('/', '-') : ''; 2597 postData.lead_type_ignore = 'lead'; 2598 postData.g_recaptcha_response = window.g_recaptcha_response; 2599 postData.pageName = window.pageName; 2600 postData.isResponsiveMode = window.isResponsiveMode; 2601 postData.reCaptchaVersion = reCaptchaVersion; 2602 postData.captcha = captchaVal; 2603 postData.recaptcha_challenge_field = recaptcha_challenge_field; 2604 postData.recaptcha_response_field = recaptcha_response_field; 2605 postData.pathname = location.pathname; 2606 postData.href = location.href; 2607 2608 postData.sid = window.sid; 2609 2610 if (typeof window.gtag === 'function') { 2611 2612 window.gtag('event', 'submit', { 2613 send_to: window.send_to['GAGT'], 2614 event_category: 'form', 2615 event_label: 'Item Enquiry form' 2616 }); 2617 2618 if (window.website_settings.google_tag) { 2619 window.gtag('event', 'conversion', { 2620 'send_to': window.send_to['GT'] 2621 }); 2622 } 2623 } else { 2624 if (typeof window.ga === 'function') { 2625 window.ga('send', 'event', { 2626 eventCategory: 'form', 2627 eventAction: 'submit', 2628 send_to: window.send_to['GA'] 2629 }); 2630 } 2631 } 2632 $.post('/helper/escadscaptcha/', postData, function (data) { 2633 $form.trigger("reset"); //console.log(postData); 2634 allFormsCallback(); 2635 if ($form.find('#detailsFormResponseDiv' + id).size() > 0) { 2636 $form.find('#detailsFormResponseDiv' + id).text(data); 2637 2638 } else { 2639 Swal.fire({ 2640 icon: 'info', 2641 title: data, 2642 showConfirmButton: true 2643 }) 2644 } 2645 2646 if (reCaptchaVersion == 1 && Recaptcha != undefined) { 2647 Recaptcha.reload(); 2648 } else if (reCaptchaVersion == 2) { 2649 2650 grecaptcha.reset($form.find('.g-recaptcha').data('widgetId')); 2651 } 2652 }); 2653 }, 500) 2654 } else { 2655 $form.find('#detailsFormResponseDiv' + id).text("The Captcha is incorrect"); //alert(""); 2656 } 2657 2658 } 2659 });
2660 2661 $(document).on("click", '.financialSubmit', function () { 2662 var id = $(this).parent("td").attr("id"); 2663 var captchaVal = $(".captcha" + id).find("input").val(); 2664 //alert(captchaVal); 2665 if ($('.financeFirstName').val() != "" && $('.financeLastName').val() != "" && $('.financePhone').val() != "" && $('.financeEmail').val() != "" && $('.financeComment').val() != "" && captchaVal != "") { 2666 var AdId = $('.financeAdId').val() ? $('.financeAdId').val() : location.hash.replace('#', ''); 2667 2668 $('#financeResponseDiv' + id).html("<img src='/images/loader.gif' />"); 2669 // url = url.split(' ').join('%20'); 2670 // alert(url); 2671 $.post('/helper/escadscaptcha/', { 2672 captcha: captchaVal, 2673 firstName: $('.financeFirstName').val(), 2674 lastName: $('.financeLastName').val(), 2675 phone: $('.financePhone').val(), 2676 email: $('.financeEmail').val(), 2677 comment: $('.financeComment').val(), 2678 adId: AdId 2679 }, function (data) { 2680 allFormsCallback(); 2681 $('#financeResponseDiv' + id).html(data); 2682 }) 2683 $('.captcha').load("/helper/createnewcaptcha/"); 2684 2685 // history.go(0); 2686 2687 } else { 2688 $('#financeResponseDiv' + id).text("all fields are required"); //alert(""); 2689 } 2690 2691 }); 2692 2693 $(document).on("click", '.emailSubmit', function () { 2694 var id = $(this).parent("td").attr("id") ? $(this).parent("td").attr("id") : $("#formType").val(); 2695 var captchaVal = $(".captcha" + id).find("input").val(); 2696 var emailLinkVal = $(".emailLink").val(); 2697 var lang = $('#lang').val(); 2698 2699 if ($('.emailName').val() != "" && $('.emailEmail').val() != "" && captchaVal != "") { 2700 var AdId = $('.emailAdId').val() ? $('.emailAdId').val() : location.hash.replace('#', ''); 2701 2702 $('#emailResponseDiv' + id).html("<img src='/images/loader.gif' />"); 2703 2704 $.post('/helper/escadscaptcha/', { 2705 captcha: captchaVal, 2706 'g-recaptcha-response': g_recaptcha_response, 2707 firstName: $('.emailName').val(), 2708 email: $('.emailEmail').val(), 2709 emailLink: emailLinkVal, 2710 adId: AdId, 2711 lang: lang, 2712 type: 'email' 2713 }, function (data) { 2714 allFormsCallback(); 2715 $('#emailResponseDiv' + id).show().html(data); 2716 }) 2717 2718 2719 } else { 2720 var _req_text = window.translate("all fields are required"); 2721 $('#emailResponseDiv' + id).show().text(_req_text); //alert(""); 2722 } 2723 2724 }); 2725 2726 $(document).on("click", 'button.genricSubmit,a.genricSubmit', function () { 2727 //console.log(typeof window.gtag); 2728 var $form = $(this).parents('form'); 2729 return genricSubmit($form); 2730 }); 2731 $(document).on("submit", 'form.genricSubmit', function () { 2732 //console.log(typeof window.gtag); 2733 var $form = $(this); 2734 return genricSubmit($form); 2735 }); 2736 2737 if (window.WebsiteModal != false && window.WebsiteModal != undefined) { 2738 var popup = getCookie('popup_' + window.sid); 2739 //alert(popup); 2740 if (popup != 1) { 2741 window.WebsiteModal.modal('show'); 2742 } else if (window.PageModal != false && window.PageModal != undefined) { 2743 var popup = getCookie('popup_' + window.pageId); 2744 if (popup != 1) { 2745 window.PageModal.modal('show'); 2746 } 2747 } 2748 } else if (window.PageModal != false && window.PageModal != undefined) { 2749 var popup = getCookie('popup_' + window.pageId); 2750 if (popup != 1) { 2751 2752 window.PageModal.modal('show'); 2753 } 2754 } 2755 if (window.WebsiteModal != false && window.WebsiteModal != undefined) { 2756 window.WebsiteModal.on('hidden.bs.modal', function () { 2757 //alert('1');
2758 setCookie('popup_' + window.sid, 1); 2759 var popup = getCookie('popup_' + window.pageId); 2760 if (popup != 1 && window.PageModal != false) { 2761 window.PageModal.modal('show'); 2762 } 2763 }) 2764 } 2765 if (window.PageModal != false && window.PageModal != undefined) { 2766 window.PageModal.on('hidden.bs.modal', function () { 2767 //alert('2'); 2768 setCookie('popup_' + window.pageId, 1); 2769 }) 2770 } 2771 2772 }); 2773var Url = { 2774 2775 // public method for url encoding 2776 encode : function (string) { 2777 return escape(this._utf8_encode(string)); 2778 }, 2779 2780 // public method for url decoding 2781 decode : function (string) { 2782 return this._utf8_decode(unescape(string)); 2783 }, 2784 2785 // private method for UTF-8 encoding 2786 _utf8_encode : function (string) { 2787 string = string.replace(/\r\n/g, "\n"); 2788 var utftext = ""; 2789 2790 for (var n = 0; n < string.length; n++) { 2791 2792 var c = string.charCodeAt(n); 2793 2794 if (c < 128) { 2795 utftext += String.fromCharCode(c); 2796 } else if ((c > 127) && (c < 2048)) { 2797 utftext += String.fromCharCode((c >> 6) | 192); 2798 utftext += String.fromCharCode((c & 63) | 128); 2799 } else { 2800 utftext += String.fromCharCode((c >> 12) | 224); 2801 utftext += String.fromCharCode(((c >> 6) & 63) | 128); 2802 utftext += String.fromCharCode((c & 63) | 128); 2803 } 2804 2805 } 2806 2807 return utftext; 2808 }, 2809 2810 // private method for UTF-8 decoding 2811 _utf8_decode : function (utftext) { 2812 var string = ""; 2813 var i = 0; 2814 var c = c1 = c2 = 0; 2815 2816 while (i < utftext.length) { 2817 2818 c = utftext.charCodeAt(i); 2819 2820 if (c < 128) { 2821 string += String.fromCharCode(c); 2822 i++; 2823 } else if ((c > 191) && (c < 224)) { 2824 c2 = utftext.charCodeAt(i + 1); 2825 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); 2826 i += 2; 2827 } else { 2828 c2 = utftext.charCodeAt(i + 1); 2829 c3 = utftext.charCodeAt(i + 2); 2830 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 2831 i += 3; 2832 } 2833 2834 } 2835 2836 return string; 2837 } 2838 2839}
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.