jellyfish-web/src/scripts/autoThemes.js
vitorsemeano 5071aedcea extracted connectionManager from site.js
new module ServerConnections for ConnectionManager
all code adapted to this new module
removed Events and ConnectionManager from eslintrc
2020-11-05 23:12:23 +00:00

23 lines
798 B
JavaScript

import * as userSettings from './settings/userSettings';
import * as webSettings from './settings/webSettings';
import skinManager from './themeManager';
import { Events } from 'jellyfin-apiclient';
import ServerConnections from '../components/ServerConnections';
// set the default theme when loading
skinManager.setTheme(userSettings.theme());
// set the saved theme once a user authenticates
Events.on(ServerConnections, 'localusersignedin', function (e, user) {
skinManager.setTheme(userSettings.theme());
});
webSettings.getFonts().then(fonts => {
for (const font of fonts) {
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.href = font;
document.getElementsByTagName('head')[0].appendChild(link);
}
});