Changeset 3006502
- Timestamp:
- 12/06/2023 11:39:41 PM (16 months ago)
- Location:
- fcp-lightest-lightbox/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fcp-lightest-lightbox/trunk/assets/script.js
r2764202 r3006502 171 171 }; 172 172 173 // ******* print figcaption 174 175 const figcaption = d.createElement( 'div' ); 176 figcaption.className = 'fcplb-caption'; 177 holder.prepend( figcaption ); 178 179 function get_figcaption(a) { 180 while ( a.parentNode ) { 181 a = a.parentNode; 182 if ( a === d ) { return false } 183 if ( a.tagName.toLowerCase() !== 'figure' ) { continue } 184 const caption = a.querySelector( 'figcaption' ), 185 html = caption !== null && caption.innerHTML; 186 return html; 187 } 188 return false; 189 } 190 191 const open_figcapture = open; 192 open = a => { 193 const caption = get_figcaption( a ); 194 figcaption.innerHTML = caption || ''; 195 return open_figcapture( a ); 196 }; 173 197 174 198 // ******* swipe & finger support … … 244 268 holder.classList.add( 'fcplb-swipe-return' ); // return to the center 245 269 270 // ++prevent changing direction on diagonal move (only prev-next or only close, as started) 246 271 // ++add 2 fingers && 2 buttons to zoom 247 272 // ++doubleclick to restore the zoom lvl 273 // ++add more styles 248 274 }); 249 275 … … 269 295 } 270 296 }; 271 297 //d.querySelector( p.selector ).dispatchEvent( new Event( 'click' ) ); // for easier testing 272 298 })(); -
fcp-lightest-lightbox/trunk/assets/style.css
r2764191 r3006502 15 15 #fcplb.fcplb-active { 16 16 opacity:1; 17 z-index:9999 6;17 z-index:99995; 18 18 transition:opacity .2s ease-out, z-index 0s linear; 19 19 } … … 21 21 max-width:94%; 22 22 max-height:95%; 23 z-index:9999 7;23 z-index:99996; 24 24 } 25 25 … … 153 153 content:none; 154 154 } 155 156 /* caption figcaption */ 157 .fcplb-caption { 158 display:block; 159 position:fixed; 160 left:0; 161 right:0; 162 bottom:0; 163 z-index:99996; 164 padding:20px; 165 box-sizing:border-box; 166 text-align:center; 167 color:#fff; 168 background-color:#000000bb; 169 } 170 .fcplb-caption:empty { 171 display:none; 172 } -
fcp-lightest-lightbox/trunk/fcp-lightbox.php
r2982111 r3006502 4 4 Plugin Name: FCP Lightest Lightbox 5 5 Description: Super lightweight lighbox. It tracks the links to images and makes it open in a popup lightbox. It also adds prev-next navigation to galleries or image sequences. 6 Version: 1.4. 16 Version: 1.4.2 7 7 Requires at least: 5.7 8 Tested up to: 6. 38 Tested up to: 6.4 9 9 Requires PHP: 7.0.0 10 10 Author: Firmcatalyst, Vadim Volkov … … 16 16 defined( 'ABSPATH' ) || exit; 17 17 18 define( 'FCPLB_DEV', true );18 define( 'FCPLB_DEV', false ); 19 19 define( 'FCPLB_VER', get_file_data( __FILE__, [ 'ver' => 'Version' ] )[ 'ver' ] . ( FCPLB_DEV ? time() : '' ) ); 20 20 … … 35 35 36 36 // defer the script loading 37 add_filter('script_loader_tag', function ($tag, $handle) {38 if ( $handle !== $loader_name || strpos( $tag, 'defer ' ) !== false) { return $tag; }39 return str_replace( ' src', ' defer src', $tag );37 add_filter('script_loader_tag', function ($tag, $handle) use ($loader_name) { 38 if ( $handle !== $loader_name ) { return $tag; } 39 return str_replace( [' defer', ' src'], [' ', ' defer src'], $tag ); 40 40 }, 10, 2); 41 41 -
fcp-lightest-lightbox/trunk/loader.js
r2751155 r3006502 1 1 'use strict'; 2 (function(){let a=setInterval(function(){if(document.readyState!=='complete'&&document.readyState!=='interactive'){return}clearInterval(a);a=null; // soft wait for dom ready3 2 4 // check if the preferences exist & can load the lightbox 5 const p = window.fcp_lightbox; 6 if ( !p || !p.selector || !document.querySelector( p.selector ) ) { return } 3 // wait for DOM 4 (function(){let i=setInterval(function(){let r=document.readyState;if(r!=='complete'&&r!=='interactive'){return}clearInterval(i);i=null;r=null; 5 6 const { selector, loader, dev, ver } = window.fcp_lightbox; 7 8 // no images found 9 if ( !document.querySelector( selector ) ) { return } 7 10 8 // append the script 9 const d = document, 10 body = d.querySelector( 'body' ); 11 // get the url of the main script 12 const self = document.getElementById( loader ), 13 self_url = new URL( self.src ), 14 load_url = new URL( 'assets/script'+(dev ? '' : '.min')+'.js'+'?'+ver, self_url ).href; 11 15 12 const script = d.createElement( 'script' ); 16 // load the main script 17 const script = document.createElement( 'script' ); 13 18 Object.assign( script, { 14 'id':'fcp-lightbox-js', 'type':'text/javascript', 'async':true, 15 'src':p.path + 'assets/script' + (p.dev ? '' : '.min') + '.js?' + p.ver 19 id: loader.replace( '-loader', '' ), 20 type: 'text/javascript', 21 defer: true, 22 src: load_url 16 23 }); 17 body.append( script);24 self.parentElement.insertBefore( script, self ); 18 25 19 }, 300)})();26 },100)})(); -
fcp-lightest-lightbox/trunk/readme.txt
r2982111 r3006502 3 3 Tags: lightbox, gallery, photography, images 4 4 Requires at least: 5.7 5 Tested up to: 6. 35 Tested up to: 6.4 6 6 Requires PHP: 7.0.0 7 Stable tag: 1.4. 17 Stable tag: 1.4.2 8 8 Author: Firmcatalyst, Vadim Volkov 9 9 Author URI: https://firmcatalyst.com
Note: See TracChangeset
for help on using the changeset viewer.