1 Star 0 Fork 0

恐咖兵糖/www.ftls.xyz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gallery2.html 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
恐咖兵糖 提交于 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

搜索帮助