=== WePOP ===
Contributors: wedok
Tags: lightbox, popup, gallery, image, gutenberg
Requires at least: 5.0
Tested up to: 6.9.4
Requires PHP: 7.4
Stable tag: 1.6.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A fast, jQuery-free lightbox for WordPress: open images, SVG, MP4, YouTube, and Vimeo in a clean popup—ideal for Gutenberg galleries and modern themes.

== Description ==

WePOP is a lightweight lightbox and media popup plugin with **zero dependencies**—no jQuery, no front-end framework. It uses plain JavaScript so it stays reliable as themes and other plugins update.

**What it does**

* Opens linked **images** (including **SVG**), **MP4** files, **YouTube**, and **Vimeo** in an overlay.
* Works with the **Block Editor**: gallery images can be grouped into a **slideshow** with prev/next, keyboard arrows, and **swipe** on phones.
* Three **grouping modes**: gallery block only, all images in the post (or on the page when the front/home option applies), or no grouping.
* Optional **alt text** captions: shown in a **strip below the photo** (not overlaid on tall images), **slide in sync** with grouped slideshows; **white text** on the dimmed overlay with a light shadow—no heavy caption bar. Per-image **“Disable popup”** toggle in the image block sidebar.
* **Keyboard-friendly**: Escape closes popups; image galleries support arrow keys.
* **Accessibility**: close and navigation controls expose meaningful labels for assistive tech.

**Who it’s for**

Portfolios, photo sites, menus, blogs—any site that wants a simple, fast lightbox without loading heavy scripts.

**What’s new in 1.6.3 (highlights)**

* Safer keyboard handling when closing the image lightbox (any close method).
* Video overlays (MP4 / YouTube / Vimeo) also close with **Escape**.
* Optional popups on the **front page** and **blog home** (off by default). When **off**, posts and static pages use **main content only** for link detection. When **on**, those views plus front/blog index use **whole-page** detection (header, footer, widgets included on posts and pages too).
* Clearer **REST API** parameters and response for advanced integrations.
* **SVG** link detection in content matches the front-end; scripts and styles are **versioned** for caching.
* Image lightbox: optional **alt captions move with each slide** in gallery mode; caption area is **below the image stage** so portrait and landscape shots stay readable on the mask, not on top of the picture.
* Alt caption look: **no dark bar** behind the text—white type on the overlay with a subtle shadow.

**Like WePOP?**

