From 925027e85b74a77e06448be5baa6053f1222fb78 Mon Sep 17 00:00:00 2001 From: Mantas VilĨinskas Date: Wed, 24 Feb 2021 13:48:14 +0200 Subject: Doc updates, bugfixes, add rel time to NCMS --- layouts/index.json | 4 ++-- layouts/issues/small.html | 9 +++++---- layouts/partials/js.html | 18 ++++++++---------- layouts/partials/meta.html | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) (limited to 'layouts') 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 @@ {{ if .Params.informational }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -23,7 +23,7 @@ {{ else if .Params.Resolved }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -65,9 +65,10 @@ {{ end }} {{ end }} - {{ else }} - + {{ else }} + + {{ 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); {{ if ne .Site.Params.googleAnalytics "UA-00000000-1" }} - +