Skip to content

Commit

Permalink
Merge branch 'gdcc:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ErykKul authored Aug 23, 2024
2 parents 273d6ef + 3be8983 commit 36a644f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/dvwebloader.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/core.js"></script>
<script type="module" src="js/fileupload2.js"></script>
<script src="js/logoHandler.js"></script>

</head>
<body>
<main>
Expand Down
Binary file added src/images/logo_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions src/js/fileupload2.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function addIconAndLogo(siteUrl) {
.attr(
'href',
siteUrl +
'/javax.faces.resource/images/fav/apple-touch-icon.png.xhtml'))
'/jakarta.faces.resource/images/fav/apple-touch-icon.png.xhtml'))
.append(
$('<link/>')
.attr('type', 'image/png')
Expand All @@ -145,7 +145,7 @@ function addIconAndLogo(siteUrl) {
.attr(
'href',
siteUrl +
'/javax.faces.resource/images/fav/favicon-16x16.png.xhtml'))
'/jakarta.faces.resource/images/fav/favicon-16x16.png.xhtml'))
.append(
$('<link/>')
.attr('type', 'image/png')
Expand All @@ -154,7 +154,7 @@ function addIconAndLogo(siteUrl) {
.attr(
'href',
siteUrl +
'/javax.faces.resource/images/fav/favicon-32x32.png.xhtml'))
'/jakarta.faces.resource/images/fav/favicon-32x32.png.xhtml'))

.append(
$('<link/>')
Expand All @@ -163,7 +163,7 @@ function addIconAndLogo(siteUrl) {
.attr(
'href',
siteUrl +
'/javax.faces.resource/images/fav/safari-pinned-tab.svg.xhtml'))
'/jakarta.faces.resource/images/fav/safari-pinned-tab.svg.xhtml'))
.append(
$('<meta/>')
.attr('content', '#da532c')
Expand All @@ -172,8 +172,9 @@ function addIconAndLogo(siteUrl) {
$('<meta/>')
.attr('content', '#ffffff')
.attr('name', 'theme-color'));
$('#logo').attr('src', siteUrl + '/logos/preview_logo.png');

$('#logo')
.attr('src', siteUrl + '/logos/preview_logo.svg')
.attr('onerror', "handleImageError(this,'".concat(siteUrl).concat("')"));
}
function initTranslation() {
initSpanTxt('title-text', 'title');
Expand Down Expand Up @@ -1028,4 +1029,4 @@ function getChecksum(blob, cbProgress) {
}
});
});
}
}
12 changes: 12 additions & 0 deletions src/js/logoHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function handleImageError(image, siteUrl) {
let currentFallback = parseInt(image.getAttribute('data-fallback-index') || '0');

if(currentFallback == 0){
image.src = siteUrl + '/logos/preview_logo.png';
image.dataset.fallbackIndex = 1;
}
else{
image.src = 'images/logo_placeholder.png';
image.onerror = null;
}
}

0 comments on commit 36a644f

Please sign in to comment.