If it’s useful on your site, a **star rating or short review** on [WordPress.org](https://wordpress.org/plugins/wepop/) helps others find it and supports ongoing development. Thank you.

== Why Choose WePOP? ==

* **Stable & compatible**: Vanilla JS—no fights with jQuery versions or bundled libraries.
* **Lightweight**: Small footprint; no unnecessary database overhead for normal use.
* **Modern WordPress**: Built around blocks and standard post content.
* **Polished UX**: Full-width slide transitions for grouped images; touch-friendly.
* **Straightforward settings**: Popup mode, language, captions, and front/home option—without a maze of options.

== Documentation & Support ==

* [Official documentation (Japanese)](https://wedok.jp/tools/wepop/)

== Popup Trigger Rules ==

WePOP detects supported media links and opens them in a popup when the visitor clicks a normal left click (modifier keys such as Ctrl, ⌘ Command, Shift, or Alt are left alone so “open in new tab” behavior still works).

Supported media types:

* Image files: jpg, jpeg, png, gif, webp, svg
* Video URLs: YouTube, Vimeo
* Direct video files: MP4

**Where links are detected**

* On **single posts and static pages** (default script loading), with **Front page & blog home** **unchecked**, supported links are detected only inside the **main content area** (typically `<main>`, or `.entry-content` / `#content` on themes without `<main>`). Header, footer, and widget areas are **not** included.
* Enable **Front page & blog home** to also load popups on the **site front page** and **blog posts index**, and to detect links **across the whole page on posts and pages too** (header, footer, sidebars, and widgets), not only the main content wrapper.
* Add the **`wepop-disable`** class (or wrap markup in an element with that class) to skip popups for specific links or regions.

== Popup Mode Settings ==

You can choose how **image** links are grouped into popup viewers. This affects slideshow prev/next and keyboard navigation.

* **Gallery Blocks Mode**  
  Only images inside WordPress Gallery blocks are grouped into slideshows. Other image links open on their own.

* **All Images Mode**  
  All qualifying image links **in the same detection scope** are grouped together: **main content only** when **Front page & blog home** is off; **entire page** when it is on (including front/blog index views).

* **No Grouping Mode**  
  Each image opens individually with no navigation arrows.

== Language Support ==

Admin labels are localized.

Supported languages:

- Japanese
- English
- Spanish
- French
- German
- Chinese (Simplified)
- Italian
- Korean
- Portuguese (Brazil)

== Installation ==

1. In WordPress Admin go to **Plugins → Add New**.
2. Search for **WePOP**.
3. Click **Install Now**, then **Activate**.
4. Adjust options under **Settings → WePOP** if needed.

Once activated, WePOP handles supported media links automatically. Use **Front page & blog home** if you want popups on the **home page and blog index** and, on **posts and static pages**, links **outside** the main content (e.g. header/footer banners) to open in the popup as well.

== Screenshots ==

1. Plugin settings screen
2. Per-image “Disable Popup” toggle in the block editor
3. Single image lightbox
4. Grouped gallery slideshow with navigation
5. YouTube popup
6. Vimeo popup
7. MP4 popup
8. Optional alt text in a strip below the image (hidden when empty)

== Frequently Asked Questions ==

= Does WePOP require jQuery? =

No. WePOP uses vanilla JavaScript only and has no front-end dependencies.

= Does it work with the Block Editor (Gutenberg)? =

Yes. Grouping is optimized for the Gallery block; you can disable the popup per image in the sidebar.

= Does it work with the Classic Editor? =

Yes. Popups work for supported links in content; grouping works best when gallery markup matches WordPress galleries.

= How do I use popups on the front page or blog home (e.g. header/footer image links)? =

Go to **Settings → WePOP** and enable **Front page & blog home**. That loads the popup script on the **front page** and **blog posts index** and detects supported links **anywhere on those views**. It also switches **posts and static pages** to **whole-page** detection so header, footer, and widget links can open in the popup. With the setting off, only the **main content area** (e.g. `main` or `.entry-content`) is used on posts and pages. Use **`wepop-disable`** on a link or wrapper to exclude specific elements.

= Why does YouTube or Vimeo say “This video cannot be played”? =

Some videos cannot be embedded on external sites due to the uploader’s privacy settings.

= Why doesn’t the popup work on my site? =

Common causes include caching/minify plugins altering JavaScript, or themes that change link behavior. Try excluding WePOP scripts from optimization.

= Does it work with page builders (e.g. Elementor)? =

Often yes if the output is normal links to image or video URLs. Custom HTML or non-standard galleries may limit grouping.

= Can I use WePOP alongside another lightbox plugin? =

You can, but two lightboxes on the same links may conflict. Disable or configure the other plugin if clicks behave oddly.

= Does it support gallery plugins like NextGEN? =

Image popups may work, but grouping may not match WePOP’s gallery-block logic.

= Feedback and support =

If WePOP is useful on your site, a short review on WordPress.org helps others find it. For detailed help, see the documentation link above.

== Changelog ==

= 1.6.3 =
* Fix: Remove document keydown listener when closing the image popup by any means (not only Escape)
* Video popups: Escape key closes MP4, YouTube, and Vimeo overlays
* Setting: Enable popups on front page and blog posts index (default off)
* Front/home **off**: on posts and static pages, link detection is limited to the **main content** wrapper (`main`, `.entry-content`, or `#content` fallback), not header/footer/widgets
* Front/home **on**: loads on front page and blog index; **whole-page** link detection on posts and pages too (header, footer, widgets)
* Fix: static front page with Front/home off no longer loads scripts (avoid `is_page()` running before front check)
* Add svg to content filter for data-wepop (matches JS image detection)
* Enqueue script, style, and editor script with WEPOP_VERSION
* REST POST /wepop/v1/disable: args schema and sanitize; response shape success, url, disabled_links
* Accessibility: aria-label on close and prev/next controls (localized via wp_localize_script)
* Image lightbox: optional alt captions **slide horizontally with** slideshow images
* Alt captions use a **dedicated row below the image** so text stays on the dimmed overlay (tall images no longer cover the caption)
* Alt caption styling: **no background bar**; white text with shadow for contrast on the overlay
* Updated translations and settings screen copy (link scope and Front page / blog home)

= 1.6.2 =
* Improved slideshow transitions for images with different sizes
* Improved slide animation for grouped galleries
* Updated alt text display position and styling
* Alt text element is now hidden when empty
* Fixed popup closing behavior when clicking the mask area

= 1.6.1 =
* Added popup support for YouTube, Vimeo, and MP4 videos
* Added per-image “Disable Popup” option in the editor sidebar
* Improved file-type detection and popup trigger logic
* Enhanced slideshow transitions when grouping is enabled
* Added basic information display in the settings screen
* Updated translations and improved language consistency

= 1.6.0 =
* Added Popup Mode setting (Gallery / All / None)
* Added swipe navigation on smartphones
* Disabled background scrolling while popup is open
* Added 3 new languages: Italian, Korean, Portuguese (Brazil)
* Updated translation template

= 1.5.4 =
* Updated wording for “No grouping” mode
* Added missing gettext wrappers
* Updated .pot and ja_JP translation files

= 1.5.3 =
* Added image grouping mode setting
* Standalone images open individually in gallery mode
* Improved multilingual loading system
* Updated translations

= 1.5.2 =
* Corrected data-wepop attribute naming
* Improved documentation and translations

= 1.5.1 =
* Improved multilingual interface
* Updated settings UI

= 1.5 =
* First public release

== Upgrade Notice ==

= 1.6.3 =
Keyboard and accessibility improvements; optional home/front popups with whole-page link detection; REST response update for disable endpoint; clearer alt captions (below the image, slide with the gallery, lighter styling).

= 1.6.2 =
Improved slideshow transitions and popup closing behavior.

= 1.6.1 =
New video popup support and improved grouping behavior. Recommended for all users.