Version Description
The primary feature in this release is the addition of a visual loader and the automatic lightboxing of external images. In prior versions, only images from the WordPress host domain were lightboxed automatically. This caused some problems with people using a CDN as the URLs were treated as external.
There have also been a handful of code improvements under the hood including:
- Added gallery support for Jetpack Tiled Galleries
- Improved URL handling to match more image instances automatically
- Fixed a mistake in the textdomain path
- Improved admin metabox markup
- Fixed a typo in the main stylesheet's script handle
Download this release
Release Info
Developer | wpsitecare |
Plugin | WP Featherlight – A Simple jQuery Lightbox |
Version | 0.2.0 |
Comparing to | |
See all releases |
Code changes from version 0.1.1 to 0.2.0
- css/src/_featherlight.scss +10 -0
- css/src/parts/_animation.scss +8 -0
- css/src/parts/_base.scss +24 -0
- css/wp-featherlight.css +56 -2
- css/wp-featherlight.min.css +1 -1
- includes/classes/admin/meta.php +5 -11
- includes/classes/scripts.php +1 -1
- includes/plugin.php +1 -1
- js/dist/wpFeatherlight.pkgd.js +13 -14
- js/dist/wpFeatherlight.pkgd.min.js +1 -1
- js/src/wpFeatherlight.js +13 -14
- readme.txt +17 -6
- templates/admin/metabox-sidebar.php +3 -3
- wp-featherlight.php +2 -5
css/src/_featherlight.scss
CHANGED
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* Featherlight - ultra slim jQuery lightbox
|
3 |
* Version 1.2.3 - http://noelboss.github.io/featherlight/
|
1 |
+
/**
|
2 |
+
* Featherlight Animations
|
3 |
+
* Version 0.2.0
|
4 |
+
*
|
5 |
+
* Copyright 2015, WP Site Care
|
6 |
+
* MIT Licensed.
|
7 |
+
*/
|
8 |
+
@import "parts/animation";
|
9 |
+
|
10 |
+
|
11 |
/**
|
12 |
* Featherlight - ultra slim jQuery lightbox
|
13 |
* Version 1.2.3 - http://noelboss.github.io/featherlight/
|
css/src/parts/_animation.scss
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@keyframes featherlightLoader {
|
2 |
+
0% {
|
3 |
+
transform: rotate(0deg);
|
4 |
+
}
|
5 |
+
100% {
|
6 |
+
transform: rotate(360deg);
|
7 |
+
}
|
8 |
+
}
|
css/src/parts/_base.scss
CHANGED
@@ -79,3 +79,27 @@
|
|
79 |
border-bottom: 0;
|
80 |
padding: 0;
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
border-bottom: 0;
|
80 |
padding: 0;
|
81 |
}
|
82 |
+
|
83 |
+
/* Animated Loader
|
84 |
+
--------------------------------------------- */
|
85 |
+
.featherlight-loading {
|
86 |
+
.featherlight-content {
|
87 |
+
animation: featherlightLoader 1s infinite linear;
|
88 |
+
background: transparent;
|
89 |
+
border: 8px solid #909090;
|
90 |
+
border-left-color: #fff;
|
91 |
+
font-size: 10px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.featherlight-content,
|
95 |
+
.featherlight-content:after {
|
96 |
+
border-radius: 50%;
|
97 |
+
width: 10em;
|
98 |
+
height: 10em;
|
99 |
+
}
|
100 |
+
|
101 |
+
.featherlight-close,
|
102 |
+
.featherlight-inner {
|
103 |
+
display: none;
|
104 |
+
}
|
105 |
+
}
|
css/wp-featherlight.css
CHANGED
@@ -1,3 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* Featherlight - ultra slim jQuery lightbox
|
3 |
* Version 1.2.3 - http://noelboss.github.io/featherlight/
|
@@ -5,7 +36,6 @@
|
|
5 |
* Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
|
6 |
* MIT Licensed.
|
7 |
*/
|
8 |
-
|
9 |
.featherlight {
|
10 |
background: transparent;
|
11 |
cursor: pointer;
|
@@ -93,6 +123,31 @@
|
|
93 |
}
|
94 |
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* Featherlight Gallery - an extension for the ultra slim jQuery lightbox
|
98 |
* Version 1.2.3 - http://noelboss.github.io/featherlight/
|
@@ -100,7 +155,6 @@
|
|
100 |
* Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
|
101 |
* MIT Licensed.
|
102 |
*/
|
103 |
-
|
104 |
.featherlight-next,
|
105 |
.featherlight-previous {
|
106 |
background: transparent;
|
1 |
+
/**
|
2 |
+
* Featherlight Animations
|
3 |
+
* Version 0.2.0
|
4 |
+
*
|
5 |
+
* Copyright 2015, WP Site Care
|
6 |
+
* MIT Licensed.
|
7 |
+
*/
|
8 |
+
@-webkit-keyframes featherlightLoader {
|
9 |
+
0% {
|
10 |
+
-webkit-transform: rotate(0deg);
|
11 |
+
transform: rotate(0deg);
|
12 |
+
}
|
13 |
+
|
14 |
+
100% {
|
15 |
+
-webkit-transform: rotate(360deg);
|
16 |
+
transform: rotate(360deg);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
@keyframes featherlightLoader {
|
21 |
+
0% {
|
22 |
+
-webkit-transform: rotate(0deg);
|
23 |
+
transform: rotate(0deg);
|
24 |
+
}
|
25 |
+
|
26 |
+
100% {
|
27 |
+
-webkit-transform: rotate(360deg);
|
28 |
+
transform: rotate(360deg);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
/**
|
33 |
* Featherlight - ultra slim jQuery lightbox
|
34 |
* Version 1.2.3 - http://noelboss.github.io/featherlight/
|
36 |
* Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
|
37 |
* MIT Licensed.
|
38 |
*/
|
|
|
39 |
.featherlight {
|
40 |
background: transparent;
|
41 |
cursor: pointer;
|
123 |
}
|
124 |
|
125 |
|
126 |
+
/* Animated Loader
|
127 |
+
--------------------------------------------- */
|
128 |
+
|
129 |
+
.featherlight-loading .featherlight-content {
|
130 |
+
-webkit-animation: featherlightLoader 1s infinite linear;
|
131 |
+
animation: featherlightLoader 1s infinite linear;
|
132 |
+
background: transparent;
|
133 |
+
border: 8px solid #909090;
|
134 |
+
border-left-color: #fff;
|
135 |
+
font-size: 10px;
|
136 |
+
}
|
137 |
+
|
138 |
+
.featherlight-loading .featherlight-content,
|
139 |
+
.featherlight-loading .featherlight-content:after {
|
140 |
+
-webkit-border-radius: 50%;
|
141 |
+
border-radius: 50%;
|
142 |
+
height: 10em;
|
143 |
+
width: 10em;
|
144 |
+
}
|
145 |
+
|
146 |
+
.featherlight-loading .featherlight-close,
|
147 |
+
.featherlight-loading .featherlight-inner {
|
148 |
+
display: none;
|
149 |
+
}
|
150 |
+
|
151 |
/**
|
152 |
* Featherlight Gallery - an extension for the ultra slim jQuery lightbox
|
153 |
* Version 1.2.3 - http://noelboss.github.io/featherlight/
|
155 |
* Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com)
|
156 |
* MIT Licensed.
|
157 |
*/
|
|
|
158 |
.featherlight-next,
|
159 |
.featherlight-previous {
|
160 |
background: transparent;
|
css/wp-featherlight.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.featherlight{background:transparent;cursor:pointer;display:none;position:fixed;top:0;right:0;bottom:0;left:0;text-align:center;white-space:nowrap;z-index:2147483647}.featherlight *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,0.8)}.featherlight:before{content:"";display:inline-block;height:100%;margin-right:-0.25em;vertical-align:middle}.featherlight .featherlight-content{background:#fff;border:0;cursor:auto;display:inline-block;max-height:95%;max-width:90%;min-width:inherit;overflow:auto;padding:0;position:relative;text-align:left;vertical-align:middle;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{background:rgba(255,255,255,0.3);color:#000;cursor:pointer;font:Arial,sans-serif;line-height:25px;position:absolute;top:0;right:0;text-align:center;width:20px;z-index:9999}.featherlight .featherlight-image{border:20px solid #fff;max-width:100%}@media only screen and (max-width:1024px){.featherlight .featherlight-image{border:10px solid #fff}}.featherlight iframe{border:0}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight-next,.featherlight-previous{background:transparent;cursor:pointer;display:block;position:absolute;top:20px;right:20px;bottom:0;left:80%;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}@media only screen and (max-width:1024px){.featherlight-next,.featherlight-previous{top:10px;right:10px;left:85%}}.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:rgba(255,255,255,0.25)}@media only screen and (max-width:1024px){.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:0}}.featherlight-next:hover span,.featherlight-next:focus span,.featherlight-previous:hover span,.featherlight-previous:focus span{display:inline-block}.featherlight-next span,.featherlight-previous span{color:#fff;display:none;font-size:80px;font-style:normal;font-weight:normal;line-height:80px;margin-top:-40px;position:absolute;top:50%;left:5%;text-align:center;text-shadow:0 0 5px #fff;width:82%}@media only screen and (max-width:1024px){.featherlight-next span,.featherlight-previous span{display:block;font-size:40px;margin-top:-30px}}.featherlight-previous{right:80%;left:20px}@media only screen and (max-width:1024px){.featherlight-previous{right:85%;left:10px}}.featherlight-next span{right:5%;left:auto}.featherlight-loading .featherlight-previous,.featherlight-loading .featherlight-next{display:none}
|
1 |
+
@-webkit-keyframes featherlightLoader{0{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes featherlightLoader{0{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.featherlight{background:transparent;cursor:pointer;display:none;position:fixed;top:0;right:0;bottom:0;left:0;text-align:center;white-space:nowrap;z-index:2147483647}.featherlight *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,0.8)}.featherlight:before{content:"";display:inline-block;height:100%;margin-right:-0.25em;vertical-align:middle}.featherlight .featherlight-content{background:#fff;border:0;cursor:auto;display:inline-block;max-height:95%;max-width:90%;min-width:inherit;overflow:auto;padding:0;position:relative;text-align:left;vertical-align:middle;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{background:rgba(255,255,255,0.3);color:#000;cursor:pointer;font:Arial,sans-serif;line-height:25px;position:absolute;top:0;right:0;text-align:center;width:20px;z-index:9999}.featherlight .featherlight-image{border:20px solid #fff;max-width:100%}@media only screen and (max-width:1024px){.featherlight .featherlight-image{border:10px solid #fff}}.featherlight iframe{border:0}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight-loading .featherlight-content{-webkit-animation:featherlightLoader 1s infinite linear;animation:featherlightLoader 1s infinite linear;background:transparent;border:8px solid #909090;border-left-color:#fff;font-size:10px}.featherlight-loading .featherlight-content,.featherlight-loading .featherlight-content:after{-webkit-border-radius:50%;border-radius:50%;height:10em;width:10em}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.featherlight-next,.featherlight-previous{background:transparent;cursor:pointer;display:block;position:absolute;top:20px;right:20px;bottom:0;left:80%;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}@media only screen and (max-width:1024px){.featherlight-next,.featherlight-previous{top:10px;right:10px;left:85%}}.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:rgba(255,255,255,0.25)}@media only screen and (max-width:1024px){.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:0}}.featherlight-next:hover span,.featherlight-next:focus span,.featherlight-previous:hover span,.featherlight-previous:focus span{display:inline-block}.featherlight-next span,.featherlight-previous span{color:#fff;display:none;font-size:80px;font-style:normal;font-weight:normal;line-height:80px;margin-top:-40px;position:absolute;top:50%;left:5%;text-align:center;text-shadow:0 0 5px #fff;width:82%}@media only screen and (max-width:1024px){.featherlight-next span,.featherlight-previous span{display:block;font-size:40px;margin-top:-30px}}.featherlight-previous{right:80%;left:20px}@media only screen and (max-width:1024px){.featherlight-previous{right:85%;left:10px}}.featherlight-next span{right:5%;left:auto}.featherlight-loading .featherlight-previous,.featherlight-loading .featherlight-next{display:none}
|
includes/classes/admin/meta.php
CHANGED
@@ -46,12 +46,9 @@ class WP_Featherlight_Admin_Meta {
|
|
46 |
* @return void
|
47 |
*/
|
48 |
protected function stop_save() {
|
49 |
-
|
50 |
-
defined( '
|
51 |
-
defined( '
|
52 |
-
defined( 'DOING_CRON' ) && DOING_CRON,
|
53 |
-
);
|
54 |
-
return in_array( true, $stops );
|
55 |
}
|
56 |
|
57 |
/**
|
@@ -79,11 +76,8 @@ class WP_Featherlight_Admin_Meta {
|
|
79 |
* @return void
|
80 |
*/
|
81 |
public function options_callback( $post ) {
|
82 |
-
|
83 |
-
|
84 |
-
}
|
85 |
-
$type = get_post_type_object( $post->post_type );
|
86 |
-
$name = $type->labels->singular_name;
|
87 |
$disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true );
|
88 |
$checked = '';
|
89 |
if ( ! empty( $disable ) ) {
|
46 |
* @return void
|
47 |
*/
|
48 |
protected function stop_save() {
|
49 |
+
return defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ||
|
50 |
+
defined( 'DOING_AJAX' ) && DOING_AJAX ||
|
51 |
+
defined( 'DOING_CRON' ) && DOING_CRON;
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
/**
|
76 |
* @return void
|
77 |
*/
|
78 |
public function options_callback( $post ) {
|
79 |
+
$type = get_post_type_object( $post->post_type );
|
80 |
+
$name = $type->labels->singular_name;
|
|
|
|
|
|
|
81 |
$disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true );
|
82 |
$checked = '';
|
83 |
if ( ! empty( $disable ) ) {
|
includes/classes/scripts.php
CHANGED
@@ -56,7 +56,7 @@ class WP_Featherlight_Scripts {
|
|
56 |
return;
|
57 |
}
|
58 |
wp_enqueue_style(
|
59 |
-
'wp-
|
60 |
WP_FEATHERLIGHT_URL . "css/wp-featherlight{$this->suffix}.css",
|
61 |
array(),
|
62 |
WP_FEATHERLIGHT_VERSION
|
56 |
return;
|
57 |
}
|
58 |
wp_enqueue_style(
|
59 |
+
'wp-featherlight',
|
60 |
WP_FEATHERLIGHT_URL . "css/wp-featherlight{$this->suffix}.css",
|
61 |
array(),
|
62 |
WP_FEATHERLIGHT_VERSION
|
includes/plugin.php
CHANGED
@@ -56,7 +56,7 @@ class WP_Featherlight {
|
|
56 |
load_plugin_textdomain(
|
57 |
'wp-featherlight',
|
58 |
false,
|
59 |
-
|
60 |
);
|
61 |
}
|
62 |
|
56 |
load_plugin_textdomain(
|
57 |
'wp-featherlight',
|
58 |
false,
|
59 |
+
dirname( plugin_basename( WP_FEATHERLIGHT_FILE ) ) . '/languages'
|
60 |
);
|
61 |
}
|
62 |
|
js/dist/wpFeatherlight.pkgd.js
CHANGED
@@ -759,7 +759,7 @@
|
|
759 |
/**
|
760 |
* WP Featherlight - Loader and helpers for the Featherlight WordPress plugin
|
761 |
*
|
762 |
-
* @version Version 0.
|
763 |
* @copyright Copyright 2015, Robert Neu (http://robneu.com)
|
764 |
* @license MIT
|
765 |
*/
|
@@ -775,10 +775,7 @@
|
|
775 |
* @return mixed
|
776 |
*/
|
777 |
function testImages( index, element ) {
|
778 |
-
|
779 |
-
return false;
|
780 |
-
}
|
781 |
-
return /(png|jpg|jpeg|gif|tiff|bmp)$/.test( $( element ).attr( 'href' ) );
|
782 |
}
|
783 |
|
784 |
/**
|
@@ -800,17 +797,19 @@
|
|
800 |
* @since 0.1.0
|
801 |
* @return void
|
802 |
*/
|
803 |
-
function buildGalleries( index,
|
804 |
-
var
|
805 |
-
$
|
|
|
|
|
|
|
|
|
806 |
|
807 |
-
if ( ! $
|
808 |
return;
|
809 |
}
|
810 |
|
811 |
-
$
|
812 |
-
openSpeed: 300
|
813 |
-
});
|
814 |
}
|
815 |
|
816 |
/**
|
@@ -820,7 +819,7 @@
|
|
820 |
* @return void
|
821 |
*/
|
822 |
function findGalleries() {
|
823 |
-
var $gallery = $( '.gallery' );
|
824 |
|
825 |
if ( $gallery.length === 0 ) {
|
826 |
return;
|
@@ -840,7 +839,7 @@
|
|
840 |
findGalleries();
|
841 |
}
|
842 |
|
843 |
-
$(document).ready(function() {
|
844 |
wpFeatherlightInit();
|
845 |
});
|
846 |
})( this, jQuery );
|
759 |
/**
|
760 |
* WP Featherlight - Loader and helpers for the Featherlight WordPress plugin
|
761 |
*
|
762 |
+
* @version Version 0.2.0
|
763 |
* @copyright Copyright 2015, Robert Neu (http://robneu.com)
|
764 |
* @license MIT
|
765 |
*/
|
775 |
* @return mixed
|
776 |
*/
|
777 |
function testImages( index, element ) {
|
778 |
+
return /(png|jpg|jpeg|gif|tiff|bmp)$/.test( $( element ).attr( 'href' ).toLowerCase() );
|
|
|
|
|
|
|
779 |
}
|
780 |
|
781 |
/**
|
797 |
* @since 0.1.0
|
798 |
* @return void
|
799 |
*/
|
800 |
+
function buildGalleries( index, element ) {
|
801 |
+
var $galleryObj = $( element ),
|
802 |
+
$galleryItems = $galleryObj.find( '.gallery-item a' );
|
803 |
+
|
804 |
+
if ( $galleryItems.length === 0 ) {
|
805 |
+
$galleryItems = $galleryObj.find( '.tiled-gallery-item a' );
|
806 |
+
}
|
807 |
|
808 |
+
if ( ! $galleryItems.attr( 'data-featherlight' ) ) {
|
809 |
return;
|
810 |
}
|
811 |
|
812 |
+
$galleryItems.featherlightGallery();
|
|
|
|
|
813 |
}
|
814 |
|
815 |
/**
|
819 |
* @return void
|
820 |
*/
|
821 |
function findGalleries() {
|
822 |
+
var $gallery = $( '.gallery, .tiled-gallery' );
|
823 |
|
824 |
if ( $gallery.length === 0 ) {
|
825 |
return;
|
839 |
findGalleries();
|
840 |
}
|
841 |
|
842 |
+
$( document ).ready(function() {
|
843 |
wpFeatherlightInit();
|
844 |
});
|
845 |
})( this, jQuery );
|
js/dist/wpFeatherlight.pkgd.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){"use strict";function t(){this.removeEventListener("touchmove",n),this.removeEventListener("touchend",t),s=!1}function n(n){if(e.detectSwipe.preventDefault&&n.preventDefault(),s){var r,i=n.touches[0].pageX,c=n.touches[0].pageY,u=a-i,f=o-c;Math.abs(u)>=e.detectSwipe.threshold?r=u>0?"left":"right":Math.abs(f)>=e.detectSwipe.threshold&&(r=f>0?"down":"up"),r&&(t.call(this),e(this).trigger("swipe",r).trigger("swipe"+r))}}function r(e){1==e.touches.length&&(a=e.touches[0].pageX,o=e.touches[0].pageY,s=!0,this.addEventListener("touchmove",n,!1),this.addEventListener("touchend",t,!1))}function i(){this.addEventListener&&this.addEventListener("touchstart",r,!1)}e.detectSwipe={version:"2.1.1",enabled:"ontouchstart"in document.documentElement,preventDefault:!0,threshold:20};var a,o,s=!1;e.event.special.swipe={setup:i},e.each(["left","up","down","right"],function(){e.event.special["swipe"+this]={setup:function(){e(this).on("swipe",e.noop)}}})}(jQuery),function(e){"use strict";function t(e,n){if(!(this instanceof t)){var r=new t(e,n);return r.open(),r}this.id=t.id++,this.setup(e,n),this.chainCallbacks(t._callbackChain)}if("undefined"==typeof e)return void("console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery."));var n=[],r=function(t){return n=e.grep(n,function(e){return e!==t&&e.$instance.closest("body").length>0})},i=function(e,t){var n={},r=new RegExp("^"+t+"([A-Z])(.*)");for(var i in e){var a=i.match(r);if(a){var o=(a[1]+a[2].replace(/([A-Z])/g,"-$1")).toLowerCase();n[o]=e[i]}}return n},a={keyup:"onKeyUp",resize:"onResize"},o=function(n){e.each(t.opened().reverse(),function(){return n.isDefaultPrevented()||!1!==this[a[n.type]](n)?void 0:(n.preventDefault(),n.stopPropagation(),!1)})},s=function(n){if(n!==t._globalHandlerInstalled){t._globalHandlerInstalled=n;var r=e.map(a,function(e,n){return n+"."+t.prototype.namespace}).join(" ");e(window)[n?"on":"off"](r,o)}};t.prototype={constructor:t,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"✕",loading:"",otherClose:null,beforeOpen:e.noop,beforeContent:e.noop,beforeClose:e.noop,afterOpen:e.noop,afterContent:e.noop,afterClose:e.noop,onKeyUp:e.noop,onResize:e.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(t,n){"object"!=typeof t||t instanceof e!=!1||n||(n=t,t=void 0);var r=e.extend(this,n,{target:t}),i=r.resetCss?r.namespace+"-reset":r.namespace,a=e(r.background||['<div class="'+i+"-loading "+i+'">','<div class="'+i+'-content">','<span class="'+i+"-close-icon "+r.namespace+'-close">',r.closeIcon,"</span>",'<div class="'+r.namespace+'-inner">'+r.loading+"</div>","</div>","</div>"].join("")),o="."+r.namespace+"-close"+(r.otherClose?","+r.otherClose:"");return r.$instance=a.clone().addClass(r.variant),r.$instance.on(r.closeTrigger+"."+r.namespace,function(t){var n=e(t.target);("background"===r.closeOnClick&&n.is("."+r.namespace)||"anywhere"===r.closeOnClick||n.closest(o).length)&&(t.preventDefault(),r.close())}),this},getContent:function(){var t=this,n=this.constructor.contentFilters,r=function(e){return t.$currentTarget&&t.$currentTarget.attr(e)},i=r(t.targetAttr),a=t.target||i||"",o=n[t.type];if(!o&&a in n&&(o=n[a],a=t.target&&i),a=a||r("href")||"",!o)for(var s in n)t[s]&&(o=n[s],a=t[s]);if(!o){var c=a;if(a=null,e.each(t.contentFilters,function(){return o=n[this],o.test&&(a=o.test(c)),!a&&o.regex&&c.match&&c.match(o.regex)&&(a=c),!a}),!a)return"console"in window&&window.console.error("Featherlight: no content filter found "+(c?' for "'+c+'"':" (no target specified)")),!1}return o.process.call(t,a)},setContent:function(t){var n=this;return(t.is("iframe")||e("iframe",t).length>0)&&n.$instance.addClass(n.namespace+"-iframe"),n.$instance.removeClass(n.namespace+"-loading"),n.$instance.find("."+n.namespace+"-inner").slice(1).remove().end().replaceWith(e.contains(n.$instance[0],t[0])?"":t),n.$content=t.addClass(n.namespace+"-inner"),n},open:function(t){var r=this;if(r.$instance.hide().appendTo(r.root),!(t&&t.isDefaultPrevented()||r.beforeOpen(t)===!1)){t&&t.preventDefault();var i=r.getContent();if(i)return n.push(r),s(!0),r.$instance.fadeIn(r.openSpeed),r.beforeContent(t),e.when(i).always(function(e){r.setContent(e),r.afterContent(t)}).then(r.$instance.promise()).done(function(){r.afterOpen(t)})}return r.$instance.detach(),e.Deferred().reject().promise()},close:function(t){var n=this,i=e.Deferred();return n.beforeClose(t)===!1?i.reject():(0===r(n).length&&s(!1),n.$instance.fadeOut(n.closeSpeed,function(){n.$instance.detach(),n.afterClose(t),i.resolve()})),i.promise()},chainCallbacks:function(t){for(var n in t)this[n]=e.proxy(t[n],this,e.proxy(this[n],this))}},e.extend(t,{id:0,autoBind:"[data-featherlight]",defaults:t.prototype,contentFilters:{jquery:{regex:/^[#.]\w/,test:function(t){return t instanceof e&&t},process:function(t){return e(t).clone(!0)}},image:{regex:/\.(png|jpg|jpeg|gif|tiff|bmp)(\?\S*)?$/i,process:function(t){var n=this,r=e.Deferred(),i=new Image,a=e('<img src="'+t+'" alt="" class="'+n.namespace+'-image" />');return i.onload=function(){a.naturalWidth=i.width,a.naturalHeight=i.height,r.resolve(a)},i.onerror=function(){r.reject(a)},i.src=t,r.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(t){return e(t)}},ajax:{regex:/./,process:function(t){var n=e.Deferred(),r=e("<div></div>").load(t,function(e,t){"error"!==t&&n.resolve(r.contents()),n.fail()});return n.promise()}},iframe:{process:function(t){var n=new e.Deferred,r=e("<iframe/>").hide().attr("src",t).css(i(this,"iframe")).on("load",function(){n.resolve(r.show())}).appendTo(this.$instance.find("."+this.namespace+"-content"));return n.promise()}},text:{process:function(t){return e("<div>",{text:t})}}},functionAttributes:["beforeOpen","afterOpen","beforeContent","afterContent","beforeClose","afterClose"],readElementConfig:function(t,n){var r=this,i=new RegExp("^data-"+n+"-(.*)"),a={};return t&&t.attributes&&e.each(t.attributes,function(){var t=this.name.match(i);if(t){var n=this.value,o=e.camelCase(t[1]);if(e.inArray(o,r.functionAttributes)>=0)n=new Function(n);else try{n=e.parseJSON(n)}catch(s){}a[o]=n}}),a},extend:function(t,n){var r=function(){this.constructor=t};return r.prototype=this.prototype,t.prototype=new r,t.__super__=this.prototype,e.extend(t,this,n),t.defaults=t.prototype,t},attach:function(t,n,r){var i=this;"object"!=typeof n||n instanceof e!=!1||r||(r=n,n=void 0),r=e.extend({},r);var a=r.namespace||i.defaults.namespace,o=e.extend({},i.defaults,i.readElementConfig(t[0],a),r);return t.on(o.openTrigger+"."+o.namespace,o.filter,function(a){var s=e.extend({$source:t,$currentTarget:e(this)},i.readElementConfig(t[0],o.namespace),i.readElementConfig(this,o.namespace),r);new i(n,s).open(a)}),t},current:function(){var e=this.opened();return e[e.length-1]||null},opened:function(){var t=this;return r(),e.grep(n,function(e){return e instanceof t})},close:function(){var e=this.current();return e?e.close():void 0},_onReady:function(){var t=this;t.autoBind&&(t.attach(e(document),{filter:t.autoBind}),e(t.autoBind).filter("[data-featherlight-filter]").each(function(){t.attach(e(this))}))},_callbackChain:{onKeyUp:function(e,t){return 27===t.keyCode?(this.closeOnEsc&&this.$instance.find("."+this.namespace+"-close:first").click(),!1):e(t)},onResize:function(e,t){if(this.$content.naturalWidth){var n=this.$content.naturalWidth,r=this.$content.naturalHeight;this.$content.css("width","").css("height","");var i=Math.max(n/parseInt(this.$content.parent().css("width"),10),r/parseInt(this.$content.parent().css("height"),10));i>1&&this.$content.css("width",""+n/i+"px").css("height",""+r/i+"px")}return e(t)},afterContent:function(e,t){var n=e(t);return this.onResize(t),n}}}),e.featherlight=t,e.fn.featherlight=function(e,n){return t.attach(this,e,n)},e(document).ready(function(){t._onReady()})}(jQuery),function(e){"use strict";function t(n,r){if(!(this instanceof t)){var i=new t(e.extend({$source:n,$currentTarget:n.first()},r));return i.open(),i}e.featherlight.apply(this,arguments),this.chainCallbacks(s)}var n=function(e){window.console&&window.console.warn&&window.console.warn("FeatherlightGallery: "+e)};if("undefined"==typeof e)return n("Too much lightness, Featherlight needs jQuery.");if(!e.featherlight)return n("Load the featherlight plugin before the gallery plugin");var r="ontouchstart"in document.documentElement,i=e.event&&e.event.special.swipeleft&&e,a=window.Hammer&&function(e){var t=new window.Hammer.Manager(e[0]);return t.add(new window.Hammer.Swipe),t},o=r&&(i||a);r&&!o&&n("No compatible swipe library detected; one must be included before featherlightGallery for swipe motions to navigate the galleries.");var s={afterClose:function(e,t){var n=this;return n.$instance.off("next."+n.namespace+" previous."+n.namespace),n._swiper&&(n._swiper.off("swipeleft",n._swipeleft).off("swiperight",n._swiperight),n._swiper=null),e(t)},beforeOpen:function(e,t){var n=this;return n.$instance.on("next."+n.namespace+" previous."+n.namespace,function(e){var t="next"===e.type?1:-1;n.navigateTo(n.currentNavigation()+t)}),o?n._swiper=o(n.$instance).on("swipeleft",n._swipeleft=function(){n.$instance.trigger("next")}).on("swiperight",n._swiperight=function(){n.$instance.trigger("previous")}):n.$instance.find("."+n.namespace+"-content").append(n.createNavigation("previous")).append(n.createNavigation("next")),e(t)},onKeyUp:function(e,t){var n={37:"previous",39:"next"}[t.keyCode];return n?(this.$instance.trigger(n),!1):e(t)}};e.featherlight.extend(t,{autoBind:"[data-featherlight-gallery]"}),e.extend(t.prototype,{previousIcon:"◀",nextIcon:"▶",galleryFadeIn:100,galleryFadeOut:300,images:function(){return this.filter?this.$source.find(this.filter):this.$source},currentNavigation:function(){return this.images().index(this.$currentTarget)},navigateTo:function(t){var n=this,r=n.images(),i=r.length,a=n.$instance.find("."+n.namespace+"-inner");return t=(t%i+i)%i,n.$currentTarget=r.eq(t),n.beforeContent(),e.when(n.getContent(),a.fadeTo(n.galleryFadeOut,.2)).always(function(e){n.setContent(e),n.afterContent(),e.fadeTo(n.galleryFadeIn,1)})},createNavigation:function(t){var n=this;return e('<span title="'+t+'" class="'+this.namespace+"-"+t+'"><span>'+this[t+"Icon"]+"</span></span>").click(function(){e(this).trigger(t+"."+n.namespace)})}}),e.featherlightGallery=t,e.fn.featherlightGallery=function(e){return t.attach(this,e)},e(document).ready(function(){t._onReady()})}(jQuery),function(e,t){"use strict";function n(e,n){return n.hostname&&n.hostname!==location.hostname?!1:/(png|jpg|jpeg|gif|tiff|bmp)$/.test(t(n).attr("href"))}function r(){t("a[href]").filter(n).attr("data-featherlight","image")}function i(e,n){var r=t(n).attr("id"),i=t("#"+r+" .gallery-item a");i.attr("data-featherlight")&&i.featherlightGallery({openSpeed:300})}function a(){var e=t(".gallery");0!==e.length&&t.each(e,i)}function o(){r(),a()}t(document).ready(function(){o()})}(this,jQuery);
|
1 |
+
!function(e){"use strict";function t(){this.removeEventListener("touchmove",n),this.removeEventListener("touchend",t),s=!1}function n(n){if(e.detectSwipe.preventDefault&&n.preventDefault(),s){var r,i=n.touches[0].pageX,c=n.touches[0].pageY,u=a-i,l=o-c;Math.abs(u)>=e.detectSwipe.threshold?r=u>0?"left":"right":Math.abs(l)>=e.detectSwipe.threshold&&(r=l>0?"down":"up"),r&&(t.call(this),e(this).trigger("swipe",r).trigger("swipe"+r))}}function r(e){1==e.touches.length&&(a=e.touches[0].pageX,o=e.touches[0].pageY,s=!0,this.addEventListener("touchmove",n,!1),this.addEventListener("touchend",t,!1))}function i(){this.addEventListener&&this.addEventListener("touchstart",r,!1)}e.detectSwipe={version:"2.1.1",enabled:"ontouchstart"in document.documentElement,preventDefault:!0,threshold:20};var a,o,s=!1;e.event.special.swipe={setup:i},e.each(["left","up","down","right"],function(){e.event.special["swipe"+this]={setup:function(){e(this).on("swipe",e.noop)}}})}(jQuery),function(e){"use strict";function t(e,n){if(!(this instanceof t)){var r=new t(e,n);return r.open(),r}this.id=t.id++,this.setup(e,n),this.chainCallbacks(t._callbackChain)}if("undefined"==typeof e)return void("console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery."));var n=[],r=function(t){return n=e.grep(n,function(e){return e!==t&&e.$instance.closest("body").length>0})},i=function(e,t){var n={},r=new RegExp("^"+t+"([A-Z])(.*)");for(var i in e){var a=i.match(r);if(a){var o=(a[1]+a[2].replace(/([A-Z])/g,"-$1")).toLowerCase();n[o]=e[i]}}return n},a={keyup:"onKeyUp",resize:"onResize"},o=function(n){e.each(t.opened().reverse(),function(){return n.isDefaultPrevented()||!1!==this[a[n.type]](n)?void 0:(n.preventDefault(),n.stopPropagation(),!1)})},s=function(n){if(n!==t._globalHandlerInstalled){t._globalHandlerInstalled=n;var r=e.map(a,function(e,n){return n+"."+t.prototype.namespace}).join(" ");e(window)[n?"on":"off"](r,o)}};t.prototype={constructor:t,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"✕",loading:"",otherClose:null,beforeOpen:e.noop,beforeContent:e.noop,beforeClose:e.noop,afterOpen:e.noop,afterContent:e.noop,afterClose:e.noop,onKeyUp:e.noop,onResize:e.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(t,n){"object"!=typeof t||t instanceof e!=!1||n||(n=t,t=void 0);var r=e.extend(this,n,{target:t}),i=r.resetCss?r.namespace+"-reset":r.namespace,a=e(r.background||['<div class="'+i+"-loading "+i+'">','<div class="'+i+'-content">','<span class="'+i+"-close-icon "+r.namespace+'-close">',r.closeIcon,"</span>",'<div class="'+r.namespace+'-inner">'+r.loading+"</div>","</div>","</div>"].join("")),o="."+r.namespace+"-close"+(r.otherClose?","+r.otherClose:"");return r.$instance=a.clone().addClass(r.variant),r.$instance.on(r.closeTrigger+"."+r.namespace,function(t){var n=e(t.target);("background"===r.closeOnClick&&n.is("."+r.namespace)||"anywhere"===r.closeOnClick||n.closest(o).length)&&(t.preventDefault(),r.close())}),this},getContent:function(){var t=this,n=this.constructor.contentFilters,r=function(e){return t.$currentTarget&&t.$currentTarget.attr(e)},i=r(t.targetAttr),a=t.target||i||"",o=n[t.type];if(!o&&a in n&&(o=n[a],a=t.target&&i),a=a||r("href")||"",!o)for(var s in n)t[s]&&(o=n[s],a=t[s]);if(!o){var c=a;if(a=null,e.each(t.contentFilters,function(){return o=n[this],o.test&&(a=o.test(c)),!a&&o.regex&&c.match&&c.match(o.regex)&&(a=c),!a}),!a)return"console"in window&&window.console.error("Featherlight: no content filter found "+(c?' for "'+c+'"':" (no target specified)")),!1}return o.process.call(t,a)},setContent:function(t){var n=this;return(t.is("iframe")||e("iframe",t).length>0)&&n.$instance.addClass(n.namespace+"-iframe"),n.$instance.removeClass(n.namespace+"-loading"),n.$instance.find("."+n.namespace+"-inner").slice(1).remove().end().replaceWith(e.contains(n.$instance[0],t[0])?"":t),n.$content=t.addClass(n.namespace+"-inner"),n},open:function(t){var r=this;if(r.$instance.hide().appendTo(r.root),!(t&&t.isDefaultPrevented()||r.beforeOpen(t)===!1)){t&&t.preventDefault();var i=r.getContent();if(i)return n.push(r),s(!0),r.$instance.fadeIn(r.openSpeed),r.beforeContent(t),e.when(i).always(function(e){r.setContent(e),r.afterContent(t)}).then(r.$instance.promise()).done(function(){r.afterOpen(t)})}return r.$instance.detach(),e.Deferred().reject().promise()},close:function(t){var n=this,i=e.Deferred();return n.beforeClose(t)===!1?i.reject():(0===r(n).length&&s(!1),n.$instance.fadeOut(n.closeSpeed,function(){n.$instance.detach(),n.afterClose(t),i.resolve()})),i.promise()},chainCallbacks:function(t){for(var n in t)this[n]=e.proxy(t[n],this,e.proxy(this[n],this))}},e.extend(t,{id:0,autoBind:"[data-featherlight]",defaults:t.prototype,contentFilters:{jquery:{regex:/^[#.]\w/,test:function(t){return t instanceof e&&t},process:function(t){return e(t).clone(!0)}},image:{regex:/\.(png|jpg|jpeg|gif|tiff|bmp)(\?\S*)?$/i,process:function(t){var n=this,r=e.Deferred(),i=new Image,a=e('<img src="'+t+'" alt="" class="'+n.namespace+'-image" />');return i.onload=function(){a.naturalWidth=i.width,a.naturalHeight=i.height,r.resolve(a)},i.onerror=function(){r.reject(a)},i.src=t,r.promise()}},html:{regex:/^\s*<[\w!][^<]*>/,process:function(t){return e(t)}},ajax:{regex:/./,process:function(t){var n=e.Deferred(),r=e("<div></div>").load(t,function(e,t){"error"!==t&&n.resolve(r.contents()),n.fail()});return n.promise()}},iframe:{process:function(t){var n=new e.Deferred,r=e("<iframe/>").hide().attr("src",t).css(i(this,"iframe")).on("load",function(){n.resolve(r.show())}).appendTo(this.$instance.find("."+this.namespace+"-content"));return n.promise()}},text:{process:function(t){return e("<div>",{text:t})}}},functionAttributes:["beforeOpen","afterOpen","beforeContent","afterContent","beforeClose","afterClose"],readElementConfig:function(t,n){var r=this,i=new RegExp("^data-"+n+"-(.*)"),a={};return t&&t.attributes&&e.each(t.attributes,function(){var t=this.name.match(i);if(t){var n=this.value,o=e.camelCase(t[1]);if(e.inArray(o,r.functionAttributes)>=0)n=new Function(n);else try{n=e.parseJSON(n)}catch(s){}a[o]=n}}),a},extend:function(t,n){var r=function(){this.constructor=t};return r.prototype=this.prototype,t.prototype=new r,t.__super__=this.prototype,e.extend(t,this,n),t.defaults=t.prototype,t},attach:function(t,n,r){var i=this;"object"!=typeof n||n instanceof e!=!1||r||(r=n,n=void 0),r=e.extend({},r);var a=r.namespace||i.defaults.namespace,o=e.extend({},i.defaults,i.readElementConfig(t[0],a),r);return t.on(o.openTrigger+"."+o.namespace,o.filter,function(a){var s=e.extend({$source:t,$currentTarget:e(this)},i.readElementConfig(t[0],o.namespace),i.readElementConfig(this,o.namespace),r);new i(n,s).open(a)}),t},current:function(){var e=this.opened();return e[e.length-1]||null},opened:function(){var t=this;return r(),e.grep(n,function(e){return e instanceof t})},close:function(){var e=this.current();return e?e.close():void 0},_onReady:function(){var t=this;t.autoBind&&(t.attach(e(document),{filter:t.autoBind}),e(t.autoBind).filter("[data-featherlight-filter]").each(function(){t.attach(e(this))}))},_callbackChain:{onKeyUp:function(e,t){return 27===t.keyCode?(this.closeOnEsc&&this.$instance.find("."+this.namespace+"-close:first").click(),!1):e(t)},onResize:function(e,t){if(this.$content.naturalWidth){var n=this.$content.naturalWidth,r=this.$content.naturalHeight;this.$content.css("width","").css("height","");var i=Math.max(n/parseInt(this.$content.parent().css("width"),10),r/parseInt(this.$content.parent().css("height"),10));i>1&&this.$content.css("width",""+n/i+"px").css("height",""+r/i+"px")}return e(t)},afterContent:function(e,t){var n=e(t);return this.onResize(t),n}}}),e.featherlight=t,e.fn.featherlight=function(e,n){return t.attach(this,e,n)},e(document).ready(function(){t._onReady()})}(jQuery),function(e){"use strict";function t(n,r){if(!(this instanceof t)){var i=new t(e.extend({$source:n,$currentTarget:n.first()},r));return i.open(),i}e.featherlight.apply(this,arguments),this.chainCallbacks(s)}var n=function(e){window.console&&window.console.warn&&window.console.warn("FeatherlightGallery: "+e)};if("undefined"==typeof e)return n("Too much lightness, Featherlight needs jQuery.");if(!e.featherlight)return n("Load the featherlight plugin before the gallery plugin");var r="ontouchstart"in document.documentElement,i=e.event&&e.event.special.swipeleft&&e,a=window.Hammer&&function(e){var t=new window.Hammer.Manager(e[0]);return t.add(new window.Hammer.Swipe),t},o=r&&(i||a);r&&!o&&n("No compatible swipe library detected; one must be included before featherlightGallery for swipe motions to navigate the galleries.");var s={afterClose:function(e,t){var n=this;return n.$instance.off("next."+n.namespace+" previous."+n.namespace),n._swiper&&(n._swiper.off("swipeleft",n._swipeleft).off("swiperight",n._swiperight),n._swiper=null),e(t)},beforeOpen:function(e,t){var n=this;return n.$instance.on("next."+n.namespace+" previous."+n.namespace,function(e){var t="next"===e.type?1:-1;n.navigateTo(n.currentNavigation()+t)}),o?n._swiper=o(n.$instance).on("swipeleft",n._swipeleft=function(){n.$instance.trigger("next")}).on("swiperight",n._swiperight=function(){n.$instance.trigger("previous")}):n.$instance.find("."+n.namespace+"-content").append(n.createNavigation("previous")).append(n.createNavigation("next")),e(t)},onKeyUp:function(e,t){var n={37:"previous",39:"next"}[t.keyCode];return n?(this.$instance.trigger(n),!1):e(t)}};e.featherlight.extend(t,{autoBind:"[data-featherlight-gallery]"}),e.extend(t.prototype,{previousIcon:"◀",nextIcon:"▶",galleryFadeIn:100,galleryFadeOut:300,images:function(){return this.filter?this.$source.find(this.filter):this.$source},currentNavigation:function(){return this.images().index(this.$currentTarget)},navigateTo:function(t){var n=this,r=n.images(),i=r.length,a=n.$instance.find("."+n.namespace+"-inner");return t=(t%i+i)%i,n.$currentTarget=r.eq(t),n.beforeContent(),e.when(n.getContent(),a.fadeTo(n.galleryFadeOut,.2)).always(function(e){n.setContent(e),n.afterContent(),e.fadeTo(n.galleryFadeIn,1)})},createNavigation:function(t){var n=this;return e('<span title="'+t+'" class="'+this.namespace+"-"+t+'"><span>'+this[t+"Icon"]+"</span></span>").click(function(){e(this).trigger(t+"."+n.namespace)})}}),e.featherlightGallery=t,e.fn.featherlightGallery=function(e){return t.attach(this,e)},e(document).ready(function(){t._onReady()})}(jQuery),function(e,t){"use strict";function n(e,n){return/(png|jpg|jpeg|gif|tiff|bmp)$/.test(t(n).attr("href").toLowerCase())}function r(){t("a[href]").filter(n).attr("data-featherlight","image")}function i(e,n){var r=t(n),i=r.find(".gallery-item a");0===i.length&&(i=r.find(".tiled-gallery-item a")),i.attr("data-featherlight")&&i.featherlightGallery()}function a(){var e=t(".gallery, .tiled-gallery");0!==e.length&&t.each(e,i)}function o(){r(),a()}t(document).ready(function(){o()})}(this,jQuery);
|
js/src/wpFeatherlight.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* WP Featherlight - Loader and helpers for the Featherlight WordPress plugin
|
3 |
*
|
4 |
-
* @version Version 0.
|
5 |
* @copyright Copyright 2015, Robert Neu (http://robneu.com)
|
6 |
* @license MIT
|
7 |
*/
|
@@ -17,10 +17,7 @@
|
|
17 |
* @return mixed
|
18 |
*/
|
19 |
function testImages( index, element ) {
|
20 |
-
|
21 |
-
return false;
|
22 |
-
}
|
23 |
-
return /(png|jpg|jpeg|gif|tiff|bmp)$/.test( $( element ).attr( 'href' ) );
|
24 |
}
|
25 |
|
26 |
/**
|
@@ -42,17 +39,19 @@
|
|
42 |
* @since 0.1.0
|
43 |
* @return void
|
44 |
*/
|
45 |
-
function buildGalleries( index,
|
46 |
-
var
|
47 |
-
$
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
if ( ! $
|
50 |
return;
|
51 |
}
|
52 |
|
53 |
-
$
|
54 |
-
openSpeed: 300
|
55 |
-
});
|
56 |
}
|
57 |
|
58 |
/**
|
@@ -62,7 +61,7 @@
|
|
62 |
* @return void
|
63 |
*/
|
64 |
function findGalleries() {
|
65 |
-
var $gallery = $( '.gallery' );
|
66 |
|
67 |
if ( $gallery.length === 0 ) {
|
68 |
return;
|
@@ -82,7 +81,7 @@
|
|
82 |
findGalleries();
|
83 |
}
|
84 |
|
85 |
-
$(document).ready(function() {
|
86 |
wpFeatherlightInit();
|
87 |
});
|
88 |
})( this, jQuery );
|
1 |
/**
|
2 |
* WP Featherlight - Loader and helpers for the Featherlight WordPress plugin
|
3 |
*
|
4 |
+
* @version Version 0.2.0
|
5 |
* @copyright Copyright 2015, Robert Neu (http://robneu.com)
|
6 |
* @license MIT
|
7 |
*/
|
17 |
* @return mixed
|
18 |
*/
|
19 |
function testImages( index, element ) {
|
20 |
+
return /(png|jpg|jpeg|gif|tiff|bmp)$/.test( $( element ).attr( 'href' ).toLowerCase() );
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
/**
|
39 |
* @since 0.1.0
|
40 |
* @return void
|
41 |
*/
|
42 |
+
function buildGalleries( index, element ) {
|
43 |
+
var $galleryObj = $( element ),
|
44 |
+
$galleryItems = $galleryObj.find( '.gallery-item a' );
|
45 |
+
|
46 |
+
if ( $galleryItems.length === 0 ) {
|
47 |
+
$galleryItems = $galleryObj.find( '.tiled-gallery-item a' );
|
48 |
+
}
|
49 |
|
50 |
+
if ( ! $galleryItems.attr( 'data-featherlight' ) ) {
|
51 |
return;
|
52 |
}
|
53 |
|
54 |
+
$galleryItems.featherlightGallery();
|
|
|
|
|
55 |
}
|
56 |
|
57 |
/**
|
61 |
* @return void
|
62 |
*/
|
63 |
function findGalleries() {
|
64 |
+
var $gallery = $( '.gallery, .tiled-gallery' );
|
65 |
|
66 |
if ( $gallery.length === 0 ) {
|
67 |
return;
|
81 |
findGalleries();
|
82 |
}
|
83 |
|
84 |
+
$( document ).ready(function() {
|
85 |
wpFeatherlightInit();
|
86 |
});
|
87 |
})( this, jQuery );
|
readme.txt
CHANGED
@@ -3,21 +3,21 @@
|
|
3 |
Contributors: fatmedia, wpsitecare
|
4 |
Tags: jquery, lightbox, featherlight, photography, images, popup, minimal, responsive
|
5 |
Requires at least: 4.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 0.
|
8 |
License: GPL-2.0+
|
9 |
|
10 |
An ultra lightweight jQuery lightbox for WordPress images and galleries.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
|
18 |
-
For more information about the Featherlight script, check out their GitHub plugin page
|
19 |
|
20 |
-
|
21 |
|
22 |
If you'd like to submit code patches or contribute in any other way, please fork the plugin on GitHub. https://github.com/wpsitecare/wp-featherlight
|
23 |
|
@@ -27,6 +27,17 @@ If you'd like to submit code patches or contribute in any other way, please fork
|
|
27 |
|
28 |
== Changelog ==
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
= 0.1.1 =
|
31 |
Fixed a bug that caused all WordPress galleries to open in a light box. Now only galleries which have been set to link to the media attachment are opened using Featherlight.
|
32 |
|
3 |
Contributors: fatmedia, wpsitecare
|
4 |
Tags: jquery, lightbox, featherlight, photography, images, popup, minimal, responsive
|
5 |
Requires at least: 4.1
|
6 |
+
Tested up to: 4.2.2
|
7 |
+
Stable tag: 0.2.0
|
8 |
License: GPL-2.0+
|
9 |
|
10 |
An ultra lightweight jQuery lightbox for WordPress images and galleries.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
WP Featherlight is a WordPress plugin wrapper for the Featherlight jQuery lightbox plugin. When installed, the plugin will automatically display all standard WordPress images and galleries in a simple, minimalistic lightbox popup. It's also possible to load Videos, iframes, and ajax content using WP Featherlight by adding data attributes to your content. For more details on custom content loading, check out the [featherlight documentation](https://github.com/noelboss/featherlight/#usage).
|
15 |
|
16 |
+
There are no settings for WP Featherlight, so you should be able to install it without needing to configure anything. In the event you don't want a lightbox on certain pages or posts, there is an option to disable it from within the post editor screen.
|
17 |
|
18 |
+
If you find a display problem, it may be related to your theme but please [open an support request](https://wordpress.org/support/plugin/wp-featherlight) about it so we can look into it. For more information about the Featherlight script itself, check out their [GitHub plugin page](http://noelboss.github.io/featherlight/).
|
19 |
|
20 |
+
= Contributing =
|
21 |
|
22 |
If you'd like to submit code patches or contribute in any other way, please fork the plugin on GitHub. https://github.com/wpsitecare/wp-featherlight
|
23 |
|
27 |
|
28 |
== Changelog ==
|
29 |
|
30 |
+
= 0.2.0 =
|
31 |
+
The primary feature in this release is the addition of a visual loader and the automatic lightboxing of external images. In prior versions, only images from the WordPress host domain were lightboxed automatically. This caused some problems with people using a CDN as the URLs were treated as external.
|
32 |
+
|
33 |
+
There have also been a handful of code improvements under the hood including:
|
34 |
+
|
35 |
+
- Added gallery support for Jetpack Tiled Galleries
|
36 |
+
- Improved URL handling to match more image instances automatically
|
37 |
+
- Fixed a mistake in the textdomain path
|
38 |
+
- Improved admin metabox markup
|
39 |
+
- Fixed a typo in the main stylesheet's script handle
|
40 |
+
|
41 |
= 0.1.1 =
|
42 |
Fixed a bug that caused all WordPress galleries to open in a light box. Now only galleries which have been set to link to the media attachment are opened using Featherlight.
|
43 |
|
templates/admin/metabox-sidebar.php
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
?>
|
12 |
<?php wp_nonce_field( plugin_basename( WP_FEATHERLIGHT_FILE ), 'wp_featherlight_nonce' ); ?>
|
13 |
<p>
|
14 |
-
<label for="
|
15 |
-
<input type="checkbox" name="wp_featherlight_disable" id="wp_featherlight_disable" value="yes"
|
16 |
-
<?php
|
17 |
</label>
|
18 |
</p>
|
11 |
?>
|
12 |
<?php wp_nonce_field( plugin_basename( WP_FEATHERLIGHT_FILE ), 'wp_featherlight_nonce' ); ?>
|
13 |
<p>
|
14 |
+
<label for="wp_featherlight_disable">
|
15 |
+
<input type="checkbox" name="wp_featherlight_disable" id="wp_featherlight_disable" value="yes"<?php checked( $checked, 'yes' ); ?> />
|
16 |
+
<?php echo esc_html( sprintf( _x( 'Disable Lightbox on This %s', '%s = post type singular name', 'wp-featherlight' ), $name ) ); ?>
|
17 |
</label>
|
18 |
</p>
|
wp-featherlight.php
CHANGED
@@ -3,23 +3,20 @@
|
|
3 |
* Plugin Name: WP Featherlight
|
4 |
* Plugin URI: http://www.wpsitecare.com/wp-featherlight/
|
5 |
* Description: An ultra lightweight jQuery lightbox for WordPress images and galleries.
|
6 |
-
* Version: 0.
|
7 |
* Author: Robert Neu
|
8 |
* Author URI: http://robneu.com
|
9 |
* License: GPL-2.0+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
* Text Domain: wp-featherlight
|
12 |
* Domain Path: /languages
|
13 |
-
* Git URI: https://github.com/wpsitecare/wp-featherlight
|
14 |
-
* GitHub Plugin URI: https://github.com/wpsitecare/wp-featherlight
|
15 |
-
* GitHub Branch: master
|
16 |
*/
|
17 |
|
18 |
// Prevent direct access.
|
19 |
defined( 'ABSPATH' ) || exit;
|
20 |
|
21 |
define( 'WP_FEATHERLIGHT_FILE', __FILE__ );
|
22 |
-
define( 'WP_FEATHERLIGHT_VERSION', '0.
|
23 |
|
24 |
if ( ! defined( 'WP_FEATHERLIGHT_DIR' ) ) {
|
25 |
define( 'WP_FEATHERLIGHT_DIR', plugin_dir_path( WP_FEATHERLIGHT_FILE ) );
|
3 |
* Plugin Name: WP Featherlight
|
4 |
* Plugin URI: http://www.wpsitecare.com/wp-featherlight/
|
5 |
* Description: An ultra lightweight jQuery lightbox for WordPress images and galleries.
|
6 |
+
* Version: 0.2.0
|
7 |
* Author: Robert Neu
|
8 |
* Author URI: http://robneu.com
|
9 |
* License: GPL-2.0+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
* Text Domain: wp-featherlight
|
12 |
* Domain Path: /languages
|
|
|
|
|
|
|
13 |
*/
|
14 |
|
15 |
// Prevent direct access.
|
16 |
defined( 'ABSPATH' ) || exit;
|
17 |
|
18 |
define( 'WP_FEATHERLIGHT_FILE', __FILE__ );
|
19 |
+
define( 'WP_FEATHERLIGHT_VERSION', '0.2.0' );
|
20 |
|
21 |
if ( ! defined( 'WP_FEATHERLIGHT_DIR' ) ) {
|
22 |
define( 'WP_FEATHERLIGHT_DIR', plugin_dir_path( WP_FEATHERLIGHT_FILE ) );
|