js: Don't add scheme and location when reloading CSS

It's not necessary and may (has) lead to the following case:
`http://localhost/http://localhost/icingaweb2/css/icinga.min.css`
This commit is contained in:
Johannes Meyer 2021-06-18 17:19:18 +02:00
parent f8b122b894
commit c01e0f9dc8

View File

@ -110,12 +110,9 @@
$('link').each(function() { $('link').each(function() {
var $oldLink = $(this); var $oldLink = $(this);
if ($oldLink.hasAttr('type') && $oldLink.attr('type').indexOf('css') > -1) { if ($oldLink.hasAttr('type') && $oldLink.attr('type').indexOf('css') > -1) {
var base = location.protocol + '//' + location.host;
var url = $(this).attr('href');
var $newLink = $oldLink.clone().attr( var $newLink = $oldLink.clone().attr(
'href', 'href',
base + '/' + url.replace(/^\//, '') $(this).attr('href')
).on('load', function() { ).on('load', function() {
$oldLink.remove(); $oldLink.remove();
}); });