diff --git a/Gruntfile.js b/Gruntfile.js index 59b2996f..bca30ac5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -58,8 +58,8 @@ module.exports = function (grunt) { 'build-demos': { files: grunt.util._.map(getNonUrlDemos(), function (demonstrator) { - - if (grunt.util._.has(demonstrator, 'params')) { + var _ = grunt.util._; + if (_.has(demonstrator, 'params')) { return { file: 'demonstratorer/' + demonstrator.id + '.html', method: function (fs, fd, done) { @@ -104,8 +104,13 @@ module.exports = function (grunt) { demonstrator.desc = ''; } + var scripts = ['dist/scripts_external.js', 'dist/scripts.min.js']; + if (_.has(demonstrator, 'extraScripts') && _.isArray(demonstrator.extraScripts)) { + scripts = scripts.concat(demonstrator.extraScripts); + } + demonstrator.inline_js = fs.readFileSync('demonstratorer_content/' + demonstrator.id + '.js', 'utf8'); - demonstrator.scriptLinks = ['dist/scripts_external.js', 'dist/scripts.min.js']; + demonstrator.scriptLinks = scripts; demonstrator.cssLinks = userConfig.demoCssExternal.concat(['dist/style.css']); var pageTemplate = getTemplateFromFile('./grunt_templates/new_demo.html.tpl', fs); diff --git a/bower.json b/bower.json index ac2c8763..9c7bf441 100644 --- a/bower.json +++ b/bower.json @@ -30,16 +30,12 @@ "esri2geo": "https://github.com/calvinmetcalf/esri2geo.git", "L.TileLayer.Kartverket": "1.0.2", "Leaflet-MiniMap": "https://github.com/Norkart/Leaflet-MiniMap.git#~2.2.0", - "KNreiseAPI": "1.7.19", + "KNreiseAPI": "1.7.22", "cesium-minimap": "0.0.2", "cilogi-marker": "https://github.com/cilogi/cilogi-marker.git", "leaflet.knreise-markers": "https://github.com/knreise/Leaflet.knreise-markers.git", "leaflet-draw": "~0.2.4", "Leaflet.TileLayer.PouchDBCached": "https://github.com/MazeMap/Leaflet.TileLayer.PouchDBCached.git#0.1.0", "fontawesome": "4.4.0" - }, - "resolutions": { - "fontawesome": "4.4.0", - "KNreiseAPI": "1.7.20" } } diff --git a/bower_components/KNreiseAPI/.bower.json b/bower_components/KNreiseAPI/.bower.json index 392d46ec..80c50b55 100644 --- a/bower_components/KNreiseAPI/.bower.json +++ b/bower_components/KNreiseAPI/.bower.json @@ -1,6 +1,6 @@ { "name": "KNreiseAPI", - "version": "1.7.20", + "version": "1.7.22", "description": "Api wrapper for KNreise", "authors": [ "Atle Frenvik Sveen " @@ -26,14 +26,14 @@ "proj4": "~2.3.6" }, "homepage": "https://github.com/knreise/KNReiseAPI", - "_release": "1.7.20", + "_release": "1.7.22", "_resolution": { "type": "version", - "tag": "1.7.20", - "commit": "30f8269e845ba81341ab6e71afe8fcc44216c6c7" + "tag": "1.7.22", + "commit": "a61bd879b433e7c95136f7a0fbb0bff85d38f923" }, "_source": "git://github.com/knreise/KNReiseAPI.git", - "_target": "1.7.20", + "_target": "1.7.22", "_originalSource": "KNreiseAPI", "_direct": true } \ No newline at end of file diff --git a/bower_components/KNreiseAPI/bower.json b/bower_components/KNreiseAPI/bower.json index a860a8eb..bc27b1af 100644 --- a/bower_components/KNreiseAPI/bower.json +++ b/bower_components/KNreiseAPI/bower.json @@ -1,6 +1,6 @@ { "name": "KNreiseAPI", - "version": "1.7.20", + "version": "1.7.22", "description": "Api wrapper for KNreise", "authors": [ "Atle Frenvik Sveen " diff --git a/bower_components/KNreiseAPI/dist/KNreiseAPI.js b/bower_components/KNreiseAPI/dist/KNreiseAPI.js index 7d34d9bc..950ebe10 100644 --- a/bower_components/KNreiseAPI/dist/KNreiseAPI.js +++ b/bower_components/KNreiseAPI/dist/KNreiseAPI.js @@ -1254,6 +1254,8 @@ var KR = this.KR || {}; KR.SparqlAPI = function (apiName, options) { 'use strict'; + var license = options.licenseText || 'http://data.norge.no/nlod/no'; + var BASE_URL = options.url; if (typeof proj4 !== 'undefined') { @@ -1308,6 +1310,10 @@ KR.SparqlAPI = function (apiName, options) { } attrs.title = attrs.name; + if (!attrs.license) { + attrs.license = license; + } + if (_.has(item, 'point')) { return KR.Util.createGeoJSONFeatureFromGeom( _parseGeom(item.point), @@ -1356,7 +1362,6 @@ KR.SparqlAPI = function (apiName, options) { function _parseEnkeltminnePoly(response, errorCallback) { var bindings = response.results.bindings; - console.log(bindings); return bindings; } @@ -1380,23 +1385,31 @@ KR.SparqlAPI = function (apiName, options) { return; } - var query = 'select distinct ?id ?name ?description ?loccatlabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link {' + - ' ?id a ?type ;' + - ' rdfs:label ?name ;' + - ' ?description ;' + - ' ?loccat ;' + - ' ?p ;' + - ' ?point .' + - ' ?loccat rdfs:label ?loccatlabel .' + - ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid)' + - ' BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url)' + - ' optional {' + - ' ?picture ?id .' + - ' ?picture ?link' + - ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid)' + - ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img)' + - ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail)' + - ' }'; + var query = 'select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ' + + ' ?id a ?type ; ' + + ' rdfs:label ?name ; ' + + ' ?description ; ' + + ' ?loccat ; ' + + ' ?locart ; ' + + ' ?org ; ' + + ' ?p ; ' + + ' ?point . ' + + ' optional { ?loccat rdfs:label ?loccatlabel .} ' + + ' optional { ?locart rdfs:label ?locartlabel .} ' + + ' optional { ?org rdfs:label ?orglabel .} ' + + ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) ' + + ' BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) ' + + ' optional { ' + + ' ?picture ?id . ' + + ' ?picture ?link . ' + + ' ?picture rdfs:label ?picturelabel . ' + + ' ?picture dc:description ?picturedescription . ' + + ' ?picture ?picturelicence . ' + + ' BIND(REPLACE(STR(?link), "http://kulturminnebilder.ra.no/fotoweb/default.fwx\\\\?search\\\\=", "") AS ?linkid) ' + + ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?linkid) AS ?img) ' + + ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?linkid) AS ?thumbnail) ' + + '} '; + if (dataset.filter) { query += ' ' + dataset.filter; } @@ -1418,24 +1431,31 @@ KR.SparqlAPI = function (apiName, options) { fylke = '0' + fylke; } - var query = 'select ?id ?name ?description ?loccatlabel (SAMPLE(?point) as ?point) ?img ?thumbnail ?url as ?link {' + - ' ?id a ?type .' + - ' ?id rdfs:label ?name .' + - ' ?id ?kommune .' + - ' ?id ?description .' + - ' ?id ?lokalitetskategori .' + - ' ?lokalitetskategori rdfs:label ?loccatlabel .' + - ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid)' + - ' BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url)' + - ' ?id ?point .' + - ' optional {' + - ' ?picture ?id .' + - ' ?picture ?link' + - ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid)' + - ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=400&rs=0&pg=0&sr=", ?lokid) AS ?img)' + - ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail)' + - ' }' + - ' FILTER regex(?kommune, "^.*' + fylke + '[0-9]{2}") .'; + var query = ' select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ' + + ' ?id a ?type ; ' + + ' rdfs:label ?name ; ' + + ' ?description ; ' + + ' ?loccat ; ' + + ' ?locart ; ' + + ' ?org ; ' + + ' ?kommune ; ' + + ' ?point . ' + + ' optional { ?loccat rdfs:label ?loccatlabel .} ' + + ' optional { ?locart rdfs:label ?locartlabel .} ' + + ' optional { ?org rdfs:label ?orglabel .} ' + + ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) ' + + ' BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) ' + + ' optional { ' + + ' ?picture ?id . ' + + ' ?picture ?link . ' + + ' ?picture rdfs:label ?picturelabel . ' + + ' ?picture dc:description ?picturedescription . ' + + ' ?picture ?picturelicence . ' + + ' BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) ' + + ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img) ' + + ' BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) ' + + ' } ' + + ' FILTER regex(?kommune, "^.*' + fylke + '[1-9]{2}") . '; if (dataset.filter) { query += ' ' + dataset.filter; diff --git a/bower_components/KNreiseAPI/dist/KNreiseAPI.min.js b/bower_components/KNreiseAPI/dist/KNreiseAPI.min.js index 83419dca..5e115243 100644 --- a/bower_components/KNreiseAPI/dist/KNreiseAPI.min.js +++ b/bower_components/KNreiseAPI/dist/KNreiseAPI.min.js @@ -1,2 +1,2 @@ -/*! KNreiseAPI 1.7.20 2015-11-11 */ -var KR=this.KR||{};KR.Util={},function(a){"use strict";function b(a){return a*Math.PI/180}a.dictWithout=function(a){var b=_.without(_.keys(a),Array.prototype.slice.call(arguments,1));return _.reduce(b,function(b,c){return b[c]=a[c],b},{})},a.createQueryParameterString=function(a){return _.map(a,function(a,b){return encodeURIComponent(b)+"="+encodeURIComponent(a)}).join("&")},a.handleError=function(a,b,c){if(a)return void a({error:b,data:c});throw new Error(b)},a.sendRequest=function(b,c,d,e,f){return f=f||{},$.ajax({type:"get",beforeSend:function(a){_.each(f,function(b,c){a.setRequestHeader(c,b)})},url:b,success:function(b){if(c){var f;try{f=c(b,e)}catch(g){return void a.handleError(e,g.message,b)}_.isUndefined(f)||d(f)}else d(b)},error:e})},a.createGeoJSONFeature=function(a,b,c){return b=b||{},{type:"Feature",geometry:{type:"Point",coordinates:[a.lng,a.lat]},properties:b,id:c}},a.createGeoJSONFeatureFromGeom=function(a,b,c){return b=b||{},{type:"Feature",geometry:a,properties:b,id:c}},a.createFeatureCollection=function(a){return{type:"FeatureCollection",features:a}},a.stamp=function(){var a=0,b="_knreise_id";return function(c){return c[b]=c[b]||++a,c[b]}}(),a.haversine=function(a,c,d,e){var f=6371e3,g=b(a),h=b(d),i=b(d-a),j=b(e-c),k=Math.sin(i/2)*Math.sin(i/2)+Math.cos(g)*Math.cos(h)*Math.sin(j/2)*Math.sin(j/2),l=2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k));return f*l},a.splitBbox=function(a){return a.split(",").map(parseFloat)},a.addCrossorigin=function(a){return 0!==a.indexOf("http://crossorigin.me/")?"http://crossorigin.me/"+a:a}}(KR.Util);var KR=this.KR||{};KR.ArcgisAPI=function(a,b){"use strict";function c(a){return a=KR.Util.splitBbox(a),JSON.stringify({xmin:a[0],ymin:a[1],xmax:a[2],ymax:a[3]})}function d(a,b,c){b=JSON.parse(b);var d=b.features,e=_.map(a.features,function(a){var b=_.find(d,function(b){return b.attributes[c.matchId]===a.properties[c.matchId]});b&&(b=b.attributes,a.properties.thumbnail=b.UrlTilBilde);var e=_.extend(a.properties,{extra:b});return KR.Util.createGeoJSONFeatureFromGeom(a.geometry,e,a.id)});return KR.Util.createFeatureCollection(e)}function e(a,b,c,e){var f=_.map(a.features,function(a){return a.properties[b.matchId]}),g={where:b.matchId+" IN ("+f.join(",")+")",outFields:"*",returnGeometry:!1,returnIdsOnly:!1,returnCountOnly:!1,returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"pjson"},i=h+b.extraDataLayer+"/query";$.ajax({type:"POST",url:i,data:KR.Util.createQueryParameterString(g),success:function(e){c(d(a,e,b))},error:function(b){c(a)}})}function f(b,c,d,f){try{b=JSON.parse(b)}catch(g){}return _.has(b,"error")?void KR.Util.handleError(d,b.error.message):void esri2geo.toGeoJSON(b,function(b,g){b?c(KR.Util.createFeatureCollection([])):(_.each(g.features,function(b){_.has(b.properties,"Navn")&&(b.properties.title=b.properties.Navn),b.id=a+"_"+b.properties.OBJECTID}),f.getExtraData?e(g,f,c,d):c(g))})}function g(a,b,d,e){var g={geometry:c(b),geometryType:"esriGeometryEnvelope",inSR:4326,spatialRel:"esriSpatialRelIntersects",outFields:"*",returnGeometry:!0,outSR:4326,returnIdsOnly:!1,returnCountOnly:!1,outStatistics:"",returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"json"};a.query&&(g.where=a.query);var i=a.layer,j=h+i+"/query?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(j,null,function(b){f(b,d,e,a)},e)}var h=b.url;return{getBbox:g}};var KR=this.KR||{};KR.CartodbAPI=function(a,b){"use strict";function c(a){return"http://"+a+".cartodb.com/api/v2/sql"}function d(a){return function(b){var c=_.map(b.rows,function(b){var c=JSON.parse(b.geom),d=_.reduce(b,function(b,c,d){if(_.has(a,d)){var e=a[d];_.isArray(e)?_.each(e,function(a){b[a]=c}):b[e]=c}return b},{});return{type:"Feature",geometry:c,properties:d}});return KR.Util.createFeatureCollection(c)}}function e(){return _.reduce(r,function(a,b,c){return a[c]=d(b),a},{cartodb_general:function(a){var b=_.map(a.rows,function(a){var b=JSON.parse(a.geom);return{type:"Feature",geometry:b,properties:_.omit(a,"geom")}});return KR.Util.createFeatureCollection(b)}})}function f(a,b,d,e,f){var g={q:a},h=f||q,i=c(h)+"?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(i,b,d,e)}function g(a){var b=a.rows[0].st_extent;return b.replace("BOX(","").replace(")","").replace(/ /g,",")}function h(a,b,c){var d=["SELECT "+a,"FROM "+b];return c&&d.push("WHERE "+c),d.join(" ")}function i(a,b){return"ST_DWithin(the_geom::geography,'POINT("+a.lng+" "+a.lat+")'::geography, "+b+");"}function j(a){var b=a.mapper;return b||(b=e().cartodb_general),b}function k(a){return _.isArray(a)?a:[a]}function l(a,b,c){var d=h("ST_Extent(the_geom)","kommuner","komm in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function m(a,b,c){var d=h("ST_Extent(the_geom)","fylker","fylkesnr in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function n(a,b,c){var d,e=j(a);if(a.query)d=a.query;else if(a.table){var g=a.columns;g||(g=["*"]),_.has(r,a.table)&&(g=_.keys(r[a.table])),g.push("ST_AsGeoJSON(the_geom) as geom"),d="SELECT "+g.join(", ")+" FROM "+a.table}else a.county?d=h("ST_AsGeoJSON(the_geom) as geom","fylker","fylkesnr in ("+k(a.county).join(", ")+")"):a.municipality&&(d=h("ST_AsGeoJSON(the_geom) as geom","kommuner","komm in ("+k(a.municipality).join(", ")+")"));d&&f(d,e,b,c)}function o(a,b,c,d){var e=a.columns;e||(e=["*"]),e.push("ST_AsGeoJSON(the_geom) as geom");var g=h(e.join(", "),a.table,"ST_Intersects(the_geom, ST_MakeEnvelope("+b+", 4326))"),i=j(a);f(g,i,c,d)}function p(a,b,c,d,e){var g=_.keys(r["default"]).concat(["ST_AsGeoJSON(the_geom) as geom"]).join(", "),j=h(g,a.table,i(b,c));f(j,s,d,e)}var q=b.user,r={"default":{delving_thumbnail:["images","thumbnail"],dc_title:"title",dc_description:"content",europeana_isshownat:"link",europeana_collectiontitle:"dataset",abm_contentProvider:"provider",europeana_type:"contentType",delving_landingpage:"video"},pilegrimsleden_dovre:{iid:"id",name:"name",omradenavn:"omradenavn"}},s=d(r["default"]);return{getBbox:o,getData:n,getWithin:p,getMunicipalityBounds:l,getCountyBounds:m,mappers:e}};var KR=this.KR||{};KR.NorvegianaAPI=function(a){"use strict";function b(a){return a.lat+","+a.lng}function c(a){return a&&a.length?a[0]:null}function d(a){return a&&-1!==a.indexOf("www.youtube.com/watch")?"https://www.youtube.com/embed/"+a.substr(a.indexOf("watch?v=")+8):a}function e(a){return _.chain(a.item.fields).pairs().where(function(a){return"abm_latLong"!==a[0]}).reduce(function(a,b){return a[b[0]]=b[1],a},{}).value()}function f(a){var b=75;return a&&a.indexOf("width=")>-1&&a.indexOf("height=")>-1?a.replace(/(width=)(\d+)/g,"$1"+b).replace(/(height=)(\d+)/g,"$1"+b):a}function g(a,b){return _.chain(b).reduce(function(b,c){return _.has(a,c)&&(b=b.concat(a[c])),b},[]).uniq().value()}function h(a){return _.chain(a).map(function(a,b){return _.map(a,function(a){return{type:b,url:a}})}).flatten().value()}function i(a){var b=c(a.delving_thumbnail),e=g(a,["delving_thumbnail","abm_imageUri"]),i={video:_.map(a.abm_videoUri,d),sound:a.abm_soundUri,image:e};return{thumbnail:f(b),images:e,title:c(a.dc_title),content:_.map(a.dc_description,function(a){return"

"+a+"

"}).join("\n"),link:c(a.europeana_isShownAt),dataset:c(a.europeana_collectionTitle),provider:c(a.abm_contentProvider),contentType:c(a.europeana_type),video:c(a.abm_videoUri),videoEmbed:d(c(a.abm_videoUri)),sound:c(a.abm_soundUri),allProps:a,media:h(i)}}function j(b){var c,d=e(b),f=i(d),g=_.map(b.item.fields.abm_latLong[0].split(","),parseFloat);_.has(d,"delving_hubId")&&(c=a+"_"+d.delving_hubId[0]);var h=KR.Util.createGeoJSONFeature({lat:g[0],lng:g[1]},f,c);return h}function k(a){var b;a.result.pagination.hasNext&&(b=a.result.pagination.nextPage);var c=_.map(a.result.items,j),d=KR.Util.createFeatureCollection(c);return d.numFound=a.result.pagination.numFound,{geoJSON:d,nextPage:b}}function l(a,b,c){var d=[];return function e(f){if(d.push(f.geoJSON),f.nextPage)return void KR.Util.sendRequest(a+"&start="+f.nextPage,k,e,c);var g=_.reduce(d,function(a,b){return a.concat(b.features)},[]);b(KR.Util.createFeatureCollection(g))}}function m(a){return a=_.isArray(a)?a:[a],_.map(a,function(a){return"delving_spec:"+a}).join(" OR ")}function n(a){x[a]&&(x[a].abort(),x[a]=null)}function o(a,b,c){return KR.Util.sendRequest(a,k,function(a){b(a.geoJSON)},c)}function p(a,b,c){return KR.Util.sendRequest(a,k,l(a,b,c),c)}function q(a,b,c,d,e){var f=m(b.dataset);a=_.extend({query:f,format:"json",rows:1e3},a),a.query+=" delving_hasGeoHash:true";var g=f;b.query&&(a.qf=b.query,g+=b.query),n(g);var h=y+"?"+KR.Util.createQueryParameterString(a);e.allPages?x[g]=p(h,c,d):x[g]=o(h,c,d)}function r(a,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(j,k,l,k),KR.Util.haversine(l,g,l,k)]),n={pt:b({lat:l,lng:k}),d:m/1e3,geoType:"bbox"};q(n,a,d,e,f)}function s(a,c,d,e,f,g){var h={pt:b(c),d:d/1e3};q(h,a,e,f,g)}function t(a,b,c,d){if(a.query&&_.isArray(a.query)){var e="delving_spec:"+a.dataset+" AND ("+a.query.join(" OR ")+") AND delving_hasGeoHash:true",f={query:e,format:"json",rows:1e3},g=e;n(g);var h=y+"?"+KR.Util.createQueryParameterString(f);return void(d.allPages?x[g]=p(h,b,c):x[g]=o(h,b,c))}q({},a,b,c,d)}function u(a,b,c){var d={id:a.id,format:"json"},e=y+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(a){return j(a.result)},b,c)}function v(b){var c=_.map(b.geo_json.features,function(b){var c,d=i(b.properties);return _.has(d.allProps,"delving_hubId")&&(c=a+"_"+d.allProps.delving_hubId),b.properties=d,b.id=c,b});return b.geo_json=KR.Util.createFeatureCollection(c),b}function w(a,b,c){var d=z+a;KR.Util.sendRequest(d,v,b,c)}var x=[],y="http://kulturnett2.delving.org/api/search",z="http://acc.norvegiana.delving.org/en/api/knreise-collection/";return{getWithin:s,getItem:u,getBbox:r,getData:t,getCollection:w}};var KR=this.KR||{};KR.WikipediaAPI=function(a,b){"use strict";function c(a,b){var c=n+"?"+KR.Util.createQueryParameterString(a);KR.Util.sendRequest(c,null,function(a){try{a=JSON.parse(a)}catch(c){}b(a)})}function d(a,b){function d(f){if(_.each(f.query.pages,function(a,b){_.has(e,b)?e[b]=_.extend(e[b],a):e[b]=a}),_.has(f,"continue")){var g={};_.has(f["continue"],"picontinue")&&(g.picontinue=f["continue"].picontinue),_.has(f["continue"],"excontinue")&&(g.excontinue=f["continue"].excontinue);var h=_.extend(g,a);c(h,d)}else b(e)}var e={};c(a,d)}function e(a){var b="http://upload.wikimedia.org/wikipedia/commons/",c=CryptoJS.MD5(a).toString();return b+c.substr(0,1)+"/"+c.substr(0,2)+"/"+a}function f(a,b){var c={action:"query",prop:"extracts|pageimages",exlimit:"max",exintro:"",pilimit:"max",pageids:a,format:"json","continue":""};d(c,b)}function g(b,c){c=c||{};var d=c[b.pageid];d&&(b=_.extend(b,d));var f;_.has(b,"thumbnail")&&(f=b.thumbnail.source);var g=null;b.pageimage&&(g=[e(b.pageimage)]);var h=o+b.pageid,i={thumbnail:f,images:g,title:b.title,content:b.extract,link:h,dataset:"Wikipedia",provider:"Wikipedia",contentType:"TEXT",id:b.pageid};return KR.Util.createGeoJSONFeature({lat:b.lat,lng:b.lon},i,a+"_"+b.pageid)}function h(a,b,c){try{a=JSON.parse(a)}catch(d){}try{var e=_.pluck(a.query.geosearch,"pageid");e.length?f(e.join("|"),function(c){var d=_.map(a.query.geosearch,function(a){return g(a,c)});b(KR.Util.createFeatureCollection(d))}):b(KR.Util.createFeatureCollection([]))}catch(h){KR.Util.handleError(c,a.error.info)}}function i(a,b,c,d,e){if(c>m)return void KR.Util.handleError(e,"to wide search radius (max is "+m+")");var f={action:"query",list:"geosearch",gsradius:c,gscoord:b.lat+"|"+b.lng,format:"json",gslimit:50},g=n+"?"+KR.Util.createQueryParameterString(f);KR.Util.sendRequest(g,null,function(a){h(a,d,e)},e)}function j(a){var b=_.chain(a).reduce(function(a,b){return _.each(b,function(b,c){_.has(a,c)?a[c]=_.extend(a[c],b):a[c]=b}),a},{}).filter(function(a){return _.has(a,"coordinates")}).map(function(a){return a.lat=a.coordinates[0].lat,a.lon=a.coordinates[0].lon,a}).map(g).value();return KR.Util.createFeatureCollection(b)}function k(a,b,c,d){function e(a){var d=_.extend({},f,a),h=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(h,null,function(a){g.push(a.query.pages),_.has(a,"continue")?e(a["continue"]):b(j(g))},c)}var f={action:"query",generator:"categorymembers",gcmtitle:"Kategori:"+a.category,prop:"coordinates",format:"json"},g=[];e({"continue":""})}function l(a,b,c){var d={action:"query",pageids:a.id,prop:"coordinates|pageimages|extracts",format:"json"},e=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(b){return g(b.query.pages[a.id])},b,c)}var m=b.maxRadius||1e4,n=b.url,o=b.linkBase;return{getWithin:i,getData:k,getItem:l}};var KR=this.KR||{};KR.UtnoAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");if("gpx"===a.type){var d="http://ut.no/tur/"+a.id+"/gpx/";KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}else KR.Util.handleError(c,"Unknown type "+a.type)}return{getData:b}};var KR=this.KR||{};KR.FolketellingAPI=function(a){"use strict";function b(b){var c=_.map(b.results,function(b){var c=KR.Util.dictWithout(b,"latitude","longitude"),d={lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)};return KR.Util.createGeoJSONFeature(d,c,a+"_"+b.autoid)});return KR.Util.createFeatureCollection(c)}function c(a,c,d,e,f,i){var j=a.limit||1e3;if("property"!==a.dataset)return void KR.Util.handleError(f,"unknown dataset "+a.dataset);if(d>h)return void KR.Util.handleError(f,"to wide search radius");var k={latitude:c.lat,longitude:c.lng,precision:d,limit:j},l=g+"search_property_geo?"+KR.Util.createQueryParameterString(k);KR.Util.sendRequest(l,b,e,f)}function d(a,b,c){if(0===a.property.id.indexOf("gf")){if(!a.apartments)return a.apartments=null,void b({properties:a});var d=[],e=_.after(a.apartments.length,function(){a.apartments=d,b({properties:a})});return void _.each(a.apartments,function(a){f({type:"apartmentData",apartmentId:a.id},function(a){d.push(a),e()})})}b({properties:a})}function e(a){return a.apartments||(a.apartments=null),{properties:a}}function f(a,b,c,f){var h;"propertyData"===a.type&&a.propertyId?(h=g+"property/"+a.propertyId,a.withPersons?KR.Util.sendRequest(h,null,function(a){d(a,b,c)},c):KR.Util.sendRequest(h,e,b,c)):"apartmentData"===a.type&&a.apartmentId?(h=g+"property/"+a.apartmentId,KR.Util.sendRequest(h,null,b,c)):KR.Util.handleError(c,"Not enough parameters")}var g="http://api.digitalarkivet.arkivverket.no/v1/census/1910/",h=5e3;return{getData:f,getWithin:c}};var KR=this.KR||{};KR.SparqlAPI=function(a,b){"use strict";function c(a){if("undefined"==typeof proj4)throw new Error("Proj4js not found!");return proj4("EPSG:32633","EPSG:4326",a)}function d(a){return a=wellknown.parse(a.value),"Point"===a.type&&(a.coordinates=c(a.coordinates)),"Polygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a,c)})),"MultiPolygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a.coordinates,function(a){return _.map(a,c)})})),a}function e(b,c){var e=_.map(b.results.bindings,function(b){var c=_.without(_.keys(b),"point","omraade"),e=_.reduce(c,function(a,c){return a[c]=b[c].value,a},{});return e.img||(e.img=!1),e.title=e.name,_.has(b,"point")?KR.Util.createGeoJSONFeatureFromGeom(d(b.point),e,a+"_"+e.id):_.has(b,"omraade")?KR.Util.createGeoJSONFeatureFromGeom(d(b.omraade),e,a+"_"+e.id):null});return KR.Util.createFeatureCollection(e)}function f(a,b){var c=a.results.bindings;if(!c||0===c.length)return void KR.Util.handleError(b);var e=_.map(c,function(a){return a.lok.type="Polygon",KR.Util.createGeoJSONFeatureFromGeom(d(a.lok),{})}),f=_.map(e,function(a){return a.geometry}),g={type:"GeometryCollection",geometries:f};return KR.Util.createGeoJSONFeatureFromGeom(g,{})}function g(a,b,c,d){var e={"default-graph-uri":"",query:a,format:"application/sparql-results+json",timeout:0,debug:"off"},f=o+"?"+KR.Util.createQueryParameterString(e);KR.Util.sendRequest(f,b,c,d)}function h(a){if(a.kommune){var b="select distinct ?id ?name ?description ?loccatlabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?p ; ?point . ?loccat rdfs:label ?loccatlabel . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) }';return a.filter&&(b+=" "+a.filter),b+="}",a.limit&&(b+="LIMIT "+a.limit),b}}function i(a){if(a.fylke){var b=parseInt(a.fylke,10);10>b&&(b="0"+b);var c='select ?id ?name ?description ?loccatlabel (SAMPLE(?point) as ?point) ?img ?thumbnail ?url as ?link { ?id a ?type . ?id rdfs:label ?name . ?id ?kommune . ?id ?description . ?id ?lokalitetskategori . ?lokalitetskategori rdfs:label ?loccatlabel . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) ?id ?point . optional { ?picture ?id . ?picture ?link BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=400&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) } FILTER regex(?kommune, "^.*'+b+'[0-9]{2}") .';return a.filter&&(c+=" "+a.filter),c+=" } order by ?img",a.limit&&(c+="LIMIT "+a.limit),c}}function j(a){return"SELECT ?lok where { <"+a.trim()+"> ?lok . }"}function k(a){return"SELECT ?enk as ?id ?name ?desc as ?content ?area as ?omraade ?enkcatlabel where { ?enk a . ?enk rdfs:label ?name . ?enk <"+a.trim()+"> . ?enk ?desc . ?enk ?area . ?enk ?enkcat . ?enkcat rdfs:label ?enkcatlabel . } "}function l(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var e=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(e))});_.each(d,function(a){g(j(a),f,function(b){b.properties.lok=a,e.push(b),h()},c)})}function m(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var f=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d,function(a){g(k(a),e,function(b){var c=_.map(b.features,function(b){return b.properties.lokalitet=a,b});f=f.concat(c),h()},c)})}function n(a,b,c,d){if(a=_.extend({},{geomType:"point"},a),a.kommune){var f=h(a,c);g(f,e,b,c)}else if(a.fylke){var f=i(a,c);g(f,e,b,c)}else a.lokalitet&&"lokalitetpoly"===a.type?l(a,b,c):a.lokalitet&&"enkeltminner"===a.type?m(a,b,c):a.sparqlQuery?g(a.sparqlQuery,e,b,c):KR.Util.handleError(c,"not enough parameters")}var o=b.url;return"undefined"!=typeof proj4&&proj4.defs([["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),{getData:n}};var KR=this.KR||{};KR.FlickrAPI=function(a,b){"use strict";function c(a,b){return l(_.extend({size:b},a))}function d(b,d){if(b.stat&&"fail"===b.stat)return void KR.Util.handleError(d,b.message,b);var e=_.chain(b.photos.photo).filter(function(a){var b=parseFloat(a.latitude),c=parseFloat(a.longitude);return 0!=b||0!=c}).map(function(b){var d=KR.Util.dictWithout(b,"latitude","longitude");return d.thumbnail=c(b,"s"),d.image=c(b,"z"),KR.Util.createGeoJSONFeature({lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)},d,a+"_"+b.id)}).value();return KR.Util.createFeatureCollection(e)}function e(a,b,c){function e(e){var h=d(e,c);if(h&&h.features&&(g=g.concat(h.features)),e.photos&&e.photos.page.staticflickr.com/<%= server %>/<%= id %>_<%= secret %>_<%= size %>.jpg");return{getData:i,getWithin:g,getBbox:h}};var KR=this.KR||{};KR.KmlAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.kml,b,c)}return{getData:b}};var KR=this.KR||{};KR.GpxAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}return{getData:b}};var KR=this.KR||{};KR.GeoJsonAPI=function(a){"use strict";function b(a,b,c){var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,JSON.parse,b,c)}return{getData:b}};var KR=this.KR||{};KR.JernbanemuseetAPI=function(a,b){"use strict";function c(a){return _.has(a,"group")?a.group:l}function d(){return{"api-key":o}}function e(b){var c=_.map(b.data.records,function(b){var c,d=_.extend(b.contents[m],{id:b.record_id});return _.has(b,"latitude")&&_.has(b,"longitude")?c={lat:b.latitude,lng:b.longitude}:_.has(b,"location")?c={lat:b.location.latitude,lng:b.location.longitude}:console.error("no geometry"),KR.Util.createGeoJSONFeature(c,d,a+"_"+b.record_id)});return KR.Util.createFeatureCollection(c)}function f(a){return _.map(a.blocks,function(a){if("text"===a.type)return{text:a.data,type:a.type};if("image_video"===a.type||"audio"===a.type){var b=_.map(a.data,function(a){var b;"image"===a.type&&(b=a.url),"video"===a.type&&(b=a.url.mp4),"audio"===a.type&&(b=a.url.ogg);var c="",d="";return _.has(a.contents,m)&&(c=a.contents[m].description,d=a.contents[m].title),{title:d,description:c,type:a.type,url:b}});return{media:b,type:a.type}}return"links"===a.type?{links:a.data,type:"links"}:void 0})}function g(b){var c,d,e=b.data.contents[m],g={lat:b.data.location.latitude,lng:b.data.location.longitude},h=b.data.id,i=_.map(e.pages,function(a){return{title:a.title,blocks:f(a)}});b.data.images.length&&(c=_.pluck(b.data.images,"url"),d=b.data.images[0].thumbnail);var j={license:b.data.license.description,id:h,thumbnail:d,images:c,title:e.title,description:e.description,pages:i};return KR.Util.createGeoJSONFeature(g,j,a+"_"+h)}function h(a,b,e){var f=n+"/groups/"+c(a)+"/records/"+a.id+"?strip_html=true";KR.Util.sendRequest(f,g,b,e,d())}function i(a,b,c){var d=e(a),f=[],g=_.after(d.features.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d.features,function(a){h(a.properties.id,function(a){f.push(a),g()},function(){g()})})}function j(a,b,f,g,h,j){var k={lat:b.lat,"long":b.lng,radius:f},l=n+"/groups/"+c(a)+"/nearby?"+KR.Util.createQueryParameterString(k);j.getDetails?KR.Util.sendRequest(l,null,function(a){i(a,g,h)},null,d()):KR.Util.sendRequest(l,e,g,h,d())}function k(a,b,f,g){var h=n+"/groups/"+c(a)+"/geography";g.getDetails?KR.Util.sendRequest(h,null,function(a){i(a,b,f)},null,d()):(a.presentation&&(h="https://api.kulturpunkt.org/v2/owners/54/presentations/"+a.presentation),KR.Util.sendRequest(h,e,b,f,d()))}var l=192,m=b.lang||"no",n="https://api.kulturpunkt.org/v2/owners/54",o=b.apikey;return{getData:k,getWithin:j,getItem:h}};var KR=this.KR||{};KR.API=function(a){"use strict";function b(){return _.reduce(k,function(b,c,d){var e=c.params;return c.extend&&(e=_.extend(e,a[d])),b[d]=new c.api(d,e),b},{})}function c(a,b,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(h,g,l,k),KR.Util.haversine(j,i,l,k)]),n={lat:l,lng:k};a.getWithin(b,n,m,d,e,f)}function d(a){var b=l[a];if(b)return b;throw new Error("Unknown API")}function e(a,b,c,e){e=e||{};var f=d(a.api);f.getData(a,b,c,e)}function f(a,b,e,f,g){g=g||{};var h=d(a.api);_.has(h,"getBbox")?h.getBbox(a,b,e,f,g):c(h,a,b,e,f,g)}function g(a,b,c,e,f,g){g=g||{},c=c||5e3;var h=d(a.api);h.getWithin(a,b,c,e,f,g)}function h(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getMunicipalityBounds(a,b,c)}function i(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getCountyBounds(a,b,c)}function j(a,b,c){var e=d(a.api);if(_.has(e,"getItem"))e.getItem(a,b,c);else{if(!c)throw new Error("No getItem function for api "+a.api);c("No getItem function for api "+a.api)}}a=a||{};var k={norvegiana:{api:KR.NorvegianaAPI,params:{}},wikipedia:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://no.wikipedia.org/w/api.php",linkBase:"http://no.wikipedia.org/?curid="}},wikipediaNN:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://nn.wikipedia.org/w/api.php",linkBase:"http://nn.wikipedia.org/?curid="}},cartodb:{api:KR.CartodbAPI,extend:!0,params:{user:"knreise"}},kulturminnedata:{api:KR.ArcgisAPI,params:{url:"http://husmann.ra.no/arcgis/rest/services/Husmann/Husmann/MapServer/"}},kulturminnedataSparql:{api:KR.SparqlAPI,params:{url:"https://sparql.kulturminne.no/"}},utno:{api:KR.UtnoAPI,params:{}},folketelling:{api:KR.FolketellingAPI,params:{}},flickr:{api:KR.FlickrAPI,extend:!0,params:{}},kml:{api:KR.KmlAPI,params:{}},gpx:{api:KR.GpxAPI,params:{}},geojson:{api:KR.GeoJsonAPI,params:{}},lokalhistoriewiki:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/http://test.lokalhistoriewiki.no:8080/api.php",linkBase:"http://lokalhistoriewiki.no/?curid=",maxRadius:1e5}},jernbanemuseet:{api:KR.JernbanemuseetAPI,extend:!0,params:{lang:"no"}}},l=b();return{getData:e,getWithin:g,getBbox:f,getMunicipalityBounds:h,getCountyBounds:i,getItem:j,getCollection:function(a,b,c){var e=d("norvegiana");e.getCollection(a,b,c)},addApi:function(a,c,d){if(_.has(k,a))throw new Error("API with name "+a+" already exists");d=d||{},k[a]={api:c,params:d},l=b()}}},KR.API.mappers={}; \ No newline at end of file +/*! KNreiseAPI 1.7.22 2015-11-27 */ +var KR=this.KR||{};KR.Util={},function(a){"use strict";function b(a){return a*Math.PI/180}a.dictWithout=function(a){var b=_.without(_.keys(a),Array.prototype.slice.call(arguments,1));return _.reduce(b,function(b,c){return b[c]=a[c],b},{})},a.createQueryParameterString=function(a){return _.map(a,function(a,b){return encodeURIComponent(b)+"="+encodeURIComponent(a)}).join("&")},a.handleError=function(a,b,c){if(a)return void a({error:b,data:c});throw new Error(b)},a.sendRequest=function(b,c,d,e,f){return f=f||{},$.ajax({type:"get",beforeSend:function(a){_.each(f,function(b,c){a.setRequestHeader(c,b)})},url:b,success:function(b){if(c){var f;try{f=c(b,e)}catch(g){return void a.handleError(e,g.message,b)}_.isUndefined(f)||d(f)}else d(b)},error:e})},a.createGeoJSONFeature=function(a,b,c){return b=b||{},{type:"Feature",geometry:{type:"Point",coordinates:[a.lng,a.lat]},properties:b,id:c}},a.createGeoJSONFeatureFromGeom=function(a,b,c){return b=b||{},{type:"Feature",geometry:a,properties:b,id:c}},a.createFeatureCollection=function(a){return{type:"FeatureCollection",features:a}},a.stamp=function(){var a=0,b="_knreise_id";return function(c){return c[b]=c[b]||++a,c[b]}}(),a.haversine=function(a,c,d,e){var f=6371e3,g=b(a),h=b(d),i=b(d-a),j=b(e-c),k=Math.sin(i/2)*Math.sin(i/2)+Math.cos(g)*Math.cos(h)*Math.sin(j/2)*Math.sin(j/2),l=2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k));return f*l},a.splitBbox=function(a){return a.split(",").map(parseFloat)},a.addCrossorigin=function(a){return 0!==a.indexOf("http://crossorigin.me/")?"http://crossorigin.me/"+a:a}}(KR.Util);var KR=this.KR||{};KR.ArcgisAPI=function(a,b){"use strict";function c(a){return a=KR.Util.splitBbox(a),JSON.stringify({xmin:a[0],ymin:a[1],xmax:a[2],ymax:a[3]})}function d(a,b,c){b=JSON.parse(b);var d=b.features,e=_.map(a.features,function(a){var b=_.find(d,function(b){return b.attributes[c.matchId]===a.properties[c.matchId]});b&&(b=b.attributes,a.properties.thumbnail=b.UrlTilBilde);var e=_.extend(a.properties,{extra:b});return KR.Util.createGeoJSONFeatureFromGeom(a.geometry,e,a.id)});return KR.Util.createFeatureCollection(e)}function e(a,b,c,e){var f=_.map(a.features,function(a){return a.properties[b.matchId]}),g={where:b.matchId+" IN ("+f.join(",")+")",outFields:"*",returnGeometry:!1,returnIdsOnly:!1,returnCountOnly:!1,returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"pjson"},i=h+b.extraDataLayer+"/query";$.ajax({type:"POST",url:i,data:KR.Util.createQueryParameterString(g),success:function(e){c(d(a,e,b))},error:function(b){c(a)}})}function f(b,c,d,f){try{b=JSON.parse(b)}catch(g){}return _.has(b,"error")?void KR.Util.handleError(d,b.error.message):void esri2geo.toGeoJSON(b,function(b,g){b?c(KR.Util.createFeatureCollection([])):(_.each(g.features,function(b){_.has(b.properties,"Navn")&&(b.properties.title=b.properties.Navn),b.id=a+"_"+b.properties.OBJECTID}),f.getExtraData?e(g,f,c,d):c(g))})}function g(a,b,d,e){var g={geometry:c(b),geometryType:"esriGeometryEnvelope",inSR:4326,spatialRel:"esriSpatialRelIntersects",outFields:"*",returnGeometry:!0,outSR:4326,returnIdsOnly:!1,returnCountOnly:!1,outStatistics:"",returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"json"};a.query&&(g.where=a.query);var i=a.layer,j=h+i+"/query?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(j,null,function(b){f(b,d,e,a)},e)}var h=b.url;return{getBbox:g}};var KR=this.KR||{};KR.CartodbAPI=function(a,b){"use strict";function c(a){return"http://"+a+".cartodb.com/api/v2/sql"}function d(a){return function(b){var c=_.map(b.rows,function(b){var c=JSON.parse(b.geom),d=_.reduce(b,function(b,c,d){if(_.has(a,d)){var e=a[d];_.isArray(e)?_.each(e,function(a){b[a]=c}):b[e]=c}return b},{});return{type:"Feature",geometry:c,properties:d}});return KR.Util.createFeatureCollection(c)}}function e(){return _.reduce(r,function(a,b,c){return a[c]=d(b),a},{cartodb_general:function(a){var b=_.map(a.rows,function(a){var b=JSON.parse(a.geom);return{type:"Feature",geometry:b,properties:_.omit(a,"geom")}});return KR.Util.createFeatureCollection(b)}})}function f(a,b,d,e,f){var g={q:a},h=f||q,i=c(h)+"?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(i,b,d,e)}function g(a){var b=a.rows[0].st_extent;return b.replace("BOX(","").replace(")","").replace(/ /g,",")}function h(a,b,c){var d=["SELECT "+a,"FROM "+b];return c&&d.push("WHERE "+c),d.join(" ")}function i(a,b){return"ST_DWithin(the_geom::geography,'POINT("+a.lng+" "+a.lat+")'::geography, "+b+");"}function j(a){var b=a.mapper;return b||(b=e().cartodb_general),b}function k(a){return _.isArray(a)?a:[a]}function l(a,b,c){var d=h("ST_Extent(the_geom)","kommuner","komm in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function m(a,b,c){var d=h("ST_Extent(the_geom)","fylker","fylkesnr in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function n(a,b,c){var d,e=j(a);if(a.query)d=a.query;else if(a.table){var g=a.columns;g||(g=["*"]),_.has(r,a.table)&&(g=_.keys(r[a.table])),g.push("ST_AsGeoJSON(the_geom) as geom"),d="SELECT "+g.join(", ")+" FROM "+a.table}else a.county?d=h("ST_AsGeoJSON(the_geom) as geom","fylker","fylkesnr in ("+k(a.county).join(", ")+")"):a.municipality&&(d=h("ST_AsGeoJSON(the_geom) as geom","kommuner","komm in ("+k(a.municipality).join(", ")+")"));d&&f(d,e,b,c)}function o(a,b,c,d){var e=a.columns;e||(e=["*"]),e.push("ST_AsGeoJSON(the_geom) as geom");var g=h(e.join(", "),a.table,"ST_Intersects(the_geom, ST_MakeEnvelope("+b+", 4326))"),i=j(a);f(g,i,c,d)}function p(a,b,c,d,e){var g=_.keys(r["default"]).concat(["ST_AsGeoJSON(the_geom) as geom"]).join(", "),j=h(g,a.table,i(b,c));f(j,s,d,e)}var q=b.user,r={"default":{delving_thumbnail:["images","thumbnail"],dc_title:"title",dc_description:"content",europeana_isshownat:"link",europeana_collectiontitle:"dataset",abm_contentProvider:"provider",europeana_type:"contentType",delving_landingpage:"video"},pilegrimsleden_dovre:{iid:"id",name:"name",omradenavn:"omradenavn"}},s=d(r["default"]);return{getBbox:o,getData:n,getWithin:p,getMunicipalityBounds:l,getCountyBounds:m,mappers:e}};var KR=this.KR||{};KR.NorvegianaAPI=function(a){"use strict";function b(a){return a.lat+","+a.lng}function c(a){return a&&a.length?a[0]:null}function d(a){return a&&-1!==a.indexOf("www.youtube.com/watch")?"https://www.youtube.com/embed/"+a.substr(a.indexOf("watch?v=")+8):a}function e(a){return _.chain(a.item.fields).pairs().where(function(a){return"abm_latLong"!==a[0]}).reduce(function(a,b){return a[b[0]]=b[1],a},{}).value()}function f(a){var b=75;return a&&a.indexOf("width=")>-1&&a.indexOf("height=")>-1?a.replace(/(width=)(\d+)/g,"$1"+b).replace(/(height=)(\d+)/g,"$1"+b):a}function g(a,b){return _.chain(b).reduce(function(b,c){return _.has(a,c)&&(b=b.concat(a[c])),b},[]).uniq().value()}function h(a){return _.chain(a).map(function(a,b){return _.map(a,function(a){return{type:b,url:a}})}).flatten().value()}function i(a){var b=c(a.delving_thumbnail),e=g(a,["delving_thumbnail","abm_imageUri"]),i={video:_.map(a.abm_videoUri,d),sound:a.abm_soundUri,image:e};return{thumbnail:f(b),images:e,title:c(a.dc_title),content:_.map(a.dc_description,function(a){return"

"+a+"

"}).join("\n"),link:c(a.europeana_isShownAt),dataset:c(a.europeana_collectionTitle),provider:c(a.abm_contentProvider),contentType:c(a.europeana_type),video:c(a.abm_videoUri),videoEmbed:d(c(a.abm_videoUri)),sound:c(a.abm_soundUri),allProps:a,media:h(i)}}function j(b){var c,d=e(b),f=i(d),g=_.map(b.item.fields.abm_latLong[0].split(","),parseFloat);_.has(d,"delving_hubId")&&(c=a+"_"+d.delving_hubId[0]);var h=KR.Util.createGeoJSONFeature({lat:g[0],lng:g[1]},f,c);return h}function k(a){var b;a.result.pagination.hasNext&&(b=a.result.pagination.nextPage);var c=_.map(a.result.items,j),d=KR.Util.createFeatureCollection(c);return d.numFound=a.result.pagination.numFound,{geoJSON:d,nextPage:b}}function l(a,b,c){var d=[];return function e(f){if(d.push(f.geoJSON),f.nextPage)return void KR.Util.sendRequest(a+"&start="+f.nextPage,k,e,c);var g=_.reduce(d,function(a,b){return a.concat(b.features)},[]);b(KR.Util.createFeatureCollection(g))}}function m(a){return a=_.isArray(a)?a:[a],_.map(a,function(a){return"delving_spec:"+a}).join(" OR ")}function n(a){x[a]&&(x[a].abort(),x[a]=null)}function o(a,b,c){return KR.Util.sendRequest(a,k,function(a){b(a.geoJSON)},c)}function p(a,b,c){return KR.Util.sendRequest(a,k,l(a,b,c),c)}function q(a,b,c,d,e){var f=m(b.dataset);a=_.extend({query:f,format:"json",rows:1e3},a),a.query+=" delving_hasGeoHash:true";var g=f;b.query&&(a.qf=b.query,g+=b.query),n(g);var h=y+"?"+KR.Util.createQueryParameterString(a);e.allPages?x[g]=p(h,c,d):x[g]=o(h,c,d)}function r(a,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(j,k,l,k),KR.Util.haversine(l,g,l,k)]),n={pt:b({lat:l,lng:k}),d:m/1e3,geoType:"bbox"};q(n,a,d,e,f)}function s(a,c,d,e,f,g){var h={pt:b(c),d:d/1e3};q(h,a,e,f,g)}function t(a,b,c,d){if(a.query&&_.isArray(a.query)){var e="delving_spec:"+a.dataset+" AND ("+a.query.join(" OR ")+") AND delving_hasGeoHash:true",f={query:e,format:"json",rows:1e3},g=e;n(g);var h=y+"?"+KR.Util.createQueryParameterString(f);return void(d.allPages?x[g]=p(h,b,c):x[g]=o(h,b,c))}q({},a,b,c,d)}function u(a,b,c){var d={id:a.id,format:"json"},e=y+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(a){return j(a.result)},b,c)}function v(b){var c=_.map(b.geo_json.features,function(b){var c,d=i(b.properties);return _.has(d.allProps,"delving_hubId")&&(c=a+"_"+d.allProps.delving_hubId),b.properties=d,b.id=c,b});return b.geo_json=KR.Util.createFeatureCollection(c),b}function w(a,b,c){var d=z+a;KR.Util.sendRequest(d,v,b,c)}var x=[],y="http://kulturnett2.delving.org/api/search",z="http://acc.norvegiana.delving.org/en/api/knreise-collection/";return{getWithin:s,getItem:u,getBbox:r,getData:t,getCollection:w}};var KR=this.KR||{};KR.WikipediaAPI=function(a,b){"use strict";function c(a,b){var c=n+"?"+KR.Util.createQueryParameterString(a);KR.Util.sendRequest(c,null,function(a){try{a=JSON.parse(a)}catch(c){}b(a)})}function d(a,b){function d(f){if(_.each(f.query.pages,function(a,b){_.has(e,b)?e[b]=_.extend(e[b],a):e[b]=a}),_.has(f,"continue")){var g={};_.has(f["continue"],"picontinue")&&(g.picontinue=f["continue"].picontinue),_.has(f["continue"],"excontinue")&&(g.excontinue=f["continue"].excontinue);var h=_.extend(g,a);c(h,d)}else b(e)}var e={};c(a,d)}function e(a){var b="http://upload.wikimedia.org/wikipedia/commons/",c=CryptoJS.MD5(a).toString();return b+c.substr(0,1)+"/"+c.substr(0,2)+"/"+a}function f(a,b){var c={action:"query",prop:"extracts|pageimages",exlimit:"max",exintro:"",pilimit:"max",pageids:a,format:"json","continue":""};d(c,b)}function g(b,c){c=c||{};var d=c[b.pageid];d&&(b=_.extend(b,d));var f;_.has(b,"thumbnail")&&(f=b.thumbnail.source);var g=null;b.pageimage&&(g=[e(b.pageimage)]);var h=o+b.pageid,i={thumbnail:f,images:g,title:b.title,content:b.extract,link:h,dataset:"Wikipedia",provider:"Wikipedia",contentType:"TEXT",id:b.pageid};return KR.Util.createGeoJSONFeature({lat:b.lat,lng:b.lon},i,a+"_"+b.pageid)}function h(a,b,c){try{a=JSON.parse(a)}catch(d){}try{var e=_.pluck(a.query.geosearch,"pageid");e.length?f(e.join("|"),function(c){var d=_.map(a.query.geosearch,function(a){return g(a,c)});b(KR.Util.createFeatureCollection(d))}):b(KR.Util.createFeatureCollection([]))}catch(h){KR.Util.handleError(c,a.error.info)}}function i(a,b,c,d,e){if(c>m)return void KR.Util.handleError(e,"to wide search radius (max is "+m+")");var f={action:"query",list:"geosearch",gsradius:c,gscoord:b.lat+"|"+b.lng,format:"json",gslimit:50},g=n+"?"+KR.Util.createQueryParameterString(f);KR.Util.sendRequest(g,null,function(a){h(a,d,e)},e)}function j(a){var b=_.chain(a).reduce(function(a,b){return _.each(b,function(b,c){_.has(a,c)?a[c]=_.extend(a[c],b):a[c]=b}),a},{}).filter(function(a){return _.has(a,"coordinates")}).map(function(a){return a.lat=a.coordinates[0].lat,a.lon=a.coordinates[0].lon,a}).map(g).value();return KR.Util.createFeatureCollection(b)}function k(a,b,c,d){function e(a){var d=_.extend({},f,a),h=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(h,null,function(a){g.push(a.query.pages),_.has(a,"continue")?e(a["continue"]):b(j(g))},c)}var f={action:"query",generator:"categorymembers",gcmtitle:"Kategori:"+a.category,prop:"coordinates",format:"json"},g=[];e({"continue":""})}function l(a,b,c){var d={action:"query",pageids:a.id,prop:"coordinates|pageimages|extracts",format:"json"},e=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(b){return g(b.query.pages[a.id])},b,c)}var m=b.maxRadius||1e4,n=b.url,o=b.linkBase;return{getWithin:i,getData:k,getItem:l}};var KR=this.KR||{};KR.UtnoAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");if("gpx"===a.type){var d="http://ut.no/tur/"+a.id+"/gpx/";KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}else KR.Util.handleError(c,"Unknown type "+a.type)}return{getData:b}};var KR=this.KR||{};KR.FolketellingAPI=function(a){"use strict";function b(b){var c=_.map(b.results,function(b){var c=KR.Util.dictWithout(b,"latitude","longitude"),d={lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)};return KR.Util.createGeoJSONFeature(d,c,a+"_"+b.autoid)});return KR.Util.createFeatureCollection(c)}function c(a,c,d,e,f,i){var j=a.limit||1e3;if("property"!==a.dataset)return void KR.Util.handleError(f,"unknown dataset "+a.dataset);if(d>h)return void KR.Util.handleError(f,"to wide search radius");var k={latitude:c.lat,longitude:c.lng,precision:d,limit:j},l=g+"search_property_geo?"+KR.Util.createQueryParameterString(k);KR.Util.sendRequest(l,b,e,f)}function d(a,b,c){if(0===a.property.id.indexOf("gf")){if(!a.apartments)return a.apartments=null,void b({properties:a});var d=[],e=_.after(a.apartments.length,function(){a.apartments=d,b({properties:a})});return void _.each(a.apartments,function(a){f({type:"apartmentData",apartmentId:a.id},function(a){d.push(a),e()})})}b({properties:a})}function e(a){return a.apartments||(a.apartments=null),{properties:a}}function f(a,b,c,f){var h;"propertyData"===a.type&&a.propertyId?(h=g+"property/"+a.propertyId,a.withPersons?KR.Util.sendRequest(h,null,function(a){d(a,b,c)},c):KR.Util.sendRequest(h,e,b,c)):"apartmentData"===a.type&&a.apartmentId?(h=g+"property/"+a.apartmentId,KR.Util.sendRequest(h,null,b,c)):KR.Util.handleError(c,"Not enough parameters")}var g="http://api.digitalarkivet.arkivverket.no/v1/census/1910/",h=5e3;return{getData:f,getWithin:c}};var KR=this.KR||{};KR.SparqlAPI=function(a,b){"use strict";function c(a){if("undefined"==typeof proj4)throw new Error("Proj4js not found!");return proj4("EPSG:32633","EPSG:4326",a)}function d(a){return a=wellknown.parse(a.value),"Point"===a.type&&(a.coordinates=c(a.coordinates)),"Polygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a,c)})),"MultiPolygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a.coordinates,function(a){return _.map(a,c)})})),a}function e(b,c){var e=_.map(b.results.bindings,function(b){var c=_.without(_.keys(b),"point","omraade"),e=_.reduce(c,function(a,c){return a[c]=b[c].value,a},{});return e.img||(e.img=!1),e.title=e.name,e.license||(e.license=o),_.has(b,"point")?KR.Util.createGeoJSONFeatureFromGeom(d(b.point),e,a+"_"+e.id):_.has(b,"omraade")?KR.Util.createGeoJSONFeatureFromGeom(d(b.omraade),e,a+"_"+e.id):null});return KR.Util.createFeatureCollection(e)}function f(a,b){var c=a.results.bindings;if(!c||0===c.length)return void KR.Util.handleError(b);var e=_.map(c,function(a){return a.lok.type="Polygon",KR.Util.createGeoJSONFeatureFromGeom(d(a.lok),{})}),f=_.map(e,function(a){return a.geometry}),g={type:"GeometryCollection",geometries:f};return KR.Util.createGeoJSONFeatureFromGeom(g,{})}function g(a,b,c,d){var e={"default-graph-uri":"",query:a,format:"application/sparql-results+json",timeout:0,debug:"off"},f=p+"?"+KR.Util.createQueryParameterString(e);KR.Util.sendRequest(f,b,c,d)}function h(a){if(a.kommune){var b="select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?locart ; ?org ; ?p ; ?point . optional { ?loccat rdfs:label ?loccatlabel .} optional { ?locart rdfs:label ?locartlabel .} optional { ?org rdfs:label ?orglabel .} BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link . ?picture rdfs:label ?picturelabel . ?picture dc:description ?picturedescription . ?picture ?picturelicence . BIND(REPLACE(STR(?link), "http://kulturminnebilder.ra.no/fotoweb/default.fwx\\\\?search\\\\=", "") AS ?linkid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?linkid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?linkid) AS ?thumbnail) } ';return a.filter&&(b+=" "+a.filter),b+="}",a.limit&&(b+="LIMIT "+a.limit),b}}function i(a){if(a.fylke){var b=parseInt(a.fylke,10);10>b&&(b="0"+b);var c=' select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?locart ; ?org ; ?kommune ; ?point . optional { ?loccat rdfs:label ?loccatlabel .} optional { ?locart rdfs:label ?locartlabel .} optional { ?org rdfs:label ?orglabel .} BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link . ?picture rdfs:label ?picturelabel . ?picture dc:description ?picturedescription . ?picture ?picturelicence . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) } FILTER regex(?kommune, "^.*'+b+'[1-9]{2}") . ';return a.filter&&(c+=" "+a.filter),c+=" } order by ?img",a.limit&&(c+="LIMIT "+a.limit),c}}function j(a){return"SELECT ?lok where { <"+a.trim()+"> ?lok . }"}function k(a){return"SELECT ?enk as ?id ?name ?desc as ?content ?area as ?omraade ?enkcatlabel where { ?enk a . ?enk rdfs:label ?name . ?enk <"+a.trim()+"> . ?enk ?desc . ?enk ?area . ?enk ?enkcat . ?enkcat rdfs:label ?enkcatlabel . } "}function l(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var e=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(e))});_.each(d,function(a){g(j(a),f,function(b){b.properties.lok=a,e.push(b),h()},c)})}function m(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var f=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d,function(a){g(k(a),e,function(b){var c=_.map(b.features,function(b){return b.properties.lokalitet=a,b});f=f.concat(c),h()},c)})}function n(a,b,c,d){if(a=_.extend({},{geomType:"point"},a),a.kommune){var f=h(a,c);g(f,e,b,c)}else if(a.fylke){var f=i(a,c);g(f,e,b,c)}else a.lokalitet&&"lokalitetpoly"===a.type?l(a,b,c):a.lokalitet&&"enkeltminner"===a.type?m(a,b,c):a.sparqlQuery?g(a.sparqlQuery,e,b,c):KR.Util.handleError(c,"not enough parameters")}var o=b.licenseText||"http://data.norge.no/nlod/no",p=b.url;return"undefined"!=typeof proj4&&proj4.defs([["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),{getData:n}};var KR=this.KR||{};KR.FlickrAPI=function(a,b){"use strict";function c(a,b){return l(_.extend({size:b},a))}function d(b,d){if(b.stat&&"fail"===b.stat)return void KR.Util.handleError(d,b.message,b);var e=_.chain(b.photos.photo).filter(function(a){var b=parseFloat(a.latitude),c=parseFloat(a.longitude);return 0!=b||0!=c}).map(function(b){var d=KR.Util.dictWithout(b,"latitude","longitude");return d.thumbnail=c(b,"s"),d.image=c(b,"z"),KR.Util.createGeoJSONFeature({lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)},d,a+"_"+b.id)}).value();return KR.Util.createFeatureCollection(e)}function e(a,b,c){function e(e){var h=d(e,c);if(h&&h.features&&(g=g.concat(h.features)),e.photos&&e.photos.page.staticflickr.com/<%= server %>/<%= id %>_<%= secret %>_<%= size %>.jpg");return{getData:i,getWithin:g,getBbox:h}};var KR=this.KR||{};KR.KmlAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.kml,b,c)}return{getData:b}};var KR=this.KR||{};KR.GpxAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}return{getData:b}};var KR=this.KR||{};KR.GeoJsonAPI=function(a){"use strict";function b(a,b,c){var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,JSON.parse,b,c)}return{getData:b}};var KR=this.KR||{};KR.JernbanemuseetAPI=function(a,b){"use strict";function c(a){return _.has(a,"group")?a.group:l}function d(){return{"api-key":o}}function e(b){var c=_.map(b.data.records,function(b){var c,d=_.extend(b.contents[m],{id:b.record_id});return _.has(b,"latitude")&&_.has(b,"longitude")?c={lat:b.latitude,lng:b.longitude}:_.has(b,"location")?c={lat:b.location.latitude,lng:b.location.longitude}:console.error("no geometry"),KR.Util.createGeoJSONFeature(c,d,a+"_"+b.record_id)});return KR.Util.createFeatureCollection(c)}function f(a){return _.map(a.blocks,function(a){if("text"===a.type)return{text:a.data,type:a.type};if("image_video"===a.type||"audio"===a.type){var b=_.map(a.data,function(a){var b;"image"===a.type&&(b=a.url),"video"===a.type&&(b=a.url.mp4),"audio"===a.type&&(b=a.url.ogg);var c="",d="";return _.has(a.contents,m)&&(c=a.contents[m].description,d=a.contents[m].title),{title:d,description:c,type:a.type,url:b}});return{media:b,type:a.type}}return"links"===a.type?{links:a.data,type:"links"}:void 0})}function g(b){var c,d,e=b.data.contents[m],g={lat:b.data.location.latitude,lng:b.data.location.longitude},h=b.data.id,i=_.map(e.pages,function(a){return{title:a.title,blocks:f(a)}});b.data.images.length&&(c=_.pluck(b.data.images,"url"),d=b.data.images[0].thumbnail);var j={license:b.data.license.description,id:h,thumbnail:d,images:c,title:e.title,description:e.description,pages:i};return KR.Util.createGeoJSONFeature(g,j,a+"_"+h)}function h(a,b,e){var f=n+"/groups/"+c(a)+"/records/"+a.id+"?strip_html=true";KR.Util.sendRequest(f,g,b,e,d())}function i(a,b,c){var d=e(a),f=[],g=_.after(d.features.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d.features,function(a){h(a.properties.id,function(a){f.push(a),g()},function(){g()})})}function j(a,b,f,g,h,j){var k={lat:b.lat,"long":b.lng,radius:f},l=n+"/groups/"+c(a)+"/nearby?"+KR.Util.createQueryParameterString(k);j.getDetails?KR.Util.sendRequest(l,null,function(a){i(a,g,h)},null,d()):KR.Util.sendRequest(l,e,g,h,d())}function k(a,b,f,g){var h=n+"/groups/"+c(a)+"/geography";g.getDetails?KR.Util.sendRequest(h,null,function(a){i(a,b,f)},null,d()):(a.presentation&&(h="https://api.kulturpunkt.org/v2/owners/54/presentations/"+a.presentation),KR.Util.sendRequest(h,e,b,f,d()))}var l=192,m=b.lang||"no",n="https://api.kulturpunkt.org/v2/owners/54",o=b.apikey;return{getData:k,getWithin:j,getItem:h}};var KR=this.KR||{};KR.API=function(a){"use strict";function b(){return _.reduce(k,function(b,c,d){var e=c.params;return c.extend&&(e=_.extend(e,a[d])),b[d]=new c.api(d,e),b},{})}function c(a,b,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(h,g,l,k),KR.Util.haversine(j,i,l,k)]),n={lat:l,lng:k};a.getWithin(b,n,m,d,e,f)}function d(a){var b=l[a];if(b)return b;throw new Error("Unknown API")}function e(a,b,c,e){e=e||{};var f=d(a.api);f.getData(a,b,c,e)}function f(a,b,e,f,g){g=g||{};var h=d(a.api);_.has(h,"getBbox")?h.getBbox(a,b,e,f,g):c(h,a,b,e,f,g)}function g(a,b,c,e,f,g){g=g||{},c=c||5e3;var h=d(a.api);h.getWithin(a,b,c,e,f,g)}function h(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getMunicipalityBounds(a,b,c)}function i(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getCountyBounds(a,b,c)}function j(a,b,c){var e=d(a.api);if(_.has(e,"getItem"))e.getItem(a,b,c);else{if(!c)throw new Error("No getItem function for api "+a.api);c("No getItem function for api "+a.api)}}a=a||{};var k={norvegiana:{api:KR.NorvegianaAPI,params:{}},wikipedia:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://no.wikipedia.org/w/api.php",linkBase:"http://no.wikipedia.org/?curid="}},wikipediaNN:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://nn.wikipedia.org/w/api.php",linkBase:"http://nn.wikipedia.org/?curid="}},cartodb:{api:KR.CartodbAPI,extend:!0,params:{user:"knreise"}},kulturminnedata:{api:KR.ArcgisAPI,params:{url:"http://husmann.ra.no/arcgis/rest/services/Husmann/Husmann/MapServer/"}},kulturminnedataSparql:{api:KR.SparqlAPI,params:{url:"https://sparql.kulturminne.no/"}},utno:{api:KR.UtnoAPI,params:{}},folketelling:{api:KR.FolketellingAPI,params:{}},flickr:{api:KR.FlickrAPI,extend:!0,params:{}},kml:{api:KR.KmlAPI,params:{}},gpx:{api:KR.GpxAPI,params:{}},geojson:{api:KR.GeoJsonAPI,params:{}},lokalhistoriewiki:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/http://test.lokalhistoriewiki.no:8080/api.php",linkBase:"http://lokalhistoriewiki.no/?curid=",maxRadius:1e5}},jernbanemuseet:{api:KR.JernbanemuseetAPI,extend:!0,params:{lang:"no"}}},l=b();return{getData:e,getWithin:g,getBbox:f,getMunicipalityBounds:h,getCountyBounds:i,getItem:j,getCollection:function(a,b,c){var e=d("norvegiana");e.getCollection(a,b,c)},addApi:function(a,c,d){if(_.has(k,a))throw new Error("API with name "+a+" already exists");d=d||{},k[a]={api:c,params:d},l=b()}}},KR.API.mappers={}; \ No newline at end of file diff --git a/bower_components/KNreiseAPI/package.json b/bower_components/KNreiseAPI/package.json index 579b7ed7..f4b08bf4 100644 --- a/bower_components/KNreiseAPI/package.json +++ b/bower_components/KNreiseAPI/package.json @@ -1,6 +1,6 @@ { "name": "KNreiseAPI", - "version": "1.7.20", + "version": "1.7.22", "description": "Api wrapper for KNreise", "main": "index.js", "scripts": { diff --git a/bower_components/L.SnowLayer.js b/bower_components/L.SnowLayer.js new file mode 100644 index 00000000..6a19e17f --- /dev/null +++ b/bower_components/L.SnowLayer.js @@ -0,0 +1,197 @@ +(function () { + 'use strict'; + + //canvasOverlay from http://bl.ocks.org/sumbera/11114288 + + L.CanvasOverlay = L.Class.extend({ + + initialize: function (userDrawFunc, options) { + this._userDrawFunc = userDrawFunc; + L.setOptions(this, options); + }, + + drawing: function (userDrawFunc) { + this._userDrawFunc = userDrawFunc; + return this; + }, + + params:function(options){ + L.setOptions(this, options); + return this; + }, + + canvas: function () { + return this._canvas; + }, + + redraw: function () { + if (!this._frame) { + this._frame = L.Util.requestAnimFrame(this._redraw, this); + } + return this; + }, + + onAdd: function (map) { + this._map = map; + this._canvas = L.DomUtil.create('canvas', 'leaflet-heatmap-layer'); + + var size = this._map.getSize(); + this._canvas.width = size.x; + this._canvas.height = size.y; + + var animated = this._map.options.zoomAnimation && L.Browser.any3d; + L.DomUtil.addClass(this._canvas, 'leaflet-zoom-' + (animated ? 'animated' : 'hide')); + + map._panes.overlayPane.appendChild(this._canvas); + + map.on('moveend', this._reset, this); + map.on('resize', this._resize, this); + + if (map.options.zoomAnimation && L.Browser.any3d) { + map.on('zoomanim', this._animateZoom, this); + } + + this._reset(); + }, + + onRemove: function (map) { + map.getPanes().overlayPane.removeChild(this._canvas); + + map.off('moveend', this._reset, this); + map.off('resize', this._resize, this); + + if (map.options.zoomAnimation) { + map.off('zoomanim', this._animateZoom, this); + } + this_canvas = null; + + }, + + addTo: function (map) { + map.addLayer(this); + return this; + }, + + _resize: function (resizeEvent) { + this._canvas.width = resizeEvent.newSize.x; + this._canvas.height = resizeEvent.newSize.y; + }, + + _reset: function () { + var topLeft = this._map.containerPointToLayerPoint([0, 0]); + L.DomUtil.setPosition(this._canvas, topLeft); + this._redraw(); + }, + + _redraw: function () { + var size = this._map.getSize(); + var bounds = this._map.getBounds(); + var zoomScale = (size.x * 180) / (20037508.34 * (bounds.getEast() - bounds.getWest())); // resolution = 1/zoomScale + var zoom = this._map.getZoom(); + + if (this._userDrawFunc) { + this._userDrawFunc(this, { + canvas :this._canvas, + bounds : bounds, + size : size, + zoomScale: zoomScale, + zoom : zoom, + options: this.options + }); + } + this._frame = null; + }, + + _animateZoom: function (e) { + var scale = this._map.getZoomScale(e.zoom), + offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos()); + + this._canvas.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(offset) + ' scale(' + scale + ')'; + } + }); + + L.canvasOverlay = function (userDrawFunc, options) { + return new L.CanvasOverlay(userDrawFunc, options); + }; + + function getDrawSnow(color) { + color = color || 'rgba(255, 255, 255, 0.8)'; + + //snow drawing function from http://thecodeplayer.com/walkthrough/html5-canvas-snow-effect + return function drawSnow(canvasOverlay, params) { + var ctx = params.canvas.getContext('2d'); + + //canvas dimensions + var W = window.innerWidth; + var H = window.innerHeight; + + //snowflake particles + var mp = 25; //max particles + var particles = []; + for(var i = 0; i < mp; i++) { + particles.push({ + x: Math.random()*W, //x-coordinate + y: Math.random()*H, //y-coordinate + r: Math.random()*4+1, //radius + d: Math.random()*mp //density + }); + } + //Lets draw the flakes + function draw() { + ctx.clearRect(0, 0, W, H); + + ctx.fillStyle = color; + ctx.beginPath(); + for(var i = 0; i < mp; i++) + { + var p = particles[i]; + ctx.moveTo(p.x, p.y); + ctx.arc(p.x, p.y, p.r, 0, Math.PI*2, true); + } + ctx.fill(); + update(); + } + + //Function to move the snowflakes + //angle will be an ongoing incremental flag. Sin and Cos functions will be applied to it to create vertical and horizontal movements of the flakes + var angle = 0; + function update() { + angle += 0.01; + for(var i = 0; i < mp; i++) { + var p = particles[i]; + //Updating X and Y coordinates + //We will add 1 to the cos function to prevent negative values which will lead flakes to move upwards + //Every particle has its own density which can be used to make the downward movement different for each flake + //Lets make it more random by adding in the radius + p.y += Math.cos(angle+p.d) + 1 + p.r/2; + p.x += Math.sin(angle) * 2; + + //Sending flakes back from the top when it exits + //Lets make it a bit more organic and let flakes enter from the left and right also. + if(p.x > W+5 || p.x < -5 || p.y > H) { + if(i%3 > 0) { //66.67% of the flakes + particles[i] = {x: Math.random()*W, y: -10, r: p.r, d: p.d}; + } else { + //If the flake is exitting from the right + if(Math.sin(angle) > 0) { + //Enter from the left + particles[i] = {x: -5, y: Math.random()*H, r: p.r, d: p.d}; + } else { + //Enter from the right + particles[i] = {x: W+5, y: Math.random()*H, r: p.r, d: p.d}; + } + } + } + } + } + + //animation loop + setInterval(draw, 33); + }; + } + + L.snowLayer = function (color) { + return new L.CanvasOverlay(getDrawSnow(color)); + }; + +}()); \ No newline at end of file diff --git a/build.config.js b/build.config.js index a36ccf0b..b308a2c5 100644 --- a/build.config.js +++ b/build.config.js @@ -281,6 +281,12 @@ module.exports = { id: '2verdenskrig', name: '2. verdenskrig', description: '2. verdenskrig og krigens kulturminner. Eget kartgrunnlag basert på tjenesten Mapbox og innhold knyttet til 2. verdenskrig fra Digitalt Fortalt, Jernbanemuseet, Riksantikvaren, Wikipedia og Digitalt Museum.' + }, + { + id: 'jul', + name: 'God jul', + description: 'Julehistorie fra hele landet', + extraScripts: ['bower_components/L.SnowLayer.js'] } ], experiments: [ diff --git a/common/css/L.Knreise.Control.Sidebar.css b/common/css/L.Knreise.Control.Sidebar.css index d59d664e..f2ee3819 100644 --- a/common/css/L.Knreise.Control.Sidebar.css +++ b/common/css/L.Knreise.Control.Sidebar.css @@ -332,4 +332,22 @@ .wikipedia-content h2 { font-size: 18px; +} + +.image.with-caption { + display: inline-block; + background: #f5f5f5; + margin-bottom: 15px; +} +.image.with-caption p { + margin: 0; + padding-bottom: 0.5em; + color: #999; + font-size: 90%; + padding-left: 0.5em; + padding-right: 0.5em; +} + +.image.with-caption .thumbnail { + margin-bottom: 5px; } \ No newline at end of file diff --git a/common/js/SidebarContent.js b/common/js/SidebarContent.js index 8cc10203..c57b6ebc 100644 --- a/common/js/SidebarContent.js +++ b/common/js/SidebarContent.js @@ -149,7 +149,7 @@ var KR = this.KR || {}; if (feature.properties.thumbnail) { marker = options.thumbnailTemplate({ thumbnail: KR.Util.getImageCache(feature.properties.thumbnail, 80, 60), - thumbnail2x: KR.Util.getImageCache(feature.properties.thumbnail, 60, 120), + thumbnail2x: KR.Util.getImageCache(feature.properties.thumbnail, 120, 90), color: KR.Style.colorForFeature(feature, true) }); } else { @@ -204,7 +204,7 @@ var KR = this.KR || {}; if (feature.properties.allProps && feature.properties.allProps.europeana_rights) { feature.properties.license = feature.properties.allProps.europeana_rights[0]; } else { - feature.properties.license = null; + feature.properties.license = feature.properties.license; } diff --git a/common/js/setupMap.js b/common/js/setupMap.js index 6e8db799..89959217 100644 --- a/common/js/setupMap.js +++ b/common/js/setupMap.js @@ -249,6 +249,13 @@ var KR = this.KR || {}; options = _.extend({}, DEFAULT_OPTIONS, options); var map = KR.Util.createMap('map', options); + + if (_.has(options, 'extraLayers') && _.isArray(options.extraLayers)) { + _.each(options.extraLayers, function (extraLayer) { + map.addLayer(extraLayer); + }); + } + var sidebar = KR.Util.setupSidebar(map, {featureHash: options.featureHash}); var datasetLoader = new KR.DatasetLoader(api, map, sidebar, null, options.cluster, options.clusterRadius); diff --git a/demonstratorer/2verdenskrig.html b/demonstratorer/2verdenskrig.html index 5be081b0..01d6c498 100644 --- a/demonstratorer/2verdenskrig.html +++ b/demonstratorer/2verdenskrig.html @@ -394,14 +394,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -450,9 +442,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -460,12 +457,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/akerselva.html b/demonstratorer/akerselva.html index b8bfb339..d21fef81 100644 --- a/demonstratorer/akerselva.html +++ b/demonstratorer/akerselva.html @@ -400,14 +400,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -456,9 +448,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -466,12 +463,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/config.html b/demonstratorer/config.html index af5f1c0e..ba4f2f68 100644 --- a/demonstratorer/config.html +++ b/demonstratorer/config.html @@ -394,14 +394,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -450,9 +442,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -460,12 +457,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/config_3d.html b/demonstratorer/config_3d.html index 55f3169c..2ffbdadb 100644 --- a/demonstratorer/config_3d.html +++ b/demonstratorer/config_3d.html @@ -398,14 +398,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -454,9 +446,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -464,12 +461,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/dovre.html b/demonstratorer/dovre.html index fe6c4ffc..394cff53 100644 --- a/demonstratorer/dovre.html +++ b/demonstratorer/dovre.html @@ -396,14 +396,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -452,9 +444,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -462,12 +459,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/flyktningeruta.html b/demonstratorer/flyktningeruta.html index 6d69a51e..a0c95a9b 100644 --- a/demonstratorer/flyktningeruta.html +++ b/demonstratorer/flyktningeruta.html @@ -391,14 +391,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -447,9 +439,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -457,12 +454,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/folkemusikk.html b/demonstratorer/folkemusikk.html index 0feef7d1..4b026be0 100644 --- a/demonstratorer/folkemusikk.html +++ b/demonstratorer/folkemusikk.html @@ -394,14 +394,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -450,9 +442,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -460,12 +457,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/foto.html b/demonstratorer/foto.html index 018e5ef4..6544d1fb 100644 --- a/demonstratorer/foto.html +++ b/demonstratorer/foto.html @@ -400,14 +400,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -456,9 +448,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -466,12 +463,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/gudbrandsdalsleden.html b/demonstratorer/gudbrandsdalsleden.html index c6e7456b..9e208620 100644 --- a/demonstratorer/gudbrandsdalsleden.html +++ b/demonstratorer/gudbrandsdalsleden.html @@ -400,14 +400,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -456,9 +448,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -466,12 +463,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/jul.html b/demonstratorer/jul.html new file mode 100644 index 00000000..e19f728c --- /dev/null +++ b/demonstratorer/jul.html @@ -0,0 +1,749 @@ + + + + + + + KNReise - God jul + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demonstratorer/keiserstien.html b/demonstratorer/keiserstien.html index 505dc58f..2c7ddd13 100644 --- a/demonstratorer/keiserstien.html +++ b/demonstratorer/keiserstien.html @@ -391,14 +391,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -447,9 +439,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -457,12 +454,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/kjaerlighetsstien.html b/demonstratorer/kjaerlighetsstien.html index fc52c263..8dfa8eb2 100644 --- a/demonstratorer/kjaerlighetsstien.html +++ b/demonstratorer/kjaerlighetsstien.html @@ -395,14 +395,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -451,9 +443,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -461,12 +458,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/nidelva.html b/demonstratorer/nidelva.html index fa870e63..8117c686 100644 --- a/demonstratorer/nidelva.html +++ b/demonstratorer/nidelva.html @@ -398,14 +398,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -454,9 +446,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -464,12 +461,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/norge.html b/demonstratorer/norge.html index 55ec83dc..01560028 100644 --- a/demonstratorer/norge.html +++ b/demonstratorer/norge.html @@ -391,14 +391,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -447,9 +439,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -457,12 +454,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/telemark.html b/demonstratorer/telemark.html index 8eee6e8f..0b66d6c6 100644 --- a/demonstratorer/telemark.html +++ b/demonstratorer/telemark.html @@ -394,14 +394,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -450,9 +442,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -460,12 +457,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer/trondheim.html b/demonstratorer/trondheim.html index 6019da22..73694d3e 100644 --- a/demonstratorer/trondheim.html +++ b/demonstratorer/trondheim.html @@ -394,14 +394,6 @@

<%= property.gatenavn_og_nummer_i_gata %>

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> @@ -450,9 +442,14 @@

<%= title %>

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -460,12 +457,20 @@

<%= name %>

+ <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - Vis hos Kulturminnesøk - - diff --git a/demonstratorer_content/jul.js b/demonstratorer_content/jul.js new file mode 100644 index 00000000..52700d6c --- /dev/null +++ b/demonstratorer_content/jul.js @@ -0,0 +1,70 @@ +(function () { + 'use strict'; + + var api = new KR.API({ + flickr: { + apikey: 'ab1f664476dabf83a289735f97a6d56c' + } + }); + + var kulturminneFunctions = KR.Config.getKulturminneFunctions(api); + + //The datasets in use + var datasets = [ + { + name: 'Digitalt fortalt', + dataset: { + dataset: 'difo', + api: 'norvegiana', + query: 'dc_subject_text:jul' + }, + cluster: true, + template: KR.Util.getDatasetTemplate('digitalt_fortalt'), + noListThreshold: Infinity, + isStatic: false, + bbox: false, + feedbackForm: true, + style: {fillcolor: '#0a6f00'} + }, + { + name: 'Digitalt Museum', + dataset: { + api: 'norvegiana', + dataset: 'DiMu', + query: 'dc_subject_facet:Jul' + }, + template: KR.Util.getDatasetTemplate('digitalt_museum'), + isStatic: false, + bbox: true, + style: {thumbnail: true, fillcolor: '#aa1000'} + }, + { + name: 'Riksarkivet', + provider: 'Riksarkivet', + dataset: { + api: 'flickr', + user_id: 'national_archives_of_norway', + tags: ['jul'], + accuracy: '10' + }, + template: KR.Util.getDatasetTemplate('flickr'), + style: {thumbnail: true, fillcolor: '#460073'}, + minZoom: 8, + } + ]; + + var layer = L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png'); + + var snowLayer = L.snowLayer('rgba(255, 255, 255, 1.0)'); + + KR.setupMap(api, datasets, { + bbox: '-3.33984375,53.64463782485651,37.6171875,75.0956327285438', + title: title, + image: 'http://dms10.dimu.org/image/032uKXXfZSh3?dimension=600x380', + description: $('#description_template').html(), + geomFilter: false, + showGeom: true, + layer: layer, + extraLayers: [snowLayer] + }); +}()); diff --git a/demonstratorer_content/jul.txt b/demonstratorer_content/jul.txt new file mode 100644 index 00000000..e69de29b diff --git a/dist/scripts.js b/dist/scripts.js index ba780f73..1e55eede 100644 --- a/dist/scripts.js +++ b/dist/scripts.js @@ -1882,7 +1882,7 @@ var KR = this.KR || {}; if (feature.properties.thumbnail) { marker = options.thumbnailTemplate({ thumbnail: KR.Util.getImageCache(feature.properties.thumbnail, 80, 60), - thumbnail2x: KR.Util.getImageCache(feature.properties.thumbnail, 60, 120), + thumbnail2x: KR.Util.getImageCache(feature.properties.thumbnail, 120, 90), color: KR.Style.colorForFeature(feature, true) }); } else { @@ -1937,7 +1937,7 @@ var KR = this.KR || {}; if (feature.properties.allProps && feature.properties.allProps.europeana_rights) { feature.properties.license = feature.properties.allProps.europeana_rights[0]; } else { - feature.properties.license = null; + feature.properties.license = feature.properties.license; } @@ -4449,6 +4449,13 @@ var KR = this.KR || {}; options = _.extend({}, DEFAULT_OPTIONS, options); var map = KR.Util.createMap('map', options); + + if (_.has(options, 'extraLayers') && _.isArray(options.extraLayers)) { + _.each(options.extraLayers, function (extraLayer) { + map.addLayer(extraLayer); + }); + } + var sidebar = KR.Util.setupSidebar(map, {featureHash: options.featureHash}); var datasetLoader = new KR.DatasetLoader(api, map, sidebar, null, options.cluster, options.clusterRadius); diff --git a/dist/scripts.min.js b/dist/scripts.min.js index 3e12c736..dfd39f98 100644 --- a/dist/scripts.min.js +++ b/dist/scripts.min.js @@ -1,2 +1,2 @@ -var KR=this.KR||{};!function(a){"use strict";a.parseError=function(a){if(a.responseJSON){if(a.responseJSON.error)return a.responseJSON.error.join(", ");if(a.responseJSON.status)return a.responseJSON.status}return a.statusText?a.statusText:a.error?a.error.info?a.error.info:a.error.error?a.error.error:a.error:"Unknown error"},a.errorHandler=function(b){var c=$(b);c.find(".close").on("click",function(){c.find(".content").html(""),c.remove()});var d=_.template("
<%= dataset %>: <%= error %>
");return function(b){var e=d({dataset:b.dataset,error:a.parseError(b.error)});c.parent()?c.find(".content").append(e):c.find(".content").html(e),$("body").append(c)}}}(KR);var KR=this.KR||{};KR.Config={contentIcons:{IMAGE:"camera-retro",VIDEO:"file-video-o",SOUND:"music",TEXT:"file-text","default":"file-o"},templates:{}},KR.Config.ImageCaheUrl="http://egbtmre.cloudimg.io",KR.Util=KR.Util||{},function(a){"use strict";function b(a,b){var c=a.lastIndexOf(b);return-1!==c&&c+b.length===a.length}function c(a){return 1e3>a?"0"+a:a}a.iconForContentType=function(a){var b=a.properties.contentType;return _.has(KR.Config.contentIcons,b)?KR.Config.contentIcons[b]:KR.Config.contentIcons["default"]},a.getDatasetTemplate=function(a){var b=$("#"+a+"_template").html();return b?_.template(b):void 0},a.templateForDataset=function(a){return _.has(KR.Config.templates,a)?KR.Config.templates[a]:void 0},a.createStyleString=function(a){return _.map(a,function(a,b){return b+": "+a}).join(";")},a.colorForProvider=function(a,b){var c=!0;"hex"!==b&&(c=!1);var d={properties:{datasetId:a}};return KR.Style.colorForFeature(d,c,!0)},a.featureClick=function(a){return function(b,c,d){c.on("click",function(c){d&&d.toPoint&&d.toPoint.stopPolyClick&&!c.parent||(d?a.showFeature(b,d.template,d.getFeatureData):a.showFeature(b))})}},a.getTemplateForFeature=function(a,b){if(b){if(b.datasets){var c=_.find(b.datasets,function(b){return b._knreise_id===a.properties.datasetID});return c.template}return b.template}},a.clusterClick=function(b){return function(c,d){c.on("clusterclick",function(c){var e=_.map(c.layer.getAllChildMarkers(),function(b){var c=b.feature;return d&&!c.template&&(c.template=a.getTemplateForFeature(c,d)),c}),f=_.extend({},{template:null,getFeatureData:null,noListThreshold:null},d);b.showFeatures(e,f.template,f.getFeatureData,f.noListThreshold)})}},a.hexToRgba=function(a,b){b=b||1;var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(!c)return 0;var d={r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)};return"rgba("+d.r+","+d.g+","+d.b+","+b+")"},a.filterByBbox=function(a,b){var c=turf.featurecollection([turf.bboxPolygon(KR.Util.splitBbox(b))]);return turf.within(a,c)},a.getDatasetId=function(a){return"norvegiana"===a.dataset.api?a.dataset.dataset:"wikipedia"===a.dataset.api?"wikipedia":a.id?a.id:KR.Util.stamp(a)},"undefined"!=typeof L&&(L.latLngBounds.fromBBoxArray=function(a){return new L.LatLngBounds(new L.LatLng(a[1],a[0]),new L.LatLng(a[3],a[2]))},L.latLngBounds.fromBBoxString=function(a){return L.latLngBounds.fromBBoxArray(KR.Util.splitBbox(a))},L.rectangle.fromBounds=function(a){return L.rectangle([a.getSouthWest(),a.getNorthEast()])}),a.parseQueryString=function(a){var b=decodeURIComponent(a);if(""!==b)return _.reduce(b.replace("?","").split("&"),function(a,b){b=b.split("=");var c=b[1];return"true"===c?c=!0:"false"===c&&(c=!1),a[b[0]]=c,a},{})};var d=_.template("<%= totalt %> (<%= menn %> menn, <%= kvinner %> kvinner)");a.formatPersons=function(a){var b=a.split("-");return b.length<2?a:d({totalt:b[0],menn:b[1],kvinner:b[2]})},a.getBaseLayer=function(a,b){var c={nib:KR.getNibLayer,hist:function(a){a(L.tileLayer.wms("http://wms.geonorge.no/skwms1/wms.historiskekart",{layers:"historiskekart",format:"image/png",attribution:"Kartverket"}))}};if(_.has(c,a))c[a](b);else{var d=navigator.userAgent.indexOf("Safari")>-1,e=!d;b(L.tileLayer.kartverket(a,{useCache:e}))}},a.getLine=function(a,c,d){if(_.isFunction(c))return void c(function(a){d(a)});var e;if(0===c.indexOf("utno/")){var f=c.replace("utno/","");e={api:"utno",id:f,type:"gpx"}}else 0===c.indexOf("http")&&(b(c,"kml")?e={api:"kml",url:c}:b(c,"gpx")||-1!==c.indexOf("http://ut.no/tur/")?e={api:"gpx",url:c}:b(c,"geojson")&&(e={api:"geojson",url:c}));e?a.getData(e,function(a){d(a)}):alert("Kunne ikke laste linjegeometri")},a.messageDisplayer=function(a){return function(b,c){var d=$(a);d.find(".close").on("click",function(){d.find(".content").html(""),d.remove()}),d.addClass("alert-"+b),d.find(".content").html(c),$("body").append(d)}},a.mostlyCoveringMunicipality=function(a,b,c){var d="ST_MakeEnvelope("+b+", 4326)",e="SELECT komm FROM kommuner WHERE ST_Intersects(the_geom, "+d+")ORDER BY st_area(st_intersection(the_geom, "+d+")) DESC LIMIT 1",f={api:"cartodb",query:e,mapper:function(a){return a.rows[0].komm}};a.getData(f,c)},a.sparqlBbox=function(a,b,d,e,f){KR.Util.mostlyCoveringMunicipality(a,d,function(d){b.kommune=c(d),a.getData(b,e,f)})},a.distanceAndSort=function(a,b){var c=_.map(a.features,function(a){return a.properties.distance=turf.distance(b,a),a});return turf.featurecollection(c.sort(function(a,b){return a.properties.distanceb.properties.distance?1:0}))},a.round=function(a,b){_.isUndefined(b)&&(b=2);var c=Math.pow(10,b);return Math.round(a*c)/c};var e=_.template("#<%= zoom %>/<%= lat %>/<%= lon %>");a.getPositionHash=function(b,c,d){return e({zoom:d,lat:a.round(b,4),lon:a.round(c,4)})},a.WORLD={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}},a.createMap=function(b,c){c=c||{};var d=L.map(b,{minZoom:c.minZoom||3,maxZoom:c.maxZoom||18,maxBounds:L.geoJson(a.WORLD).getBounds()}),e=c.layer||"norges_grunnkart_graatone";return _.isString(e)?KR.Util.getBaseLayer(e,function(a){a.addTo(d)}):e.addTo(d),d},a.setupSidebar=function(a,b){b=b||{};var c=KR.Util.getDatasetTemplate("popup"),d=_.template($("#list_item_template").html()),e=_.template($("#marker_template").html()),f=_.template($("#thumbnail_template").html()),g=_.template($("#footer_template").html()),h=_.extend({},{position:"left",template:c,listElementTemplate:d,markerTemplate:e,thumbnailTemplate:f,footerTemplate:g},b),i=L.Knreise.Control.sidebar("sidebar",h);return a.addControl(i),i},a.distanceAndBearing=function(a,b){return{distance:1e3*turf.distance(a,b,"kilometers"),bearing:turf.bearing(a,b)}};var f=_.template("<%= service %>/s/crop/<%= width %>x<%= height %>/<%= image %>");a.getImageCache=function(a,b,c){return KR.Config.ImageCaheUrl?f({service:KR.Config.ImageCaheUrl,width:b,height:c,image:a}):a},a.isInIframe=function(){try{return window.self!==window.top}catch(a){return!0}}}(KR.Util);var KR=this.KR||{};KR.Style={},function(a){"use strict";function b(a){var b=a.properties.vernef_id;return _.find(p,function(a){return-1!==a.ids.indexOf(b)})}function c(a){return u[a]||"blue"}function d(a,b,c,d){return _.isFunction(a[b])?d?a[b]():a[b](c):a[b]}function e(a,b,c){return c?d(a,"fillcolor",b,!0):d(a,"fillcolor",b)}function f(a,b){return a.bordercolor?d(a,"bordercolor",b):e(a,b)}function g(b){return a.groups[b]}function h(b){var c;return b.properties&&b.properties.groupId?g(b.properties.groupId):(b.properties&&b.properties.datasetId&&(c=a.getDatasetStyle(b.properties.datasetId)),c?c:_.extend({},s))}function i(a,b,c){return c=c||9,{radius:c,weight:1,opacity:1,color:a,fillColor:b,fillOpacity:.4}}function j(a,b,c){return L.circleMarker(a,i(b,c))}function k(a){return L.Knreise.icon({markerColor:a})}function l(a,b,c){var d="";return a.properties&&a.properties.title&&(d=a.properties.title),L.marker(b,{icon:c,title:d})}function m(a,b,c){if(a.properties&&a.properties.thumbnail){var d={"border-color":b,"background-image":"url("+a.properties.thumbnail+")"};c&&(d["border-width"]="3px");var e=KR.Util.getImageCache(a.properties.thumbnail,50,50),f='
';return new L.DivIcon({className:"leaflet-marker-circle",html:f,iconSize:[50,50],iconAnchor:[25,25]})}}function n(a,b,c){var d=_.filter(a,function(a){return a.feature.properties.thumbnail});if(d.length){var e;_.isArray(b)&&(e=_.rest(b),b=b[0]);var f=KR.Util.getImageCache(d[0].feature.properties.thumbnail,50,50),g={"border-color":b,"background-image":"url("+f+");"};e&&(g["box-shadow"]=_.map(e,function(a,b){var c=2*(b+1);return"0 0 0 "+c+"px "+a}).join(",")+";"),c&&(g["border-width"]="3px");var h='
'+a.length+"";return new L.DivIcon({className:"leaflet-marker-photo",html:h,iconSize:[60,60],iconAnchor:[30,30]})}}function o(a,b){var c=KR.Util.hexToRgba(b,.4);return new L.DivIcon({className:"leaflet-marker-circle",html:'
'+a.length+"",iconSize:[20,20],iconAnchor:[10,10]})}var p={landskapsvern:{ids:["LVO","LVOD","LVOP","LVOPD","BV","MAV","P","GVS","MIV","NM","BVV","PO","DO","D"],style:{fillColor:"#d8cb7a",color:"#9c8f1b"}},nasjonalpark:{ids:["NP","NPS"],style:{fillColor:"#7f9aac",color:"#b3a721"}},naturreservat:{ids:["NR","NRS"],style:{fillColor:"#ef9874",color:"#ef9873"}}},q="#72B026",r="#38A9DC",s={fillcolor:r,circle:!1,thumbnail:!0},t={difo:"Digitalt fortalt",Kulturminnesok:"Kulturminnesok",DiMu:"DigitaltMuseum",MUSIT:"Musit",Artsdatabanken:"Artsdatabanken",wikipedia:"wikipedia",riksantikvaren:"riksantikvaren"};a.datasets={"Digitalt fortalt":{fillcolor:"#F69730",circle:!1,thumbnail:!0},Kulturminnesok:{fillcolor:"#436978",circle:!1,thumbnail:!1},DigitaltMuseum:{fillcolor:"#436978",circle:!1,thumbnail:!1},Musit:{fillcolor:"#436978",circle:!1,thumbnail:!1},Artsdatabanken:{fillcolor:"#5B396B",thumbnail:!1,circle:!0},riksantikvaren:{fillcolor:"#436978",circle:!1,thumbnail:!0},verneomraader:{fillcolor:function(a){if(a){var c=b(a);if(c)return c.style.fillColor}return"#009300"},bordercolor:function(a){if(a){var c=b(a);if(c)return c.style.color}return"#009300"},thumbnail:!1,circle:!0},wikipedia:{fillcolor:"#D14020",thumbnail:!0}},a.groups={},a.getDatasetStyle=function(b){var c=a.datasets[t[b]];return c||(c=a.datasets[b]),c},a.setDatasetStyle=function(b,c){_.has(t,b)||(t[b]=b);var d=a.getDatasetStyle(b);d||(d=s),a.datasets[t[b]]=_.extend({},d,c)};var u={"#F69730":"orange","#38A9DC":"blue","#A23336":"darkred","#72B026":"green","#436978":"cadetblue","#5B396B":"darkpurple","#728224":"darkgreen","#D252B9":"purple","#D14020":"red"};a.getClusterIcon=function(a,b){var c,d=a.getAllChildMarkers(),f=_.uniq(_.map(d,function(a){return a.feature.properties.groupId})),i=h(d[0].feature);if(_.compact(f).length>1){var j=_.compact(f);j.length>1&&(c=_.map(j,_.compose(e,g)))}else c=e(i,d[0].feature);if(b&&(c=q),i.thumbnail){var k=n(d,c,b);if(k)return k}return o(d,c)},a.getIcon=function(a,b){var c=h(a),d=b?q:e(c,a),g=b?q:f(c,a);if(c.thumbnail){var j=m(a,g,b);if(j)return j}return c.circle?i(g,d,c.radius):k(d)},a.getMarker=function(b,c){var d=h(b);if(d.thumbnail){var g=m(b,f(d,b),!1);if(g)return l(b,c,g)}return d.circle?j(c,f(d,b),e(d,b)):l(b,c,a.getIcon(b,!1))},a.colorForFeature=function(a,b,d){var f=h(a);return f?b?e(f,a,d):c(e(f,a)):void 0},a.colorForDataset=function(b,d,f){var g,i;return b.grouped?(g=a.groups[KR.Util.stamp(b)],g||(i=b.datasets[0].extras.datasetId)):(i||(i=b.extras.datasetId),g=h({properties:{datasetId:i}})),g?d?e(g,null,f):c(e(g,null)):void 0},a.getPathStyle=function(a,b){b=b||!1;var c=h(a),d=e(c,a),g=f(c,a);return{weight:1,color:g,fillColor:d,clickable:b,opacity:.8,fillOpacity:.4}},a.getPathStyleForGroup=function(b,c){var d={properties:{groupId:b}};return a.getPathStyle(d,c)}}(KR.Style),L.Knreise=L.Knreise||{},L.Knreise.MarkerClusterGroup=L.MarkerClusterGroup.extend({options:{zoomToBoundsOnClick:!1,spiderfyOnMaxZoom:!1,polygonOptions:{fillColor:"#ddd",weight:2,color:"#999",fillOpacity:.6}},initialize:function(a){L.Util.setOptions(this,a),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._iconCreator.bind(this)),this._featureGroup=L.featureGroup(),this._featureGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this.on("clusterclick",this._clusterClicked,this)},onAdd:function(a){L.MarkerClusterGroup.prototype.onAdd.apply(this,arguments),a.on("layerSelected",this._deselectAll,this)},_deselectAll:function(){_.each(this._gridClusters,function(a){_.each(a._grid,function(a){_.each(a,function(a){_.each(a,function(a){a.selected&&(a.createIcon=_.bind(L.MarkerCluster.prototype.createIcon,a),a._updateIcon(),a.selected=!1)})})})}),this.eachLayer(function(a){a.selected&&(a.createIcon=_.bind(L.MarkerCluster.prototype.createIcon,a),a.setIcon(_.bind(L.Knreise.GeoJSON.prototype._createFeatureIcon,this)(a.feature)),a.selected=!1)},this)},_clusterClicked:function(a){this._map.fire("layerSelected");var b=a.layer,c=_.bind(this._iconCreator,this);b.createIcon=function(){return c(this,!0).createIcon()},b.selected=!0,b._updateIcon()},_iconCreator:function(a,b){return KR.Style.getClusterIcon(a,b)}}),L.Knreise.markerClusterGroup=function(a){return new L.Knreise.MarkerClusterGroup(a)},L.Knreise=L.Knreise||{},L.Knreise.GeoJSON=L.GeoJSON.extend({initialize:function(a,b){L.setOptions(this,b),this._layers={},this.options.pointToLayer=this._pointToLayer.bind(this),a&&this.addData(a),this.on("click",this._featureClicked,this),this.on("dblclick",this._featureDblClicked,this),this._selectedLayer=null},removedPaths:[],isCollapsed:function(a,b){var c=this.options.dataset.toPoint.minSize||20,d=a.getBounds(),e=this._map.project(d.getNorthEast(),b),f=this._map.project(d.getSouthWest(),b),g=e.x-f.x,h=f.y-e.y;return c>h||c>g},_deselectAll:function(){if(this._selectedLayer){var a=this._selectedLayer;if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!1)),a.setZIndexOffset(0)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(a.setStyle(this._createFeatureIcon(b,!1)),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!1))}}this._selectedLayer=null}},deselectAllNew:function(){_.each(this.getLayers(),function(a){if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!1)),a.setZIndexOffset(0)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(a.setStyle(this._createFeatureIcon(b,!1)),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!1))}}},this)},setLayerSelected:function(a){if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!0)),a.setZIndexOffset(1e3)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(b&&(a.setStyle(this._createFeatureIcon(b,!0)),a.bringToFront()),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!0))}}this._selectedLayer=a},_featureClicked:function(a){if(!(this.options.dataset&&this.options.dataset.toPoint&&this.options.dataset.toPoint.stopPolyClick&&"Point"!==a.layer.toGeoJSON().geometry.type)){a.layer._map&&a.layer._map.fire("layerSelected");var b=a.layer;this.setLayerSelected(b)}},_featureDblClicked:function(a){this.options.dataset&&this.options.dataset.toPoint&&this.options.dataset.toPoint.stopPolyClick&&"Point"!==a.layer.toGeoJSON().geometry.type&&a.layer._map&&a.layer._map.zoomIn()},getParentLayer:function(a){var b=this._layers[a];if(b)return b;var c,d,e;for(c in this._layers)if(this._layers.hasOwnProperty(c)&&(d=this._layers[c],d.getLayer&&(e=d.getLayer(a))))return d},getZoomThreshold:function(a){var b=null,c=this._map.getZoom();if(this.isCollapsed(a,this._map.getZoom()))for(;!b;)c+=1,this.isCollapsed(a,c)||(b=c-1);else for(;!b;)c-=1,this.isCollapsed(a,c)&&(b=c);return b},_zoomend:function(){if(this.options.dataset.toPoint&&this.shouldLoad){var a,b,c=[];for(this.eachLayer(function(a){this._map.getZoom()<=a.zoomThreshold&&(this.removeLayer(a),this.options.dataset.toPoint.showAlways||this.addLayer(a.marker),c.push(a))},this),b=0;ba.zoomThreshold&&(this.options.dataset.toPoint.showAlways||this.removeLayer(a.marker),this.addLayer(a),this.removedPaths.splice(b,1),b-=1);this.removedPaths=this.removedPaths.concat(c)}},_getCenter:function(a){if("undefined"!=typeof turf){var b=turf.pointOnSurface(a.toGeoJSON());return L.latLng(b.geometry.coordinates.reverse())}return a.getBounds().getCenter()},_layeradd:function(a){var b=a.layer;if("Point"===b.feature.geometry.type||b.isMarker||(b.setStyle(KR.Style.getPathStyle(b.feature)),b.bringToBack()),this.options.dataset.toPoint){if(b.isMarker)return;if(b.getBounds&&!b.zoomThreshold&&!b.marker){var c=this.getZoomThreshold(b),d=this._pointToLayer(b.feature,this._getCenter(b));d.feature=b.feature,d.on("click",function(a){b.fire("click",{containerPoint:a.containerPoint,latlng:a.latlng,layerPoint:a.layerPoint,originalEvent:a.originalEvent,target:a.target,type:a.type,parent:!0})}),b.zoomThreshold=c,this.removedPaths.push(b),b.marker=d,b.marker.isMarker=!0,b.marker.getParent=function(){return b},this._map.getZoom()<=c&&(this.removeLayer(b),this.options.dataset.toPoint.showAlways||this.addLayer(b.marker)),this.options.dataset.toPoint.showAlways&&this.addLayer(b.marker)}}},setMap:function(a){a.on("layerSelected",this._deselectAll,this)},onAdd:function(a){L.GeoJSON.prototype.onAdd.apply(this,arguments),this.options.dataset&&this.options.dataset.toPoint&&(this._zoomend(),a.on("zoomend",this._zoomend,this),this.on("layeradd",this._layeradd,this)),this.setMap(a)},_createFeatureIcon:function(a,b){return KR.Style.getIcon(a,b)},_pointToLayer:function(a,b){return KR.Style.getMarker(a,b)}}),L.Knreise.geoJson=function(a,b){return new L.Knreise.GeoJSON(a,b)},L.Knreise=L.Knreise||{},L.Knreise.Control=L.Knreise.Control||{},L.Knreise.Control.Sidebar=L.Control.Sidebar.extend({initialize:function(a,b){b=b||{},b.autoPan=!1,L.setOptions(this,b);var c=L.DomUtil.get(a);L.DomEvent.on(c,"click",function(a){L.DomEvent.stopPropagation(a)}),c.parentNode.removeChild(c);var d=L.DomUtil.create("div","top-menu",c);this._contentContainer=L.DomUtil.create("div","sidebar-content",c),this.on("hide",this._removeContent,this);var e="leaflet-",f=this._container=L.DomUtil.create("div",e+"sidebar knreise-sidebar "+this.options.position);if(this.options.closeButton){var g=this._closeButton=L.DomUtil.create("a","close pull-right",d);g.innerHTML="×"}this._top=L.DomUtil.create("span","",d),L.DomUtil.addClass(c,e+"control"),f.appendChild(c),this.on("hide",function(){this._map&&(this._map.fire("layerSelected"),this._map.fire("layerDeselect"))},this),this.sidebar=new KR.SidebarContent(this._container,this._contentContainer,this._top,this.options,this._map)},addTo:function(a){return this.sidebar.setMap(a),L.Control.Sidebar.prototype.addTo.apply(this,arguments)},showFeature:function(a,b,c,d,e,f){if(this.show(),this.sidebar.showFeature(a,b,c,d,e,f),KR.UrlFunctions){var g=$("
"),h={id:a.id,url:KR.UrlFunctions.getFeatureLink(a),provider:a.properties.provider};a.properties.feedbackForm&&($(this._contentContainer).append(g),KR.ResponseForm(g,h)),a.id&&this.options.featureHash&&KR.UrlFunctions.setFeatureHash(a.id)}},showFeatures:function(a,b,c,d,e){this.show(),this.sidebar.showFeatures(a,b,c,d,e)},_removeContent:function(){$(this.getContainer()).html(""),KR.UrlFunctions&&KR.UrlFunctions.setFeatureHash()}}),L.Knreise.Control.sidebar=function(a,b){return new L.Knreise.Control.Sidebar(a,b)};var KR=this.KR||{};KR.UrlFunctions={},function(a){"use strict";a.setupLocationUrl=function(a){var b=function(){var b=a.getCenter(),c=KR.Util.getPositionHash(b.lat,b.lng,a.getZoom()),d=window.location.hash.split(":");if(d.length>1){var e=_.rest(d).join(":");c+=":"+e}window.location.hash=c};a.on("moveend",b),b()},a.getLocationUrl=function(){var a=window.location.hash;if(a&&""!==a&&1!==a.indexOf(":")){var b=a.replace("#","").split("/"),c=parseInt(b[0],10),d=parseFloat(b[1]),e=parseFloat(b[2]);return{lat:d,lon:e,zoom:c}}},a.getHashFeature=function(){var a=window.location.hash.split(":");return a.length>1?_.rest(a).join(":"):void 0},a.setFeatureHash=function(a){var b=window.location.hash.split(":")[0];a?window.location.hash=b+":"+encodeURIComponent(a):window.location.hash=b},a.getFeatureLink=function(a){var b=window.location.href.replace(window.location.hash,""),c=a.geometry.coordinates,d=KR.Util.getPositionHash(c[1],c[0],16),e=b+d;return a.id&&(e=e+":"+encodeURIComponent(a.id)),e}}(KR.UrlFunctions);var KR=this.KR||{};KR.MediaCarousel={},function(a){"use strict";function b(a,b){b=b||0;var c=function(){return a-1>b},d=function(){return b>0};return{prev:function(){return d()?--b:b},next:function(){return c()?++b:b},hasNext:c,hasPrev:d}}function c(a){return $('')}function d(a){return-1!==a.indexOf("mp4")?$(''):$('')}function e(a){return $('')}function f(a){if(_.has(h,a.type)){var b=h[a.type](a.url);return b.attr("data-type",a.type),b.attr("data-created",!0),b}}function g(a,b){return $('').attr("data-src",a).attr("data-type",b)}var h={image:c,video:d,sound:e};a.SetupMediaCarousel=function(a){function c(b){d=a.find(".media-list").children();var c=$(d[b]);if(d.addClass("hidden"),c.attr("data-created")||c.hasClass("audiojs"))c.removeClass("hidden");else{var g={type:c.attr("data-type"),url:c.attr("data-src")},h=f(g);c.replaceWith(h),h.is("audio")&&audiojs.create(h)}e.hasPrev()?a.find(".prev").addClass("active"):a.find(".prev").removeClass("active"),e.hasNext()?a.find(".next").addClass("active"):a.find(".next").removeClass("active")}var d=a.find(".media-list").children(),e=new b(d.length);a.find(".next").on("click",function(){e.hasNext()&&c(e.next())}),a.find(".prev").on("click",function(){e.hasPrev()&&c(e.prev())})},a.CreateMediaListMarkup=function(a){var b=$('
'),c=$('
');return c.append(_.map(a,function(a,b){var c=0===b;return c?f(a):g(a.url,a.type)})),b.append(c),a.length>1&&b.append($('
')),b[0].outerHTML}}(KR.MediaCarousel);var KR=this.KR||{};!function(){"use strict";function a(){function a(a){if(d&&d.userPosition){var b=turf.point([d.userPosition.lng,d.userPosition.lat]),c=KR.Util.distanceAndBearing(b,a),e=c.distance;return e=1e3>e?KR.Util.round(e,0)+" Meter":KR.Util.round(e/1e3,2)+" Kilometer",{dist:e,rot:c.bearing-45}}}function b(){if(e&&d&&d.userPosition&&f){g&&g.remove();var b=e.find("h3").eq(0),c=a(f);g=$(h({distanceBearing:c})),b.length?b.after(g):e.prepend(g)}}function c(a,c){e=c,f=a,b()}var d,e,f,g,h=_.template($("#user_position_template").html());return{setMap:function(a){d=a,d.on("locationChange",b)},selectFeature:c}}KR.SidebarContent=function(b,c,d,e){function f(a){c.html(a)}function g(a){a&&c.swipe({swipe:function(){},allowPageScroll:"vertical"}).off("swipeLeft").on("swipeLeft",function(){a.next&&a.next()}).off("swipeRight").on("swipeRight",function(){a.prev&&a.prev()})}function h(a,b,c,d,f,g){var i;b>0&&(i=function(e){e&&e.preventDefault(),b-=1,a=f[b];var i=h(a,b,c,d,f,g);j(a,c,d,i,b,f.length)});var l;return b"),p+='',f(p),void i(a,function(b){b.properties=_.extend(a.properties,b.properties),j(b,h,null,k,n,o)})}h=h||a.template||KR.Util.templateForDataset(a.properties.dataset)||l;var q=a.properties.images;_.isArray(q)&&(q=q[0]),a.properties.images||(a.properties.images=null),a.properties.allProps&&a.properties.allProps.europeana_rights?a.properties.license=a.properties.allProps.europeana_rights[0]:a.properties.license=null;var r=a.properties.color||KR.Style.colorForFeature(a,!0,!0),p=''+a.properties.provider+"";if(p+=h(_.extend({image:null},a.properties)),e.footerTemplate&&a.properties.link&&(p+=e.footerTemplate(a.properties)),p=$(["
",p,"
"].join(" ")),KR.Util.isInIframe()&&p.find("a").attr("target","_blank"),m.selectFeature(a,p),f(p),g(k),b.find(".prev-next-arrows").remove(),d.html(""),k){var s=$('');d.append(s),s.click(k.close);var t=n+1;d.append($('
'+t+" av "+o+"
"));var u=$('');b.append(u),k.prev&&u.click(k.prev).addClass("active");var v=$('');b.append(v),k.next&&v.click(k.next).addClass("active")}var w=c.find(".media-container");w.length&&KR.MediaCarousel.SetupMediaCarousel(w),"undefined"!=typeof audiojs&&audiojs.createAll(),c.scrollTop(0)}function k(a,b,f,g,j){g=void 0===g?e.noListThreshold:g;var k=a.length<=g;if(k&&j!==!0){var l=a[0];c.html("");var m=h(l,0,b,f,a);return void this.showFeature(l,b,f,m,0,a.length)}var n=$(''+a.length+"");d.html(n);var o=_.chain(a).groupBy(function(a){return a.properties.provider}).map(function(c,d){var e=$("
"),g=$('
'),h=_.map(c,function(c){var d=_.findIndex(a,function(a){return a===c});return i(c,d,b,f,a)},this);return g.append(h),e.append('
'+d+"
"),e.append(g),e}).value();c.html(o),c.scrollTop(0)}var l=KR.Util.getDatasetTemplate("popup"),m=new a;return c=$(c),b=$(b),d=$(d),{showFeature:j,showFeatures:k,setMap:function(a){m.setMap(a)}}}}(),function(){"use strict";L.Knreise=L.Knreise||{},L.Knreise.Control=L.Knreise.Control||{};var a=function(a,b){function c(c){var d=document.createElement("i");return d.className="layericon fa",a.visible?d.className+=" fa-check-square-o":d.className+=" fa-square-o",c&&(d.className+=" "+c),b.isLoading&&(d.className="layericon fa fa-spinner fa-pulse"),b.enabled?d.style.color=KR.Style.colorForDataset(a,!0,!0):d.style.color="#ddd",d}function d(){var a=c();j.replaceChild(a,k),k=a}function e(){a.visible=!a.visible,d(),a.visible?b.fire("show"):b.fire("hide")}function f(a){m?m.setAttribute("title",m.getAttribute("title")+", "+KR.parseError(a)):(m=L.DomUtil.create("i","error-icon fa fa-exclamation-triangle"),m.setAttribute("title",KR.parseError(a)),j.insertBefore(m,j.childNodes[0]))}function g(){j=document.createElement("label"),_.isUndefined(a.visible)&&(a.visible=!0);var d=document.createElement("span");d.innerHTML=" "+a.name,k=c(),j.appendChild(k),j.appendChild(d),b.error&&f(b.error),b.enabled||(j.className="disabled"),L.DomEvent.on(j,"click",function(){var a=b.enabled&&!b.isLoading;a&&e()})}function h(){b.enabled!==l&&(l=b.enabled,d(),l?j.className=j.className.replace("disabled",""):j.className+="disabled")}function i(){return j}var j,k,l=b.enabled,m=null;return g(),b.on("changeEnabled",h),b.on("dataloadstart",function(){m&&(j.removeChild(m),m=null),d()}),b.on("dataloadend",d),b.on("error",f),{getLabel:i,hasError:function(){return!!b.error}}};L.Control.Datasets=L.Control.extend({initialize:function(a,b){L.setOptions(this,b),this._labels=[],this._handlingClick=!1,this.expanded=!1,this.numLoading=0;var c;for(c in a)a.hasOwnProperty(c)&&this._addLayer(a[c])},_addLayer:function(a){var b,c=a.options.dataset;if(c.datasets)if(c.grouped)this._addDataset(c,a);else for(b=0;b0?this._btnIcon=L.DomUtil.create("i","fa fa-spinner fa-pulse",b):this._btnIcon=L.DomUtil.create("i","fa fa-bars",b),this._container.appendChild(this._closeDiv),this._listContainer=L.DomUtil.create("div",a+" hidden"),this._listContainer.appendChild(this._form),this._container.appendChild(this._listContainer)},_toggle:function(){this.expanded?this._collapse():this._expand()},_expand:function(){L.DomUtil.addClass(this._listContainer,"leaflet-control-layers-expanded"),this.expanded=!0,this._listContainer.className=this._listContainer.className.replace(" hidden","")},_collapse:function(){this._listContainer.className=this._listContainer.className.replace(" leaflet-control-layers-expanded",""),L.DomUtil.addClass(this._listContainer,"hidden"),this.expanded=!1}}),L.control.datasets=function(a,b){return new L.Control.Datasets(a,b)}}(),L.Knreise=L.Knreise||{},L.Knreise.Icon=L.KNreiseMarkers.Icon.extend({options:{icon:null}}),L.Knreise.icon=function(a){return new L.Knreise.Icon(a)};var KR=this.KR||{};KR.DatasetLoader=function(a,b,c,d,e,f){ -"use strict";function g(a){var b=KR.Util.stamp(a);return function(c){return c&&c.features.length?(_.each(c.features,function(c){c.properties.datasetID=b,_.has(a,"circle")&&(c.properties.circle=a.circle),_.has(a,"provider")&&(c.properties.provider=a.provider),_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()b;b++)a[b]={identifier:""+b,topLeftCorner:new L.LatLng(20037508.3428,-20037508.3428)};return a}}),L.tileLayer.wmts=function(a,b){return new L.TileLayer.WMTS(a,b)},function(a){"use strict";function b(a){var b,c=new Array(30);for(b=0;22>b;b++)c[b]={identifier:a+":"+b,topLeftCorner:new L.LatLng(20037508,-20037508.34)};return c}a.SKTokenUrl="http://localhost:8001/html/baat/?type=token",a.getNibLayer=function(c,d){a.Util.sendRequest(KR.SKTokenUrl,null,function(a){var e;if(d)e=L.tileLayer.wms("http://gatekeeper2.geonorge.no/BaatGatekeeper/gk/gk.nibcache",{layers:"NiB",format:"image/jpeg",transparent:!1,attribution:"Kartverket"});else{var f="http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts",g="EPSG:900913";e=new L.TileLayer.WMTS(f,{layer:"NiB",style:"normal",tilematrixSet:g,matrixIds:b(g),format:"image/jpeg",attribution:"Kartverket"})}e.setParams({GKT:a}),c(e)})}}(KR);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getKulturminneFunctions=function(a){var b,c,d,e,f,g=[],h=!1,i=!0,j=function(){map.removeLayer(d)},k=function(){map.addLayer(d)},l=function(a){var b="down"===a;b?(c.addLayer(d),f&&c.addLayer(f)):(c.removeLayer(d),f&&c.removeLayer(f))},m=function(a,b,c){var d;a.on("zoomstart",function(b){d=a.getZoom()}),a.on("zoomend",function(e){var f=a.getZoom();d>b&&b>=f&&c("up"),b>=d&&f>b&&c("down")})},n=function(a){return _.find(b.getLayers(),function(b){return b.feature.properties.id===a})},o=function(a){return _.find(d.getLayers(),function(b){return b.feature.properties.lok===a})},p=function(a,b){var c=n(a.properties.lok);c&&c.fire("click")},q=function(a){return L.geoJson(null,{onEachFeature:function(b,c){a.extras&&a.extras.groupId?c.setStyle(KR.Style.getPathStyleForGroup(a.extras.groupId)):(b.properties.datasetId=a.id,c.setStyle(KR.Style.getPathStyle(b,!0))),c.on("click",function(){p(b,c)})}}).addTo(c)},r=function(){},s=function(){_.each(d.getLayers(),function(a){a.setStyle(KR.Style.getPathStyle(a.feature,!0))})},t=function(a){s();var b=a.layer.feature.properties.id,c=o(b);c&&(c.setStyle({weight:1,color:"#436978",fillColor:"#72B026",clickable:!0,opacity:.8,fillOpacity:.4}),e&&e(a.layer.feature))},u=function(a,b){c.sidebar&&c.sidebar.showFeature(a,b.enkeltminner.template||KR.Util.getDatasetTemplate("ra_enkeltminne"))},v=function(b){_.has(b,"enkeltminner")||(b.enkeltminner={});var d=b.enkeltminner.style||{color:"#fff",weight:1,fillColor:"#B942D0"};f=L.geoJson(null,{onEachFeature:function(a,c){a.properties.provider=b.enkeltminner.provider||"Enkeltminne",a.properties.color=b.enkeltminner.sidebarColor||"#B942D0",c.on("click",function(){u(a,b)})},style:function(){return d}}).addTo(c),e=function(b){var c={api:"kulturminnedataSparql",type:"enkeltminner",lokalitet:b.properties.id};a.getData(c,function(a){f.clearLayers(),f.addData(a)})}},w=function(a,e,f){b=f,c=a,b.on("hide",j),b.on("show",k),d=q(e),m(c,13,l),c.on("zoomend",r),c.on("layerDeselect",s),b.on("click",t),_.has(e,"showEnkeltminner")&&(i=e.showEnkeltminner),i&&v(e)},x=function(a){d.addData(a);var b=_.chain(a.features).map(function(a){return a.properties.lok}).uniq().value();h&&_.each(b,function(a){n(a)}),g=g.concat(b)},y=function(b,c,d){if(d){var e=_.chain(d).map(function(a){return a.properties.id}).filter(function(a){return-1===g.indexOf(a)}).value();if(e.length){var f={api:"kulturminnedataSparql",type:"lokalitetpoly",lokalitet:e};a.getData(f,x)}}};return{loadKulturminnePoly:y,initKulturminnePoly:w}}}(KR.Config);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getDatasetList=function(b,c,d){var e=a.getKulturminneFunctions(b);c&&3===c.length&&(c="0"+c);var f={difo:{name:"Digitalt fortalt",dataset:{dataset:"difo",api:"norvegiana"},cluster:!0,template:KR.Util.getDatasetTemplate("digitalt_fortalt"),noListThreshold:1/0,description:"Kulturrådets tjeneste for personlige fortellinger fra kulturinstitusjoner og privatpersoner.",allowTopic:!0,feedbackForm:!0,isStatic:!1},verneomr:{id:"verneomraader",dataset:{api:"cartodb",table:"naturvernomrader_utm33_2",columns:["iid","omradenavn","vernef_id","verneform"]},provider:"Naturbase",name:"Verneområder",template:KR.Util.getDatasetTemplate("verneomraader"),getFeatureData:function(a,c){b.getItem({api:"norvegiana",id:"kulturnett_Naturbase_"+a.properties.iid},c)},toPoint:{showAlways:!0,stopPolyClick:!0,minSize:20},minZoom:10,cluster:!1,description:"Nasjonalparker og andre naturvernområder - ca. 2700 i hele landet."},artobs:{name:"Artsobservasjoner",hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"Artsdatabanken"},cluster:!1,description:"Artsobservasjoner fra Artsdatabanken",template:KR.Util.getDatasetTemplate("popup")},folketelling:{name:"Folketelling 1910",provider:"Folketelling 1910",dataset:{api:"folketelling",dataset:"property"},isStatic:!1,minZoom:14,template:KR.Util.getDatasetTemplate("folketelling"),getFeatureData:function(a,c){b.getData({api:"folketelling",type:"propertyData",propertyId:a.properties.efid},function(b){a.properties=b.properties,a.properties.provider="Folketelling 1910",c(a)})},mappings:{title:"gaardsnavn_gateadr"},noListThreshold:0,description:"Personer og eiendommer fra folketellingen 1910"},ark_hist:{grouped:!0,name:"Arkeologi og historie",minZoom:14,datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Data fra Universitetsmuseene, Digitalt museum og Riksantikvaren"},jernbane:{id:"jernbane",dataset:{api:"jernbanemuseet"},provider:"Jernbanemuseet",name:"Jernbanemuseet",hideFromGenerator:!0,template:KR.Util.getDatasetTemplate("jernbanemuseet"),getFeatureData:function(a,c){b.getItem({api:"jernbanemuseet",id:a.properties.id},c)},isStatic:!0,bbox:!1,description:"Jernbanemuseet"},arkeologi:{grouped:!0,name:"Arkeologi",minZoom:14,style:{fillcolor:"#436978",circle:!1,thumbnail:!0},datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER regex(?loccatlabel, "^Arkeologisk", "i") .',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Arkeologidata fra Universitetsmuseene og Riksantikvaren"},historie:{grouped:!0,name:"Historie",minZoom:14,style:{fillcolor:"#D252B9",circle:!1,thumbnail:!0},datasets:[{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER (!regex(?loccatlabel, "^Arkeologisk", "i"))',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"-dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Industrimuseum"},isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Foto-SF"},isStatic:!1,bbox:!1,template:KR.Util.getDatasetTemplate("foto_sf")},{dataset:{api:"norvegiana",dataset:"Kystreise"},isStatic:!0,bbox:!1}],description:"Historie og kulturminner fra Riksantikvaren og Digitalt museum "},kunst:{grouped:!0,name:"Kunst",style:{fillcolor:"#72B026",circle:!1,thumbnail:!0},datasets:[{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1}],description:"Kunstdata fra Digitalt museum "},wikipedia:{name:"Wikipedia",provider:"Wikipedia",dataset:{api:"wikipedia"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra bokmålswikipedia"},wikipediaNN:{name:"Wikipedia Nynorsk",provider:"Wikipedia Nynorsk",dataset:{api:"wikipediaNN"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra nynorskwikipedia"},lokalwiki:{id:"lokalwiki",name:"Lokalhistoriewiki",hideFromGenerator:!1,provider:"Lokalhistoriewiki",dataset:{api:"lokalhistoriewiki"},style:{thumbnail:!0},minZoom:13,bbox:!0,isStatic:!1,description:"Stedfestede artikler fra lokalhistoriewiki.no"},riksantikvaren:{id:"riksantikvaren",name:"Kulturminnesøk",hideFromGenerator:!1,provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:10,callback:e.loadKulturminnePoly},description:"Data fra Riksantikvarens kulturminnesøk"},brukerminner:{name:"Kulturminnesøk - brukerregistreringer",hideFromGenerator:!1,provider:"riksantikvaren",dataset:{api:"kulturminnedata",layer:2,getExtraData:!0,extraDataLayer:6,matchId:"KulturminnesokID"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Brukerregistrerte data fra Riksantikvarens kulturminnesøk",template:KR.Util.getDatasetTemplate("brukerminne")},groruddalen:{name:"Byantikvaren Oslo - Groruddalen",hideFromGenerator:!0,provider:"Byantikvaren i Oslo",dataset:{api:"cartodb",table:"byantikvaren_oslo_groruddalen"},bbox:!1,isStatic:!1,style:{thumbnail:!0},template:KR.Util.getDatasetTemplate("byantikvaren_oslo"),description:"Byantikvarens Groruddalsatlas"},norgerundt:{name:"Norge Rundt",hideFromGenerator:!0,provider:"NRK",dataset:{api:"cartodb",table:"nrk_norge_rundt"},bbox:!1,isStatic:!1,style:{thumbnail:!0},description:"Stedfestede innslag fra Norge Rundt"},dimu:{name:"Digitalt Museum",hideFromGenerator:!1,provider:"dimu",dataset:{dataset:"DiMu",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Digitalt Museum",allowTopic:!0,feedbackForm:!0},musit:{name:"Universitetsmuseene",hideFromGenerator:!1,provider:"Universitetsmuseene",dataset:{dataset:"MUSIT",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Universitetsmuseene",allowTopic:!0,feedbackForm:!0},industrimuseum:{name:"Industrimuseum",hideFromGenerator:!1,provider:"Industrimuseum",dataset:{dataset:"Industrimuseum",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Industrimuseum",allowTopic:!0,feedbackForm:!0},kystreise:{name:"Kystreise",hideFromGenerator:!1,provider:"Kystreise",dataset:{dataset:"Kystreise",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Kystreise",allowTopic:!0,feedbackForm:!0},dimufoto:{hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"DiMu",query:"europeana_type_facet:IMAGE"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,style:{thumbnail:!0},noListThreshold:1/0},kulturminnesok_flickr:{name:"Kulturminnesøk",dataset_name_override:"Kulturminnesøk",provider:"Kulturminnesøk Flickr",hideFromGenerator:!0,dataset:{api:"flickr",group_id:"1426230@N24"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!0,style:{thumbnail:!0},description:"Bilder fra Kulturminnesøks Flickr-gruppe"},riksarkivet:{name:"Riksarkivet",dataset_name_override:"Riksarkivet",provider:"riksarkivet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_archives_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Riksarkivets Flickr-konto"},nasjonalbiblioteket:{name:"Nasjonalbiblioteket",dataset_name_override:"Nasjonalbiblioteket",provider:"nasjonalbiblioteket",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_library_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalbibliotekets Flickr-konto"},oslobyarkiv:{name:"Oslo Byarkiv",dataset_name_override:"Oslo Byarkiv",provider:"oslobyarkiv",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"byarkiv"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Oslo byarkiv sin Flickr-konto"},nasjonalmuseet:{name:"Nasjonalmuseet",dataset_name_override:"Nasjonalmuseet",provider:"nasjonalmuseet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nasjonalmuseet"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalmuseet sin Flickr-konto"},nve:{name:"NVE",dataset_name_override:"NVE",provider:"nve",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nve",accuracy:"6"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra NVE Flickr-konto"},vestfoldmuseene:{name:"Vestfoldmuseene",dataset_name_override:"Vestfoldmuseene",provider:"Vestfoldmuseene",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"vestfoldmuseene",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Vestfoldmuseene sin Flickr-konto"},perspektivet:{name:"Perspektivet Museum",dataset_name_override:"Perspektivet Museum",provider:"Perspektivet Museum",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"perspektivetmuseum",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Perspektivet Museum sin Flickr-konto"}};if(!c&&!d){var g={bbox:!0,minZoom:12,isStatic:!1,bboxFunc:KR.Util.sparqlBbox};_.extend(f.riksantikvaren,g),_.extend(f.ark_hist.datasets[2],g),_.extend(f.arkeologi.datasets[1],g),_.extend(f.historie.datasets[0],g)}return f},a.getDatasets=function(b,c,d,e){var f=a.getDatasetList(c,d,e);return _.chain(b).map(function(a){var b;if(a.indexOf(":")>-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};KR.SplashScreen=function(a,b,c,d,e,f){"use strict";function g(){return window.location.href.replace(window.location.hash,"")}function h(){var a=g(),b="remember_"+a+"=",c=document.cookie.split("; "),d=_.find(c,function(a){return 0===a.indexOf(b)});return d?"true"===d.substring(b.length,d.length):void 0}function i(a){document.cookie="remember_"+g()+"="+a}function j(){this._gray&&this._container.removeChild(this._gray),L.Control.Sidebar.prototype.hide.apply(this,arguments)}function k(){this._gray=L.DomUtil.create("div","gray",this._container),L.Control.Sidebar.prototype.show.apply(this,arguments)}function l(){var g=L.DomUtil.create("div","",document.body);g.id="splashscreen";var h=L.control.sidebar("splashscreen",{position:"center",autoPan:!1});h.hide=_.bind(j,h),h.show=_.bind(k,h),a.addControl(h);var i=_.template($("#splashscreen_template").html()),l=$("
"+i({title:b,image:d,description:c,creator:e,spinner:!!f})+"
");return KR.Util.isInIframe()&&l.find("a").attr("target","_blank"),h.setContent(l.html()),h}function m(a){function b(){i(c.prop("checked"))}var c=$(a.getContainer()).find("#persist_splash_cb");c.prop("checked",h()),c.on("change",b),b()}function n(b){return L.easyButton(a,b,{position:"topright",icon:"fa-info-circle",title:"Om"})}var o=l();n(function(){o.isVisible()?o.hide():o.show()});var p=h();return p||(_.isUndefined(p)&&i(!0),o.show()),m(o),{finishedLoading:function(){var a=$(o.getContainer()).find("#splash_spinner");a&&a.remove()}}};var KR=this.KR||{};KR.ResponseForm=function(a,b){function c(a,b){var c=_.reduce(a,function(a,b,c){return a[g[c]]=b,a},{});$.ajax({url:h,data:c,type:"POST",dataType:"xml",success:b,error:b})}function d(b){a.find("form").addClass("hidden"),a.find("#form-success").removeClass("hidden").find(".media-body").text("Din melding er sendt til "+b+". De vil ta kontakt hvis de har behov for ytterligere informasjon")}function e(e){e.preventDefault();var f=a.find("#form_email").val(),g=a.find("#form_message").val();if(""===f||""===g)return!1;var h=_.extend({},b,{email:f,message:g});return c(h,function(){d(h.provider)}),!1}function f(){a.find("#form_email").val(""),a.find("#form_message").val(""),a.find("#form-success").addClass("hidden"),a.find("form").addClass("hidden"),a.find(".show-more").removeClass("hidden")}var g={message:"entry.126368279",email:"entry.748218122",id:"entry.2043404140",url:"entry.243673559",provider:"entry.826324496"},h="https://docs.google.com/forms/d/1ah66lattC8it7OTIM6de20NSNkBeiQ0vabpsHSaPU7s/formResponse",i=$("#response_form_template").html();a.append(i),a.find("form").on("submit",e),a.find(".show-more").click(function(){a.find(".show-more").addClass("hidden"),a.find("form").removeClass("hidden")}),a.find(".close ").click(f)};var KR=this.KR||{};!function(a){"use strict";function b(a){return function(b){if(!b||!b.features.length)return b;var c=b.features[0].geometry.type;if(c.indexOf("Polygon")>-1){var d=_.filter(b.features,function(b){var c=turf.extent(b),d=turf.bboxPolygon(c);return!!turf.intersect(d,a.features[0])});return KR.Util.createFeatureCollection(d)}if(c.indexOf("MultiLineString")>-1){var d=_.filter(b.features,function(b){var c=turf.extent(b),d=turf.bboxPolygon(c);return!!turf.intersect(d,a.features[0])});return KR.Util.createFeatureCollection(d)}return turf.within(b,a)}}function c(a,b,c,d,e){return c&&(b=KR.Config.getDatasets(b,a,d,e)),b}function d(a,b){var c={stroke:!1,fillColor:"#ddd",fillOpacity:.8},d=_.reduce(b.features,function(a,b){return turf.erase(a,b)},KR.Util.WORLD);L.geoJson(d,c).addTo(a)}function e(a,c,e,f,g,h,i,j){if(a.geomFilter){var k={api:"cartodb"};k[h]=g,c.getData(k,function(c){a.showGeom&&d(a.map,c);var f=L.geoJson(c),g=b(c);i(f.getBounds(),e,g,null,j)})}else f(g,function(a){var b=L.latLngBounds.fromBBoxString(a);i(b,e,null,null,j)})}function f(a,b,d,f,g,h){d=c(b,d,f,a.komm),_.isString(a.komm)&&(a.komm=a.komm.split(",")),e(a,b,d,b.getMunicipalityBounds,a.komm,"municipality",g,h)}function g(a,b,d,f,g,h){d=c(b,d,f,null,a.fylke),_.isString(a.fylke)&&(a.fylke=a.fylke.split(",")),e(a,b,d,b.getCountyBounds,a.fylke,"county",g,h)}function h(a,b,d,e,f,g){d=c(b,d,e);var h=L.latLngBounds.fromBBoxString(a.bbox);f(h,d,null,null,g)}function i(a){var b=[];return _.each(a.features,function(a){"GeometryCollection"===a.geometry.type?_.each(a.geometry.geometries,function(c){b.push(KR.Util.createGeoJSONFeatureFromGeom(c,a.properties))}):b.push(a)}),KR.Util.createFeatureCollection(b)}function j(a){var b=_.map(a.features,function(a){return turf.simplify(a,.01,!1)});return KR.Util.createFeatureCollection(b)}function k(a,d,e,f,g,h,k){var l={};e.linecolor&&(l.color=e.linecolor);var m=L.geoJson(a,l),n=m.getBounds();f=c(d,f,g);var o;if(a&&e.buffer){a=i(a),a.features.length>5&&(a=j(a));var p=turf.buffer(a,e.buffer,"kilometers");o=b(p)}h(n,f,o,m,k)}function l(a,b,c,d,e,f){KR.Util.getLine(b,a.line,function(g){k(g,b,a,c,d,e,f)})}function m(a){var b=KR.UrlFunctions.getHashFeature();if(b){var c=function(a){return decodeURIComponent(a.feature.id)===decodeURIComponent(b)||a.feature.id===decodeURIComponent(b)},d=_.find(_.flatten(a),function(a){return _.find(a.getLayers(),c)});if(d){var e=_.find(d.getLayers(),c);e.fire("click"),d.setLayerSelected(e)}}}function n(a,b){return _.map(a,function(a){return a.isStatic&&(a.fixedBbox=b),a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic&&(a.fixedBbox=b),a})),a})}function o(a){return _.map(a,function(a){return a.isStatic=!0,a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic=!0,a})),a})}var p={geomFilter:!1,showGeom:!1,loactionHash:!0,featureHash:!0};a.setupMap=function(a,b,c,d){function e(a,b,d,e,f){c.allstatic&&(b=o(b)),b=n(b,a.toBBoxString());var g=L.Knreise.LocateButton(null,null,{bounds:a});g.addTo(i);var h=function(f){f?(i.setView([f.lat,f.lon],f.zoom),a=i.getBounds()):i.fitBounds(a),c.loactionHash&&KR.UrlFunctions.setupLocationUrl(i);var g,h=function(a){m(a),q&&q.finishedLoading()};c.geomFilter&&a&&(g=a.toBBoxString());var j=k.loadDatasets(b,a.toBBoxString(),d,h,g);e&&e.addTo(i),b.length>1&&L.control.datasets(j).addTo(i)};c.initUserPos?(i.addOneTimeEventListener("locationChange",function(){var a={lat:i.userPosition.lat,lon:i.userPosition.lng,zoom:16};h(a)}),i.addOneTimeEventListener("locationError",function(){h(f)}),g.getLocation()):h(f)}c=c||{},c=_.extend({},p,c);var i=KR.Util.createMap("map",c),j=KR.Util.setupSidebar(i,{featureHash:c.featureHash}),k=new KR.DatasetLoader(a,i,j,null,c.cluster,c.clusterRadius);i.sidebar=j;var q;c.title&&(q=KR.SplashScreen(i,c.title,c.description,c.image,null,!1));var r,s=KR.UrlFunctions.getLocationUrl(i);return c.initUserPos||(r=s),c.map=i,c.komm?f(c,a,b,d,e,r):c.fylke?g(c,a,b,d,e,r):c.line?l(c,a,b,d,e,r):c.bbox?h(c,a,b,d,e,r):alert("Missing parameters!"),i},a.setupMapFromUrl=function(b,c,d){a.setupMap(b,c,d,!0)}}(KR);var KR=this.KR||{};KR.setupCollectionMap=function(a,b,c){"use strict";function d(a){var b=KR.Util.createMap("map",{layer:c});KR.SplashScreen(b,a.title,a.description,a.image,a.creator),$("title").append(a.title);var d=L.latLngBounds.fromBBoxArray(turf.extent(a.geo_json));_.each(a.geo_json.features,function(a){a.properties.datasetId=a.properties.provider,_.has(e,a.properties.provider)&&(a.template=e[a.properties.provider])});var f=KR.Util.setupSidebar(b),g=KR.Util.clusterClick(f),h=KR.Util.featureClick(f);L.Knreise.LocateButton(null,null,{bounds:d}).addTo(b),b.fitBounds(d);var i=L.Knreise.geoJson(a.geo_json,{onEachFeature:function(a,b){h(a,b)}}),j=(new L.Knreise.MarkerClusterGroup).addTo(b);j.addLayers(i.getLayers()),g(j)}var e={"Digitalt fortalt":KR.Util.getDatasetTemplate("digitalt_fortalt"),DigitaltMuseum:KR.Util.getDatasetTemplate("digitalt_museum"),Musit:KR.Util.getDatasetTemplate("musit"),Artsdatabanken:KR.Util.getDatasetTemplate("popup")};a.getCollection(b,d)}; \ No newline at end of file +var KR=this.KR||{};!function(a){"use strict";a.parseError=function(a){if(a.responseJSON){if(a.responseJSON.error)return a.responseJSON.error.join(", ");if(a.responseJSON.status)return a.responseJSON.status}return a.statusText?a.statusText:a.error?a.error.info?a.error.info:a.error.error?a.error.error:a.error:"Unknown error"},a.errorHandler=function(b){var c=$(b);c.find(".close").on("click",function(){c.find(".content").html(""),c.remove()});var d=_.template("
<%= dataset %>: <%= error %>
");return function(b){var e=d({dataset:b.dataset,error:a.parseError(b.error)});c.parent()?c.find(".content").append(e):c.find(".content").html(e),$("body").append(c)}}}(KR);var KR=this.KR||{};KR.Config={contentIcons:{IMAGE:"camera-retro",VIDEO:"file-video-o",SOUND:"music",TEXT:"file-text","default":"file-o"},templates:{}},KR.Config.ImageCaheUrl="http://egbtmre.cloudimg.io",KR.Util=KR.Util||{},function(a){"use strict";function b(a,b){var c=a.lastIndexOf(b);return-1!==c&&c+b.length===a.length}function c(a){return 1e3>a?"0"+a:a}a.iconForContentType=function(a){var b=a.properties.contentType;return _.has(KR.Config.contentIcons,b)?KR.Config.contentIcons[b]:KR.Config.contentIcons["default"]},a.getDatasetTemplate=function(a){var b=$("#"+a+"_template").html();return b?_.template(b):void 0},a.templateForDataset=function(a){return _.has(KR.Config.templates,a)?KR.Config.templates[a]:void 0},a.createStyleString=function(a){return _.map(a,function(a,b){return b+": "+a}).join(";")},a.colorForProvider=function(a,b){var c=!0;"hex"!==b&&(c=!1);var d={properties:{datasetId:a}};return KR.Style.colorForFeature(d,c,!0)},a.featureClick=function(a){return function(b,c,d){c.on("click",function(c){d&&d.toPoint&&d.toPoint.stopPolyClick&&!c.parent||(d?a.showFeature(b,d.template,d.getFeatureData):a.showFeature(b))})}},a.getTemplateForFeature=function(a,b){if(b){if(b.datasets){var c=_.find(b.datasets,function(b){return b._knreise_id===a.properties.datasetID});return c.template}return b.template}},a.clusterClick=function(b){return function(c,d){c.on("clusterclick",function(c){var e=_.map(c.layer.getAllChildMarkers(),function(b){var c=b.feature;return d&&!c.template&&(c.template=a.getTemplateForFeature(c,d)),c}),f=_.extend({},{template:null,getFeatureData:null,noListThreshold:null},d);b.showFeatures(e,f.template,f.getFeatureData,f.noListThreshold)})}},a.hexToRgba=function(a,b){b=b||1;var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(!c)return 0;var d={r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)};return"rgba("+d.r+","+d.g+","+d.b+","+b+")"},a.filterByBbox=function(a,b){var c=turf.featurecollection([turf.bboxPolygon(KR.Util.splitBbox(b))]);return turf.within(a,c)},a.getDatasetId=function(a){return"norvegiana"===a.dataset.api?a.dataset.dataset:"wikipedia"===a.dataset.api?"wikipedia":a.id?a.id:KR.Util.stamp(a)},"undefined"!=typeof L&&(L.latLngBounds.fromBBoxArray=function(a){return new L.LatLngBounds(new L.LatLng(a[1],a[0]),new L.LatLng(a[3],a[2]))},L.latLngBounds.fromBBoxString=function(a){return L.latLngBounds.fromBBoxArray(KR.Util.splitBbox(a))},L.rectangle.fromBounds=function(a){return L.rectangle([a.getSouthWest(),a.getNorthEast()])}),a.parseQueryString=function(a){var b=decodeURIComponent(a);if(""!==b)return _.reduce(b.replace("?","").split("&"),function(a,b){b=b.split("=");var c=b[1];return"true"===c?c=!0:"false"===c&&(c=!1),a[b[0]]=c,a},{})};var d=_.template("<%= totalt %> (<%= menn %> menn, <%= kvinner %> kvinner)");a.formatPersons=function(a){var b=a.split("-");return b.length<2?a:d({totalt:b[0],menn:b[1],kvinner:b[2]})},a.getBaseLayer=function(a,b){var c={nib:KR.getNibLayer,hist:function(a){a(L.tileLayer.wms("http://wms.geonorge.no/skwms1/wms.historiskekart",{layers:"historiskekart",format:"image/png",attribution:"Kartverket"}))}};if(_.has(c,a))c[a](b);else{var d=navigator.userAgent.indexOf("Safari")>-1,e=!d;b(L.tileLayer.kartverket(a,{useCache:e}))}},a.getLine=function(a,c,d){if(_.isFunction(c))return void c(function(a){d(a)});var e;if(0===c.indexOf("utno/")){var f=c.replace("utno/","");e={api:"utno",id:f,type:"gpx"}}else 0===c.indexOf("http")&&(b(c,"kml")?e={api:"kml",url:c}:b(c,"gpx")||-1!==c.indexOf("http://ut.no/tur/")?e={api:"gpx",url:c}:b(c,"geojson")&&(e={api:"geojson",url:c}));e?a.getData(e,function(a){d(a)}):alert("Kunne ikke laste linjegeometri")},a.messageDisplayer=function(a){return function(b,c){var d=$(a);d.find(".close").on("click",function(){d.find(".content").html(""),d.remove()}),d.addClass("alert-"+b),d.find(".content").html(c),$("body").append(d)}},a.mostlyCoveringMunicipality=function(a,b,c){var d="ST_MakeEnvelope("+b+", 4326)",e="SELECT komm FROM kommuner WHERE ST_Intersects(the_geom, "+d+")ORDER BY st_area(st_intersection(the_geom, "+d+")) DESC LIMIT 1",f={api:"cartodb",query:e,mapper:function(a){return a.rows[0].komm}};a.getData(f,c)},a.sparqlBbox=function(a,b,d,e,f){KR.Util.mostlyCoveringMunicipality(a,d,function(d){b.kommune=c(d),a.getData(b,e,f)})},a.distanceAndSort=function(a,b){var c=_.map(a.features,function(a){return a.properties.distance=turf.distance(b,a),a});return turf.featurecollection(c.sort(function(a,b){return a.properties.distanceb.properties.distance?1:0}))},a.round=function(a,b){_.isUndefined(b)&&(b=2);var c=Math.pow(10,b);return Math.round(a*c)/c};var e=_.template("#<%= zoom %>/<%= lat %>/<%= lon %>");a.getPositionHash=function(b,c,d){return e({zoom:d,lat:a.round(b,4),lon:a.round(c,4)})},a.WORLD={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}},a.createMap=function(b,c){c=c||{};var d=L.map(b,{minZoom:c.minZoom||3,maxZoom:c.maxZoom||18,maxBounds:L.geoJson(a.WORLD).getBounds()}),e=c.layer||"norges_grunnkart_graatone";return _.isString(e)?KR.Util.getBaseLayer(e,function(a){a.addTo(d)}):e.addTo(d),d},a.setupSidebar=function(a,b){b=b||{};var c=KR.Util.getDatasetTemplate("popup"),d=_.template($("#list_item_template").html()),e=_.template($("#marker_template").html()),f=_.template($("#thumbnail_template").html()),g=_.template($("#footer_template").html()),h=_.extend({},{position:"left",template:c,listElementTemplate:d,markerTemplate:e,thumbnailTemplate:f,footerTemplate:g},b),i=L.Knreise.Control.sidebar("sidebar",h);return a.addControl(i),i},a.distanceAndBearing=function(a,b){return{distance:1e3*turf.distance(a,b,"kilometers"),bearing:turf.bearing(a,b)}};var f=_.template("<%= service %>/s/crop/<%= width %>x<%= height %>/<%= image %>");a.getImageCache=function(a,b,c){return KR.Config.ImageCaheUrl?f({service:KR.Config.ImageCaheUrl,width:b,height:c,image:a}):a},a.isInIframe=function(){try{return window.self!==window.top}catch(a){return!0}}}(KR.Util);var KR=this.KR||{};KR.Style={},function(a){"use strict";function b(a){var b=a.properties.vernef_id;return _.find(p,function(a){return-1!==a.ids.indexOf(b)})}function c(a){return u[a]||"blue"}function d(a,b,c,d){return _.isFunction(a[b])?d?a[b]():a[b](c):a[b]}function e(a,b,c){return c?d(a,"fillcolor",b,!0):d(a,"fillcolor",b)}function f(a,b){return a.bordercolor?d(a,"bordercolor",b):e(a,b)}function g(b){return a.groups[b]}function h(b){var c;return b.properties&&b.properties.groupId?g(b.properties.groupId):(b.properties&&b.properties.datasetId&&(c=a.getDatasetStyle(b.properties.datasetId)),c?c:_.extend({},s))}function i(a,b,c){return c=c||9,{radius:c,weight:1,opacity:1,color:a,fillColor:b,fillOpacity:.4}}function j(a,b,c){return L.circleMarker(a,i(b,c))}function k(a){return L.Knreise.icon({markerColor:a})}function l(a,b,c){var d="";return a.properties&&a.properties.title&&(d=a.properties.title),L.marker(b,{icon:c,title:d})}function m(a,b,c){if(a.properties&&a.properties.thumbnail){var d={"border-color":b,"background-image":"url("+a.properties.thumbnail+")"};c&&(d["border-width"]="3px");var e=KR.Util.getImageCache(a.properties.thumbnail,50,50),f='
';return new L.DivIcon({className:"leaflet-marker-circle",html:f,iconSize:[50,50],iconAnchor:[25,25]})}}function n(a,b,c){var d=_.filter(a,function(a){return a.feature.properties.thumbnail});if(d.length){var e;_.isArray(b)&&(e=_.rest(b),b=b[0]);var f=KR.Util.getImageCache(d[0].feature.properties.thumbnail,50,50),g={"border-color":b,"background-image":"url("+f+");"};e&&(g["box-shadow"]=_.map(e,function(a,b){var c=2*(b+1);return"0 0 0 "+c+"px "+a}).join(",")+";"),c&&(g["border-width"]="3px");var h='
'+a.length+"";return new L.DivIcon({className:"leaflet-marker-photo",html:h,iconSize:[60,60],iconAnchor:[30,30]})}}function o(a,b){var c=KR.Util.hexToRgba(b,.4);return new L.DivIcon({className:"leaflet-marker-circle",html:'
'+a.length+"",iconSize:[20,20],iconAnchor:[10,10]})}var p={landskapsvern:{ids:["LVO","LVOD","LVOP","LVOPD","BV","MAV","P","GVS","MIV","NM","BVV","PO","DO","D"],style:{fillColor:"#d8cb7a",color:"#9c8f1b"}},nasjonalpark:{ids:["NP","NPS"],style:{fillColor:"#7f9aac",color:"#b3a721"}},naturreservat:{ids:["NR","NRS"],style:{fillColor:"#ef9874",color:"#ef9873"}}},q="#72B026",r="#38A9DC",s={fillcolor:r,circle:!1,thumbnail:!0},t={difo:"Digitalt fortalt",Kulturminnesok:"Kulturminnesok",DiMu:"DigitaltMuseum",MUSIT:"Musit",Artsdatabanken:"Artsdatabanken",wikipedia:"wikipedia",riksantikvaren:"riksantikvaren"};a.datasets={"Digitalt fortalt":{fillcolor:"#F69730",circle:!1,thumbnail:!0},Kulturminnesok:{fillcolor:"#436978",circle:!1,thumbnail:!1},DigitaltMuseum:{fillcolor:"#436978",circle:!1,thumbnail:!1},Musit:{fillcolor:"#436978",circle:!1,thumbnail:!1},Artsdatabanken:{fillcolor:"#5B396B",thumbnail:!1,circle:!0},riksantikvaren:{fillcolor:"#436978",circle:!1,thumbnail:!0},verneomraader:{fillcolor:function(a){if(a){var c=b(a);if(c)return c.style.fillColor}return"#009300"},bordercolor:function(a){if(a){var c=b(a);if(c)return c.style.color}return"#009300"},thumbnail:!1,circle:!0},wikipedia:{fillcolor:"#D14020",thumbnail:!0}},a.groups={},a.getDatasetStyle=function(b){var c=a.datasets[t[b]];return c||(c=a.datasets[b]),c},a.setDatasetStyle=function(b,c){_.has(t,b)||(t[b]=b);var d=a.getDatasetStyle(b);d||(d=s),a.datasets[t[b]]=_.extend({},d,c)};var u={"#F69730":"orange","#38A9DC":"blue","#A23336":"darkred","#72B026":"green","#436978":"cadetblue","#5B396B":"darkpurple","#728224":"darkgreen","#D252B9":"purple","#D14020":"red"};a.getClusterIcon=function(a,b){var c,d=a.getAllChildMarkers(),f=_.uniq(_.map(d,function(a){return a.feature.properties.groupId})),i=h(d[0].feature);if(_.compact(f).length>1){var j=_.compact(f);j.length>1&&(c=_.map(j,_.compose(e,g)))}else c=e(i,d[0].feature);if(b&&(c=q),i.thumbnail){var k=n(d,c,b);if(k)return k}return o(d,c)},a.getIcon=function(a,b){var c=h(a),d=b?q:e(c,a),g=b?q:f(c,a);if(c.thumbnail){var j=m(a,g,b);if(j)return j}return c.circle?i(g,d,c.radius):k(d)},a.getMarker=function(b,c){var d=h(b);if(d.thumbnail){var g=m(b,f(d,b),!1);if(g)return l(b,c,g)}return d.circle?j(c,f(d,b),e(d,b)):l(b,c,a.getIcon(b,!1))},a.colorForFeature=function(a,b,d){var f=h(a);return f?b?e(f,a,d):c(e(f,a)):void 0},a.colorForDataset=function(b,d,f){var g,i;return b.grouped?(g=a.groups[KR.Util.stamp(b)],g||(i=b.datasets[0].extras.datasetId)):(i||(i=b.extras.datasetId),g=h({properties:{datasetId:i}})),g?d?e(g,null,f):c(e(g,null)):void 0},a.getPathStyle=function(a,b){b=b||!1;var c=h(a),d=e(c,a),g=f(c,a);return{weight:1,color:g,fillColor:d,clickable:b,opacity:.8,fillOpacity:.4}},a.getPathStyleForGroup=function(b,c){var d={properties:{groupId:b}};return a.getPathStyle(d,c)}}(KR.Style),L.Knreise=L.Knreise||{},L.Knreise.MarkerClusterGroup=L.MarkerClusterGroup.extend({options:{zoomToBoundsOnClick:!1,spiderfyOnMaxZoom:!1,polygonOptions:{fillColor:"#ddd",weight:2,color:"#999",fillOpacity:.6}},initialize:function(a){L.Util.setOptions(this,a),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._iconCreator.bind(this)),this._featureGroup=L.featureGroup(),this._featureGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this.on("clusterclick",this._clusterClicked,this)},onAdd:function(a){L.MarkerClusterGroup.prototype.onAdd.apply(this,arguments),a.on("layerSelected",this._deselectAll,this)},_deselectAll:function(){_.each(this._gridClusters,function(a){_.each(a._grid,function(a){_.each(a,function(a){_.each(a,function(a){a.selected&&(a.createIcon=_.bind(L.MarkerCluster.prototype.createIcon,a),a._updateIcon(),a.selected=!1)})})})}),this.eachLayer(function(a){a.selected&&(a.createIcon=_.bind(L.MarkerCluster.prototype.createIcon,a),a.setIcon(_.bind(L.Knreise.GeoJSON.prototype._createFeatureIcon,this)(a.feature)),a.selected=!1)},this)},_clusterClicked:function(a){this._map.fire("layerSelected");var b=a.layer,c=_.bind(this._iconCreator,this);b.createIcon=function(){return c(this,!0).createIcon()},b.selected=!0,b._updateIcon()},_iconCreator:function(a,b){return KR.Style.getClusterIcon(a,b)}}),L.Knreise.markerClusterGroup=function(a){return new L.Knreise.MarkerClusterGroup(a)},L.Knreise=L.Knreise||{},L.Knreise.GeoJSON=L.GeoJSON.extend({initialize:function(a,b){L.setOptions(this,b),this._layers={},this.options.pointToLayer=this._pointToLayer.bind(this),a&&this.addData(a),this.on("click",this._featureClicked,this),this.on("dblclick",this._featureDblClicked,this),this._selectedLayer=null},removedPaths:[],isCollapsed:function(a,b){var c=this.options.dataset.toPoint.minSize||20,d=a.getBounds(),e=this._map.project(d.getNorthEast(),b),f=this._map.project(d.getSouthWest(),b),g=e.x-f.x,h=f.y-e.y;return c>h||c>g},_deselectAll:function(){if(this._selectedLayer){var a=this._selectedLayer;if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!1)),a.setZIndexOffset(0)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(a.setStyle(this._createFeatureIcon(b,!1)),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!1))}}this._selectedLayer=null}},deselectAllNew:function(){_.each(this.getLayers(),function(a){if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!1)),a.setZIndexOffset(0)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(a.setStyle(this._createFeatureIcon(b,!1)),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!1))}}},this)},setLayerSelected:function(a){if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!0)),a.setZIndexOffset(1e3)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(b&&(a.setStyle(this._createFeatureIcon(b,!0)),a.bringToFront()),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!0))}}this._selectedLayer=a},_featureClicked:function(a){if(!(this.options.dataset&&this.options.dataset.toPoint&&this.options.dataset.toPoint.stopPolyClick&&"Point"!==a.layer.toGeoJSON().geometry.type)){a.layer._map&&a.layer._map.fire("layerSelected");var b=a.layer;this.setLayerSelected(b)}},_featureDblClicked:function(a){this.options.dataset&&this.options.dataset.toPoint&&this.options.dataset.toPoint.stopPolyClick&&"Point"!==a.layer.toGeoJSON().geometry.type&&a.layer._map&&a.layer._map.zoomIn()},getParentLayer:function(a){var b=this._layers[a];if(b)return b;var c,d,e;for(c in this._layers)if(this._layers.hasOwnProperty(c)&&(d=this._layers[c],d.getLayer&&(e=d.getLayer(a))))return d},getZoomThreshold:function(a){var b=null,c=this._map.getZoom();if(this.isCollapsed(a,this._map.getZoom()))for(;!b;)c+=1,this.isCollapsed(a,c)||(b=c-1);else for(;!b;)c-=1,this.isCollapsed(a,c)&&(b=c);return b},_zoomend:function(){if(this.options.dataset.toPoint&&this.shouldLoad){var a,b,c=[];for(this.eachLayer(function(a){this._map.getZoom()<=a.zoomThreshold&&(this.removeLayer(a),this.options.dataset.toPoint.showAlways||this.addLayer(a.marker),c.push(a))},this),b=0;ba.zoomThreshold&&(this.options.dataset.toPoint.showAlways||this.removeLayer(a.marker),this.addLayer(a),this.removedPaths.splice(b,1),b-=1);this.removedPaths=this.removedPaths.concat(c)}},_getCenter:function(a){if("undefined"!=typeof turf){var b=turf.pointOnSurface(a.toGeoJSON());return L.latLng(b.geometry.coordinates.reverse())}return a.getBounds().getCenter()},_layeradd:function(a){var b=a.layer;if("Point"===b.feature.geometry.type||b.isMarker||(b.setStyle(KR.Style.getPathStyle(b.feature)),b.bringToBack()),this.options.dataset.toPoint){if(b.isMarker)return;if(b.getBounds&&!b.zoomThreshold&&!b.marker){var c=this.getZoomThreshold(b),d=this._pointToLayer(b.feature,this._getCenter(b));d.feature=b.feature,d.on("click",function(a){b.fire("click",{containerPoint:a.containerPoint,latlng:a.latlng,layerPoint:a.layerPoint,originalEvent:a.originalEvent,target:a.target,type:a.type,parent:!0})}),b.zoomThreshold=c,this.removedPaths.push(b),b.marker=d,b.marker.isMarker=!0,b.marker.getParent=function(){return b},this._map.getZoom()<=c&&(this.removeLayer(b),this.options.dataset.toPoint.showAlways||this.addLayer(b.marker)),this.options.dataset.toPoint.showAlways&&this.addLayer(b.marker)}}},setMap:function(a){a.on("layerSelected",this._deselectAll,this)},onAdd:function(a){L.GeoJSON.prototype.onAdd.apply(this,arguments),this.options.dataset&&this.options.dataset.toPoint&&(this._zoomend(),a.on("zoomend",this._zoomend,this),this.on("layeradd",this._layeradd,this)),this.setMap(a)},_createFeatureIcon:function(a,b){return KR.Style.getIcon(a,b)},_pointToLayer:function(a,b){return KR.Style.getMarker(a,b)}}),L.Knreise.geoJson=function(a,b){return new L.Knreise.GeoJSON(a,b)},L.Knreise=L.Knreise||{},L.Knreise.Control=L.Knreise.Control||{},L.Knreise.Control.Sidebar=L.Control.Sidebar.extend({initialize:function(a,b){b=b||{},b.autoPan=!1,L.setOptions(this,b);var c=L.DomUtil.get(a);L.DomEvent.on(c,"click",function(a){L.DomEvent.stopPropagation(a)}),c.parentNode.removeChild(c);var d=L.DomUtil.create("div","top-menu",c);this._contentContainer=L.DomUtil.create("div","sidebar-content",c),this.on("hide",this._removeContent,this);var e="leaflet-",f=this._container=L.DomUtil.create("div",e+"sidebar knreise-sidebar "+this.options.position);if(this.options.closeButton){var g=this._closeButton=L.DomUtil.create("a","close pull-right",d);g.innerHTML="×"}this._top=L.DomUtil.create("span","",d),L.DomUtil.addClass(c,e+"control"),f.appendChild(c),this.on("hide",function(){this._map&&(this._map.fire("layerSelected"),this._map.fire("layerDeselect"))},this),this.sidebar=new KR.SidebarContent(this._container,this._contentContainer,this._top,this.options,this._map)},addTo:function(a){return this.sidebar.setMap(a),L.Control.Sidebar.prototype.addTo.apply(this,arguments)},showFeature:function(a,b,c,d,e,f){if(this.show(),this.sidebar.showFeature(a,b,c,d,e,f),KR.UrlFunctions){var g=$("
"),h={id:a.id,url:KR.UrlFunctions.getFeatureLink(a),provider:a.properties.provider};a.properties.feedbackForm&&($(this._contentContainer).append(g),KR.ResponseForm(g,h)),a.id&&this.options.featureHash&&KR.UrlFunctions.setFeatureHash(a.id)}},showFeatures:function(a,b,c,d,e){this.show(),this.sidebar.showFeatures(a,b,c,d,e)},_removeContent:function(){$(this.getContainer()).html(""),KR.UrlFunctions&&KR.UrlFunctions.setFeatureHash()}}),L.Knreise.Control.sidebar=function(a,b){return new L.Knreise.Control.Sidebar(a,b)};var KR=this.KR||{};KR.UrlFunctions={},function(a){"use strict";a.setupLocationUrl=function(a){var b=function(){var b=a.getCenter(),c=KR.Util.getPositionHash(b.lat,b.lng,a.getZoom()),d=window.location.hash.split(":");if(d.length>1){var e=_.rest(d).join(":");c+=":"+e}window.location.hash=c};a.on("moveend",b),b()},a.getLocationUrl=function(){var a=window.location.hash;if(a&&""!==a&&1!==a.indexOf(":")){var b=a.replace("#","").split("/"),c=parseInt(b[0],10),d=parseFloat(b[1]),e=parseFloat(b[2]);return{lat:d,lon:e,zoom:c}}},a.getHashFeature=function(){var a=window.location.hash.split(":");return a.length>1?_.rest(a).join(":"):void 0},a.setFeatureHash=function(a){var b=window.location.hash.split(":")[0];a?window.location.hash=b+":"+encodeURIComponent(a):window.location.hash=b},a.getFeatureLink=function(a){var b=window.location.href.replace(window.location.hash,""),c=a.geometry.coordinates,d=KR.Util.getPositionHash(c[1],c[0],16),e=b+d;return a.id&&(e=e+":"+encodeURIComponent(a.id)),e}}(KR.UrlFunctions);var KR=this.KR||{};KR.MediaCarousel={},function(a){"use strict";function b(a,b){b=b||0;var c=function(){return a-1>b},d=function(){return b>0};return{prev:function(){return d()?--b:b},next:function(){return c()?++b:b},hasNext:c,hasPrev:d}}function c(a){return $('')}function d(a){return-1!==a.indexOf("mp4")?$(''):$('')}function e(a){return $('')}function f(a){if(_.has(h,a.type)){var b=h[a.type](a.url);return b.attr("data-type",a.type),b.attr("data-created",!0),b}}function g(a,b){return $('').attr("data-src",a).attr("data-type",b)}var h={image:c,video:d,sound:e};a.SetupMediaCarousel=function(a){function c(b){d=a.find(".media-list").children();var c=$(d[b]);if(d.addClass("hidden"),c.attr("data-created")||c.hasClass("audiojs"))c.removeClass("hidden");else{var g={type:c.attr("data-type"),url:c.attr("data-src")},h=f(g);c.replaceWith(h),h.is("audio")&&audiojs.create(h)}e.hasPrev()?a.find(".prev").addClass("active"):a.find(".prev").removeClass("active"),e.hasNext()?a.find(".next").addClass("active"):a.find(".next").removeClass("active")}var d=a.find(".media-list").children(),e=new b(d.length);a.find(".next").on("click",function(){e.hasNext()&&c(e.next())}),a.find(".prev").on("click",function(){e.hasPrev()&&c(e.prev())})},a.CreateMediaListMarkup=function(a){var b=$('
'),c=$('
');return c.append(_.map(a,function(a,b){var c=0===b;return c?f(a):g(a.url,a.type)})),b.append(c),a.length>1&&b.append($('
')),b[0].outerHTML}}(KR.MediaCarousel);var KR=this.KR||{};!function(){"use strict";function a(){function a(a){if(d&&d.userPosition){var b=turf.point([d.userPosition.lng,d.userPosition.lat]),c=KR.Util.distanceAndBearing(b,a),e=c.distance;return e=1e3>e?KR.Util.round(e,0)+" Meter":KR.Util.round(e/1e3,2)+" Kilometer",{dist:e,rot:c.bearing-45}}}function b(){if(e&&d&&d.userPosition&&f){g&&g.remove();var b=e.find("h3").eq(0),c=a(f);g=$(h({distanceBearing:c})),b.length?b.after(g):e.prepend(g)}}function c(a,c){e=c,f=a,b()}var d,e,f,g,h=_.template($("#user_position_template").html());return{setMap:function(a){d=a,d.on("locationChange",b)},selectFeature:c}}KR.SidebarContent=function(b,c,d,e){function f(a){c.html(a)}function g(a){a&&c.swipe({swipe:function(){},allowPageScroll:"vertical"}).off("swipeLeft").on("swipeLeft",function(){a.next&&a.next()}).off("swipeRight").on("swipeRight",function(){a.prev&&a.prev()})}function h(a,b,c,d,f,g){var i;b>0&&(i=function(e){e&&e.preventDefault(),b-=1,a=f[b];var i=h(a,b,c,d,f,g);j(a,c,d,i,b,f.length)});var l;return b"),p+='',f(p),void i(a,function(b){b.properties=_.extend(a.properties,b.properties),j(b,h,null,k,n,o)})}h=h||a.template||KR.Util.templateForDataset(a.properties.dataset)||l;var q=a.properties.images;_.isArray(q)&&(q=q[0]),a.properties.images||(a.properties.images=null),a.properties.allProps&&a.properties.allProps.europeana_rights?a.properties.license=a.properties.allProps.europeana_rights[0]:a.properties.license=a.properties.license;var r=a.properties.color||KR.Style.colorForFeature(a,!0,!0),p=''+a.properties.provider+"";if(p+=h(_.extend({image:null},a.properties)),e.footerTemplate&&a.properties.link&&(p+=e.footerTemplate(a.properties)),p=$(["
",p,"
"].join(" ")),KR.Util.isInIframe()&&p.find("a").attr("target","_blank"),m.selectFeature(a,p),f(p),g(k),b.find(".prev-next-arrows").remove(),d.html(""),k){var s=$('');d.append(s),s.click(k.close);var t=n+1;d.append($('
'+t+" av "+o+"
"));var u=$('');b.append(u),k.prev&&u.click(k.prev).addClass("active");var v=$('');b.append(v),k.next&&v.click(k.next).addClass("active")}var w=c.find(".media-container");w.length&&KR.MediaCarousel.SetupMediaCarousel(w),"undefined"!=typeof audiojs&&audiojs.createAll(),c.scrollTop(0)}function k(a,b,f,g,j){g=void 0===g?e.noListThreshold:g;var k=a.length<=g;if(k&&j!==!0){var l=a[0];c.html("");var m=h(l,0,b,f,a);return void this.showFeature(l,b,f,m,0,a.length)}var n=$(''+a.length+"");d.html(n);var o=_.chain(a).groupBy(function(a){return a.properties.provider}).map(function(c,d){var e=$("
"),g=$('
'),h=_.map(c,function(c){var d=_.findIndex(a,function(a){return a===c});return i(c,d,b,f,a)},this);return g.append(h),e.append('
'+d+"
"),e.append(g),e}).value();c.html(o),c.scrollTop(0)}var l=KR.Util.getDatasetTemplate("popup"),m=new a;return c=$(c),b=$(b),d=$(d),{showFeature:j,showFeatures:k,setMap:function(a){m.setMap(a)}}}}(),function(){"use strict";L.Knreise=L.Knreise||{},L.Knreise.Control=L.Knreise.Control||{};var a=function(a,b){function c(c){var d=document.createElement("i");return d.className="layericon fa",a.visible?d.className+=" fa-check-square-o":d.className+=" fa-square-o",c&&(d.className+=" "+c),b.isLoading&&(d.className="layericon fa fa-spinner fa-pulse"),b.enabled?d.style.color=KR.Style.colorForDataset(a,!0,!0):d.style.color="#ddd",d}function d(){var a=c();j.replaceChild(a,k),k=a}function e(){a.visible=!a.visible,d(),a.visible?b.fire("show"):b.fire("hide")}function f(a){m?m.setAttribute("title",m.getAttribute("title")+", "+KR.parseError(a)):(m=L.DomUtil.create("i","error-icon fa fa-exclamation-triangle"),m.setAttribute("title",KR.parseError(a)),j.insertBefore(m,j.childNodes[0]))}function g(){j=document.createElement("label"),_.isUndefined(a.visible)&&(a.visible=!0);var d=document.createElement("span");d.innerHTML=" "+a.name,k=c(),j.appendChild(k),j.appendChild(d),b.error&&f(b.error),b.enabled||(j.className="disabled"),L.DomEvent.on(j,"click",function(){var a=b.enabled&&!b.isLoading;a&&e()})}function h(){b.enabled!==l&&(l=b.enabled,d(),l?j.className=j.className.replace("disabled",""):j.className+="disabled")}function i(){return j}var j,k,l=b.enabled,m=null;return g(),b.on("changeEnabled",h),b.on("dataloadstart",function(){m&&(j.removeChild(m),m=null),d()}),b.on("dataloadend",d),b.on("error",f),{getLabel:i,hasError:function(){return!!b.error}}};L.Control.Datasets=L.Control.extend({initialize:function(a,b){L.setOptions(this,b),this._labels=[],this._handlingClick=!1,this.expanded=!1,this.numLoading=0;var c;for(c in a)a.hasOwnProperty(c)&&this._addLayer(a[c])},_addLayer:function(a){var b,c=a.options.dataset;if(c.datasets)if(c.grouped)this._addDataset(c,a);else for(b=0;b0?this._btnIcon=L.DomUtil.create("i","fa fa-spinner fa-pulse",b):this._btnIcon=L.DomUtil.create("i","fa fa-bars",b),this._container.appendChild(this._closeDiv),this._listContainer=L.DomUtil.create("div",a+" hidden"),this._listContainer.appendChild(this._form),this._container.appendChild(this._listContainer)},_toggle:function(){this.expanded?this._collapse():this._expand()},_expand:function(){L.DomUtil.addClass(this._listContainer,"leaflet-control-layers-expanded"),this.expanded=!0,this._listContainer.className=this._listContainer.className.replace(" hidden","")},_collapse:function(){this._listContainer.className=this._listContainer.className.replace(" leaflet-control-layers-expanded",""),L.DomUtil.addClass(this._listContainer,"hidden"),this.expanded=!1}}),L.control.datasets=function(a,b){return new L.Control.Datasets(a,b)}}(),L.Knreise=L.Knreise||{},L.Knreise.Icon=L.KNreiseMarkers.Icon.extend({options:{icon:null}}),L.Knreise.icon=function(a){return new L.Knreise.Icon(a)};var KR=this.KR||{}; +KR.DatasetLoader=function(a,b,c,d,e,f){"use strict";function g(a){var b=KR.Util.stamp(a);return function(c){return c&&c.features.length?(_.each(c.features,function(c){c.properties.datasetID=b,_.has(a,"circle")&&(c.properties.circle=a.circle),_.has(a,"provider")&&(c.properties.provider=a.provider),_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()b;b++)a[b]={identifier:""+b,topLeftCorner:new L.LatLng(20037508.3428,-20037508.3428)};return a}}),L.tileLayer.wmts=function(a,b){return new L.TileLayer.WMTS(a,b)},function(a){"use strict";function b(a){var b,c=new Array(30);for(b=0;22>b;b++)c[b]={identifier:a+":"+b,topLeftCorner:new L.LatLng(20037508,-20037508.34)};return c}a.SKTokenUrl="http://localhost:8001/html/baat/?type=token",a.getNibLayer=function(c,d){a.Util.sendRequest(KR.SKTokenUrl,null,function(a){var e;if(d)e=L.tileLayer.wms("http://gatekeeper2.geonorge.no/BaatGatekeeper/gk/gk.nibcache",{layers:"NiB",format:"image/jpeg",transparent:!1,attribution:"Kartverket"});else{var f="http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts",g="EPSG:900913";e=new L.TileLayer.WMTS(f,{layer:"NiB",style:"normal",tilematrixSet:g,matrixIds:b(g),format:"image/jpeg",attribution:"Kartverket"})}e.setParams({GKT:a}),c(e)})}}(KR);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getKulturminneFunctions=function(a){var b,c,d,e,f,g=[],h=!1,i=!0,j=function(){map.removeLayer(d)},k=function(){map.addLayer(d)},l=function(a){var b="down"===a;b?(c.addLayer(d),f&&c.addLayer(f)):(c.removeLayer(d),f&&c.removeLayer(f))},m=function(a,b,c){var d;a.on("zoomstart",function(b){d=a.getZoom()}),a.on("zoomend",function(e){var f=a.getZoom();d>b&&b>=f&&c("up"),b>=d&&f>b&&c("down")})},n=function(a){return _.find(b.getLayers(),function(b){return b.feature.properties.id===a})},o=function(a){return _.find(d.getLayers(),function(b){return b.feature.properties.lok===a})},p=function(a,b){var c=n(a.properties.lok);c&&c.fire("click")},q=function(a){return L.geoJson(null,{onEachFeature:function(b,c){a.extras&&a.extras.groupId?c.setStyle(KR.Style.getPathStyleForGroup(a.extras.groupId)):(b.properties.datasetId=a.id,c.setStyle(KR.Style.getPathStyle(b,!0))),c.on("click",function(){p(b,c)})}}).addTo(c)},r=function(){},s=function(){_.each(d.getLayers(),function(a){a.setStyle(KR.Style.getPathStyle(a.feature,!0))})},t=function(a){s();var b=a.layer.feature.properties.id,c=o(b);c&&(c.setStyle({weight:1,color:"#436978",fillColor:"#72B026",clickable:!0,opacity:.8,fillOpacity:.4}),e&&e(a.layer.feature))},u=function(a,b){c.sidebar&&c.sidebar.showFeature(a,b.enkeltminner.template||KR.Util.getDatasetTemplate("ra_enkeltminne"))},v=function(b){_.has(b,"enkeltminner")||(b.enkeltminner={});var d=b.enkeltminner.style||{color:"#fff",weight:1,fillColor:"#B942D0"};f=L.geoJson(null,{onEachFeature:function(a,c){a.properties.provider=b.enkeltminner.provider||"Enkeltminne",a.properties.color=b.enkeltminner.sidebarColor||"#B942D0",c.on("click",function(){u(a,b)})},style:function(){return d}}).addTo(c),e=function(b){var c={api:"kulturminnedataSparql",type:"enkeltminner",lokalitet:b.properties.id};a.getData(c,function(a){f.clearLayers(),f.addData(a)})}},w=function(a,e,f){b=f,c=a,b.on("hide",j),b.on("show",k),d=q(e),m(c,13,l),c.on("zoomend",r),c.on("layerDeselect",s),b.on("click",t),_.has(e,"showEnkeltminner")&&(i=e.showEnkeltminner),i&&v(e)},x=function(a){d.addData(a);var b=_.chain(a.features).map(function(a){return a.properties.lok}).uniq().value();h&&_.each(b,function(a){n(a)}),g=g.concat(b)},y=function(b,c,d){if(d){var e=_.chain(d).map(function(a){return a.properties.id}).filter(function(a){return-1===g.indexOf(a)}).value();if(e.length){var f={api:"kulturminnedataSparql",type:"lokalitetpoly",lokalitet:e};a.getData(f,x)}}};return{loadKulturminnePoly:y,initKulturminnePoly:w}}}(KR.Config);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getDatasetList=function(b,c,d){var e=a.getKulturminneFunctions(b);c&&3===c.length&&(c="0"+c);var f={difo:{name:"Digitalt fortalt",dataset:{dataset:"difo",api:"norvegiana"},cluster:!0,template:KR.Util.getDatasetTemplate("digitalt_fortalt"),noListThreshold:1/0,description:"Kulturrådets tjeneste for personlige fortellinger fra kulturinstitusjoner og privatpersoner.",allowTopic:!0,feedbackForm:!0,isStatic:!1},verneomr:{id:"verneomraader",dataset:{api:"cartodb",table:"naturvernomrader_utm33_2",columns:["iid","omradenavn","vernef_id","verneform"]},provider:"Naturbase",name:"Verneområder",template:KR.Util.getDatasetTemplate("verneomraader"),getFeatureData:function(a,c){b.getItem({api:"norvegiana",id:"kulturnett_Naturbase_"+a.properties.iid},c)},toPoint:{showAlways:!0,stopPolyClick:!0,minSize:20},minZoom:10,cluster:!1,description:"Nasjonalparker og andre naturvernområder - ca. 2700 i hele landet."},artobs:{name:"Artsobservasjoner",hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"Artsdatabanken"},cluster:!1,description:"Artsobservasjoner fra Artsdatabanken",template:KR.Util.getDatasetTemplate("popup")},folketelling:{name:"Folketelling 1910",provider:"Folketelling 1910",dataset:{api:"folketelling",dataset:"property"},isStatic:!1,minZoom:14,template:KR.Util.getDatasetTemplate("folketelling"),getFeatureData:function(a,c){b.getData({api:"folketelling",type:"propertyData",propertyId:a.properties.efid},function(b){a.properties=b.properties,a.properties.provider="Folketelling 1910",c(a)})},mappings:{title:"gaardsnavn_gateadr"},noListThreshold:0,description:"Personer og eiendommer fra folketellingen 1910"},ark_hist:{grouped:!0,name:"Arkeologi og historie",minZoom:14,datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Data fra Universitetsmuseene, Digitalt museum og Riksantikvaren"},jernbane:{id:"jernbane",dataset:{api:"jernbanemuseet"},provider:"Jernbanemuseet",name:"Jernbanemuseet",hideFromGenerator:!0,template:KR.Util.getDatasetTemplate("jernbanemuseet"),getFeatureData:function(a,c){b.getItem({api:"jernbanemuseet",id:a.properties.id},c)},isStatic:!0,bbox:!1,description:"Jernbanemuseet"},arkeologi:{grouped:!0,name:"Arkeologi",minZoom:14,style:{fillcolor:"#436978",circle:!1,thumbnail:!0},datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER regex(?loccatlabel, "^Arkeologisk", "i") .',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Arkeologidata fra Universitetsmuseene og Riksantikvaren"},historie:{grouped:!0,name:"Historie",minZoom:14,style:{fillcolor:"#D252B9",circle:!1,thumbnail:!0},datasets:[{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER (!regex(?loccatlabel, "^Arkeologisk", "i"))',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"-dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Industrimuseum"},isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Foto-SF"},isStatic:!1,bbox:!1,template:KR.Util.getDatasetTemplate("foto_sf")},{dataset:{api:"norvegiana",dataset:"Kystreise"},isStatic:!0,bbox:!1}],description:"Historie og kulturminner fra Riksantikvaren og Digitalt museum "},kunst:{grouped:!0,name:"Kunst",style:{fillcolor:"#72B026",circle:!1,thumbnail:!0},datasets:[{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1}],description:"Kunstdata fra Digitalt museum "},wikipedia:{name:"Wikipedia",provider:"Wikipedia",dataset:{api:"wikipedia"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra bokmålswikipedia"},wikipediaNN:{name:"Wikipedia Nynorsk",provider:"Wikipedia Nynorsk",dataset:{api:"wikipediaNN"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra nynorskwikipedia"},lokalwiki:{id:"lokalwiki",name:"Lokalhistoriewiki",hideFromGenerator:!1,provider:"Lokalhistoriewiki",dataset:{api:"lokalhistoriewiki"},style:{thumbnail:!0},minZoom:13,bbox:!0,isStatic:!1,description:"Stedfestede artikler fra lokalhistoriewiki.no"},riksantikvaren:{id:"riksantikvaren",name:"Kulturminnesøk",hideFromGenerator:!1,provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:10,callback:e.loadKulturminnePoly},description:"Data fra Riksantikvarens kulturminnesøk"},brukerminner:{name:"Kulturminnesøk - brukerregistreringer",hideFromGenerator:!1,provider:"riksantikvaren",dataset:{api:"kulturminnedata",layer:2,getExtraData:!0,extraDataLayer:6,matchId:"KulturminnesokID"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Brukerregistrerte data fra Riksantikvarens kulturminnesøk",template:KR.Util.getDatasetTemplate("brukerminne")},groruddalen:{name:"Byantikvaren Oslo - Groruddalen",hideFromGenerator:!0,provider:"Byantikvaren i Oslo",dataset:{api:"cartodb",table:"byantikvaren_oslo_groruddalen"},bbox:!1,isStatic:!1,style:{thumbnail:!0},template:KR.Util.getDatasetTemplate("byantikvaren_oslo"),description:"Byantikvarens Groruddalsatlas"},norgerundt:{name:"Norge Rundt",hideFromGenerator:!0,provider:"NRK",dataset:{api:"cartodb",table:"nrk_norge_rundt"},bbox:!1,isStatic:!1,style:{thumbnail:!0},description:"Stedfestede innslag fra Norge Rundt"},dimu:{name:"Digitalt Museum",hideFromGenerator:!1,provider:"dimu",dataset:{dataset:"DiMu",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Digitalt Museum",allowTopic:!0,feedbackForm:!0},musit:{name:"Universitetsmuseene",hideFromGenerator:!1,provider:"Universitetsmuseene",dataset:{dataset:"MUSIT",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Universitetsmuseene",allowTopic:!0,feedbackForm:!0},industrimuseum:{name:"Industrimuseum",hideFromGenerator:!1,provider:"Industrimuseum",dataset:{dataset:"Industrimuseum",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Industrimuseum",allowTopic:!0,feedbackForm:!0},kystreise:{name:"Kystreise",hideFromGenerator:!1,provider:"Kystreise",dataset:{dataset:"Kystreise",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Kystreise",allowTopic:!0,feedbackForm:!0},dimufoto:{hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"DiMu",query:"europeana_type_facet:IMAGE"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,style:{thumbnail:!0},noListThreshold:1/0},kulturminnesok_flickr:{name:"Kulturminnesøk",dataset_name_override:"Kulturminnesøk",provider:"Kulturminnesøk Flickr",hideFromGenerator:!0,dataset:{api:"flickr",group_id:"1426230@N24"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!0,style:{thumbnail:!0},description:"Bilder fra Kulturminnesøks Flickr-gruppe"},riksarkivet:{name:"Riksarkivet",dataset_name_override:"Riksarkivet",provider:"riksarkivet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_archives_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Riksarkivets Flickr-konto"},nasjonalbiblioteket:{name:"Nasjonalbiblioteket",dataset_name_override:"Nasjonalbiblioteket",provider:"nasjonalbiblioteket",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_library_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalbibliotekets Flickr-konto"},oslobyarkiv:{name:"Oslo Byarkiv",dataset_name_override:"Oslo Byarkiv",provider:"oslobyarkiv",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"byarkiv"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Oslo byarkiv sin Flickr-konto"},nasjonalmuseet:{name:"Nasjonalmuseet",dataset_name_override:"Nasjonalmuseet",provider:"nasjonalmuseet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nasjonalmuseet"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalmuseet sin Flickr-konto"},nve:{name:"NVE",dataset_name_override:"NVE",provider:"nve",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nve",accuracy:"6"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra NVE Flickr-konto"},vestfoldmuseene:{name:"Vestfoldmuseene",dataset_name_override:"Vestfoldmuseene",provider:"Vestfoldmuseene",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"vestfoldmuseene",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Vestfoldmuseene sin Flickr-konto"},perspektivet:{name:"Perspektivet Museum",dataset_name_override:"Perspektivet Museum",provider:"Perspektivet Museum",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"perspektivetmuseum",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Perspektivet Museum sin Flickr-konto"}};if(!c&&!d){var g={bbox:!0,minZoom:12,isStatic:!1,bboxFunc:KR.Util.sparqlBbox};_.extend(f.riksantikvaren,g),_.extend(f.ark_hist.datasets[2],g),_.extend(f.arkeologi.datasets[1],g),_.extend(f.historie.datasets[0],g)}return f},a.getDatasets=function(b,c,d,e){var f=a.getDatasetList(c,d,e);return _.chain(b).map(function(a){var b;if(a.indexOf(":")>-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};KR.SplashScreen=function(a,b,c,d,e,f){"use strict";function g(){return window.location.href.replace(window.location.hash,"")}function h(){var a=g(),b="remember_"+a+"=",c=document.cookie.split("; "),d=_.find(c,function(a){return 0===a.indexOf(b)});return d?"true"===d.substring(b.length,d.length):void 0}function i(a){document.cookie="remember_"+g()+"="+a}function j(){this._gray&&this._container.removeChild(this._gray),L.Control.Sidebar.prototype.hide.apply(this,arguments)}function k(){this._gray=L.DomUtil.create("div","gray",this._container),L.Control.Sidebar.prototype.show.apply(this,arguments)}function l(){var g=L.DomUtil.create("div","",document.body);g.id="splashscreen";var h=L.control.sidebar("splashscreen",{position:"center",autoPan:!1});h.hide=_.bind(j,h),h.show=_.bind(k,h),a.addControl(h);var i=_.template($("#splashscreen_template").html()),l=$("
"+i({title:b,image:d,description:c,creator:e,spinner:!!f})+"
");return KR.Util.isInIframe()&&l.find("a").attr("target","_blank"),h.setContent(l.html()),h}function m(a){function b(){i(c.prop("checked"))}var c=$(a.getContainer()).find("#persist_splash_cb");c.prop("checked",h()),c.on("change",b),b()}function n(b){return L.easyButton(a,b,{position:"topright",icon:"fa-info-circle",title:"Om"})}var o=l();n(function(){o.isVisible()?o.hide():o.show()});var p=h();return p||(_.isUndefined(p)&&i(!0),o.show()),m(o),{finishedLoading:function(){var a=$(o.getContainer()).find("#splash_spinner");a&&a.remove()}}};var KR=this.KR||{};KR.ResponseForm=function(a,b){function c(a,b){var c=_.reduce(a,function(a,b,c){return a[g[c]]=b,a},{});$.ajax({url:h,data:c,type:"POST",dataType:"xml",success:b,error:b})}function d(b){a.find("form").addClass("hidden"),a.find("#form-success").removeClass("hidden").find(".media-body").text("Din melding er sendt til "+b+". De vil ta kontakt hvis de har behov for ytterligere informasjon")}function e(e){e.preventDefault();var f=a.find("#form_email").val(),g=a.find("#form_message").val();if(""===f||""===g)return!1;var h=_.extend({},b,{email:f,message:g});return c(h,function(){d(h.provider)}),!1}function f(){a.find("#form_email").val(""),a.find("#form_message").val(""),a.find("#form-success").addClass("hidden"),a.find("form").addClass("hidden"),a.find(".show-more").removeClass("hidden")}var g={message:"entry.126368279",email:"entry.748218122",id:"entry.2043404140",url:"entry.243673559",provider:"entry.826324496"},h="https://docs.google.com/forms/d/1ah66lattC8it7OTIM6de20NSNkBeiQ0vabpsHSaPU7s/formResponse",i=$("#response_form_template").html();a.append(i),a.find("form").on("submit",e),a.find(".show-more").click(function(){a.find(".show-more").addClass("hidden"),a.find("form").removeClass("hidden")}),a.find(".close ").click(f)};var KR=this.KR||{};!function(a){"use strict";function b(a){return function(b){if(!b||!b.features.length)return b;var c=b.features[0].geometry.type;if(c.indexOf("Polygon")>-1){var d=_.filter(b.features,function(b){var c=turf.extent(b),d=turf.bboxPolygon(c);return!!turf.intersect(d,a.features[0])});return KR.Util.createFeatureCollection(d)}if(c.indexOf("MultiLineString")>-1){var d=_.filter(b.features,function(b){var c=turf.extent(b),d=turf.bboxPolygon(c);return!!turf.intersect(d,a.features[0])});return KR.Util.createFeatureCollection(d)}return turf.within(b,a)}}function c(a,b,c,d,e){return c&&(b=KR.Config.getDatasets(b,a,d,e)),b}function d(a,b){var c={stroke:!1,fillColor:"#ddd",fillOpacity:.8},d=_.reduce(b.features,function(a,b){return turf.erase(a,b)},KR.Util.WORLD);L.geoJson(d,c).addTo(a)}function e(a,c,e,f,g,h,i,j){if(a.geomFilter){var k={api:"cartodb"};k[h]=g,c.getData(k,function(c){a.showGeom&&d(a.map,c);var f=L.geoJson(c),g=b(c);i(f.getBounds(),e,g,null,j)})}else f(g,function(a){var b=L.latLngBounds.fromBBoxString(a);i(b,e,null,null,j)})}function f(a,b,d,f,g,h){d=c(b,d,f,a.komm),_.isString(a.komm)&&(a.komm=a.komm.split(",")),e(a,b,d,b.getMunicipalityBounds,a.komm,"municipality",g,h)}function g(a,b,d,f,g,h){d=c(b,d,f,null,a.fylke),_.isString(a.fylke)&&(a.fylke=a.fylke.split(",")),e(a,b,d,b.getCountyBounds,a.fylke,"county",g,h)}function h(a,b,d,e,f,g){d=c(b,d,e);var h=L.latLngBounds.fromBBoxString(a.bbox);f(h,d,null,null,g)}function i(a){var b=[];return _.each(a.features,function(a){"GeometryCollection"===a.geometry.type?_.each(a.geometry.geometries,function(c){b.push(KR.Util.createGeoJSONFeatureFromGeom(c,a.properties))}):b.push(a)}),KR.Util.createFeatureCollection(b)}function j(a){var b=_.map(a.features,function(a){return turf.simplify(a,.01,!1)});return KR.Util.createFeatureCollection(b)}function k(a,d,e,f,g,h,k){var l={};e.linecolor&&(l.color=e.linecolor);var m=L.geoJson(a,l),n=m.getBounds();f=c(d,f,g);var o;if(a&&e.buffer){a=i(a),a.features.length>5&&(a=j(a));var p=turf.buffer(a,e.buffer,"kilometers");o=b(p)}h(n,f,o,m,k)}function l(a,b,c,d,e,f){KR.Util.getLine(b,a.line,function(g){k(g,b,a,c,d,e,f)})}function m(a){var b=KR.UrlFunctions.getHashFeature();if(b){var c=function(a){return decodeURIComponent(a.feature.id)===decodeURIComponent(b)||a.feature.id===decodeURIComponent(b)},d=_.find(_.flatten(a),function(a){return _.find(a.getLayers(),c)});if(d){var e=_.find(d.getLayers(),c);e.fire("click"),d.setLayerSelected(e)}}}function n(a,b){return _.map(a,function(a){return a.isStatic&&(a.fixedBbox=b),a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic&&(a.fixedBbox=b),a})),a})}function o(a){return _.map(a,function(a){return a.isStatic=!0,a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic=!0,a})),a})}var p={geomFilter:!1,showGeom:!1,loactionHash:!0,featureHash:!0};a.setupMap=function(a,b,c,d){function e(a,b,d,e,f){c.allstatic&&(b=o(b)),b=n(b,a.toBBoxString());var g=L.Knreise.LocateButton(null,null,{bounds:a});g.addTo(i);var h=function(f){f?(i.setView([f.lat,f.lon],f.zoom),a=i.getBounds()):i.fitBounds(a),c.loactionHash&&KR.UrlFunctions.setupLocationUrl(i);var g,h=function(a){m(a),q&&q.finishedLoading()};c.geomFilter&&a&&(g=a.toBBoxString());var j=k.loadDatasets(b,a.toBBoxString(),d,h,g);e&&e.addTo(i),b.length>1&&L.control.datasets(j).addTo(i)};c.initUserPos?(i.addOneTimeEventListener("locationChange",function(){var a={lat:i.userPosition.lat,lon:i.userPosition.lng,zoom:16};h(a)}),i.addOneTimeEventListener("locationError",function(){h(f)}),g.getLocation()):h(f)}c=c||{},c=_.extend({},p,c);var i=KR.Util.createMap("map",c);_.has(c,"extraLayers")&&_.isArray(c.extraLayers)&&_.each(c.extraLayers,function(a){i.addLayer(a)});var j=KR.Util.setupSidebar(i,{featureHash:c.featureHash}),k=new KR.DatasetLoader(a,i,j,null,c.cluster,c.clusterRadius);i.sidebar=j;var q;c.title&&(q=KR.SplashScreen(i,c.title,c.description,c.image,null,!1));var r,s=KR.UrlFunctions.getLocationUrl(i);return c.initUserPos||(r=s),c.map=i,c.komm?f(c,a,b,d,e,r):c.fylke?g(c,a,b,d,e,r):c.line?l(c,a,b,d,e,r):c.bbox?h(c,a,b,d,e,r):alert("Missing parameters!"),i},a.setupMapFromUrl=function(b,c,d){a.setupMap(b,c,d,!0)}}(KR);var KR=this.KR||{};KR.setupCollectionMap=function(a,b,c){"use strict";function d(a){var b=KR.Util.createMap("map",{layer:c});KR.SplashScreen(b,a.title,a.description,a.image,a.creator),$("title").append(a.title);var d=L.latLngBounds.fromBBoxArray(turf.extent(a.geo_json));_.each(a.geo_json.features,function(a){a.properties.datasetId=a.properties.provider,_.has(e,a.properties.provider)&&(a.template=e[a.properties.provider])});var f=KR.Util.setupSidebar(b),g=KR.Util.clusterClick(f),h=KR.Util.featureClick(f);L.Knreise.LocateButton(null,null,{bounds:d}).addTo(b),b.fitBounds(d);var i=L.Knreise.geoJson(a.geo_json,{onEachFeature:function(a,b){h(a,b)}}),j=(new L.Knreise.MarkerClusterGroup).addTo(b);j.addLayers(i.getLayers()),g(j)}var e={"Digitalt fortalt":KR.Util.getDatasetTemplate("digitalt_fortalt"),DigitaltMuseum:KR.Util.getDatasetTemplate("digitalt_museum"),Musit:KR.Util.getDatasetTemplate("musit"),Artsdatabanken:KR.Util.getDatasetTemplate("popup")};a.getCollection(b,d)}; \ No newline at end of file diff --git a/dist/scripts3d.js b/dist/scripts3d.js index 26cdb2ef..d8127caf 100644 --- a/dist/scripts3d.js +++ b/dist/scripts3d.js @@ -1756,7 +1756,7 @@ var KR = this.KR || {}; if (feature.properties.thumbnail) { marker = options.thumbnailTemplate({ thumbnail: KR.Util.getImageCache(feature.properties.thumbnail, 80, 60), - thumbnail2x: KR.Util.getImageCache(feature.properties.thumbnail, 60, 120), + thumbnail2x: KR.Util.getImageCache(feature.properties.thumbnail, 120, 90), color: KR.Style.colorForFeature(feature, true) }); } else { @@ -1811,7 +1811,7 @@ var KR = this.KR || {}; if (feature.properties.allProps && feature.properties.allProps.europeana_rights) { feature.properties.license = feature.properties.allProps.europeana_rights[0]; } else { - feature.properties.license = null; + feature.properties.license = feature.properties.license; } diff --git a/dist/scripts3d.min.js b/dist/scripts3d.min.js index f50fe69e..b1f99da7 100644 --- a/dist/scripts3d.min.js +++ b/dist/scripts3d.min.js @@ -1,2 +1,2 @@ -var KR=this.KR||{};!function(a){"use strict";a.parseError=function(a){if(a.responseJSON){if(a.responseJSON.error)return a.responseJSON.error.join(", ");if(a.responseJSON.status)return a.responseJSON.status}return a.statusText?a.statusText:a.error?a.error.info?a.error.info:a.error.error?a.error.error:a.error:"Unknown error"},a.errorHandler=function(b){var c=$(b);c.find(".close").on("click",function(){c.find(".content").html(""),c.remove()});var d=_.template("
<%= dataset %>: <%= error %>
");return function(b){var e=d({dataset:b.dataset,error:a.parseError(b.error)});c.parent()?c.find(".content").append(e):c.find(".content").html(e),$("body").append(c)}}}(KR);var KR=this.KR||{};KR.Config={contentIcons:{IMAGE:"camera-retro",VIDEO:"file-video-o",SOUND:"music",TEXT:"file-text","default":"file-o"},templates:{}},KR.Config.ImageCaheUrl="http://egbtmre.cloudimg.io",KR.Util=KR.Util||{},function(a){"use strict";function b(a,b){var c=a.lastIndexOf(b);return-1!==c&&c+b.length===a.length}function c(a){return 1e3>a?"0"+a:a}a.iconForContentType=function(a){var b=a.properties.contentType;return _.has(KR.Config.contentIcons,b)?KR.Config.contentIcons[b]:KR.Config.contentIcons["default"]},a.getDatasetTemplate=function(a){var b=$("#"+a+"_template").html();return b?_.template(b):void 0},a.templateForDataset=function(a){return _.has(KR.Config.templates,a)?KR.Config.templates[a]:void 0},a.createStyleString=function(a){return _.map(a,function(a,b){return b+": "+a}).join(";")},a.colorForProvider=function(a,b){var c=!0;"hex"!==b&&(c=!1);var d={properties:{datasetId:a}};return KR.Style.colorForFeature(d,c,!0)},a.featureClick=function(a){return function(b,c,d){c.on("click",function(c){d&&d.toPoint&&d.toPoint.stopPolyClick&&!c.parent||(d?a.showFeature(b,d.template,d.getFeatureData):a.showFeature(b))})}},a.getTemplateForFeature=function(a,b){if(b){if(b.datasets){var c=_.find(b.datasets,function(b){return b._knreise_id===a.properties.datasetID});return c.template}return b.template}},a.clusterClick=function(b){return function(c,d){c.on("clusterclick",function(c){var e=_.map(c.layer.getAllChildMarkers(),function(b){var c=b.feature;return d&&!c.template&&(c.template=a.getTemplateForFeature(c,d)),c}),f=_.extend({},{template:null,getFeatureData:null,noListThreshold:null},d);b.showFeatures(e,f.template,f.getFeatureData,f.noListThreshold)})}},a.hexToRgba=function(a,b){b=b||1;var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(!c)return 0;var d={r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)};return"rgba("+d.r+","+d.g+","+d.b+","+b+")"},a.filterByBbox=function(a,b){var c=turf.featurecollection([turf.bboxPolygon(KR.Util.splitBbox(b))]);return turf.within(a,c)},a.getDatasetId=function(a){return"norvegiana"===a.dataset.api?a.dataset.dataset:"wikipedia"===a.dataset.api?"wikipedia":a.id?a.id:KR.Util.stamp(a)},"undefined"!=typeof L&&(L.latLngBounds.fromBBoxArray=function(a){return new L.LatLngBounds(new L.LatLng(a[1],a[0]),new L.LatLng(a[3],a[2]))},L.latLngBounds.fromBBoxString=function(a){return L.latLngBounds.fromBBoxArray(KR.Util.splitBbox(a))},L.rectangle.fromBounds=function(a){return L.rectangle([a.getSouthWest(),a.getNorthEast()])}),a.parseQueryString=function(a){var b=decodeURIComponent(a);if(""!==b)return _.reduce(b.replace("?","").split("&"),function(a,b){b=b.split("=");var c=b[1];return"true"===c?c=!0:"false"===c&&(c=!1),a[b[0]]=c,a},{})};var d=_.template("<%= totalt %> (<%= menn %> menn, <%= kvinner %> kvinner)");a.formatPersons=function(a){var b=a.split("-");return b.length<2?a:d({totalt:b[0],menn:b[1],kvinner:b[2]})},a.getBaseLayer=function(a,b){var c={nib:KR.getNibLayer,hist:function(a){a(L.tileLayer.wms("http://wms.geonorge.no/skwms1/wms.historiskekart",{layers:"historiskekart",format:"image/png",attribution:"Kartverket"}))}};if(_.has(c,a))c[a](b);else{var d=navigator.userAgent.indexOf("Safari")>-1,e=!d;b(L.tileLayer.kartverket(a,{useCache:e}))}},a.getLine=function(a,c,d){if(_.isFunction(c))return void c(function(a){d(a)});var e;if(0===c.indexOf("utno/")){var f=c.replace("utno/","");e={api:"utno",id:f,type:"gpx"}}else 0===c.indexOf("http")&&(b(c,"kml")?e={api:"kml",url:c}:b(c,"gpx")||-1!==c.indexOf("http://ut.no/tur/")?e={api:"gpx",url:c}:b(c,"geojson")&&(e={api:"geojson",url:c}));e?a.getData(e,function(a){d(a)}):alert("Kunne ikke laste linjegeometri")},a.messageDisplayer=function(a){return function(b,c){var d=$(a);d.find(".close").on("click",function(){d.find(".content").html(""),d.remove()}),d.addClass("alert-"+b),d.find(".content").html(c),$("body").append(d)}},a.mostlyCoveringMunicipality=function(a,b,c){var d="ST_MakeEnvelope("+b+", 4326)",e="SELECT komm FROM kommuner WHERE ST_Intersects(the_geom, "+d+")ORDER BY st_area(st_intersection(the_geom, "+d+")) DESC LIMIT 1",f={api:"cartodb",query:e,mapper:function(a){return a.rows[0].komm}};a.getData(f,c)},a.sparqlBbox=function(a,b,d,e,f){KR.Util.mostlyCoveringMunicipality(a,d,function(d){b.kommune=c(d),a.getData(b,e,f)})},a.distanceAndSort=function(a,b){var c=_.map(a.features,function(a){return a.properties.distance=turf.distance(b,a),a});return turf.featurecollection(c.sort(function(a,b){return a.properties.distanceb.properties.distance?1:0}))},a.round=function(a,b){_.isUndefined(b)&&(b=2);var c=Math.pow(10,b);return Math.round(a*c)/c};var e=_.template("#<%= zoom %>/<%= lat %>/<%= lon %>");a.getPositionHash=function(b,c,d){return e({zoom:d,lat:a.round(b,4),lon:a.round(c,4)})},a.WORLD={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}},a.createMap=function(b,c){c=c||{};var d=L.map(b,{minZoom:c.minZoom||3,maxZoom:c.maxZoom||18,maxBounds:L.geoJson(a.WORLD).getBounds()}),e=c.layer||"norges_grunnkart_graatone";return _.isString(e)?KR.Util.getBaseLayer(e,function(a){a.addTo(d)}):e.addTo(d),d},a.setupSidebar=function(a,b){b=b||{};var c=KR.Util.getDatasetTemplate("popup"),d=_.template($("#list_item_template").html()),e=_.template($("#marker_template").html()),f=_.template($("#thumbnail_template").html()),g=_.template($("#footer_template").html()),h=_.extend({},{position:"left",template:c,listElementTemplate:d,markerTemplate:e,thumbnailTemplate:f,footerTemplate:g},b),i=L.Knreise.Control.sidebar("sidebar",h);return a.addControl(i),i},a.distanceAndBearing=function(a,b){return{distance:1e3*turf.distance(a,b,"kilometers"),bearing:turf.bearing(a,b)}};var f=_.template("<%= service %>/s/crop/<%= width %>x<%= height %>/<%= image %>");a.getImageCache=function(a,b,c){return KR.Config.ImageCaheUrl?f({service:KR.Config.ImageCaheUrl,width:b,height:c,image:a}):a},a.isInIframe=function(){try{return window.self!==window.top}catch(a){return!0}}}(KR.Util);var KR=this.KR||{};KR.Style={},function(a){"use strict";function b(a){var b=a.properties.vernef_id;return _.find(p,function(a){return-1!==a.ids.indexOf(b)})}function c(a){return u[a]||"blue"}function d(a,b,c,d){return _.isFunction(a[b])?d?a[b]():a[b](c):a[b]}function e(a,b,c){return c?d(a,"fillcolor",b,!0):d(a,"fillcolor",b)}function f(a,b){return a.bordercolor?d(a,"bordercolor",b):e(a,b)}function g(b){return a.groups[b]}function h(b){var c;return b.properties&&b.properties.groupId?g(b.properties.groupId):(b.properties&&b.properties.datasetId&&(c=a.getDatasetStyle(b.properties.datasetId)),c?c:_.extend({},s))}function i(a,b,c){return c=c||9,{radius:c,weight:1,opacity:1,color:a,fillColor:b,fillOpacity:.4}}function j(a,b,c){return L.circleMarker(a,i(b,c))}function k(a){return L.Knreise.icon({markerColor:a})}function l(a,b,c){var d="";return a.properties&&a.properties.title&&(d=a.properties.title),L.marker(b,{icon:c,title:d})}function m(a,b,c){if(a.properties&&a.properties.thumbnail){var d={"border-color":b,"background-image":"url("+a.properties.thumbnail+")"};c&&(d["border-width"]="3px");var e=KR.Util.getImageCache(a.properties.thumbnail,50,50),f='
';return new L.DivIcon({className:"leaflet-marker-circle",html:f,iconSize:[50,50],iconAnchor:[25,25]})}}function n(a,b,c){var d=_.filter(a,function(a){return a.feature.properties.thumbnail});if(d.length){var e;_.isArray(b)&&(e=_.rest(b),b=b[0]);var f=KR.Util.getImageCache(d[0].feature.properties.thumbnail,50,50),g={"border-color":b,"background-image":"url("+f+");"};e&&(g["box-shadow"]=_.map(e,function(a,b){var c=2*(b+1);return"0 0 0 "+c+"px "+a}).join(",")+";"),c&&(g["border-width"]="3px");var h='
'+a.length+"";return new L.DivIcon({className:"leaflet-marker-photo",html:h,iconSize:[60,60],iconAnchor:[30,30]})}}function o(a,b){var c=KR.Util.hexToRgba(b,.4);return new L.DivIcon({className:"leaflet-marker-circle",html:'
'+a.length+"",iconSize:[20,20],iconAnchor:[10,10]})}var p={landskapsvern:{ids:["LVO","LVOD","LVOP","LVOPD","BV","MAV","P","GVS","MIV","NM","BVV","PO","DO","D"],style:{fillColor:"#d8cb7a",color:"#9c8f1b"}},nasjonalpark:{ids:["NP","NPS"],style:{fillColor:"#7f9aac",color:"#b3a721"}},naturreservat:{ids:["NR","NRS"],style:{fillColor:"#ef9874",color:"#ef9873"}}},q="#72B026",r="#38A9DC",s={fillcolor:r,circle:!1,thumbnail:!0},t={difo:"Digitalt fortalt",Kulturminnesok:"Kulturminnesok",DiMu:"DigitaltMuseum",MUSIT:"Musit",Artsdatabanken:"Artsdatabanken",wikipedia:"wikipedia",riksantikvaren:"riksantikvaren"};a.datasets={"Digitalt fortalt":{fillcolor:"#F69730",circle:!1,thumbnail:!0},Kulturminnesok:{fillcolor:"#436978",circle:!1,thumbnail:!1},DigitaltMuseum:{fillcolor:"#436978",circle:!1,thumbnail:!1},Musit:{fillcolor:"#436978",circle:!1,thumbnail:!1},Artsdatabanken:{fillcolor:"#5B396B",thumbnail:!1,circle:!0},riksantikvaren:{fillcolor:"#436978",circle:!1,thumbnail:!0},verneomraader:{fillcolor:function(a){if(a){var c=b(a);if(c)return c.style.fillColor}return"#009300"},bordercolor:function(a){if(a){var c=b(a);if(c)return c.style.color}return"#009300"},thumbnail:!1,circle:!0},wikipedia:{fillcolor:"#D14020",thumbnail:!0}},a.groups={},a.getDatasetStyle=function(b){var c=a.datasets[t[b]];return c||(c=a.datasets[b]),c},a.setDatasetStyle=function(b,c){_.has(t,b)||(t[b]=b);var d=a.getDatasetStyle(b);d||(d=s),a.datasets[t[b]]=_.extend({},d,c)};var u={"#F69730":"orange","#38A9DC":"blue","#A23336":"darkred","#72B026":"green","#436978":"cadetblue","#5B396B":"darkpurple","#728224":"darkgreen","#D252B9":"purple","#D14020":"red"};a.getClusterIcon=function(a,b){var c,d=a.getAllChildMarkers(),f=_.uniq(_.map(d,function(a){return a.feature.properties.groupId})),i=h(d[0].feature);if(_.compact(f).length>1){var j=_.compact(f);j.length>1&&(c=_.map(j,_.compose(e,g)))}else c=e(i,d[0].feature);if(b&&(c=q),i.thumbnail){var k=n(d,c,b);if(k)return k}return o(d,c)},a.getIcon=function(a,b){var c=h(a),d=b?q:e(c,a),g=b?q:f(c,a);if(c.thumbnail){var j=m(a,g,b);if(j)return j}return c.circle?i(g,d,c.radius):k(d)},a.getMarker=function(b,c){var d=h(b);if(d.thumbnail){var g=m(b,f(d,b),!1);if(g)return l(b,c,g)}return d.circle?j(c,f(d,b),e(d,b)):l(b,c,a.getIcon(b,!1))},a.colorForFeature=function(a,b,d){var f=h(a);return f?b?e(f,a,d):c(e(f,a)):void 0},a.colorForDataset=function(b,d,f){var g,i;return b.grouped?(g=a.groups[KR.Util.stamp(b)],g||(i=b.datasets[0].extras.datasetId)):(i||(i=b.extras.datasetId),g=h({properties:{datasetId:i}})),g?d?e(g,null,f):c(e(g,null)):void 0},a.getPathStyle=function(a,b){b=b||!1;var c=h(a),d=e(c,a),g=f(c,a);return{weight:1,color:g,fillColor:d,clickable:b,opacity:.8,fillOpacity:.4}},a.getPathStyleForGroup=function(b,c){var d={properties:{groupId:b}};return a.getPathStyle(d,c)}}(KR.Style);var KR=this.KR||{};KR.PathTracer=function(a,b,c){"use strict";function d(b,c){Cesium.Math.setRandomNumberSeed(3),a.clock.startTime=b.clone(),a.clock.stopTime=c.clone(),a.clock.currentTime=b.clone(),a.clock.clockRange=Cesium.ClockRange.LOOP_STOP,a.clock.multiplier=l,a.clock.shouldAnimate=!1}function e(b,c,d){var e=a.entities.add({availability:new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({start:b,stop:c})]),position:d,orientation:new Cesium.VelocityOrientationProperty(d)});return e}function f(a,b,c){b=b.reverse(),c.geometry.coordinates=c.geometry.coordinates.reverse();var d=0,e=turf.point(c.geometry.coordinates[0]),f=new Cesium.SampledPositionProperty;return _.each(b,function(b,g){var h=turf.point(c.geometry.coordinates[g]);d+=1e3*turf.distance(e,h,"kilometers"),e=h;var i=Cesium.JulianDate.addSeconds(a,d/k,new Cesium.JulianDate),j=new Cesium.Cartesian3(b.x,b.y,b.z+2);f.addSample(i,j)}),f}function g(b){a.clock.onTick.addEventListener(function(c){if(m){var d=Cesium.Cartesian3,e=b.position.getValue(c.currentTime,new d),f=b.position.getValue(Cesium.JulianDate.addSeconds(c.currentTime,1/60,new Cesium.JulianDate),new d),g=d.subtract(f,e,new d);d.normalize(g,g);var h=new d,i=new d,j=new d;Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(e,h),d.cross({x:0,y:0,z:1},h,i),d.cross(h,i,j);var k=new d;k.x=d.dot(g,i),k.y=d.dot(g,j),k.z=d.dot(g,h);var l=new d(0,0,1),o=new d(1,0,0),p=new d(0,1,0),q=d.dot(k,o),r=d.dot(k,p),s=d.dot(k,l),t=Math.atan2(q,r),u=Math.asin(s);t+=0*Math.PI,u+=-20/180*Math.PI;var v=800,w=new Cesium.HeadingPitchRange(t,u+n,v);a.scene.camera.lookAt(b.position.getValue(c.currentTime),w)}})}function h(){var h=c.features[0],i=1e3*turf.lineDistance(h,"kilometers"),j=i/k,l=Cesium.JulianDate.fromDate(new Date(2015,2,25,16)),m=Cesium.JulianDate.addSeconds(l,j,new Cesium.JulianDate);d(l,m);var n=f(l,b,h),o=e(l,m,n);o.position.setInterpolationOptions({interpolationDegree:5,interpolationAlgorithm:Cesium.LagrangePolynomialApproximation}),a.trackedEntity=void 0,g(o)}function i(){m=!0,a.clock.shouldAnimate=!0}function j(){m=!1,a.clock.shouldAnimate=!1}var k=1.4,l=35,m=!1,n=0;return h(),{start:i,stop:j,isRunning:function(){return m},setPitchCorr:function(a){n=a}}};var KR=this.KR||{};KR.CesiumMap=function(a,b,c){"use strict";function d(a){return a=a||"//assets.agi.com/stk-terrain/world",new Cesium.CesiumTerrainProvider({url:a,requestVertexNormals:!0,requestWaterMask:!1})}function e(a){var b,c=s.scene.camera;c.moveEnd.addEventListener(function(){var d=Cesium.Ellipsoid.WGS84.cartesianToCartographic(c.position),e=!Cesium.Rectangle.contains(a,d);e&&b&&(c.position=b),b=c.position.clone()})}function f(){s=new Cesium.Viewer(a,t.cesiumViewerOpts);var b=s.scene;b.imageryLayers.removeAll();var f=b.globe;t.cesiumViewerOpts.enableLighting&&(f.enableLighting=!0),f.depthTestAgainstTerrain=!0,s.terrainProvider=d(t.cesiumViewerOpts.terrainUrl);var g,h=b.camera;if(c){c=KR.Util.splitBbox(c);var i=Cesium.Ellipsoid.WGS84;g=new Cesium.Rectangle(Cesium.Math.toRadians(c[0]),Cesium.Math.toRadians(c[1]),Cesium.Math.toRadians(c[2]),Cesium.Math.toRadians(c[3])),h.viewRectangle(g,i)}g&&t.cesiumViewerOpts.limitBounds&&e(g)}function g(a,b){var c=a.features[0].geometry.coordinates,d=_.map(c,function(a){return new Cesium.Cartographic.fromDegrees(a[0],a[1])}),e=Cesium.sampleTerrain(s.terrainProvider,14,d);Cesium.when(e,function(a){b(Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(a))})}function h(a){return _.map(a,function(a,b){return b+"="+a}).join("&")}function i(a){return new Cesium.UrlTemplateImageryProvider({url:a})}function j(a,b,c){var d={SERVICE:"WMTS",REQUEST:"GetTile",TILEROW:"{TileRow}",TILECOL:"{TileCol}",STYLE:"{Style}",LAYER:b};return{url:a+"?"+h(_.extend({},d,c||{})),layer:"",tileMatrixSetID:""}}function k(a,b,c){var d={style:"default",version:"1.0.0",format:"image/png",maximumLevel:19};return new Cesium.WebMapTileServiceImageryProvider(_.extend({},d,j(a,b,c)))}function l(a,b){return new Cesium.WebMapServiceImageryProvider({url:a,layers:b,parameters:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/png",transparent:!0}})}function m(a){return _.map(a,function(a){var b={position:Cesium.Cartesian3.fromDegrees(a.pos.lng,a.pos.lat,a.pos.height||80),billboard:{image:a.icon,show:!0,heightReference:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1},label:{text:a.text,font:"14pt monospace",style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,32)},properties:a.properties};return s.entities.add(b),b})}function n(a,b,c,d){c=c||14;var e=[];d||(d=0),_.each(a.features,function(a){var b=a.geometry.coordinates;e.push(new Cesium.Cartographic.fromDegrees(b[0],b[1]))});var f=Cesium.sampleTerrain(s.terrainProvider,c,e);Cesium.when(f,function(c){var e=c;_.each(a.features,function(a,b){var c=e[b];a.geometry.coordinates=[Cesium.Math.toDegrees(c.longitude),Cesium.Math.toDegrees(c.latitude),c.height+d]}),b(a)})}function o(a){var b=new Cesium.EntityCollection,c=new Cesium.ScreenSpaceEventHandler(s.scene.canvas);c.setInputAction(function(c){var d=s.scene.drillPick(c.position);if(Cesium.defined(d)){b.removeAll();var e=_.map(d,function(a){var c=a.id;return b.add(c),c.properties});e.length&&a(e)}},Cesium.ScreenSpaceEventType.LEFT_CLICK)}function p(a,b,c,d){c.getBbox(a,b,function(a){n(a,function(a){var b=Cesium.GeoJsonDataSource.load(a);d(b)})},function(a){d()})}function q(a,b,c,d){c.getBbox(a,b,function(a){_.each(a.features,function(a){a.properties=_.extend(a.properties,d)}),n(a,function(a){var b=_.map(a.features,function(a){var b=a.properties["marker-color"]||"blue";return{pos:{lat:a.geometry.coordinates[1],lng:a.geometry.coordinates[0],height:a.geometry.coordinates[2]},icon:"../common/img/markers/"+b+".png",properties:a.properties}});m(b)})},function(b){console.warn("could not load dataset",a)})}function r(){$(".spinner-wrapper").delay(2e3).fadeOut({duration:200})}Cesium.BingMapsApi.defaultKey="";var s,t={cesiumViewerOpts:_.extend({timeline:!1,baseLayerPicker:!1,geocoder:!1,enableLighting:!0,infoBox:!1,animation:!1,orderIndependentTranslucency:!1},b||{})};return f(),{viewer:s,addMarkers:m,build3DLine:g,addClickhandler:o,loadDataset:p,loadDataset2:q,stopLoading:r,getTiles:i,getWmts:k,getWms:l,addImageryProvider:function(a){s.imageryLayers.addImageryProvider(a)}}},KR.CesiumUtils={},KR.CesiumUtils.getBounds=function(a){"use strict";var b=turf.envelope(a),c=b.geometry.coordinates[0];return c[0].concat(c[2]).join(",")};var KR=this.KR||{};KR.CesiumSidebar=function(a,b,c,d){"use strict";function e(a){o.html(a)}function f(a){return{properties:a,template:a.template}}function g(a){p.showFeature(f(a))}function h(a){var b=_.map(a,f);p.showFeatures(b)}function i(b){a.show("slide",{direction:"left"},100),1===b.length?g(b[0]):h(b)}function j(){a.hide("slide",{direction:"left"},100),e(""),q&&q()}d=d||{footerTemplate:_.template($("#footer_template").html()),listElementTemplate:_.template($("#list_item_template").html()),markerTemplate:_.template($("#marker_template").html()),thumbnailTemplate:_.template($("#thumbnail_template").html())};var k=$('');a.append(k);var l=$('
');k.append(l);var m=$('×');l.append(m);var n=$("");l.append(n);var o=$('');k.append(o);var p=new KR.SidebarContent(k,o,n,d),q=c;return a.addClass("knreise-sidebar"),m.click(j),{show:i,addCloseCb:function(a){q=a}}};var KR=this.KR||{};!function(){"use strict";function a(){function a(a){if(d&&d.userPosition){var b=turf.point([d.userPosition.lng,d.userPosition.lat]),c=KR.Util.distanceAndBearing(b,a),e=c.distance;return e=1e3>e?KR.Util.round(e,0)+" Meter":KR.Util.round(e/1e3,2)+" Kilometer",{dist:e,rot:c.bearing-45}}}function b(){if(e&&d&&d.userPosition&&f){g&&g.remove();var b=e.find("h3").eq(0),c=a(f);g=$(h({distanceBearing:c})),b.length?b.after(g):e.prepend(g)}}function c(a,c){e=c,f=a,b()}var d,e,f,g,h=_.template($("#user_position_template").html());return{setMap:function(a){d=a,d.on("locationChange",b)},selectFeature:c}}KR.SidebarContent=function(b,c,d,e){function f(a){c.html(a)}function g(a){a&&c.swipe({swipe:function(){},allowPageScroll:"vertical"}).off("swipeLeft").on("swipeLeft",function(){a.next&&a.next()}).off("swipeRight").on("swipeRight",function(){a.prev&&a.prev()})}function h(a,b,c,d,f,g){var i;b>0&&(i=function(e){e&&e.preventDefault(),b-=1,a=f[b];var i=h(a,b,c,d,f,g);j(a,c,d,i,b,f.length)});var l;return b"),p+='',f(p),void i(a,function(b){b.properties=_.extend(a.properties,b.properties),j(b,h,null,k,n,o)})}h=h||a.template||KR.Util.templateForDataset(a.properties.dataset)||l;var q=a.properties.images;_.isArray(q)&&(q=q[0]),a.properties.images||(a.properties.images=null),a.properties.allProps&&a.properties.allProps.europeana_rights?a.properties.license=a.properties.allProps.europeana_rights[0]:a.properties.license=null;var r=a.properties.color||KR.Style.colorForFeature(a,!0,!0),p=''+a.properties.provider+"";if(p+=h(_.extend({image:null},a.properties)),e.footerTemplate&&a.properties.link&&(p+=e.footerTemplate(a.properties)),p=$(["
",p,"
"].join(" ")),KR.Util.isInIframe()&&p.find("a").attr("target","_blank"),m.selectFeature(a,p),f(p),g(k),b.find(".prev-next-arrows").remove(),d.html(""),k){var s=$('');d.append(s),s.click(k.close);var t=n+1;d.append($('
'+t+" av "+o+"
"));var u=$('');b.append(u),k.prev&&u.click(k.prev).addClass("active");var v=$('');b.append(v),k.next&&v.click(k.next).addClass("active")}var w=c.find(".media-container");w.length&&KR.MediaCarousel.SetupMediaCarousel(w),"undefined"!=typeof audiojs&&audiojs.createAll(),c.scrollTop(0)}function k(a,b,f,g,j){g=void 0===g?e.noListThreshold:g;var k=a.length<=g;if(k&&j!==!0){var l=a[0];c.html("");var m=h(l,0,b,f,a);return void this.showFeature(l,b,f,m,0,a.length)}var n=$(''+a.length+"");d.html(n);var o=_.chain(a).groupBy(function(a){return a.properties.provider}).map(function(c,d){var e=$("
"),g=$('
'),h=_.map(c,function(c){var d=_.findIndex(a,function(a){return a===c});return i(c,d,b,f,a)},this);return g.append(h),e.append('
'+d+"
"),e.append(g),e}).value();c.html(o),c.scrollTop(0)}var l=KR.Util.getDatasetTemplate("popup"),m=new a;return c=$(c),b=$(b),d=$(d),{showFeature:j,showFeatures:k,setMap:function(a){m.setMap(a)}}}}();var KR=this.KR||{};KR.DatasetLoader=function(a,b,c,d,e,f){"use strict";function g(a){var b=KR.Util.stamp(a);return function(c){return c&&c.features.length?(_.each(c.features,function(c){c.properties.datasetID=b,_.has(a,"circle")&&(c.properties.circle=a.circle),_.has(a,"provider")&&(c.properties.provider=a.provider),_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()b&&b>=f&&c("up"),b>=d&&f>b&&c("down")})},n=function(a){return _.find(b.getLayers(),function(b){return b.feature.properties.id===a})},o=function(a){return _.find(d.getLayers(),function(b){return b.feature.properties.lok===a})},p=function(a,b){var c=n(a.properties.lok);c&&c.fire("click")},q=function(a){return L.geoJson(null,{onEachFeature:function(b,c){a.extras&&a.extras.groupId?c.setStyle(KR.Style.getPathStyleForGroup(a.extras.groupId)):(b.properties.datasetId=a.id,c.setStyle(KR.Style.getPathStyle(b,!0))),c.on("click",function(){p(b,c)})}}).addTo(c)},r=function(){},s=function(){_.each(d.getLayers(),function(a){a.setStyle(KR.Style.getPathStyle(a.feature,!0))})},t=function(a){s();var b=a.layer.feature.properties.id,c=o(b);c&&(c.setStyle({weight:1,color:"#436978",fillColor:"#72B026",clickable:!0,opacity:.8,fillOpacity:.4}),e&&e(a.layer.feature))},u=function(a,b){c.sidebar&&c.sidebar.showFeature(a,b.enkeltminner.template||KR.Util.getDatasetTemplate("ra_enkeltminne"))},v=function(b){_.has(b,"enkeltminner")||(b.enkeltminner={});var d=b.enkeltminner.style||{color:"#fff",weight:1,fillColor:"#B942D0"};f=L.geoJson(null,{onEachFeature:function(a,c){a.properties.provider=b.enkeltminner.provider||"Enkeltminne",a.properties.color=b.enkeltminner.sidebarColor||"#B942D0",c.on("click",function(){u(a,b)})},style:function(){return d}}).addTo(c),e=function(b){var c={api:"kulturminnedataSparql",type:"enkeltminner",lokalitet:b.properties.id};a.getData(c,function(a){f.clearLayers(),f.addData(a)})}},w=function(a,e,f){b=f,c=a,b.on("hide",j),b.on("show",k),d=q(e),m(c,13,l),c.on("zoomend",r),c.on("layerDeselect",s),b.on("click",t),_.has(e,"showEnkeltminner")&&(i=e.showEnkeltminner),i&&v(e)},x=function(a){d.addData(a);var b=_.chain(a.features).map(function(a){return a.properties.lok}).uniq().value();h&&_.each(b,function(a){n(a)}),g=g.concat(b)},y=function(b,c,d){if(d){var e=_.chain(d).map(function(a){return a.properties.id}).filter(function(a){return-1===g.indexOf(a)}).value();if(e.length){var f={api:"kulturminnedataSparql",type:"lokalitetpoly",lokalitet:e};a.getData(f,x)}}};return{loadKulturminnePoly:y,initKulturminnePoly:w}}}(KR.Config);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getDatasetList=function(b,c,d){var e=a.getKulturminneFunctions(b);c&&3===c.length&&(c="0"+c);var f={difo:{name:"Digitalt fortalt",dataset:{dataset:"difo",api:"norvegiana"},cluster:!0,template:KR.Util.getDatasetTemplate("digitalt_fortalt"),noListThreshold:1/0,description:"Kulturrådets tjeneste for personlige fortellinger fra kulturinstitusjoner og privatpersoner.",allowTopic:!0,feedbackForm:!0,isStatic:!1},verneomr:{id:"verneomraader",dataset:{api:"cartodb",table:"naturvernomrader_utm33_2",columns:["iid","omradenavn","vernef_id","verneform"]},provider:"Naturbase",name:"Verneområder",template:KR.Util.getDatasetTemplate("verneomraader"),getFeatureData:function(a,c){b.getItem({api:"norvegiana",id:"kulturnett_Naturbase_"+a.properties.iid +var KR=this.KR||{};!function(a){"use strict";a.parseError=function(a){if(a.responseJSON){if(a.responseJSON.error)return a.responseJSON.error.join(", ");if(a.responseJSON.status)return a.responseJSON.status}return a.statusText?a.statusText:a.error?a.error.info?a.error.info:a.error.error?a.error.error:a.error:"Unknown error"},a.errorHandler=function(b){var c=$(b);c.find(".close").on("click",function(){c.find(".content").html(""),c.remove()});var d=_.template("
<%= dataset %>: <%= error %>
");return function(b){var e=d({dataset:b.dataset,error:a.parseError(b.error)});c.parent()?c.find(".content").append(e):c.find(".content").html(e),$("body").append(c)}}}(KR);var KR=this.KR||{};KR.Config={contentIcons:{IMAGE:"camera-retro",VIDEO:"file-video-o",SOUND:"music",TEXT:"file-text","default":"file-o"},templates:{}},KR.Config.ImageCaheUrl="http://egbtmre.cloudimg.io",KR.Util=KR.Util||{},function(a){"use strict";function b(a,b){var c=a.lastIndexOf(b);return-1!==c&&c+b.length===a.length}function c(a){return 1e3>a?"0"+a:a}a.iconForContentType=function(a){var b=a.properties.contentType;return _.has(KR.Config.contentIcons,b)?KR.Config.contentIcons[b]:KR.Config.contentIcons["default"]},a.getDatasetTemplate=function(a){var b=$("#"+a+"_template").html();return b?_.template(b):void 0},a.templateForDataset=function(a){return _.has(KR.Config.templates,a)?KR.Config.templates[a]:void 0},a.createStyleString=function(a){return _.map(a,function(a,b){return b+": "+a}).join(";")},a.colorForProvider=function(a,b){var c=!0;"hex"!==b&&(c=!1);var d={properties:{datasetId:a}};return KR.Style.colorForFeature(d,c,!0)},a.featureClick=function(a){return function(b,c,d){c.on("click",function(c){d&&d.toPoint&&d.toPoint.stopPolyClick&&!c.parent||(d?a.showFeature(b,d.template,d.getFeatureData):a.showFeature(b))})}},a.getTemplateForFeature=function(a,b){if(b){if(b.datasets){var c=_.find(b.datasets,function(b){return b._knreise_id===a.properties.datasetID});return c.template}return b.template}},a.clusterClick=function(b){return function(c,d){c.on("clusterclick",function(c){var e=_.map(c.layer.getAllChildMarkers(),function(b){var c=b.feature;return d&&!c.template&&(c.template=a.getTemplateForFeature(c,d)),c}),f=_.extend({},{template:null,getFeatureData:null,noListThreshold:null},d);b.showFeatures(e,f.template,f.getFeatureData,f.noListThreshold)})}},a.hexToRgba=function(a,b){b=b||1;var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(!c)return 0;var d={r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)};return"rgba("+d.r+","+d.g+","+d.b+","+b+")"},a.filterByBbox=function(a,b){var c=turf.featurecollection([turf.bboxPolygon(KR.Util.splitBbox(b))]);return turf.within(a,c)},a.getDatasetId=function(a){return"norvegiana"===a.dataset.api?a.dataset.dataset:"wikipedia"===a.dataset.api?"wikipedia":a.id?a.id:KR.Util.stamp(a)},"undefined"!=typeof L&&(L.latLngBounds.fromBBoxArray=function(a){return new L.LatLngBounds(new L.LatLng(a[1],a[0]),new L.LatLng(a[3],a[2]))},L.latLngBounds.fromBBoxString=function(a){return L.latLngBounds.fromBBoxArray(KR.Util.splitBbox(a))},L.rectangle.fromBounds=function(a){return L.rectangle([a.getSouthWest(),a.getNorthEast()])}),a.parseQueryString=function(a){var b=decodeURIComponent(a);if(""!==b)return _.reduce(b.replace("?","").split("&"),function(a,b){b=b.split("=");var c=b[1];return"true"===c?c=!0:"false"===c&&(c=!1),a[b[0]]=c,a},{})};var d=_.template("<%= totalt %> (<%= menn %> menn, <%= kvinner %> kvinner)");a.formatPersons=function(a){var b=a.split("-");return b.length<2?a:d({totalt:b[0],menn:b[1],kvinner:b[2]})},a.getBaseLayer=function(a,b){var c={nib:KR.getNibLayer,hist:function(a){a(L.tileLayer.wms("http://wms.geonorge.no/skwms1/wms.historiskekart",{layers:"historiskekart",format:"image/png",attribution:"Kartverket"}))}};if(_.has(c,a))c[a](b);else{var d=navigator.userAgent.indexOf("Safari")>-1,e=!d;b(L.tileLayer.kartverket(a,{useCache:e}))}},a.getLine=function(a,c,d){if(_.isFunction(c))return void c(function(a){d(a)});var e;if(0===c.indexOf("utno/")){var f=c.replace("utno/","");e={api:"utno",id:f,type:"gpx"}}else 0===c.indexOf("http")&&(b(c,"kml")?e={api:"kml",url:c}:b(c,"gpx")||-1!==c.indexOf("http://ut.no/tur/")?e={api:"gpx",url:c}:b(c,"geojson")&&(e={api:"geojson",url:c}));e?a.getData(e,function(a){d(a)}):alert("Kunne ikke laste linjegeometri")},a.messageDisplayer=function(a){return function(b,c){var d=$(a);d.find(".close").on("click",function(){d.find(".content").html(""),d.remove()}),d.addClass("alert-"+b),d.find(".content").html(c),$("body").append(d)}},a.mostlyCoveringMunicipality=function(a,b,c){var d="ST_MakeEnvelope("+b+", 4326)",e="SELECT komm FROM kommuner WHERE ST_Intersects(the_geom, "+d+")ORDER BY st_area(st_intersection(the_geom, "+d+")) DESC LIMIT 1",f={api:"cartodb",query:e,mapper:function(a){return a.rows[0].komm}};a.getData(f,c)},a.sparqlBbox=function(a,b,d,e,f){KR.Util.mostlyCoveringMunicipality(a,d,function(d){b.kommune=c(d),a.getData(b,e,f)})},a.distanceAndSort=function(a,b){var c=_.map(a.features,function(a){return a.properties.distance=turf.distance(b,a),a});return turf.featurecollection(c.sort(function(a,b){return a.properties.distanceb.properties.distance?1:0}))},a.round=function(a,b){_.isUndefined(b)&&(b=2);var c=Math.pow(10,b);return Math.round(a*c)/c};var e=_.template("#<%= zoom %>/<%= lat %>/<%= lon %>");a.getPositionHash=function(b,c,d){return e({zoom:d,lat:a.round(b,4),lon:a.round(c,4)})},a.WORLD={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}},a.createMap=function(b,c){c=c||{};var d=L.map(b,{minZoom:c.minZoom||3,maxZoom:c.maxZoom||18,maxBounds:L.geoJson(a.WORLD).getBounds()}),e=c.layer||"norges_grunnkart_graatone";return _.isString(e)?KR.Util.getBaseLayer(e,function(a){a.addTo(d)}):e.addTo(d),d},a.setupSidebar=function(a,b){b=b||{};var c=KR.Util.getDatasetTemplate("popup"),d=_.template($("#list_item_template").html()),e=_.template($("#marker_template").html()),f=_.template($("#thumbnail_template").html()),g=_.template($("#footer_template").html()),h=_.extend({},{position:"left",template:c,listElementTemplate:d,markerTemplate:e,thumbnailTemplate:f,footerTemplate:g},b),i=L.Knreise.Control.sidebar("sidebar",h);return a.addControl(i),i},a.distanceAndBearing=function(a,b){return{distance:1e3*turf.distance(a,b,"kilometers"),bearing:turf.bearing(a,b)}};var f=_.template("<%= service %>/s/crop/<%= width %>x<%= height %>/<%= image %>");a.getImageCache=function(a,b,c){return KR.Config.ImageCaheUrl?f({service:KR.Config.ImageCaheUrl,width:b,height:c,image:a}):a},a.isInIframe=function(){try{return window.self!==window.top}catch(a){return!0}}}(KR.Util);var KR=this.KR||{};KR.Style={},function(a){"use strict";function b(a){var b=a.properties.vernef_id;return _.find(p,function(a){return-1!==a.ids.indexOf(b)})}function c(a){return u[a]||"blue"}function d(a,b,c,d){return _.isFunction(a[b])?d?a[b]():a[b](c):a[b]}function e(a,b,c){return c?d(a,"fillcolor",b,!0):d(a,"fillcolor",b)}function f(a,b){return a.bordercolor?d(a,"bordercolor",b):e(a,b)}function g(b){return a.groups[b]}function h(b){var c;return b.properties&&b.properties.groupId?g(b.properties.groupId):(b.properties&&b.properties.datasetId&&(c=a.getDatasetStyle(b.properties.datasetId)),c?c:_.extend({},s))}function i(a,b,c){return c=c||9,{radius:c,weight:1,opacity:1,color:a,fillColor:b,fillOpacity:.4}}function j(a,b,c){return L.circleMarker(a,i(b,c))}function k(a){return L.Knreise.icon({markerColor:a})}function l(a,b,c){var d="";return a.properties&&a.properties.title&&(d=a.properties.title),L.marker(b,{icon:c,title:d})}function m(a,b,c){if(a.properties&&a.properties.thumbnail){var d={"border-color":b,"background-image":"url("+a.properties.thumbnail+")"};c&&(d["border-width"]="3px");var e=KR.Util.getImageCache(a.properties.thumbnail,50,50),f='
';return new L.DivIcon({className:"leaflet-marker-circle",html:f,iconSize:[50,50],iconAnchor:[25,25]})}}function n(a,b,c){var d=_.filter(a,function(a){return a.feature.properties.thumbnail});if(d.length){var e;_.isArray(b)&&(e=_.rest(b),b=b[0]);var f=KR.Util.getImageCache(d[0].feature.properties.thumbnail,50,50),g={"border-color":b,"background-image":"url("+f+");"};e&&(g["box-shadow"]=_.map(e,function(a,b){var c=2*(b+1);return"0 0 0 "+c+"px "+a}).join(",")+";"),c&&(g["border-width"]="3px");var h='
'+a.length+"";return new L.DivIcon({className:"leaflet-marker-photo",html:h,iconSize:[60,60],iconAnchor:[30,30]})}}function o(a,b){var c=KR.Util.hexToRgba(b,.4);return new L.DivIcon({className:"leaflet-marker-circle",html:'
'+a.length+"",iconSize:[20,20],iconAnchor:[10,10]})}var p={landskapsvern:{ids:["LVO","LVOD","LVOP","LVOPD","BV","MAV","P","GVS","MIV","NM","BVV","PO","DO","D"],style:{fillColor:"#d8cb7a",color:"#9c8f1b"}},nasjonalpark:{ids:["NP","NPS"],style:{fillColor:"#7f9aac",color:"#b3a721"}},naturreservat:{ids:["NR","NRS"],style:{fillColor:"#ef9874",color:"#ef9873"}}},q="#72B026",r="#38A9DC",s={fillcolor:r,circle:!1,thumbnail:!0},t={difo:"Digitalt fortalt",Kulturminnesok:"Kulturminnesok",DiMu:"DigitaltMuseum",MUSIT:"Musit",Artsdatabanken:"Artsdatabanken",wikipedia:"wikipedia",riksantikvaren:"riksantikvaren"};a.datasets={"Digitalt fortalt":{fillcolor:"#F69730",circle:!1,thumbnail:!0},Kulturminnesok:{fillcolor:"#436978",circle:!1,thumbnail:!1},DigitaltMuseum:{fillcolor:"#436978",circle:!1,thumbnail:!1},Musit:{fillcolor:"#436978",circle:!1,thumbnail:!1},Artsdatabanken:{fillcolor:"#5B396B",thumbnail:!1,circle:!0},riksantikvaren:{fillcolor:"#436978",circle:!1,thumbnail:!0},verneomraader:{fillcolor:function(a){if(a){var c=b(a);if(c)return c.style.fillColor}return"#009300"},bordercolor:function(a){if(a){var c=b(a);if(c)return c.style.color}return"#009300"},thumbnail:!1,circle:!0},wikipedia:{fillcolor:"#D14020",thumbnail:!0}},a.groups={},a.getDatasetStyle=function(b){var c=a.datasets[t[b]];return c||(c=a.datasets[b]),c},a.setDatasetStyle=function(b,c){_.has(t,b)||(t[b]=b);var d=a.getDatasetStyle(b);d||(d=s),a.datasets[t[b]]=_.extend({},d,c)};var u={"#F69730":"orange","#38A9DC":"blue","#A23336":"darkred","#72B026":"green","#436978":"cadetblue","#5B396B":"darkpurple","#728224":"darkgreen","#D252B9":"purple","#D14020":"red"};a.getClusterIcon=function(a,b){var c,d=a.getAllChildMarkers(),f=_.uniq(_.map(d,function(a){return a.feature.properties.groupId})),i=h(d[0].feature);if(_.compact(f).length>1){var j=_.compact(f);j.length>1&&(c=_.map(j,_.compose(e,g)))}else c=e(i,d[0].feature);if(b&&(c=q),i.thumbnail){var k=n(d,c,b);if(k)return k}return o(d,c)},a.getIcon=function(a,b){var c=h(a),d=b?q:e(c,a),g=b?q:f(c,a);if(c.thumbnail){var j=m(a,g,b);if(j)return j}return c.circle?i(g,d,c.radius):k(d)},a.getMarker=function(b,c){var d=h(b);if(d.thumbnail){var g=m(b,f(d,b),!1);if(g)return l(b,c,g)}return d.circle?j(c,f(d,b),e(d,b)):l(b,c,a.getIcon(b,!1))},a.colorForFeature=function(a,b,d){var f=h(a);return f?b?e(f,a,d):c(e(f,a)):void 0},a.colorForDataset=function(b,d,f){var g,i;return b.grouped?(g=a.groups[KR.Util.stamp(b)],g||(i=b.datasets[0].extras.datasetId)):(i||(i=b.extras.datasetId),g=h({properties:{datasetId:i}})),g?d?e(g,null,f):c(e(g,null)):void 0},a.getPathStyle=function(a,b){b=b||!1;var c=h(a),d=e(c,a),g=f(c,a);return{weight:1,color:g,fillColor:d,clickable:b,opacity:.8,fillOpacity:.4}},a.getPathStyleForGroup=function(b,c){var d={properties:{groupId:b}};return a.getPathStyle(d,c)}}(KR.Style);var KR=this.KR||{};KR.PathTracer=function(a,b,c){"use strict";function d(b,c){Cesium.Math.setRandomNumberSeed(3),a.clock.startTime=b.clone(),a.clock.stopTime=c.clone(),a.clock.currentTime=b.clone(),a.clock.clockRange=Cesium.ClockRange.LOOP_STOP,a.clock.multiplier=l,a.clock.shouldAnimate=!1}function e(b,c,d){var e=a.entities.add({availability:new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({start:b,stop:c})]),position:d,orientation:new Cesium.VelocityOrientationProperty(d)});return e}function f(a,b,c){b=b.reverse(),c.geometry.coordinates=c.geometry.coordinates.reverse();var d=0,e=turf.point(c.geometry.coordinates[0]),f=new Cesium.SampledPositionProperty;return _.each(b,function(b,g){var h=turf.point(c.geometry.coordinates[g]);d+=1e3*turf.distance(e,h,"kilometers"),e=h;var i=Cesium.JulianDate.addSeconds(a,d/k,new Cesium.JulianDate),j=new Cesium.Cartesian3(b.x,b.y,b.z+2);f.addSample(i,j)}),f}function g(b){a.clock.onTick.addEventListener(function(c){if(m){var d=Cesium.Cartesian3,e=b.position.getValue(c.currentTime,new d),f=b.position.getValue(Cesium.JulianDate.addSeconds(c.currentTime,1/60,new Cesium.JulianDate),new d),g=d.subtract(f,e,new d);d.normalize(g,g);var h=new d,i=new d,j=new d;Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(e,h),d.cross({x:0,y:0,z:1},h,i),d.cross(h,i,j);var k=new d;k.x=d.dot(g,i),k.y=d.dot(g,j),k.z=d.dot(g,h);var l=new d(0,0,1),o=new d(1,0,0),p=new d(0,1,0),q=d.dot(k,o),r=d.dot(k,p),s=d.dot(k,l),t=Math.atan2(q,r),u=Math.asin(s);t+=0*Math.PI,u+=-20/180*Math.PI;var v=800,w=new Cesium.HeadingPitchRange(t,u+n,v);a.scene.camera.lookAt(b.position.getValue(c.currentTime),w)}})}function h(){var h=c.features[0],i=1e3*turf.lineDistance(h,"kilometers"),j=i/k,l=Cesium.JulianDate.fromDate(new Date(2015,2,25,16)),m=Cesium.JulianDate.addSeconds(l,j,new Cesium.JulianDate);d(l,m);var n=f(l,b,h),o=e(l,m,n);o.position.setInterpolationOptions({interpolationDegree:5,interpolationAlgorithm:Cesium.LagrangePolynomialApproximation}),a.trackedEntity=void 0,g(o)}function i(){m=!0,a.clock.shouldAnimate=!0}function j(){m=!1,a.clock.shouldAnimate=!1}var k=1.4,l=35,m=!1,n=0;return h(),{start:i,stop:j,isRunning:function(){return m},setPitchCorr:function(a){n=a}}};var KR=this.KR||{};KR.CesiumMap=function(a,b,c){"use strict";function d(a){return a=a||"//assets.agi.com/stk-terrain/world",new Cesium.CesiumTerrainProvider({url:a,requestVertexNormals:!0,requestWaterMask:!1})}function e(a){var b,c=s.scene.camera;c.moveEnd.addEventListener(function(){var d=Cesium.Ellipsoid.WGS84.cartesianToCartographic(c.position),e=!Cesium.Rectangle.contains(a,d);e&&b&&(c.position=b),b=c.position.clone()})}function f(){s=new Cesium.Viewer(a,t.cesiumViewerOpts);var b=s.scene;b.imageryLayers.removeAll();var f=b.globe;t.cesiumViewerOpts.enableLighting&&(f.enableLighting=!0),f.depthTestAgainstTerrain=!0,s.terrainProvider=d(t.cesiumViewerOpts.terrainUrl);var g,h=b.camera;if(c){c=KR.Util.splitBbox(c);var i=Cesium.Ellipsoid.WGS84;g=new Cesium.Rectangle(Cesium.Math.toRadians(c[0]),Cesium.Math.toRadians(c[1]),Cesium.Math.toRadians(c[2]),Cesium.Math.toRadians(c[3])),h.viewRectangle(g,i)}g&&t.cesiumViewerOpts.limitBounds&&e(g)}function g(a,b){var c=a.features[0].geometry.coordinates,d=_.map(c,function(a){return new Cesium.Cartographic.fromDegrees(a[0],a[1])}),e=Cesium.sampleTerrain(s.terrainProvider,14,d);Cesium.when(e,function(a){b(Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(a))})}function h(a){return _.map(a,function(a,b){return b+"="+a}).join("&")}function i(a){return new Cesium.UrlTemplateImageryProvider({url:a})}function j(a,b,c){var d={SERVICE:"WMTS",REQUEST:"GetTile",TILEROW:"{TileRow}",TILECOL:"{TileCol}",STYLE:"{Style}",LAYER:b};return{url:a+"?"+h(_.extend({},d,c||{})),layer:"",tileMatrixSetID:""}}function k(a,b,c){var d={style:"default",version:"1.0.0",format:"image/png",maximumLevel:19};return new Cesium.WebMapTileServiceImageryProvider(_.extend({},d,j(a,b,c)))}function l(a,b){return new Cesium.WebMapServiceImageryProvider({url:a,layers:b,parameters:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/png",transparent:!0}})}function m(a){return _.map(a,function(a){var b={position:Cesium.Cartesian3.fromDegrees(a.pos.lng,a.pos.lat,a.pos.height||80),billboard:{image:a.icon,show:!0,heightReference:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1},label:{text:a.text,font:"14pt monospace",style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,32)},properties:a.properties};return s.entities.add(b),b})}function n(a,b,c,d){c=c||14;var e=[];d||(d=0),_.each(a.features,function(a){var b=a.geometry.coordinates;e.push(new Cesium.Cartographic.fromDegrees(b[0],b[1]))});var f=Cesium.sampleTerrain(s.terrainProvider,c,e);Cesium.when(f,function(c){var e=c;_.each(a.features,function(a,b){var c=e[b];a.geometry.coordinates=[Cesium.Math.toDegrees(c.longitude),Cesium.Math.toDegrees(c.latitude),c.height+d]}),b(a)})}function o(a){var b=new Cesium.EntityCollection,c=new Cesium.ScreenSpaceEventHandler(s.scene.canvas);c.setInputAction(function(c){var d=s.scene.drillPick(c.position);if(Cesium.defined(d)){b.removeAll();var e=_.map(d,function(a){var c=a.id;return b.add(c),c.properties});e.length&&a(e)}},Cesium.ScreenSpaceEventType.LEFT_CLICK)}function p(a,b,c,d){c.getBbox(a,b,function(a){n(a,function(a){var b=Cesium.GeoJsonDataSource.load(a);d(b)})},function(a){d()})}function q(a,b,c,d){c.getBbox(a,b,function(a){_.each(a.features,function(a){a.properties=_.extend(a.properties,d)}),n(a,function(a){var b=_.map(a.features,function(a){var b=a.properties["marker-color"]||"blue";return{pos:{lat:a.geometry.coordinates[1],lng:a.geometry.coordinates[0],height:a.geometry.coordinates[2]},icon:"../common/img/markers/"+b+".png",properties:a.properties}});m(b)})},function(b){console.warn("could not load dataset",a)})}function r(){$(".spinner-wrapper").delay(2e3).fadeOut({duration:200})}Cesium.BingMapsApi.defaultKey="";var s,t={cesiumViewerOpts:_.extend({timeline:!1,baseLayerPicker:!1,geocoder:!1,enableLighting:!0,infoBox:!1,animation:!1,orderIndependentTranslucency:!1},b||{})};return f(),{viewer:s,addMarkers:m,build3DLine:g,addClickhandler:o,loadDataset:p,loadDataset2:q,stopLoading:r,getTiles:i,getWmts:k,getWms:l,addImageryProvider:function(a){s.imageryLayers.addImageryProvider(a)}}},KR.CesiumUtils={},KR.CesiumUtils.getBounds=function(a){"use strict";var b=turf.envelope(a),c=b.geometry.coordinates[0];return c[0].concat(c[2]).join(",")};var KR=this.KR||{};KR.CesiumSidebar=function(a,b,c,d){"use strict";function e(a){o.html(a)}function f(a){return{properties:a,template:a.template}}function g(a){p.showFeature(f(a))}function h(a){var b=_.map(a,f);p.showFeatures(b)}function i(b){a.show("slide",{direction:"left"},100),1===b.length?g(b[0]):h(b)}function j(){a.hide("slide",{direction:"left"},100),e(""),q&&q()}d=d||{footerTemplate:_.template($("#footer_template").html()),listElementTemplate:_.template($("#list_item_template").html()),markerTemplate:_.template($("#marker_template").html()),thumbnailTemplate:_.template($("#thumbnail_template").html())};var k=$('');a.append(k);var l=$('
');k.append(l);var m=$('×');l.append(m);var n=$("");l.append(n);var o=$('');k.append(o);var p=new KR.SidebarContent(k,o,n,d),q=c;return a.addClass("knreise-sidebar"),m.click(j),{show:i,addCloseCb:function(a){q=a}}};var KR=this.KR||{};!function(){"use strict";function a(){function a(a){if(d&&d.userPosition){var b=turf.point([d.userPosition.lng,d.userPosition.lat]),c=KR.Util.distanceAndBearing(b,a),e=c.distance;return e=1e3>e?KR.Util.round(e,0)+" Meter":KR.Util.round(e/1e3,2)+" Kilometer",{dist:e,rot:c.bearing-45}}}function b(){if(e&&d&&d.userPosition&&f){g&&g.remove();var b=e.find("h3").eq(0),c=a(f);g=$(h({distanceBearing:c})),b.length?b.after(g):e.prepend(g)}}function c(a,c){e=c,f=a,b()}var d,e,f,g,h=_.template($("#user_position_template").html());return{setMap:function(a){d=a,d.on("locationChange",b)},selectFeature:c}}KR.SidebarContent=function(b,c,d,e){function f(a){c.html(a)}function g(a){a&&c.swipe({swipe:function(){},allowPageScroll:"vertical"}).off("swipeLeft").on("swipeLeft",function(){a.next&&a.next()}).off("swipeRight").on("swipeRight",function(){a.prev&&a.prev()})}function h(a,b,c,d,f,g){var i;b>0&&(i=function(e){e&&e.preventDefault(),b-=1,a=f[b];var i=h(a,b,c,d,f,g);j(a,c,d,i,b,f.length)});var l;return b"),p+='',f(p),void i(a,function(b){b.properties=_.extend(a.properties,b.properties),j(b,h,null,k,n,o)})}h=h||a.template||KR.Util.templateForDataset(a.properties.dataset)||l;var q=a.properties.images;_.isArray(q)&&(q=q[0]),a.properties.images||(a.properties.images=null),a.properties.allProps&&a.properties.allProps.europeana_rights?a.properties.license=a.properties.allProps.europeana_rights[0]:a.properties.license=a.properties.license;var r=a.properties.color||KR.Style.colorForFeature(a,!0,!0),p=''+a.properties.provider+"";if(p+=h(_.extend({image:null},a.properties)),e.footerTemplate&&a.properties.link&&(p+=e.footerTemplate(a.properties)),p=$(["
",p,"
"].join(" ")),KR.Util.isInIframe()&&p.find("a").attr("target","_blank"),m.selectFeature(a,p),f(p),g(k),b.find(".prev-next-arrows").remove(),d.html(""),k){var s=$('');d.append(s),s.click(k.close);var t=n+1;d.append($('
'+t+" av "+o+"
"));var u=$('');b.append(u),k.prev&&u.click(k.prev).addClass("active");var v=$('');b.append(v),k.next&&v.click(k.next).addClass("active")}var w=c.find(".media-container");w.length&&KR.MediaCarousel.SetupMediaCarousel(w),"undefined"!=typeof audiojs&&audiojs.createAll(),c.scrollTop(0)}function k(a,b,f,g,j){g=void 0===g?e.noListThreshold:g;var k=a.length<=g;if(k&&j!==!0){var l=a[0];c.html("");var m=h(l,0,b,f,a);return void this.showFeature(l,b,f,m,0,a.length)}var n=$(''+a.length+"");d.html(n);var o=_.chain(a).groupBy(function(a){return a.properties.provider}).map(function(c,d){var e=$("
"),g=$('
'),h=_.map(c,function(c){var d=_.findIndex(a,function(a){return a===c});return i(c,d,b,f,a)},this);return g.append(h),e.append('
'+d+"
"),e.append(g),e}).value();c.html(o),c.scrollTop(0)}var l=KR.Util.getDatasetTemplate("popup"),m=new a;return c=$(c),b=$(b),d=$(d),{showFeature:j,showFeatures:k,setMap:function(a){m.setMap(a)}}}}();var KR=this.KR||{};KR.DatasetLoader=function(a,b,c,d,e,f){"use strict";function g(a){var b=KR.Util.stamp(a);return function(c){return c&&c.features.length?(_.each(c.features,function(c){c.properties.datasetID=b,_.has(a,"circle")&&(c.properties.circle=a.circle),_.has(a,"provider")&&(c.properties.provider=a.provider),_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()b&&b>=f&&c("up"),b>=d&&f>b&&c("down")})},n=function(a){return _.find(b.getLayers(),function(b){return b.feature.properties.id===a})},o=function(a){return _.find(d.getLayers(),function(b){return b.feature.properties.lok===a})},p=function(a,b){var c=n(a.properties.lok);c&&c.fire("click")},q=function(a){return L.geoJson(null,{onEachFeature:function(b,c){a.extras&&a.extras.groupId?c.setStyle(KR.Style.getPathStyleForGroup(a.extras.groupId)):(b.properties.datasetId=a.id,c.setStyle(KR.Style.getPathStyle(b,!0))),c.on("click",function(){p(b,c)})}}).addTo(c)},r=function(){},s=function(){_.each(d.getLayers(),function(a){a.setStyle(KR.Style.getPathStyle(a.feature,!0))})},t=function(a){s();var b=a.layer.feature.properties.id,c=o(b);c&&(c.setStyle({weight:1,color:"#436978",fillColor:"#72B026",clickable:!0,opacity:.8,fillOpacity:.4}),e&&e(a.layer.feature))},u=function(a,b){c.sidebar&&c.sidebar.showFeature(a,b.enkeltminner.template||KR.Util.getDatasetTemplate("ra_enkeltminne"))},v=function(b){_.has(b,"enkeltminner")||(b.enkeltminner={});var d=b.enkeltminner.style||{color:"#fff",weight:1,fillColor:"#B942D0"};f=L.geoJson(null,{onEachFeature:function(a,c){a.properties.provider=b.enkeltminner.provider||"Enkeltminne",a.properties.color=b.enkeltminner.sidebarColor||"#B942D0",c.on("click",function(){u(a,b)})},style:function(){return d}}).addTo(c),e=function(b){var c={api:"kulturminnedataSparql",type:"enkeltminner",lokalitet:b.properties.id};a.getData(c,function(a){f.clearLayers(),f.addData(a)})}},w=function(a,e,f){b=f,c=a,b.on("hide",j),b.on("show",k),d=q(e),m(c,13,l),c.on("zoomend",r),c.on("layerDeselect",s),b.on("click",t),_.has(e,"showEnkeltminner")&&(i=e.showEnkeltminner),i&&v(e)},x=function(a){d.addData(a);var b=_.chain(a.features).map(function(a){return a.properties.lok}).uniq().value();h&&_.each(b,function(a){n(a)}),g=g.concat(b)},y=function(b,c,d){if(d){var e=_.chain(d).map(function(a){return a.properties.id}).filter(function(a){return-1===g.indexOf(a)}).value();if(e.length){var f={api:"kulturminnedataSparql",type:"lokalitetpoly",lokalitet:e};a.getData(f,x)}}};return{loadKulturminnePoly:y,initKulturminnePoly:w}}}(KR.Config);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getDatasetList=function(b,c,d){var e=a.getKulturminneFunctions(b);c&&3===c.length&&(c="0"+c);var f={difo:{name:"Digitalt fortalt",dataset:{dataset:"difo",api:"norvegiana"},cluster:!0,template:KR.Util.getDatasetTemplate("digitalt_fortalt"),noListThreshold:1/0,description:"Kulturrådets tjeneste for personlige fortellinger fra kulturinstitusjoner og privatpersoner.",allowTopic:!0,feedbackForm:!0,isStatic:!1},verneomr:{id:"verneomraader",dataset:{api:"cartodb",table:"naturvernomrader_utm33_2",columns:["iid","omradenavn","vernef_id","verneform"]},provider:"Naturbase",name:"Verneområder",template:KR.Util.getDatasetTemplate("verneomraader"),getFeatureData:function(a,c){b.getItem({api:"norvegiana",id:"kulturnett_Naturbase_"+a.properties.iid },c)},toPoint:{showAlways:!0,stopPolyClick:!0,minSize:20},minZoom:10,cluster:!1,description:"Nasjonalparker og andre naturvernområder - ca. 2700 i hele landet."},artobs:{name:"Artsobservasjoner",hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"Artsdatabanken"},cluster:!1,description:"Artsobservasjoner fra Artsdatabanken",template:KR.Util.getDatasetTemplate("popup")},folketelling:{name:"Folketelling 1910",provider:"Folketelling 1910",dataset:{api:"folketelling",dataset:"property"},isStatic:!1,minZoom:14,template:KR.Util.getDatasetTemplate("folketelling"),getFeatureData:function(a,c){b.getData({api:"folketelling",type:"propertyData",propertyId:a.properties.efid},function(b){a.properties=b.properties,a.properties.provider="Folketelling 1910",c(a)})},mappings:{title:"gaardsnavn_gateadr"},noListThreshold:0,description:"Personer og eiendommer fra folketellingen 1910"},ark_hist:{grouped:!0,name:"Arkeologi og historie",minZoom:14,datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Data fra Universitetsmuseene, Digitalt museum og Riksantikvaren"},jernbane:{id:"jernbane",dataset:{api:"jernbanemuseet"},provider:"Jernbanemuseet",name:"Jernbanemuseet",hideFromGenerator:!0,template:KR.Util.getDatasetTemplate("jernbanemuseet"),getFeatureData:function(a,c){b.getItem({api:"jernbanemuseet",id:a.properties.id},c)},isStatic:!0,bbox:!1,description:"Jernbanemuseet"},arkeologi:{grouped:!0,name:"Arkeologi",minZoom:14,style:{fillcolor:"#436978",circle:!1,thumbnail:!0},datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER regex(?loccatlabel, "^Arkeologisk", "i") .',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Arkeologidata fra Universitetsmuseene og Riksantikvaren"},historie:{grouped:!0,name:"Historie",minZoom:14,style:{fillcolor:"#D252B9",circle:!1,thumbnail:!0},datasets:[{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER (!regex(?loccatlabel, "^Arkeologisk", "i"))',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"-dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Industrimuseum"},isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Foto-SF"},isStatic:!1,bbox:!1,template:KR.Util.getDatasetTemplate("foto_sf")},{dataset:{api:"norvegiana",dataset:"Kystreise"},isStatic:!0,bbox:!1}],description:"Historie og kulturminner fra Riksantikvaren og Digitalt museum "},kunst:{grouped:!0,name:"Kunst",style:{fillcolor:"#72B026",circle:!1,thumbnail:!0},datasets:[{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1}],description:"Kunstdata fra Digitalt museum "},wikipedia:{name:"Wikipedia",provider:"Wikipedia",dataset:{api:"wikipedia"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra bokmålswikipedia"},wikipediaNN:{name:"Wikipedia Nynorsk",provider:"Wikipedia Nynorsk",dataset:{api:"wikipediaNN"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra nynorskwikipedia"},lokalwiki:{id:"lokalwiki",name:"Lokalhistoriewiki",hideFromGenerator:!1,provider:"Lokalhistoriewiki",dataset:{api:"lokalhistoriewiki"},style:{thumbnail:!0},minZoom:13,bbox:!0,isStatic:!1,description:"Stedfestede artikler fra lokalhistoriewiki.no"},riksantikvaren:{id:"riksantikvaren",name:"Kulturminnesøk",hideFromGenerator:!1,provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:10,callback:e.loadKulturminnePoly},description:"Data fra Riksantikvarens kulturminnesøk"},brukerminner:{name:"Kulturminnesøk - brukerregistreringer",hideFromGenerator:!1,provider:"riksantikvaren",dataset:{api:"kulturminnedata",layer:2,getExtraData:!0,extraDataLayer:6,matchId:"KulturminnesokID"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Brukerregistrerte data fra Riksantikvarens kulturminnesøk",template:KR.Util.getDatasetTemplate("brukerminne")},groruddalen:{name:"Byantikvaren Oslo - Groruddalen",hideFromGenerator:!0,provider:"Byantikvaren i Oslo",dataset:{api:"cartodb",table:"byantikvaren_oslo_groruddalen"},bbox:!1,isStatic:!1,style:{thumbnail:!0},template:KR.Util.getDatasetTemplate("byantikvaren_oslo"),description:"Byantikvarens Groruddalsatlas"},norgerundt:{name:"Norge Rundt",hideFromGenerator:!0,provider:"NRK",dataset:{api:"cartodb",table:"nrk_norge_rundt"},bbox:!1,isStatic:!1,style:{thumbnail:!0},description:"Stedfestede innslag fra Norge Rundt"},dimu:{name:"Digitalt Museum",hideFromGenerator:!1,provider:"dimu",dataset:{dataset:"DiMu",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Digitalt Museum",allowTopic:!0,feedbackForm:!0},musit:{name:"Universitetsmuseene",hideFromGenerator:!1,provider:"Universitetsmuseene",dataset:{dataset:"MUSIT",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Universitetsmuseene",allowTopic:!0,feedbackForm:!0},industrimuseum:{name:"Industrimuseum",hideFromGenerator:!1,provider:"Industrimuseum",dataset:{dataset:"Industrimuseum",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Industrimuseum",allowTopic:!0,feedbackForm:!0},kystreise:{name:"Kystreise",hideFromGenerator:!1,provider:"Kystreise",dataset:{dataset:"Kystreise",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Kystreise",allowTopic:!0,feedbackForm:!0},dimufoto:{hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"DiMu",query:"europeana_type_facet:IMAGE"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,style:{thumbnail:!0},noListThreshold:1/0},kulturminnesok_flickr:{name:"Kulturminnesøk",dataset_name_override:"Kulturminnesøk",provider:"Kulturminnesøk Flickr",hideFromGenerator:!0,dataset:{api:"flickr",group_id:"1426230@N24"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!0,style:{thumbnail:!0},description:"Bilder fra Kulturminnesøks Flickr-gruppe"},riksarkivet:{name:"Riksarkivet",dataset_name_override:"Riksarkivet",provider:"riksarkivet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_archives_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Riksarkivets Flickr-konto"},nasjonalbiblioteket:{name:"Nasjonalbiblioteket",dataset_name_override:"Nasjonalbiblioteket",provider:"nasjonalbiblioteket",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_library_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalbibliotekets Flickr-konto"},oslobyarkiv:{name:"Oslo Byarkiv",dataset_name_override:"Oslo Byarkiv",provider:"oslobyarkiv",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"byarkiv"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Oslo byarkiv sin Flickr-konto"},nasjonalmuseet:{name:"Nasjonalmuseet",dataset_name_override:"Nasjonalmuseet",provider:"nasjonalmuseet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nasjonalmuseet"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalmuseet sin Flickr-konto"},nve:{name:"NVE",dataset_name_override:"NVE",provider:"nve",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nve",accuracy:"6"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra NVE Flickr-konto"},vestfoldmuseene:{name:"Vestfoldmuseene",dataset_name_override:"Vestfoldmuseene",provider:"Vestfoldmuseene",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"vestfoldmuseene",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Vestfoldmuseene sin Flickr-konto"},perspektivet:{name:"Perspektivet Museum",dataset_name_override:"Perspektivet Museum",provider:"Perspektivet Museum",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"perspektivetmuseum",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Perspektivet Museum sin Flickr-konto"}};if(!c&&!d){var g={bbox:!0,minZoom:12,isStatic:!1,bboxFunc:KR.Util.sparqlBbox};_.extend(f.riksantikvaren,g),_.extend(f.ark_hist.datasets[2],g),_.extend(f.arkeologi.datasets[1],g),_.extend(f.historie.datasets[0],g)}return f},a.getDatasets=function(b,c,d,e){var f=a.getDatasetList(c,d,e);return _.chain(b).map(function(a){var b;if(a.indexOf(":")>-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};!function(a){"use strict";function b(a){return turf.featurecollection([turf.simplify(a.features[0],.001,!1)])}function c(a,b){return b=b||{},{polyline:{positions:a,width:5,material:new Cesium.PolylineOutlineMaterialProperty({color:Cesium.Color.ORANGE,outlineWidth:2,outlineColor:Cesium.Color.BLACK})}}}function d(a,b,c){var d=a.layer||"topo2";if("norges_grunnkart_graatone"===d&&(d="norges_grunnkart"),"hist"===d)c(b.getWms("http://wms.geonorge.no/skwms1/wms.historiskekart","historiskekart"));else if("nib"===d){var e="http://knreise.no/nib/?type=token";KR.Util.sendRequest(e,null,function(a){c(0!==a.indexOf("**")?b.getWmts("http://crossorigin.me/http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts","NiB",{TILEMATRIXSET:"EPSG:900913",TILEMATRIX:"EPSG:900913:{TileMatrix}",FORMAT:"image/jpeg",GKT:a}):b.getTiles("http://www.webatlas.no/wacloud/servicerepository/combine.aspx?X={x}&Y={y}&Z={z}&layers=TMS_WEBATLAS_STANDARD:1"))})}else c(b.getWmts("http://opencache.statkart.no/gatekeeper/gk/gk.open_wmts",d,{TILEMATRIXSET:"EPSG:3857",TILEMATRIX:"EPSG:3857:{TileMatrix}",FORMAT:"image/png"}))}function e(a){function b(){e.find(".glyphicon").removeClass("glyphicon-play").addClass("glyphicon-pause"),a.start()}function c(){e.find(".glyphicon").removeClass("glyphicon-pause").addClass("glyphicon-play"),a.stop()}function d(){a.isRunning()?c():b()}var e=$("#playpause");return{play:b,pause:c,toggle:d}}var f={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!1,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!0,navigationInstructionsInitiallyVisible:!1,orderIndependentTranslucency:!1};a.setupMap3d=function(a,g,h){function i(){var b=KR.Config.getDatasets(g,a);return _.chain(b).map(function(a){return a.datasets?a.datasets:a}).flatten().filter(function(a){return _.has(a.dataset,"kommune")&&_.isUndefined(a.dataset.kommune)?!1:!0}).value()}function j(a,b){return new KR.CesiumMap(a,_.extend(f,{limitBounds:h.limitBounds,terrainUrl:h.terrainUrl,enableLighting:h.enableLighting}),b)}function k(b,c,d){_.each(b,function(b){var d=KR.Util.getDatasetId(b),e={template:b.template,datasetId:d,"marker-color":KR.Style.colorForFeature({properties:{datasetId:d}},!1)};o.loadDataset2(b.dataset,c,a,e)}),o.addClickhandler(function(a){q.show(a),d&&d()})}function l(a){o=j("cesium-viewer",a),o.viewer.scene.imageryLayers.removeAll(),d(h,o,o.addImageryProvider),k(i(),a),o.stopLoading()}function m(){var f,g,l=!1;KR.Util.getLine(a,h.line,function(a){if(p=KR.CesiumUtils.getBounds(a),o=j("cesium-viewer",p),d(h,o,o.addImageryProvider),k(i(),p,function(){h.player&&(l=f.isRunning(),g.pause(),f.stop())}),o.build3DLine(a,function(a){var b=c(a,{color:Cesium.Color.DEEPSKYBLUE,glow:.25});o.viewer.zoomTo(o.viewer.entities.add(b)),o.stopLoading()}),h.player){var m=b(a);o.build3DLine(m,function(a){f=new KR.PathTracer(o.viewer,a,m),f.setPitchCorr(.1),g=new e(f),$("#playpause").removeClass("hidden"),$("#playpause").click(g.toggle)}),q.addCloseCb(function(){l&&g.play()})}})}function n(){h.bbox?l(h.bbox):h.komm?a.getMunicipalityBounds(h.komm,l):h.line?m():alert("Missing parameters!")}h=h||{},h=_.extend({player:!0,limitBounds:!1},h);var o,p,q=KR.CesiumSidebar($("#cesium-sidebar"),{});n()}}(KR); \ No newline at end of file diff --git a/dist/scripts_external.js b/dist/scripts_external.js index d2056a0e..6b5d90d2 100644 --- a/dist/scripts_external.js +++ b/dist/scripts_external.js @@ -33,8 +33,8 @@ L.TileLayer.addInitHook(function(){if(!this.options.useCache){this._db=null;this var esri2geo={};(function(){function toGeoJSON(data,cb){if(typeof data==="string"){if(cb){ajax(data,function(err,d){toGeoJSON(d,cb)});return}else{throw new TypeError("callback needed for url")}}var outPut={type:"FeatureCollection",features:[]};var fl=data.features.length;var i=0;while(fl>i){var ft=data.features[i];var outFT={type:"Feature",properties:prop(ft.attributes)};if(ft.geometry.x){outFT.geometry=point(ft.geometry)}else if(ft.geometry.points){outFT.geometry=points(ft.geometry)}else if(ft.geometry.paths){outFT.geometry=line(ft.geometry)}else if(ft.geometry.rings){outFT.geometry=poly(ft.geometry)}outPut.features.push(outFT);i++}cb(null,outPut)}function point(geometry){return{type:"Point",coordinates:[geometry.x,geometry.y]}}function points(geometry){if(geometry.points.length===1){return{type:"Point",coordinates:geometry.points[0]}}else{return{type:"MultiPoint",coordinates:geometry.points}}}function line(geometry){if(geometry.paths.length===1){return{type:"LineString",coordinates:geometry.paths[0]}}else{return{type:"MultiLineString",coordinates:geometry.paths}}}function poly(geometry){if(geometry.rings.length===1){return{type:"Polygon",coordinates:geometry.rings}}else{return decodePolygon(geometry.rings)}}function decodePolygon(a){var coords=[],type;var len=a.length;var i=0;var len2=coords.length-1;while(len>i){if(ringIsClockwise(a[i])){coords.push([a[i]]);len2++}else{coords[len2].push(a[i])}i++}if(coords.length===1){type="Polygon"}else{type="MultiPolygon"}return{type:type,coordinates:coords.length===1?coords[0]:coords}}function ringIsClockwise(ringToTest){var total=0,i=0,rLength=ringToTest.length,pt1=ringToTest[i],pt2;for(i;i=0}function prop(a){var p={};for(var k in a){if(a[k]){p[k]=a[k]}}return p}function ajax(url,cb){if(typeof module!=="undefined"){var request=require("request");request(url,{json:true},function(e,r,b){cb(e,b)});return}var response;var req=new XMLHttpRequest;req.onreadystatechange=function(){if(req.readyState===4&&req.status===200){cb(null,JSON.parse(req.responseText))}};req.open("GET",url);req.send()}if(typeof module!=="undefined"){module.exports=toGeoJSON}else{esri2geo.toGeoJSON=toGeoJSON}})(); -/*! KNreiseAPI 1.7.20 2015-11-11 */ -var KR=this.KR||{};KR.Util={},function(a){"use strict";function b(a){return a*Math.PI/180}a.dictWithout=function(a){var b=_.without(_.keys(a),Array.prototype.slice.call(arguments,1));return _.reduce(b,function(b,c){return b[c]=a[c],b},{})},a.createQueryParameterString=function(a){return _.map(a,function(a,b){return encodeURIComponent(b)+"="+encodeURIComponent(a)}).join("&")},a.handleError=function(a,b,c){if(a)return void a({error:b,data:c});throw new Error(b)},a.sendRequest=function(b,c,d,e,f){return f=f||{},$.ajax({type:"get",beforeSend:function(a){_.each(f,function(b,c){a.setRequestHeader(c,b)})},url:b,success:function(b){if(c){var f;try{f=c(b,e)}catch(g){return void a.handleError(e,g.message,b)}_.isUndefined(f)||d(f)}else d(b)},error:e})},a.createGeoJSONFeature=function(a,b,c){return b=b||{},{type:"Feature",geometry:{type:"Point",coordinates:[a.lng,a.lat]},properties:b,id:c}},a.createGeoJSONFeatureFromGeom=function(a,b,c){return b=b||{},{type:"Feature",geometry:a,properties:b,id:c}},a.createFeatureCollection=function(a){return{type:"FeatureCollection",features:a}},a.stamp=function(){var a=0,b="_knreise_id";return function(c){return c[b]=c[b]||++a,c[b]}}(),a.haversine=function(a,c,d,e){var f=6371e3,g=b(a),h=b(d),i=b(d-a),j=b(e-c),k=Math.sin(i/2)*Math.sin(i/2)+Math.cos(g)*Math.cos(h)*Math.sin(j/2)*Math.sin(j/2),l=2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k));return f*l},a.splitBbox=function(a){return a.split(",").map(parseFloat)},a.addCrossorigin=function(a){return 0!==a.indexOf("http://crossorigin.me/")?"http://crossorigin.me/"+a:a}}(KR.Util);var KR=this.KR||{};KR.ArcgisAPI=function(a,b){"use strict";function c(a){return a=KR.Util.splitBbox(a),JSON.stringify({xmin:a[0],ymin:a[1],xmax:a[2],ymax:a[3]})}function d(a,b,c){b=JSON.parse(b);var d=b.features,e=_.map(a.features,function(a){var b=_.find(d,function(b){return b.attributes[c.matchId]===a.properties[c.matchId]});b&&(b=b.attributes,a.properties.thumbnail=b.UrlTilBilde);var e=_.extend(a.properties,{extra:b});return KR.Util.createGeoJSONFeatureFromGeom(a.geometry,e,a.id)});return KR.Util.createFeatureCollection(e)}function e(a,b,c,e){var f=_.map(a.features,function(a){return a.properties[b.matchId]}),g={where:b.matchId+" IN ("+f.join(",")+")",outFields:"*",returnGeometry:!1,returnIdsOnly:!1,returnCountOnly:!1,returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"pjson"},i=h+b.extraDataLayer+"/query";$.ajax({type:"POST",url:i,data:KR.Util.createQueryParameterString(g),success:function(e){c(d(a,e,b))},error:function(b){c(a)}})}function f(b,c,d,f){try{b=JSON.parse(b)}catch(g){}return _.has(b,"error")?void KR.Util.handleError(d,b.error.message):void esri2geo.toGeoJSON(b,function(b,g){b?c(KR.Util.createFeatureCollection([])):(_.each(g.features,function(b){_.has(b.properties,"Navn")&&(b.properties.title=b.properties.Navn),b.id=a+"_"+b.properties.OBJECTID}),f.getExtraData?e(g,f,c,d):c(g))})}function g(a,b,d,e){var g={geometry:c(b),geometryType:"esriGeometryEnvelope",inSR:4326,spatialRel:"esriSpatialRelIntersects",outFields:"*",returnGeometry:!0,outSR:4326,returnIdsOnly:!1,returnCountOnly:!1,outStatistics:"",returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"json"};a.query&&(g.where=a.query);var i=a.layer,j=h+i+"/query?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(j,null,function(b){f(b,d,e,a)},e)}var h=b.url;return{getBbox:g}};var KR=this.KR||{};KR.CartodbAPI=function(a,b){"use strict";function c(a){return"http://"+a+".cartodb.com/api/v2/sql"}function d(a){return function(b){var c=_.map(b.rows,function(b){var c=JSON.parse(b.geom),d=_.reduce(b,function(b,c,d){if(_.has(a,d)){var e=a[d];_.isArray(e)?_.each(e,function(a){b[a]=c}):b[e]=c}return b},{});return{type:"Feature",geometry:c,properties:d}});return KR.Util.createFeatureCollection(c)}}function e(){return _.reduce(r,function(a,b,c){return a[c]=d(b),a},{cartodb_general:function(a){var b=_.map(a.rows,function(a){var b=JSON.parse(a.geom);return{type:"Feature",geometry:b,properties:_.omit(a,"geom")}});return KR.Util.createFeatureCollection(b)}})}function f(a,b,d,e,f){var g={q:a},h=f||q,i=c(h)+"?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(i,b,d,e)}function g(a){var b=a.rows[0].st_extent;return b.replace("BOX(","").replace(")","").replace(/ /g,",")}function h(a,b,c){var d=["SELECT "+a,"FROM "+b];return c&&d.push("WHERE "+c),d.join(" ")}function i(a,b){return"ST_DWithin(the_geom::geography,'POINT("+a.lng+" "+a.lat+")'::geography, "+b+");"}function j(a){var b=a.mapper;return b||(b=e().cartodb_general),b}function k(a){return _.isArray(a)?a:[a]}function l(a,b,c){var d=h("ST_Extent(the_geom)","kommuner","komm in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function m(a,b,c){var d=h("ST_Extent(the_geom)","fylker","fylkesnr in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function n(a,b,c){var d,e=j(a);if(a.query)d=a.query;else if(a.table){var g=a.columns;g||(g=["*"]),_.has(r,a.table)&&(g=_.keys(r[a.table])),g.push("ST_AsGeoJSON(the_geom) as geom"),d="SELECT "+g.join(", ")+" FROM "+a.table}else a.county?d=h("ST_AsGeoJSON(the_geom) as geom","fylker","fylkesnr in ("+k(a.county).join(", ")+")"):a.municipality&&(d=h("ST_AsGeoJSON(the_geom) as geom","kommuner","komm in ("+k(a.municipality).join(", ")+")"));d&&f(d,e,b,c)}function o(a,b,c,d){var e=a.columns;e||(e=["*"]),e.push("ST_AsGeoJSON(the_geom) as geom");var g=h(e.join(", "),a.table,"ST_Intersects(the_geom, ST_MakeEnvelope("+b+", 4326))"),i=j(a);f(g,i,c,d)}function p(a,b,c,d,e){var g=_.keys(r["default"]).concat(["ST_AsGeoJSON(the_geom) as geom"]).join(", "),j=h(g,a.table,i(b,c));f(j,s,d,e)}var q=b.user,r={"default":{delving_thumbnail:["images","thumbnail"],dc_title:"title",dc_description:"content",europeana_isshownat:"link",europeana_collectiontitle:"dataset",abm_contentProvider:"provider",europeana_type:"contentType",delving_landingpage:"video"},pilegrimsleden_dovre:{iid:"id",name:"name",omradenavn:"omradenavn"}},s=d(r["default"]);return{getBbox:o,getData:n,getWithin:p,getMunicipalityBounds:l,getCountyBounds:m,mappers:e}};var KR=this.KR||{};KR.NorvegianaAPI=function(a){"use strict";function b(a){return a.lat+","+a.lng}function c(a){return a&&a.length?a[0]:null}function d(a){return a&&-1!==a.indexOf("www.youtube.com/watch")?"https://www.youtube.com/embed/"+a.substr(a.indexOf("watch?v=")+8):a}function e(a){return _.chain(a.item.fields).pairs().where(function(a){return"abm_latLong"!==a[0]}).reduce(function(a,b){return a[b[0]]=b[1],a},{}).value()}function f(a){var b=75;return a&&a.indexOf("width=")>-1&&a.indexOf("height=")>-1?a.replace(/(width=)(\d+)/g,"$1"+b).replace(/(height=)(\d+)/g,"$1"+b):a}function g(a,b){return _.chain(b).reduce(function(b,c){return _.has(a,c)&&(b=b.concat(a[c])),b},[]).uniq().value()}function h(a){return _.chain(a).map(function(a,b){return _.map(a,function(a){return{type:b,url:a}})}).flatten().value()}function i(a){var b=c(a.delving_thumbnail),e=g(a,["delving_thumbnail","abm_imageUri"]),i={video:_.map(a.abm_videoUri,d),sound:a.abm_soundUri,image:e};return{thumbnail:f(b),images:e,title:c(a.dc_title),content:_.map(a.dc_description,function(a){return"

"+a+"

"}).join("\n"),link:c(a.europeana_isShownAt),dataset:c(a.europeana_collectionTitle),provider:c(a.abm_contentProvider),contentType:c(a.europeana_type),video:c(a.abm_videoUri),videoEmbed:d(c(a.abm_videoUri)),sound:c(a.abm_soundUri),allProps:a,media:h(i)}}function j(b){var c,d=e(b),f=i(d),g=_.map(b.item.fields.abm_latLong[0].split(","),parseFloat);_.has(d,"delving_hubId")&&(c=a+"_"+d.delving_hubId[0]);var h=KR.Util.createGeoJSONFeature({lat:g[0],lng:g[1]},f,c);return h}function k(a){var b;a.result.pagination.hasNext&&(b=a.result.pagination.nextPage);var c=_.map(a.result.items,j),d=KR.Util.createFeatureCollection(c);return d.numFound=a.result.pagination.numFound,{geoJSON:d,nextPage:b}}function l(a,b,c){var d=[];return function e(f){if(d.push(f.geoJSON),f.nextPage)return void KR.Util.sendRequest(a+"&start="+f.nextPage,k,e,c);var g=_.reduce(d,function(a,b){return a.concat(b.features)},[]);b(KR.Util.createFeatureCollection(g))}}function m(a){return a=_.isArray(a)?a:[a],_.map(a,function(a){return"delving_spec:"+a}).join(" OR ")}function n(a){x[a]&&(x[a].abort(),x[a]=null)}function o(a,b,c){return KR.Util.sendRequest(a,k,function(a){b(a.geoJSON)},c)}function p(a,b,c){return KR.Util.sendRequest(a,k,l(a,b,c),c)}function q(a,b,c,d,e){var f=m(b.dataset);a=_.extend({query:f,format:"json",rows:1e3},a),a.query+=" delving_hasGeoHash:true";var g=f;b.query&&(a.qf=b.query,g+=b.query),n(g);var h=y+"?"+KR.Util.createQueryParameterString(a);e.allPages?x[g]=p(h,c,d):x[g]=o(h,c,d)}function r(a,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(j,k,l,k),KR.Util.haversine(l,g,l,k)]),n={pt:b({lat:l,lng:k}),d:m/1e3,geoType:"bbox"};q(n,a,d,e,f)}function s(a,c,d,e,f,g){var h={pt:b(c),d:d/1e3};q(h,a,e,f,g)}function t(a,b,c,d){if(a.query&&_.isArray(a.query)){var e="delving_spec:"+a.dataset+" AND ("+a.query.join(" OR ")+") AND delving_hasGeoHash:true",f={query:e,format:"json",rows:1e3},g=e;n(g);var h=y+"?"+KR.Util.createQueryParameterString(f);return void(d.allPages?x[g]=p(h,b,c):x[g]=o(h,b,c))}q({},a,b,c,d)}function u(a,b,c){var d={id:a.id,format:"json"},e=y+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(a){return j(a.result)},b,c)}function v(b){var c=_.map(b.geo_json.features,function(b){var c,d=i(b.properties);return _.has(d.allProps,"delving_hubId")&&(c=a+"_"+d.allProps.delving_hubId),b.properties=d,b.id=c,b});return b.geo_json=KR.Util.createFeatureCollection(c),b}function w(a,b,c){var d=z+a;KR.Util.sendRequest(d,v,b,c)}var x=[],y="http://kulturnett2.delving.org/api/search",z="http://acc.norvegiana.delving.org/en/api/knreise-collection/";return{getWithin:s,getItem:u,getBbox:r,getData:t,getCollection:w}};var KR=this.KR||{};KR.WikipediaAPI=function(a,b){"use strict";function c(a,b){var c=n+"?"+KR.Util.createQueryParameterString(a);KR.Util.sendRequest(c,null,function(a){try{a=JSON.parse(a)}catch(c){}b(a)})}function d(a,b){function d(f){if(_.each(f.query.pages,function(a,b){_.has(e,b)?e[b]=_.extend(e[b],a):e[b]=a}),_.has(f,"continue")){var g={};_.has(f["continue"],"picontinue")&&(g.picontinue=f["continue"].picontinue),_.has(f["continue"],"excontinue")&&(g.excontinue=f["continue"].excontinue);var h=_.extend(g,a);c(h,d)}else b(e)}var e={};c(a,d)}function e(a){var b="http://upload.wikimedia.org/wikipedia/commons/",c=CryptoJS.MD5(a).toString();return b+c.substr(0,1)+"/"+c.substr(0,2)+"/"+a}function f(a,b){var c={action:"query",prop:"extracts|pageimages",exlimit:"max",exintro:"",pilimit:"max",pageids:a,format:"json","continue":""};d(c,b)}function g(b,c){c=c||{};var d=c[b.pageid];d&&(b=_.extend(b,d));var f;_.has(b,"thumbnail")&&(f=b.thumbnail.source);var g=null;b.pageimage&&(g=[e(b.pageimage)]);var h=o+b.pageid,i={thumbnail:f,images:g,title:b.title,content:b.extract,link:h,dataset:"Wikipedia",provider:"Wikipedia",contentType:"TEXT",id:b.pageid};return KR.Util.createGeoJSONFeature({lat:b.lat,lng:b.lon},i,a+"_"+b.pageid)}function h(a,b,c){try{a=JSON.parse(a)}catch(d){}try{var e=_.pluck(a.query.geosearch,"pageid");e.length?f(e.join("|"),function(c){var d=_.map(a.query.geosearch,function(a){return g(a,c)});b(KR.Util.createFeatureCollection(d))}):b(KR.Util.createFeatureCollection([]))}catch(h){KR.Util.handleError(c,a.error.info)}}function i(a,b,c,d,e){if(c>m)return void KR.Util.handleError(e,"to wide search radius (max is "+m+")");var f={action:"query",list:"geosearch",gsradius:c,gscoord:b.lat+"|"+b.lng,format:"json",gslimit:50},g=n+"?"+KR.Util.createQueryParameterString(f);KR.Util.sendRequest(g,null,function(a){h(a,d,e)},e)}function j(a){var b=_.chain(a).reduce(function(a,b){return _.each(b,function(b,c){_.has(a,c)?a[c]=_.extend(a[c],b):a[c]=b}),a},{}).filter(function(a){return _.has(a,"coordinates")}).map(function(a){return a.lat=a.coordinates[0].lat,a.lon=a.coordinates[0].lon,a}).map(g).value();return KR.Util.createFeatureCollection(b)}function k(a,b,c,d){function e(a){var d=_.extend({},f,a),h=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(h,null,function(a){g.push(a.query.pages),_.has(a,"continue")?e(a["continue"]):b(j(g))},c)}var f={action:"query",generator:"categorymembers",gcmtitle:"Kategori:"+a.category,prop:"coordinates",format:"json"},g=[];e({"continue":""})}function l(a,b,c){var d={action:"query",pageids:a.id,prop:"coordinates|pageimages|extracts",format:"json"},e=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(b){return g(b.query.pages[a.id])},b,c)}var m=b.maxRadius||1e4,n=b.url,o=b.linkBase;return{getWithin:i,getData:k,getItem:l}};var KR=this.KR||{};KR.UtnoAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");if("gpx"===a.type){var d="http://ut.no/tur/"+a.id+"/gpx/";KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}else KR.Util.handleError(c,"Unknown type "+a.type)}return{getData:b}};var KR=this.KR||{};KR.FolketellingAPI=function(a){"use strict";function b(b){var c=_.map(b.results,function(b){var c=KR.Util.dictWithout(b,"latitude","longitude"),d={lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)};return KR.Util.createGeoJSONFeature(d,c,a+"_"+b.autoid)});return KR.Util.createFeatureCollection(c)}function c(a,c,d,e,f,i){var j=a.limit||1e3;if("property"!==a.dataset)return void KR.Util.handleError(f,"unknown dataset "+a.dataset);if(d>h)return void KR.Util.handleError(f,"to wide search radius");var k={latitude:c.lat,longitude:c.lng,precision:d,limit:j},l=g+"search_property_geo?"+KR.Util.createQueryParameterString(k);KR.Util.sendRequest(l,b,e,f)}function d(a,b,c){if(0===a.property.id.indexOf("gf")){if(!a.apartments)return a.apartments=null,void b({properties:a});var d=[],e=_.after(a.apartments.length,function(){a.apartments=d,b({properties:a})});return void _.each(a.apartments,function(a){f({type:"apartmentData",apartmentId:a.id},function(a){d.push(a),e()})})}b({properties:a})}function e(a){return a.apartments||(a.apartments=null),{properties:a}}function f(a,b,c,f){var h;"propertyData"===a.type&&a.propertyId?(h=g+"property/"+a.propertyId,a.withPersons?KR.Util.sendRequest(h,null,function(a){d(a,b,c)},c):KR.Util.sendRequest(h,e,b,c)):"apartmentData"===a.type&&a.apartmentId?(h=g+"property/"+a.apartmentId,KR.Util.sendRequest(h,null,b,c)):KR.Util.handleError(c,"Not enough parameters")}var g="http://api.digitalarkivet.arkivverket.no/v1/census/1910/",h=5e3;return{getData:f,getWithin:c}};var KR=this.KR||{};KR.SparqlAPI=function(a,b){"use strict";function c(a){if("undefined"==typeof proj4)throw new Error("Proj4js not found!");return proj4("EPSG:32633","EPSG:4326",a)}function d(a){return a=wellknown.parse(a.value),"Point"===a.type&&(a.coordinates=c(a.coordinates)),"Polygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a,c)})),"MultiPolygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a.coordinates,function(a){return _.map(a,c)})})),a}function e(b,c){var e=_.map(b.results.bindings,function(b){var c=_.without(_.keys(b),"point","omraade"),e=_.reduce(c,function(a,c){return a[c]=b[c].value,a},{});return e.img||(e.img=!1),e.title=e.name,_.has(b,"point")?KR.Util.createGeoJSONFeatureFromGeom(d(b.point),e,a+"_"+e.id):_.has(b,"omraade")?KR.Util.createGeoJSONFeatureFromGeom(d(b.omraade),e,a+"_"+e.id):null});return KR.Util.createFeatureCollection(e)}function f(a,b){var c=a.results.bindings;if(!c||0===c.length)return void KR.Util.handleError(b);var e=_.map(c,function(a){return a.lok.type="Polygon",KR.Util.createGeoJSONFeatureFromGeom(d(a.lok),{})}),f=_.map(e,function(a){return a.geometry}),g={type:"GeometryCollection",geometries:f};return KR.Util.createGeoJSONFeatureFromGeom(g,{})}function g(a,b,c,d){var e={"default-graph-uri":"",query:a,format:"application/sparql-results+json",timeout:0,debug:"off"},f=o+"?"+KR.Util.createQueryParameterString(e);KR.Util.sendRequest(f,b,c,d)}function h(a){if(a.kommune){var b="select distinct ?id ?name ?description ?loccatlabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?p ; ?point . ?loccat rdfs:label ?loccatlabel . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) }';return a.filter&&(b+=" "+a.filter),b+="}",a.limit&&(b+="LIMIT "+a.limit),b}}function i(a){if(a.fylke){var b=parseInt(a.fylke,10);10>b&&(b="0"+b);var c='select ?id ?name ?description ?loccatlabel (SAMPLE(?point) as ?point) ?img ?thumbnail ?url as ?link { ?id a ?type . ?id rdfs:label ?name . ?id ?kommune . ?id ?description . ?id ?lokalitetskategori . ?lokalitetskategori rdfs:label ?loccatlabel . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) ?id ?point . optional { ?picture ?id . ?picture ?link BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=400&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) } FILTER regex(?kommune, "^.*'+b+'[0-9]{2}") .';return a.filter&&(c+=" "+a.filter),c+=" } order by ?img",a.limit&&(c+="LIMIT "+a.limit),c}}function j(a){return"SELECT ?lok where { <"+a.trim()+"> ?lok . }"}function k(a){return"SELECT ?enk as ?id ?name ?desc as ?content ?area as ?omraade ?enkcatlabel where { ?enk a . ?enk rdfs:label ?name . ?enk <"+a.trim()+"> . ?enk ?desc . ?enk ?area . ?enk ?enkcat . ?enkcat rdfs:label ?enkcatlabel . } "}function l(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var e=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(e))});_.each(d,function(a){g(j(a),f,function(b){b.properties.lok=a,e.push(b),h()},c)})}function m(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var f=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d,function(a){g(k(a),e,function(b){var c=_.map(b.features,function(b){return b.properties.lokalitet=a,b});f=f.concat(c),h()},c)})}function n(a,b,c,d){if(a=_.extend({},{geomType:"point"},a),a.kommune){var f=h(a,c);g(f,e,b,c)}else if(a.fylke){var f=i(a,c);g(f,e,b,c)}else a.lokalitet&&"lokalitetpoly"===a.type?l(a,b,c):a.lokalitet&&"enkeltminner"===a.type?m(a,b,c):a.sparqlQuery?g(a.sparqlQuery,e,b,c):KR.Util.handleError(c,"not enough parameters")}var o=b.url;return"undefined"!=typeof proj4&&proj4.defs([["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),{getData:n}};var KR=this.KR||{};KR.FlickrAPI=function(a,b){"use strict";function c(a,b){return l(_.extend({size:b},a))}function d(b,d){if(b.stat&&"fail"===b.stat)return void KR.Util.handleError(d,b.message,b);var e=_.chain(b.photos.photo).filter(function(a){var b=parseFloat(a.latitude),c=parseFloat(a.longitude);return 0!=b||0!=c}).map(function(b){var d=KR.Util.dictWithout(b,"latitude","longitude");return d.thumbnail=c(b,"s"),d.image=c(b,"z"),KR.Util.createGeoJSONFeature({lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)},d,a+"_"+b.id)}).value();return KR.Util.createFeatureCollection(e)}function e(a,b,c){function e(e){var h=d(e,c);if(h&&h.features&&(g=g.concat(h.features)),e.photos&&e.photos.page.staticflickr.com/<%= server %>/<%= id %>_<%= secret %>_<%= size %>.jpg");return{getData:i,getWithin:g,getBbox:h}};var KR=this.KR||{};KR.KmlAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.kml,b,c)}return{getData:b}};var KR=this.KR||{};KR.GpxAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}return{getData:b}};var KR=this.KR||{};KR.GeoJsonAPI=function(a){"use strict";function b(a,b,c){var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,JSON.parse,b,c)}return{getData:b}};var KR=this.KR||{};KR.JernbanemuseetAPI=function(a,b){"use strict";function c(a){return _.has(a,"group")?a.group:l}function d(){return{"api-key":o}}function e(b){var c=_.map(b.data.records,function(b){var c,d=_.extend(b.contents[m],{id:b.record_id});return _.has(b,"latitude")&&_.has(b,"longitude")?c={lat:b.latitude,lng:b.longitude}:_.has(b,"location")?c={lat:b.location.latitude,lng:b.location.longitude}:console.error("no geometry"),KR.Util.createGeoJSONFeature(c,d,a+"_"+b.record_id)});return KR.Util.createFeatureCollection(c)}function f(a){return _.map(a.blocks,function(a){if("text"===a.type)return{text:a.data,type:a.type};if("image_video"===a.type||"audio"===a.type){var b=_.map(a.data,function(a){var b;"image"===a.type&&(b=a.url),"video"===a.type&&(b=a.url.mp4),"audio"===a.type&&(b=a.url.ogg);var c="",d="";return _.has(a.contents,m)&&(c=a.contents[m].description,d=a.contents[m].title),{title:d,description:c,type:a.type,url:b}});return{media:b,type:a.type}}return"links"===a.type?{links:a.data,type:"links"}:void 0})}function g(b){var c,d,e=b.data.contents[m],g={lat:b.data.location.latitude,lng:b.data.location.longitude},h=b.data.id,i=_.map(e.pages,function(a){return{title:a.title,blocks:f(a)}});b.data.images.length&&(c=_.pluck(b.data.images,"url"),d=b.data.images[0].thumbnail);var j={license:b.data.license.description,id:h,thumbnail:d,images:c,title:e.title,description:e.description,pages:i};return KR.Util.createGeoJSONFeature(g,j,a+"_"+h)}function h(a,b,e){var f=n+"/groups/"+c(a)+"/records/"+a.id+"?strip_html=true";KR.Util.sendRequest(f,g,b,e,d())}function i(a,b,c){var d=e(a),f=[],g=_.after(d.features.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d.features,function(a){h(a.properties.id,function(a){f.push(a),g()},function(){g()})})}function j(a,b,f,g,h,j){var k={lat:b.lat,"long":b.lng,radius:f},l=n+"/groups/"+c(a)+"/nearby?"+KR.Util.createQueryParameterString(k);j.getDetails?KR.Util.sendRequest(l,null,function(a){i(a,g,h)},null,d()):KR.Util.sendRequest(l,e,g,h,d())}function k(a,b,f,g){var h=n+"/groups/"+c(a)+"/geography";g.getDetails?KR.Util.sendRequest(h,null,function(a){i(a,b,f)},null,d()):(a.presentation&&(h="https://api.kulturpunkt.org/v2/owners/54/presentations/"+a.presentation),KR.Util.sendRequest(h,e,b,f,d()))}var l=192,m=b.lang||"no",n="https://api.kulturpunkt.org/v2/owners/54",o=b.apikey;return{getData:k,getWithin:j,getItem:h}};var KR=this.KR||{};KR.API=function(a){"use strict";function b(){return _.reduce(k,function(b,c,d){var e=c.params;return c.extend&&(e=_.extend(e,a[d])),b[d]=new c.api(d,e),b},{})}function c(a,b,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(h,g,l,k),KR.Util.haversine(j,i,l,k)]),n={lat:l,lng:k};a.getWithin(b,n,m,d,e,f)}function d(a){var b=l[a];if(b)return b;throw new Error("Unknown API")}function e(a,b,c,e){e=e||{};var f=d(a.api);f.getData(a,b,c,e)}function f(a,b,e,f,g){g=g||{};var h=d(a.api);_.has(h,"getBbox")?h.getBbox(a,b,e,f,g):c(h,a,b,e,f,g)}function g(a,b,c,e,f,g){g=g||{},c=c||5e3;var h=d(a.api);h.getWithin(a,b,c,e,f,g)}function h(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getMunicipalityBounds(a,b,c)}function i(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getCountyBounds(a,b,c)}function j(a,b,c){var e=d(a.api);if(_.has(e,"getItem"))e.getItem(a,b,c);else{if(!c)throw new Error("No getItem function for api "+a.api);c("No getItem function for api "+a.api)}}a=a||{};var k={norvegiana:{api:KR.NorvegianaAPI,params:{}},wikipedia:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://no.wikipedia.org/w/api.php",linkBase:"http://no.wikipedia.org/?curid="}},wikipediaNN:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://nn.wikipedia.org/w/api.php",linkBase:"http://nn.wikipedia.org/?curid="}},cartodb:{api:KR.CartodbAPI,extend:!0,params:{user:"knreise"}},kulturminnedata:{api:KR.ArcgisAPI,params:{url:"http://husmann.ra.no/arcgis/rest/services/Husmann/Husmann/MapServer/"}},kulturminnedataSparql:{api:KR.SparqlAPI,params:{url:"https://sparql.kulturminne.no/"}},utno:{api:KR.UtnoAPI,params:{}},folketelling:{api:KR.FolketellingAPI,params:{}},flickr:{api:KR.FlickrAPI,extend:!0,params:{}},kml:{api:KR.KmlAPI,params:{}},gpx:{api:KR.GpxAPI,params:{}},geojson:{api:KR.GeoJsonAPI,params:{}},lokalhistoriewiki:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/http://test.lokalhistoriewiki.no:8080/api.php",linkBase:"http://lokalhistoriewiki.no/?curid=",maxRadius:1e5}},jernbanemuseet:{api:KR.JernbanemuseetAPI,extend:!0,params:{lang:"no"}}},l=b();return{getData:e,getWithin:g,getBbox:f,getMunicipalityBounds:h,getCountyBounds:i,getItem:j,getCollection:function(a,b,c){var e=d("norvegiana");e.getCollection(a,b,c)},addApi:function(a,c,d){if(_.has(k,a))throw new Error("API with name "+a+" already exists");d=d||{},k[a]={api:c,params:d},l=b()}}},KR.API.mappers={}; +/*! KNreiseAPI 1.7.22 2015-11-27 */ +var KR=this.KR||{};KR.Util={},function(a){"use strict";function b(a){return a*Math.PI/180}a.dictWithout=function(a){var b=_.without(_.keys(a),Array.prototype.slice.call(arguments,1));return _.reduce(b,function(b,c){return b[c]=a[c],b},{})},a.createQueryParameterString=function(a){return _.map(a,function(a,b){return encodeURIComponent(b)+"="+encodeURIComponent(a)}).join("&")},a.handleError=function(a,b,c){if(a)return void a({error:b,data:c});throw new Error(b)},a.sendRequest=function(b,c,d,e,f){return f=f||{},$.ajax({type:"get",beforeSend:function(a){_.each(f,function(b,c){a.setRequestHeader(c,b)})},url:b,success:function(b){if(c){var f;try{f=c(b,e)}catch(g){return void a.handleError(e,g.message,b)}_.isUndefined(f)||d(f)}else d(b)},error:e})},a.createGeoJSONFeature=function(a,b,c){return b=b||{},{type:"Feature",geometry:{type:"Point",coordinates:[a.lng,a.lat]},properties:b,id:c}},a.createGeoJSONFeatureFromGeom=function(a,b,c){return b=b||{},{type:"Feature",geometry:a,properties:b,id:c}},a.createFeatureCollection=function(a){return{type:"FeatureCollection",features:a}},a.stamp=function(){var a=0,b="_knreise_id";return function(c){return c[b]=c[b]||++a,c[b]}}(),a.haversine=function(a,c,d,e){var f=6371e3,g=b(a),h=b(d),i=b(d-a),j=b(e-c),k=Math.sin(i/2)*Math.sin(i/2)+Math.cos(g)*Math.cos(h)*Math.sin(j/2)*Math.sin(j/2),l=2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k));return f*l},a.splitBbox=function(a){return a.split(",").map(parseFloat)},a.addCrossorigin=function(a){return 0!==a.indexOf("http://crossorigin.me/")?"http://crossorigin.me/"+a:a}}(KR.Util);var KR=this.KR||{};KR.ArcgisAPI=function(a,b){"use strict";function c(a){return a=KR.Util.splitBbox(a),JSON.stringify({xmin:a[0],ymin:a[1],xmax:a[2],ymax:a[3]})}function d(a,b,c){b=JSON.parse(b);var d=b.features,e=_.map(a.features,function(a){var b=_.find(d,function(b){return b.attributes[c.matchId]===a.properties[c.matchId]});b&&(b=b.attributes,a.properties.thumbnail=b.UrlTilBilde);var e=_.extend(a.properties,{extra:b});return KR.Util.createGeoJSONFeatureFromGeom(a.geometry,e,a.id)});return KR.Util.createFeatureCollection(e)}function e(a,b,c,e){var f=_.map(a.features,function(a){return a.properties[b.matchId]}),g={where:b.matchId+" IN ("+f.join(",")+")",outFields:"*",returnGeometry:!1,returnIdsOnly:!1,returnCountOnly:!1,returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"pjson"},i=h+b.extraDataLayer+"/query";$.ajax({type:"POST",url:i,data:KR.Util.createQueryParameterString(g),success:function(e){c(d(a,e,b))},error:function(b){c(a)}})}function f(b,c,d,f){try{b=JSON.parse(b)}catch(g){}return _.has(b,"error")?void KR.Util.handleError(d,b.error.message):void esri2geo.toGeoJSON(b,function(b,g){b?c(KR.Util.createFeatureCollection([])):(_.each(g.features,function(b){_.has(b.properties,"Navn")&&(b.properties.title=b.properties.Navn),b.id=a+"_"+b.properties.OBJECTID}),f.getExtraData?e(g,f,c,d):c(g))})}function g(a,b,d,e){var g={geometry:c(b),geometryType:"esriGeometryEnvelope",inSR:4326,spatialRel:"esriSpatialRelIntersects",outFields:"*",returnGeometry:!0,outSR:4326,returnIdsOnly:!1,returnCountOnly:!1,outStatistics:"",returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"json"};a.query&&(g.where=a.query);var i=a.layer,j=h+i+"/query?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(j,null,function(b){f(b,d,e,a)},e)}var h=b.url;return{getBbox:g}};var KR=this.KR||{};KR.CartodbAPI=function(a,b){"use strict";function c(a){return"http://"+a+".cartodb.com/api/v2/sql"}function d(a){return function(b){var c=_.map(b.rows,function(b){var c=JSON.parse(b.geom),d=_.reduce(b,function(b,c,d){if(_.has(a,d)){var e=a[d];_.isArray(e)?_.each(e,function(a){b[a]=c}):b[e]=c}return b},{});return{type:"Feature",geometry:c,properties:d}});return KR.Util.createFeatureCollection(c)}}function e(){return _.reduce(r,function(a,b,c){return a[c]=d(b),a},{cartodb_general:function(a){var b=_.map(a.rows,function(a){var b=JSON.parse(a.geom);return{type:"Feature",geometry:b,properties:_.omit(a,"geom")}});return KR.Util.createFeatureCollection(b)}})}function f(a,b,d,e,f){var g={q:a},h=f||q,i=c(h)+"?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(i,b,d,e)}function g(a){var b=a.rows[0].st_extent;return b.replace("BOX(","").replace(")","").replace(/ /g,",")}function h(a,b,c){var d=["SELECT "+a,"FROM "+b];return c&&d.push("WHERE "+c),d.join(" ")}function i(a,b){return"ST_DWithin(the_geom::geography,'POINT("+a.lng+" "+a.lat+")'::geography, "+b+");"}function j(a){var b=a.mapper;return b||(b=e().cartodb_general),b}function k(a){return _.isArray(a)?a:[a]}function l(a,b,c){var d=h("ST_Extent(the_geom)","kommuner","komm in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function m(a,b,c){var d=h("ST_Extent(the_geom)","fylker","fylkesnr in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function n(a,b,c){var d,e=j(a);if(a.query)d=a.query;else if(a.table){var g=a.columns;g||(g=["*"]),_.has(r,a.table)&&(g=_.keys(r[a.table])),g.push("ST_AsGeoJSON(the_geom) as geom"),d="SELECT "+g.join(", ")+" FROM "+a.table}else a.county?d=h("ST_AsGeoJSON(the_geom) as geom","fylker","fylkesnr in ("+k(a.county).join(", ")+")"):a.municipality&&(d=h("ST_AsGeoJSON(the_geom) as geom","kommuner","komm in ("+k(a.municipality).join(", ")+")"));d&&f(d,e,b,c)}function o(a,b,c,d){var e=a.columns;e||(e=["*"]),e.push("ST_AsGeoJSON(the_geom) as geom");var g=h(e.join(", "),a.table,"ST_Intersects(the_geom, ST_MakeEnvelope("+b+", 4326))"),i=j(a);f(g,i,c,d)}function p(a,b,c,d,e){var g=_.keys(r["default"]).concat(["ST_AsGeoJSON(the_geom) as geom"]).join(", "),j=h(g,a.table,i(b,c));f(j,s,d,e)}var q=b.user,r={"default":{delving_thumbnail:["images","thumbnail"],dc_title:"title",dc_description:"content",europeana_isshownat:"link",europeana_collectiontitle:"dataset",abm_contentProvider:"provider",europeana_type:"contentType",delving_landingpage:"video"},pilegrimsleden_dovre:{iid:"id",name:"name",omradenavn:"omradenavn"}},s=d(r["default"]);return{getBbox:o,getData:n,getWithin:p,getMunicipalityBounds:l,getCountyBounds:m,mappers:e}};var KR=this.KR||{};KR.NorvegianaAPI=function(a){"use strict";function b(a){return a.lat+","+a.lng}function c(a){return a&&a.length?a[0]:null}function d(a){return a&&-1!==a.indexOf("www.youtube.com/watch")?"https://www.youtube.com/embed/"+a.substr(a.indexOf("watch?v=")+8):a}function e(a){return _.chain(a.item.fields).pairs().where(function(a){return"abm_latLong"!==a[0]}).reduce(function(a,b){return a[b[0]]=b[1],a},{}).value()}function f(a){var b=75;return a&&a.indexOf("width=")>-1&&a.indexOf("height=")>-1?a.replace(/(width=)(\d+)/g,"$1"+b).replace(/(height=)(\d+)/g,"$1"+b):a}function g(a,b){return _.chain(b).reduce(function(b,c){return _.has(a,c)&&(b=b.concat(a[c])),b},[]).uniq().value()}function h(a){return _.chain(a).map(function(a,b){return _.map(a,function(a){return{type:b,url:a}})}).flatten().value()}function i(a){var b=c(a.delving_thumbnail),e=g(a,["delving_thumbnail","abm_imageUri"]),i={video:_.map(a.abm_videoUri,d),sound:a.abm_soundUri,image:e};return{thumbnail:f(b),images:e,title:c(a.dc_title),content:_.map(a.dc_description,function(a){return"

"+a+"

"}).join("\n"),link:c(a.europeana_isShownAt),dataset:c(a.europeana_collectionTitle),provider:c(a.abm_contentProvider),contentType:c(a.europeana_type),video:c(a.abm_videoUri),videoEmbed:d(c(a.abm_videoUri)),sound:c(a.abm_soundUri),allProps:a,media:h(i)}}function j(b){var c,d=e(b),f=i(d),g=_.map(b.item.fields.abm_latLong[0].split(","),parseFloat);_.has(d,"delving_hubId")&&(c=a+"_"+d.delving_hubId[0]);var h=KR.Util.createGeoJSONFeature({lat:g[0],lng:g[1]},f,c);return h}function k(a){var b;a.result.pagination.hasNext&&(b=a.result.pagination.nextPage);var c=_.map(a.result.items,j),d=KR.Util.createFeatureCollection(c);return d.numFound=a.result.pagination.numFound,{geoJSON:d,nextPage:b}}function l(a,b,c){var d=[];return function e(f){if(d.push(f.geoJSON),f.nextPage)return void KR.Util.sendRequest(a+"&start="+f.nextPage,k,e,c);var g=_.reduce(d,function(a,b){return a.concat(b.features)},[]);b(KR.Util.createFeatureCollection(g))}}function m(a){return a=_.isArray(a)?a:[a],_.map(a,function(a){return"delving_spec:"+a}).join(" OR ")}function n(a){x[a]&&(x[a].abort(),x[a]=null)}function o(a,b,c){return KR.Util.sendRequest(a,k,function(a){b(a.geoJSON)},c)}function p(a,b,c){return KR.Util.sendRequest(a,k,l(a,b,c),c)}function q(a,b,c,d,e){var f=m(b.dataset);a=_.extend({query:f,format:"json",rows:1e3},a),a.query+=" delving_hasGeoHash:true";var g=f;b.query&&(a.qf=b.query,g+=b.query),n(g);var h=y+"?"+KR.Util.createQueryParameterString(a);e.allPages?x[g]=p(h,c,d):x[g]=o(h,c,d)}function r(a,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(j,k,l,k),KR.Util.haversine(l,g,l,k)]),n={pt:b({lat:l,lng:k}),d:m/1e3,geoType:"bbox"};q(n,a,d,e,f)}function s(a,c,d,e,f,g){var h={pt:b(c),d:d/1e3};q(h,a,e,f,g)}function t(a,b,c,d){if(a.query&&_.isArray(a.query)){var e="delving_spec:"+a.dataset+" AND ("+a.query.join(" OR ")+") AND delving_hasGeoHash:true",f={query:e,format:"json",rows:1e3},g=e;n(g);var h=y+"?"+KR.Util.createQueryParameterString(f);return void(d.allPages?x[g]=p(h,b,c):x[g]=o(h,b,c))}q({},a,b,c,d)}function u(a,b,c){var d={id:a.id,format:"json"},e=y+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(a){return j(a.result)},b,c)}function v(b){var c=_.map(b.geo_json.features,function(b){var c,d=i(b.properties);return _.has(d.allProps,"delving_hubId")&&(c=a+"_"+d.allProps.delving_hubId),b.properties=d,b.id=c,b});return b.geo_json=KR.Util.createFeatureCollection(c),b}function w(a,b,c){var d=z+a;KR.Util.sendRequest(d,v,b,c)}var x=[],y="http://kulturnett2.delving.org/api/search",z="http://acc.norvegiana.delving.org/en/api/knreise-collection/";return{getWithin:s,getItem:u,getBbox:r,getData:t,getCollection:w}};var KR=this.KR||{};KR.WikipediaAPI=function(a,b){"use strict";function c(a,b){var c=n+"?"+KR.Util.createQueryParameterString(a);KR.Util.sendRequest(c,null,function(a){try{a=JSON.parse(a)}catch(c){}b(a)})}function d(a,b){function d(f){if(_.each(f.query.pages,function(a,b){_.has(e,b)?e[b]=_.extend(e[b],a):e[b]=a}),_.has(f,"continue")){var g={};_.has(f["continue"],"picontinue")&&(g.picontinue=f["continue"].picontinue),_.has(f["continue"],"excontinue")&&(g.excontinue=f["continue"].excontinue);var h=_.extend(g,a);c(h,d)}else b(e)}var e={};c(a,d)}function e(a){var b="http://upload.wikimedia.org/wikipedia/commons/",c=CryptoJS.MD5(a).toString();return b+c.substr(0,1)+"/"+c.substr(0,2)+"/"+a}function f(a,b){var c={action:"query",prop:"extracts|pageimages",exlimit:"max",exintro:"",pilimit:"max",pageids:a,format:"json","continue":""};d(c,b)}function g(b,c){c=c||{};var d=c[b.pageid];d&&(b=_.extend(b,d));var f;_.has(b,"thumbnail")&&(f=b.thumbnail.source);var g=null;b.pageimage&&(g=[e(b.pageimage)]);var h=o+b.pageid,i={thumbnail:f,images:g,title:b.title,content:b.extract,link:h,dataset:"Wikipedia",provider:"Wikipedia",contentType:"TEXT",id:b.pageid};return KR.Util.createGeoJSONFeature({lat:b.lat,lng:b.lon},i,a+"_"+b.pageid)}function h(a,b,c){try{a=JSON.parse(a)}catch(d){}try{var e=_.pluck(a.query.geosearch,"pageid");e.length?f(e.join("|"),function(c){var d=_.map(a.query.geosearch,function(a){return g(a,c)});b(KR.Util.createFeatureCollection(d))}):b(KR.Util.createFeatureCollection([]))}catch(h){KR.Util.handleError(c,a.error.info)}}function i(a,b,c,d,e){if(c>m)return void KR.Util.handleError(e,"to wide search radius (max is "+m+")");var f={action:"query",list:"geosearch",gsradius:c,gscoord:b.lat+"|"+b.lng,format:"json",gslimit:50},g=n+"?"+KR.Util.createQueryParameterString(f);KR.Util.sendRequest(g,null,function(a){h(a,d,e)},e)}function j(a){var b=_.chain(a).reduce(function(a,b){return _.each(b,function(b,c){_.has(a,c)?a[c]=_.extend(a[c],b):a[c]=b}),a},{}).filter(function(a){return _.has(a,"coordinates")}).map(function(a){return a.lat=a.coordinates[0].lat,a.lon=a.coordinates[0].lon,a}).map(g).value();return KR.Util.createFeatureCollection(b)}function k(a,b,c,d){function e(a){var d=_.extend({},f,a),h=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(h,null,function(a){g.push(a.query.pages),_.has(a,"continue")?e(a["continue"]):b(j(g))},c)}var f={action:"query",generator:"categorymembers",gcmtitle:"Kategori:"+a.category,prop:"coordinates",format:"json"},g=[];e({"continue":""})}function l(a,b,c){var d={action:"query",pageids:a.id,prop:"coordinates|pageimages|extracts",format:"json"},e=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(b){return g(b.query.pages[a.id])},b,c)}var m=b.maxRadius||1e4,n=b.url,o=b.linkBase;return{getWithin:i,getData:k,getItem:l}};var KR=this.KR||{};KR.UtnoAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");if("gpx"===a.type){var d="http://ut.no/tur/"+a.id+"/gpx/";KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}else KR.Util.handleError(c,"Unknown type "+a.type)}return{getData:b}};var KR=this.KR||{};KR.FolketellingAPI=function(a){"use strict";function b(b){var c=_.map(b.results,function(b){var c=KR.Util.dictWithout(b,"latitude","longitude"),d={lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)};return KR.Util.createGeoJSONFeature(d,c,a+"_"+b.autoid)});return KR.Util.createFeatureCollection(c)}function c(a,c,d,e,f,i){var j=a.limit||1e3;if("property"!==a.dataset)return void KR.Util.handleError(f,"unknown dataset "+a.dataset);if(d>h)return void KR.Util.handleError(f,"to wide search radius");var k={latitude:c.lat,longitude:c.lng,precision:d,limit:j},l=g+"search_property_geo?"+KR.Util.createQueryParameterString(k);KR.Util.sendRequest(l,b,e,f)}function d(a,b,c){if(0===a.property.id.indexOf("gf")){if(!a.apartments)return a.apartments=null,void b({properties:a});var d=[],e=_.after(a.apartments.length,function(){a.apartments=d,b({properties:a})});return void _.each(a.apartments,function(a){f({type:"apartmentData",apartmentId:a.id},function(a){d.push(a),e()})})}b({properties:a})}function e(a){return a.apartments||(a.apartments=null),{properties:a}}function f(a,b,c,f){var h;"propertyData"===a.type&&a.propertyId?(h=g+"property/"+a.propertyId,a.withPersons?KR.Util.sendRequest(h,null,function(a){d(a,b,c)},c):KR.Util.sendRequest(h,e,b,c)):"apartmentData"===a.type&&a.apartmentId?(h=g+"property/"+a.apartmentId,KR.Util.sendRequest(h,null,b,c)):KR.Util.handleError(c,"Not enough parameters")}var g="http://api.digitalarkivet.arkivverket.no/v1/census/1910/",h=5e3;return{getData:f,getWithin:c}};var KR=this.KR||{};KR.SparqlAPI=function(a,b){"use strict";function c(a){if("undefined"==typeof proj4)throw new Error("Proj4js not found!");return proj4("EPSG:32633","EPSG:4326",a)}function d(a){return a=wellknown.parse(a.value),"Point"===a.type&&(a.coordinates=c(a.coordinates)),"Polygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a,c)})),"MultiPolygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a.coordinates,function(a){return _.map(a,c)})})),a}function e(b,c){var e=_.map(b.results.bindings,function(b){var c=_.without(_.keys(b),"point","omraade"),e=_.reduce(c,function(a,c){return a[c]=b[c].value,a},{});return e.img||(e.img=!1),e.title=e.name,e.license||(e.license=o),_.has(b,"point")?KR.Util.createGeoJSONFeatureFromGeom(d(b.point),e,a+"_"+e.id):_.has(b,"omraade")?KR.Util.createGeoJSONFeatureFromGeom(d(b.omraade),e,a+"_"+e.id):null});return KR.Util.createFeatureCollection(e)}function f(a,b){var c=a.results.bindings;if(!c||0===c.length)return void KR.Util.handleError(b);var e=_.map(c,function(a){return a.lok.type="Polygon",KR.Util.createGeoJSONFeatureFromGeom(d(a.lok),{})}),f=_.map(e,function(a){return a.geometry}),g={type:"GeometryCollection",geometries:f};return KR.Util.createGeoJSONFeatureFromGeom(g,{})}function g(a,b,c,d){var e={"default-graph-uri":"",query:a,format:"application/sparql-results+json",timeout:0,debug:"off"},f=p+"?"+KR.Util.createQueryParameterString(e);KR.Util.sendRequest(f,b,c,d)}function h(a){if(a.kommune){var b="select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?locart ; ?org ; ?p ; ?point . optional { ?loccat rdfs:label ?loccatlabel .} optional { ?locart rdfs:label ?locartlabel .} optional { ?org rdfs:label ?orglabel .} BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link . ?picture rdfs:label ?picturelabel . ?picture dc:description ?picturedescription . ?picture ?picturelicence . BIND(REPLACE(STR(?link), "http://kulturminnebilder.ra.no/fotoweb/default.fwx\\\\?search\\\\=", "") AS ?linkid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?linkid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?linkid) AS ?thumbnail) } ';return a.filter&&(b+=" "+a.filter),b+="}",a.limit&&(b+="LIMIT "+a.limit),b}}function i(a){if(a.fylke){var b=parseInt(a.fylke,10);10>b&&(b="0"+b);var c=' select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?locart ; ?org ; ?kommune ; ?point . optional { ?loccat rdfs:label ?loccatlabel .} optional { ?locart rdfs:label ?locartlabel .} optional { ?org rdfs:label ?orglabel .} BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link . ?picture rdfs:label ?picturelabel . ?picture dc:description ?picturedescription . ?picture ?picturelicence . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) } FILTER regex(?kommune, "^.*'+b+'[1-9]{2}") . ';return a.filter&&(c+=" "+a.filter),c+=" } order by ?img",a.limit&&(c+="LIMIT "+a.limit),c}}function j(a){return"SELECT ?lok where { <"+a.trim()+"> ?lok . }"}function k(a){return"SELECT ?enk as ?id ?name ?desc as ?content ?area as ?omraade ?enkcatlabel where { ?enk a . ?enk rdfs:label ?name . ?enk <"+a.trim()+"> . ?enk ?desc . ?enk ?area . ?enk ?enkcat . ?enkcat rdfs:label ?enkcatlabel . } "}function l(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var e=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(e))});_.each(d,function(a){g(j(a),f,function(b){b.properties.lok=a,e.push(b),h()},c)})}function m(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var f=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d,function(a){g(k(a),e,function(b){var c=_.map(b.features,function(b){return b.properties.lokalitet=a,b});f=f.concat(c),h()},c)})}function n(a,b,c,d){if(a=_.extend({},{geomType:"point"},a),a.kommune){var f=h(a,c);g(f,e,b,c)}else if(a.fylke){var f=i(a,c);g(f,e,b,c)}else a.lokalitet&&"lokalitetpoly"===a.type?l(a,b,c):a.lokalitet&&"enkeltminner"===a.type?m(a,b,c):a.sparqlQuery?g(a.sparqlQuery,e,b,c):KR.Util.handleError(c,"not enough parameters")}var o=b.licenseText||"http://data.norge.no/nlod/no",p=b.url;return"undefined"!=typeof proj4&&proj4.defs([["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),{getData:n}};var KR=this.KR||{};KR.FlickrAPI=function(a,b){"use strict";function c(a,b){return l(_.extend({size:b},a))}function d(b,d){if(b.stat&&"fail"===b.stat)return void KR.Util.handleError(d,b.message,b);var e=_.chain(b.photos.photo).filter(function(a){var b=parseFloat(a.latitude),c=parseFloat(a.longitude);return 0!=b||0!=c}).map(function(b){var d=KR.Util.dictWithout(b,"latitude","longitude");return d.thumbnail=c(b,"s"),d.image=c(b,"z"),KR.Util.createGeoJSONFeature({lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)},d,a+"_"+b.id)}).value();return KR.Util.createFeatureCollection(e)}function e(a,b,c){function e(e){var h=d(e,c);if(h&&h.features&&(g=g.concat(h.features)),e.photos&&e.photos.page.staticflickr.com/<%= server %>/<%= id %>_<%= secret %>_<%= size %>.jpg");return{getData:i,getWithin:g,getBbox:h}};var KR=this.KR||{};KR.KmlAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.kml,b,c)}return{getData:b}};var KR=this.KR||{};KR.GpxAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}return{getData:b}};var KR=this.KR||{};KR.GeoJsonAPI=function(a){"use strict";function b(a,b,c){var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,JSON.parse,b,c)}return{getData:b}};var KR=this.KR||{};KR.JernbanemuseetAPI=function(a,b){"use strict";function c(a){return _.has(a,"group")?a.group:l}function d(){return{"api-key":o}}function e(b){var c=_.map(b.data.records,function(b){var c,d=_.extend(b.contents[m],{id:b.record_id});return _.has(b,"latitude")&&_.has(b,"longitude")?c={lat:b.latitude,lng:b.longitude}:_.has(b,"location")?c={lat:b.location.latitude,lng:b.location.longitude}:console.error("no geometry"),KR.Util.createGeoJSONFeature(c,d,a+"_"+b.record_id)});return KR.Util.createFeatureCollection(c)}function f(a){return _.map(a.blocks,function(a){if("text"===a.type)return{text:a.data,type:a.type};if("image_video"===a.type||"audio"===a.type){var b=_.map(a.data,function(a){var b;"image"===a.type&&(b=a.url),"video"===a.type&&(b=a.url.mp4),"audio"===a.type&&(b=a.url.ogg);var c="",d="";return _.has(a.contents,m)&&(c=a.contents[m].description,d=a.contents[m].title),{title:d,description:c,type:a.type,url:b}});return{media:b,type:a.type}}return"links"===a.type?{links:a.data,type:"links"}:void 0})}function g(b){var c,d,e=b.data.contents[m],g={lat:b.data.location.latitude,lng:b.data.location.longitude},h=b.data.id,i=_.map(e.pages,function(a){return{title:a.title,blocks:f(a)}});b.data.images.length&&(c=_.pluck(b.data.images,"url"),d=b.data.images[0].thumbnail);var j={license:b.data.license.description,id:h,thumbnail:d,images:c,title:e.title,description:e.description,pages:i};return KR.Util.createGeoJSONFeature(g,j,a+"_"+h)}function h(a,b,e){var f=n+"/groups/"+c(a)+"/records/"+a.id+"?strip_html=true";KR.Util.sendRequest(f,g,b,e,d())}function i(a,b,c){var d=e(a),f=[],g=_.after(d.features.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d.features,function(a){h(a.properties.id,function(a){f.push(a),g()},function(){g()})})}function j(a,b,f,g,h,j){var k={lat:b.lat,"long":b.lng,radius:f},l=n+"/groups/"+c(a)+"/nearby?"+KR.Util.createQueryParameterString(k);j.getDetails?KR.Util.sendRequest(l,null,function(a){i(a,g,h)},null,d()):KR.Util.sendRequest(l,e,g,h,d())}function k(a,b,f,g){var h=n+"/groups/"+c(a)+"/geography";g.getDetails?KR.Util.sendRequest(h,null,function(a){i(a,b,f)},null,d()):(a.presentation&&(h="https://api.kulturpunkt.org/v2/owners/54/presentations/"+a.presentation),KR.Util.sendRequest(h,e,b,f,d()))}var l=192,m=b.lang||"no",n="https://api.kulturpunkt.org/v2/owners/54",o=b.apikey;return{getData:k,getWithin:j,getItem:h}};var KR=this.KR||{};KR.API=function(a){"use strict";function b(){return _.reduce(k,function(b,c,d){var e=c.params;return c.extend&&(e=_.extend(e,a[d])),b[d]=new c.api(d,e),b},{})}function c(a,b,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(h,g,l,k),KR.Util.haversine(j,i,l,k)]),n={lat:l,lng:k};a.getWithin(b,n,m,d,e,f)}function d(a){var b=l[a];if(b)return b;throw new Error("Unknown API")}function e(a,b,c,e){e=e||{};var f=d(a.api);f.getData(a,b,c,e)}function f(a,b,e,f,g){g=g||{};var h=d(a.api);_.has(h,"getBbox")?h.getBbox(a,b,e,f,g):c(h,a,b,e,f,g)}function g(a,b,c,e,f,g){g=g||{},c=c||5e3;var h=d(a.api);h.getWithin(a,b,c,e,f,g)}function h(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getMunicipalityBounds(a,b,c)}function i(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getCountyBounds(a,b,c)}function j(a,b,c){var e=d(a.api);if(_.has(e,"getItem"))e.getItem(a,b,c);else{if(!c)throw new Error("No getItem function for api "+a.api);c("No getItem function for api "+a.api)}}a=a||{};var k={norvegiana:{api:KR.NorvegianaAPI,params:{}},wikipedia:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://no.wikipedia.org/w/api.php",linkBase:"http://no.wikipedia.org/?curid="}},wikipediaNN:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://nn.wikipedia.org/w/api.php",linkBase:"http://nn.wikipedia.org/?curid="}},cartodb:{api:KR.CartodbAPI,extend:!0,params:{user:"knreise"}},kulturminnedata:{api:KR.ArcgisAPI,params:{url:"http://husmann.ra.no/arcgis/rest/services/Husmann/Husmann/MapServer/"}},kulturminnedataSparql:{api:KR.SparqlAPI,params:{url:"https://sparql.kulturminne.no/"}},utno:{api:KR.UtnoAPI,params:{}},folketelling:{api:KR.FolketellingAPI,params:{}},flickr:{api:KR.FlickrAPI,extend:!0,params:{}},kml:{api:KR.KmlAPI,params:{}},gpx:{api:KR.GpxAPI,params:{}},geojson:{api:KR.GeoJsonAPI,params:{}},lokalhistoriewiki:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/http://test.lokalhistoriewiki.no:8080/api.php",linkBase:"http://lokalhistoriewiki.no/?curid=",maxRadius:1e5}},jernbanemuseet:{api:KR.JernbanemuseetAPI,extend:!0,params:{lang:"no"}}},l=b();return{getData:e,getWithin:g,getBbox:f,getMunicipalityBounds:h,getCountyBounds:i,getItem:j,getCollection:function(a,b,c){var e=d("norvegiana");e.getCollection(a,b,c)},addApi:function(a,c,d){if(_.has(k,a))throw new Error("API with name "+a+" already exists");d=d||{},k[a]={api:c,params:d},l=b()}}},KR.API.mappers={}; /*! leaflet.knreise-markers - v0.0.0 - 2015-10-27 */!function(){"use strict";L.KNreiseMarkers={};var a="m 17.55,4.1951017 c -9.6366105,0 -17.4496113,7.4402593 -17.4496113,16.6171183 0,5.366984 4.6259821,10.878443 7.9062546,15.588509 C 13.057202,43.652706 17.55,49.004896 17.55,49.004896 c 0,0 4.461376,-5.052713 9.506171,-12.22664 3.296987,-4.688464 7.94344,-10.282935 7.94344,-15.965121 0,-9.177774 -7.813,-16.6180333 -17.449611,-16.6180333 z";L.KNreiseMarkers.Icon=L.Icon.extend({options:{iconSize:[35,45],iconAnchor:[17,42],popupAnchor:[1,-32],shadowAnchor:[10,12],shadowSize:[36,16],className:"awesome-marker",extraClasses:"",markerColor:"#ff0000"},initialize:function(a){return a=L.Util.setOptions(this,a)},createIcon:function(b){var c,d;return c=b&&"DIV"===b.tagName?b:document.createElement("div"),d=this.options,c.innerHTML='',this._setIconStyles(c,"icon"),this._setIconStyles(c,"icon-"+d.markerColor),c},_setIconStyles:function(a,b){var c,d=this.options,e=L.point(d["shadow"===b?"shadowSize":"iconSize"]);c="shadow"===b?L.point(d.shadowAnchor||d.iconAnchor):L.point(d.iconAnchor),!c&&e&&(c=e.divideBy(2,!0)),a.className="awesome-marker-"+b+" "+d.className,c&&(a.style.marginLeft=-c.x+"px",a.style.marginTop=-c.y+"px"),e&&(a.style.width=e.x+"px",a.style.height=e.y+"px")},createShadow:function(){var a;return a=document.createElement("div"),this._setIconStyles(a,"shadow"),a}}),L.KNreiseMarkers.icon=function(a){return new L.KNreiseMarkers.Icon(a)}}(); L.Control.Sidebar=L.Control.extend({includes:L.Mixin.Events,options:{closeButton:true,position:"left",autoPan:true},initialize:function(placeholder,options){L.setOptions(this,options);var content=L.DomUtil.get(placeholder);content.parentNode.removeChild(content);this._contentContainer=L.DomUtil.create("div","sidebar-content",content);var l="leaflet-";var container=this._container=L.DomUtil.create("div",l+"sidebar "+this.options.position);L.DomUtil.addClass(content,l+"control");container.appendChild(content);if(this.options.closeButton){var close=this._closeButton=L.DomUtil.create("a","close",container);close.innerHTML="×"}},addTo:function(map){var container=this._container;var content=this._contentContainer;if(this.options.closeButton){var close=this._closeButton;L.DomEvent.on(close,"click",this.hide,this)}L.DomEvent.on(container,"transitionend",this._handleTransitionEvent,this).on(container,"webkitTransitionEnd",this._handleTransitionEvent,this);var controlContainer=map._controlContainer;controlContainer.insertBefore(container,controlContainer.firstChild);this._map=map;var stop=L.DomEvent.stopPropagation;L.DomEvent.on(content,"click",stop).on(content,"mousedown",stop).on(content,"touchstart",stop).on(content,"dblclick",stop).on(content,"mousewheel",stop).on(content,"MozMousePixelScroll",stop);return this},removeFrom:function(map){this.hide();var content=this._contentContainer;var controlContainer=map._controlContainer;controlContainer.removeChild(this._container);this._map=null;var stop=L.DomEvent.stopPropagation;L.DomEvent.off(content,"click",stop).off(content,"mousedown",stop).off(content,"touchstart",stop).off(content,"dblclick",stop).off(content,"mousewheel",stop).off(content,"MozMousePixelScroll",stop);L.DomEvent.off(container,"transitionend",this._handleTransitionEvent,this).off(container,"webkitTransitionEnd",this._handleTransitionEvent,this);if(this._closeButton&&this._close){var close=this._closeButton;L.DomEvent.off(close,"click",this.hide,this)}return this},isVisible:function(){return L.DomUtil.hasClass(this._container,"visible")},show:function(){if(!this.isVisible()){L.DomUtil.addClass(this._container,"visible");if(this.options.autoPan){this._map.panBy([-this.getOffset()/2,0],{duration:.5})}this.fire("show")}},hide:function(e){if(this.isVisible()){L.DomUtil.removeClass(this._container,"visible");if(this.options.autoPan){this._map.panBy([this.getOffset()/2,0],{duration:.5})}this.fire("hide")}if(e){L.DomEvent.stopPropagation(e)}},toggle:function(){if(this.isVisible()){this.hide()}else{this.show()}},getContainer:function(){return this._contentContainer},getCloseButton:function(){return this._closeButton},setContent:function(content){this.getContainer().innerHTML=content;return this},getOffset:function(){if(this.options.position==="right"){return-this._container.offsetWidth}else{return this._container.offsetWidth}},_handleTransitionEvent:function(e){if(e.propertyName=="left"||e.propertyName=="right")this.fire(this.isVisible()?"shown":"hidden")}});L.control.sidebar=function(placeholder,options){return new L.Control.Sidebar(placeholder,options)}; diff --git a/dist/style.css b/dist/style.css index 0e19e7ff..73383994 100644 --- a/dist/style.css +++ b/dist/style.css @@ -1 +1 @@ -#map,.alert{position:absolute;bottom:0}#map{top:0;left:0;right:0}.alert{left:10%;right:10%;z-index:3000}.active .leaflet-bar-part{background-color:#ddd!important}.leaflet-marker-favicon .outer{position:relative}.leaflet-marker-favicon .outer i{position:absolute;top:0;left:0}.leaflet-marker-favicon .outer i.rot1{position:absolute;top:-2px;left:-2px;-ms-transform:rotate(-10deg);-webkit-transform:rotate(-10deg);transform:rotate(-10deg)}.leaflet-marker-favicon .outer i.rot2{position:absolute;top:2px;left:2px;-ms-transform:rotate(10deg);-webkit-transform:rotate(10deg);transform:rotate(10deg)}.leaflet-marker-circle .outer{position:relative}.leaflet-marker-circle div{background-position:center center;background-repeat:no-repeat;background-size:cover;height:100%;width:100%}.leaflet-marker-circle b,.leaflet-marker-photo b{background-color:#fff;border-radius:8px;box-shadow:0 3px 14px rgba(0,0,0,.4);box-sizing:initial;color:#555;font-size:8px;height:8px;line-height:8px;min-width:8px;padding:3px;position:absolute;text-align:center;right:-7px;top:-7px}.knreise-sidebar .list-btn,.knreise-sidebar .top-text{margin-left:15px;margin-top:15px;color:#333}.leaflet-marker-photo b{right:2px;top:2px}.circle{border-radius:50%;behavior:url(PIE.htc);border:2px solid #fff}#sidebar{overflow:none;padding:0;position:relative;height:100%}#sidebar .fullwidth{width:100%;margin-bottom:15px}#sidebar .sidebar-content{bottom:0;overflow:auto;padding:15px;position:absolute;top:50px;width:100%}#sidebar .sidebar-content h5{padding-bottom:5px;padding-left:5px;padding-top:5px}.knreise-sidebar .awesome-marker{position:relative}.knreise-sidebar .thumbnail{margin-bottom:0;padding:0;border-width:2px}.knreise-sidebar .list-btn{opacity:.5;cursor:pointer}.knreise-sidebar .prev-next-arrows{position:absolute;top:50%;z-index:4000}.knreise-sidebar .prev-next-arrows .glyphicon{top:2px}.knreise-sidebar .prev{color:#fff!important;left:-10px}.knreise-sidebar .next{color:#fff!important;right:-10px}.knreise-sidebar .circle,.knreise-sidebar .headertext{color:#000;display:block;height:30px;margin-left:10px;font-weight:700;margin-top:10px}@media (max-width:770px){.knreise-sidebar .prev{left:-5px}.knreise-sidebar .next{right:5px}.leaflet-sidebar .close{top:12px}}.knreise-sidebar .next.active,.knreise-sidebar .prev.active{background-color:#A5A5A5;cursor:pointer}.knreise-sidebar .circle{background-color:#ddd;border-radius:15px;box-shadow:1px 1px 5px #888;font-size:14px;line-height:26px;text-align:center;width:30px}.knreise-sidebar .top-menu .circle{background-color:#fff}.knreise-sidebar .headertext{font-size:1.5em;line-height:30px}.knreise-sidebar .close,.leaflet-sidebar .close{line-height:25px;font-size:25px}.knreise-sidebar .providertext{color:#666;font-size:12px;font-weight:700;text-transform:uppercase}.fa-bars:hover{color:#000}.knreise-sidebar .top-menu{background:#F6F6F6;height:50px;left:0;position:absolute;top:0;width:100%;z-index:5000}.knreise-sidebar .close{position:relative;margin-right:10px;margin-top:10px;top:0;right:0;background:#fff;border-radius:16px;color:#333;cursor:pointer;height:31px;text-align:center;width:31px;z-index:8}.audiojs,.leaflet-sidebar .splash-image{width:100%}.knreise-sidebar .sidebar-content h3{margin-top:0}.knreise-sidebar .sidebar-link{color:#333}.knreise-sidebar .list-group-item{border:0;padding:5px;margin-bottom:5px}.knreise-sidebar .media-body{font-weight:500}.knreise-sidebar .images-list img{margin-bottom:0!important}.knreise-sidebar .media-navigation{position:relative;height:50px}.knreise-sidebar .media-navigation .circle{border-color:#8C8C8C}.knreise-sidebar .media-navigation .prev{position:absolute;color:#8C8C8C!important;left:35%}.knreise-sidebar .media-navigation .next{position:absolute;color:#8C8C8C!important;right:35%}.sidebar-table{margin-top:20px;margin-bottom:20px}.sidebar-table tr td:first-child{font-weight:700;padding-right:10px;vertical-align:top}.sidebar-image-text{margin-bottom:20px;color:grey}.leaflet-sidebar.center{right:-500px;transition:right .5s,width .5s;padding-left:0;margin-right:-500px}.leaflet-sidebar.center.visible{left:0;right:0;margin-left:auto;margin-right:auto}.leaflet-sidebar .gray{position:fixed;left:0;right:0;top:0;bottom:0;background-color:#000;opacity:.4}.leaflet-sidebar .distance{color:#6F6F6F}#splashscreen{padding-left:0;padding-right:0;background-color:rgba(0,0,0,.9);color:#E6E6E6}#splashscreen .splash-content,#splashscreen h2{margin-top:12px;padding-left:24px;padding-right:24px}#splashscreen .footer{margin-top:40px;color:rgba(255,255,255,.8)}#splashscreen a{color:#E6E6E6;text-decoration:underline}#splashscreen h2{text-transform:uppercase;margin-top:6px;font-size:25px;font-weight:400;padding-left:18px}#splashscreen .close{background:#000}@media (min-width:770px) and (max-width:1000px){#splashscreen h2{font-size:18px;font-weight:600}.center .close{top:15px}}.feedback-form{margin-top:30px;margin-bottom:30px;color:#6F6F6F}.feedback-form label{font-weight:100}.feedback-form .btn-default{color:#6F6F6F}.feedback-form .show-more{cursor:pointer}.wikipedia-content h2{font-size:18px}.leaflet-control-layers{margin-top:10px}.leaflet-control-layers .layericon{margin-left:5px;font-size:18px;cursor:pointer}.leaflet-control-layers label.disabled{color:#ddd}.leaflet-control-layers i.fa-square-o{padding-right:3px!important}i.error-icon{color:#a94442}.audiojs{display:table;height:34px}.audiojs .play-pause,.scrubber,.time{display:table-cell;float:none;height:auto;vertical-align:middle}.audiojs .play-pause{padding:0 6px}.audiojs .play-pause>p{margin:0;padding:0;height:26px}.audiojs .scrubber{width:99%;margin:0;padding:0}.audiojs .scrubber>div{position:relative;margin:0}.audiojs .scrubber>div &.progress{z-index:2}.audiojs .scrubber>div &.loaded{margin-top:-14px;z-index:1}.audiojs .time{height:20px;line-height:normal;margin:0;padding-top:2px;border-left:0;width:auto} \ No newline at end of file +#map,.alert{position:absolute;bottom:0}#map{top:0;left:0;right:0}.alert{left:10%;right:10%;z-index:3000}.active .leaflet-bar-part{background-color:#ddd!important}.leaflet-marker-favicon .outer{position:relative}.leaflet-marker-favicon .outer i{position:absolute;top:0;left:0}.leaflet-marker-favicon .outer i.rot1{position:absolute;top:-2px;left:-2px;-ms-transform:rotate(-10deg);-webkit-transform:rotate(-10deg);transform:rotate(-10deg)}.leaflet-marker-favicon .outer i.rot2{position:absolute;top:2px;left:2px;-ms-transform:rotate(10deg);-webkit-transform:rotate(10deg);transform:rotate(10deg)}.leaflet-marker-circle .outer{position:relative}.leaflet-marker-circle div{background-position:center center;background-repeat:no-repeat;background-size:cover;height:100%;width:100%}.leaflet-marker-circle b,.leaflet-marker-photo b{background-color:#fff;border-radius:8px;box-shadow:0 3px 14px rgba(0,0,0,.4);box-sizing:initial;color:#555;font-size:8px;height:8px;line-height:8px;min-width:8px;padding:3px;position:absolute;text-align:center;right:-7px;top:-7px}.knreise-sidebar .list-btn,.knreise-sidebar .top-text{margin-left:15px;margin-top:15px;color:#333}.leaflet-marker-photo b{right:2px;top:2px}.circle{border-radius:50%;behavior:url(PIE.htc);border:2px solid #fff}#sidebar{overflow:none;padding:0;position:relative;height:100%}#sidebar .fullwidth{width:100%;margin-bottom:15px}#sidebar .sidebar-content{bottom:0;overflow:auto;padding:15px;position:absolute;top:50px;width:100%}#sidebar .sidebar-content h5{padding-bottom:5px;padding-left:5px;padding-top:5px}.knreise-sidebar .awesome-marker{position:relative}.knreise-sidebar .thumbnail{margin-bottom:0;padding:0;border-width:2px}.knreise-sidebar .list-btn{opacity:.5;cursor:pointer}.knreise-sidebar .prev-next-arrows{position:absolute;top:50%;z-index:4000}.knreise-sidebar .prev-next-arrows .glyphicon{top:2px}.knreise-sidebar .prev{color:#fff!important;left:-10px}.knreise-sidebar .next{color:#fff!important;right:-10px}.knreise-sidebar .circle,.knreise-sidebar .headertext{color:#000;display:block;height:30px;margin-left:10px;font-weight:700;margin-top:10px}@media (max-width:770px){.knreise-sidebar .prev{left:-5px}.knreise-sidebar .next{right:5px}.leaflet-sidebar .close{top:12px}}.knreise-sidebar .next.active,.knreise-sidebar .prev.active{background-color:#A5A5A5;cursor:pointer}.knreise-sidebar .circle{background-color:#ddd;border-radius:15px;box-shadow:1px 1px 5px #888;font-size:14px;line-height:26px;text-align:center;width:30px}.knreise-sidebar .top-menu .circle{background-color:#fff}.knreise-sidebar .headertext{font-size:1.5em;line-height:30px}.knreise-sidebar .close,.leaflet-sidebar .close{line-height:25px;font-size:25px}.knreise-sidebar .providertext{color:#666;font-size:12px;font-weight:700;text-transform:uppercase}.fa-bars:hover{color:#000}.knreise-sidebar .top-menu{background:#F6F6F6;height:50px;left:0;position:absolute;top:0;width:100%;z-index:5000}.knreise-sidebar .close{position:relative;margin-right:10px;margin-top:10px;top:0;right:0;background:#fff;border-radius:16px;color:#333;cursor:pointer;height:31px;text-align:center;width:31px;z-index:8}.audiojs,.leaflet-sidebar .splash-image{width:100%}.knreise-sidebar .sidebar-content h3{margin-top:0}.knreise-sidebar .sidebar-link{color:#333}.knreise-sidebar .list-group-item{border:0;padding:5px;margin-bottom:5px}.knreise-sidebar .media-body{font-weight:500}.knreise-sidebar .images-list img{margin-bottom:0!important}.knreise-sidebar .media-navigation{position:relative;height:50px}.knreise-sidebar .media-navigation .circle{border-color:#8C8C8C}.knreise-sidebar .media-navigation .prev{position:absolute;color:#8C8C8C!important;left:35%}.knreise-sidebar .media-navigation .next{position:absolute;color:#8C8C8C!important;right:35%}.sidebar-table{margin-top:20px;margin-bottom:20px}.sidebar-table tr td:first-child{font-weight:700;padding-right:10px;vertical-align:top}.sidebar-image-text{margin-bottom:20px;color:grey}.leaflet-sidebar.center{right:-500px;transition:right .5s,width .5s;padding-left:0;margin-right:-500px}.leaflet-sidebar.center.visible{left:0;right:0;margin-left:auto;margin-right:auto}.leaflet-sidebar .gray{position:fixed;left:0;right:0;top:0;bottom:0;background-color:#000;opacity:.4}.leaflet-sidebar .distance{color:#6F6F6F}#splashscreen{padding-left:0;padding-right:0;background-color:rgba(0,0,0,.9);color:#E6E6E6}#splashscreen .splash-content,#splashscreen h2{margin-top:12px;padding-left:24px;padding-right:24px}#splashscreen .footer{margin-top:40px;color:rgba(255,255,255,.8)}#splashscreen a{color:#E6E6E6;text-decoration:underline}#splashscreen h2{text-transform:uppercase;margin-top:6px;font-size:25px;font-weight:400;padding-left:18px}#splashscreen .close{background:#000}@media (min-width:770px) and (max-width:1000px){#splashscreen h2{font-size:18px;font-weight:600}.center .close{top:15px}}.feedback-form{margin-top:30px;margin-bottom:30px;color:#6F6F6F}.feedback-form label{font-weight:100}.feedback-form .btn-default{color:#6F6F6F}.feedback-form .show-more{cursor:pointer}.wikipedia-content h2{font-size:18px}.image.with-caption{display:inline-block;background:#f5f5f5;margin-bottom:15px}.image.with-caption p{margin:0;padding-bottom:.5em;color:#999;font-size:90%;padding-left:.5em;padding-right:.5em}.image.with-caption .thumbnail{margin-bottom:5px}.leaflet-control-layers{margin-top:10px}.leaflet-control-layers .layericon{margin-left:5px;font-size:18px;cursor:pointer}.leaflet-control-layers label.disabled{color:#ddd}.leaflet-control-layers i.fa-square-o{padding-right:3px!important}i.error-icon{color:#a94442}.audiojs{display:table;height:34px}.audiojs .play-pause,.scrubber,.time{display:table-cell;float:none;height:auto;vertical-align:middle}.audiojs .play-pause{padding:0 6px}.audiojs .play-pause>p{margin:0;padding:0;height:26px}.audiojs .scrubber{width:99%;margin:0;padding:0}.audiojs .scrubber>div{position:relative;margin:0}.audiojs .scrubber>div &.progress{z-index:2}.audiojs .scrubber>div &.loaded{margin-top:-14px;z-index:1}.audiojs .time{height:20px;line-height:normal;margin:0;padding-top:2px;border-left:0;width:auto} \ No newline at end of file diff --git a/dist/style3d.css b/dist/style3d.css index 75837bca..a1536175 100644 --- a/dist/style3d.css +++ b/dist/style3d.css @@ -1 +1 @@ -.knreise-sidebar .list-btn,.knreise-sidebar .top-text{margin-left:15px;margin-top:15px;color:#333}#splashscreen h2,.cesium-sidebar h4{text-transform:uppercase}#sidebar{overflow:none;padding:0;position:relative;height:100%}#sidebar .fullwidth{width:100%;margin-bottom:15px}#sidebar .sidebar-content{bottom:0;overflow:auto;padding:15px;position:absolute;top:50px;width:100%}#sidebar .sidebar-content h5{padding-bottom:5px;padding-left:5px;padding-top:5px}.knreise-sidebar .awesome-marker{position:relative}.knreise-sidebar .thumbnail{margin-bottom:0;padding:0;border-width:2px}.knreise-sidebar .list-btn{opacity:.5;cursor:pointer}.knreise-sidebar .prev-next-arrows{position:absolute;top:50%;z-index:4000}.knreise-sidebar .prev-next-arrows .glyphicon{top:2px}.knreise-sidebar .prev{color:#fff!important;left:-10px}.knreise-sidebar .next{color:#fff!important;right:-10px}.knreise-sidebar .circle,.knreise-sidebar .headertext{color:#000;display:block;margin-left:10px;font-weight:700;margin-top:10px;height:30px}@media (max-width:770px){.knreise-sidebar .prev{left:-5px}.knreise-sidebar .next{right:5px}.leaflet-sidebar .close{top:12px}}.knreise-sidebar .next.active,.knreise-sidebar .prev.active{background-color:#A5A5A5;cursor:pointer}.knreise-sidebar .circle{background-color:#ddd;border-radius:15px;box-shadow:1px 1px 5px #888;font-size:14px;line-height:26px;text-align:center;width:30px}.knreise-sidebar .top-menu .circle{background-color:#fff}.knreise-sidebar .headertext{font-size:1.5em;line-height:30px}.knreise-sidebar .close,.leaflet-sidebar .close{line-height:25px;font-size:25px}.knreise-sidebar .providertext{color:#666;font-size:12px;font-weight:700;text-transform:uppercase}.fa-bars:hover{color:#000}.knreise-sidebar .top-menu{background:#F6F6F6;height:50px;left:0;position:absolute;top:0;width:100%;z-index:5000}.knreise-sidebar .close{position:relative;margin-right:10px;margin-top:10px;top:0;right:0;background:#fff;border-radius:16px;color:#333;cursor:pointer;height:31px;text-align:center;width:31px;z-index:8}.knreise-sidebar .sidebar-content h3{margin-top:0}.knreise-sidebar .sidebar-link{color:#333}.knreise-sidebar .list-group-item{border:0;padding:5px;margin-bottom:5px}.knreise-sidebar .media-body{font-weight:500}.knreise-sidebar .images-list img{margin-bottom:0!important}.knreise-sidebar .media-navigation{position:relative;height:50px}.knreise-sidebar .media-navigation .circle{border-color:#8C8C8C}.knreise-sidebar .media-navigation .prev{position:absolute;color:#8C8C8C!important;left:35%}.knreise-sidebar .media-navigation .next{position:absolute;color:#8C8C8C!important;right:35%}.sidebar-table{margin-top:20px;margin-bottom:20px}.sidebar-table tr td:first-child{font-weight:700;padding-right:10px;vertical-align:top}.sidebar-image-text{margin-bottom:20px;color:grey}.leaflet-sidebar.center{right:-500px;transition:right .5s,width .5s;padding-left:0;margin-right:-500px}.leaflet-sidebar.center.visible{left:0;right:0;margin-left:auto;margin-right:auto}.leaflet-sidebar .gray{position:fixed;left:0;right:0;top:0;bottom:0;background-color:#000;opacity:.4}#topbar,.spinner-wrapper{width:100%;position:absolute}.leaflet-sidebar .splash-image{width:100%}.leaflet-sidebar .distance{color:#6F6F6F}#splashscreen{padding-left:0;padding-right:0;background-color:rgba(0,0,0,.9);color:#E6E6E6}#splashscreen .splash-content,#splashscreen h2{margin-top:12px;padding-left:24px;padding-right:24px}#splashscreen .footer{margin-top:40px;color:rgba(255,255,255,.8)}#splashscreen a{color:#E6E6E6;text-decoration:underline}#splashscreen h2{margin-top:6px;font-size:25px;font-weight:400;padding-left:18px}#splashscreen .close{background:#000}@media (min-width:770px) and (max-width:1000px){#splashscreen h2{font-size:18px;font-weight:600}.center .close{top:15px}}.feedback-form{margin-top:30px;margin-bottom:30px;color:#6F6F6F}.feedback-form label{font-weight:100}.feedback-form .btn-default{color:#6F6F6F}.feedback-form .show-more{cursor:pointer}.wikipedia-content h2{font-size:18px}#cesium,#cesium-viewer,body,html{width:100%;height:100%;margin:0;padding:0;overflow:hidden}body{margin:0}#topbar{z-index:1200;height:50px;background-color:#fff;box-shadow:0 1px 1px #888}.navbar-logo{max-width:100px;max-height:46px;margin:2px}.cesium-viewer-toolbar{top:60px}.spinner-wrapper{height:100%;background-color:rgba(255,255,255,.9);z-index:1000}body{background:#1a1a1a}@-webkit-keyframes spinner1{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}@-moz-keyframes spinner1{from{-moz-transform:rotate(0)}to{-moz-transform:rotate(360deg)}}@keyframes spinner1{from{-webkit-transform:rotate(0);-moz-transform:rotate(0);-ms-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spinner2{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(-360deg)}}@-moz-keyframes spinner2{from{-moz-transform:rotate(0)}to{-moz-transform:rotate(-360deg)}}@keyframes spinner2{from{-webkit-transform:rotate(0);-moz-transform:rotate(0);-ms-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(-360deg);-moz-transform:rotate(-360deg);-ms-transform:rotate(-360deg);-o-transform:rotate(-360deg);transform:rotate(-360deg)}}.spinner{z-index:2000;position:fixed;width:34px;height:34px;top:50%;left:50%;margin-left:-17px;margin-top:-17px}.spinner:after,.spinner:before{position:fixed;content:"";border:2px solid #000;width:32px;height:32px}.spinner:after{-webkit-animation:spinner1 2.5s linear infinite;-moz-animation:spinner1 2.5s linear infinite;animation:spinner1 2.5s linear infinite}.spinner:before{width:44px;height:44px;margin-left:-6.5px;margin-top:-6.5px;-webkit-animation:spinner2 2.5s linear infinite;-moz-animation:spinner2 2.5s linear infinite;animation:spinner2 2.5s linear infinite}.cesium-sidebar-body{overflow-y:auto;height:100%}.close-sidebar{padding-top:5px;position:absolute;top:15px;right:15px;width:30px;height:30px;background-color:transparent;cursor:pointer}.cesium-sidebar-body,.fullwidth{padding:10px}.close-sidebar .lr,.close-sidebar .lr .rl{width:1px;height:30px;background-color:#222}.close-sidebar:hover{opacity:.3}.close-sidebar .lr{z-index:1051;margin-left:15px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.close-sidebar .lr .rl{z-index:1052;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fullwidth{max-width:95%}#cesium-sidebar{top:50px;position:absolute;z-index:1000;bottom:0;display:none;width:400px;background-color:rgba(255,255,255,.9);box-shadow:1px 0 1px #888}.cesium-sidebar-close .lr{z-index:1051;width:2px;height:15px;margin-left:35px;background-color:#222;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.cesium-sidebar-close .lr .rl{z-index:1052;width:2px;height:15px;background-color:#222;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)} \ No newline at end of file +.knreise-sidebar .list-btn,.knreise-sidebar .top-text{margin-left:15px;margin-top:15px;color:#333}#splashscreen h2,.cesium-sidebar h4{text-transform:uppercase}#sidebar{overflow:none;padding:0;position:relative;height:100%}#sidebar .fullwidth{width:100%;margin-bottom:15px}#sidebar .sidebar-content{bottom:0;overflow:auto;padding:15px;position:absolute;top:50px;width:100%}#sidebar .sidebar-content h5{padding-bottom:5px;padding-left:5px;padding-top:5px}.knreise-sidebar .awesome-marker{position:relative}.knreise-sidebar .thumbnail{margin-bottom:0;padding:0;border-width:2px}.knreise-sidebar .list-btn{opacity:.5;cursor:pointer}.knreise-sidebar .prev-next-arrows{position:absolute;top:50%;z-index:4000}.knreise-sidebar .prev-next-arrows .glyphicon{top:2px}.knreise-sidebar .prev{color:#fff!important;left:-10px}.knreise-sidebar .next{color:#fff!important;right:-10px}.knreise-sidebar .circle,.knreise-sidebar .headertext{color:#000;display:block;margin-left:10px;font-weight:700;margin-top:10px;height:30px}@media (max-width:770px){.knreise-sidebar .prev{left:-5px}.knreise-sidebar .next{right:5px}.leaflet-sidebar .close{top:12px}}.knreise-sidebar .next.active,.knreise-sidebar .prev.active{background-color:#A5A5A5;cursor:pointer}.knreise-sidebar .circle{background-color:#ddd;border-radius:15px;box-shadow:1px 1px 5px #888;font-size:14px;line-height:26px;text-align:center;width:30px}.knreise-sidebar .top-menu .circle{background-color:#fff}.knreise-sidebar .headertext{font-size:1.5em;line-height:30px}.knreise-sidebar .close,.leaflet-sidebar .close{line-height:25px;font-size:25px}.knreise-sidebar .providertext{color:#666;font-size:12px;font-weight:700;text-transform:uppercase}.fa-bars:hover{color:#000}.knreise-sidebar .top-menu{background:#F6F6F6;height:50px;left:0;position:absolute;top:0;width:100%;z-index:5000}.knreise-sidebar .close{position:relative;margin-right:10px;margin-top:10px;top:0;right:0;background:#fff;border-radius:16px;color:#333;cursor:pointer;height:31px;text-align:center;width:31px;z-index:8}.knreise-sidebar .sidebar-content h3{margin-top:0}.knreise-sidebar .sidebar-link{color:#333}.knreise-sidebar .list-group-item{border:0;padding:5px;margin-bottom:5px}.knreise-sidebar .media-body{font-weight:500}.knreise-sidebar .images-list img{margin-bottom:0!important}.knreise-sidebar .media-navigation{position:relative;height:50px}.knreise-sidebar .media-navigation .circle{border-color:#8C8C8C}.knreise-sidebar .media-navigation .prev{position:absolute;color:#8C8C8C!important;left:35%}.knreise-sidebar .media-navigation .next{position:absolute;color:#8C8C8C!important;right:35%}.sidebar-table{margin-top:20px;margin-bottom:20px}.sidebar-table tr td:first-child{font-weight:700;padding-right:10px;vertical-align:top}.sidebar-image-text{margin-bottom:20px;color:grey}.leaflet-sidebar.center{right:-500px;transition:right .5s,width .5s;padding-left:0;margin-right:-500px}.leaflet-sidebar.center.visible{left:0;right:0;margin-left:auto;margin-right:auto}.leaflet-sidebar .gray{position:fixed;left:0;right:0;top:0;bottom:0;background-color:#000;opacity:.4}#topbar,.spinner-wrapper{width:100%;position:absolute}.leaflet-sidebar .splash-image{width:100%}.leaflet-sidebar .distance{color:#6F6F6F}#splashscreen{padding-left:0;padding-right:0;background-color:rgba(0,0,0,.9);color:#E6E6E6}#splashscreen .splash-content,#splashscreen h2{margin-top:12px;padding-left:24px;padding-right:24px}#splashscreen .footer{margin-top:40px;color:rgba(255,255,255,.8)}#splashscreen a{color:#E6E6E6;text-decoration:underline}#splashscreen h2{margin-top:6px;font-size:25px;font-weight:400;padding-left:18px}#splashscreen .close{background:#000}@media (min-width:770px) and (max-width:1000px){#splashscreen h2{font-size:18px;font-weight:600}.center .close{top:15px}}.feedback-form{margin-top:30px;margin-bottom:30px;color:#6F6F6F}.feedback-form label{font-weight:100}.feedback-form .btn-default{color:#6F6F6F}.feedback-form .show-more{cursor:pointer}.wikipedia-content h2{font-size:18px}.image.with-caption{display:inline-block;background:#f5f5f5;margin-bottom:15px}.image.with-caption p{margin:0;padding-bottom:.5em;color:#999;font-size:90%;padding-left:.5em;padding-right:.5em}.image.with-caption .thumbnail{margin-bottom:5px}#cesium,#cesium-viewer,body,html{width:100%;height:100%;margin:0;padding:0;overflow:hidden}body{margin:0}#topbar{z-index:1200;height:50px;background-color:#fff;box-shadow:0 1px 1px #888}.navbar-logo{max-width:100px;max-height:46px;margin:2px}.cesium-viewer-toolbar{top:60px}.spinner-wrapper{height:100%;background-color:rgba(255,255,255,.9);z-index:1000}body{background:#1a1a1a}@-webkit-keyframes spinner1{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}@-moz-keyframes spinner1{from{-moz-transform:rotate(0)}to{-moz-transform:rotate(360deg)}}@keyframes spinner1{from{-webkit-transform:rotate(0);-moz-transform:rotate(0);-ms-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spinner2{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(-360deg)}}@-moz-keyframes spinner2{from{-moz-transform:rotate(0)}to{-moz-transform:rotate(-360deg)}}@keyframes spinner2{from{-webkit-transform:rotate(0);-moz-transform:rotate(0);-ms-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(-360deg);-moz-transform:rotate(-360deg);-ms-transform:rotate(-360deg);-o-transform:rotate(-360deg);transform:rotate(-360deg)}}.spinner{z-index:2000;position:fixed;width:34px;height:34px;top:50%;left:50%;margin-left:-17px;margin-top:-17px}.spinner:after,.spinner:before{position:fixed;content:"";border:2px solid #000;width:32px;height:32px}.spinner:after{-webkit-animation:spinner1 2.5s linear infinite;-moz-animation:spinner1 2.5s linear infinite;animation:spinner1 2.5s linear infinite}.spinner:before{width:44px;height:44px;margin-left:-6.5px;margin-top:-6.5px;-webkit-animation:spinner2 2.5s linear infinite;-moz-animation:spinner2 2.5s linear infinite;animation:spinner2 2.5s linear infinite}.cesium-sidebar-body{overflow-y:auto;height:100%}.close-sidebar{padding-top:5px;position:absolute;top:15px;right:15px;width:30px;height:30px;background-color:transparent;cursor:pointer}.cesium-sidebar-body,.fullwidth{padding:10px}.close-sidebar .lr,.close-sidebar .lr .rl{width:1px;height:30px;background-color:#222}.close-sidebar:hover{opacity:.3}.close-sidebar .lr{z-index:1051;margin-left:15px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.close-sidebar .lr .rl{z-index:1052;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fullwidth{max-width:95%}#cesium-sidebar{top:50px;position:absolute;z-index:1000;bottom:0;display:none;width:400px;background-color:rgba(255,255,255,.9);box-shadow:1px 0 1px #888}.cesium-sidebar-close .lr{z-index:1051;width:2px;height:15px;margin-left:35px;background-color:#222;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.cesium-sidebar-close .lr .rl{z-index:1052;width:2px;height:15px;background-color:#222;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)} \ No newline at end of file diff --git a/index.html b/index.html index 1df98827..02106a32 100644 --- a/index.html +++ b/index.html @@ -98,6 +98,10 @@

Foto

2. verdenskrig

2. verdenskrig og krigens kulturminner. Eget kartgrunnlag basert på tjenesten Mapbox og innhold knyttet til 2. verdenskrig fra Digitalt Fortalt, Jernbanemuseet, Riksantikvaren, Wikipedia og Digitalt Museum.

+ +

God jul

+

Julehistorie fra hele landet

+
diff --git a/templates/datasets/folketelling.tmpl b/templates/datasets/folketelling.tmpl index 601d806e..c5cab6a0 100644 --- a/templates/datasets/folketelling.tmpl +++ b/templates/datasets/folketelling.tmpl @@ -53,14 +53,6 @@

<%= property.bostedets_navn %>

- - <% if (distanceBearing) { %> -
- - <%= distanceBearing.dist %> -
- <% } %> - <% _.each(residents, function (resident) { %> diff --git a/templates/datasets/ra_sparql.tmpl b/templates/datasets/ra_sparql.tmpl index 0953f0bc..341119fd 100644 --- a/templates/datasets/ra_sparql.tmpl +++ b/templates/datasets/ra_sparql.tmpl @@ -1,9 +1,14 @@

<%= name %>

<% if (img) { %> - +
+ + +

<%= picturelabel %> - <%= picturedescription %> (Lisens)

+
<% } %> +

<%= description %>

@@ -11,8 +16,16 @@ + <% if(!_.isUndefined(arguments[0].locartlabel)) { %> + + + + + <% } %> + <% if(!_.isUndefined(arguments[0].orglabel)) { %> + + + + + <% } %> - - - Vis hos Kulturminnesøk -