Skip to content

Commit

Permalink
memos
Browse files Browse the repository at this point in the history
  • Loading branch information
lmm214 committed Feb 25, 2023
1 parent 480895f commit fa99456
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions js/oper.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,18 @@ $('#search').click(function () {
var resourceList = searchData[i].item.resourceList;
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 = info.apiUrl.replace(/api\/memo.*/,'')+'o/r/'+resourceList[j].id+'/'+resourceList[j].filename
}
if(restype == 'image'){
searchDom += '<img class="random-image" src="'+ info.apiUrl.replace(/api\/memo.*/,'')+'o/r/'+resourceList[j].id+'/'+resourceList[j].filename+'"/>'
searchDom += '<img class="random-image" src="'+resLink+'"/>'
}
if(restype !== 'image'){
searchDom += '<a target="_blank" rel="noreferrer" href="'+resLink+'">'+resourceList[j].filename+'</a>'
}
}
}
Expand Down Expand Up @@ -309,8 +319,18 @@ function randDom(randomData){
var resourceList = randomData.resourceList;
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 = info.apiUrl.replace(/api\/memo.*/,'')+'o/r/'+resourceList[j].id+'/'+resourceList[j].filename
}
if(restype == 'image'){
randomDom += '<img class="random-image" src="'+info.apiUrl.replace(/api\/memo.*/,'')+'o/r/'+resourceList[j].id+'/'+resourceList[j].filename+'"/>'
randomDom += '<img class="random-image" src="'+resLink+'"/>'
}
if(restype !== 'image'){
randomDom += '<a target="_blank" rel="noreferrer" href="'+resLink+'">'+resourceList[j].filename+'</a>'
}
}
}
Expand Down

0 comments on commit fa99456

Please sign in to comment.