From 160f441a95462fde0941f491d94ce1ece249c711 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 20 Apr 2018 07:59:01 +0900 Subject: [wip] darkmode --- src/client/app/init.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/client/app/init.ts') diff --git a/src/client/app/init.ts b/src/client/app/init.ts index 990933ec0e..a3ab2e8e31 100644 --- a/src/client/app/init.ts +++ b/src/client/app/init.ts @@ -47,6 +47,43 @@ Vue.mixin({ } }); +// Dark/Light +Vue.mixin({ + data() { + return { + _darkmode_: false + }; + }, + beforeCreate() { + // なぜか警告が出るため + this._darkmode_ = false; + }, + mounted() { + const set = () => { + if (!this.$el || !this.$el.setAttribute || !this.os || !this.os.i) return; + if (this.os.i.clientSettings.dark) { + document.documentElement.setAttribute('data-darkmode', 'true'); + this.$el.setAttribute('data-darkmode', 'true'); + this._darkmode_ = true; + this.$forceUpdate(); + } else { + document.documentElement.removeAttribute('data-darkmode'); + this.$el.removeAttribute('data-darkmode'); + this._darkmode_ = false; + this.$forceUpdate(); + } + }; + + set(); + + this.$watch('os.i.clientSettings', i => { + set(); + }, { + deep: true + }); + } +}); + /** * APP ENTRY POINT! */ -- cgit v1.2.3-freya From b14d7b45ae59f284f7bd9f77666795d237ad585e Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 21 Apr 2018 15:37:02 +0900 Subject: Better timeline rendering Co-Authored-By: tamaina --- package.json | 1 + .../app/desktop/views/components/timeline.core.vue | 100 +++++++++++++++++---- .../app/desktop/views/components/timeline.vue | 23 ----- .../app/desktop/views/components/ui.header.vue | 2 + src/client/app/init.ts | 14 +++ .../app/mobile/views/components/timeline.vue | 74 ++++++++++++--- .../app/mobile/views/components/ui.header.vue | 2 + 7 files changed, 165 insertions(+), 51 deletions(-) (limited to 'src/client/app/init.ts') diff --git a/package.json b/package.json index 9c2f78d216..c5962a3dba 100644 --- a/package.json +++ b/package.json @@ -208,6 +208,7 @@ "vue-router": "3.0.1", "vue-template-compiler": "2.5.16", "vuedraggable": "2.16.0", + "vuex": "^3.0.1", "web-push": "3.3.0", "webfinger.js": "2.6.6", "webpack": "4.6.0", diff --git a/src/client/app/desktop/views/components/timeline.core.vue b/src/client/app/desktop/views/components/timeline.core.vue index f66ae57885..719425c3c7 100644 --- a/src/client/app/desktop/views/components/timeline.core.vue +++ b/src/client/app/desktop/views/components/timeline.core.vue @@ -1,5 +1,6 @@