=== Tobidase Swipe LightBox ===
Contributors: satohata
Tags: lightbox, gallery, popup, swipe, youtube
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Plugin URI: https://satoruhatano.xsrv.jp/tobidase-swipe-lightbox/

A swipeable lightbox for images and videos. Supports YouTube, Vimeo, Niconico, Dailymotion, and MP4. Fully configurable from the admin panel.

== Description ==

Tobidase Swipe LightBox opens images and videos in a fullscreen popup with swipe support.

**Features:**

* Swipeable popup for images and videos
* Supports YouTube, Vimeo, Niconico, Dailymotion, and MP4
* Auto-fetches title and thumbnail from YouTube and Vimeo
* Two popup styles: **standard popup** and **zoom**
* Zoom on desktop: double-click or Ctrl+scroll to zoom in/out; drag to pan while zoomed
* Auto-captures MP4 thumbnails from self-hosted video files (browser-side, no server processing)
* Switch popup style per post type in the admin settings
* Override the style for individual items directly in the post editor
* Group images and videos within a post for sequential slideshow display
* Reset the slideshow at the group boundary.
* Slide counter display (current / total)
* Loop, autoplay, and mute options
* Caption alignment (center / left)
* Keyboard navigation (← →, Esc)
* Admin bar compatible (z-index safe)
* Hint animation on popup open (mobile)

**How to open an image in the popup:**

1. Insert an image in the post editor
2. Click the image → click "Link" in the block toolbar
3. Select "Media File" and save

**How to insert a video:**

1. Place the cursor at the insertion point in the post editor (Text mode)
2. Click the "Tobidase Movie" quicktag button
3. Enter the video URL in the dialog
4. Optionally add a thumbnail and caption, then click "Insert"

== Installation ==

1. Upload the `tobidase-swipe-lightbox` folder to `/wp-content/plugins/`
2. Activate the plugin from the WordPress admin "Plugins" screen
3. Go to **Tools > Tobidase SLB** to configure settings

== Frequently Asked Questions ==

= The popup does not open when I click an image. =

Make sure the image link is set to "Media File". If the link is set to "Attachment Page" or "None", the popup will not open.

= Can I use this with videos? =

Yes. YouTube, Vimeo, Niconico, Dailymotion, and MP4 are supported. Use the "Tobidase Movie" quicktag button in the post editor to insert a video.

= Why isn't the thumbnail auto-fetched for my MP4 video? =

For MP4 files hosted on your own site, the thumbnail is captured automatically from the video in your browser. For MP4 files hosted on another website, browsers block this capture for security reasons (CORS) unless that website explicitly allows it. In that case, please enter the thumbnail image URL manually.

= How do I navigate between slides? =

* **Mobile:** Swipe left/right, or tap the navigation buttons at the bottom of the popup
* **PC:** Click the arrow buttons on the left/right of the screen, or use the ← → keyboard keys
* **Close:** Tap the ✕ button, tap the background, or press Esc

== External services ==

This plugin connects to third-party services to retrieve video metadata (thumbnails and titles). These requests are made only when a video URL is entered in the admin editor dialog, or when a post containing a [tdslb-movie] shortcode is published/saved.

= YouTube =
Fetches thumbnail images and video titles via the YouTube oEmbed API and thumbnail CDN.
No personal user data is transmitted; only the video ID is used.
Terms of service: https://www.youtube.com/t/terms
Privacy policy: https://policies.google.com/privacy

= Vimeo =
Fetches thumbnail images and video titles via the Vimeo v2 API.
No personal user data is transmitted; only the video ID is used.
Terms of service: https://vimeo.com/terms
Privacy policy: https://vimeo.com/privacy

= Niconico (NicoVideo) =
Fetches thumbnail images and video titles via the Niconico public API (ext.nicovideo.jp).
No personal user data is transmitted; only the video ID is used.
Terms of service: https://account.nicovideo.jp/rules/account
Privacy policy: https://account.nicovideo.jp/rules/account

= Dailymotion =
Fetches thumbnail images and video titles via the Dailymotion public API.
No personal user data is transmitted; only the video ID is used.
Terms of service: https://www.dailymotion.com/legal/terms
Privacy policy: https://www.dailymotion.com/legal/privacy

== Screenshots ==

1. Each image in the Classic Editor shows a badge icon indicating its lightbox mode at a glance.
2. Videos display with an auto-fetched thumbnail and platform badge. Embed mode is also supported.
3. The image detail dialog lets you choose the lightbox mode and add a caption per image.
4. The video insert dialog supports YouTube, Vimeo, Niconico, Dailymotion, and MP4.
5. Images can be grouped in the editor for sequential swipe display in the lightbox.

== Changelog ==
= 1.0.4 =
* Tested: Confirmed compatibility with WordPress 7.1.

= 1.0.3 =
* Fix: When multiple images were inserted together in the visual editor, text typed right before/after an image could end up trapped inside the image's link tag. Text is now automatically moved outside the link when the content is displayed, and a line break (Shift+Enter) right after an image is handled the same way.
* Fix: A paragraph containing several images is now automatically split (both in the visual editor and in the displayed page) so each image gets its own paragraph, letting you place text above/below each image without affecting the swipe grouping.
* Fix: Images inside figure blocks (block editor) with extra text inside the link previously failed to convert into a lightbox at all; this is now corrected.
* Improve: Clicking an image link and pressing the Left/Right arrow key now moves the cursor out of the link (still inside the same paragraph), so text and line breaks typed next to an image no longer get trapped inside the link tag.
* Improve: Redesigned the "swipe" mode badge icon — the center frame is now a tall rectangle instead of a square, with a wide white bar appearing to pass behind it (evoking a filmstrip), instead of two separate faded side chips.

= 1.0.2 =
* New: Auto-capture thumbnails from self-hosted MP4 files in the editor (browser-side)
* New: Zoom support on desktop — double-click or Ctrl+scroll to zoom; drag to pan

= 1.0.1 =
* Fix: Groups with the same name are now treated as separate groups
* Improve: Lightbox layout on mobile landscape (button position, image size)
* Improve: Settings page — added section headings, grouping instructions, and redesigned controls table

= 1.0 =
* Initial release

== Upgrade Notice ==
= 1.0.3 =
Fixes text/line-breaks getting trapped inside image links, auto-splits multi-image paragraphs, and updates the swipe mode badge icon.

= 1.0.2 =
Added auto MP4 thumbnail capture and desktop zoom (double-click or Ctrl+scroll to zoom, drag to pan).

= 1.0.1 =
Fixed a bug where groups with the same name were merged into one.

= 1.0 =
Initial release.