aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials
diff options
context:
space:
mode:
authorMantas <11616378+mistermantas@users.noreply.github.com>2018-07-24 13:47:45 +0300
committerMantas <11616378+mistermantas@users.noreply.github.com>2018-07-24 13:47:45 +0300
commit88a199b6c0576a35bae67a241c20370b629dd7cd (patch)
treecef7874e319d9084fff7316621148fb360f60212 /layouts/partials
parent4c175215cf3ee423dd138ef57c06c3a550fa24ce (diff)
v2-rc1
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/footer.html2
-rw-r--r--layouts/partials/js.html114
-rw-r--r--layouts/partials/meta.html7
3 files changed, 23 insertions, 100 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index f9c49d8..55e512c 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -11,7 +11,7 @@
<p>{{ .Site.Params.description }}</p>
<!-- Please keep this one around to help cState grow <3 -->
- <small class="copyright faded">Powered by <a href="https://github.com/mistermantas/cstate">cState <b>v2.0-rc1</b></a></small>
+ <small class="copyright faded">Powered by <a href="https://github.com/cstate/cstate">cState v2.0</a></small>
</div>
</div>
diff --git a/layouts/partials/js.html b/layouts/partials/js.html
index a26d36c..1896127 100644
--- a/layouts/partials/js.html
+++ b/layouts/partials/js.html
@@ -3,7 +3,7 @@
* Dev toolset
*/
- console.log('Welcome to cState! https://github.com/mistermantas/cstate');
+ console.log('Welcome to cState v2.0! https://github.com/cstate/cstate');
document.querySelector('html').className = 'js';
@@ -11,20 +11,15 @@
* Make theme color pretty
*/
- if (document.body.className === 'status-down') {
- document.querySelector('meta[name=theme-color]').setAttribute('content', themeDownColor);
- } else if (document.body.className === 'status-disrupted') {
- document.querySelector('meta[name=theme-color]').setAttribute('content', themeDisruptedColor);
- } else {
- document.querySelector('meta[name=theme-color]').setAttribute('content', themeNoticeColor);
+ if (document.body.className === 'change-header-color') {
+ if (document.body.className === 'status-down') {
+ document.querySelector('meta[name=theme-color]').setAttribute('content', themeDownColor);
+ } else if (document.body.className === 'status-disrupted') {
+ document.querySelector('meta[name=theme-color]').setAttribute('content', themeDisruptedColor);
+ } else {
+ document.querySelector('meta[name=theme-color]').setAttribute('content', themeNoticeColor);
+ }
}
-</script>
-
-<!--
-<script>
- /**
- * Check for internet
- */
function hasClass(element, className) {
return (' ' + element.className + ' ').indexOf(' ' + className+ ' ') > -1;
@@ -32,6 +27,8 @@
if (hasClass(document.querySelector('body'), 'status-homepage')) {
var lastUpdated = document.querySelector('.summary__date');
+ lastUpdated.innerHTML = 'Last checked just now';
+
var lastUpdate = new Date();
function timeSince(date) {
@@ -63,96 +60,19 @@
var aDay = 24*60*60*1000;
}
- function checkCurrentStatus() {
- // Check for each status
- if (hasClass(document.querySelector('body'), 'status-ok')) {
- window.currentState = 'Operational';
- }
- if (hasClass(document.querySelector('body'), 'status-disrupted')) {
- window.currentState = 'Disrupted';
- }
- if (hasClass(document.querySelector('body'), 'status-down')) {
- window.currentState = 'Down';
- }
- if (hasClass(document.querySelector('body'), 'status-notice')) {
- window.currentState = 'Maintenance';
- }
- }
- checkCurrentStatus();
-
- // Set for first time use
- if (typeof(Storage) !== 'undefined') {
- window.sessionStorage.setItem('priorState', currentState);
- }
-
- // Show second by second updates
window.setInterval(function() {
if (hasClass(document.querySelector('body'), 'status-homepage')) {
lastUpdated.innerHTML = 'Last checked ' + timeSince(lastUpdate) + ' ago';
- }
-
- checkCurrentStatus();
- if (typeof(Storage) !== "undefined") {
- if (window.sessionStorage.getItem('priorState') !== currentState) {
- displayNotification('Status changed from ' + window.sessionStorage.getItem('priorState') + ' to ' + currentState);
+ var lastUpdateTime = new Date() - lastUpdate;
+ // Refresh every 4m 30s
+ if (lastUpdateTime > 290000) {
+ location.reload;
}
-
- window.sessionStorage.setItem('priorState', currentState);
- } else {
- console.log('UNSUPPORTED - SMART NOTIFICATIONS');
}
- }, 1000);
-
-
- /**
- * Modern browser shiz
- */
-
- if (navigator.serviceWorker) {
- console.log('Service Worker and Push is supported');
-
- navigator.serviceWorker.register('sw.js')
- .then(function(swReg) {
- console.log('Service Worker is registered', swReg);
-
- swRegistration = swReg;
- })
- .catch(function(error) {
- console.error('Service Worker Error', error);
- });
- } else {
- console.log('Push messaging is not supported');
- }
-
-
- Notification.requestPermission(function(status) {
- console.log('Notification permission status:', status);
- });
-
-
- function displayNotification(title, body) {
- if (Notification.permission == 'granted') {
- navigator.serviceWorker.getRegistration().then(function(reg) {
- var options = {
- body: body,
- icon: '/favicon.png',
- vibrate: [100, 50, 100],
- data: {
- dateOfArrival: Date.now(),
- primaryKey: 1
- },
- actions: [
- {action: 'view', title: 'View incident'},
- {action: 'close', title: 'Dismiss'},
- ]
- };
- reg.showNotification(title, options);
- });
- }
- }
+ }, 5000)
</script>
--->
+
{{ if ne .Site.Params.googleAnalytics "UA-00000000-1" }}
<!-- Global site tag (gtag.js) - Google Analytics -->
diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html
index b5b7568..ef9e3af 100644
--- a/layouts/partials/meta.html
+++ b/layouts/partials/meta.html
@@ -10,7 +10,7 @@
<title>{{ if eq .Title .Site.Title }}{{ .Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
<link rel="canonical" href="{{ .Permalink }}">
{{ .Hugo.Generator }}
- <meta name="theme-color" content="#{{ .Site.Params.ok }}">
+ <meta name="theme-color" content="#{{ .Site.Params.brand }}">
<script>
var themeBrandColor = '#{{ .Site.Params.brand }}';
var themeOkColor = '#{{ .Site.Params.ok }}';
@@ -68,7 +68,8 @@
h3 { font-size: 20px; }
h4 { font-size: 18px; }
- .stat { font-size: 18px; }
+ .headline { font-size: 20px; }
+ .bold { color: #000; }
h2, h4 {
font-weight: normal;
@@ -121,6 +122,8 @@
}
.center { text-align: center; }
+ .right { text-align: right; }
+ .padding-s { padding: 6px; }
.padding { padding: 12px; }
.summary {