Skip to content

Commit

Permalink
🎉 able to copy link noe & update icons (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Dec 19, 2022
1 parent 4d3fda9 commit 39ff681
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
18 changes: 17 additions & 1 deletion common/public/explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<td></td>
<td></td>
{{ else }}
<td><a class="file-link" href="{{$file.Link}}" target="_blank" download="{{$file.Name}}">📄 {{$file.Name}}</a></td>
<td><a class="file-link" href="{{$file.Link}}" target="_blank" download="{{$file.Name}}">📄
{{$file.Name}}</a></td>
<td style="">
<a class="file-link" href="{{$file.Link}}" download="{{$file.Name}}">
<svg t="1656772118144" class="icon" viewBox="0 0 1024 1024" version="1.1"
Expand All @@ -42,6 +43,21 @@
p-id="1885" fill="#333333"></path>
</svg>
</a>
<span class="file-link" onclick='copyLink("/{{$file.Link}}")' style="cursor: pointer">
<svg t="1671422296199" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="2683" width="24" height="24">
<path d="M672 832 224 832c-52.928 0-96-43.072-96-96L128 160c0-52.928 43.072-96 96-96l448 0c52.928 0 96 43.072 96 96l0 576C768 788.928 724.928 832 672 832zM224 128C206.368 128 192 142.368 192 160l0 576c0 17.664 14.368 32 32 32l448 0c17.664 0 32-14.336 32-32L704 160c0-17.632-14.336-32-32-32L224 128z"
fill="#5E6570" p-id="2684"></path>
<path d="M800 960 320 960c-17.664 0-32-14.304-32-32s14.336-32 32-32l480 0c17.664 0 32-14.336 32-32L832 256c0-17.664 14.304-32 32-32s32 14.336 32 32l0 608C896 916.928 852.928 960 800 960z"
fill="#5E6570" p-id="2685"></path>
<path d="M544 320 288 320c-17.664 0-32-14.336-32-32s14.336-32 32-32l256 0c17.696 0 32 14.336 32 32S561.696 320 544 320z"
fill="#5E6570" p-id="2686"></path>
<path d="M608 480 288.032 480c-17.664 0-32-14.336-32-32s14.336-32 32-32L608 416c17.696 0 32 14.336 32 32S625.696 480 608 480z"
fill="#5E6570" p-id="2687"></path>
<path d="M608 640 288 640c-17.664 0-32-14.304-32-32s14.336-32 32-32l320 0c17.696 0 32 14.304 32 32S625.696 640 608 640z"
fill="#5E6570" p-id="2688"></path>
</svg>
</span>
</td>
<td>{{$file.Size}}</td>
{{ end }}
Expand Down
32 changes: 12 additions & 20 deletions common/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,28 @@
<article class="media">
<div class="media-content">
<div class="content">
<div class="page-card-title"><a download="{{$file.Filename}}" href="/upload/{{$file.Link}}">{{$file.Filename}}</a>
<div class="page-card-title"><a download="{{$file.Filename}}"
href="/upload/{{$file.Link}}">{{$file.Filename}}</a>
</div>
<span class="tag is-light">{{$file.Uploader}}</span>
<span class="tag is-light">{{$file.Time}}</span>
<span class="tag is-light" id="counter-{{$file.Id}}">{{$file.DownloadCounter}} 次下载</span>
<span class="tag is-light"
id="counter-{{$file.Id}}">{{$file.DownloadCounter}} 次下载</span>
<div class="page-card-text">
{{$file.Description}}
</div>
<div class="actions">
<span onclick="deleteFile({{$file.Id}}, '{{$file.Link}}')">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
fill="#F44336"
class="bi bi-trash-fill" viewBox="0 0 16 16">
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"/>
</svg>
</span>
<span onclick="deleteFile({{$file.Id}}, '{{$file.Link}}')">
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#FF5252"><path d="M7 21q-.825 0-1.412-.587Q5 19.825 5 19V6q-.425 0-.713-.287Q4 5.425 4 5t.287-.713Q4.575 4 5 4h4q0-.425.288-.713Q9.575 3 10 3h4q.425 0 .713.287Q15 3.575 15 4h4q.425 0 .712.287Q20 4.575 20 5t-.288.713Q19.425 6 19 6v13q0 .825-.587 1.413Q17.825 21 17 21Zm2-5q0 .425.288.712Q9.575 17 10 17t.713-.288Q11 16.425 11 16V9q0-.425-.287-.713Q10.425 8 10 8t-.712.287Q9 8.575 9 9Zm4 0q0 .425.288.712.287.288.712.288t.713-.288Q15 16.425 15 16V9q0-.425-.287-.713Q14.425 8 14 8t-.712.287Q13 8.575 13 9Z"/></svg>
</span>
<span onclick="showQRCode('/upload/{{$file.Link}}')">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
fill="#2196F3"
class="bi bi-camera-fill" viewBox="0 0 16 16">
<path d="M10.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
<path d="M2 4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1.172a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 9.172 2H6.828a2 2 0 0 0-1.414.586l-.828.828A2 2 0 0 1 3.172 4H2zm.5 2a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1zm9 2.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#536DFE"><path d="M5 11q-.825 0-1.413-.588Q3 9.825 3 9V5q0-.825.587-1.413Q4.175 3 5 3h4q.825 0 1.413.587Q11 4.175 11 5v4q0 .825-.587 1.412Q9.825 11 9 11Zm0-2h4V5H5Zm0 12q-.825 0-1.413-.587Q3 19.825 3 19v-4q0-.825.587-1.413Q4.175 13 5 13h4q.825 0 1.413.587Q11 14.175 11 15v4q0 .825-.587 1.413Q9.825 21 9 21Zm0-2h4v-4H5Zm10-8q-.825 0-1.412-.588Q13 9.825 13 9V5q0-.825.588-1.413Q14.175 3 15 3h4q.825 0 1.413.587Q21 4.175 21 5v4q0 .825-.587 1.412Q19.825 11 19 11Zm0-2h4V5h-4Zm4.5 12q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm-6-6q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm2 2q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm-2 2q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm2 2q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm2-2q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm0-4q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Zm2 2q-.2 0-.35-.15-.15-.15-.15-.35v-1q0-.2.15-.35.15-.15.35-.15h1q.2 0 .35.15.15.15.15.35v1q0 .2-.15.35-.15.15-.35.15Z"/></svg>
</span>
<span onclick="copyLink('/upload/{{$file.Link}}')">
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#2196F3"><path d="M9 18q-.825 0-1.412-.587Q7 16.825 7 16V4q0-.825.588-1.413Q8.175 2 9 2h9q.825 0 1.413.587Q20 3.175 20 4v12q0 .825-.587 1.413Q18.825 18 18 18Zm-4 4q-.825 0-1.413-.587Q3 20.825 3 20V7q0-.425.288-.713Q3.575 6 4 6t.713.287Q5 6.575 5 7v13h10q.425 0 .713.288.287.287.287.712t-.287.712Q15.425 22 15 22Z"/></svg>
</span>
<a target="_blank" href="/upload/{{$file.Link}}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
fill="#3F51B5"
class="bi bi-play-circle-fill" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM6.79 5.093A.5.5 0 0 0 6 5.5v5a.5.5 0 0 0 .79.407l3.5-2.5a.5.5 0 0 0 0-.814l-3.5-2.5z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#40C4FF"><path d="M9.5 9.325v5.35q0 .575.525.875.525.3 1.025-.05l4.15-2.65q.475-.3.475-.85t-.475-.85L11.05 8.5q-.5-.35-1.025-.05-.525.3-.525.875ZM12 22q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Z"/></svg>
</a>
<a download="{{$file.Filename}}" href="/upload/{{$file.Link}}" onclick="updateDownloadCounter('counter-{{$file.Id}}')">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
Expand Down
9 changes: 8 additions & 1 deletion common/public/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ function showQRCode(link) {
showModal('qrcodeModal');
}

function copyLink(link) {
let url = window.location.origin + link;
url = decodeURI(url);
copyText(url);
showToast(`已复制:${url}`);
}

function toLocalTime(str) {
let date = Date.parse(str);
return date.toLocaleString()
Expand Down Expand Up @@ -337,7 +344,7 @@ async function loadOptions() {
tab.innerHTML = html;
}

async function updateOption(key, inputElementId, originValue="") {
async function updateOption(key, inputElementId, originValue = "") {
let inputElement = document.getElementById(inputElementId);
let value = inputElement.value;
let response = await fetch("/api/option", {
Expand Down

0 comments on commit 39ff681

Please sign in to comment.