Skip to content

Commit

Permalink
Fixes/sugarlabs#650 Needless double GET of favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
ad1tyayadav authored Jan 20, 2025
1 parent b71fa69 commit dd3c09e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,26 @@ $(document).ready(function () {
var selectedColors = COLORS[colorIndex];

//Apply selected colors to the Sugarlabs logo
var logoID = colorIndex + 1;
if (logoID < 10) {
logoID = "0" + logoID;
}

var defaultIcon = document.querySelector('#defaultIcon1');
if (defaultIcon) {
var logoID = colorIndex + 1;
if (logoID < 10) {
logoID = "0" + logoID;
}

var rootUrl = '';
var baseTag = document.querySelector('base');
if (baseTag && baseTag.href) {
rootUrl = baseTag.href;
} else {
rootUrl = window.location.protocol + '//' + window.location.host + '/';
}

defaultIcon.href = rootUrl + 'assets/favicon_' + logoID + '.png';

// Update the favicon
var newFaviconUrl = rootUrl + 'assets/favicon_' + logoID + '.png';
if (defaultIcon.href !== newFaviconUrl) {
defaultIcon.href = newFaviconUrl;
}
}

var h = document.querySelector('.logo1').innerHTML;
Expand Down

0 comments on commit dd3c09e

Please sign in to comment.