1const $jt = jQuery.noConflict(); 2 3const fields = "ID,Title,FechaOrden,Resumen,UrlDestino,File/ServerRelativeUrl"; 4const topCount = 5; 5const libraryName = "Temas%20de%20interes"; 6const webUrl = _spPageContextInfo.webAbsoluteUrl; 7const expand = "Properties,File"; 8const orderby = "FechaOrden desc"; 9const filter = ""; // Example: "Visible eq 1" 10 11document.addEventListener("DOMContentLoaded", getTemasInteres); 12 13async function getTemasInteres() { 14 try { 15 const response = await fetch(`${webUrl}/_api/web/lists/GetByTitle('${libraryName}')/items?$top=${topCount}&$select=${fields}&$orderby=${orderby}&$filter=${filter}&$expand=${expand}`, { 16 headers: { 17 "Accept": "application/json;odata=verbose" 18 } 19 }); 20 21 if (!response.ok) { 22 throw new Error(`HTTP error! status: ${response.status}`); 23 } 24 25 const data = await response.json(); 26 setTemasInteres(data.d.results); 27 } catch (error) { 28 console.error("Error fetching data:", error); 29 } 30} 31 32function setTemasInteres(items) { 33 const cardTemplate = (item, linkClass) => ` 34 <div class="temas-p"> 35 <p class="home-temas-title mb-2">${escapeHTML(item.Title)}</p> 36 <p class="home-temas-resume mb-3">${escapeHTML(item.Resumen)}.</p> 37 <a class="${linkClass}" href="${item.UrlDestino.Url}" class="card-link">Ver más</a> 38 </div><br>`; 39 40 const container = $jt(".setTemasInteres"); 41 container.empty(); 42var cont=0; 43 items.forEach(item => { 44 45 // const linkClass = (item.Title === "" || item.Title === "") /// tenia unos temas de galeon colocados por david, ya se corrigio 46 const linkClass = (cont === 0 || cont === 3) 47 ? "home-temas-link-destacado" 48 : "home-temas-link"; 49 container.append(cardTemplate(item, linkClass)); 50 cont += 1; 51 }); 52} 53 54function escapeHTML(str) { 55 if (!str) return ''; 56 return str.replace(/[&<>'"]/g, tag => ( 57 { 58 '&': '&', 59 '<': '<', 60 '>': '>', 61 "'": ''', 62 '"': '"' 63 }[tag] || tag 64 )); 65}
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.