PageSourceSearch

https://valdresmusea.no/assets/gen/m24-a-events.js?77ecc8a4

js valdresmusea.no collected 2026-09-24 20:48:23 UTC 9,711 bytes, 49 lines download raw bytes

1angular.module('m24App').directive('m24EventsAuto',['$log','$sce','$http','$rootScope',function($log,$sce,$http,$rootScope){return{restrict:"EA",scope:true,templateUrl:'/assets/js/angular/m24-events.tpl.html?t='+MUSEUM24_PORTAL_VERSION,link:function(scope,iElm,iAttrs){scope.block=angular.fromJson(iAttrs.block);scope.baseurl=iAttrs.baseurl+"/";scope.pageid=iAttrs.pageid;scope.siteid=iAttrs.siteid;scope.locale=iAttrs.locale||'no';var placeholder=iAttrs.placeholder;scope.pageLanguage=iAttrs.pagelanguage||scope.locale;scope.me=Math.random().toString().replace(".","");scope.translateCategory=translateCategory;scope.translateText=translateText;scope.h3=false;if(scope.block.visibletitle){scope.h3=true;}
2scope.onSiteCheckboxKeydown=function(event,index,isLast,isFirst){if(event.key==="Tab"){if((!event.shiftKey&&isLast)||(event.shiftKey&&isFirst)){scope.$applyAsync(function(){scope.currentFilter=false;});}}else if(event.key==="Escape"){scope.$applyAsync(function(){scope.currentFilter=false;});}};scope.filterCategories=[{name:"activity",active:false},{name:"concert",active:false},{name:"performance",active:false},{name:"tour",active:false},{name:"exhibition",active:false},{name:"opening",active:false},{name:"market",active:false},{name:"conference",active:false},{name:"course",active:false},{name:"lecture",active:false},{name:"school_event",active:false},{name:"family_event",active:false},{name:"recurring_event",active:false},{name:"recurring_program",active:false},{name:"digital_event",active:false}];scope.filterAudience=[{name:"family",active:false},{name:"adults",active:false},{name:"youth",active:false},{name:"kids",active:false}];scope.filterSites=[];scope.filterLocations=[];scope.currentFilter=false;if(scope.block.userCategoryFilter&&scope.block.subCategories&&scope.block.subCategories.length>0){for(var i=0;i<scope.filterCategories.length;i++){if(scope.block.subCategories.indexOf(scope.filterCategories[i].name)!==-1){}else{scope.filterCategories[i].hidden=true;}}}
3scope.closeOuterFilters=function($event){if(scope.currentFilter){scope.currentFilter=false;}
4$event.stopPropagation();};scope.stopPropagation=function($event){$event.stopPropagation();}
5scope.toggleFilter=function(filtertype,$event){if(scope.currentFilter!=filtertype){scope.currentFilter=filtertype;}else{if($rootScope.closeAllFilters){scope.currentFilter=filtertype;}else{scope.currentFilter=false;}}
6if($rootScope.closeAllFilters){$rootScope.closeAllFilters=false;}
7$event.stopPropagation();}
8scope.filter={enabled:false,today:false,site:false,siteIds:"",category:false,audience:false,target_audience:"",sub_categories:"",location:false,locationIds:""}
9scope.dynamicYearFormat='dd. MMM';if(scope.block.showForPeriodType){if(scope.block.showForPeriodType==='previous'||scope.block.showForPeriodType==='specify'){scope.dynamicYearFormat='dd. MMM yyyy';}}
10if(scope.block.userDateFilter||scope.block.userTodayFilter){scope.filter.enabled=true;}
11if(scope.block.userCategoryFilter){scope.filter.enabled=true;scope.filter.category=true;}
12if(scope.block.userTargetGroupFilter){scope.filter.enabled=true;scope.filter.audience=true;}
13if(scope.block.enableSearch){scope.filter.enabled=true;}
14var fq="?";if(scope.block.userMuseumFilter&&scope.block.siteIds&&scope.block.siteIds.length>0){fq+="&site_ids="+scope.block.siteIds;scope.filter.site=true;}
15if(scope.block.userMuseumFilter&&scope.block.locationIds&&scope.block.locationIds.length>0){fq+="&location_ids="+scope.block.locationIds;scope.filter.location=true;}
16if(scope.block.userMuseumFilter){scope.filter.enabled=true;var filtersURL="/api/site/filters/data"+fq;$http.get(filtersURL).then(function(result,status){if(result.data){if(result.data.site_names){scope.filterSites=result.data.site_names;}
17if(result.data.location_names){scope.filterLocations=result.data.location_names;}}});}
18var max=scope.block.maxSearchResults||"200";scope.filterEvents=function(){scope.filter.siteIds="";scope.filter.sub_categories="";scope.filter.target_audience="";scope.filter.locationIds="";for(var s=0;s<scope.filterSites.length;s++){if(scope.filterSites[s].active){scope.filter.siteIds+=scope.filterSites[s].id+",";}}
19for(var c=0;c<scope.filterCategories.length;c++){if(scope.filterCategories[c].active){scope.filter.sub_categories+=scope.filterCategories[c].name+",";}}
20for(var a=0;a<scope.filterAudience.length;a++){if(scope.filterAudience[a].active){scope.filter.target_audience+=scope.filterAudience[a].name+",";}}
21for(var l=0;l<scope.filterLocations.length;l++){if(scope.filterLocations[l].active){scope.filter.locationIds+=scope.filterLocations[l].id+",";}}
22scope.filter.siteIds=scope.filter.siteIds.replace(/,\s*$/,"");scope.filter.sub_categories=scope.filter.sub_categories.replace(/,\s*$/,"");scope.filter.target_audience=scope.filter.target_audience.replace(/,\s*$/,"");scope.filter.locationIds=scope.filter.locationIds.replace(/,\s*$/,"");q=buildQuery(scope.filter);doSearch(q);}
23scope.setCategoryFilter=function(category){scope.filter.category=category;q=buildQuery(scope.filter);doSearch(q);}
24var userChangedOrder=false;var order="asc";scope.changeOrder=function(){userChangedOrder=true;if(order=="asc"){order="desc";}else{order="asc";}
25q=buildQuery(scope.filter);doSearch(q);}
26scope.onlyToday=false;scope.filterToday=function(){q=buildQuery(scope.filter);doSearch(q);}
27function buildQuery(filter){var q="?t="+Math.random();q+="&is_event=true&order_by=event_start";q+="&locale="+scope.pageLanguage;q+="&site_id="+scope.siteid;q+="&rows="+max;if(filter.siteIds!==""){q+="&site_ids="+filter.siteIds;}else{q+="&site_ids="+(scope.block.siteIds||'');}
28if(filter.locationIds!==""){q+="&location_ids="+filter.locationIds;}else{q+="&location_ids="+(scope.block.locationIds||'');}
29if(filter.sub_categories!==""){q+="&sub_categories="+filter.sub_categories;}else{q+="&sub_categories="+(scope.block.subCategories||'');}
30if(filter.target_audience!==""){q+="&target_audience="+filter.target_audience;}else{}
31if(scope.block.showForPeriodType){if(scope.block.showForPeriodType==='previous'){q+="&past_events=true";q+="&event_start_before=today";if(!userChangedOrder){order="desc";}}
32else if(scope.block.showForPeriodType!=='specify'){q+="&event_start_after=today";if(scope.filter.today){q+="&event_start_before=today";}else{q+="&event_start_before="+(scope.block.showForPeriodType);}}else{var eventStartAfter=parseAPITimestamp(scope.block.showForPeriodStart);var eventStartBefore=parseAPITimestamp(scope.block.showForPeriodEnd);isoDate="";if(eventStartAfter){eventStartAfter=eventStartAfter.toISOString().split('T')[0];}
33if(eventStartBefore){const esbf=new Date(eventStartBefore);esbf.setDate(eventStartBefore.getDate()+1);isoDate=esbf.toISOString().split('T')[0];}
34q+="&event_start_after="+(eventStartAfter||'');q+="&event_start_before="+(isoDate||'');}
35q+="&order="+order;}
36if(scope.block.disableExpandedDates){q+="&disable_expanded_dates=true";}
37return q}
38document.getElementById(placeholder).style.display="none";scope.search={done:false}
39q=buildQuery(scope.filter);doSearch(q);function doSearch(q){scope.search.done=false;var ajaxUrl="/api/page/pages/list"+q;$http.get(ajaxUrl,{cache:false,headers:{'Cache-Control':'no-cache','Pragma':'no-cache','Expires':'0'}}).then(function(result,status){if(result.data&&result.data.pages){var pages=result.data.pages;for(var i=0;i<pages.length;i++){if(pages[i].image_focus_point){pages[i]._objectposition=getObjectPosition(pages[i].image_focus_point);}}
40scope.searchResult=pages;scope.searchResultCount=result.data.count;}else{scope.searchResult=[];scope.searchResultCount=0;}
41scope.search.done=true;},function(data){scope.searchResult=[];scope.searchResultCount=0;});}
42if(scope.block.showAllLinkPage&&scope.block.showAllLinkPage.id){var getReadMorePage="/api/page/pages/list?page_ids="+scope.block.showAllLinkPage.id;scope.dynamicReadMorePage=false;$http.get(getReadMorePage).then(function(result,status){if(result.data&&result.data.pages){scope.dynamicReadMorePage=result.data.pages[0];}});}}};}]).directive('m24EventsManual',['$log','$sce','$http',function($log,$sce,$http){return{restrict:"EA",scope:true,templateUrl:'/assets/js/angular/m24-events.tpl.html?t='+MUSEUM24_PORTAL_VERSION,link:function(scope,iElm,iAttrs){scope.block=angular.fromJson(iAttrs.block);scope.baseurl=iAttrs.baseurl+"/";scope.pageid=iAttrs.pageid;scope.siteid=iAttrs.siteid;scope.locale=iAttrs.locale||'no';var placeholder=iAttrs.placeholder;scope.translateCategory=translateCategory;scope.h3=false;if(scope.block.visibletitle){scope.h3=true;}
43scope.dynamicYearFormat='dd. MMM';var ids="";document.getElementById(placeholder).style.display="none";scope.search={done:false}
44var pages=scope.block.items;if(pages.length===0){scope.search.done=true;}
45if(pages.length>0){scope.localdata={};for(var i=0;i<pages.length;i++){if(pages[i].local){scope.localdata[pages[i].id]=(pages[i].local);}
46ids+=pages[i].id+",";}
47ids=ids.slice(0,-1);var q="?page_ids="+ids;q+="&site_id="+scope.siteid;var ajaxUrl="/api/page/pages/list"+q;$http.get(ajaxUrl).then(function(result,status){if(result.data&&result.data.pages){var pages=result.data.pages;for(var i=0;i<pages.length;i++){if(pages[i].image_focus_point){pages[i]._objectposition=getObjectPosition(pages[i].image_focus_point);}}
48scope.searchResult=pages;scope.search.done=true;}else{scope.searchResult=pages;scope.search.done=true;}},function(data){scope.searchResult=pages;scope.search.done=true;});}
49if(scope.block.showAllLinkPage&&scope.block.showAllLinkPage.id){var getReadMorePage="/api/page/pages/list?page_ids="+scope.block.showAllLinkPage.id;scope.dynamicReadMorePage=false;$http.get(getReadMorePage).then(function(result,status){if(result.data&&result.data.pages){scope.dynamicReadMorePage=result.data.pages[0];}});}}};}])

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.