aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorMantas Vilčinskas <hi@mnts.lt>2021-02-24 13:48:14 +0200
committerMantas Vilčinskas <hi@mnts.lt>2021-02-24 13:48:14 +0200
commit925027e85b74a77e06448be5baa6053f1222fb78 (patch)
treeb5dc98f1a5828764ec653cd37dc4b70585faf47d /layouts
parent867f6a5dc8118d0d6f903eea75484c59e296d37e (diff)
Doc updates, bugfixes, add rel time to NCMS
Diffstat (limited to 'layouts')
-rw-r--r--layouts/index.json4
-rw-r--r--layouts/issues/small.html9
-rw-r--r--layouts/partials/js.html18
-rw-r--r--layouts/partials/meta.html2
4 files changed, 16 insertions, 17 deletions
diff --git a/layouts/index.json b/layouts/index.json
index 5c47558..b37af7a 100644
--- a/layouts/index.json
+++ b/layouts/index.json
@@ -5,8 +5,8 @@
{{ $isDown := where $active "Params.severity" "=" "down" }}
{
"is": "index",
- "cStateVersion": "4.4",
- "apiVersion": "1.0.0",
+ "cStateVersion": "5.0",
+ "apiVersion": "2.0",
"title": "{{ .Site.Title }}",
"languageCodeHTML": "{{ .Site.LanguageCode }}",
"languageCode": "{{ T "languageCode" }}",
diff --git a/layouts/issues/small.html b/layouts/issues/small.html
index 79db524..531b47b 100644
--- a/layouts/issues/small.html
+++ b/layouts/issues/small.html
@@ -8,7 +8,7 @@
<a href="{{ .Permalink }}" class="issue no-underline">
{{ if .Params.informational }}
- <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "02 Jan 2006 03:05:00 PM" }}">
+ <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ else }}
@@ -23,7 +23,7 @@
</span>
{{ else if .Params.Resolved }}
- <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "02 Jan 2006 03:05:00 PM" }}">
+ <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006" }}">
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ else }}
@@ -65,9 +65,10 @@
</div>
{{ end }}
{{ end }}
- {{ else }}
- <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "02 Jan 2006 03:05:00 PM" }}">
+ {{ else }}
+ <!-- If not resolved -->
+ <small class="date float-right {{ cond .Site.Params.useRelativeTime "relative-time" "" }}" title="{{ .Date.Format "Jan 2 15:04:05 2006 UTC" }}">
{{ if .Site.Params.dateFormat }}
{{ .Date.Format .Site.Params.dateFormat }}
{{ else }}
diff --git a/layouts/partials/js.html b/layouts/partials/js.html
index 8465483..d966643 100644
--- a/layouts/partials/js.html
+++ b/layouts/partials/js.html
@@ -3,11 +3,11 @@
* Dev toolset
*/
- console.log('cState v4.4 - https://github.com/cstate/cstate');
+ console.log('cState v5 Dev - https://github.com/cstate/cstate');
document.getElementsByTagName('html')[0].className = 'js';
/**
- * Make theme color pretty
+ * Change header color based on status
*/
if (document.body.className === 'change-header-color') {
@@ -43,6 +43,7 @@
/**
* Returns a relative date string for the given date.
*/
+
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000);
@@ -78,6 +79,7 @@
* Changes elements with the class 'relative-time' into relative times and
* moves the timestamp to a title attribute tooltip.
*/
+
function updateRelativeTimes() {
var elements = document.querySelectorAll('.relative-time');
for (var i = 0; i < elements.length; i++) {
@@ -95,21 +97,17 @@
element.innerHTML = html.trim();
}
}
+
updateRelativeTimes();
- setInterval(updateRelativeTimes, 5000);
- /**
- * Reload homepage after 290 seconds.
- */
- if (document.querySelector('body.status-homepage')) {
- setTimeout(location.reload, 290000)
- }
+ // Update "time since" feature every 5s
+ setInterval(updateRelativeTimes, 5000);
</script>
{{ if ne .Site.Params.googleAnalytics "UA-00000000-1" }}
<!-- Global site tag (gtag.js) - Google Analytics -->
- <script type="text/javascript" defer src="https://www.googletagmanager.com/gtag/js?id=UA-109775664-1"></script>
+ <script type="text/javascript" defer src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Params.googleAnalytics }}"></script>
<script type="text/javascript" defer>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html
index 77c66db..283e840 100644
--- a/layouts/partials/meta.html
+++ b/layouts/partials/meta.html
@@ -12,7 +12,7 @@
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
- <meta name="generator" content="cState v4.4 - https://github.com/cstate/cstate">
+ <meta name="generator" content="cState v5 Dev - https://github.com/cstate/cstate">
<meta name="theme-color" content="{{ .Site.Params.brand }}">
<script>
var themeBrandColor = '{{ .Site.Params.brand }}';