1function JCSmartFilterCustom(ajaxURL, form, params) { 2 this.ajaxURL = ajaxURL; 3 this.form = form; 4 this.link = '/catalog/'; 5 this.sectionLink = $('input[name=section]').val(); 6 this.defLink = `/catalog/${this.sectionLink}/filter/clear/apply/`; 7 this.timerId = null; 8 9 this.reloadLink(`/catalog/${this.sectionLink}/filter/clear/apply/`); 10 this.bindUrlToButton('set_filter'); 11 this.bindUrlToButton('show_map'); 12 this.bindAction(); 13 14} 15 16JCSmartFilterCustom.prototype.bindAction = function () { 17 document.addEventListener('filter-set', e => this.setFilter()); 18} 19 20JCSmartFilterCustom.prototype.reloadLink = function(link) { 21 this.link = link; 22} 23 24JCSmartFilterCustom.prototype.getLink = function() { 25 return this.link; 26} 27 28JCSmartFilterCustom.prototype.getContainer = function () { 29 return this.getForm().closest('#filter-smart-custom'); 30} 31 32JCSmartFilterCustom.prototype.getForm = function () { 33 return document.querySelector('[name=' + this.form + ']'); 34} 35 36JCSmartFilterCustom.prototype.addReload = function() { 37 this.getContainer().classList.add('filter--loading'); 38} 39 40JCSmartFilterCustom.prototype.removeReload = function() { 41 this.getContainer().classList.remove('filter--loading'); 42} 43 44JCSmartFilterCustom.prototype.bindUrlToButton = function (buttonId) { 45 const button = BX(buttonId); 46 if (button) { 47 if (button.type == 'submit') 48 button.type = 'button'; 49 50 const self = this; 51 BX.bind(button, 'click', function () { 52 if(buttonId == 'set_filter') { 53 54 window.location.href = self.getLink(); 55 } else { 56 window.location.href = `${self.getLink()}?map=on`; 57 } 58 59 return false; 60 }); 61 } 62 63}; 64 65JCSmartFilterCustom.prototype.setFilter = function () { 66 let urlObj = {}; 67 let _this = this; 68 69 setTimeout(() => { 70 let dataForm = new FormData(this.getForm()); 71 dataForm.append('ajax', 'y'); 72 73 for (let [name, value] of dataForm) { 74 urlObj[name] = value.replace(/\s+/g, ''); 75 } 76 77 BX.ajax({ 78 'method': 'GET', 79 'dataType': 'json', 80 'url': `/catalog/${_this.sectionLink}/?${BX.ajax.prepareData(urlObj)}`, 81 'data': dataForm, 82 'onsuccess': function (res) { 83 _this.reloadLink(res.FILTER_URL); 84 $('#filter-count').text(`${res.ELEMENT_COUNT} обÑÑвлений`); 85 } 86 }) 87 }, 300); 88} 89 90 91JCSmartFilterCustom.prototype.setFilterSection = function (input) { 92 this.sectionLink = input.value; 93 94 if(this.sectionLink == 'prodazha-zemli-v-sochi'){ 95 document.getElementById('ATT_TOTAL_AREA').style.display = 'none'; 96 document.getElementById('ATT_LEND_AREA').style.display = 'block'; 97 98 document.getElementById('mainCatalogFilter_45_MIN').value = ''; 99 document.getElementById('mainCatalogFilter_45_MAX').value = ''; 100 } 101 else{ 102 document.getElementById('ATT_TOTAL_AREA').style.display = 'block'; 103 document.getElementById('ATT_LEND_AREA').style.display = 'none'; 104 105 document.getElementById('mainCatalogFilter_47_MIN').value = ''; 106 document.getElementById('mainCatalogFilter_47_MAX').value = ''; 107 } 108 109 BX.ajax({ 110 method: 'POST', 111 dataType: 'html', 112 processData: false, 113 scriptsRunFirst: true, 114 url: '/local/ajax/catalogFilter.php', 115 data: { 116 'code': this.sectionLink 117 }, 118 onsuccess: function (data) { 119 const arData = BX.processHTML(data); 120 const doc = document.createElement('html'); 121 doc.innerHTML = arData.HTML; 122 document.getElementById('filter-region-input').innerHTML = doc.querySelector('#filter-region-input').innerHTML; 123 document.getElementById('filter-cost-input').innerHTML = doc.querySelector('#filter-cost-input').innerHTML; 124 //document.getElementById('filter-area-input').innerHTML = doc.querySelector('#filter-area-input').innerHTML; 125 BX.ajax.processScripts(arData.SCRIPT.filter((item) => item.isInternal === true)); 126 window.mainReady(); 127 } 128 }); 129 this.setFilter(); 130}
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.