mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 20:01:33 +02:00
feat: add multilingual theme introduction posts
- Added localized Retypeset theme introduction posts for multiple languages - Included posts in English, Spanish, Russian, Japanese, Chinese (Simplified and Traditional) - Standardized post structure with consistent metadata and content - Updated content configuration to support multilingual post entries
This commit is contained in:
parent
e43036ae3a
commit
d72ec58837
24 changed files with 425 additions and 669 deletions
|
@ -2,11 +2,16 @@
|
|||
import PhotoSwipeLightbox from 'photoswipe/lightbox'
|
||||
import 'photoswipe/style.css'
|
||||
|
||||
// Store lightbox instance for later use
|
||||
let lightbox: PhotoSwipeLightbox | null = null
|
||||
const pswp = import('photoswipe')
|
||||
|
||||
// Initialize PhotoSwipe lightbox with custom configuration
|
||||
function cleanup() {
|
||||
if (lightbox) {
|
||||
lightbox.destroy()
|
||||
lightbox = null
|
||||
}
|
||||
}
|
||||
|
||||
function createPhotoSwipe() {
|
||||
// Clean up existing instance if any
|
||||
cleanup()
|
||||
|
@ -24,7 +29,7 @@
|
|||
doubleTapAction: 'zoom',
|
||||
})
|
||||
|
||||
// Add custom filter to handle image data and dimensions
|
||||
// Automatically add image dimensions
|
||||
lightbox.addFilter('domItemData', (itemData: any, element: Element) => {
|
||||
if (element instanceof HTMLImageElement) {
|
||||
itemData.src = element.src
|
||||
|
@ -38,15 +43,6 @@
|
|||
lightbox.init()
|
||||
}
|
||||
|
||||
// Cleanup function to destroy lightbox instance
|
||||
function cleanup() {
|
||||
if (lightbox) {
|
||||
lightbox.destroy()
|
||||
lightbox = null
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize PhotoSwipe when DOM is ready and after page transitions
|
||||
document.addEventListener('astro:page-load', createPhotoSwipe)
|
||||
document.addEventListener('astro:before-swap', cleanup)
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue