1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00

Update Timeline, add persistent dark mode

This commit is contained in:
Daniel Supernault 2019-04-21 23:42:37 -06:00
parent efab7a9ba0
commit ca4c556a93
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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) {
this.modes.dark = false; axios.post('/i/metro/dark-mode', {
$('link[data-stylesheet=dark]').remove(); mode: 'light'
}).then(res => {
$('link[data-stylesheet=dark]')
.attr('data-stylesheet', 'light')
.attr('href', '/css/app.css?v=' + Date.now());
this.modes.dark = false;
});
} else { } else {
this.modes.dark = true; axios.post('/i/metro/dark-mode', {
let head = document.head; mode: 'dark'
let link = document.createElement("link"); }).then(res => {
link.type = "text/css"; $('link[data-stylesheet=light]')
link.rel = "stylesheet"; .attr('data-stylesheet', 'dark')
link.href = "/css/appdark.css"; .attr('href', '/css/appdark.css?v=' + Date.now());
link.setAttribute('data-stylesheet','dark'); this.modes.dark = true;
head.appendChild(link); });
} }
window.ls.set('pixelfed-classicui-settings', this.modes); window.ls.set('pixelfed-classicui-settings', this.modes);
}, },