Skip to content

Commit

Permalink
add svg logo first and secend load png gdcc#59
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMeierUIT committed May 15, 2024
1 parent 7dc117a commit c6dbdb4
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions previewers/v1.4/js/retriever.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,8 @@ function addStandardPreviewHeader(file, title, authors) {

// Add logo from source Dataverse or use a local one, unless we are in preview mode
$('#logo')
.attr('src', queryParams.siteUrl + '/logos/preview_logo.png')
.attr(
'onerror',
'this.onerror=null;this.src="images/logo_placeholder.png";');
.attr('src', queryParams.siteUrl + '/logos/preview_logo.svg')
.attr('onerror', "handleImageError(this)");
}
//Footer
var footer = $.i18n("footer");
Expand Down Expand Up @@ -305,3 +303,17 @@ function reportFailure(msg, statusCode) {
+ errorText
+ statusCode);
}

function handleImageError(image) {
let currentFallback = parseInt(image.getAttribute('data-fallback-index') || '0');

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

}

0 comments on commit c6dbdb4

Please sign in to comment.