Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zakius committed Mar 6, 2023
1 parent 3918eb6 commit 3caebfd
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions src/scripts/libs/favicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,28 @@ define(function () {
const links = new Set();
links.add(baseUrl.origin + '/favicon.ico');

linkElements.forEach((link) => {
const favicon = link.getAttribute('href');
if (!favicon) {
linkElements.forEach((linkElement) => {
const faviconAddress = linkElement.getAttribute('href');
if (!faviconAddress) {
return;
}
if (favicon.includes('svg')) {
if (faviconAddress.includes('svg')) {
return;
}
if (favicon.startsWith('http')) {
links.add(favicon);
if (faviconAddress.startsWith('http')) {
return links.add(faviconAddress);
}
if (favicon.startsWith('//')) {
links.add(baseUrl.protocol + favicon);
return;
if (faviconAddress.startsWith('//')) {
return links.add(baseUrl.protocol + faviconAddress);
}
if (favicon.startsWith('data')) {
links.add(favicon);
return;
if (faviconAddress.startsWith('data')) {
return links.add(faviconAddress);
}
if (favicon.startsWith('/')) {
links.add(baseUrl.origin + favicon);
return;
if (faviconAddress.startsWith('/')) {
return links.add(baseUrl.origin + faviconAddress);
}

links.add(baseUrl.origin + '/' + favicon);
links.add(baseUrl.origin + '/' + faviconAddress);
});


Expand Down

0 comments on commit 3caebfd

Please sign in to comment.