mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-14 01:02:19 +00:00
Minify calendar JS
This commit is contained in:
26
assets/js/calendar.js
Normal file
26
assets/js/calendar.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
var events = [];
|
||||||
|
$(document).ready(function () {
|
||||||
|
$.getJSON('https://api.leighhack.org/events', function (data) {
|
||||||
|
data.forEach(function (event) {
|
||||||
|
events.push({
|
||||||
|
id: event['uid'],
|
||||||
|
title: event['summary'],
|
||||||
|
body: event['description'],
|
||||||
|
state: 'Free',
|
||||||
|
dueDateClass: '',
|
||||||
|
start: event['start']['dateTime'],
|
||||||
|
end: event['end']['dateTime'],
|
||||||
|
})
|
||||||
|
});
|
||||||
|
let ec = new EventCalendar(document.getElementById('calendar'), {
|
||||||
|
view: 'listMonth',
|
||||||
|
events: events,
|
||||||
|
headerToolbar: {
|
||||||
|
start: 'prev,next today',
|
||||||
|
center: 'title',
|
||||||
|
end: 'dayGridMonth, listMonth'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -8,38 +8,13 @@
|
|||||||
|
|
||||||
{{ define "extra_css" }}
|
{{ define "extra_css" }}
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.4.1/event-calendar.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.4.1/event-calendar.min.css">
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "extra_js" }}
|
{{ define "extra_js" }}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.4.1/event-calendar.min.js" type="application/javascript"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.4.1/event-calendar.min.js" type="application/javascript"></script>
|
||||||
<script type="application/javascript">
|
{{ $js := resources.Get "js/calendar.js" | resources.Minify }}
|
||||||
var events = [];
|
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
|
||||||
$(document).ready(function () {
|
<script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
|
||||||
$.getJSON('https://api.leighhack.org/events', function (data) {
|
|
||||||
data.forEach(function (event) {
|
|
||||||
events.push({
|
|
||||||
id: event['uid'],
|
|
||||||
title: event['summary'],
|
|
||||||
body: event['description'],
|
|
||||||
state: 'Free',
|
|
||||||
dueDateClass: '',
|
|
||||||
start: event['start']['dateTime'],
|
|
||||||
end: event['end']['dateTime'],
|
|
||||||
})
|
|
||||||
});
|
|
||||||
let ec = new EventCalendar(document.getElementById('calendar'), {
|
|
||||||
view: 'listMonth',
|
|
||||||
events: events,
|
|
||||||
headerToolbar: {
|
|
||||||
start: 'prev,next today',
|
|
||||||
center: 'title',
|
|
||||||
end: 'dayGridMonth, listMonth'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
|
|||||||
Reference in New Issue
Block a user