1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #763 from thornbill/custom-css

Fix custom css precedence
This commit is contained in:
dkanada 2020-02-06 00:06:51 +09:00 committed by GitHub
commit ca06c47b55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
});
}
});
});