1"use strict";(self.webpackChunkuniversity_of_glasgow=self.webpackChunkuniversity_of_glasgow||[]).push([[7695],{22508:function(t,s,e){e.r(s),e.d(s,{default:function(){return Tags}});var a=e(55498),n=e(55124);class Tags{constructor(t){this.element=t,this.entries=[],this.tags=[],this.rootPath=this.element.dataset.rooturl,this.feedURL="/tags/all/",this.getFeed().then((()=>{this.init()}))}async getFeed(){try{const t=await fetch(this.feedURL);if(!t.ok)throw new Error(`Failed to fetch feed: ${t.status} ${t.statusText}`);const s=await t.json();this.entries=s.entries||[],console.log(this.entries)}catch(t){console.error("An error occurred while fetching the feed:",t)}}getAllEntries(){return this.entries}getEntriesByTag(t,s){return t.filter((t=>!!t.tags&&t.tags.split(",").includes(s)))}getEntriesByRootPath(t,s){return console.log(t),console.log(s),t.filter((t=>!!t.tag_section_details&&t.tag_section_details.path===s))}getTags(t){let s=new Set;return t.forEach((t=>{t.tags&&t.tags.split(",").forEach((t=>{s.add(t)}))})),Array.from(s)}getTagsByRootPath(t,s){return this.getTags(this.getEntriesByRootPath(t,s))}getTagsByEntry(t){return t.tags?t.tags.split(","):[]}displayEntries(t){let s="";return t.forEach((t=>{if(t.name){let e="";
1t.tags&&(e='<ul class="tags-list">',t.tags.split(",").forEach((t=>{e+=`\n <li class="tag">\n <a href="?tags=${t}">${t}</a>\n </li>\n `})),e+="</ul>"),s+=`\n <div class="row">\n <div class="column large-12">\n <div class="result">\n <div class="tag-entry">\n <h3>${t.section_name}</h3>\n <p><a href="${t.url}">${t.url}</a></p>\n <p>${t.summary}</p>\n ${e}\n </div>\n </div>\n </div>\n </div>\n `}})),s}displayTags(t){let s='<h2>Related tags</h2><ul class="tags-list">';return t.forEach((t=>{s+=`\n <li class="tag">\n <a href="?tags=${t}">${t}</a>\n </li>\n `})),s+="</ul>",s}displayPage(t,s,e){return a.A.standard({heading:e,content:this.displayEntries(t),quicklinks:this.displayTags(s)})}watchURLParams(){const t=new URLSearchParams(window.location.search).get("tags");t?this.element.insertAdjacentHTML("beforeend",this.displayPage(this.getEntriesByTag(this.entries,t),this.getTagsByRootPath(this.entries,this.rootPath),`Showing: ${t} <span class="tags-show-all"><a href="?tags=">show all</a></span>`)):this.element.insertAdjacentHTML("beforeend",this.displayPage(this.getEntriesByRootPath(this.entries,this.rootPath),this.getTagsByRootPath(this.entries,this.rootPath),"All tags"))}init(){this.watchURLParams(),[...document.querySelectorAll(".standardContent:not(.splashwrapper)")].forEach((t=>{new n.A(t)})),window.addEventListener("popstate",(()=>{this.watchURLParams()}))}}}}]); 2//# sourceMappingURL=gu-tags.5ddd93b7.js.map
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.