Gallery – Photo Gallery – Image Gallery - Version 2.0.6

Version Description

Download this release

Release Info

Developer machothemes
Plugin Icon wp plugin Gallery – Photo Gallery – Image Gallery
Version 2.0.6
Comparing to
See all releases

Code changes from version 2.0.5 to 2.0.6

Modula.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://wp-modula.com/
5
  * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
6
  * Author: MachoThemes
7
- * Version: 2.0.5
8
  * Author URI: https://www.machothemes.com/
9
  * License: GPLv3 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -43,7 +43,7 @@
43
  *
44
  * @since 2.0.2
45
  */
46
- define( 'MODULA_LITE_VERSION', '2.0.5' );
47
  define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
48
  define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
49
 
4
  * Plugin URI: https://wp-modula.com/
5
  * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
6
  * Author: MachoThemes
7
+ * Version: 2.0.6
8
  * Author URI: https://www.machothemes.com/
9
  * License: GPLv3 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
43
  *
44
  * @since 2.0.2
45
  */
46
+ define( 'MODULA_LITE_VERSION', '2.0.6' );
47
  define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) );
48
  define( 'MODULA_URL', plugin_dir_url( __FILE__ ) );
49
 
README.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Modula Photo Gallery ===
2
  Contributors: machothemes, silkalns
3
- Tags: best gallery plugin, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin, masonry gallery, fancy gallery, media gallery, mosaic gallery, polaroid gallery, portfolio gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.1
6
  Requires PHP: 5.6
7
- Stable tag: 2.0.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -12,11 +12,11 @@ Photo Gallery by Modula - an advanced solution for Photo Gallery users. Create b
12
 
13
  == Description ==
14
 
