generated from dellevin/template
更新动画效果
This commit is contained in:
@@ -213,7 +213,7 @@
|
||||
const category = post.categories && post.categories.length > 0 ? post.categories[0].name : '未分类';
|
||||
const digest = post.digest || '';
|
||||
|
||||
let html = `<div class="blog-post-item" onclick="window.open('${post.permalink}', '_blank')">`;
|
||||
let html = `<div class="blog-post-item" onclick="showCustomConfirm('确定要打开网站吗?\\n${post.permalink}', () => window.open('${post.permalink}', '_blank'))">`;
|
||||
html += `<div class="blog-post-title">${escapeHtml(post.title)}</div>`;
|
||||
if (digest) {
|
||||
html += `<div class="blog-post-digest">${escapeHtml(digest)}</div>`;
|
||||
|
||||
@@ -168,11 +168,11 @@
|
||||
window.openPhotoLightbox = function(photoIndex) {
|
||||
currentPhotoIndex = photoIndex;
|
||||
|
||||
// 检查是否已经存在 lightbox
|
||||
let lightbox = document.querySelector('.photo-lightbox');
|
||||
// 检查是否已经存在 lightbox(使用特定的类名避免与MookNote冲突)
|
||||
let lightbox = document.querySelector('.photo-album-lightbox');
|
||||
if (!lightbox) {
|
||||
lightbox = document.createElement('div');
|
||||
lightbox.className = 'photo-lightbox';
|
||||
lightbox.className = 'photo-lightbox photo-album-lightbox'; // 同时保留两个类名以兼容CSS
|
||||
lightbox.innerHTML = `
|
||||
<span class="photo-lightbox-close">×</span>
|
||||
<span class="photo-lightbox-nav photo-lightbox-prev">❮</span>
|
||||
@@ -208,7 +208,7 @@
|
||||
|
||||
// 更新 Lightbox 图片
|
||||
function updateLightboxImage() {
|
||||
const lightbox = document.querySelector('.photo-lightbox');
|
||||
const lightbox = document.querySelector('.photo-album-lightbox');
|
||||
if (!lightbox || !allPhotos[currentPhotoIndex]) return;
|
||||
|
||||
const img = lightbox.querySelector('img');
|
||||
@@ -255,6 +255,10 @@
|
||||
|
||||
// 处理键盘事件
|
||||
function handleLightboxKeydown(e) {
|
||||
// 只在旅途剪影的lightbox激活时处理
|
||||
const albumLightbox = document.querySelector('.photo-album-lightbox');
|
||||
if (!albumLightbox || !albumLightbox.classList.contains('active')) return;
|
||||
|
||||
if (e.key === 'ArrowLeft') {
|
||||
showPreviousPhoto();
|
||||
} else if (e.key === 'ArrowRight') {
|
||||
@@ -266,7 +270,7 @@
|
||||
|
||||
// 关闭照片放大查看器
|
||||
function closePhotoLightbox() {
|
||||
const lightbox = document.querySelector('.photo-lightbox');
|
||||
const lightbox = document.querySelector('.photo-album-lightbox');
|
||||
if (lightbox) {
|
||||
lightbox.classList.remove('active');
|
||||
|
||||
|
||||
@@ -100,7 +100,9 @@ function renderWebsites(websitesArray) {
|
||||
} else {
|
||||
linkElement.onclick = (e) => {
|
||||
e.preventDefault();
|
||||
window.open(item.url, '_blank');
|
||||
showCustomConfirm(`确定要打开网站吗?\n${item.url}`, () => {
|
||||
window.open(item.url, '_blank');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -126,7 +128,11 @@ function renderWebsites(websitesArray) {
|
||||
if (item.url === 'https://mooknote.iletter.top/#/') {
|
||||
card.onclick = () => openMookNoteModal();
|
||||
} else {
|
||||
card.onclick = () => window.open(item.url, '_blank');
|
||||
card.onclick = () => {
|
||||
showCustomConfirm(`确定要打开网站吗?\n${item.url}`, () => {
|
||||
window.open(item.url, '_blank');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const title = currentLang === 'en' ? item.linkText_en : item.linkText_zh;
|
||||
@@ -220,7 +226,7 @@ window.nextMooknoteImage = function() {
|
||||
// 全屏预览功能
|
||||
window.openMooknoteLightbox = function(index) {
|
||||
lightboxImageIndex = index;
|
||||
const lightbox = document.getElementById('mooknote-lightbox');
|
||||
const lightbox = document.querySelector('.mooknote-lightbox');
|
||||
const img = lightbox.querySelector('.lightbox-img');
|
||||
const counter = lightbox.querySelector('.lightbox-counter');
|
||||
|
||||
@@ -230,7 +236,7 @@ window.openMooknoteLightbox = function(index) {
|
||||
};
|
||||
|
||||
window.closeMooknoteLightbox = function() {
|
||||
const lightbox = document.getElementById('mooknote-lightbox');
|
||||
const lightbox = document.querySelector('.mooknote-lightbox');
|
||||
lightbox.classList.remove('active');
|
||||
};
|
||||
|
||||
@@ -245,7 +251,7 @@ window.nextLightboxImage = function() {
|
||||
};
|
||||
|
||||
function updateLightboxImage() {
|
||||
const lightbox = document.getElementById('mooknote-lightbox');
|
||||
const lightbox = document.querySelector('.mooknote-lightbox');
|
||||
const img = lightbox.querySelector('.lightbox-img');
|
||||
const counter = lightbox.querySelector('.lightbox-counter');
|
||||
|
||||
@@ -255,8 +261,8 @@ function updateLightboxImage() {
|
||||
|
||||
// 键盘事件支持
|
||||
document.addEventListener('keydown', (e) => {
|
||||
const lightbox = document.getElementById('mooknote-lightbox');
|
||||
if (!lightbox.classList.contains('active')) return;
|
||||
const lightbox = document.querySelector('.mooknote-lightbox');
|
||||
if (!lightbox || !lightbox.classList.contains('active')) return;
|
||||
|
||||
if (e.key === 'Escape') {
|
||||
closeMooknoteLightbox();
|
||||
|
||||
Reference in New Issue
Block a user