PageSourceSearch

https://www.riksidrottsmuseum.se/webapp-resource/4.67acf94f181d1e9…/1717006468871/webapp-assets.js

js riksidrottsmuseum.se collected 2026-10-02 12:22:40 UTC 5,888 bytes, 166 lines download raw bytes

1AppRegistry.registerBundle({applicationId:'welcome-banner|0.0.6',bundle: {"en":{},"sv":{}}});
2AppRegistry.registerModule({applicationId:'welcome-banner|0.0.6',path:'/template/partials/message',module:function(define){define(function(require){var _=require('underscore');return function(obj){
3var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
4with(obj||{}){
5__p+='<h1>'+
6((__t=( message ))==null?'':__t)+
7'</h1>';
8}
9return __p;
10};});}});
11AppRegistry.registerModule({applicationId:'welcome-banner|0.0.6',path:'/template/main',module:function(define){define(function(require){var _=require('underscore');return function(obj){
12var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
13with(obj||{}){
14__p+='<div id="'+
15((__t=( appContext.getWebAppNamespace('app') ))==null?'':__t)+
16'" class="hiq-welcome-banner">\r\n	<div class="hiq-welcome-banner__wrapper">\r\n		<div class="hiq-welcome-banner__left" id="left-banner">\r\n			<div class="hiq-welcome-banner__left-inner">\r\n				<div class="hiq-welcome-banner__text">\r\n					<h1 class="hiq-welcome-banner__title">'+
17((__t=( title ))==null?'':_.escape(__t))+
18'</h1>\r\n					<p class="hiq-welcome-banner__preamble">'+
19((__t=( preamble ))==null?'':_.escape(__t))+
20'</p>\r\n					<ul class="hiq-welcome-banner__list">\r\n						';
21 links.forEach(function(link) { 
22__p+='\r\n							<li class="hiq-welcome-banner__item">\r\n								<a href="'+
23((__t=( link.uri ))==null?'':_.escape(__t))+
24'" class="hiq-welcome-banner__link '+
25((__t=( link.type ))==null?'':_.escape(__t))+
26'">'+
27((__t=( link.name ))==null?'':_.escape(__t))+
28'</a>\r\n							</li>\r\n						';
29 }) 
30__p+='\r\n					</ul>\r\n				</div>\r\n			</div>\r\n		</div>\r\n		\r\n		<div class="hiq-welcome-banner__right" id="right-banner">\r\n			<img class="hiq-welcome-banner__image" id="banner-image" src="'+
31((__t=( image ))==null?'':_.escape(__t))+
32'" alt="">\r\n		</div>\r\n	</div>\r\n</div>\r\n';
33}
34return __p;
35};});}});
36AppRegistry.registerModule({applicationId:'welcome-banner|0.0.6',path:'/reducer',module:function(define){'use strict';define(function(require) {
37    'use strict';
38 
39    var _ = require('underscore');
40 
41    var reducer = function(state, action) {
42       switch (action.type) {
43          case 'SET_LINKS':
44             return _.extend({}, state, {links: action.links});
45          default:
46             return state;
47       }
48    }
49 
50    return reducer;
51 });}});
52AppRegistry.registerModule({applicationId:'welcome-banner|0.0.6',path:'/main',module:function(define){'use strict';define(function(require) {
53	'use strict';
54 
55	var _          = require('underscore');
56	var Component  = require('Component');
57	var store 	   = require('store');
58	var template   = require('/template/main');
59  var requester = require('requester');
60  
61 
62	return Component.extend({
63		
64    template: template,
65		
66    events: {
67      self: {
68        'state:changed': 'render'
69      },
70      store: 'handleStoreChange'
71    },
72
73    onInit: function() {
74      if(window.__rekai) {
75        this.addAILinks(this.state.count || 6);
76      } else {
77        store.dispatch({type: 'SET_LINKS', links: this.state.manualLinks});
78      }
79    },
80    onAttached: function() {
81      const left = document.querySelector('#left-banner');
82      const right = document.querySelector('#right-banner');
83      let leftHeight = left.clientHeight;
84      if(window.innerWidth > 1024) {
85        right.style.height = (leftHeight + 100) + 'px';
86      }
87
88      window.addEventListener('resize', () => {
89        if(window.innerWidth > 1024) {
90          let leftHeight = left.clientHeight;
91          right.style.height = (leftHeight + 100) + 'px';
92        } else {
93          right.style.height = 'auto';
94        }
95      })
96    },
97    addAILinks: function(count) {
98
99      const options = {
100        overwrite: {
101          nrofhits: count,
102          minpathdepth: 2,
103          pagetype: 'svpage'
104        }
105      }
106      const linksCallback = (data) => {
107        const manualLinks = this.state.manualLinks;
108        const total = this.state.count;
109
110        if(manualLinks.length >= total) {
111          store.dispatch({type: 'SET_LINKS', links: manualLinks.slice(0, total)});
112        }
113        else {
114          const missing = total - manualLinks.length;
115          const predictions = data.predictions.filter(obj1 => !manualLinks.some(obj2 => obj1.pageid == obj2.id));
116          for(let i = 0; i < missing; i++) {
117            manualLinks.push({
118              name: predictions[i].title,
119              uri: predictions[i].url,
120              type: 'internal',
121              id: predictions[i].pageid
122            })
123          }
124          store.dispatch({type: 'SET_LINKS', links: manualLinks});
125        
126        }
127
128      }
129      if(!window.__rekai || !window.__rekai.predict) {
130        window.addEventListener('rekai.load', function() {
131          window.__rekai.predict(options, linksCallback);
132        })
133      } else {
134        window.__rekai.predict(options, linksCallback);
135      }
136			
137    },
138
139    handleStoreChange: function(newState) {
140      this.setState(newState)
141    },
142
143    filterState: function(state) {
144      return _.extend({}, state);
145    },
146    templateFunctions: function() {
147      var _this = this;
148
149			return {
150				// Functions allows rendering of sub views, with optional data to be pushed into the renderer. If no data the whole state will be present
151				renderPartial: function(partialName, data) {
152					var template = require('/template/partials/' + partialName);
153					if (template) {
154						if (data) {
155							return _this.renderTemplate(template, data);
156						} else {
157							return _this.renderTemplate(template, _this.state);
158						}
159					} else {
160						return 'No partial template found';
161					}
162				}
163			}
164		}
165	});
166});}});

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.