mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Update Timeline, add persistent dark mode
This commit is contained in:
parent
efab7a9ba0
commit
ca4c556a93
1 changed files with 20 additions and 10 deletions
|
@ -374,6 +374,10 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
if($('link[data-stylesheet="dark"]').length != 0) {
|
||||||
|
this.modes.dark = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
});
|
});
|
||||||
|
@ -810,17 +814,23 @@
|
||||||
modeDarkToggle() {
|
modeDarkToggle() {
|
||||||
// todo: more graceful stylesheet change
|
// todo: more graceful stylesheet change
|
||||||
if(this.modes.dark == true) {
|
if(this.modes.dark == true) {
|
||||||
|
axios.post('/i/metro/dark-mode', {
|
||||||
|
mode: 'light'
|
||||||
|
}).then(res => {
|
||||||
|
$('link[data-stylesheet=dark]')
|
||||||
|
.attr('data-stylesheet', 'light')
|
||||||
|
.attr('href', '/css/app.css?v=' + Date.now());
|
||||||
this.modes.dark = false;
|
this.modes.dark = false;
|
||||||
$('link[data-stylesheet=dark]').remove();
|
});
|
||||||
} else {
|
} else {
|
||||||
|
axios.post('/i/metro/dark-mode', {
|
||||||
|
mode: 'dark'
|
||||||
|
}).then(res => {
|
||||||
|
$('link[data-stylesheet=light]')
|
||||||
|
.attr('data-stylesheet', 'dark')
|
||||||
|
.attr('href', '/css/appdark.css?v=' + Date.now());
|
||||||
this.modes.dark = true;
|
this.modes.dark = true;
|
||||||
let head = document.head;
|
});
|
||||||
let link = document.createElement("link");
|
|
||||||
link.type = "text/css";
|
|
||||||
link.rel = "stylesheet";
|
|
||||||
link.href = "/css/appdark.css";
|
|
||||||
link.setAttribute('data-stylesheet','dark');
|
|
||||||
head.appendChild(link);
|
|
||||||
}
|
}
|
||||||
window.ls.set('pixelfed-classicui-settings', this.modes);
|
window.ls.set('pixelfed-classicui-settings', this.modes);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue