update theme

This commit is contained in:
Ben Goldsworthy 2023-04-08 12:57:21 -06:00
parent 2a0ecfc3ec
commit f9aaff71c0
10 changed files with 1302 additions and 49 deletions

File diff suppressed because it is too large Load diff

11
js/leaflet-heat.js Normal file
View file

@ -0,0 +1,11 @@
/*
(c) 2014, Vladimir Agafonkin
simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas
https://github.com/mourner/simpleheat
*/
!function(){"use strict";function t(i){return this instanceof t?(this._canvas=i="string"==typeof i?document.getElementById(i):i,this._ctx=i.getContext("2d"),this._width=i.width,this._height=i.height,this._max=1,void this.clear()):new t(i)}t.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t,i){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,i){i=i||15;var a=this._circle=document.createElement("canvas"),s=a.getContext("2d"),e=this._r=t+i;return a.width=a.height=2*e,s.shadowOffsetX=s.shadowOffsetY=200,s.shadowBlur=i,s.shadowColor="black",s.beginPath(),s.arc(e-200,e-200,t,0,2*Math.PI,!0),s.closePath(),s.fill(),this},gradient:function(t){var i=document.createElement("canvas"),a=i.getContext("2d"),s=a.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var e in t)s.addColorStop(e,t[e]);return a.fillStyle=s,a.fillRect(0,0,1,256),this._grad=a.getImageData(0,0,1,256).data,this},draw:function(t){this._circle||this.radius(this.defaultRadius),this._grad||this.gradient(this.defaultGradient);var i=this._ctx;i.clearRect(0,0,this._width,this._height);for(var a,s=0,e=this._data.length;e>s;s++)a=this._data[s],i.globalAlpha=Math.max(a[2]/this._max,t||.05),i.drawImage(this._circle,a[0]-this._r,a[1]-this._r);var n=i.getImageData(0,0,this._width,this._height);return this._colorize(n.data,this._grad),i.putImageData(n,0,0),this},_colorize:function(t,i){for(var a,s=3,e=t.length;e>s;s+=4)a=4*t[s],a&&(t[s-3]=i[a],t[s-2]=i[a+1],t[s-1]=i[a+2])}},window.simpleheat=t}(),/*
(c) 2014, Vladimir Agafonkin
Leaflet.heat, a tiny and fast heatmap plugin for Leaflet.
https://github.com/Leaflet/Leaflet.heat
*/
L.HeatLayer=(L.Layer?L.Layer:L.Class).extend({initialize:function(t,i){this._latlngs=t,L.setOptions(this,i)},setLatLngs:function(t){return this._latlngs=t,this.redraw()},addLatLng:function(t){return this._latlngs.push(t),this.redraw()},setOptions:function(t){return L.setOptions(this,t),this._heat&&this._updateOptions(),this.redraw()},redraw:function(){return!this._heat||this._frame||this._map._animating||(this._frame=L.Util.requestAnimFrame(this._redraw,this)),this},onAdd:function(t){this._map=t,this._canvas||this._initCanvas(),t._panes.overlayPane.appendChild(this._canvas),t.on("moveend",this._reset,this),t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._canvas),t.off("moveend",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},_initCanvas:function(){var t=this._canvas=L.DomUtil.create("canvas","leaflet-heatmap-layer leaflet-layer"),i=L.DomUtil.testProp(["transformOrigin","WebkitTransformOrigin","msTransformOrigin"]);t.style[i]="50% 50%";var a=this._map.getSize();t.width=a.x,t.height=a.y;var s=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(t,"leaflet-zoom-"+(s?"animated":"hide")),this._heat=simpleheat(t),this._updateOptions()},_updateOptions:function(){this._heat.radius(this.options.radius||this._heat.defaultRadius,this.options.blur),this.options.gradient&&this._heat.gradient(this.options.gradient),this.options.max&&this._heat.max(this.options.max)},_reset:function(){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t);var i=this._map.getSize();this._heat._width!==i.x&&(this._canvas.width=this._heat._width=i.x),this._heat._height!==i.y&&(this._canvas.height=this._heat._height=i.y),this._redraw()},_redraw:function(){var t,i,a,s,e,n,h,o,r,d=[],_=this._heat._r,l=this._map.getSize(),m=new L.Bounds(L.point([-_,-_]),l.add([_,_])),c=void 0===this.options.max?1:this.options.max,u=void 0===this.options.maxZoom?this._map.getMaxZoom():this.options.maxZoom,f=1/Math.pow(2,Math.max(0,Math.min(u-this._map.getZoom(),12))),g=_/2,p=[],v=this._map._getMapPanePos(),w=v.x%g,y=v.y%g;for(t=0,i=this._latlngs.length;i>t;t++)if(a=this._map.latLngToContainerPoint(this._latlngs[t]),m.contains(a)){e=Math.floor((a.x-w)/g)+2,n=Math.floor((a.y-y)/g)+2;var x=void 0!==this._latlngs[t].alt?this._latlngs[t].alt:void 0!==this._latlngs[t][2]?+this._latlngs[t][2]:1;r=x*f,p[n]=p[n]||[],s=p[n][e],s?(s[0]=(s[0]*s[2]+a.x*r)/(s[2]+r),s[1]=(s[1]*s[2]+a.y*r)/(s[2]+r),s[2]+=r):p[n][e]=[a.x,a.y,r]}for(t=0,i=p.length;i>t;t++)if(p[t])for(h=0,o=p[t].length;o>h;h++)s=p[t][h],s&&d.push([Math.round(s[0]),Math.round(s[1]),Math.min(s[2],c)]);this._heat.data(d).draw(this.options.minOpacity),this._frame=null},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),a=this._map._getCenterOffset(t.center)._multiplyBy(-i).subtract(this._map._getMapPanePos());L.DomUtil.setTransform?L.DomUtil.setTransform(this._canvas,a,i):this._canvas.style[L.DomUtil.TRANSFORM]=L.DomUtil.getTranslateString(a)+" scale("+i+")"}}),L.heatLayer=function(t,i){return new L.HeatLayer(t,i)};

