2020-08-14 08:46:34 +02:00
|
|
|
import * as userSettings from './settings/userSettings';
|
|
|
|
import * as webSettings from './settings/webSettings';
|
|
|
|
import skinManager from './themeManager';
|
2020-09-08 02:05:02 -04:00
|
|
|
import { ConnectionManager, Events } from 'jellyfin-apiclient';
|
2020-08-02 17:28:25 +09:00
|
|
|
|
2020-10-25 20:20:06 +09:00
|
|
|
// set the default theme when loading
|
2020-08-09 13:24:16 +02:00
|
|
|
skinManager.setTheme(userSettings.theme());
|
|
|
|
|
2020-10-25 20:20:06 +09:00
|
|
|
// set the saved theme once a user authenticates
|
2020-09-08 02:05:02 -04:00
|
|
|
Events.on(ConnectionManager, 'localusersignedin', function (e, user) {
|
2020-08-02 17:28:25 +09:00
|
|
|
skinManager.setTheme(userSettings.theme());
|
|
|
|
});
|
2020-10-25 20:20:06 +09:00
|
|
|
|
|
|
|
webSettings.getFonts().then(fonts => {
|
|
|
|
for (const font of fonts) {
|
2020-10-25 20:24:40 +09:00
|
|
|
const link = document.createElement('link');
|
2020-10-25 20:20:06 +09:00
|
|
|
link.setAttribute('rel', 'stylesheet');
|
|
|
|
link.href = font;
|
|
|
|
|
|
|
|
document.getElementsByTagName('head')[0].appendChild(link);
|
|
|
|
}
|
|
|
|
});
|