mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix custom css precedence
This commit is contained in:
parent
9c92dbcdb4
commit
a8c979ceaf
1 changed files with 19 additions and 2 deletions
|
@ -623,8 +623,25 @@ var AppInfo = {};
|
|||
|
||||
require(["playerSelectionMenu", "fullscreenManager"]);
|
||||
|
||||
if (!AppInfo.isNativeApp && window.ApiClient) {
|
||||
require(["css!" + ApiClient.getUrl("Branding/Css")]);
|
||||
var apiClient = window.ConnectionManager && window.ConnectionManager.currentApiClient();
|
||||
if (apiClient) {
|
||||
fetch(apiClient.getUrl("Branding/Css"))
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
throw new Error(response.status + ' ' + response.statusText);
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then(function(css) {
|
||||
// Inject the branding css as a dom element in body so it will take
|
||||
// precedence over other stylesheets
|
||||
var style = document.createElement('style');
|
||||
style.appendChild(document.createTextNode(css));
|
||||
document.body.appendChild(style);
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.warn('Error applying custom css', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue