]>
git.immae.eu Git - github/bastienwirtz/homer.git/blob - app.js
10 created: function () {
13 this.isDark
= 'overrideDark' in localStorage
?
14 JSON
.parse(localStorage
.overrideDark
) : matchMedia("(prefers-color-scheme: dark)").matches
;
16 if ('vlayout' in localStorage
) {
17 this.vlayout
= JSON
.parse(localStorage
.vlayout
)
21 that
.getConfig().then(function (config
) {
23 }).catch(function () {
27 document
.addEventListener('visibilitychange', function () {
28 if (document
.visibilityState
== "visible") {
34 checkOffline: function () {
36 return fetch(window
.location
.href
+ "?alive", {
41 }).catch(function () {
45 getConfig: function (event
) {
46 return fetch('config.yml').then(function (response
) {
47 if (response
.status
!= 200) {
50 return response
.text().then(function (body
) {
51 return jsyaml
.load(body
);
55 toggleTheme: function() {
56 this.isDark
= !this.isDark
;
57 localStorage
.overrideDark
= this.isDark
;
59 toggleLayout: function() {
60 this.vlayout
= !this.vlayout
;
61 localStorage
.vlayout
= this.vlayout
;
66 Vue
.component('service', {
71 <div class="card-content">
73 <div v-if="item.logo" class="media-left">
74 <figure class="image is-48x48">
75 <img :src="item.logo" />
78 <div v-if="item.icon" class="media-left">
79 <figure class="image is-48x48">
80 <i style="font-size: 35px" :class="item.icon"></i>
83 <div class="media-content">
84 <p class="title is-4">{{ item.name }}</p>
85 <p class="subtitle is-6">{{ item.subtitle }}</p>
88 <div class="tag" :class="item.tagstyle" v-if="item.tag">
89 <strong class="tag-text">#{{ item.tag }}</strong>
96 if ('serviceWorker' in navigator
) {
97 window
.addEventListener('load', function () {
98 navigator
.serviceWorker
.register('worker.js');