+
+ document.addEventListener('visibilitychange', function () {
+ if (document.visibilityState == "visible") {
+ that.checkOffline();
+ }
+ }, false);
+ },
+ methods: {
+ checkOffline: function () {
+ let that = this;
+ return fetch(window.location.href + "?alive", {
+ method: 'HEAD',
+ cache: 'no-store'
+ }).then(function () {
+ that.offline = false;
+ }).catch(function () {
+ that.offline = true;
+ });
+ },
+ getConfig: function (event) {
+ return fetch('config.yml').then(function (response) {
+ if (response.status != 200) {
+ return
+ }
+ return response.text().then(function (body) {
+ return jsyaml.load(body);
+ });
+ });
+ },
+ toggleTheme: function() {
+ this.isDark = !this.isDark;
+ localStorage.overrideDark = this.isDark;
+ },
+ toggleLayout: function() {
+ this.vlayout = !this.vlayout;
+ localStorage.vlayout = this.vlayout;
+ },