15
- **Modula Photo Gallery** is a standalone plugin built, maintained & operated by the friendly folks over at [MachoThemes](https://www.machothemes.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite).
16
 
17
- With Modula, it's easier than ever to build a stunning [lightbox gallery](https://wp-modula.com/demo/lightbox-gallery?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite), masonry grids, custom grids and more in no more than a few clicks right from the WordPress dashboard.
18
 
19
- Modula is the best WordPress photo gallery plugin for adding custom, unique and responsive galleries to your website. There is a free version of Modula available (Modula Lite) and a premium version (Modula Pro) both of which will allow you to add amazing, fast-loading galleries to your website.
20
 
21
 
22
  = SEE HOW EASY IT IS TO CREATE A PHOTO GALLERY WITH MODULA =
@@ -128,7 +128,7 @@ Showcase your photography portfolio in a professional and creative way with Modu
128
 
129
  * [Food Gallery](https://wp-modula.com/demo/applications/food?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
130
 
131
- Modula is the perfect photo gallery plugin for **food blogs** and **restaurant** websites. Let your delicious meals speak for themselves in your unique and creative galleries created with Modula.
132
 
133
 
134
  * [Pets Gallery](https://wp-modula.com/demo/applications/pets-animals?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
1
+ === Modula Image Gallery ===
2
  Contributors: machothemes, silkalns
3
+ Tags: best gallery plugin, image gallery, photo gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin, masonry gallery, fancy gallery, media gallery, mosaic gallery, polaroid gallery, portfolio gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.1
6
  Requires PHP: 5.6
7
+ Stable tag: 2.0.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ **Modula Image Gallery** is a standalone plugin built, maintained & operated by the friendly folks over at [MachoThemes](https://www.machothemes.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite).
16
 
17
+ With Modula, it's easier than ever to build stunning [lightbox galleries](https://wp-modula.com/demo/lightbox-gallery?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite), masonry grids, custom grids and more in no more than a few clicks right from the WordPress dashboard.
18
 
19
+ Modula is the best WordPress gallery plugin for adding custom, unique and responsive galleries to your website. There is a free version of Modula available (Modula Lite) and a premium version (Modula Pro) both of which will allow you to add amazing, fast-loading galleries to your website.
20
 
21
 
22
  = SEE HOW EASY IT IS TO CREATE A PHOTO GALLERY WITH MODULA =
128
 
129
  * [Food Gallery](https://wp-modula.com/demo/applications/food?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
130
 
131
+ Modula is the perfect image gallery plugin for **food blogs** and **restaurant** websites. Let your delicious meals speak for themselves in your unique and creative galleries created with Modula.
132
 
133
 
134
  * [Pets Gallery](https://wp-modula.com/demo/applications/pets-animals?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
assets/css/modula-gutenberg.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .modula-block-preview {
2
+ background: #f3f3f5;
3
+ border-radius: 6px;
4
+ position: relative;
5
+ overflow: hidden; }
6
+ .modula-block-preview .components-spinner {
7
+ display: block;
8
+ float: none;
9
+ margin: 0 auto; }
10
+
11
+ .modula-block-preview__logo {
12
+ width: 100%;
13
+ height: 60px;
14
+ background: url(../images/block-preview-bg.svg) no-repeat 50% 0%;
15
+ background-size: 75%; }
16
+
17
+ .modula-block-preview__content {
18
+ width: 100%;
19
+ max-width: 400px;
20
+ margin: 40px auto;
21
+ text-align: center; }
22
+
23
+ .modula-block-preview--images {
24
+ display: -ms-flexbox;
25
+ display: flex;
26
+ -ms-flex-wrap: wrap;
27
+ flex-wrap: wrap;
28
+ margin-left: -1%;
29
+ margin-right: -1%; }
30
+
31
+ .modula-preview-image-wrap {
32
+ width: 23%;
33
+ height: 0px;
34
+ padding-bottom: 23%;
35
+ position: relative;
36
+ margin: 1%; }
37
+ .modula-preview-image-wrap img {
38
+ position: absolute;
39
+ left: 0;
40
+ top: 0;
41
+ width: 100%;
42
+ height: 100%;
43
+ -o-object-fit: cover;
44
+ object-fit: cover; }
assets/css/modula.css CHANGED
@@ -3,6 +3,7 @@
3
  overflow: hidden;
4
  transition: transform .3s ease-out, opacity .2s linear, top .3s, left .6s;
5
  opacity: 0;
 
6
  }
7
  .modula .items .item > a {
8
  display: block;
3
  overflow: hidden;
4
  transition: transform .3s ease-out, opacity .2s linear, top .3s, left .6s;
5
  opacity: 0;
6
+ box-sizing: border-box;
7
  }
8
  .modula .items .item > a {
9
  display: block;
assets/images/block-preview-bg.svg ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="364 242.9 2290 357" style="enable-background:new 364 242.9 2290 357;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#2ebf91;}
7
+ </style>
8
+ <g>
9
+ <path class="st0" d="M528.1,242.9c8.5,16.9,17,33.8,25.6,50.6c13.4,26.4,26.9,52.7,39.9,79.7c-41.8-23.3-83.6-46.7-125.4-70.1
10
+ c0.3-1.9,1.7-2.6,2.7-3.5c17.7-17.7,35.4-35.4,53.1-53c1.1-1.1,2.6-2,3.1-3.7C527.4,242.9,527.8,242.9,528.1,242.9z"/>
11
+ <path class="st0" d="M602.3,463.3c11.3-6.9,22.6-13.9,33.9-20.8c5.5-3.4,11.1-6.7,16.5-10.3c2.2-1.4,2.9-1.1,3.5,1.5
12
+ c6.4,25.3,13,50.6,19.6,75.8c0.6,2.2,1,3.7-2.4,3.5c-46.7-2.1-93.5-4.1-140.2-6.1c-0.2,0-0.3-0.1-0.5-0.2c0.5-1.7,2.1-2,3.3-2.7
13
+ c20-12.3,39.9-24.7,60-36.8c3.4-2.1,5.1-3.7,4.8-8.5c-1.4-21.3-1.8-42.6-2.6-63.9c-0.9-24.1-1.8-48.3-2.8-72.4
14
+ c-0.2-6.1-0.2-6.1,5.5-4.6c23.8,6.2,47.6,12.5,71.5,18.5c3.9,1,4.2,1.9,2.1,5.4c-23.4,38.5-46.7,77.1-70,115.7c-1,1.7-2,3.4-3,5.1
15
+ C601.7,462.8,602,463,602.3,463.3z"/>
16
+ <path class="st0" d="M372.8,326.9c48,2.6,95.8,5.1,143.9,7.7c-0.9,2-2.5,2.3-3.7,3.1c-38.6,23.2-77.3,46.4-115.9,69.6
17
+ c-3,1.8-4.3,2.6-5.4-1.9c-5.9-24.9-12.2-49.7-18.3-74.6C373.1,329.6,373,328.4,372.8,326.9z"/>
18
+ <path class="st0" d="M517.6,599.9c-23.2-43.7-45.9-86.6-69.2-130.5c2.3,1.2,3.5,1.8,4.7,2.4c39.8,21.5,79.5,43.1,119.3,64.5
19
+ c3.2,1.7,4.1,2.5,1,5.6c-17.7,17.8-35.2,35.9-52.8,53.9C519.7,596.9,518.9,598.2,517.6,599.9z"/>
20
+ <path class="st0" d="M364.9,505.1c26.6-40.5,53.1-80.8,79.7-121.3c1.3,1.3,0.9,2.5,0.9,3.6c0,46-0.1,92-0.1,137.9
21
+ c0,3.1-0.2,4.5-4,3.3c-24.9-7.7-49.9-15.2-74.9-22.8C366,505.8,365.7,505.5,364.9,505.1z"/>
22
+ </g>
23
+ <g>
24
+ <path class="st0" d="M843.2,334.1H883l44.2,71l44.2-71h39.8v168h-36.5V392.4l-47.3,71.8h-1l-46.8-71v109h-36.5V334.1z"/>
25
+ <path class="st0" d="M1110.8,505c-9.9,0-19.1-1.7-27.6-5.2c-8.5-3.4-15.8-8.2-22-14.2c-6.2-6-11-13-14.5-21.1
26
+ c-3.5-8.1-5.3-16.8-5.3-26V438c0-9.3,1.8-18,5.3-26c3.5-8.1,8.4-15.2,14.6-21.2c6.2-6.1,13.6-10.9,22.1-14.4
27
+ c8.5-3.5,17.8-5.3,27.8-5.3c9.9,0,19.1,1.7,27.6,5.2c8.5,3.4,15.8,8.2,22,14.2c6.2,6,11,13,14.5,21.1c3.5,8.1,5.3,16.8,5.3,26v0.5
28
+ c0,9.3-1.8,18-5.3,26c-3.5,8.1-8.4,15.2-14.6,21.2c-6.2,6.1-13.6,10.9-22.1,14.4C1130.1,503.2,1120.8,505,1110.8,505z
29
+ M1111.2,473.5c5.3,0,10-0.9,14-2.8c4.1-1.8,7.6-4.4,10.4-7.6c2.9-3.2,5.1-6.9,6.6-11.2c1.5-4.2,2.3-8.8,2.3-13.6V438
30
+ c0-4.8-0.8-9.3-2.4-13.6c-1.6-4.2-3.9-8-7-11.3c-3-3.3-6.6-5.9-10.8-7.8c-4.2-1.9-8.7-2.9-13.7-2.9c-5.3,0-10,0.9-14,2.8
31
+ c-4.1,1.8-7.6,4.4-10.4,7.6c-2.9,3.2-5.1,6.9-6.6,11.2c-1.5,4.2-2.3,8.8-2.3,13.6v0.5c0,4.8,0.8,9.3,2.4,13.6c1.6,4.2,3.9,8,7,11.3
32
+ c3,3.3,6.6,5.9,10.7,7.8C1101.5,472.6,1106.1,473.5,1111.2,473.5z"/>
33
+ <path class="st0" d="M1259.8,504.5c-7.5,0-14.8-1.4-21.8-4.3c-7-2.9-13.3-7.2-18.7-12.8c-5.4-5.7-9.8-12.6-13.1-20.9
34
+ c-3.3-8.2-4.9-17.7-4.9-28.4v-0.5c0-10.7,1.6-20.2,4.9-28.4c3.3-8.2,7.6-15.2,13-20.9c5.4-5.7,11.6-10,18.6-12.8
35
+ c7-2.9,14.4-4.3,22.1-4.3c9.8,0,17.8,1.9,24.1,5.8c6.3,3.8,11.6,8.3,16,13.4v-63.4h36.5v175.2h-36.5v-18.5
36
+ c-4.5,6.1-9.9,11.1-16.2,15C1277.4,502.5,1269.4,504.5,1259.8,504.5z M1269.2,473.5c4.3,0,8.4-0.8,12.1-2.5c3.8-1.7,7-4.1,9.8-7.2
37
+ c2.8-3.1,5-6.9,6.7-11.3c1.7-4.4,2.5-9.2,2.5-14.5v-0.5c0-5.3-0.8-10.1-2.5-14.5c-1.7-4.4-3.9-8.2-6.7-11.3
38
+ c-2.8-3.1-6.1-5.5-9.8-7.2c-3.8-1.7-7.8-2.5-12.1-2.5c-4.3,0-8.4,0.8-12.1,2.5c-3.8,1.7-7.1,4.1-10,7.2c-2.9,3.1-5.2,6.8-6.8,11.2
39
+ c-1.7,4.3-2.5,9.2-2.5,14.6v0.5c0,5.3,0.8,10.1,2.5,14.5c1.7,4.4,4,8.2,6.8,11.3c2.9,3.1,6.2,5.5,10,7.2
40
+ C1260.8,472.7,1264.8,473.5,1269.2,473.5z"/>
41
+ <path class="st0" d="M1411.7,504.5c-13.9,0-24.7-4.2-32.3-12.7c-7.6-8.5-11.4-20.2-11.4-35v-83.3h36.5V445c0,8.6,1.9,15.1,5.8,19.5
42
+ c3.8,4.4,9.3,6.6,16.3,6.6c7,0,12.6-2.2,16.7-6.6s6.1-10.9,6.1-19.5v-71.6h36.5v128.6h-36.5v-18.4c-2.1,2.7-4.4,5.4-6.8,7.9
43
+ c-2.5,2.5-5.2,4.7-8.3,6.6c-3,1.9-6.4,3.5-10.1,4.6C1420.5,503.9,1416.4,504.5,1411.7,504.5z"/>
44
+ <path class="st0" d="M1520.2,326.9h36.5v175.2h-36.5V326.9z"/>
45
+ <path class="st0" d="M1627.5,504.5c-6.1,0-11.8-0.8-17.2-2.5c-5.4-1.7-10-4.2-14-7.6c-4-3.4-7.2-7.5-9.5-12.4
46
+ c-2.3-4.9-3.5-10.5-3.5-16.9v-0.5c0-7,1.3-13.1,3.8-18.2c2.6-5.1,6.1-9.4,10.7-12.7c4.6-3.4,10-5.9,16.3-7.6
47
+ c6.3-1.7,13.3-2.5,21-2.5c6.6,0,12.3,0.5,17.2,1.4c4.9,1,9.6,2.2,14.3,3.8v-2.2c0-7.7-2.3-13.5-7-17.5c-4.6-4-11.5-6-20.6-6
48
+ c-7,0-13.2,0.6-18.6,1.8c-5.4,1.2-11,2.9-16.9,5.2l-9.1-27.8c7-3,14.4-5.5,22.1-7.4c7.7-1.9,17-2.9,27.8-2.9
49
+ c10.1,0,18.7,1.2,25.8,3.7c7.1,2.5,13,6,17.6,10.7c4.8,4.8,8.3,10.7,10.6,17.6c2.2,7,3.4,14.8,3.4,23.4v74.6h-35.3v-13.9
50
+ c-4.5,5-9.8,8.9-16.1,11.9C1644,503,1636.4,504.5,1627.5,504.5z M1638.5,479.3c8.6,0,15.6-2.1,20.8-6.2c5.2-4.2,7.8-9.6,7.8-16.3
51
+ v-6.5c-3.2-1.4-6.8-2.6-10.7-3.5c-3.9-0.9-8.1-1.3-12.6-1.3c-7.8,0-14,1.5-18.5,4.6c-4.5,3-6.7,7.4-6.7,13.2v0.5
52
+ c0,5,1.8,8.8,5.5,11.5C1627.8,477.9,1632.6,479.3,1638.5,479.3z"/>
53
+ <path class="st0" d="M1889.8,505c-13.1,0-25.1-2.2-35.9-6.5c-10.8-4.3-20.1-10.3-27.8-18c-7.8-7.7-13.8-16.8-18.1-27.4
54
+ c-4.3-10.6-6.5-22.1-6.5-34.6v-0.5c0-12,2.2-23.2,6.6-33.7c4.4-10.5,10.5-19.7,18.4-27.6c7.8-7.9,17.1-14.2,27.8-18.7
55
+ c10.7-4.6,22.5-6.8,35.3-6.8c7.5,0,14.4,0.5,20.5,1.6c6.2,1,11.9,2.5,17.2,4.4c5.3,1.9,10.2,4.3,14.9,7.2c4.6,2.9,9.1,6.2,13.4,9.8
56
+ l-23.3,28.1c-3.2-2.7-6.4-5.1-9.6-7.2c-3.2-2.1-6.5-3.8-10-5.3c-3.4-1.4-7.2-2.6-11.2-3.4c-4-0.8-8.4-1.2-13.2-1.2
57
+ c-6.7,0-13,1.4-18.8,4.2c-5.8,2.8-11,6.6-15.4,11.3c-4.4,4.7-7.8,10.3-10.3,16.6c-2.5,6.3-3.7,13.1-3.7,20.3v0.5
58
+ c0,7.7,1.2,14.8,3.7,21.3c2.5,6.5,6,12.1,10.6,17c4.6,4.8,9.9,8.5,16.1,11.2c6.2,2.6,13,4,20.5,4c13.8,0,25.4-3.4,34.8-10.2v-24.2
59
+ h-37.2v-31.9h73v73c-8.6,7.4-18.9,13.6-30.8,18.8C1918.8,502.4,1905.1,505,1889.8,505z"/>
60
+ <path class="st0" d="M2029.7,504.5c-6.1,0-11.8-0.8-17.2-2.5c-5.4-1.7-10-4.2-14-7.6c-4-3.4-7.2-7.5-9.5-12.4
61
+ c-2.3-4.9-3.5-10.5-3.5-16.9v-0.5c0-7,1.3-13.1,3.8-18.2c2.6-5.1,6.1-9.4,10.7-12.7c4.6-3.4,10-5.9,16.3-7.6
62
+ c6.3-1.7,13.3-2.5,21-2.5c6.6,0,12.3,0.5,17.2,1.4c4.9,1,9.6,2.2,14.3,3.8v-2.2c0-7.7-2.3-13.5-7-17.5c-4.6-4-11.5-6-20.6-6
63
+ c-7,0-13.2,0.6-18.6,1.8c-5.4,1.2-11,2.9-16.9,5.2l-9.1-27.8c7-3,14.4-5.5,22.1-7.4c7.7-1.9,17-2.9,27.8-2.9
64
+ c10.1,0,18.7,1.2,25.8,3.7c7.1,2.5,13,6,17.6,10.7c4.8,4.8,8.3,10.7,10.6,17.6c2.2,7,3.4,14.8,3.4,23.4v74.6h-35.3v-13.9
65
+ c-4.5,5-9.8,8.9-16.1,11.9C2046.3,503,2038.7,504.5,2029.7,504.5z M2040.7,479.3c8.6,0,15.6-2.1,20.8-6.2c5.2-4.2,7.8-9.6,7.8-16.3
66
+ v-6.5c-3.2-1.4-6.8-2.6-10.7-3.5c-3.9-0.9-8.1-1.3-12.6-1.3c-7.8,0-14,1.5-18.5,4.6c-4.5,3-6.7,7.4-6.7,13.2v0.5
67
+ c0,5,1.8,8.8,5.5,11.5C2030,477.9,2034.8,479.3,2040.7,479.3z"/>
68
+ <path class="st0" d="M2137,326.9h36.5v175.2H2137V326.9z"/>
69
+ <path class="st0" d="M2209.5,326.9h36.5v175.2h-36.5V326.9z"/>
70
+ <path class="st0" d="M2341.2,505c-9.6,0-18.5-1.6-26.8-4.8c-8.2-3.2-15.4-7.8-21.4-13.7c-6-5.9-10.7-12.9-14-21
71
+ c-3.4-8.1-5-17.1-5-27V438c0-9.1,1.6-17.8,4.7-25.9s7.5-15.3,13.1-21.4c5.6-6.1,12.3-10.9,20-14.4c7.8-3.5,16.4-5.3,25.8-5.3
72
+ c10.7,0,20,1.9,27.8,5.8c7.8,3.8,14.4,9,19.6,15.5c5.2,6.5,9,13.9,11.5,22.3c2.5,8.4,3.7,17.2,3.7,26.3c0,1.4,0,3-0.1,4.6
73
+ c-0.1,1.6-0.2,3.3-0.4,5h-89.5c1.8,8.3,5.4,14.6,10.9,18.8c5.5,4.2,12.4,6.4,20.5,6.4c6.1,0,11.5-1,16.3-3.1
74
+ c4.8-2.1,9.8-5.4,14.9-10.1l20.9,18.5c-6.1,7.5-13.4,13.4-22.1,17.6C2363.1,502.8,2352.9,505,2341.2,505z M2364.7,427.7
75
+ c-1.1-8.2-4-14.8-8.6-19.8c-4.6-5-10.8-7.6-18.5-7.6c-7.7,0-13.9,2.5-18.6,7.4c-4.7,5-7.8,11.6-9.2,19.9H2364.7z"/>
76
+ <path class="st0" d="M2427.4,373.4h36.5v25.9c3.7-8.8,8.7-15.8,15.1-21.1c6.4-5.3,15-7.7,25.9-7.2v38.2h-1.9
77
+ c-12.2,0-21.7,3.7-28.7,11c-7,7.4-10.4,18.8-10.4,34.3v47.5h-36.5V373.4z"/>
78
+ <path class="st0" d="M2558.4,541.2c-6.7,0-12.6-0.8-17.8-2.4c-5.1-1.6-10-3.8-14.6-6.5l12.2-26.4c2.4,1.4,5,2.6,7.8,3.6
79
+ c2.8,1,5.4,1.4,7.8,1.4c3.2,0,5.7-0.6,7.6-1.8c1.8-1.2,3.6-3.4,5.2-6.6l-50.4-129.1h38.6l29.3,87.6l28.1-87.6h37.9l-49.4,131.8
80
+ c-2.4,6.6-5,12.1-7.7,16.7c-2.7,4.6-5.7,8.3-9,11.2c-3.3,2.9-7,5-11.2,6.2C2568.6,540.6,2563.8,541.2,2558.4,541.2z"/>
81
+ </g>
82
+ </svg>
assets/js/jquery-modula.js CHANGED
@@ -1,4 +1,267 @@
1
  // Place any jQuery/helper plugins in here.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  * Project: jQuery Modula 2
4
  * Version: 1.0
@@ -58,6 +321,18 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
58
  this.init();
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  // Create custom grid gallery based on packery.
62
  Plugin.prototype.createCustomGallery = function () {
63
 
@@ -67,7 +342,7 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
67
  columns = this.options.columns,
68
  viewport = document.documentElement.clientWidth;
69
 
70
- if ( this.options.enableResponsive ) {
71
 
72
  if ( viewport <= 568 ) {
73
  columns = this.options.mobileColumns;
@@ -78,9 +353,9 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
78
  }
79
 
80
  if ( this.options.gutter > 0 ) {
81
- size = Math.trunc( ( containerWidth - this.options.gutter * columns ) / columns );
82
  }else{
83
- size = Math.trunc( containerWidth / columns );
84
  }
85
 
86
  this.$items.not(".jtg-hidden").each(function (i, item) {
@@ -93,7 +368,7 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
93
  widthColumns = 12;
94
  }
95
 
96
- if ( plugin.options.enableResponsive ) {
97
  auxWidth = widthColumns;
98
  auxHeight = heightColumns;
99
 
@@ -415,7 +690,7 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
415
  instance.onResize(instance);
416
  });
417
 
418
- $(window).on( 'scroll', function () {
419
  instance.onResize(instance);
420
  });
421
 
1
  // Place any jQuery/helper plugins in here.
2
+
3
+ /**
4
+ * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
5
+ * directory of this distribution and at
6
+ * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
7
+ */
8
+ (function (root, factory) {
9
+ if (typeof define === "function" && define.amd) {
10
+ define(factory);
11
+ } else if (typeof exports === "object") {
12
+ module.exports = factory();
13
+ } else {
14
+ root.ResizeSensor = factory();
15
+ }
16
+ }(typeof window !== 'undefined' ? window : this, function () {
17
+
18
+ // Make sure it does not throw in a SSR (Server Side Rendering) situation
19
+ if (typeof window === "undefined") {
20
+ return null;
21
+ }
22
+ // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
23
+ // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
24
+ // would generate too many unnecessary events.
25
+ var requestAnimationFrame = window.requestAnimationFrame ||
26
+ window.mozRequestAnimationFrame ||
27
+ window.webkitRequestAnimationFrame ||
28
+ function (fn) {
29
+ return window.setTimeout(fn, 20);
30
+ };
31
+
32
+ /**
33
+ * Iterate over each of the provided element(s).
34
+ *
35
+ * @param {HTMLElement|HTMLElement[]} elements
36
+ * @param {Function} callback
37
+ */
38
+ function forEachElement(elements, callback){
39
+ var elementsType = Object.prototype.toString.call(elements);
40
+ var isCollectionTyped = ('[object Array]' === elementsType
41
+ || ('[object NodeList]' === elementsType)
42
+ || ('[object HTMLCollection]' === elementsType)
43
+ || ('[object Object]' === elementsType)
44
+ || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
45
+ || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
46
+ );
47
+ var i = 0, j = elements.length;
48
+ if (isCollectionTyped) {
49
+ for (; i < j; i++) {
50
+ callback(elements[i]);
51
+ }
52
+ } else {
53
+ callback(elements);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Get element size
59
+ * @param {HTMLElement} element
60
+ * @returns {Object} {width, height}
61
+ */
62
+ function getElementSize(element) {
63
+ if (!element.getBoundingClientRect) {
64
+ return {
65
+ width: element.offsetWidth,
66
+ height: element.offsetHeight
67
+ }
68
+ }
69
+
70
+ var rect = element.getBoundingClientRect();
71
+ return {
72
+ width: Math.round(rect.width),
73
+ height: Math.round(rect.height)
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Class for dimension change detection.
79
+ *
80
+ * @param {Element|Element[]|Elements|jQuery} element
81
+ * @param {Function} callback
82
+ *
83
+ * @constructor
84
+ */
85
+ var ResizeSensor = function(element, callback) {
86
+ /**
87
+ *
88
+ * @constructor
89
+ */
90
+ function EventQueue() {
91
+ var q = [];
92
+ this.add = function(ev) {
93
+ q.push(ev);
94
+ };
95
+
96
+ var i, j;
97
+ this.call = function() {
98
+ for (i = 0, j = q.length; i < j; i++) {
99
+ q[i].call();
100
+ }
101
+ };
102
+
103
+ this.remove = function(ev) {
104
+ var newQueue = [];
105
+ for(i = 0, j = q.length; i < j; i++) {
106
+ if(q[i] !== ev) newQueue.push(q[i]);
107
+ }
108
+ q = newQueue;
109
+ };
110
+
111
+ this.length = function() {
112
+ return q.length;
113
+ }
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @param {HTMLElement} element
119
+ * @param {Function} resized
120
+ */
121
+ function attachResizeEvent(element, resized) {
122
+ if (!element) return;
123
+ if (element.resizedAttached) {
124
+ element.resizedAttached.add(resized);
125
+ return;
126
+ }
127
+
128
+ element.resizedAttached = new EventQueue();
129
+ element.resizedAttached.add(resized);
130
+
131
+ element.resizeSensor = document.createElement('div');
132
+ element.resizeSensor.dir = 'ltr';
133
+ element.resizeSensor.className = 'resize-sensor';
134
+ var style = 'position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;';
135
+ var styleChild = 'position: absolute; left: 0; top: 0; transition: 0s;';
136
+
137
+ element.resizeSensor.style.cssText = style;
138
+ element.resizeSensor.innerHTML =
139
+ '<div class="resize-sensor-expand" style="' + style + '">' +
140
+ '<div style="' + styleChild + '"></div>' +
141
+ '</div>' +
142
+ '<div class="resize-sensor-shrink" style="' + style + '">' +
143
+ '<div style="' + styleChild + ' width: 200%; height: 200%"></div>' +
144
+ '</div>';
145
+ element.appendChild(element.resizeSensor);
146
+
147
+ var position = window.getComputedStyle(element).getPropertyPriority('position');
148
+ if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) {
149
+ element.style.position = 'relative';
150
+ }
151
+
152
+ var expand = element.resizeSensor.childNodes[0];
153
+ var expandChild = expand.childNodes[0];
154
+ var shrink = element.resizeSensor.childNodes[1];
155
+ var dirty, rafId, newWidth, newHeight;
156
+ var size = getElementSize(element);
157
+ var lastWidth = size.width;
158
+ var lastHeight = size.height;
159
+
160
+ var reset = function() {
161
+ //set display to block, necessary otherwise hidden elements won't ever work
162
+ var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
163
+
164
+ if (invisible) {
165
+ var saveDisplay = element.style.display;
166
+ element.style.display = 'block';
167
+ }
168
+
169
+ expandChild.style.width = '100000px';
170
+ expandChild.style.height = '100000px';
171
+
172
+ expand.scrollLeft = 100000;
173
+ expand.scrollTop = 100000;
174
+
175
+ shrink.scrollLeft = 100000;
176
+ shrink.scrollTop = 100000;
177
+
178
+ if (invisible) {
179
+ element.style.display = saveDisplay;
180
+ }
181
+ };
182
+ element.resizeSensor.resetSensor = reset;
183
+
184
+ var onResized = function() {
185
+ rafId = 0;
186
+
187
+ if (!dirty) return;
188
+
189
+ lastWidth = newWidth;
190
+ lastHeight = newHeight;
191
+
192
+ if (element.resizedAttached) {
193
+ element.resizedAttached.call();
194
+ }
195
+ };
196
+
197
+ var onScroll = function() {
198
+ var size = getElementSize(element);
199
+ var newWidth = size.width;
200
+ var newHeight = size.height;
201
+ dirty = newWidth != lastWidth || newHeight != lastHeight;
202
+
203
+ if (dirty && !rafId) {
204
+ rafId = requestAnimationFrame(onResized);
205
+ }
206
+
207
+ reset();
208
+ };
209
+
210
+ var addEvent = function(el, name, cb) {
211
+ if (el.attachEvent) {
212
+ el.attachEvent('on' + name, cb);
213
+ } else {
214
+ el.addEventListener(name, cb);
215
+ }
216
+ };
217
+
218
+ addEvent(expand, 'scroll', onScroll);
219
+ addEvent(shrink, 'scroll', onScroll);
220
+
221
+ // Fix for custom Elements
222
+ requestAnimationFrame(reset);
223
+ }
224
+
225
+ forEachElement(element, function(elem){
226
+ attachResizeEvent(elem, callback);
227
+ });
228
+
229
+ this.detach = function(ev) {
230
+ ResizeSensor.detach(element, ev);
231
+ };
232
+
233
+ this.reset = function() {
234
+ element.resizeSensor.resetSensor();
235
+ };
236
+ };
237
+
238
+ ResizeSensor.reset = function(element, ev) {
239
+ forEachElement(element, function(elem){
240
+ elem.resizeSensor.resetSensor();
241
+ });
242
+ };
243
+
244
+ ResizeSensor.detach = function(element, ev) {
245
+ forEachElement(element, function(elem){
246
+ if (!elem) return;
247
+ if(elem.resizedAttached && typeof ev === "function"){
248
+ elem.resizedAttached.remove(ev);
249
+ if(elem.resizedAttached.length()) return;
250
+ }
251
+ if (elem.resizeSensor) {
252
+ if (elem.contains(elem.resizeSensor)) {
253
+ elem.removeChild(elem.resizeSensor);
254
+ }
255
+ delete elem.resizeSensor;
256
+ delete elem.resizedAttached;
257
+ }
258
+ });
259
+ };
260
+
261
+ return ResizeSensor;
262
+
263
+ }));
264
+
265
  /*
266
  * Project: jQuery Modula 2
267
  * Version: 1.0
321
  this.init();
322
  }
323
 
324
+ Plugin.prototype.trunc = function ( v ) {
325
+
326
+ if ( Math.trunc ) {
327
+ return Math.trunc( v );
328
+ }else{
329
+ v = +v;
330
+ if (!isFinite(v)) return v;
331
+
332
+ return (v - v % 1) || (v < 0 ? -0 : v === 0 ? v : 0);
333
+ }
334
+ }
335
+
336
  // Create custom grid gallery based on packery.
337
  Plugin.prototype.createCustomGallery = function () {
338
 
342
  columns = this.options.columns,
343
  viewport = document.documentElement.clientWidth;
344
 
345
+ if ( '1' == this.options.enableResponsive ) {
346
 
347
  if ( viewport <= 568 ) {
348
  columns = this.options.mobileColumns;
353
  }
354
 
355
  if ( this.options.gutter > 0 ) {
356
+ size = plugin.trunc( ( containerWidth - this.options.gutter * columns ) / columns );
357
  }else{
358
+ size = plugin.trunc( containerWidth / columns );
359
  }
360
 
361
  this.$items.not(".jtg-hidden").each(function (i, item) {
368
  widthColumns = 12;
369
  }
370
 
371
+ if ( '1' == plugin.options.enableResponsive ) {
372
  auxWidth = widthColumns;
373
  auxHeight = heightColumns;
374
 
690
  instance.onResize(instance);
691
  });
692
 
693
+ new ResizeSensor( instance.$element, function() {
694
  instance.onResize(instance);
695
  });
696
 
assets/js/jquery-modula.min.js CHANGED
@@ -1 +1 @@
1
- function tg_getURLParameter(t){return decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}jQuery(document).on("vc-full-width-row-single vc-full-width-row",function(t,i){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")}),function(d,l,c,t){var o="modulaGallery",e={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1};function n(t,i){this.element=t,this.$element=d(t),this.$itemsCnt=this.$element.find(".items"),this.$items=this.$itemsCnt.find(".item"),this.options=d.extend({},e,i),this._defaults=e,this._name=o,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}n.prototype.createCustomGallery=function(){var a,t=this.$element.width(),r=this,l=this.options.columns,i=c.documentElement.clientWidth;this.options.enableResponsive&&(i<=568?l=this.options.mobileColumns:i<=768&&(l=this.options.tabletColumns)),a=0<this.options.gutter?Math.trunc((t-this.options.gutter*l)/l):Math.trunc(t/l),this.$items.not(".jtg-hidden").each(function(t,i){var e,s,o,n,h={};e=d(i).data("width"),s=d(i).data("height"),12<e&&(e=12),r.options.enableResponsive&&(o=e,n=s,1==l?s=(e=1)*n/o:((e=Math.round(l*o/12))<1&&(e=1),(s=Math.round(e*n/o))<1&&(s=1))),h.width=a*e+r.options.gutter*(e-1),h.height=a*s+r.options.gutter*(s-1),d(i).data("size",h).addClass("tiled").addClass(h.width>h.height?"tile-h":"tile-v").data("position"),d(i).css(d(i).data("size")),d(i).find(".figc").css({width:d(i).data("size").width,height:d(i).data("size").height})}),this.isPackeryActive&&this.$itemsCnt.packery("destroy"),this.$itemsCnt.packery({itemSelector:".item",gutter:parseInt(r.options.gutter),columnWidth:a,resize:!1}),this.isPackeryActive=!0},n.prototype.createGrid=function(){var s=this;this.options.width&&this.$itemsCnt.width(this.options.width),this.options.height&&this.$itemsCnt.height(this.options.height),this.$itemsCnt.data("area",this.$itemsCnt.width()*this.$itemsCnt.height()),this.lastWidth=this.$itemsCnt.width();for(var t=0;t<this.$items.not(".jtg-hidden").length;t++)this.tiles.push(s.getSlot());this.tiles.sort(function(t,i){return t.position-i.position}),this.$items.not(".jtg-hidden").each(function(t,i){var e=s.tiles[t];d(i).data("size",e).addClass("tiled").addClass(e.width>e.height?"tile-h":"tile-v").data("position")}),this.$items.each(function(t,i){d(i).css(d(i).data("size")),d(i).find(".figc").css({width:d(i).data("size").width,height:d(i).data("size").height})}),this.completed=!0},n.prototype.getSlot=function(){if(0==this.tiles.length)return e={top:0,left:0,width:this.$itemsCnt.width(),height:this.$itemsCnt.height(),area:this.$itemsCnt.width()*this.$itemsCnt.height(),position:0};for(var t=0,i=0;i<this.tiles.length;i++){(e=this.tiles[i]).area>this.tiles[t].area&&(t=i)}var e={},s=this.tiles[t];if(s.width>s.height){var o=s.width/2*this.options.randomFactor;s.prevWidth=s.width,s.width=Math.floor(s.width/2+o*(Math.random()-.5)),e={top:s.top,left:s.left+s.width+this.options.margin,width:s.prevWidth-s.width-this.options.margin,height:s.height}}else{o=s.height/2*this.options.randomFactor;s.prevHeight=s.height,s.height=Math.floor(s.height/2+o*(Math.random()-.5)),e={left:s.left,top:s.top+s.height+this.options.margin,width:s.width,height:s.prevHeight-s.height-this.options.margin}}return e.area=e.width*e.height,e.position=1e3*e.top+e.left,s.position=1e3*s.top+s.left,this.tiles[t]=s,this.tiles[t].area=s.width*s.height,e},n.prototype.reset=function(){var e=this;e.tiles=[],"custom-grid"===e.options.type?(e.createCustomGallery(),e.$itemsCnt.packery()):e.createGrid(),e.$itemsCnt.find(".pic").each(function(t,i){e.placeImage(t)}),e.lastWidth=e.$itemsCnt.width()},n.prototype.onResize=function(i){i.lastWidth!=i.$itemsCnt.width()&&(clearTimeout(i.resizeTO),i.resizeTO=setTimeout(function(){if(i.options.keepArea){var t=i.$itemsCnt.data("area");i.$itemsCnt.height(t/i.$itemsCnt.width())}i.reset()},100))},n.prototype.placeImage=function(t){var i=this.$items.eq(t),e=i.find(".pic"),s=i.data("size"),o=e.data("size"),n=s.width/s.height,h=o.width/o.height,a=e.data("valign")?e.data("valign"):"middle",r=e.data("halign")?e.data("halign"):"center",l={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(h<n)switch(l.width=s.width,l.left=0,a){case"top":l.top=0;break;case"middle":l.top=0-(s.width*(1/h)-s.height)/2;break;case"bottom":l.bottom=0}else switch(l.height=s.height,l.top=0,r){case"left":l.left=0;break;case"center":l.left=0-(s.height*h-s.width)/2;break;case"right":l.right=0}e.css(l)},n.prototype.loadImage=function(t){var i=this,e=i.$items.eq(t).find(".pic"),s=new Image;s.onerror=function(){console.log("error loading image ["+t+"] : "+this.src),t+1<i.$items.length&&i.loadImage(t+1)},s.onload=function(){e.data("size",{width:this.width,height:this.height}),i.placeImage(t),i.$items.eq(t).addClass("tg-loaded"),t+1<i.$items.length&&i.loadImage(t+1)};var o=e.data("src");s.src=o,e.attr("src",o)},n.prototype.init=function(){var t=this;d(c).trigger("modula_api_before_init",[t]),this.$itemsCnt.css({position:"relative",zIndex:1}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():this.createGrid(),this.loadImage(0),d(l).resize(function(){t.onResize(t)}),d(l).on("modula-update",function(){t.onResize(t)}),d(l).on("scroll",function(){t.onResize(t)}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),d(c).trigger("modula_api_after_init",[t])},n.prototype.setupSocial=function(){this.options.enableTwitter&&i(this.$items,this),this.options.enableFacebook&&s(this.$items,this),this.options.enableGplus&&a(this.$items,this),this.options.enablePinterest&&h(this.$items,this)};var i=function(t,s){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".caption"),e=s.options.twitterText||c.title;return!s.options.twitterText&&1==i.length&&0<i.text().length&&(e=d.trim(i.text())),l.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(e),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},s=function(t,o){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".pic"),e=d(this).parents(".tile:first").find(".caption");o.options.facebookText||c.title;!o.options.facebookText&&1==e.length&&0<e.text().length&&d.trim(e.text());i.attr("src");var s="//www.facebook.com/sharer.php?u="+location.href;return l.open(s,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},h=function(t,r){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".pic"),e=d(this).parents(".tile:first").find(".caption"),s=r.options.facebookText||c.title;!r.options.facebookText&&1==e.length&&0<e.text().length&&(s=d.trim(e.text()));var o,n,h="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(s);if(1==i.length){var a=i.attr("src");h+="&media="+(o=a,(n=c.createElement("img")).src=o,o=n.src,n.src=null,o)}return l.open(h,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},a=function(t,i){t.find(".modula-icon-google-plus").click(function(t){t.preventDefault();var i="https://plus.google.com/share?url="+encodeURI(location.href);return l.open(i,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};d.fn[o]=function(i){var e,s=arguments;return i===t||"object"==typeof i?this.each(function(){d.data(this,"plugin_"+o)||d.data(this,"plugin_"+o,new n(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var t=d.data(this,"plugin_"+o);t instanceof n&&"function"==typeof t[i]&&(e=t[i].apply(t,Array.prototype.slice.call(s,1))),"destroy"===i&&d.data(this,"plugin_"+o,null)}),e!==t?e:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(e){var t=e(".modula-gallery");e.each(t,function(){var t=e(this).attr("id"),i=e(this).data("config");e("#"+t).modulaGallery(i)})});
1
+ function tg_getURLParameter(t){return decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.ResizeSensor=e()}("undefined"!=typeof window?window:this,function(){if("undefined"==typeof window)return null;var v=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return window.setTimeout(t,20)};function n(t,e){var i=Object.prototype.toString.call(t),n="[object Array]"===i||"[object NodeList]"===i||"[object HTMLCollection]"===i||"[object Object]"===i||"undefined"!=typeof jQuery&&t instanceof jQuery||"undefined"!=typeof Elements&&t instanceof Elements,s=0,o=t.length;if(n)for(;s<o;s++)e(t[s]);else e(t)}function y(t){if(!t.getBoundingClientRect)return{width:t.offsetWidth,height:t.offsetHeight};var e=t.getBoundingClientRect();return{width:Math.round(e.width),height:Math.round(e.height)}}var s=function(e,i){function w(){var i,n,s=[];this.add=function(t){s.push(t)},this.call=function(){for(i=0,n=s.length;i<n;i++)s[i].call()},this.remove=function(t){var e=[];for(i=0,n=s.length;i<n;i++)s[i]!==t&&e.push(s[i]);s=e},this.length=function(){return s.length}}n(e,function(t){!function(n,t){if(n)if(n.resizedAttached)n.resizedAttached.add(t);else{n.resizedAttached=new w,n.resizedAttached.add(t),n.resizeSensor=document.createElement("div"),n.resizeSensor.dir="ltr",n.resizeSensor.className="resize-sensor";var e="position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;",i="position: absolute; left: 0; top: 0; transition: 0s;";n.resizeSensor.style.cssText=e,n.resizeSensor.innerHTML='<div class="resize-sensor-expand" style="'+e+'"><div style="'+i+'"></div></div><div class="resize-sensor-shrink" style="'+e+'"><div style="'+i+' width: 200%; height: 200%"></div></div>',n.appendChild(n.resizeSensor);var s=window.getComputedStyle(n).getPropertyPriority("position");"absolute"!==s&&"relative"!==s&&"fixed"!==s&&(n.style.position="relative");var o,h,r=n.resizeSensor.childNodes[0],a=r.childNodes[0],d=n.resizeSensor.childNodes[1],l=y(n),c=l.width,u=l.height,p=function(){var t=0===n.offsetWidth&&0===n.offsetHeight;if(t){var e=n.style.display;n.style.display="block"}a.style.width="100000px",a.style.height="100000px",r.scrollLeft=1e5,r.scrollTop=1e5,d.scrollLeft=1e5,d.scrollTop=1e5,t&&(n.style.display=e)};n.resizeSensor.resetSensor=p;var f=function(){h=0,o&&(u=c=void 0,n.resizedAttached&&n.resizedAttached.call())},g=function(){var t=y(n),e=t.width,i=t.height;(o=e!=c||i!=u)&&!h&&(h=v(f)),p()},m=function(t,e,i){t.attachEvent?t.attachEvent("on"+e,i):t.addEventListener(e,i)};m(r,"scroll",g),m(d,"scroll",g),v(p)}}(t,i)}),this.detach=function(t){s.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};return s.reset=function(t,e){n(t,function(t){t.resizeSensor.resetSensor()})},s.detach=function(t,e){n(t,function(t){t&&(t.resizedAttached&&"function"==typeof e&&(t.resizedAttached.remove(e),t.resizedAttached.length())||t.resizeSensor&&(t.contains(t.resizeSensor)&&t.removeChild(t.resizeSensor),delete t.resizeSensor,delete t.resizedAttached))})},s}),jQuery(document).on("vc-full-width-row-single vc-full-width-row",function(t,e){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")}),function(l,d,c,t){var s="modulaGallery",i={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1};function o(t,e){this.element=t,this.$element=l(t),this.$itemsCnt=this.$element.find(".items"),this.$items=this.$itemsCnt.find(".item"),this.options=l.extend({},i,e),this._defaults=i,this._name=s,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}o.prototype.trunc=function(t){return Math.trunc?Math.trunc(t):(t=+t,isFinite(t)?t-t%1||(t<0?-0:0===t?t:0):t)},o.prototype.createCustomGallery=function(){var r,t=this.$element.width(),a=this,d=this.options.columns,e=c.documentElement.clientWidth;"1"==this.options.enableResponsive&&(e<=568?d=this.options.mobileColumns:e<=768&&(d=this.options.tabletColumns)),r=0<this.options.gutter?a.trunc((t-this.options.gutter*d)/d):a.trunc(t/d),this.$items.not(".jtg-hidden").each(function(t,e){var i,n,s,o,h={};i=l(e).data("width"),n=l(e).data("height"),12<i&&(i=12),"1"==a.options.enableResponsive&&(s=i,o=n,1==d?n=(i=1)*o/s:((i=Math.round(d*s/12))<1&&(i=1),(n=Math.round(i*o/s))<1&&(n=1))),h.width=r*i+a.options.gutter*(i-1),h.height=r*n+a.options.gutter*(n-1),l(e).data("size",h).addClass("tiled").addClass(h.width>h.height?"tile-h":"tile-v").data("position"),l(e).css(l(e).data("size")),l(e).find(".figc").css({width:l(e).data("size").width,height:l(e).data("size").height})}),this.isPackeryActive&&this.$itemsCnt.packery("destroy"),this.$itemsCnt.packery({itemSelector:".item",gutter:parseInt(a.options.gutter),columnWidth:r,resize:!1}),this.isPackeryActive=!0},o.prototype.createGrid=function(){var n=this;this.options.width&&this.$itemsCnt.width(this.options.width),this.options.height&&this.$itemsCnt.height(this.options.height),this.$itemsCnt.data("area",this.$itemsCnt.width()*this.$itemsCnt.height()),this.lastWidth=this.$itemsCnt.width();for(var t=0;t<this.$items.not(".jtg-hidden").length;t++)this.tiles.push(n.getSlot());this.tiles.sort(function(t,e){return t.position-e.position}),this.$items.not(".jtg-hidden").each(function(t,e){var i=n.tiles[t];l(e).data("size",i).addClass("tiled").addClass(i.width>i.height?"tile-h":"tile-v").data("position")}),this.$items.each(function(t,e){l(e).css(l(e).data("size")),l(e).find(".figc").css({width:l(e).data("size").width,height:l(e).data("size").height})}),this.completed=!0},o.prototype.getSlot=function(){if(0==this.tiles.length)return i={top:0,left:0,width:this.$itemsCnt.width(),height:this.$itemsCnt.height(),area:this.$itemsCnt.width()*this.$itemsCnt.height(),position:0};for(var t=0,e=0;e<this.tiles.length;e++){(i=this.tiles[e]).area>this.tiles[t].area&&(t=e)}var i={},n=this.tiles[t];if(n.width>n.height){var s=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+s*(Math.random()-.5)),i={top:n.top,left:n.left+n.width+this.options.margin,width:n.prevWidth-n.width-this.options.margin,height:n.height}}else{s=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+s*(Math.random()-.5)),i={left:n.left,top:n.top+n.height+this.options.margin,width:n.width,height:n.prevHeight-n.height-this.options.margin}}return i.area=i.width*i.height,i.position=1e3*i.top+i.left,n.position=1e3*n.top+n.left,this.tiles[t]=n,this.tiles[t].area=n.width*n.height,i},o.prototype.reset=function(){var i=this;i.tiles=[],"custom-grid"===i.options.type?(i.createCustomGallery(),i.$itemsCnt.packery()):i.createGrid(),i.$itemsCnt.find(".pic").each(function(t,e){i.placeImage(t)}),i.lastWidth=i.$itemsCnt.width()},o.prototype.onResize=function(e){e.lastWidth!=e.$itemsCnt.width()&&(clearTimeout(e.resizeTO),e.resizeTO=setTimeout(function(){if(e.options.keepArea){var t=e.$itemsCnt.data("area");e.$itemsCnt.height(t/e.$itemsCnt.width())}e.reset()},100))},o.prototype.placeImage=function(t){var e=this.$items.eq(t),i=e.find(".pic"),n=e.data("size"),s=i.data("size"),o=n.width/n.height,h=s.width/s.height,r=i.data("valign")?i.data("valign"):"middle",a=i.data("halign")?i.data("halign"):"center",d={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(h<o)switch(d.width=n.width,d.left=0,r){case"top":d.top=0;break;case"middle":d.top=0-(n.width*(1/h)-n.height)/2;break;case"bottom":d.bottom=0}else switch(d.height=n.height,d.top=0,a){case"left":d.left=0;break;case"center":d.left=0-(n.height*h-n.width)/2;break;case"right":d.right=0}i.css(d)},o.prototype.loadImage=function(t){var e=this,i=e.$items.eq(t).find(".pic"),n=new Image;n.onerror=function(){console.log("error loading image ["+t+"] : "+this.src),t+1<e.$items.length&&e.loadImage(t+1)},n.onload=function(){i.data("size",{width:this.width,height:this.height}),e.placeImage(t),e.$items.eq(t).addClass("tg-loaded"),t+1<e.$items.length&&e.loadImage(t+1)};var s=i.data("src");n.src=s,i.attr("src",s)},o.prototype.init=function(){var t=this;l(c).trigger("modula_api_before_init",[t]),this.$itemsCnt.css({position:"relative",zIndex:1}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():this.createGrid(),this.loadImage(0),l(d).resize(function(){t.onResize(t)}),l(d).on("modula-update",function(){t.onResize(t)}),new ResizeSensor(t.$element,function(){t.onResize(t)}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),l(c).trigger("modula_api_after_init",[t])},o.prototype.setupSocial=function(){this.options.enableTwitter&&e(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enableGplus&&r(this.$items,this),this.options.enablePinterest&&h(this.$items,this)};var e=function(t,n){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".caption"),i=n.options.twitterText||c.title;return!n.options.twitterText&&1==e.length&&0<e.text().length&&(i=l.trim(e.text())),d.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(i),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},n=function(t,s){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".pic"),i=l(this).parents(".tile:first").find(".caption");s.options.facebookText||c.title;!s.options.facebookText&&1==i.length&&0<i.text().length&&l.trim(i.text());e.attr("src");var n="//www.facebook.com/sharer.php?u="+location.href;return d.open(n,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},h=function(t,a){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var e=l(this).parents(".tile:first").find(".pic"),i=l(this).parents(".tile:first").find(".caption"),n=a.options.facebookText||c.title;!a.options.facebookText&&1==i.length&&0<i.text().length&&(n=l.trim(i.text()));var s,o,h="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);if(1==e.length){var r=e.attr("src");h+="&media="+(s=r,(o=c.createElement("img")).src=s,s=o.src,o.src=null,s)}return d.open(h,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,e){t.find(".modula-icon-google-plus").click(function(t){t.preventDefault();var e="https://plus.google.com/share?url="+encodeURI(location.href);return d.open(e,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};l.fn[s]=function(e){var i,n=arguments;return void 0===e||"object"==typeof e?this.each(function(){l.data(this,"plugin_"+s)||l.data(this,"plugin_"+s,new o(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?(this.each(function(){var t=l.data(this,"plugin_"+s);t instanceof o&&"function"==typeof t[e]&&(i=t[e].apply(t,Array.prototype.slice.call(n,1))),"destroy"===e&&l.data(this,"plugin_"+s,null)}),void 0!==i?i:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(i){var t=i(".modula-gallery");i.each(t,function(){var t=i(this).attr("id"),e=i(this).data("config");i("#"+t).modulaGallery(e)})});
assets/js/lightbox.js CHANGED
@@ -42,7 +42,8 @@
42
  // http://lokeshdhakar.com/projects/lightbox2/index.html#options
43
  Lightbox.defaults = {
44
  albumLabel: 'Image %1 of %2',
45
- alwaysShowNavOnTouchDevices: false,
 
46
  fadeDuration: 600,
47
  fitImagesInViewport: true,
48
  imageFadeDuration: 600,
@@ -73,6 +74,12 @@
73
  return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
74
  };
75
 
 
 
 
 
 
 
76
  Lightbox.prototype.init = function() {
77
  var self = this;
78
  // Both enable and build methods require the body tag to be in the DOM.
@@ -114,7 +121,7 @@
114
  startX = touchobj.pageX
115
  startY = touchobj.pageY
116
  startTime = new Date().getTime() // record time when finger first makes contact with surface
117
- e.preventDefault()
118
  }, false)
119
 
120
  touchsurface.addEventListener('touchmove', function(e){
@@ -134,7 +141,16 @@
134
  swipedir = (distY < 0)? 'up' : 'down' // if dist traveled is negative, it indicates up swipe
135
  }
136
  }
137
- handleswipe(swipedir)
 
 
 
 
 
 
 
 
 
138
  e.preventDefault()
139
  }, false)
140
  };
@@ -457,15 +473,20 @@
457
  // Check to see if the browser supports touch events. If so, we take the conservative approach
458
  // and assume that mouse hover events are not supported and always show prev/next navigation
459
  // arrows in image sets.
460
- var alwaysShowNav = false,
 
461
  enableSwipe = false;
462
  try {
463
  document.createEvent('TouchEvent');
464
- alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
465
  enableSwipe = (this.options.enableSwipeOnTouchDevices)? true: false;
 
466
  } catch (e) {}
467
 
468
- if ( ! enableSwipe ) {
 
 
 
 
469
  this.$lightbox.find('.lb-nav').show();
470
 
471
  if (this.album.length > 1) {
42
  // http://lokeshdhakar.com/projects/lightbox2/index.html#options
43
  Lightbox.defaults = {
44
  albumLabel: 'Image %1 of %2',
45
+ showNavigation: true,
46
+ showNavigationOnMobile: false,
47
  fadeDuration: 600,
48
  fitImagesInViewport: true,
49
  imageFadeDuration: 600,
74
  return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
75
  };
76
 
77
+ Lightbox.prototype.mobilecheck = function() {
78
+ var check = false;
79
+ (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
80
+ return check;
81
+ };
82
+
83
  Lightbox.prototype.init = function() {
84
  var self = this;
85
  // Both enable and build methods require the body tag to be in the DOM.
121
  startX = touchobj.pageX
122
  startY = touchobj.pageY
123
  startTime = new Date().getTime() // record time when finger first makes contact with surface
124
+ e.preventDefault();
125
  }, false)
126
 
127
  touchsurface.addEventListener('touchmove', function(e){
141
  swipedir = (distY < 0)? 'up' : 'down' // if dist traveled is negative, it indicates up swipe
142
  }
143
  }
144
+
145
+ if ( 'none' == swipedir ) {
146
+ var el = $( e.target );
147
+ if ( el.hasClass( 'lb-prev' ) ) {
148
+ swipedir = 'left';
149
+ }else if ( el.hasClass( 'lb-next' ) ) {
150
+ swipedir = 'right';
151
+ }
152
+ }
153
+ handleswipe(swipedir);
154
  e.preventDefault()
155
  }, false)
156
  };
473
  // Check to see if the browser supports touch events. If so, we take the conservative approach
474
  // and assume that mouse hover events are not supported and always show prev/next navigation
475
  // arrows in image sets.
476
+ var showNav = (this.options.showNavigation) ? true : false,
477
+ alwaysShowNav = false,
478
  enableSwipe = false;
479
  try {
480
  document.createEvent('TouchEvent');
 
481
  enableSwipe = (this.options.enableSwipeOnTouchDevices)? true: false;
482
+ alwaysShowNav = true;
483
  } catch (e) {}
484
 
485
+ if ( this.mobilecheck() ) {
486
+ showNav = (this.options.showNavigationOnMobile) ? true : false;
487
+ }
488
+
489
+ if ( showNav ) {
490
  this.$lightbox.find('.lb-nav').show();
491
 
492
  if (this.album.length > 1) {
assets/js/lightbox.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):t.lightbox=i(t.jQuery)}(this,function(g){function t(t){this.album=[],this.currentImageIndex=void 0,this.init(),this.options=g.extend({},this.constructor.defaults),this.option(t)}return t.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:!1,fadeDuration:600,fitImagesInViewport:!0,imageFadeDuration:600,positionFromTop:50,resizeDuration:700,showImageNumberLabel:!0,wrapAround:!1,disableScrolling:!1,enableSwipeOnTouchDevices:!0,sanitizeTitle:!1},t.prototype.option=function(t){g.extend(this.options,t)},t.prototype.imageCountLabel=function(t,i){return this.options.albumLabel.replace(/%1/g,t).replace(/%2/g,i)},t.prototype.init=function(){var t=this;g(document).ready(function(){t.enable(),t.build()})},t.prototype.enable=function(){var i=this;g("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(t){return i.start(g(t.currentTarget)),!1})},t.prototype.swipedetect=function(t,i){var e,n,a,o,s,r,h=t,l=i||function(t){};h.addEventListener("touchstart",function(t){var i=t.changedTouches[0];e="none",dist=0,n=i.pageX,a=i.pageY,r=(new Date).getTime(),t.preventDefault()},!1),h.addEventListener("touchmove",function(t){t.preventDefault()},!1),h.addEventListener("touchend",function(t){var i=t.changedTouches[0];o=i.pageX-n,s=i.pageY-a,(new Date).getTime()-r<=300&&(1<=Math.abs(o)&&Math.abs(s)<=100?e=o<0?"left":"right":1<=Math.abs(s)&&Math.abs(o)<=100&&(e=s<0?"up":"down")),l(e),t.preventDefault()},!1)},t.prototype.build=function(){if(!(0<g("#lightbox").length)){var i=this;g('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo(g("body")),this.$lightbox=g("#lightbox"),this.$overlay=g("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".lb-container"),this.$image=this.$lightbox.find(".lb-image"),this.$nav=this.$lightbox.find(".lb-nav"),this.containerPadding={top:parseInt(this.$container.css("padding-top"),10),right:parseInt(this.$container.css("padding-right"),10),bottom:parseInt(this.$container.css("padding-bottom"),10),left:parseInt(this.$container.css("padding-left"),10)},this.imageBorderWidth={top:parseInt(this.$image.css("border-top-width"),10),right:parseInt(this.$image.css("border-right-width"),10),bottom:parseInt(this.$image.css("border-bottom-width"),10),left:parseInt(this.$image.css("border-left-width"),10)},this.$overlay.hide().on("click",function(){return i.end(),!1}),this.$lightbox.hide().on("click",function(t){return"lightbox"===g(t.target).attr("id")&&i.end(),!1}),this.$outerContainer.on("click",function(t){return"lightbox"===g(t.target).attr("id")&&i.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===i.currentImageIndex?i.changeImage(i.album.length-1):i.changeImage(i.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return i.currentImageIndex===i.album.length-1?i.changeImage(0):i.changeImage(i.currentImageIndex+1),!1});var t=this.$lightbox.find(".lb-container")[0];i.swipedetect(t,function(t){"left"==t?0===i.currentImageIndex?i.changeImage(i.album.length-1):i.changeImage(i.currentImageIndex-1):"right"==t&&(i.currentImageIndex===i.album.length-1?i.changeImage(0):i.changeImage(i.currentImageIndex+1))}),this.$nav.on("mousedown",function(t){3===t.which&&(i.$nav.css("pointer-events","none"),i.$lightbox.one("contextmenu",function(){setTimeout(function(){this.$nav.css("pointer-events","auto")}.bind(i),0)}))}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return i.end(),!1})}},t.prototype.start=function(t){var i=this,e=g(window);e.on("resize",g.proxy(this.sizeOverlay,this)),g("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var n=0;function a(t){i.album.push({alt:t.attr("data-alt"),link:t.attr("href"),title:t.attr("data-title")||t.attr("title")})}var o,s=t.attr("data-lightbox");if(s){o=g(t.prop("tagName")+'[data-lightbox="'+s+'"]');for(var r=0;r<o.length;r=++r)a(g(o[r])),o[r]===t[0]&&(n=r)}else if("lightbox"===t.attr("rel"))a(t);else{o=g(t.prop("tagName")+'[rel="'+t.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)a(g(o[h])),o[h]===t[0]&&(n=h)}var l=e.scrollTop()+this.options.positionFromTop,d=e.scrollLeft();this.$lightbox.css({top:l+"px",left:d+"px"}).fadeIn(this.options.fadeDuration),this.options.disableScrolling&&g("html").addClass("lb-disable-scrolling"),this.changeImage(n)},t.prototype.changeImage=function(s){var r=this;this.disableKeyboardNav();var h=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration),g(".lb-loader").fadeIn("slow"),this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(),this.$outerContainer.addClass("animating");var l=new Image;l.onload=function(){var t,i,e,n,a,o;h.attr({alt:r.album[s].alt,src:r.album[s].link}),g(l),h.width(l.width),h.height(l.height),r.options.fitImagesInViewport&&(o=g(window).width(),a=g(window).height(),n=o-r.containerPadding.left-r.containerPadding.right-r.imageBorderWidth.left-r.imageBorderWidth.right-20,e=a-r.containerPadding.top-r.containerPadding.bottom-r.imageBorderWidth.top-r.imageBorderWidth.bottom-120,r.options.maxWidth&&r.options.maxWidth<n&&(n=r.options.maxWidth),r.options.maxHeight&&r.options.maxHeight<n&&(e=r.options.maxHeight),(l.width>n||l.height>e)&&(l.width/n>l.height/e?(i=n,t=parseInt(l.height/(l.width/i),10)):(t=e,i=parseInt(l.width/(l.height/t),10)),h.width(i),h.height(t))),r.sizeContainer(h.width(),h.height())},l.src=this.album[s].link,this.currentImageIndex=s},t.prototype.sizeOverlay=function(){this.$overlay.width(g(document).width()).height(g(document).height())},t.prototype.sizeContainer=function(t,i){var e=this,n=this.$outerContainer.outerWidth(),a=this.$outerContainer.outerHeight(),o=t+this.containerPadding.left+this.containerPadding.right+this.imageBorderWidth.left+this.imageBorderWidth.right,s=i+this.containerPadding.top+this.containerPadding.bottom+this.imageBorderWidth.top+this.imageBorderWidth.bottom;function r(){e.$lightbox.find(".lb-dataContainer").width(o),e.$lightbox.find(".lb-prevLink").height(s),e.$lightbox.find(".lb-nextLink").height(s),e.showImage()}n!==o||a!==s?this.$outerContainer.animate({width:o,height:s},this.options.resizeDuration,"swing",function(){r()}):r()},t.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(!0).hide(),this.$lightbox.find(".lb-image").fadeIn(this.options.imageFadeDuration),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},t.prototype.updateNav=function(){var t=!1,i=!1;try{document.createEvent("TouchEvent"),t=!!this.options.alwaysShowNavOnTouchDevices,i=!!this.options.enableSwipeOnTouchDevices}catch(t){}i?this.$lightbox.find(".lb-nav").hide():(this.$lightbox.find(".lb-nav").show(),1<this.album.length&&(this.options.wrapAround?(t&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(0<this.currentImageIndex&&(this.$lightbox.find(".lb-prev").show(),t&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".lb-next").show(),t&&this.$lightbox.find(".lb-next").css("opacity","1")))))},t.prototype.updateDetails=function(){var t=this;if(void 0!==this.album[this.currentImageIndex].title&&""!==this.album[this.currentImageIndex].title){var i=this.$lightbox.find(".lb-caption");this.options.sanitizeTitle?i.text(this.album[this.currentImageIndex].title):i.html(this.album[this.currentImageIndex].title),i.fadeIn("fast").find("a").on("click",function(t){void 0!==g(this).attr("target")?window.open(g(this).attr("href"),g(this).attr("target")):location.href=g(this).attr("href")})}if(1<this.album.length&&this.options.showImageNumberLabel){var e=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(e).fadeIn("fast")}else this.$lightbox.find(".lb-number").hide();this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return t.sizeOverlay()})},t.prototype.preloadNeighboringImages=function(){this.album.length>this.currentImageIndex+1&&((new Image).src=this.album[this.currentImageIndex+1].link);0<this.currentImageIndex&&((new Image).src=this.album[this.currentImageIndex-1].link)},t.prototype.enableKeyboardNav=function(){g(document).on("keyup.keyboard",g.proxy(this.keyboardAction,this))},t.prototype.disableKeyboardNav=function(){g(document).off(".keyboard")},t.prototype.keyboardAction=function(t){var i=t.keyCode,e=String.fromCharCode(i).toLowerCase();27===i||e.match(/x|o|c/)?this.end():"p"===e||37===i?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&1<this.album.length&&this.changeImage(this.album.length-1):"n"!==e&&39!==i||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&1<this.album.length&&this.changeImage(0))},t.prototype.end=function(){this.disableKeyboardNav(),g(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),g("select, object, embed").css({visibility:"visible"}),this.options.disableScrolling&&g("html").removeClass("lb-disable-scrolling")},new t});
1
+ !function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):t.lightbox=i(t.jQuery)}(this,function(c){function t(t){this.album=[],this.currentImageIndex=void 0,this.init(),this.options=c.extend({},this.constructor.defaults),this.option(t)}return t.defaults={albumLabel:"Image %1 of %2",showNavigation:!0,showNavigationOnMobile:!1,fadeDuration:600,fitImagesInViewport:!0,imageFadeDuration:600,positionFromTop:50,resizeDuration:700,showImageNumberLabel:!0,wrapAround:!1,disableScrolling:!1,enableSwipeOnTouchDevices:!0,sanitizeTitle:!1},t.prototype.option=function(t){c.extend(this.options,t)},t.prototype.imageCountLabel=function(t,i){return this.options.albumLabel.replace(/%1/g,t).replace(/%2/g,i)},t.prototype.mobilecheck=function(){var t,i=!1;return t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(i=!0),i},t.prototype.init=function(){var t=this;c(document).ready(function(){t.enable(),t.build()})},t.prototype.enable=function(){var i=this;c("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(t){return i.start(c(t.currentTarget)),!1})},t.prototype.swipedetect=function(t,i){var n,a,o,s,r,h,e=t,l=i||function(t){};e.addEventListener("touchstart",function(t){var i=t.changedTouches[0];n="none",dist=0,a=i.pageX,o=i.pageY,h=(new Date).getTime(),t.preventDefault()},!1),e.addEventListener("touchmove",function(t){t.preventDefault()},!1),e.addEventListener("touchend",function(t){var i=t.changedTouches[0];if(s=i.pageX-a,r=i.pageY-o,(new Date).getTime()-h<=300&&(1<=Math.abs(s)&&Math.abs(r)<=100?n=s<0?"left":"right":1<=Math.abs(r)&&Math.abs(s)<=100&&(n=r<0?"up":"down")),"none"==n){var e=c(t.target);e.hasClass("lb-prev")?n="left":e.hasClass("lb-next")&&(n="right")}l(n),t.preventDefault()},!1)},t.prototype.build=function(){if(!(0<c("#lightbox").length)){var i=this;c('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo(c("body")),this.$lightbox=c("#lightbox"),this.$overlay=c("#lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".lb-outerContainer"),this.$container=this.$lightbox.find(".lb-container"),this.$image=this.$lightbox.find(".lb-image"),this.$nav=this.$lightbox.find(".lb-nav"),this.containerPadding={top:parseInt(this.$container.css("padding-top"),10),right:parseInt(this.$container.css("padding-right"),10),bottom:parseInt(this.$container.css("padding-bottom"),10),left:parseInt(this.$container.css("padding-left"),10)},this.imageBorderWidth={top:parseInt(this.$image.css("border-top-width"),10),right:parseInt(this.$image.css("border-right-width"),10),bottom:parseInt(this.$image.css("border-bottom-width"),10),left:parseInt(this.$image.css("border-left-width"),10)},this.$overlay.hide().on("click",function(){return i.end(),!1}),this.$lightbox.hide().on("click",function(t){return"lightbox"===c(t.target).attr("id")&&i.end(),!1}),this.$outerContainer.on("click",function(t){return"lightbox"===c(t.target).attr("id")&&i.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===i.currentImageIndex?i.changeImage(i.album.length-1):i.changeImage(i.currentImageIndex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return i.currentImageIndex===i.album.length-1?i.changeImage(0):i.changeImage(i.currentImageIndex+1),!1});var t=this.$lightbox.find(".lb-container")[0];i.swipedetect(t,function(t){"left"==t?0===i.currentImageIndex?i.changeImage(i.album.length-1):i.changeImage(i.currentImageIndex-1):"right"==t&&(i.currentImageIndex===i.album.length-1?i.changeImage(0):i.changeImage(i.currentImageIndex+1))}),this.$nav.on("mousedown",function(t){3===t.which&&(i.$nav.css("pointer-events","none"),i.$lightbox.one("contextmenu",function(){setTimeout(function(){this.$nav.css("pointer-events","auto")}.bind(i),0)}))}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return i.end(),!1})}},t.prototype.start=function(t){var i=this,e=c(window);e.on("resize",c.proxy(this.sizeOverlay,this)),c("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var n=0;function a(t){i.album.push({alt:t.attr("data-alt"),link:t.attr("href"),title:t.attr("data-title")||t.attr("title")})}var o,s=t.attr("data-lightbox");if(s){o=c(t.prop("tagName")+'[data-lightbox="'+s+'"]');for(var r=0;r<o.length;r=++r)a(c(o[r])),o[r]===t[0]&&(n=r)}else if("lightbox"===t.attr("rel"))a(t);else{o=c(t.prop("tagName")+'[rel="'+t.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)a(c(o[h])),o[h]===t[0]&&(n=h)}var l=e.scrollTop()+this.options.positionFromTop,d=e.scrollLeft();this.$lightbox.css({top:l+"px",left:d+"px"}).fadeIn(this.options.fadeDuration),this.options.disableScrolling&&c("html").addClass("lb-disable-scrolling"),this.changeImage(n)},t.prototype.changeImage=function(s){var r=this;this.disableKeyboardNav();var h=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration),c(".lb-loader").fadeIn("slow"),this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(),this.$outerContainer.addClass("animating");var l=new Image;l.onload=function(){var t,i,e,n,a,o;h.attr({alt:r.album[s].alt,src:r.album[s].link}),c(l),h.width(l.width),h.height(l.height),r.options.fitImagesInViewport&&(o=c(window).width(),a=c(window).height(),n=o-r.containerPadding.left-r.containerPadding.right-r.imageBorderWidth.left-r.imageBorderWidth.right-20,e=a-r.containerPadding.top-r.containerPadding.bottom-r.imageBorderWidth.top-r.imageBorderWidth.bottom-120,r.options.maxWidth&&r.options.maxWidth<n&&(n=r.options.maxWidth),r.options.maxHeight&&r.options.maxHeight<n&&(e=r.options.maxHeight),(l.width>n||l.height>e)&&(l.width/n>l.height/e?(i=n,t=parseInt(l.height/(l.width/i),10)):(t=e,i=parseInt(l.width/(l.height/t),10)),h.width(i),h.height(t))),r.sizeContainer(h.width(),h.height())},l.src=this.album[s].link,this.currentImageIndex=s},t.prototype.sizeOverlay=function(){this.$overlay.width(c(document).width()).height(c(document).height())},t.prototype.sizeContainer=function(t,i){var e=this,n=this.$outerContainer.outerWidth(),a=this.$outerContainer.outerHeight(),o=t+this.containerPadding.left+this.containerPadding.right+this.imageBorderWidth.left+this.imageBorderWidth.right,s=i+this.containerPadding.top+this.containerPadding.bottom+this.imageBorderWidth.top+this.imageBorderWidth.bottom;function r(){e.$lightbox.find(".lb-dataContainer").width(o),e.$lightbox.find(".lb-prevLink").height(s),e.$lightbox.find(".lb-nextLink").height(s),e.showImage()}n!==o||a!==s?this.$outerContainer.animate({width:o,height:s},this.options.resizeDuration,"swing",function(){r()}):r()},t.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(!0).hide(),this.$lightbox.find(".lb-image").fadeIn(this.options.imageFadeDuration),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},t.prototype.updateNav=function(){var t=!!this.options.showNavigation,i=!1;try{document.createEvent("TouchEvent"),!!this.options.enableSwipeOnTouchDevices,i=!0}catch(t){}this.mobilecheck()&&(t=!!this.options.showNavigationOnMobile),t?(this.$lightbox.find(".lb-nav").show(),1<this.album.length&&(this.options.wrapAround?(i&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(0<this.currentImageIndex&&(this.$lightbox.find(".lb-prev").show(),i&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".lb-next").show(),i&&this.$lightbox.find(".lb-next").css("opacity","1"))))):this.$lightbox.find(".lb-nav").hide()},t.prototype.updateDetails=function(){var t=this;if(void 0!==this.album[this.currentImageIndex].title&&""!==this.album[this.currentImageIndex].title){var i=this.$lightbox.find(".lb-caption");this.options.sanitizeTitle?i.text(this.album[this.currentImageIndex].title):i.html(this.album[this.currentImageIndex].title),i.fadeIn("fast").find("a").on("click",function(t){void 0!==c(this).attr("target")?window.open(c(this).attr("href"),c(this).attr("target")):location.href=c(this).attr("href")})}if(1<this.album.length&&this.options.showImageNumberLabel){var e=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(e).fadeIn("fast")}else this.$lightbox.find(".lb-number").hide();this.$outerContainer.removeClass("animating"),this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return t.sizeOverlay()})},t.prototype.preloadNeighboringImages=function(){this.album.length>this.currentImageIndex+1&&((new Image).src=this.album[this.currentImageIndex+1].link);0<this.currentImageIndex&&((new Image).src=this.album[this.currentImageIndex-1].link)},t.prototype.enableKeyboardNav=function(){c(document).on("keyup.keyboard",c.proxy(this.keyboardAction,this))},t.prototype.disableKeyboardNav=function(){c(document).off(".keyboard")},t.prototype.keyboardAction=function(t){var i=t.keyCode,e=String.fromCharCode(i).toLowerCase();27===i||e.match(/x|o|c/)?this.end():"p"===e||37===i?0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&1<this.album.length&&this.changeImage(this.album.length-1):"n"!==e&&39!==i||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&1<this.album.length&&this.changeImage(0))},t.prototype.end=function(){this.disableKeyboardNav(),c(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),c("select, object, embed").css({visibility:"visible"}),this.options.disableScrolling&&c("html").removeClass("lb-disable-scrolling")},new t});
assets/js/wp-modula-conditions.js CHANGED
@@ -18,6 +18,7 @@ var modulaGalleryConditions = Backbone.Model.extend({
18
 
19
  this.listenTo( wp.Modula.Settings, 'change:type', this.changedType );
20
  this.listenTo( wp.Modula.Settings, 'change:effect', this.changedEffect );
 
21
 
22
  },
23
 
@@ -25,6 +26,7 @@ var modulaGalleryConditions = Backbone.Model.extend({
25
 
26
  this.changedType( false, wp.Modula.Settings.get( 'type' ) );
27
  this.changedEffect( false, wp.Modula.Settings.get( 'effect' ) );
 
28
 
29
  },
30
 
@@ -32,8 +34,6 @@ var modulaGalleryConditions = Backbone.Model.extend({
32
  var rows = this.get( 'rows' ),
33
  tabs = this.get( 'tabs' );
34
 
35
- console.log( tabs );
36
-
37
  if ( 'custom-grid' == value ) {
38
 
39
  // Show Responsive tab
@@ -54,6 +54,22 @@ var modulaGalleryConditions = Backbone.Model.extend({
54
 
55
  },
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  changedEffect: function( settings, value ){
58
  var hoverBoxes = jQuery( '.modula-effects-preview > div' );
59
 
18
 
19
  this.listenTo( wp.Modula.Settings, 'change:type', this.changedType );
20
  this.listenTo( wp.Modula.Settings, 'change:effect', this.changedEffect );
21
+ this.listenTo( wp.Modula.Settings, 'change:lightbox', this.changedLightbox );
22
 
23
  },
24
 
26
 
27
  this.changedType( false, wp.Modula.Settings.get( 'type' ) );
28
  this.changedEffect( false, wp.Modula.Settings.get( 'effect' ) );
29
+ this.changedLightbox( false, wp.Modula.Settings.get( 'lightbox' ) );
30
 
31
  },
32
 
34
  var rows = this.get( 'rows' ),
35
  tabs = this.get( 'tabs' );
36
 
 
 
37
  if ( 'custom-grid' == value ) {
38
 
39
  // Show Responsive tab
54
 
55
  },
56
 
57
+ changedLightbox: function( settings, value ){
58
+ var rows = this.get( 'rows' ),
59
+ tabs = this.get( 'tabs' );
60
+
61
+ if ( 'lightbox2' == value ) {
62
+
63
+ rows.filter( '[data-container="show_navigation"], [data-container="show_navigation_on_mobile"]' ).show();
64
+
65
+ }else{
66
+
67
+ rows.filter( '[data-container="show_navigation"], [data-container="show_navigation_on_mobile"]' ).hide();
68
+
69
+ }
70
+
71
+ },
72
+
73
  changedEffect: function( settings, value ){
74
  var hoverBoxes = jQuery( '.modula-effects-preview > div' );
75
 
assets/js/wp-modula-gutenberg.js ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // identity function for calling harmony imports with the correct context
37
+ /******/ __webpack_require__.i = function(value) { return value; };
38
+ /******/
39
+ /******/ // define getter function for harmony exports
40
+ /******/ __webpack_require__.d = function(exports, name, getter) {
41
+ /******/ if(!__webpack_require__.o(exports, name)) {
42
+ /******/ Object.defineProperty(exports, name, {
43
+ /******/ configurable: false,
44
+ /******/ enumerable: true,
45
+ /******/ get: getter
46
+ /******/ });
47
+ /******/ }
48
+ /******/ };
49
+ /******/
50
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
51
+ /******/ __webpack_require__.n = function(module) {
52
+ /******/ var getter = module && module.__esModule ?
53
+ /******/ function getDefault() { return module['default']; } :
54
+ /******/ function getModuleExports() { return module; };
55
+ /******/ __webpack_require__.d(getter, 'a', getter);
56
+ /******/ return getter;
57
+ /******/ };
58
+ /******/
59
+ /******/ // Object.prototype.hasOwnProperty.call
60
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
61
+ /******/
62
+ /******/ // __webpack_public_path__
63
+ /******/ __webpack_require__.p = "";
64
+ /******/
65
+ /******/ // Load entry module and return exports
66
+ /******/ return __webpack_require__(__webpack_require__.s = 3);
67
+ /******/ })
68
+ /************************************************************************/
69
+ /******/ ([
70
+ /* 0 */
71
+ /***/ (function(module, exports, __webpack_require__) {
72
+
73
+ "use strict";
74
+
75
+
76
+ Object.defineProperty(exports, "__esModule", {
77
+ value: true
78
+ });
79
+
80
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
81
+
82
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
83
+
84
+ var _inspector = __webpack_require__(2);
85
+
86
+ var _inspector2 = _interopRequireDefault(_inspector);
87
+
88
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
89
+
90
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
91
+
92
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
93
+
94
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
95
+ * Internal dependencies
96
+ */
97
+
98
+
99
+ /**
100
+ * WordPress dependencies
101
+ */
102
+ var __ = wp.i18n.__;
103
+ var _wp$element = wp.element,
104
+ Component = _wp$element.Component,
105
+ Fragment = _wp$element.Fragment;
106
+ var withSelect = wp.data.withSelect;
107
+ var _wp$components = wp.components,
108
+ SelectControl = _wp$components.SelectControl,
109
+ Button = _wp$components.Button,
110
+ Spinner = _wp$components.Spinner,
111
+ Toolbar = _wp$components.Toolbar,
112
+ IconButton = _wp$components.IconButton;
113
+ var BlockControls = wp.editor.BlockControls;
114
+
115
+ var ModulaEdit = function (_Component) {
116
+ _inherits(ModulaEdit, _Component);
117
+
118
+ function ModulaEdit(props) {
119
+ _classCallCheck(this, ModulaEdit);
120
+
121
+ var _this = _possibleConstructorReturn(this, (ModulaEdit.__proto__ || Object.getPrototypeOf(ModulaEdit)).apply(this, arguments));
122
+
123
+ _this.props.attributes.status = 'ready';
124
+ _this.props.attributes.images = [];
125
+ return _this;
126
+ }
127
+
128
+ _createClass(ModulaEdit, [{
129
+ key: 'componentDidMount',
130
+ value: function componentDidMount() {
131
+ if (this.props.attributes.id !== 0) {
132
+ this.onIdChange(this.props.attributes.id);
133
+ }
134
+ }
135
+ }, {
136
+ key: 'onIdChange',
137
+ value: function onIdChange(id) {
138
+ var _this2 = this;
139
+
140
+ this.props.setAttributes({ status: 'loading' });
141
+
142
+ jQuery.ajax({
143
+ type: "POST",
144
+ data: { action: "modula_get_gallery_meta", id: id, nonce: modulaVars.nonce },
145
+ url: modulaVars.ajaxURL,
146
+ success: function success(result) {
147
+ return _this2.onGalleryLoaded(id, result);
148
+ }
149
+ });
150
+ }
151
+ }, {
152
+ key: 'onGalleryLoaded',
153
+ value: function onGalleryLoaded(id, result) {
154
+ if (result.success === false) {
155
+ this.props.setAttributes({ id: 0, status: 'ready' });
156
+ return;
157
+ }
158
+
159
+ this.props.setAttributes({ id: id, images: JSON.parse(result), status: 'ready' });
160
+ }
161
+ }, {
162
+ key: 'selectOptions',
163
+ value: function selectOptions() {
164
+ var options = [{ value: 0, label: __('select a gallery') }];
165
+
166
+ this.props.galleries.forEach(function (gallery) {
167
+ options.push({ value: gallery.id, label: gallery.title.rendered });
168
+ });
169
+
170
+ return options;
171
+ }
172
+ }, {
173
+ key: 'render',
174
+ value: function render() {
175
+ var _this3 = this;
176
+
177
+ var _props = this.props,
178
+ attributes = _props.attributes,
179
+ galleries = _props.galleries;
180
+ var id = attributes.id,
181
+ images = attributes.images,
182
+ status = attributes.status;
183
+
184
+
185
+ var blockControls = React.createElement(
186
+ BlockControls,
187
+ null,
188
+ images.length > 0 && React.createElement(
189
+ Toolbar,
190
+ null,
191
+ React.createElement(IconButton, {
192
+ label: __('Edit gallery'),
193
+ icon: 'edit',
194
+ href: modulaVars.adminURL + 'post.php?post=' + id + '&action=edit',
195
+ target: '_blank'
196
+ })
197
+ )
198
+ );
199
+
200
+ if (status === 'loading') {
201
+ return [React.createElement(
202
+ Fragment,
203
+ null,
204
+ React.createElement(
205
+ 'div',
206
+ { 'class': 'modula-block-preview' },
207
+ React.createElement(
208
+ 'div',
209
+ { 'class': 'modula-block-preview__content' },
210
+ React.createElement('div', { 'class': 'modula-block-preview__logo' }),
211
+ React.createElement(Spinner, null)
212
+ )
213
+ )
214
+ )];
215
+ }
216
+
217
+ if (id == 0 || images.length === 0) {
218
+ return [React.createElement(
219
+ Fragment,
220
+ null,
221
+ React.createElement(_inspector2.default, _extends({ onIdChange: function onIdChange(id) {
222
+ return _this3.onIdChange(id);
223
+ } }, this.props)),
224
+ React.createElement(
225
+ 'div',
226
+ { 'class': 'modula-block-preview' },
227
+ React.createElement(
228
+ 'div',
229
+ { 'class': 'modula-block-preview__content' },
230
+ React.createElement('div', { 'class': 'modula-block-preview__logo' }),
231
+ galleries.length === 0 && React.createElement(
232
+ Fragment,
233
+ null,
234
+ React.createElement(
235
+ 'p',
236
+ null,
237
+ __('You don\'t seem to have any galleries.')
238
+ ),
239
+ React.createElement(
240
+ Button,
241
+ { href: modulaVars.adminURL + 'post-new.php?post_type=modula-gallery', target: '_blank', isDefault: true },
242
+ __('Add New Gallery')
243
+ )
244
+ ),
245
+ galleries.length > 0 && React.createElement(
246
+ Fragment,
247
+ null,
248
+ React.createElement(SelectControl, {
249
+ value: id,
250
+ options: this.selectOptions(),
251
+ onChange: function onChange(value) {
252
+ return _this3.onIdChange(parseInt(value));
253
+ }
254
+ }),
255
+ id != 0 && React.createElement(
256
+ Button,
257
+ { target: '_blank', href: modulaVars.adminURL + 'post.php?post=' + id + '&action=edit', isPrimary: true },
258
+ __('Edit Gallery')
259
+ )
260
+ )
261
+ )
262
+ )
263
+ )];
264
+ }
265
+
266
+ return [React.createElement(
267
+ Fragment,
268
+ null,
269
+ blockControls,
270
+ React.createElement(_inspector2.default, _extends({ onIdChange: function onIdChange(id) {
271
+ return _this3.onIdChange(id);
272
+ } }, this.props)),
273
+ React.createElement(
274
+ 'div',
275
+ { 'class': 'modula-block-preview--images' },
276
+ images.map(function (img, index) {
277
+ return [React.createElement(
278
+ 'div',
279
+ { 'class': 'modula-preview-image-wrap' },
280
+ React.createElement('img', { src: img.src })
281
+ )];
282
+ })
283
+ )
284
+ )];
285
+ }
286
+ }]);
287
+
288
+ return ModulaEdit;
289
+ }(Component);
290
+
291
+ exports.default = withSelect(function (select, props) {
292
+ var _select = select('core'),
293
+ getEntityRecords = _select.getEntityRecords;
294
+
295
+ var query = {
296
+ post_status: 'publish',
297
+ per_page: -1
298
+ };
299
+
300
+ return {
301
+ galleries: getEntityRecords('postType', 'modula-gallery', query) || []
302
+ };
303
+ })(ModulaEdit);
304
+
305
+ /***/ }),
306
+ /* 1 */
307
+ /***/ (function(module, exports, __webpack_require__) {
308
+
309
+ "use strict";
310
+
311
+
312
+ Object.defineProperty(exports, "__esModule", {
313
+ value: true
314
+ });
315
+ var icons = {};
316
+
317
+ icons.modula = React.createElement(
318
+ "svg",
319
+ { xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "364 242.9 312.2 357" },
320
+ React.createElement(
321
+ "g",
322
+ null,
323
+ React.createElement("path", { d: "M528.1,242.9c8.5,16.9,17,33.8,25.6,50.6c13.4,26.4,26.9,52.7,39.9,79.7c-41.8-23.3-83.6-46.7-125.4-70.1 c0.3-1.9,1.7-2.6,2.7-3.5c17.7-17.7,35.4-35.4,53.1-53c1.1-1.1,2.6-2,3.1-3.7C527.4,242.9,527.8,242.9,528.1,242.9z" }),
324
+ React.createElement("path", { d: "M602.3,463.3c11.3-6.9,22.6-13.9,33.9-20.8c5.5-3.4,11.1-6.7,16.5-10.3c2.2-1.4,2.9-1.1,3.5,1.5 c6.4,25.3,13,50.6,19.6,75.8c0.6,2.2,1,3.7-2.4,3.5c-46.7-2.1-93.5-4.1-140.2-6.1c-0.2,0-0.3-0.1-0.5-0.2c0.5-1.7,2.1-2,3.3-2.7 c20-12.3,39.9-24.7,60-36.8c3.4-2.1,5.1-3.7,4.8-8.5c-1.4-21.3-1.8-42.6-2.6-63.9c-0.9-24.1-1.8-48.3-2.8-72.4 c-0.2-6.1-0.2-6.1,5.5-4.6c23.8,6.2,47.6,12.5,71.5,18.5c3.9,1,4.2,1.9,2.1,5.4c-23.4,38.5-46.7,77.1-70,115.7c-1,1.7-2,3.4-3,5.1 C601.7,462.8,602,463,602.3,463.3z" }),
325
+ React.createElement("path", { d: "M372.8,326.9c48,2.6,95.8,5.1,143.9,7.7c-0.9,2-2.5,2.3-3.7,3.1c-38.6,23.2-77.3,46.4-115.9,69.6c-3,1.8-4.3,2.6-5.4-1.9 c-5.9-24.9-12.2-49.7-18.3-74.6C373.1,329.6,373,328.4,372.8,326.9z" }),
326
+ React.createElement("path", { d: "M517.6,599.9c-23.2-43.7-45.9-86.6-69.2-130.5c2.3,1.2,3.5,1.8,4.7,2.4c39.8,21.5,79.5,43.1,119.3,64.5 c3.2,1.7,4.1,2.5,1,5.6c-17.7,17.8-35.2,35.9-52.8,53.9C519.7,596.9,518.9,598.2,517.6,599.9z" }),
327
+ React.createElement("path", { d: "M364.9,505.1c26.6-40.5,53.1-80.8,79.7-121.3c1.3,1.3,0.9,2.5,0.9,3.6c0,46-0.1,92-0.1,137.9c0,3.1-0.2,4.5-4,3.3 c-24.9-7.7-49.9-15.2-74.9-22.8C366,505.8,365.7,505.5,364.9,505.1z" })
328
+ )
329
+ );
330
+
331
+ exports.default = icons;
332
+
333
+ /***/ }),
334
+ /* 2 */
335
+ /***/ (function(module, exports, __webpack_require__) {
336
+
337
+ "use strict";
338
+
339
+
340
+ Object.defineProperty(exports, "__esModule", {
341
+ value: true
342
+ });
343
+
344
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
345
+
346
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
347
+
348
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
349
+
350
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
351
+
352
+ /**
353
+ * WordPress dependencies
354
+ */
355
+ var __ = wp.i18n.__;
356
+ var _wp$element = wp.element,
357
+ Component = _wp$element.Component,
358
+ Fragment = _wp$element.Fragment;
359
+ var InspectorControls = wp.editor.InspectorControls;
360
+ var _wp$components = wp.components,
361
+ SelectControl = _wp$components.SelectControl,
362
+ Button = _wp$components.Button,
363
+ PanelBody = _wp$components.PanelBody;
364
+
365
+ /**
366
+ * Inspector controls
367
+ */
368
+
369
+ var Inspector = function (_Component) {
370
+ _inherits(Inspector, _Component);
371
+
372
+ function Inspector(props) {
373
+ _classCallCheck(this, Inspector);
374
+
375
+ return _possibleConstructorReturn(this, (Inspector.__proto__ || Object.getPrototypeOf(Inspector)).apply(this, arguments));
376
+ }
377
+
378
+ _createClass(Inspector, [{
379
+ key: 'selectOptions',
380
+ value: function selectOptions() {
381
+ var options = [{ value: 0, label: __('none') }];
382
+
383
+ this.props.galleries.forEach(function (gallery) {
384
+ options.push({ value: gallery.id, label: gallery.title.rendered });
385
+ });
386
+
387
+ return options;
388
+ }
389
+ }, {
390
+ key: 'render',
391
+ value: function render() {
392
+ var _this2 = this;
393
+
394
+ var _props = this.props,
395
+ attributes = _props.attributes,
396
+ setAttributes = _props.setAttributes,
397
+ galleries = _props.galleries;
398
+ var id = attributes.id;
399
+
400
+
401
+ return React.createElement(
402
+ Fragment,
403
+ null,
404
+ React.createElement(
405
+ InspectorControls,
406
+ null,
407
+ React.createElement(
408
+ PanelBody,
409
+ { title: __('Gallery Settings'), initialOpen: true },
410
+ galleries.length === 0 && React.createElement(
411
+ Fragment,
412
+ null,
413
+ React.createElement(
414
+ 'p',
415
+ null,
416
+ __('You don\'t seem to have any galleries.')
417
+ ),
418
+ React.createElement(
419
+ Button,
420
+ { href: modulaVars.adminURL + 'post-new.php?post_type=modula-gallery', target: '_blank', isDefault: true },
421
+ __('Add New Gallery')
422
+ )
423
+ ),
424
+ galleries.length > 0 && React.createElement(
425
+ Fragment,
426
+ null,
427
+ React.createElement(SelectControl, {
428
+ label: __('Select Gallery'),
429
+ value: id,
430
+ options: this.selectOptions(),
431
+ onChange: function onChange(value) {
432
+ return _this2.props.onIdChange(parseInt(value));
433
+ }
434
+ }),
435
+ id != 0 && React.createElement(
436
+ Button,
437
+ { target: '_blank', href: modulaVars.adminURL + 'post.php?post=' + id + '&action=edit', isDefault: true },
438
+ __('Edit gallery')
439
+ )
440
+ )
441
+ )
442
+ )
443
+ );
444
+ }
445
+ }]);
446
+
447
+ return Inspector;
448
+ }(Component);
449
+
450
+ exports.default = Inspector;
451
+
452
+ /***/ }),
453
+ /* 3 */
454
+ /***/ (function(module, exports, __webpack_require__) {
455
+
456
+ "use strict";
457
+
458
+
459
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
460
+ * Internal dependencies
461
+ */
462
+
463
+
464
+ var _edit = __webpack_require__(0);
465
+
466
+ var _edit2 = _interopRequireDefault(_edit);
467
+
468
+ var _icons = __webpack_require__(1);
469
+
470
+ var _icons2 = _interopRequireDefault(_icons);
471
+
472
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
473
+
474
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
475
+
476
+ /**
477
+ * WordPress dependencies
478
+ */
479
+ var __ = wp.i18n.__;
480
+ var registerBlockType = wp.blocks.registerBlockType;
481
+
482
+ var ModulaGutenberg = function () {
483
+ function ModulaGutenberg() {
484
+ _classCallCheck(this, ModulaGutenberg);
485
+
486
+ this.registerBlock();
487
+ }
488
+
489
+ _createClass(ModulaGutenberg, [{
490
+ key: 'registerBlock',
491
+ value: function registerBlock() {
492
+
493
+ this.blockName = 'modula/gallery';
494
+
495
+ this.blockAttributes = {
496
+ id: {
497
+ type: 'number',
498
+ default: 0
499
+ }
500
+ };
501
+
502
+ registerBlockType(this.blockName, {
503
+ title: 'Modula Gallery',
504
+ icon: _icons2.default.modula,
505
+ description: __('Make your galleries stand out.'),
506
+ keywords: [__('gallery'), __('modula'), __('images')],
507
+ category: 'common',
508
+ supports: {
509
+ align: ['wide', 'full'],
510
+ customClassName: false
511
+ },
512
+ attributes: this.blockAttributes,
513
+ edit: _edit2.default,
514
+ save: function save() {
515
+ // Rendering in PHP
516
+ return null;
517
+ }
518
+ });
519
+ }
520
+ }]);
521
+
522
+ return ModulaGutenberg;
523
+ }();
524
+
525
+ var modulaGutenberg = new ModulaGutenberg();
526
+
527
+ /***/ })
528
+ /******/ ]);
assets/js/wp-modula-items.js CHANGED
@@ -4,6 +4,15 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
4
 
5
  var modulaItemsCollection = Backbone.Collection.extend({
6
  maxFiles: 20,
 
 
 
 
 
 
 
 
 
7
 
8
  moveItem: function( model, index ){
9
  var currentIndex = this.indexOf( model );
@@ -26,6 +35,45 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
26
 
27
  this.add( model );
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
  });
@@ -56,6 +104,7 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
56
  'index': '',
57
  'orientation': 'landscape'
58
  },
 
59
 
60
  initialize: function( args ){
61
 
@@ -76,10 +125,25 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
76
  this.set( 'resize', true );
77
  this.resize();
78
  }
79
-
 
 
80
 
81
  },
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  resize: function() {
84
  var size = modula.Resizer.get( 'size' ),
85
  gutter = modula.Resizer.get( 'gutter' ),
@@ -126,6 +190,45 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
126
 
127
  },
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  } );
130
 
131
  var modulaItemView = Backbone.View.extend({
@@ -291,6 +394,7 @@ wp.Modula = 'undefined' === typeof( wp.Modula ) ? {} : wp.Modula;
291
  },
292
 
293
  updateIndex: function( event, data ) {
 
294
  this.model.set( 'index', data.index );
295
  modula.Items.moveItem( this.model, data.index );
296
  this.render();
4
 
5
  var modulaItemsCollection = Backbone.Collection.extend({
6
  maxFiles: 20,
7
+ updateInterval: false,
8
+
9
+ initialize: function() {
10
+
11
+ // Listen to remove items from collections
12
+ this.listenTo( this, 'remove', this.checkSave );
13
+ this.listenTo( this, 'add', this.checkSave );
14
+
15
+ },
16
 
17
  moveItem: function( model, index ){
18
  var currentIndex = this.indexOf( model );
35
 
36
  this.add( model );
37
 
38
+ },
39
+
40
+ checkSave: function() {
41
+ var self = this;
42
+
43
+ $('#publishing-action .spinner').addClass( 'is-active' );
44
+ $('#publishing-action #publish').attr( 'disabled', 'disabled' );
45
+
46
+ if ( ! self.updateInterval ) {
47
+ self.updateInterval = setInterval( $.proxy( self.saveImages, self ), 1000);
48
+ }else{
49
+ clearInterval( self.updateInterval );
50
+ self.updateInterval = setInterval( $.proxy( self.saveImages, self ), 1000);
51
+ }
52
+ },
53
+
54
+ saveImages: function() {
55
+ var images = [],
56
+ ajaxData, self = this;
57
+ clearInterval( this.updateInterval );
58
+
59
+ this.each( function( item ) {
60
+ var attributes = item.getAttributes();
61
+ images[ attributes['index'] ] = attributes;
62
+ });
63
+
64
+ ajaxData = { '_wpnonce' : modulaHelper['_wpnonce'], 'action' : 'modula_save_images', gallery : modulaHelper['id'] };
65
+ ajaxData['images'] = JSON.stringify( images );
66
+
67
+ $.ajax({
68
+ method: 'POST',
69
+ url: modulaHelper['ajax_url'],
70
+ data: ajaxData,
71
+ dataType: 'json',
72
+ }).done(function( msg ) {
73
+ $('#publishing-action .spinner').removeClass( 'is-active' );
74
+ $('#publishing-action #publish').removeAttr( 'disabled' );
75
+ });
76
+
77
  }
78
 
79
  });
104
  'index': '',
105
  'orientation': 'landscape'
106
  },
107
+ updateInterval: false,
108
 
109
  initialize: function( args ){
110
 
125
  this.set( 'resize', true );
126
  this.resize();
127
  }
128
+
129
+ // save
130
+ this.listenTo( this, 'change', this.checkSave );
131
 
132
  },
133
 
134
+ getAttributes: function(){
135
+ var attributes = this.toJSON(),
136
+ data = {};
137
+
138
+ jQuery.each( attributes, function( attribute, value ){
139
+ if ( 'object' != typeof value ) {
140
+ data[ attribute ] = value;
141
+ }
142
+ });
143
+
144
+ return data;
145
+ },
146
+
147
  resize: function() {
148
  var size = modula.Resizer.get( 'size' ),
149
  gutter = modula.Resizer.get( 'gutter' ),
190
 
191
  },
192
 
193
+ checkSave: function() {
194
+
195
+ var self = this,
196
+ changedAttributes = _.keys( self.changedAttributes() );
197
+
198
+ if ( changedAttributes.includes( 'index' ) ) {
199
+ return;
200
+ }
201
+
202
+ $('#publishing-action .spinner').addClass( 'is-active' );
203
+ $('#publishing-action #publish').attr( 'disabled', 'disabled' );
204
+
205
+ if ( ! self.updateInterval ) {
206
+ self.updateInterval = setInterval( $.proxy( self.saveImage, self ), 1000 );
207
+ }else{
208
+ clearInterval( self.updateInterval );
209
+ self.updateInterval = setInterval( $.proxy( self.saveImage, self ), 1000 );
210
+ }
211
+ },
212
+
213
+ saveImage: function() {
214
+ var json = this.getAttributes();
215
+ clearInterval( this.updateInterval );
216
+
217
+ ajaxData = { '_wpnonce': modulaHelper['_wpnonce'], 'action': 'modula_save_image', 'gallery': modulaHelper['id'] };
218
+ ajaxData['image'] = JSON.stringify( json );
219
+
220
+ $.ajax({
221
+ method: 'POST',
222
+ url: modulaHelper['ajax_url'],
223
+ data: ajaxData,
224
+ dataType: 'json',
225
+ }).done(function( msg ) {
226
+ $('#publishing-action .spinner').removeClass( 'is-active' );
227
+ $('#publishing-action #publish').removeAttr( 'disabled' );
228
+ });
229
+
230
+ }
231
+
232
  } );
233
 
234
  var modulaItemView = Backbone.View.extend({
394
  },
395
 
396
  updateIndex: function( event, data ) {
397
+
398
  this.model.set( 'index', data.index );
399
  modula.Items.moveItem( this.model, data.index );
400
  this.render();
assets/src/js/components/edit.js ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import Inspector from './inspector';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ const { __ } = wp.i18n;
10
+ const { Component, Fragment } = wp.element;
11
+ const { withSelect } = wp.data;
12
+ const { SelectControl, Button, Spinner, Toolbar, IconButton } = wp.components;
13
+ const { BlockControls } = wp.editor;
14
+
15
+ class ModulaEdit extends Component {
16
+
17
+ constructor( props ) {
18
+ super( ...arguments );
19
+
20
+ this.props.attributes.status = 'ready';
21
+ this.props.attributes.images = [];
22
+ }
23
+
24
+ componentDidMount() {
25
+ if( this.props.attributes.id !== 0 ) {
26
+ this.onIdChange( this.props.attributes.id );
27
+ }
28
+ }
29
+
30
+ onIdChange( id ) {
31
+ this.props.setAttributes( { status: 'loading' } );
32
+
33
+ jQuery.ajax({
34
+ type: "POST",
35
+ data : { action: "modula_get_gallery_meta", id: id, nonce: modulaVars.nonce },
36
+ url : modulaVars.ajaxURL,
37
+ success: ( result ) => this.onGalleryLoaded( id, result ),
38
+ });
39
+ }
40
+
41
+ onGalleryLoaded( id, result ) {
42
+ if( result.success === false ) {
43
+ this.props.setAttributes( { id: 0, status: 'ready' } );
44
+ return;
45
+ }
46
+
47
+ this.props.setAttributes( { id: id, images: JSON.parse( result ), status: 'ready' } );
48
+ }
49
+
50
+ selectOptions() {
51
+ let options = [ { value: 0, label: __( 'select a gallery' ) } ];
52
+
53
+ this.props.galleries.forEach(function( gallery ) {
54
+ options.push( { value: gallery.id, label: gallery.title.rendered } );
55
+ });
56
+
57
+ return options;
58
+ }
59
+
60
+ render() {
61
+ const { attributes, galleries } = this.props;
62
+ const { id, images, status } = attributes;
63
+
64
+ const blockControls = (
65
+ <BlockControls>
66
+ { images.length > 0 && (
67
+ <Toolbar>
68
+ <IconButton
69
+ label={ __( 'Edit gallery' ) }
70
+ icon="edit"
71
+ href={ modulaVars.adminURL + 'post.php?post=' + id + '&action=edit' }
72
+ target="_blank"
73
+ />
74
+ </Toolbar>
75
+ ) }
76
+ </BlockControls>
77
+ );
78
+
79
+ if( status === 'loading' ) {
80
+ return [
81
+ <Fragment>
82
+ <div class="modula-block-preview">
83
+ <div class="modula-block-preview__content">
84
+ <div class="modula-block-preview__logo"></div>
85
+ <Spinner/>
86
+ </div>
87
+ </div>
88
+ </Fragment>
89
+ ];
90
+ }
91
+
92
+ if( id == 0 || images.length === 0 ) {
93
+ return [
94
+ <Fragment>
95
+ <Inspector onIdChange={ ( id ) => this.onIdChange( id ) } { ...this.props } />
96
+
97
+ <div class="modula-block-preview">
98
+ <div class="modula-block-preview__content">
99
+ <div class="modula-block-preview__logo"></div>
100
+ { ( galleries.length === 0 ) && (
101
+ <Fragment>
102
+ <p>{ __( 'You don\'t seem to have any galleries.' ) }</p>
103
+ <Button href={ modulaVars.adminURL + 'post-new.php?post_type=modula-gallery' } target="_blank" isDefault>{ __( 'Add New Gallery' ) }</Button>
104
+ </Fragment>
105
+ )}
106
+ { ( galleries.length > 0 ) && (
107
+ <Fragment>
108
+ <SelectControl
109
+ value={ id }
110
+ options={ this.selectOptions() }
111
+ onChange={ ( value ) => this.onIdChange( parseInt( value ) ) }
112
+ />
113
+ { id != 0 && (
114
+ <Button target="_blank" href={ modulaVars.adminURL + 'post.php?post=' + id + '&action=edit' } isPrimary>{ __( 'Edit Gallery' ) }</Button>
115
+ ) }
116
+ </Fragment>
117
+ )}
118
+ </div>
119
+ </div>
120
+
121
+ </Fragment>
122
+ ];
123
+ }
124
+
125
+ return [
126
+ <Fragment>
127
+ { blockControls }
128
+ <Inspector onIdChange={ ( id ) => this.onIdChange( id ) } { ...this.props } />
129
+
130
+ <div class="modula-block-preview--images">
131
+ { images.map( ( img, index ) => {
132
+ return [
133
+ <div class="modula-preview-image-wrap">
134
+ <img src={ img.src } />
135
+ </div>
136
+ ];
137
+ } ) }
138
+ </div>
139
+
140
+ </Fragment>
141
+ ];
142
+ }
143
+ }
144
+
145
+
146
+
147
+ export default withSelect( ( select, props ) => {
148
+ const { getEntityRecords } = select( 'core' );
149
+ const query = {
150
+ post_status: 'publish',
151
+ per_page: -1,
152
+ }
153
+
154
+ return {
155
+ galleries: getEntityRecords( 'postType', 'modula-gallery', query ) || [],
156
+ };
157
+ } )( ModulaEdit );
158
+
159
+
assets/src/js/components/inspector.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ const { __ } = wp.i18n;
5
+ const { Component, Fragment } = wp.element;
6
+ const { InspectorControls } = wp.editor;
7
+ const { SelectControl, Button, PanelBody } = wp.components;
8
+
9
+ /**
10
+ * Inspector controls
11
+ */
12
+ export default class Inspector extends Component {
13
+
14
+ constructor( props ) {
15
+ super( ...arguments );
16
+ }
17
+
18
+ selectOptions() {
19
+ let options = [ { value: 0, label: __( 'none' ) } ];
20
+
21
+ this.props.galleries.forEach(function( gallery ) {
22
+ options.push( { value: gallery.id, label: gallery.title.rendered } );
23
+ });
24
+
25
+ return options;
26
+ }
27
+
28
+ render() {
29
+ const { attributes, setAttributes, galleries } = this.props;
30
+ const { id } = attributes;
31
+
32
+ return (
33
+ <Fragment>
34
+ <InspectorControls>
35
+ <PanelBody title={ __( 'Gallery Settings' ) } initialOpen={ true }>
36
+ { galleries.length === 0 && (
37
+ <Fragment>
38
+ <p>{ __( 'You don\'t seem to have any galleries.' ) }</p>
39
+ <Button href={ modulaVars.adminURL + 'post-new.php?post_type=modula-gallery' } target="_blank" isDefault>{ __( 'Add New Gallery' ) }</Button>
40
+ </Fragment>
41
+ )}
42
+
43
+ { galleries.length > 0 && (
44
+ <Fragment>
45
+ <SelectControl
46
+ label={ __( 'Select Gallery' ) }
47
+ value={ id }
48
+ options={ this.selectOptions() }
49
+ onChange={ ( value ) => this.props.onIdChange( parseInt( value ) ) }
50
+ />
51
+ { id != 0 && (
52
+ <Button target="_blank" href={ modulaVars.adminURL + 'post.php?post=' + id + '&action=edit' } isDefault>{ __( 'Edit gallery' ) }</Button>
53
+ ) }
54
+ </Fragment>
55
+ )}
56
+
57
+ </PanelBody>
58
+ </InspectorControls>
59
+ </Fragment>
60
+ );
61
+ }
62
+ }
assets/src/js/utils/icons.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const icons = {};
2
+
3
+ icons.modula =
4
+ <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="364 242.9 312.2 357">
5
+ <g>
6
+ <path d="M528.1,242.9c8.5,16.9,17,33.8,25.6,50.6c13.4,26.4,26.9,52.7,39.9,79.7c-41.8-23.3-83.6-46.7-125.4-70.1
7
+ c0.3-1.9,1.7-2.6,2.7-3.5c17.7-17.7,35.4-35.4,53.1-53c1.1-1.1,2.6-2,3.1-3.7C527.4,242.9,527.8,242.9,528.1,242.9z"/>
8
+ <path d="M602.3,463.3c11.3-6.9,22.6-13.9,33.9-20.8c5.5-3.4,11.1-6.7,16.5-10.3c2.2-1.4,2.9-1.1,3.5,1.5
9
+ c6.4,25.3,13,50.6,19.6,75.8c0.6,2.2,1,3.7-2.4,3.5c-46.7-2.1-93.5-4.1-140.2-6.1c-0.2,0-0.3-0.1-0.5-0.2c0.5-1.7,2.1-2,3.3-2.7
10
+ c20-12.3,39.9-24.7,60-36.8c3.4-2.1,5.1-3.7,4.8-8.5c-1.4-21.3-1.8-42.6-2.6-63.9c-0.9-24.1-1.8-48.3-2.8-72.4
11
+ c-0.2-6.1-0.2-6.1,5.5-4.6c23.8,6.2,47.6,12.5,71.5,18.5c3.9,1,4.2,1.9,2.1,5.4c-23.4,38.5-46.7,77.1-70,115.7c-1,1.7-2,3.4-3,5.1
12
+ C601.7,462.8,602,463,602.3,463.3z"/>
13
+ <path d="M372.8,326.9c48,2.6,95.8,5.1,143.9,7.7c-0.9,2-2.5,2.3-3.7,3.1c-38.6,23.2-77.3,46.4-115.9,69.6c-3,1.8-4.3,2.6-5.4-1.9
14
+ c-5.9-24.9-12.2-49.7-18.3-74.6C373.1,329.6,373,328.4,372.8,326.9z"/>
15
+ <path d="M517.6,599.9c-23.2-43.7-45.9-86.6-69.2-130.5c2.3,1.2,3.5,1.8,4.7,2.4c39.8,21.5,79.5,43.1,119.3,64.5
16
+ c3.2,1.7,4.1,2.5,1,5.6c-17.7,17.8-35.2,35.9-52.8,53.9C519.7,596.9,518.9,598.2,517.6,599.9z"/>
17
+ <path d="M364.9,505.1c26.6-40.5,53.1-80.8,79.7-121.3c1.3,1.3,0.9,2.5,0.9,3.6c0,46-0.1,92-0.1,137.9c0,3.1-0.2,4.5-4,3.3
18
+ c-24.9-7.7-49.9-15.2-74.9-22.8C366,505.8,365.7,505.5,364.9,505.1z"/>
19
+ </g>
20
+ </svg>;
21
+
22
+ export default icons;
assets/src/js/wp-modula-gutenberg.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import Edit from './components/edit';
5
+ import icons from './utils/icons';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ const { __ } = wp.i18n;
11
+ const { registerBlockType } = wp.blocks;
12
+
13
+ class ModulaGutenberg {
14
+
15
+ constructor() {
16
+ this.registerBlock();
17
+ }
18
+
19
+ registerBlock() {
20
+
21
+ this.blockName = 'modula/gallery';
22
+
23
+ this.blockAttributes = {
24
+ id: {
25
+ type: 'number',
26
+ default: 0,
27
+ },
28
+ };
29
+
30
+ registerBlockType( this.blockName, {
31
+ title: 'Modula Gallery',
32
+ icon: icons.modula,
33
+ description: __( 'Make your galleries stand out.' ),
34
+ keywords: [
35
+ __( 'gallery' ),
36
+ __( 'modula' ),
37
+ __( 'images' ),
38
+ ],
39
+ category: 'common',
40
+ supports: {
41
+ align: [ 'wide', 'full' ],
42
+ customClassName: false,
43
+ },
44
+ attributes: this.blockAttributes,
45
+ edit: Edit,
46
+ save() {
47
+ // Rendering in PHP
48
+ return null;
49
+ },
50
+ } );
51
+
52
+ }
53
+
54
+ }
55
+
56
+ let modulaGutenberg = new ModulaGutenberg();
assets/src/scss/modula-gutenberg.scss ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .modula-block-preview {
2
+ background: #f3f3f5;
3
+ border-radius: 6px;
4
+ position: relative;
5
+ overflow: hidden;
6
+
7
+ .components-spinner {
8
+ display: block;
9
+ float: none;
10
+ margin: 0 auto;
11
+ }
12
+ }
13
+
14
+ .modula-block-preview__logo {
15
+ width: 100%;
16
+ height: 60px;
17
+ background:url(../images/block-preview-bg.svg) no-repeat 50% 0%;
18
+ background-size: 75%;
19
+ }
20
+
21
+ .modula-block-preview__content {
22
+ width: 100%;
23
+ max-width: 400px;
24
+ margin: 40px auto;
25
+ text-align: center;
26
+ }
27
+
28
+ .modula-block-preview--images {
29
+ display: flex;
30
+ flex-wrap: wrap;
31
+ margin-left: -1%;
32
+ margin-right: -1%;
33
+ }
34
+
35
+ .modula-preview-image-wrap {
36
+ width: 23%;
37
+ height: 0px;
38
+ padding-bottom: 23%;
39
+ position: relative;
40
+ margin: 1%;
41
+
42
+ img {
43
+ position: absolute;
44
+ left: 0;
45
+ top: 0;
46
+ width: 100%;
47
+ height: 100%;
48
+ object-fit: cover;
49
+ }
50
+ }
changelog.txt CHANGED
@@ -1,3 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 2.0.5 =
2
  * Added responsive options for custom grid
3
  * Compatibility with WP Real Media Library( https://matthias-web.com/wordpress/real-media-library/ )
1
+ = 2.0.6 - 13.03.2019 =
2
+ * Changed how we save images
3
+ * Change some strings
4
+ * Fixed "scroll issue"
5
+ * Added shortcode column
6
+ * Fixed error on IE
7
+ * Fixed random images with max count issue
8
+ * Added Filter tab as upsell
9
+ * Added option to hide/show lightbox arrow on desktop/mobile
10
+ * Fixed Custom responsiveness issue
11
+ * Added Gutenberg block
12
+
13
+ For more information : https://github.com/MachoThemes/modula-lite/milestone/8?closed=1
14
+
15
  = 2.0.5 =
16
  * Added responsive options for custom grid
17
  * Compatibility with WP Real Media Library( https://matthias-web.com/wordpress/real-media-library/ )
includes/admin/class-modula-admin.php CHANGED
@@ -17,6 +17,11 @@ class Modula_Admin {
17
  // Show general tab
18
  add_action( 'modula_admin_tab_general', array( $this, 'show_general_tab' ) );
19
 
 
 
 
 
 
20
  }
21
 
22
  public function register_submenus() {
@@ -136,6 +141,149 @@ class Modula_Admin {
136
  public function show_general_tab() {
137
  include 'tabs/general.php';
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
  new Modula_Admin();
17
  // Show general tab
18
  add_action( 'modula_admin_tab_general', array( $this, 'show_general_tab' ) );
19
 
20
+ add_action( 'wp_ajax_modula_save_images', array( $this, 'save_images' ) );
21
+ add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
22
+
23
+
24
+
25
  }
26
 
27
  public function register_submenus() {
141
  public function show_general_tab() {
142
  include 'tabs/general.php';
143
  }
144
+
145
+ private function sanitize_image( $image ){
146
+
147
+ $new_image = array();
148
+
149
+ // This list will not contain id because we save our images based on image id.
150
+ $image_attributes = apply_filters( 'modula_gallery_image_attributes', array(
151
+ 'id',
152
+ 'alt',
153
+ 'title',
154
+ 'description',
155
+ 'halign',
156
+ 'valign',
157
+ 'link',
158
+ 'target',
159
+ 'width',
160
+ 'height',
161
+ ) );
162
+
163
+ foreach ( $image_attributes as $attribute ) {
164
+ if ( isset( $image[ $attribute ] ) ) {
165
+
166
+ switch ( $attribute ) {
167
+ case 'alt':
168
+ $new_image[ $attribute ] = sanitize_text_field( $image[ $attribute ] );
169
+ break;
170
+ case 'width':
171
+ case 'height':
172
+ $new_image[ $attribute ] = absint( $image[ $attribute ] );
173
+ break;
174
+ case 'title':
175
+ case 'description' :
176
+ $new_image[ $attribute ] = wp_filter_post_kses( $image[ $attribute ] );
177
+ break;
178
+ case 'link' :
179
+ $new_image[ $attribute ] = esc_url_raw( $image[ $attribute ] );
180
+ break;
181
+ case 'target':
182
+ if ( isset( $image[ $attribute ] ) ) {
183
+ $new_image[ $attribute ] = absint( $image[ $attribute ] );
184
+ }else{
185
+ $new_image[ $attribute ] = 0;
186
+ }
187
+ break;
188
+ case 'halign' :
189
+ if ( in_array( $image[ $attribute ], array( 'left', 'right', 'center' ) ) ) {
190
+ $new_image[ $attribute ] = $image[ $attribute ];
191
+ }else{
192
+ $new_image[ $attribute ] = 'center';
193
+ }
194
+ break;
195
+ case 'valign' :
196
+ if ( in_array( $image[ $attribute ], array( 'top', 'bottom', 'middle' ) ) ) {
197
+ $new_image[ $attribute ] = $image[ $attribute ];
198
+ }else{
199
+ $new_image[ $attribute ] = 'middle';
200
+ }
201
+ break;
202
+ default:
203
+ $new_image[ $attribute ] = apply_filters( 'modula_image_field_sanitization', sanitize_text_field( $image[ $attribute ] ), $image[ $attribute ], $attribute );
204
+ break;
205
+ }
206
+
207
+ }else{
208
+ $new_image[ $attribute ] = '';
209
+ }
210
+ }
211
+
212
+ return $new_image;
213
+
214
+ }
215
+
216
+ public function save_images(){
217
+
218
+ $nonce = $_POST['_wpnonce'];
219
+ if ( ! wp_verify_nonce( $nonce, 'modula-ajax-save' ) ) {
220
+ wp_send_json( array( 'status' => 'failed' ) );
221
+ }
222
+
223
+ if ( ! isset( $_POST['gallery'] ) ) {
224
+ wp_send_json( array( 'status' => 'failed' ) );
225
+ }
226
+
227
+ $gallery_id = absint( $_POST['gallery'] );
228
+
229
+ if ( 'modula-gallery' != get_post_type( $gallery_id ) ) {
230
+ wp_send_json( array( 'status' => 'failed' ) );
231
+ }
232
+
233
+ if ( ! isset( $_POST['images'] ) ) {
234
+ wp_send_json( array( 'status' => 'failed' ) );
235
+ }
236
+
237
+ $old_images = get_post_meta( $gallery_id, 'modula-images', true );
238
+ $images = json_decode( stripslashes($_POST['images']), true );
239
+ $new_images = array();
240
+
241
+ if ( is_array( $images ) ) {
242
+ foreach ( $images as $image ) {
243
+ $new_images[] = $this->sanitize_image( $image );
244
+ }
245
+ }
246
+
247
+ update_post_meta( $gallery_id, 'modula-images', $new_images );
248
+ wp_send_json( array( 'status' => 'succes' ) );
249
+
250
+ }
251
+
252
+ public function save_image(){
253
+
254
+ $nonce = $_POST['_wpnonce'];
255
+ if ( ! wp_verify_nonce( $nonce, 'modula-ajax-save' ) ) {
256
+ wp_send_json( array( 'status' => 'failed' ) );
257
+ }
258
+
259
+ if ( ! isset( $_POST['gallery'] ) ) {
260
+ wp_send_json( array( 'status' => 'failed' ) );
261
+ }
262
+
263
+ $gallery_id = absint( $_POST['gallery'] );
264
+
265
+ if ( 'modula-gallery' != get_post_type( $gallery_id ) ) {
266
+ wp_send_json( array( 'status' => 'failed' ) );
267
+ }
268
+
269
+ if ( ! isset( $_POST['image'] ) ) {
270
+ wp_send_json( array( 'status' => 'failed' ) );
271
+ }
272
+
273
+ $image = json_decode( stripslashes($_POST['image']), true );
274
+ $old_images = get_post_meta( $gallery_id, 'modula-images', true );
275
+
276
+ foreach ( $old_images as $key => $old_image ) {
277
+ if ( $old_image['id'] == $image['id'] ) {
278
+ $old_images[ $key ] = $this->sanitize_image( $image );
279
+ }
280
+ }
281
+
282
+ update_post_meta( $gallery_id, 'modula-images', $old_images );
283
+ wp_send_json( array( 'status' => 'succes' ) );
284
+
285
+ }
286
+
287
  }
288
 
289
  new Modula_Admin();
includes/admin/class-modula-cpt-fields-helper.php CHANGED
@@ -36,6 +36,13 @@ class Modula_CPT_Fields_Helper {
36
  "icon" => "dashicons dashicons-admin-generic",
37
  'priority' => 10,
38
  ),
 
 
 
 
 
 
 
39
  'captions' => array(
40
  'label' => esc_html__( 'Captions', 'modula-best-grid-gallery' ),
41
  'title' => esc_html__( 'Caption Settings', 'modula-best-grid-gallery' ),
@@ -88,7 +95,6 @@ class Modula_CPT_Fields_Helper {
88
  'responsive' => array(
89
  'label' => esc_html__( 'Responsive', 'modula-best-grid-gallery' ),
90
  'title' => esc_html__( 'Responsive Settings', 'modula-best-grid-gallery' ),
91
- // 'description' => $customizations_description,
92
  'badge' => esc_html__( 'Beta', 'modula-best-grid-gallery' ),
93
  "icon" => "dashicons dashicons-smartphone",
94
  'priority' => 90,
@@ -202,6 +208,18 @@ class Modula_CPT_Fields_Helper {
202
  ),
203
  'priority' => 110,
204
  ),
 
 
 
 
 
 
 
 
 
 
 
 
205
  "shuffle" => array(
206
  "name" => esc_html__( 'Shuffle images', 'modula-best-grid-gallery' ),
207
  "type" => "toggle",
@@ -375,7 +393,7 @@ class Modula_CPT_Fields_Helper {
375
  ),
376
  'responsive' => array(
377
  'enable_responsive' => array(
378
- "name" => esc_html__( 'Custom responsivness', 'modula-best-grid-gallery' ),
379
  "description" => esc_html__( 'Force the gallery to show a certain number of column on tablet/mobile devices', 'modula-best-grid-gallery' ),
380
  "type" => "toggle",
381
  "default" => 0,
@@ -434,6 +452,8 @@ class Modula_CPT_Fields_Helper {
434
  'margin' => '10',
435
  'randomFactor' => '50',
436
  'lightbox' => 'lightbox2',
 
 
437
  'shuffle' => 0,
438
  'captionColor' => '#ffffff',
439
  'wp_field_caption' => 'none',
36
  "icon" => "dashicons dashicons-admin-generic",
37
  'priority' => 10,
38
  ),
39
+ 'filters' => array(
40
+ 'label' => esc_html__( 'Filters', 'modula-best-grid-gallery' ),
41
+ 'title' => esc_html__( 'Filters', 'modula-best-grid-gallery' ),
42
+ "icon" => "dashicons dashicons-filter",
43
+ 'badge' => esc_html__( 'PRO', 'modula-best-grid-gallery' ),
44
+ 'priority' => 15,
45
+ ),
46
  'captions' => array(
47
  'label' => esc_html__( 'Captions', 'modula-best-grid-gallery' ),
48
  'title' => esc_html__( 'Caption Settings', 'modula-best-grid-gallery' ),
95
  'responsive' => array(
96
  'label' => esc_html__( 'Responsive', 'modula-best-grid-gallery' ),
97
  'title' => esc_html__( 'Responsive Settings', 'modula-best-grid-gallery' ),
 
98
  'badge' => esc_html__( 'Beta', 'modula-best-grid-gallery' ),
99
  "icon" => "dashicons dashicons-smartphone",
100
  'priority' => 90,
208
  ),
209
  'priority' => 110,
210
  ),
211
+ "show_navigation" => array(
212
+ "name" => esc_html__( 'Show lightbox navigation', 'modula-best-grid-gallery' ),
213
+ "type" => "toggle",
214
+ "default" => 1,
215
+ 'priority' => 111,
216
+ ),
217
+ "show_navigation_on_mobile" => array(
218
+ "name" => esc_html__( 'Show lightbox navigation on mobile', 'modula-best-grid-gallery' ),
219
+ "type" => "toggle",
220
+ "default" => 0,
221
+ 'priority' => 112,
222
+ ),
223
  "shuffle" => array(
224
  "name" => esc_html__( 'Shuffle images', 'modula-best-grid-gallery' ),
225
  "type" => "toggle",
393
  ),
394
  'responsive' => array(
395
  'enable_responsive' => array(
396
+ "name" => esc_html__( 'Custom responsiveness', 'modula-best-grid-gallery' ),
397
  "description" => esc_html__( 'Force the gallery to show a certain number of column on tablet/mobile devices', 'modula-best-grid-gallery' ),
398
  "type" => "toggle",
399
  "default" => 0,
452
  'margin' => '10',
453
  'randomFactor' => '50',
454
  'lightbox' => 'lightbox2',
455
+ 'show_navigation' => 1,
456
+ 'show_navigation_on_mobile' => 0,
457
  'shuffle' => 0,
458
  'captionColor' => '#ffffff',
459
  'wp_field_caption' => 'none',
includes/admin/class-modula-cpt.php CHANGED
@@ -62,6 +62,7 @@ class Modula_CPT {
62
  'has_archive' => false,
63
  'exclude_from_search' => true,
64
  'rewrite' => false,
 
65
  ) );
66
 
67
  $this->metaboxes = apply_filters( 'modula_cpt_metaboxes', array(
@@ -83,7 +84,7 @@ class Modula_CPT {
83
  ) );
84
 
85
  $this->cpt_name = apply_filters( 'modula_cpt_name', 'modula-gallery' );
86
-
87
  add_action( 'init', array( $this, 'register_cpt' ) );
88
 
89
  /* Fire our meta box setup function on the post editor screen. */
@@ -93,6 +94,10 @@ class Modula_CPT {
93
  /* */
94
  add_filter( 'views_edit-modula-gallery', array( $this, 'add_extensions_tab' ), 10, 1 );
95
 
 
 
 
 
96
  /* Load Fields Helper */
97
  require_once MODULA_PATH . 'includes/admin/class-modula-cpt-fields-helper.php';
98
 
@@ -148,7 +153,7 @@ class Modula_CPT {
148
  public function output_gallery_images() {
149
  $this->builder->render( 'gallery' );
150
  }
151
-
152
  public function output_gallery_settings() {
153
  $this->builder->render( 'settings' );
154
  }
@@ -167,114 +172,31 @@ class Modula_CPT {
167
  return $post_id;
168
  }
169
 
170
- // Here we will save gallery images
171
- if ( isset( $_POST['modula-images'] ) ) {
172
-
173
- // This list will not contain id because we save our images based on image id.
174
- $image_attributes = apply_filters( 'modula_gallery_image_attributes', array(
175
- 'alt',
176
- 'title',
177
- 'description',
178
- 'halign',
179
- 'valign',
180
- 'link',
181
- 'target',
182
- 'width',
183
- 'height',
184
- ) );
185
-
186
- $modula_images = array();
187
-
188
- $gallery_type = isset( $_POST['modula-settings']['type'] ) ? sanitize_text_field($_POST['modula-settings']['type']) : 'creative-gallery';
189
- for ( $index=0; $index < count( $_POST['modula-images']['id'] ); $index++ ) {
190
-
191
- if ( ! is_numeric( $_POST['modula-images']['id'][ $index ] ) ) {
192
- continue;
193
- }
194
-
195
- $new_image = array();
196
- $grid_sizes = array(
197
- 'width' => isset( $_POST['modula-images']['width'][ $index ] ) ? absint( $_POST['modula-images']['width'][ $index ] ) : 1,
198
- 'height' => isset( $_POST['modula-images']['height'][ $index ] ) ? absint( $_POST['modula-images']['height'][ $index ] ) : 1,
199
- );
200
-
201
- // Save the image's id
202
- $new_image['id'] = absint( $_POST['modula-images']['id'][ $index ] );
203
-
204
- // Get from the current image only accepted attributes
205
- foreach ( $image_attributes as $attribute ) {
206
- if ( isset( $_POST['modula-images'][ $attribute ][ $index ] ) ) {
207
-
208
- switch ( $attribute ) {
209
- case 'alt':
210
- $new_image[ $attribute ] = sanitize_text_field( $_POST['modula-images'][ $attribute ][ $index ] );
211
- break;
212
- case 'width':
213
- case 'height':
214
- $new_image[ $attribute ] = absint( $_POST['modula-images'][ $attribute ][ $index ] );
215
- break;
216
- case 'title':
217
- case 'description' :
218
- $new_image[ $attribute ] = wp_filter_post_kses( $_POST['modula-images'][ $attribute ][ $index ] );
219
- break;
220
- case 'link' :
221
- $new_image[ $attribute ] = esc_url_raw( $_POST['modula-images'][ $attribute ][ $index ] );
222
- break;
223
- case 'target':
224
- if ( isset( $_POST['modula-images'][ $attribute ][ $index ] ) ) {
225
- $new_image[ $attribute ] = absint( $_POST['modula-images'][ $attribute ][ $index ] );
226
- }else{
227
- $new_image[ $attribute ] = 0;
228
- }
229
- break;
230
- case 'halign' :
231
- if ( in_array( $_POST['modula-images'][ $attribute ][ $index ], array( 'left', 'right', 'center' ) ) ) {
232
- $new_image[ $attribute ] = $_POST['modula-images'][ $attribute ][ $index ];
233
- }else{
234
- $new_image[ $attribute ] = 'center';
235
- }
236
- break;
237
- case 'valign' :
238
- if ( in_array( $_POST['modula-images'][ $attribute ][ $index ], array( 'top', 'bottom', 'middle' ) ) ) {
239
- $new_image[ $attribute ] = $_POST['modula-images'][ $attribute ][ $index ];
240
- }else{
241
- $new_image[ $attribute ] = 'middle';
242
- }
243
- break;
244
- default:
245
- $new_image[ $attribute ] = apply_filters( 'modula_image_field_sanitization', sanitize_text_field( $_POST['modula-images'][ $attribute ][ $index ] ), $_POST['modula-images'][ $attribute ][ $index ], $attribute );
246
- break;
247
- }
248
-
249
- }else{
250
- $new_image[ $attribute ] = '';
251
- }
252
- }
253
-
254
- // Check if we need to resize this image
255
- if ( isset( $_POST['modula-settings']['img_size'] ) && apply_filters( 'modula_resize_images', true, $_POST['modula-settings'] ) ) {
256
- $img_size = absint( $_POST['modula-settings']['img_size'] );
257
  $sizes = $this->resizer->get_image_size( $new_image['id'], $img_size, $gallery_type, $grid_sizes );
258
  if ( ! is_wp_error( $sizes ) ) {
259
  $this->resizer->resize_image( $sizes['url'], $sizes['width'], $sizes['height'] );
260
  }
 
261
  }
262
 
263
- // Add new image to modula images
264
- $modula_images[ $index ] = $new_image;
265
  }
266
-
267
- // Add images to gallery meta
268
- update_post_meta( $post_id, 'modula-images', $modula_images );
269
-
270
- }else{
271
-
272
- delete_post_meta( $post_id, 'modula-images' );
273
-
274
  }
275
 
276
  if ( isset( $_POST['modula-settings'] ) ) {
277
-
278
  $fields_with_tabs = Modula_CPT_Fields_Helper::get_fields( 'all' );
279
 
280
  // Here we will save all our settings
@@ -428,4 +350,24 @@ class Modula_CPT {
428
 
429
  <?php
430
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  }
62
  'has_archive' => false,
63
  'exclude_from_search' => true,
64
  'rewrite' => false,
65
+ 'show_in_rest' => true,
66
  ) );
67
 
68
  $this->metaboxes = apply_filters( 'modula_cpt_metaboxes', array(
84
  ) );
85
 
86
  $this->cpt_name = apply_filters( 'modula_cpt_name', 'modula-gallery' );
87
+
88
  add_action( 'init', array( $this, 'register_cpt' ) );
89
 
90
  /* Fire our meta box setup function on the post editor screen. */
94
  /* */
95
  add_filter( 'views_edit-modula-gallery', array( $this, 'add_extensions_tab' ), 10, 1 );
96
 
97
+ // Post Table Columns
98
+ add_filter( "manage_{$this->cpt_name}_posts_columns", array( $this, 'add_columns' ) );
99
+ add_action( "manage_{$this->cpt_name}_posts_custom_column" , array( $this, 'outpu_column' ), 10, 2 );
100
+
101
  /* Load Fields Helper */
102
  require_once MODULA_PATH . 'includes/admin/class-modula-cpt-fields-helper.php';
103
 
153
  public function output_gallery_images() {
154
  $this->builder->render( 'gallery' );
155
  }
156
+
157
  public function output_gallery_settings() {
158
  $this->builder->render( 'settings' );
159
  }
172
  return $post_id;
173
  }
174
 
175
+ // We need to resize our images
176
+ $images = get_post_meta( $post_id, 'modula-images', true );
177
+ if ( $images && is_array( $images ) ) {
178
+ if ( isset( $_POST['modula-settings']['img_size'] ) && apply_filters( 'modula_resize_images', true, $_POST['modula-settings'] ) ) {
179
+
180
+ $gallery_type = isset( $_POST['modula-settings']['type'] ) ? sanitize_text_field($_POST['modula-settings']['type']) : 'creative-gallery';
181
+ $img_size = absint( $_POST['modula-settings']['img_size'] );
182
+
183
+ foreach ( $images as $image ) {
184
+ $grid_sizes = array(
185
+ 'width' => isset( $image['width'] ) ? absint( $image['width'] ) : 1,
186
+ 'height' => isset( $image['height'] ) ? absint( $image['height'] ) : 1,
187
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  $sizes = $this->resizer->get_image_size( $new_image['id'], $img_size, $gallery_type, $grid_sizes );
189
  if ( ! is_wp_error( $sizes ) ) {
190
  $this->resizer->resize_image( $sizes['url'], $sizes['width'], $sizes['height'] );
191
  }
192
+
193
  }
194
 
 
 
195
  }
 
 
 
 
 
 
 
 
196
  }
197
 
198
  if ( isset( $_POST['modula-settings'] ) ) {
199
+
200
  $fields_with_tabs = Modula_CPT_Fields_Helper::get_fields( 'all' );
201
 
202
  // Here we will save all our settings
350
 
351
  <?php
352
  }
353
+
354
+ public function add_columns( $columns ){
355
+
356
+ $date = $columns['date'];
357
+ unset( $columns['date'] );
358
+ $columns['shortcode'] = esc_html__( 'Shortcode', 'modula-best-grid-gallery' );
359
+ $columns['date'] = $date;
360
+ return $columns;
361
+
362
+ }
363
+
364
+ public function outpu_column( $column, $post_id ){
365
+
366
+ if ( 'shortcode' == $column ) {
367
+ $shortcode = '[modula id="' . $post_id . '"]';
368
+ echo '<input type="text" value="' . esc_attr( $shortcode ) . '" onclick="select()" readonly>';
369
+ }
370
+
371
+ }
372
+
373
  }
includes/admin/class-modula-field-builder.php CHANGED
@@ -175,9 +175,9 @@ class Modula_Field_Builder {
175
  $current_tab_content .= '</div>';
176
 
177
  $current_tab_content .= '<div class="tab-content-header-actions">';
178
- $current_tab_content .= '<a href="https://wp-modula.com/docs/" target="_blank" class="button"><span class="dashicons dashicons-sos"></span>' . esc_html__( 'Read The Documentation', 'modula-best-grid-gallery' ) . '</a>';
179
  $current_tab_content .= '<span> - or - </span>';
180
- $current_tab_content .= '<a href="https://wp-modula.com/contact-us/" target="_blank" class="button button-primary"><span class="dashicons dashicons-email-alt"></span>' . esc_html__( 'Need help? Get in touch', 'modula-best-grid-gallery' ) . '</a>';
181
  $current_tab_content .= '</div>';
182
 
183
  $current_tab_content .= '</div>';
175
  $current_tab_content .= '</div>';
176
 
177
  $current_tab_content .= '<div class="tab-content-header-actions">';
178
+ $current_tab_content .= '<a href="https://wp-modula.com/docs/" target="_blank" class="button"><span class="dashicons dashicons-sos"></span>' . esc_html__( 'Documentation', 'modula-best-grid-gallery' ) . '</a>';
179
  $current_tab_content .= '<span> - or - </span>';
180
+ $current_tab_content .= '<a href="https://wp-modula.com/contact-us/" target="_blank" class="button button-primary"><span class="dashicons dashicons-email-alt"></span>' . esc_html__( 'Get in touch', 'modula-best-grid-gallery' ) . '</a>';
181
  $current_tab_content .= '</div>';
182
 
183
  $current_tab_content .= '</div>';
includes/admin/class-modula-upsells.php CHANGED
@@ -13,6 +13,7 @@ class Modula_Upsells {
13
  add_filter( 'modula_image-loaded-effects_tab_content', array( $this, 'loadingeffects_tab_upsell' ) );
14
  add_filter( 'modula_video_tab_content', array( $this, 'video_tab_upsell' ) );
15
  add_filter( 'modula_speedup_tab_content', array( $this, 'speedup_tab_upsell' ) );
 
16
 
17
  }
18
 
@@ -65,7 +66,7 @@ class Modula_Upsells {
65
  public function video_tab_upsell( $tab_content ) {
66
 
67
  $upsell_title = esc_html__( 'Trying to add a video to your gallery?', 'modula-best-grid-gallery' );
68
- $upsell_description = esc_html__( 'Upgrade to Modula Pro today to add your stunning videos to your gallery...', 'modula-best-grid-gallery' );
69
 
70
  $tab_content .= $this->generate_upsell_box( $upsell_title, $upsell_description, 'video' );
71
 
@@ -76,7 +77,7 @@ class Modula_Upsells {
76
  public function speedup_tab_upsell( $tab_content ) {
77
 
78
  $upsell_title = esc_html__( 'Looking to make your gallery load faster ?', 'modula-best-grid-gallery' );
79
- $upsell_description = esc_html__( 'Upgrade to Modula PRO today and enjoy unlimited CDN & unlimited, on-the-fly image optimization through ShortPixel\'s API.', 'modula-best-grid-gallery' );
80
 
81
  $tab_content .= $this->generate_upsell_box( $upsell_title, $upsell_description, 'speedup' );
82
 
@@ -84,4 +85,15 @@ class Modula_Upsells {
84
 
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
13
  add_filter( 'modula_image-loaded-effects_tab_content', array( $this, 'loadingeffects_tab_upsell' ) );
14
  add_filter( 'modula_video_tab_content', array( $this, 'video_tab_upsell' ) );
15
  add_filter( 'modula_speedup_tab_content', array( $this, 'speedup_tab_upsell' ) );
16
+ add_filter( 'modula_filters_tab_content', array( $this, 'filters_tab_upsell' ) );
17
 
18
  }
19
 
66
  public function video_tab_upsell( $tab_content ) {
67
 
68
  $upsell_title = esc_html__( 'Trying to add a video to your gallery?', 'modula-best-grid-gallery' );
69
+ $upsell_description = esc_html__( 'Adding a video gallery with both self-hosted videos and videos from sources like YouTube and Vimeo to your website has never been easier.', 'modula-best-grid-gallery' );
70
 
71
  $tab_content .= $this->generate_upsell_box( $upsell_title, $upsell_description, 'video' );
72
 
77
  public function speedup_tab_upsell( $tab_content ) {
78
 
79
  $upsell_title = esc_html__( 'Looking to make your gallery load faster ?', 'modula-best-grid-gallery' );
80
+ $upsell_description = esc_html__( 'Allow Modula to automatically optimize your images to load as fast as possible by reducing their file sizes, resizing them and serving them from StackPath’s content delivery network.', 'modula-best-grid-gallery' );
81
 
82
  $tab_content .= $this->generate_upsell_box( $upsell_title, $upsell_description, 'speedup' );
83
 
85
 
86
  }
87
 
88
+ public function filters_tab_upsell( $tab_content ) {
89
+
90
+ $upsell_title = esc_html__( 'Looking to add filters to your gallery?', 'modula-best-grid-gallery' );
91
+ $upsell_description = esc_html__( 'Ugrade to Modula Pro today and get access to filters and separate the images in your gallery.', 'modula-best-grid-gallery' );
92
+
93
+ $tab_content .= $this->generate_upsell_box( $upsell_title, $upsell_description, 'filters' );
94
+
95
+ return $tab_content;
96
+
97
+ }
98
+
99
  }
includes/admin/modula-js-templates.php CHANGED
@@ -7,19 +7,6 @@
7
  <a href="#" class="modula-edit-image""><span class="dashicons dashicons-edit"></span></a>
8
  <a href="#" class="modula-delete-image""><span class="dashicons dashicons-trash"></span></a>
9
  </div>
10
- <div class="values">
11
- <input type="hidden" name="modula-images[id][{{data.index}}]" class="modula-image-id" value="{{ data.id }}">
12
- <input type="hidden" name="modula-images[alt][{{data.index}}]" class="modula-image-alt" value="{{ data.alt }}">
13
- <input type="hidden" name="modula-images[title][{{data.index}}]" class="modula-image-title" value="{{ data.title }}">
14
- <input type="hidden" name="modula-images[description][{{data.index}}]" class="modula-image-description" value="{{ data.description }}">
15
- <input type="hidden" name="modula-images[halign][{{data.index}}]" class="modula-image-halign" value="{{ data.halign }}">
16
- <input type="hidden" name="modula-images[valign][{{data.index}}]" class="modula-image-valign" value="{{ data.valign }}">
17
- <input type="hidden" name="modula-images[link][{{data.index}}]" class="modula-image-link" value="{{ data.link }}">
18
- <input type="hidden" name="modula-images[target][{{data.index}}]" class="modula-image-target" value="{{ data.target }}">
19
- <input type="hidden" name="modula-images[width][{{data.index}}]" class="modula-image-width" value="{{ data.width }}">
20
- <input type="hidden" name="modula-images[height][{{data.index}}]" class="modula-image-height" value="{{ data.height }}">
21
- <?php do_action( 'modula_item_extra_fields' ) ?>
22
- </div>
23
  <div class="segrip ui-resizable-handle ui-resizable-se"></div>
24
  </div>
25
  </script>
7
  <a href="#" class="modula-edit-image""><span class="dashicons dashicons-edit"></span></a>
8
  <a href="#" class="modula-delete-image""><span class="dashicons dashicons-trash"></span></a>
9
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  <div class="segrip ui-resizable-handle ui-resizable-se"></div>
11
  </div>
12
  </script>
includes/class-modula-gutenberg.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Modula_Gutenberg {
4
+
5
+ function __construct() {
6
+
7
+ // Return early if this function does not exist.
8
+ if ( ! function_exists( 'register_block_type' ) ) {
9
+ return;
10
+ }
11
+
12
+ add_action( 'init', array( $this, 'register_block_type' ) );
13
+ add_action( 'init', array( $this, 'generate_js_vars' ) );
14
+ add_action( 'wp_ajax_modula_get_gallery_meta', array( $this, 'get_gallery_meta' ) );
15
+ }
16
+
17
+ public function register_block_type() {
18
+
19
+ wp_register_script( 'modula-gutenberg', MODULA_URL . 'assets/js/wp-modula-gutenberg.js', array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-data' ) );
20
+ wp_register_style( 'modula-gutenberg', MODULA_URL . 'assets/css/modula-gutenberg.css', array(), true );
21
+
22
+ register_block_type(
23
+ 'modula/gallery',
24
+ array(
25
+ 'render_callback' => array( $this, 'render_modula_gallery' ),
26
+ 'editor_script' => 'modula-gutenberg',
27
+ 'editor_style' => 'modula-gutenberg',
28
+ )
29
+ );
30
+
31
+ }
32
+
33
+ public function generate_js_vars() {
34
+
35
+ wp_localize_script(
36
+ 'modula-gutenberg',
37
+ 'modulaVars',
38
+ array(
39
+ 'adminURL' => admin_url(),
40
+ 'ajaxURL' => admin_url( 'admin-ajax.php' ),
41
+ 'nonce' => wp_create_nonce( 'modula_nonce' ),
42
+ )
43
+ );
44
+ }
45
+
46
+ public function render_modula_gallery( $atts ) {
47
+ if ( ! isset( $atts['id'] ) ) {
48
+ return;
49
+ }
50
+
51
+ if ( ! isset( $atts['align'] ) ) {
52
+ $atts['align'] = '';
53
+ }
54
+
55
+ return do_shortcode( '[modula id=' . $atts['id'] . ' align=' . $atts['align'] . ']' );
56
+ }
57
+
58
+ public function get_gallery_meta() {
59
+
60
+ $id = $_POST['id'];
61
+ $nonce = $_POST['nonce'];
62
+
63
+ if ( ! wp_verify_nonce( $nonce, 'modula_nonce' ) ) {
64
+ wp_send_json_error();
65
+ die();
66
+ }
67
+
68
+ $images = get_post_meta( $id, 'modula-images', true );
69
+
70
+ if ( ! is_array( $images ) ) {
71
+ wp_send_json_error();
72
+ die();
73
+ }
74
+
75
+ foreach ( $images as $key => $value ) :
76
+ $image_obj = wp_get_attachment_image_src( $images[ $key ]['id'], 'large' );
77
+ $images[ $key ]['src'] = $image_obj[0];
78
+ $images[ $key ]['width'] = $image_obj[1];
79
+ $images[ $key ]['height'] = $image_obj[2];
80
+ endforeach;
81
+
82
+ echo json_encode( $images );
83
+
84
+ die();
85
+
86
+ }
87
+
88
+ }
89
+
90
+ new Modula_Gutenberg();
91
+
92
+
includes/class-modula.php CHANGED
@@ -12,7 +12,7 @@
12
  * @since 2.0.0
13
  */
14
  class Modula {
15
-
16
  /**
17
  * Define the core functionality of the plugin.
18
  *
@@ -22,7 +22,7 @@ class Modula {
22
  * @since 2.0.0
23
  */
24
  public function __construct() {
25
-
26
  $this->load_dependencies();
27
  $this->define_admin_hooks();
28
  $this->define_public_hooks();
@@ -41,12 +41,13 @@ class Modula {
41
  require_once MODULA_PATH . 'includes/admin/class-modula-admin.php';
42
 
43
  require_once MODULA_PATH . 'includes/public/class-modula-shortcode.php';
 
44
 
45
  if ( is_admin() ) {
46
 
47
  require_once MODULA_PATH . 'includes/class-modula-upgrades.php';
48
  // require_once MODULA_PATH . 'includes/admin/class-modula-admin-pointers.php';
49
-
50
  if ( ! class_exists( 'Epsilon_Review' ) ) {
51
  require_once MODULA_PATH . 'includes/libraries/class-modula-review.php';
52
  }
@@ -70,7 +71,7 @@ class Modula {
70
  }
71
 
72
  private function define_admin_hooks() {
73
-
74
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 20 );
75
  add_action( 'init', array( $this, 'admin_init' ), 20 );
76
  add_action( 'wp_ajax_modula-reload-addons', array( $this, 'reload_addons' ), 20 );
@@ -97,7 +98,7 @@ class Modula {
97
  }
98
 
99
  private function define_public_hooks() {
100
-
101
  }
102
 
103
  /* Enqueue Admin Scripts */
@@ -117,7 +118,7 @@ class Modula {
117
  $post_id = isset( $post->ID ) ? $post->ID : (int) $id;
118
 
119
  if ( 'post-new.php' == $hook || 'post.php' == $hook ) {
120
-
121
  /* CPT Styles & Scripts */
122
  // Media Scripts
123
  wp_enqueue_media( array(
@@ -130,6 +131,9 @@ class Modula {
130
  'strings' => array(
131
  'limitExceeded' => sprintf( __( 'You excedeed the limit of 20 photos. You can remove an image or %supgrade to pro%s', 'modula-best-grid-gallery' ), '<a href="#" target="_blank">', '</a>' ),
132
  ),
 
 
 
133
  );
134
 
135
  // Get all items from current gallery.
@@ -162,33 +166,32 @@ class Modula {
162
  }
163
 
164
  wp_enqueue_style( 'wp-color-picker' );
165
- wp_enqueue_style( 'jquery-ui', MODULA_URL . 'assets/css/jquery-ui.min.css' );
166
- // wp_enqueue_style( 'modula-icons', MODULA_URL . 'assets/css/materialdesignicons.css' );
167
- wp_enqueue_style( 'modula-cpt-style', MODULA_URL . 'assets/css/modula-cpt.css' );
168
-
169
- wp_enqueue_script( 'modula-resize-senzor', MODULA_URL . 'assets/js/resizesensor.js', array( 'jquery' ), '1.0.0', true );
170
- wp_enqueue_script( 'modula-packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-draggable' ), '2.0.0', true );
171
- wp_enqueue_script( 'modula-settings', MODULA_URL . 'assets/js/wp-modula-settings.js', array( 'jquery', 'jquery-ui-slider', 'wp-color-picker', 'jquery-ui-sortable' ), '2.0.0', true );
172
- wp_enqueue_script( 'modula-items', MODULA_URL . 'assets/js/wp-modula-items.js', array(), '2.0.0', true );
173
- wp_enqueue_script( 'modula-modal', MODULA_URL . 'assets/js/wp-modula-modal.js', array(), '2.0.0', true );
174
- wp_enqueue_script( 'modula-upload', MODULA_URL . 'assets/js/wp-modula-upload.js', array(), '2.0.0', true );
175
- wp_enqueue_script( 'modula-gallery', MODULA_URL . 'assets/js/wp-modula-gallery.js', array(), '2.0.0', true );
176
- wp_enqueue_script( 'modula-conditions', MODULA_URL . 'assets/js/wp-modula-conditions.js', array(), '2.0.0', true );
177
 
178
  do_action( 'modula_scripts_before_wp_modula' );
179
 
180
- wp_enqueue_script( 'modula', MODULA_URL . 'assets/js/wp-modula.js', array(), '2.0.0', true );
181
  wp_localize_script( 'modula', 'modulaHelper', $modula_helper );
182
 
183
  do_action( 'modula_scripts_after_wp_modula' );
184
 
185
  }elseif ( 'modula-gallery_page_modula' == $hook ) {
186
- wp_enqueue_style( 'modula-welcome-style', MODULA_URL . 'assets/css/welcome.css' );
187
  }elseif ( 'modula-gallery_page_modula-addons' == $hook ) {
188
- wp_enqueue_style( 'modula-welcome-style', MODULA_URL . 'assets/css/addons.css' );
189
- wp_enqueue_script( 'modula-addon', MODULA_URL . 'assets/js/modula-addon.js', array( 'jquery' ), '2.0.0', true );
190
  }elseif ( 'edit.php' == $hook ) {
191
- wp_enqueue_style( 'modula-welcome-style', MODULA_URL . 'assets/css/edit.css' );
192
  }
193
 
194
  }
12
  * @since 2.0.0
13
  */
14
  class Modula {
15
+
16
  /**
17
  * Define the core functionality of the plugin.
18
  *
22
  * @since 2.0.0
23
  */
24
  public function __construct() {
25
+
26
  $this->load_dependencies();
27
  $this->define_admin_hooks();
28
  $this->define_public_hooks();
41
  require_once MODULA_PATH . 'includes/admin/class-modula-admin.php';
42
 
43
  require_once MODULA_PATH . 'includes/public/class-modula-shortcode.php';
44
+ require_once MODULA_PATH . 'includes/class-modula-gutenberg.php';
45
 
46
  if ( is_admin() ) {
47
 
48
  require_once MODULA_PATH . 'includes/class-modula-upgrades.php';
49
  // require_once MODULA_PATH . 'includes/admin/class-modula-admin-pointers.php';
50
+
51
  if ( ! class_exists( 'Epsilon_Review' ) ) {
52
  require_once MODULA_PATH . 'includes/libraries/class-modula-review.php';
53
  }
71
  }
72
 
73
  private function define_admin_hooks() {
74
+
75
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 20 );
76
  add_action( 'init', array( $this, 'admin_init' ), 20 );
77
  add_action( 'wp_ajax_modula-reload-addons', array( $this, 'reload_addons' ), 20 );
98
  }
99
 
100
  private function define_public_hooks() {
101
+
102
  }
103
 
104
  /* Enqueue Admin Scripts */
118
  $post_id = isset( $post->ID ) ? $post->ID : (int) $id;
119
 
120
  if ( 'post-new.php' == $hook || 'post.php' == $hook ) {
121
+
122
  /* CPT Styles & Scripts */
123
  // Media Scripts
124
  wp_enqueue_media( array(
131
  'strings' => array(
132
  'limitExceeded' => sprintf( __( 'You excedeed the limit of 20 photos. You can remove an image or %supgrade to pro%s', 'modula-best-grid-gallery' ), '<a href="#" target="_blank">', '</a>' ),
133
  ),
134
+ 'id' => $post_id,
135
+ '_wpnonce' => wp_create_nonce( 'modula-ajax-save' ),
136
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
137
  );
138
 
139
  // Get all items from current gallery.
166
  }
167
 
168
  wp_enqueue_style( 'wp-color-picker' );
169
+ wp_enqueue_style( 'jquery-ui', MODULA_URL . 'assets/css/jquery-ui.min.css', null, MODULA_LITE_VERSION );
170
+ wp_enqueue_style( 'modula-cpt-style', MODULA_URL . 'assets/css/modula-cpt.css', null, MODULA_LITE_VERSION );
171
+
172
+ wp_enqueue_script( 'modula-resize-senzor', MODULA_URL . 'assets/js/resizesensor.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
173
+ wp_enqueue_script( 'modula-packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-draggable' ), MODULA_LITE_VERSION, true );
174
+ wp_enqueue_script( 'modula-settings', MODULA_URL . 'assets/js/wp-modula-settings.js', array( 'jquery', 'jquery-ui-slider', 'wp-color-picker', 'jquery-ui-sortable' ), MODULA_LITE_VERSION, true );
175
+ wp_enqueue_script( 'modula-items', MODULA_URL . 'assets/js/wp-modula-items.js', array(), MODULA_LITE_VERSION, true );
176
+ wp_enqueue_script( 'modula-modal', MODULA_URL . 'assets/js/wp-modula-modal.js', array(), MODULA_LITE_VERSION, true );
177
+ wp_enqueue_script( 'modula-upload', MODULA_URL . 'assets/js/wp-modula-upload.js', array(), MODULA_LITE_VERSION, true );
178
+ wp_enqueue_script( 'modula-gallery', MODULA_URL . 'assets/js/wp-modula-gallery.js', array(), MODULA_LITE_VERSION, true );
179
+ wp_enqueue_script( 'modula-conditions', MODULA_URL . 'assets/js/wp-modula-conditions.js', array(), MODULA_LITE_VERSION, true );
 
180
 
181
  do_action( 'modula_scripts_before_wp_modula' );
182
 
183
+ wp_enqueue_script( 'modula', MODULA_URL . 'assets/js/wp-modula.js', array(), MODULA_LITE_VERSION, true );
184
  wp_localize_script( 'modula', 'modulaHelper', $modula_helper );
185
 
186
  do_action( 'modula_scripts_after_wp_modula' );
187
 
188
  }elseif ( 'modula-gallery_page_modula' == $hook ) {
189
+ wp_enqueue_style( 'modula-welcome-style', MODULA_URL . 'assets/css/welcome.css', null, MODULA_LITE_VERSION );
190
  }elseif ( 'modula-gallery_page_modula-addons' == $hook ) {
191
+ wp_enqueue_style( 'modula-welcome-style', MODULA_URL . 'assets/css/addons.css', null, MODULA_LITE_VERSION );
192
+ wp_enqueue_script( 'modula-addon', MODULA_URL . 'assets/js/modula-addon.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
193
  }elseif ( 'edit.php' == $hook ) {
194
+ wp_enqueue_style( 'modula-welcome-style', MODULA_URL . 'assets/css/edit.css', null, MODULA_LITE_VERSION );
195
  }
196
 
197
  }
includes/public/class-modula-shortcode.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
 
3
  /**
4
- *
5
  */
6
  class Modula_Shortcode {
7
 
8
  private $loader;
9
-
10
  function __construct() {
11
 
12
  $this->loader = new Modula_Template_Loader();
@@ -23,26 +23,26 @@ class Modula_Shortcode {
23
  }
24
 
25
  public function add_gallery_scripts() {
26
-
27
- wp_register_style( 'lightbox2_stylesheet', MODULA_URL . 'assets/css/lightbox.min.css' );
28
-
29
  // @todo: move effects to modula style
30
- wp_register_style( 'modula', MODULA_URL . 'assets/css/modula.css', null, null );
31
- wp_register_style( 'modula-effects', MODULA_URL . 'assets/css/effects.css', null, null );
32
 
33
  // Scripts necessary for some galleries
34
- wp_register_script( 'lightbox2_script', MODULA_URL . 'assets/js/lightbox.min.js', array( 'jquery' ), null, true );
35
- wp_register_script( 'packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery' ), null, true );
36
-
37
 
38
  // @todo: minify all css & js for a better optimization.
39
- wp_register_script( 'modula', MODULA_URL . 'assets/js/jquery-modula.min.js', array( 'jquery' ), null, true );
40
 
41
  }
42
 
43
  public function gallery_shortcode_handler( $atts ) {
44
  $default_atts = array(
45
  'id' => false,
 
46
  );
47
 
48
  $atts = wp_parse_args( $atts, $default_atts );
@@ -91,10 +91,11 @@ class Modula_Shortcode {
91
  }
92
 
93
  /* Get gallery images */
94
- $images = apply_filters( 'modula_gallery_images', get_post_meta( $atts['id'], 'modula-images', true ), $settings );
95
  if ( isset( $settings['shuffle'] ) && '1' == $settings['shuffle'] && 'creative-gallery' == $type ) {
96
  shuffle( $images );
97
  }
 
98
 
99
  if ( empty( $settings ) || empty( $images ) ) {
100
  return esc_html__( 'Gallery not found.', 'modula-best-grid-gallery' );
@@ -109,7 +110,7 @@ class Modula_Shortcode {
109
  case "lightbox2":
110
  wp_enqueue_style( 'lightbox2_stylesheet' );
111
  wp_enqueue_script( 'lightbox2_script' );
112
- wp_add_inline_script( 'lightbox2_script', 'jQuery(document).ready(function(){lightbox.option({albumLabel: "' . esc_html__( 'Image %1 of %2', 'modula-best-grid-gallery' ) . '",wrapAround: true});});' );
113
  break;
114
  default:
115
  do_action( 'modula_lighbox_shortcode', $settings['lightbox'] );
@@ -133,6 +134,7 @@ class Modula_Shortcode {
133
  }
134
 
135
  $settings['gallery_id'] = $gallery_id;
 
136
 
137
  $template_data = array(
138
  'gallery_id' => $gallery_id,
@@ -204,7 +206,7 @@ class Modula_Shortcode {
204
  }
205
 
206
  $css .= "#{$gallery_id} .item { transform: scale(" . absint( $settings['loadedScale'] ) / 100 . "); }";
207
-
208
  if ( 'custom-grid' != $settings['type'] ) {
209
  $css .= "#{$gallery_id} .items { width:" . esc_attr($settings['width']) . "; height:" . absint( $settings['height'] ) . "px; }";
210
  }
1
  <?php
2
 
3
  /**
4
+ *
5
  */
6
  class Modula_Shortcode {
7
 
8
  private $loader;
9
+
10
  function __construct() {
11
 
12
  $this->loader = new Modula_Template_Loader();
23
  }
24
 
25
  public function add_gallery_scripts() {
26
+
27
+ wp_register_style( 'lightbox2_stylesheet', MODULA_URL . 'assets/css/lightbox.min.css', null, MODULA_LITE_VERSION );
28
+
29
  // @todo: move effects to modula style
30
+ wp_register_style( 'modula', MODULA_URL . 'assets/css/modula.css', null, MODULA_LITE_VERSION );
31
+ wp_register_style( 'modula-effects', MODULA_URL . 'assets/css/effects.css', null, MODULA_LITE_VERSION );
32
 
33
  // Scripts necessary for some galleries
34
+ wp_register_script( 'lightbox2_script', MODULA_URL . 'assets/js/lightbox.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
35
+ wp_register_script( 'packery', MODULA_URL . 'assets/js/packery.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
 
36
 
37
  // @todo: minify all css & js for a better optimization.
38
+ wp_register_script( 'modula', MODULA_URL . 'assets/js/jquery-modula.min.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
39
 
40
  }
41
 
42
  public function gallery_shortcode_handler( $atts ) {
43
  $default_atts = array(
44
  'id' => false,
45
+ 'align' => '',
46
  );
47
 
48
  $atts = wp_parse_args( $atts, $default_atts );
91
  }
92
 
93
  /* Get gallery images */
94
+ $images = apply_filters( 'modula_gallery_before_shuffle_images', get_post_meta( $atts['id'], 'modula-images', true ), $settings );
95
  if ( isset( $settings['shuffle'] ) && '1' == $settings['shuffle'] && 'creative-gallery' == $type ) {
96
  shuffle( $images );
97
  }
98
+ $images = apply_filters( 'modula_gallery_images', $images, $settings );
99
 
100
  if ( empty( $settings ) || empty( $images ) ) {
101
  return esc_html__( 'Gallery not found.', 'modula-best-grid-gallery' );
110
  case "lightbox2":
111
  wp_enqueue_style( 'lightbox2_stylesheet' );
112
  wp_enqueue_script( 'lightbox2_script' );
113
+ wp_add_inline_script( 'lightbox2_script', 'jQuery(document).ready(function(){lightbox.option({albumLabel: "' . esc_html__( 'Image %1 of %2', 'modula-best-grid-gallery' ) . '",wrapAround: true, showNavigation: ' . $settings['show_navigation'] . ', showNavigationOnMobile: ' . $settings['show_navigation_on_mobile'] . '});});' );
114
  break;
115
  default:
116
  do_action( 'modula_lighbox_shortcode', $settings['lightbox'] );
134
  }
135
 
136
  $settings['gallery_id'] = $gallery_id;
137
+ $settings['align'] = $atts['align'];
138
 
139
  $template_data = array(
140
  'gallery_id' => $gallery_id,
206
  }
207
 
208
  $css .= "#{$gallery_id} .item { transform: scale(" . absint( $settings['loadedScale'] ) / 100 . "); }";
209
+
210
  if ( 'custom-grid' != $settings['type'] ) {
211
  $css .= "#{$gallery_id} .items { width:" . esc_attr($settings['width']) . "; height:" . absint( $settings['height'] ) . "px; }";
212
  }
includes/public/templates/modula-gallery.php CHANGED
@@ -1,4 +1,4 @@
1
- <div id="<?php echo esc_attr($data->gallery_id) ?>" class="modula modula-gallery" data-config="<?php echo esc_attr( json_encode( $data->js_config ) ) ?>">
2
 
3
  <?php do_action( 'modula_shortcode_before_items', $data->settings ) ?>
4
 
1
+ <div id="<?php echo esc_attr($data->gallery_id) ?>" class="modula modula-gallery <?php echo ( $data->settings['align'] != '' ) ? esc_attr( 'align' . $data->settings['align'] ) : ''; ?>" data-config="<?php echo esc_attr( json_encode( $data->js_config ) ) ?>">
2
 
3
  <?php do_action( 'modula_shortcode_before_items', $data->settings ) ?>
4