1 Star 0 Fork 0

恐咖兵糖/www.ftls.xyz

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
gallery2.html 1.43 KB
Copy Edit Raw Blame History
恐咖兵糖 authored 2024-04-18 22:29 +08:00 . pref: 增加注释 优化文件
<!-- 画廊 -->
{{- $url := .Get 2 -}}
{{- $md5Hash := md5 $url -}}
{{- $md5Short := substr $md5Hash 0 8 -}}
<link href="https://cdn.bootcdn.net/ajax/libs/justifiedGallery/3.8.1/css/justifiedGallery.min.css" rel="stylesheet">
<div id="{{- $md5Short -}}">
</div>
<script type="text/javascript" src="https://cdn.ftls.xyz/static/whispers/assets/js/view-image.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js"></script>
<script>
fetch("{{ $url }}")
.then(response => response.text())
.then(text => {
text.trim().split('\n').forEach((imageUrl) => {
const anchor = document.createElement("a");
anchor.href = imageUrl;
anchor.classList.add("gallery-img");
const img = document.createElement("img");
img.src = imageUrl + `${imageUrl.includes("?") ? "" : "?image_process=quality,Q_10"}`; // 略缩图 - 使用 CDN 的图像处理
img.alt = "";
img.loading = "lazy";
anchor.appendChild(img);
document.getElementById("{{- $md5Short -}}").appendChild(anchor);
});
$("#{{- $md5Short -}}").justifiedGallery({
rowHeight: {{ .Get 0 | default 200 }},
});
if({{- .Get 1 | default false -}} == true) {
window.ViewImage && ViewImage.init('.gallery-img');
}
});
</script>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kkbt/www.ftls.xyz.git
git@gitee.com:kkbt/www.ftls.xyz.git
kkbt
www.ftls.xyz
www.ftls.xyz
master

Search