PageSourceSearch

https://liu.se/dist/global/component-teaser-teaser-js.js?v=1790061783566

js liu.se collected 2026-09-24 07:43:56 UTC 12,878 bytes, 1 lines download raw bytes

1(self.webpackChunknodejs_dependencies=self.webpackChunknodejs_dependencies||[]).push([[3707,5003,6386,8688],{2206(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function(){return{renderString:function(template,data){return template.replace(/\{([\w\.]*)\}/g,function(str,key){for(var keys=key.split("."),value=data[keys.shift()],i=0,l=keys.length;i<l;i++)value=value[keys[i]];return null!=value?value:""})}}}.call(exports,__webpack_require__,exports,module))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},1125(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,jQuery=__webpack_require__(4692);__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(4692),__webpack_require__(2206),__webpack_require__(227)],void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function($,renderTemplateUtil,simplepagination){var teaser=function(element){this.$el=$(element),this.itemId=element.dataset.itemid,this.showDates="True"===element.dataset.showdates,this.showGrid="True"===element.dataset.showgrid,this.$filterButton=this.$el.find(".primary.js-teaser-picker__submit"),this.$yearSelect=this.$el.find(".year_select"),this.$monthSelect=this.$el.find(".month_select"),this.$tagSelect=this.$el.find(".tag_select"),this.bindEvents(),this.changeDropdowns();var self=this;this.$el.find("button[name=search-more-teasernewslist]").click(function(){var noDisplayedNewsItems=self.$el.find(".teaser-list-list >").length;return self.updateNews(noDisplayedNewsItems),teaser})};teaser.prototype.bindEvents=function(){var self=this;this.$filterButton.on("click",function(){return self.updateNews()}),this.$yearSelect.on("change",function(){self.changeDropdowns()}),this.$monthSelect.on("change",function(){self.changeDropdowns()}),this.updateNews()},teaser.prototype.changeDropdowns=function(){""!=this.$tagSelect.val()?$("button[name=search-more-teasernewslist]").hide():$("button[name=search-more-teasernewslist]").show()},teaser.prototype.updateNews=function(noItemsToSkip){var self=this;self.$el.each(function(i,list){var forms=jQuery(this).find(".teaser-list-filter form");if(forms.length>0){var form=forms[0],year=form.elements.year?.value??"";if(void 0!==form.elements.tag)var tag=form.elements.tag.value;else tag=""}else year="",tag="";noItemsToSkip=noItemsToSkip||0,jQuery.get("/api/teaser/news",{itemId:self.itemId,year,tag,lang:document.documentElement.lang,itemsToSkipMaybeNull:noItemsToSkip},function(result){let data=result.Teasers;var lang=document.documentElement.lang;"en"==lang&&(lang="en-GB");var $listContainer=self.showGrid?self.$el.find(".teaser-list-list .mod-teaser.teaser-small-container .liucolumns"):self.$el.find(".teaser-list-list");if($listContainer.empty(),0==noItemsToSkip&&0==data.length)return void $listContainer.html('<div class="no-items-found">Inga träffar</div>');var template=self.showGrid?self.$el.find(".template_grid").html():self.$el.find(".template").html(),html=jQuery(data).map(function(i,d){return self.showDates&&(d.PublishedDateMonthYear=new Date(d.Published).toLocaleDateString(lang,{month:"long",day:"numeric",year:"numeric"})),renderTemplateUtil.renderString(template.replace("template ",""),{teaserModel:d})}).toArray().join("\n");self.$el.find(".maxNewsItemCount").attr("data-newsitemcount",noItemsToSkip),noItemsToSkip>0?$listContainer.append(html):$listContainer.html(html);let startNumber=result.StartResultNumber+1,endNumber=result.EndResultNumber,totalHits=result.TotalNoResults,pageNumber=result.PageNumber+1,pageSize=result.PageSize,currentPage=startNumber/pageSize;var paginationElement=self.$el.find("#pagination");self.$el.find("#pagination")[0]&&(paginationElement.attr("data-hits",data.length),paginationElement.attr("data-totalhits",totalHits),self.$el.find("#paginationResultText").text(paginationElement.data("paginationtext").replace("{0}",startNumber).replace("{1}",endNumber).replace("{2}",totalHits)));let pages=totalHits/pageSize;self.$el.find("#pagination")[0]&&self.$el.find("#pagination").pagination({currentPage:pageNumber,items:totalHits,itemsOnPage:pageSize,cssStyle:"liu-pagination-theme",onPageClick:function(pageNumber,event){event&&event.preventDefault(),self.updateNews((pageNumber-1)*pageSize),self.$el.find("#progressBar div").width(pageNumber*self.$el.find("#progressBar")[0].clientWidth/pages)},onInit:function(){self.$el.find("#progressBar div").width(currentPage*self.$el.find("#progressBar")[0].clientWidth/pages)}});const words=glossary[document.documentElement.lang.toLowerCase()];self.$el.find("#pagination li a:not(.next):not(.prev)").each((i,x)=>$(x).attr("aria-label",words.page+" "+x.innerText)),self.$el.find("#pagination li a.next").each((i,x)=>$(x).attr("aria-label",words.next_page)),self.$el.find("#pagination li a.prev").each((i,x)=>$(x).attr("aria-label",words.previous_page))})})};const glossary={"sv-se":{page:"Sida",next_page:"Nästa sida",previous_page:"Föregående sida"},en:{page:"Page",next_page:"Next page",previous_page:"Previous page"}};return teaser}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)},227(__unused_webpack_module,__unused_webpack_exports,__webpack_require__){var $,methods,jQuery=__webpack_require__(4692);methods={init:function(options){var o=$.extend({items:1,itemsOnPage:1,pages:0,displayedPages:5,edges:1,currentPage:0,useAnchors:!0,hrefTextPrefix:"#page-",hrefTextSuffix:"",prevText:" ",nextText:" ",ellipseText:"&hellip;",ellipsePageSet:!0,cssStyle:"liu-pagination-theme",listStyle:"",labelMap:[],selectOnClick:!0,nextAtFront:!1,invertPageOrder:!1,useStartEdge:!0,useEndEdge:!0,onPageClick:function(pageNumber,event){},onInit:function(){}},options||{}),self=this;return o.pages=o.pages?o.pages:Math.ceil(o.items/o.itemsOnPage)?Math.ceil(o.items/o.itemsOnPage):1,o.currentPage?o.currentPage=o.currentPage-1:o.currentPage=o.invertPageOrder?o.pages-1:0,o.halfDisplayed=o.displayedPages/2,this.each(function(){self.addClass(o.cssStyle+" simple-pagination").data("pagination",o),methods._draw.call(self)}),o.onInit(),this},selectPage:function(page){return methods._selectPage.call(this,page-1),this},prevPage:function(){var o=this.data("pagination");return o.invertPageOrder?o.currentPage<o.pages-1&&methods._selectPage.call(this,o.currentPage+1):o.currentPage>0&&methods._selectPage.call(this,o.currentPage-1),this},nextPage:function(){var o=this.data("pagination");return o.invertPageOrder?o.currentPage>0&&methods._selectPage.call(this,o.currentPage-1):o.currentPage<o.pages-1&&methods._selectPage.call(this,o.currentPage+1),this},getPagesCount:function(){return this.data("pagination").pages},setPagesCount:function(count){this.data("pagination").pages=count},getCurrentPage:function(){return this.data("pagination").currentPage+1},destroy:function(){return this.empty(),this},drawPage:function(page){var o=this.data("pagination");return o.currentPage=page-1,this.data("pagination",o),methods._draw.call(this),this},redraw:function(){return methods._draw.call(this),this},disable:function(){var o=this.data("pagination");return o.disabled=!0,this.data("pagination",o),methods._draw.call(this),this},enable:function(){var o=this.data("pagination");return o.disabled=!1,this.data("pagination",o),methods._draw.call(this),this},updateItems:function(newItems){var o=this.data("pagination");o.items=newItems,o.pages=methods._getPages(o),this.data("pagination",o),methods._draw.call(this)},updateItemsOnPage:function(itemsOnPage){var o=this.data("pagination");return o.itemsOnPage=itemsOnPage,o.pages=methods._getPages(o),this.data("pagination",o),methods._selectPage.call(this,0),this},getItemsOnPage:function(){return this.data("pagination").itemsOnPage},_draw:function(){var i,o=this.data("pagination"),interval=methods._getInterval(o);methods.destroy.call(this);var $panel="UL"===("function"==typeof this.prop?this.prop("tagName"):this.attr("tagName"))?this:$("<ul"+(o.listStyle?' class="'+o.listStyle+'"':"")+"></ul>").appendTo(this);if(o.prevText&&methods._appendItem.call(this,o.invertPageOrder?o.currentPage+1:o.currentPage-1,{text:o.prevText,classes:"prev"}),o.nextText&&o.nextAtFront&&methods._appendItem.call(this,o.invertPageOrder?o.currentPage-1:o.currentPage+1,{text:o.nextText,classes:"next"}),o.invertPageOrder){if(interval.end<o.pages&&o.edges>0){if(o.useStartEdge){var begin=Math.max(o.pages-o.edges,interval.end);for(i=o.pages-1;i>=begin;i--)methods._appendItem.call(this,i)}o.pages-o.edges>interval.end&&o.pages-o.edges-interval.end!=1?$panel.append('<li class="disabled"><span class="ellipse">'+o.ellipseText+"</span></li>"):o.pages-o.edges-interval.end==1&&methods._appendItem.call(this,interval.end)}}else if(interval.start>0&&o.edges>0){if(o.useStartEdge){var end=Math.min(o.edges,interval.start);for(i=0;i<end;i++)methods._appendItem.call(this,i)}o.edges<interval.start&&interval.start-o.edges!=1?$panel.append('<li class="disabled"><span class="ellipse">'+o.ellipseText+"</span></li>"):interval.start-o.edges==1&&methods._appendItem.call(this,o.edges)}if(o.invertPageOrder)for(i=interval.end-1;i>=interval.start;i--)methods._appendItem.call(this,i);else for(i=interval.start;i<interval.end;i++)methods._appendItem.call(this,i);if(o.invertPageOrder){if(interval.start>0&&o.edges>0&&(o.edges<interval.start&&interval.start-o.edges!=1?$panel.append('<li class="disabled"><span class="ellipse">'+o.ellipseText+"</span></li>"):interval.start-o.edges==1&&methods._appendItem.call(this,o.edges),o.useEndEdge))for(i=(end=Math.min(o.edges,interval.start))-1;i>=0;i--)methods._appendItem.call(this,i)}else if(interval.end<o.pages&&o.edges>0&&(o.pages-o.edges>interval.end&&o.pages-o.edges-interval.end!=1?$panel.append('<li class="disabled"><span class="ellipse">'+o.ellipseText+"</span></li>"):o.pages-o.edges-interval.end==1&&methods._appendItem.call(this,interval.end),o.useEndEdge))for(i=begin=Math.max(o.pages-o.edges,interval.end);i<o.pages;i++)methods._appendItem.call(this,i);o.nextText&&!o.nextAtFront&&methods._appendItem.call(this,o.invertPageOrder?o.currentPage-1:o.currentPage+1,{text:o.nextText,classes:"next"}),o.ellipsePageSet&&!o.disabled&&methods._ellipseClick.call(this,$panel)},_getPages:function(o){return Math.ceil(o.items/o.itemsOnPage)||1},_getInterval:function(o){return{start:Math.ceil(o.currentPage>o.halfDisplayed?Math.max(Math.min(o.currentPage-o.halfDisplayed,o.pages-o.displayedPages),0):0),end:Math.ceil(o.currentPage>o.halfDisplayed?Math.min(o.currentPage+o.halfDisplayed,o.pages):Math.min(o.displayedPages,o.pages))}},_appendItem:function(pageIndex,opts){var options,$link,self=this,o=self.data("pagination"),$linkWrapper=$("<li></li>"),$ul=self.find("ul");if(options={text:(pageIndex=pageIndex<0?0:pageIndex<o.pages?pageIndex:o.pages-1)+1,classes:""},o.labelMap.length&&o.labelMap[pageIndex]&&(options.text=o.labelMap[pageIndex]),options=$.extend(options,opts||{}),pageIndex==o.currentPage||o.disabled)o.disabled||"prev"===options.classes||"next"===options.classes?$linkWrapper.addClass("disabled"):$linkWrapper.addClass("active"),$link=$('<span class="current">'+options.text+"</span>");
1else{if(o.useAnchors){let urlParams=new URLSearchParams(window.location.search);urlParams.set("page",pageIndex+1);let href=location.href.substring(0,location.href.indexOf("?"))+"?"+urlParams.toString();$link=$('<a href="'+href+'" class="page-link">'+options.text+"</a>")}else $link=$("<span >"+options.text+"</span>");$link.click(function(event){return methods._selectPage.call(self,pageIndex,event)})}options.classes&&$link.addClass(options.classes),$linkWrapper.append($link),$ul.length?$ul.append($linkWrapper):self.append($linkWrapper)},_selectPage:function(pageIndex,event){var o=this.data("pagination");return o.currentPage=pageIndex,o.selectOnClick&&methods._draw.call(this),o.onPageClick(pageIndex+1,event)},_ellipseClick:function($panel){var self=this,o=this.data("pagination"),$ellip=$panel.find(".ellipse");$ellip.addClass("clickable").parent().removeClass("disabled"),$ellip.click(function(event){if(!o.disable){var $this=$(this),val=(parseInt($this.parent().prev().text(),10)||0)+1;$this.html('<input type="number" min="1" max="'+o.pages+'" step="1" value="'+val+'">').find("input").focus().click(function(event){event.stopPropagation()}).keyup(function(event){var val=$(this).val();13===event.which&&""!==val?val>0&&val<=o.pages&&methods._selectPage.call(self,val-1):27===event.which&&$ellip.empty().html(o.ellipseText)}).bind("blur",function(event){var val=$(this).val();return""!==val&&methods._selectPage.call(self,val-1),$ellip.empty().html(o.ellipseText),!1})}return!1})}},($=jQuery).fn.pagination=function(method){return methods[method]&&"_"!=method.charAt(0)?methods[method].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof method&&method?void $.error("Method "+method+" does not exist on jQuery.pagination"):methods.init.apply(this,arguments)}}}]);

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.