View file

@ -12,11 +12,25 @@ function drawChart() {
dataTable.addRows([ dataTable.addRows([
[ [
"Workaway, Hospedaje Wounaan", "Workaway, Volcano Day",
"Workawayer", "Workawayer",
"#BBBBB0", "#BBBBB0",
new Date("2023-03-26"),
new Date("2023-04-08")
],
[
"Cuba Solidarity Campaign",
"Member",
"#BBBBB0",
new Date("2023-03-03"),
new Date("2023-04-08")
],
[
"Workaway, Hospedaje Wounaan",
"Workawayer",
"#FFFFF0",
new Date("2023-02-24"), new Date("2023-02-24"),
new Date("2023-03-05") new Date("2023-03-12")
], ],
[ [
"Workaway, Finca DeLaRey", "Workaway, Finca DeLaRey",
@ -37,7 +51,7 @@ function drawChart() {
"Developer", "Developer",
"#BBBBB0", "#BBBBB0",
new Date("2023-01-19"), new Date("2023-01-19"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Workaway, Finca DeLaRey", "Workaway, Finca DeLaRey",
@ -72,14 +86,14 @@ function drawChart() {
"Web Developer", "Web Developer",
"#BCBC7E", "#BCBC7E",
new Date("2022-10-26"), new Date("2022-10-26"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Chartered Institute for Information Security", "Chartered Institute for Information Security",
"Associate Member", "Associate Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-08-09"), new Date("2022-08-09"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"West Lancs Scouts Active Support", "West Lancs Scouts Active Support",
@ -93,112 +107,112 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Computer Arts Society", "Computer Arts Society",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Computer Conservation Society", "Computer Conservation Society",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Consultancy Specialist Group", "Consultancy Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Enterprise Architecture Specialist Group", "Enterprise Architecture Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Green IT Specialist Group", "Green IT Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Health & Care Specialist Group", "Health & Care Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Internet Specialist Group", "Internet Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Information Risk Management and Assurance Specialist Group", "Information Risk Management and Assurance Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Information Security Specialist Group", "Information Security Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"IT Ethics Specialist Group", "IT Ethics Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Law Specialist Group", "Law Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"BCS Nottingham & Derby Branch", "BCS Nottingham & Derby Branch",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Open Source Specialist Group", "Open Source Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Sociotechnical Specialist Group", "Sociotechnical Specialist Group",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"BCS, the Chartered Institute for IT", "BCS, the Chartered Institute for IT",
"Professional Member", "Professional Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-06-06"), new Date("2022-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Chartered Institute for Information Security", "Chartered Institute for Information Security",
@ -219,7 +233,7 @@ function drawChart() {
"Student Member", "Student Member",
"#BBBBB0", "#BBBBB0",
new Date("2022-05-26"), new Date("2022-05-26"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"MORS Cyber CoP", "MORS Cyber CoP",
@ -261,7 +275,7 @@ function drawChart() {
"Supporter", "Supporter",
"#BBBBB0", "#BBBBB0",
new Date("2022-01-14"), new Date("2022-01-14"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Actica Consulting", "Actica Consulting",
@ -317,14 +331,14 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2021-09-24"), new Date("2021-09-24"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Mountain Training Association", "Mountain Training Association",
"Trainee Member", "Trainee Member",
"#BBBBB0", "#BBBBB0",
new Date("2021-08-24"), new Date("2021-08-24"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"North West Area Meeting", "North West Area Meeting",
@ -338,7 +352,7 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2021-07-26"), new Date("2021-07-26"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Lancaster Quaker Meeting", "Lancaster Quaker Meeting",
@ -394,7 +408,7 @@ function drawChart() {
"Participant", "Participant",
"#BBBBB0", "#BBBBB0",
new Date("2021-01-23"), new Date("2021-01-23"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"footnotes", "footnotes",
@ -429,7 +443,7 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2020-09-29"), new Date("2020-09-29"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Executive Committee", "Executive Committee",
@ -450,7 +464,7 @@ function drawChart() {
"Website Content Manager", "Website Content Manager",
"#BBBBB0", "#BBBBB0",
new Date("2020-08-31"), new Date("2020-08-31"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Unity2020", "Unity2020",
@ -604,14 +618,14 @@ function drawChart() {
"Associate Member", "Associate Member",
"#BBBBB0", "#BBBBB0",
new Date("2019-04-01"), new Date("2019-04-01"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Youth Hostel Association", "Youth Hostel Association",
"Company Member", "Company Member",
"#BBBBB0", "#BBBBB0",
new Date("2019-02-20"), new Date("2019-02-20"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Friends of Lancaster Library", "Friends of Lancaster Library",
@ -793,14 +807,14 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2018-06-20"), new Date("2018-06-20"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"UK England Chapter", "UK England Chapter",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2018-06-13"), new Date("2018-06-13"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Community Networks SIG", "Community Networks SIG",
@ -814,14 +828,14 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2018-06-06"), new Date("2018-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Internet Society", "Internet Society",
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2018-06-04"), new Date("2018-06-04"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Mitigate Cyber", "Mitigate Cyber",
@ -1010,7 +1024,7 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2017-06-06"), new Date("2017-06-06"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Lonsdale District Scout Network, Scout Network", "Lonsdale District Scout Network, Scout Network",
@ -1073,7 +1087,7 @@ function drawChart() {
"Member", "Member",
"#BBBBB0", "#BBBBB0",
new Date("2016-12-19"), new Date("2016-12-19"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Pendle College, Lancaster University Students' Union", "Pendle College, Lancaster University Students' Union",
@ -1444,7 +1458,7 @@ function drawChart() {
"Librarian", "Librarian",
"#BBBBB0", "#BBBBB0",
new Date("2013-05-01"), new Date("2013-05-01"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Patient Participation Group", "Patient Participation Group",
@ -1500,7 +1514,7 @@ function drawChart() {
"Minister", "Minister",
"#BBBBB0", "#BBBBB0",
new Date("2012-01-01"), new Date("2012-01-01"),
new Date("2023-03-05") new Date("2023-04-08")
], ],
[ [
"Salvation Army", "Salvation Army",

View file

@ -2,7 +2,7 @@
{{ partialCached "copying.html" . }} {{ partialCached "copying.html" . }}
<html itemscope itemtype="https://schema.org/WebSite"> <html lang="en-gb" itemscope itemtype="https://schema.org/WebSite">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, intitial-scale=1"> <meta name="viewport" content="width=device-width, intitial-scale=1">
@ -23,6 +23,7 @@
{{- $sass := resources.Get "css/main.scss" }} {{- $sass := resources.Get "css/main.scss" }}
{{- $style := $sass | resources.ToCSS | resources.Fingerprint }} {{- $style := $sass | resources.ToCSS | resources.Fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity | html }}"> <link rel="stylesheet" type="text/css" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity | html }}">
{{- block "header-styles" . -}}<!-- -->{{- end -}}
{{- block "header-scripts" . -}}<!-- -->{{- end -}} {{- block "header-scripts" . -}}<!-- -->{{- end -}}
</head> </head>

View file

@ -4,6 +4,12 @@
{{ define "main-class" }}--single{{ end }} {{ define "main-class" }}--single{{ end }}
{{ define "header-styles" }}
{{ with .Params.styles }}
<link rel="stylesheet" type="text/css" href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}">
{{ end }}
{{ end }}
{{ define "footer-scripts" }} {{ define "footer-scripts" }}
{{ with .Params.locations }} {{ with .Params.locations }}
<script src="https://www.openlayers.org/api/OpenLayers.js"></script> <script src="https://www.openlayers.org/api/OpenLayers.js"></script>
@ -126,7 +132,9 @@
{{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }} {{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }}
<section class="article-body__appendices"> <section class="article-body__appendices">
<h2 class="subheading subheading--appendices">Appendices</h2> <h2 class="subheading subheading--appendices">Appendices</h2>
{{ readFile ( path.Join $.Page.File.Dir "appendices.md" ) | markdownify }} {{ warnf "Getting appendix for '%v'" $.File.Dir }}
{{ $file := path.Join $.Page.File.Dir "appendices.md" }}
{{ $file | markdownify }}
</section> </section>
{{ end }} {{ end }}
</article> </article>

View file

@ -4,16 +4,100 @@
{{ define "main-class" }}--section location-map{{ end }} {{ define "main-class" }}--section location-map{{ end }}
{{ define "header-scripts" }}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css"
integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI="
crossorigin=""/>
{{ end }}
{{ define "footer-scripts" }} {{ define "footer-scripts" }}
<script src="https://www.openlayers.org/api/OpenLayers.js"></script> <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"
integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM="
crossorigin=""></script>
<script src="/js/leaflet-heat.js"></script>
<script>
/*
(c) 2014, Vladimir Agafonkin
simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas
https://github.com/mourner/simpleheat
*/
!function(){"use strict";function t(i){return this instanceof t?(this._canvas=i="string"==typeof i?document.getElementById(i):i,this._ctx=i.getContext("2d"),this._width=i.width,this._height=i.height,this._max=1,void this.clear()):new t(i)}t.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t,i){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,i){i=i||15;var a=this._circle=document.createElement("canvas"),s=a.getContext("2d"),e=this._r=t+i;return a.width=a.height=2*e,s.shadowOffsetX=s.shadowOffsetY=200,s.shadowBlur=i,s.shadowColor="black",s.beginPath(),s.arc(e-200,e-200,t,0,2*Math.PI,!0),s.closePath(),s.fill(),this},gradient:function(t){var i=document.createElement("canvas"),a=i.getContext("2d"),s=a.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var e in t)s.addColorStop(e,t[e]);return a.fillStyle=s,a.fillRect(0,0,1,256),this._grad=a.getImageData(0,0,1,256).data,this},draw:function(t){this._circle||this.radius(this.defaultRadius),this._grad||this.gradient(this.defaultGradient);var i=this._ctx;i.clearRect(0,0,this._width,this._height);for(var a,s=0,e=this._data.length;e>s;s++)a=this._data[s],i.globalAlpha=Math.max(a[2]/this._max,t||.05),i.drawImage(this._circle,a[0]-this._r,a[1]-this._r);var n=i.getImageData(0,0,this._width,this._height);return this._colorize(n.data,this._grad),i.putImageData(n,0,0),this},_colorize:function(t,i){for(var a,s=3,e=t.length;e>s;s+=4)a=4*t[s],a&&(t[s-3]=i[a],t[s-2]=i[a+1],t[s-1]=i[a+2])}},window.simpleheat=t}(),/*
(c) 2014, Vladimir Agafonkin
Leaflet.heat, a tiny and fast heatmap plugin for Leaflet.
https://github.com/Leaflet/Leaflet.heat
*/
L.HeatLayer=(L.Layer?L.Layer:L.Class).extend({initialize:function(t,i){this._latlngs=t,L.setOptions(this,i)},setLatLngs:function(t){return this._latlngs=t,this.redraw()},addLatLng:function(t){return this._latlngs.push(t),this.redraw()},setOptions:function(t){return L.setOptions(this,t),this._heat&&this._updateOptions(),this.redraw()},redraw:function(){return!this._heat||this._frame||this._map._animating||(this._frame=L.Util.requestAnimFrame(this._redraw,this)),this},onAdd:function(t){this._map=t,this._canvas||this._initCanvas(),t._panes.overlayPane.appendChild(this._canvas),t.on("moveend",this._reset,this),t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._canvas),t.off("moveend",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},_initCanvas:function(){var t=this._canvas=L.DomUtil.create("canvas","leaflet-heatmap-layer leaflet-layer"),i=L.DomUtil.testProp(["transformOrigin","WebkitTransformOrigin","msTransformOrigin"]);t.style[i]="50% 50%";var a=this._map.getSize();t.width=a.x,t.height=a.y;var s=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(t,"leaflet-zoom-"+(s?"animated":"hide")),this._heat=simpleheat(t),this._updateOptions()},_updateOptions:function(){this._heat.radius(this.options.radius||this._heat.defaultRadius,this.options.blur),this.options.gradient&&this._heat.gradient(this.options.gradient),this.options.max&&this._heat.max(this.options.max)},_reset:function(){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t);var i=this._map.getSize();this._heat._width!==i.x&&(this._canvas.width=this._heat._width=i.x),this._heat._height!==i.y&&(this._canvas.height=this._heat._height=i.y),this._redraw()},_redraw:function(){var t,i,a,s,e,n,h,o,r,d=[],_=this._heat._r,l=this._map.getSize(),m=new L.Bounds(L.point([-_,-_]),l.add([_,_])),c=void 0===this.options.max?1:this.options.max,u=void 0===this.options.maxZoom?this._map.getMaxZoom():this.options.maxZoom,f=1/Math.pow(2,Math.max(0,Math.min(u-this._map.getZoom(),12))),g=_/2,p=[],v=this._map._getMapPanePos(),w=v.x%g,y=v.y%g;for(t=0,i=this._latlngs.length;i>t;t++)if(a=this._map.latLngToContainerPoint(this._latlngs[t]),m.contains(a)){e=Math.floor((a.x-w)/g)+2,n=Math.floor((a.y-y)/g)+2;var x=void 0!==this._latlngs[t].alt?this._latlngs[t].alt:void 0!==this._latlngs[t][2]?+this._latlngs[t][2]:1;r=x*f,p[n]=p[n]||[],s=p[n][e],s?(s[0]=(s[0]*s[2]+a.x*r)/(s[2]+r),s[1]=(s[1]*s[2]+a.y*r)/(s[2]+r),s[2]+=r):p[n][e]=[a.x,a.y,r]}for(t=0,i=p.length;i>t;t++)if(p[t])for(h=0,o=p[t].length;o>h;h++)s=p[t][h],s&&d.push([Math.round(s[0]),Math.round(s[1]),Math.min(s[2],c)]);this._heat.data(d).draw(this.options.minOpacity),this._frame=null},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),a=this._map._getCenterOffset(t.center)._multiplyBy(-i).subtract(this._map._getMapPanePos());L.DomUtil.setTransform?L.DomUtil.setTransform(this._canvas,a,i):this._canvas.style[L.DomUtil.TRANSFORM]=L.DomUtil.getTranslateString(a)+" scale("+i+")"}}),L.heatLayer=function(t,i){return new L.HeatLayer(t,i)};
</script>
<script> <script>
var map = L.map('map').setView([55, -3], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
{{ range $.Site.Data.locations }}
//L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
{{ end }}
{{ .Scratch.Set "maxItems" 0 }}
{{ .Scratch.Set "numOfItems" 0 }}
{{ warnf "No of locations: %v" ( len $.Site.Data.locations ) }}
{{ range $key, $value := $.Site.Data.locations }}
{{ $childPosts := where $.Site.Pages ".Params.locations" "intersect" ( slice $key ) }}
{{ warnf "Current location: %v" $key }}
{{ warnf "Child posts: %v" $childPosts }}
{{ .Scratch.Set "numOfItems" ( len $childPosts ) }}
{{ if ( gt ( .Scratch.Get "numOfItems" ) ( .Scratch.Get "maxItems" ) ) }}
{{ warnf "Updating maxItems" }}
{{ .Scratch.Set "maxItems" ( .Scratch.Get "numOfItems" ) }}
{{ warnf "New maxItems: %d" .Scratch.Get "maxItems" }}
{{ end }}
{{ end }}
{{ warnf "maxItems: %v" ( .Scratch.Get "maxItems" ) }}
console.log({{ .Scratch.Get "maxItems" }});
L.heatLayer([
{{ range $key, $value := $.Site.Data.locations }}
[ {{ .lat }}, {{ .lon }}, {{ len ( where $.Site.Pages "Params.locations" $key ) }} ],
{{ end }}
], { max: {{ .Scratch.Get "maxItems" }} }).addTo(map);
</script>
<script>
/*
map = new OpenLayers.Map("map"); map = new OpenLayers.Map("map");
map.addLayer(new OpenLayers.Layer.OSM()); map.addLayer(new OpenLayers.Layer.OSM());
{{ $minItems := 0 }}
{{ $maxItems := 0 }}
{{ range $.Site.Data.locations }}
{{ $numOfLocations := len ( where $.Site.Pages ".Params.locations" "intersect" . ) }}
{{ if ( gt $numOfLocations $maxItems ) }}
{{ $maxItems := $numOfLocations }}
{{ end }}
{{ end }}
var heatmap = new OpenLayers.Layer.Heatmap({
title: "Heatmap",
weight: function(feature){
return (feature.get('numOfPages')-{{$minItems}}) / ({{$maxItems}}-{{$minItems}});
}
});
map.addLayer(heatmap);
var markers = new OpenLayers.Layer.Markers( "Markers" ); var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers); //map.addLayer(markers);
{{ range $.Site.Data.locations }} {{ range $.Site.Data.locations }}
heatmap.addDataPoint(
new OpenLayers.LonLat(
{{ .lon }},
{{ .lat }}
)
);
markers.addMarker( markers.addMarker(
new OpenLayers.Marker( new OpenLayers.Marker(
new OpenLayers.LonLat( new OpenLayers.LonLat(
@ -28,6 +112,7 @@
{{ end }} {{ end }}
map.setCenter([0,0], 5); map.setCenter([0,0], 5);
*/
</script> </script>
{{ end }} {{ end }}

View file

@ -1,8 +1,14 @@
<a id="{{ .Slug }}" class="link--tile" href="{{ .RelPermalink }}" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting"> <a id="{{ .Slug }}" class="link--tile" href="{{ .RelPermalink }}" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<article class="item-tile lazy {{- with .Params.site }} item-tile--{{ . }}{{ end -}}" <article class="item-tile lazy {{- with .Params.site }} item-tile--{{ . }}{{ end -}}"
{{ if .Params.featured_image }} {{ if .Params.featured_image }}
{{ if .Resources.GetMatch .Params.featured_image }} {{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ ( .Resources.GetMatch .Params.featured_image ).RelPermalink }})" {{ if eq .MediaType.SubType "svg" }}
style="background-image: url({{ .RelPermalink }})"
{{ else }}
{{ with .Resize "2000x webp" }}
style="background-image: url({{ .RelPermalink }})"
{{ end }}
{{ end }}
{{ else }} {{ else }}
style="background-image: url({{ .Params.featured_image }})" style="background-image: url({{ .Params.featured_image }})"
{{ end }} {{ end }}

View file

@ -0,0 +1,32 @@
{{ with where ( $.Site.Data.abbreviations .Params.abbr ) }}
{{ if ( or ( eq .Params.mode "shortTitle" ) ( eq .Params.mode "shortTitlePl" ) ) }}
<abbr class="abbr" title="
{{- if ( eq .Params.mode "shortTitle" ) }}
{{ .shortTitle }}
{{ else if ( eq .Params.mode "shortTitlePl" ) }}
{{ if .shortTitlePl }}{{ .shortTitlePl }}{{ else }}{{ .shortTitle }}s{{ end }}
{{ end -}}
">
{{- if ( eq .Params.mode "shortTitle" ) }}
{{ .shortTitle }}
{{ else if ( eq .Params.mode "shortTitlePl" ) }}
{{ if .shortTitlePl }}{{ .shortTitlePl }}{{ else }}{{ .shortTitle }}s{{ end }}
{{ end -}}
</abbr>
{{ else if ( or ( eq .Params.mode "longtitle" ) ( eq .Params.mode "longTitlePl" ) ) }}
{{- if ( eq .Params.mode "longTitle" ) }}
{{ .longTitle }}
{{ else if ( eq .Params.mode "longTitlePl" ) }}
{{ if .longTitlePl }}{{ .longTitlePl }}{{ else }}{{ .longTitle }}s{{ end }}
{{ end -}}
{{ else if ( or ( eq .Params.mode "fullTitle" ) ( eq .Params.mode "fullTitlePl" ) ) }}
{{ if ( eq .Params.mode "fullTitle" ) }}
{{ .longTitle }}&nbsp;(<abbr>{{ .short }}</abbr>)
{{ else if ( eq .Params.mode "fullTitlePl" ) }}
{{- if .longTitlePl }}{{ .longTitlePl }}{{ else }}{{ .longTitle }}s{{ end -}}
&nbsp;(<abbr>{{ if .shortPl }}{{ .shortPl }}{{ else }}{{ .short }}s{{ end }}</abbr>)
{{ end }}
{{ end }}
{{ else }}
{{ errorf "No definition found for abbreviation '%q'" .Params.abbr }}
{{ end }}

View file

@ -0,0 +1,16 @@
{{ if .Params.href }}
<a href="{{ if eq .Params.href "asCite" }}{{ .Params.cite }}{{ else }}{{ .Params.href }}{{end}}" target="_blank" rel="noopener noreferrer">
<cite class="cite {{ with .Params.citeStyle }}cite--{{ . }}{{ end }}"
{{ with .Params.cite }}cite="{{ . }}"{{ end }}
itemscope
itemtype="https://schema.org/
{{- with .Params.schemaType -}}
{{- . -}}
{{- else -}}
CreativeWork
{{- end -}}"
>
{{- .Params.title -}}
</cite>
</a>
{{ end }}

View file

@ -3,6 +3,9 @@
{{- end -}} {{- end -}}
{{ $src := $.Page.Resources.GetMatch (.Get "src") }} {{ $src := $.Page.Resources.GetMatch (.Get "src") }}
{{ if ( not $src ) }}
{{- errorf "No Page Resource found for src '%v' for post '%v'" ( .Get "src" ) $.Page.Title -}}
{{ end }}
{{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }} {{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }}
<figure class="article__figure{{ with .Get "class" }} {{ . }}{{ end }}"> <figure class="article__figure{{ with .Get "class" }} {{ . }}{{ end }}">
@ -34,15 +37,19 @@
{{- if eq $src.ResourceType "image" -}} {{- if eq $src.ResourceType "image" -}}
<picture class="figure__picture"> <picture class="figure__picture">
<img class="figure__image" <img class="figure__image"
{{ with $src.Resize "1500x webp" }} {{ if eq $src.MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ $src.RelPermalink }}"
{{ else }}
{{ with $src.Resize "1500x webp" }}
src="{{ .RelPermalink }}"
{{ end }}
width="{{ $src.Width }}"
height="{{ $src.Height }}"
{{ end }} {{ end }}
{{- if or ($src.Params.alt) (.Get "caption") }} {{- if or ($src.Params.alt) (.Get "caption") }}
alt="{{ with $src.Params.alt }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}" alt="{{ with $src.Params.alt }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
{{- end -}} {{- end -}}
{{- with $src.Params.title }} title="{{ . }}"{{ end -}} {{- with $src.Params.title }} title="{{ . }}"{{ end -}}
width="{{ $src.Width }}"
height="{{ $src.Height }}"
/> />
</picture> </picture>
{{- else if eq $src.ResourceType "video" -}} {{- else if eq $src.ResourceType "video" -}}