Skip to content

Commit

Permalink
fix: resource link
Browse files Browse the repository at this point in the history
closed #4
  • Loading branch information
eallion committed Feb 28, 2023
1 parent df4a83c commit a0b5422
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,19 @@ function updateHTMl(data) {
var imgUrl = '', resUrl = '', resImgLength = 0;
for (var j = 0; j < resourceList.length; j++) {
var resType = resourceList[j].type.slice(0, 5);
var resexlink = resourceList[j].externalLink;
var resLink = ''
if (resexlink) {
resLink = resexlink
} else {
resLink = memos + 'o/r/' + resourceList[j].id + '/' + resourceList[j].filename
}
if (resType == 'image') {
imgUrl += '<img loading="lazy" src="' + memos + 'o/r/' + resourceList[j].id + '/' + resourceList[j].filename + '"/>'
imgUrl += '<img loading="lazy" src=" ' + resLink + '"/>'
resImgLength = resImgLength + 1
}
if (resType !== 'image') {
resUrl += '<a target="_blank" rel="noreferrer" href="' + memos + 'o/r/' + resourceList[j].id + '/' + resourceList[j].filename + '">' + resourceList[j].filename + '</a>'
resUrl += '<a target="_blank" rel="noreferrer" href="' + resLink + '">' + resourceList[j].filename + '</a>'
}
}
if (imgUrl) {
Expand Down

0 comments on commit a0b5422

Please sign in to comment.