1FiltroEnum.prototype.actualizaValor = function() { 2 this.valor = this.element.find('input:checked').val() || ""; 3 this.texto = this.element.find('input:checked').text() || ""; 4}; 5 6FiltroTreeMultiple.prototype.actualizaValor = function() { 7 let values=[]; 8 this.element.find('.treeselect input[type="checkbox"]:checked').each(function () { 9 values.push(this.value); 10 }); 11 this.valor = values; 12 13 this.texto = this.element.find('input.chosentree-search').attr('placeholder') 14 if (this.texto === this.element.data('placeholderaux')){ 15 this.texto=''; 16 } 17}; 18 19function updateLegendFilters(){ 20 let $legend = $('#filters-chips'); 21 $legend.html(''); 22 23 let $filterSection = $('#filter-section'); 24 let $filterElements = $filterSection.find('div .filter-element'); 25 26 const createDateChip = (label, desde, hasta, $desdeElem, $hastaElem) => { 27 const wrapper = document.createElement('div'); 28 const chipLabel = document.createElement('span'); 29 const chipValueWrapper = document.createElement('div'); 30 31 wrapper.classList.add('filter-chip'); 32 chipLabel.classList.add('filter-chip-label'); 33 chipLabel.innerText = `${label}: `; 34 chipValueWrapper.classList.add('filter-chip-value-wrapper'); 35 36 if(desde) { 37 const chipValue = document.createElement('div'); 38 chipValue.classList.add('filter-chip-value'); 39 chipValue.innerText = `${document.getElementsByTagName('html')[0].lang === 'es' ? 'De
39sde' : 'Dende'}: ${desde}`; 40 chipValueWrapper.appendChild(chipValue); 41 42 if (!$desdeElem.prop("disabled")) { 43 const chipClose = document.createElement('i'); 44 chipClose.classList.add('fa-solid', 'fa-circle-xmark'); 45 chipClose.onclick = () => { 46 $desdeElem.val(''); 47 $desdeElem.trigger('change'); 48 } 49 chipValue.appendChild(chipClose); 50 } 51 } 52 53 if(hasta) { 54 const chipValue = document.createElement('div'); 55 chipValue.classList.add('filter-chip-value'); 56 chipValue.innerText = `${document.getElementsByTagName('html')[0].lang === 'es' ? 'Hasta' : 'Ata'}: ${hasta}`; 57 chipValueWrapper.appendChild(chipValue); 58 59 if (!$hastaElem.prop("disabled")) { 60 const chipClose = document.createElement('i'); 61 chipClose.classList.add('fa-solid', 'fa-circle-xmark'); 62 chipClose.onclick = () => { 63 $hastaElem.val(''); 64 $hastaElem.trigger('change'); 65 } 66 chipValue.appendChild(chipClose); 67 } 68 } 69 70 if(!desde && !hasta) { 71 const chipValue = document.createElement('div'); 72 chipValue.classList.add('filter-chip-value'); 73 chipValue.innerText = "Todos"; 74 chipValueWrapper.appendChild(chipValue); 75 } 76 77 wrapper.appendChild(chipLabel); 78 wrapper.appendChild(chipValueWrapper); 79 return wrapper; 80 }; 81 82 /** 83 * 84 * @param {String} label The name of the chips 85 * @param {Map} values The values to print as chips as a map of ID and text value of the check 86 * @returns {HTMLElement} 87 */ 88 const createMultipleSelectorChip = (label, values, $inputElem) => { 89 const wrapper = document.createElement('div'); 90 const chipLabel = document.createElement('span'); 91 const chipValueWrapper = document.createElement('div'); 92 93 wrapper.classList.add('filter-chip'); 94 chipLabel.classList.add('filter-chip-label'); 95 chipLabel.innerText = `${label}: `; 96 chipValueWrapper.classList.add('filter-chip-value-wrapper'); 97 98 if(values.size === 0) { 99 const chipValue = document.createElement('div'); 100 chipValue.classList.add('filter-chip-value'); 101 chipValue.innerText = "Todos"; 102 chipValueWrapper.appendChild(chipValue); 103 } 104 105 for (const [key, value] of values.entries()) { 106 const chipValue = document.createElement('div'); 107 chipValue.classList.add('filter-chip-value'); 108 chipValue.innerText = value; 109 chipValueWrapper.appendChild(chipValue); 110 111 const chipClose = document.createElement('i'); 112 chipClose.classList.add('fa-solid', 'fa-circle-xmark'); 113 chipClose.onclick = () => { 114 $inputElem.find(`#choice_${key}`).prop("checked", false); 115 $inputElem.find(`#choice_${key}`).trigger('change'); 116 } 117 chipValue.appendChild(chipClose); 118 } 119 120 wrapper.appendChild(chipLabel); 121 wrapper.appendChild(chipValueWrapper); 122 return wrapper; 123 }; 124 125 $filterElements.each((_index, elem) => { 126 let $elem = $(elem); 127 let $label = $($elem.find('label').get(0)); 128 // let label = this.children[0].textContent; 129 // let text; 130 // let removeH; 131 // let checkId; 132 133 if (($elem.find('label').hasClass('qfdefault')) && $elem.hasClass('hidden')) { 134 if (!$elem.find('label').hasClass('filter-hidden')) { 135 $elem.removeClass('hidden'); 136 } 137 } 138 139 if ($elem.find('.date').length > 0 || $elem.find('.number').length > 0) { 140 let desde = $elem.find('input.desde:visible').val(); 141 let hasta = $elem.find('input.hasta:visible').val(); 142 // text = (desde + (hasta != null && hasta !== '' && hasta !== 'undefined' ? " - " + hasta : '')).trim(); 143 // removeH = (desde + (hasta != null && hasta !== '' && hasta !== 'undefined' ? hasta : '')).trim().length > 0;
144 // checkId = $(this).find('input.desde').attr('id').replace("-desde", ""); 145 $legend.append(createDateChip($label.text().trim(), desde, hasta, $elem.find('input.desde:visible'), $elem.find('input.hasta:visible'))); 146 } else if ($elem.find('.chosen-scrud').length > 0) { 147 // text = $(this).find('.chosen-scrud').find(':selected').map(function () { 148 // return $(this).text(); 149 // }).get().join(' ,'); 150 // removeH = text.trim().length > 0; 151 // checkId = $(this).find('.chosen-scrud').attr('id'); 152 } else if ($elem.find('.combo-multiple select').length > 0) { 153 // text = $elem.find('.combo-multiple select').find(':selected').text(); 154 // removeH = text.trim().length > 0; 155 // checkId = $elem.find('.combo-multiple select').attr('id'); 156 } else if ($elem.find('.chosentree').length > 0) { 157 let skippedChildren = $(); 158 let valuesString = []; 159 let valuesIDs = []; 160 let valuesMap = new Map(); 161 162 $elem.find('.treeselect input[type="checkbox"]:checked').each((_index, elem) => { 163 let $elem = $(elem); 164 if($elem.siblings('ul').children().length > 0) { 165 skippedChildren = skippedChildren.add($elem.siblings('ul').find('input[type="checkbox"]:checked')) 166 } 167 }); 168 169 $elem.find('.treeselect input[type="checkbox"]:checked').each((_index, elem) => { 170 let $elem = $(elem); 171 if(skippedChildren.is($elem)) return; 172 valuesString.push($elem.siblings('label').text().trim() || $elem.siblings('.treeselect-title').children('label').text().trim()); 173 valuesIDs.push($elem.val()); 174 valuesMap.set($elem.val(), $elem.siblings('label').text().trim() || $elem.siblings('.treeselect-title').children('label').text().trim()); 175 }) 176 177 console.debug("Chosen element with label", $label.text().trim(), "has values", valuesString, "with IDs", valuesIDs); 178 $legend.append(createMultipleSelectorChip($label.text().trim(), valuesMap, $elem)); 179 // text = $elem.find('.chosentree input.chosentree-search').attr('placeholder'); 180 // text = text === $elem.find('.chosentree').data('placeholderaux') ? '' : text; 181 // removeH = text.trim().length > 0; 182 // checkId = $elem.find('.chosentree').attr('id'); 183 } else if ($elem.find('.enum').length > 0) { 184 let $checkedRadio = $elem.find('radio:checked'); 185 console.log("Enum element with label", $label.text().trim(), "has values", $checkedRadio.next('label').text().trim(), "with IDs", $elem.val()); 186 } else if ($elem.find('input').length > 0) { 187 // text = $elem.find('input').val(); 188 // removeH = text !== undefined ? text.trim().length > 0 : false; 189 // checkId = $elem.find('input').attr('id'); 190 } 191 }) 192}
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.