Version Description
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Zoom Magnifier |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- assets/css/admin.css +131 -131
- assets/css/frontend.css +103 -103
- assets/css/yith_magnifier.css +90 -85
- assets/icons/lightbox.svg +17 -17
- assets/icons/zoom.svg +18 -18
- assets/js/init.prettyPhoto.js +935 -935
- assets/js/jquery.carouFredSel.js +3822 -3822
- assets/js/jquery.carouFredSel.min.js +1 -1
- assets/js/jquery.min.js +1 -1
- assets/js/yith_magnifier.js +1041 -1041
- assets/js/ywzm_backend.js +88 -88
- assets/js/ywzm_frontend.js +285 -285
- changelog.txt +190 -190
- init.php +155 -154
- languages/yith-woocommerce-zoom-magnifier-es_ES.po +410 -200
- languages/yith-woocommerce-zoom-magnifier-it_IT.po +476 -223
- languages/yith-woocommerce-zoom-magnifier.pot +2 -2
- lib/class.yith-wcmg-admin.php +97 -97
- lib/class.yith-wcmg-frontend.php +370 -370
- lib/class.yith-woocommerce-zoom-magnifier.php +177 -177
- lib/class.yith-ywzm-plugin-fw-loader.php +266 -266
- lib/compatibility/class-yith-wczm-compatibility.php +113 -113
- lib/compatibility/class-yith-wczm-elementor-compatibility.php +102 -102
- lib/compatibility/elementor/class-yith-wczm-product-images-widget.php +80 -80
- lib/functions.yith-ywzm.php +41 -0
- plugin-fw/LICENSE.txt +695 -695
- plugin-fw/assets/css/admin.css +333 -333
- plugin-fw/assets/css/codemirror/codemirror.css +260 -260
- plugin-fw/assets/css/colorbox.css +65 -65
- plugin-fw/assets/css/elementor.css +35 -35
- plugin-fw/assets/css/metaboxes.css +751 -751
- plugin-fw/assets/css/yit-plugin-panel.css +1087 -1087
- plugin-fw/assets/css/yit-upgrade-to-pro.css +82 -82
- plugin-fw/assets/css/yit-upgrader.css +21 -21
- plugin-fw/assets/css/yith-fields.css +0 -1535
assets/css/admin.css
CHANGED
@@ -1,131 +1,131 @@
|
|
1 |
-
.yith_woocommerce_slider {
|
2 |
-
width: 300px;
|
3 |
-
float: left
|
4 |
-
}
|
5 |
-
|
6 |
-
.yith_woocommerce_slider_value {
|
7 |
-
margin-top: -5px;
|
8 |
-
margin-left: 10px;
|
9 |
-
width: 50px;
|
10 |
-
float: left;
|
11 |
-
text-align: center;
|
12 |
-
font-weight: bold;
|
13 |
-
}
|
14 |
-
|
15 |
-
#eg-wrap .select_fake { /* solve back-end conflict with Essential Grid */
|
16 |
-
height: 24px;
|
17 |
-
}
|
18 |
-
|
19 |
-
.yith-plugins_page_yith_woocommerce_zoom-magnifier_panel .yith-plugin-fw-dimensions__dimensions{
|
20 |
-
max-width: 250px;
|
21 |
-
}
|
22 |
-
|
23 |
-
#yith_wcmg_slider_sizes .yith-plugin-fw-dimensions__linked{
|
24 |
-
display: none;
|
25 |
-
}
|
26 |
-
|
27 |
-
#yith_wcmg_slider_radius, #ywzm_zoom_icon_size, #ywzm_lightbox_icon_size, #yith_wcmg_zoom_radius, #yith_wcmg_lightbox_radius{
|
28 |
-
max-width: 75px;
|
29 |
-
}
|
30 |
-
|
31 |
-
|
32 |
-
.ywzm-admin-wrap-content{
|
33 |
-
background: white;
|
34 |
-
padding: 20px;
|
35 |
-
}
|
36 |
-
|
37 |
-
.yith-plugin-ui .ywzm-admin-wrap-content h2 {
|
38 |
-
border: 0;
|
39 |
-
border-top-color: currentcolor;
|
40 |
-
border-top-style: none;
|
41 |
-
border-top-width: 0px;
|
42 |
-
padding: 0;
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
.ywzm-admin-no-posts {
|
47 |
-
text-align: center;
|
48 |
-
padding: 50px;
|
49 |
-
}
|
50 |
-
|
51 |
-
.ywzm-admin-no-posts-logo {
|
52 |
-
padding-bottom: 10px;
|
53 |
-
}
|
54 |
-
|
55 |
-
.ywzm-admin-no-posts-text {
|
56 |
-
font-size: 16px;
|
57 |
-
line-height: 30px;
|
58 |
-
margin-top: 20px;
|
59 |
-
}
|
60 |
-
|
61 |
-
.ywzm-admin-no-posts a.page-title-action {
|
62 |
-
padding: 5px 30px !important;
|
63 |
-
}
|
64 |
-
|
65 |
-
.ywzm-admin-no-posts-text p {
|
66 |
-
font-size: 14px;
|
67 |
-
line-height: 1em;
|
68 |
-
}
|
69 |
-
|
70 |
-
.wrap-title {
|
71 |
-
display: flex;
|
72 |
-
align-items: center;
|
73 |
-
}
|
74 |
-
|
75 |
-
.yith-plugins_page_yith_woocommerce_zoom-magnifier_panel .ui-dialog-buttonpane .ui-button {
|
76 |
-
box-shadow: none;
|
77 |
-
background: #007694;
|
78 |
-
color: #fff;
|
79 |
-
border: 0;
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
table.excluded_categories td,
|
84 |
-
table.excluded_categories th,
|
85 |
-
table.excluded_products td,
|
86 |
-
table.excluded_products th {
|
87 |
-
vertical-align: middle;
|
88 |
-
}
|
89 |
-
|
90 |
-
table.excluded_categories .column-image,
|
91 |
-
table.excluded_products .column-image {
|
92 |
-
width: 52px;
|
93 |
-
text-align: center;
|
94 |
-
white-space: nowrap;
|
95 |
-
}
|
96 |
-
|
97 |
-
table.excluded_categories .column-image img,
|
98 |
-
table.excluded_products .column-image img {
|
99 |
-
margin: 0;
|
100 |
-
width: auto;
|
101 |
-
height: auto;
|
102 |
-
max-width: 40px;
|
103 |
-
max-height: 40px;
|
104 |
-
}
|
105 |
-
|
106 |
-
table.excluded_categories .column-slug,
|
107 |
-
table.excluded_categories .column-name {
|
108 |
-
width: 25%;
|
109 |
-
}
|
110 |
-
|
111 |
-
table.excluded_categories .column-count {
|
112 |
-
width: 74px;
|
113 |
-
}
|
114 |
-
|
115 |
-
table.excluded_categories .column-actions,
|
116 |
-
table.excluded_products .column-actions {
|
117 |
-
width: 100px;
|
118 |
-
}
|
119 |
-
|
120 |
-
.wp-core-ui .yith-plugin-ui .ywzm-admin-wrap-content .button-secondary,
|
121 |
-
.wp-core-ui .yith-plugin-ui .ywzm-admin-wrap-content .button-primary {
|
122 |
-
line-height: 30px;
|
123 |
-
}
|
124 |
-
.ywzm-admin-wrap-content {
|
125 |
-
background: white;
|
126 |
-
padding: 20px;
|
127 |
-
}
|
128 |
-
|
129 |
-
.ywzm-admin-wrap-content input#add {
|
130 |
-
margin-top: 7px;
|
131 |
-
}
|
1 |
+
.yith_woocommerce_slider {
|
2 |
+
width: 300px;
|
3 |
+
float: left
|
4 |
+
}
|
5 |
+
|
6 |
+
.yith_woocommerce_slider_value {
|
7 |
+
margin-top: -5px;
|
8 |
+
margin-left: 10px;
|
9 |
+
width: 50px;
|
10 |
+
float: left;
|
11 |
+
text-align: center;
|
12 |
+
font-weight: bold;
|
13 |
+
}
|
14 |
+
|
15 |
+
#eg-wrap .select_fake { /* solve back-end conflict with Essential Grid */
|
16 |
+
height: 24px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.yith-plugins_page_yith_woocommerce_zoom-magnifier_panel .yith-plugin-fw-dimensions__dimensions{
|
20 |
+
max-width: 250px;
|
21 |
+
}
|
22 |
+
|
23 |
+
#yith_wcmg_slider_sizes .yith-plugin-fw-dimensions__linked{
|
24 |
+
display: none;
|
25 |
+
}
|
26 |
+
|
27 |
+
#yith_wcmg_slider_radius, #ywzm_zoom_icon_size, #ywzm_lightbox_icon_size, #yith_wcmg_zoom_radius, #yith_wcmg_lightbox_radius{
|
28 |
+
max-width: 75px;
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
.ywzm-admin-wrap-content{
|
33 |
+
background: white;
|
34 |
+
padding: 20px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.yith-plugin-ui .ywzm-admin-wrap-content h2 {
|
38 |
+
border: 0;
|
39 |
+
border-top-color: currentcolor;
|
40 |
+
border-top-style: none;
|
41 |
+
border-top-width: 0px;
|
42 |
+
padding: 0;
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
.ywzm-admin-no-posts {
|
47 |
+
text-align: center;
|
48 |
+
padding: 50px;
|
49 |
+
}
|
50 |
+
|
51 |
+
.ywzm-admin-no-posts-logo {
|
52 |
+
padding-bottom: 10px;
|
53 |
+
}
|
54 |
+
|
55 |
+
.ywzm-admin-no-posts-text {
|
56 |
+
font-size: 16px;
|
57 |
+
line-height: 30px;
|
58 |
+
margin-top: 20px;
|
59 |
+
}
|
60 |
+
|
61 |
+
.ywzm-admin-no-posts a.page-title-action {
|
62 |
+
padding: 5px 30px !important;
|
63 |
+
}
|
64 |
+
|
65 |
+
.ywzm-admin-no-posts-text p {
|
66 |
+
font-size: 14px;
|
67 |
+
line-height: 1em;
|
68 |
+
}
|
69 |
+
|
70 |
+
.wrap-title {
|
71 |
+
display: flex;
|
72 |
+
align-items: center;
|
73 |
+
}
|
74 |
+
|
75 |
+
.yith-plugins_page_yith_woocommerce_zoom-magnifier_panel .ui-dialog-buttonpane .ui-button {
|
76 |
+
box-shadow: none;
|
77 |
+
background: #007694;
|
78 |
+
color: #fff;
|
79 |
+
border: 0;
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
table.excluded_categories td,
|
84 |
+
table.excluded_categories th,
|
85 |
+
table.excluded_products td,
|
86 |
+
table.excluded_products th {
|
87 |
+
vertical-align: middle;
|
88 |
+
}
|
89 |
+
|
90 |
+
table.excluded_categories .column-image,
|
91 |
+
table.excluded_products .column-image {
|
92 |
+
width: 52px;
|
93 |
+
text-align: center;
|
94 |
+
white-space: nowrap;
|
95 |
+
}
|
96 |
+
|
97 |
+
table.excluded_categories .column-image img,
|
98 |
+
table.excluded_products .column-image img {
|
99 |
+
margin: 0;
|
100 |
+
width: auto;
|
101 |
+
height: auto;
|
102 |
+
max-width: 40px;
|
103 |
+
max-height: 40px;
|
104 |
+
}
|
105 |
+
|
106 |
+
table.excluded_categories .column-slug,
|
107 |
+
table.excluded_categories .column-name {
|
108 |
+
width: 25%;
|
109 |
+
}
|
110 |
+
|
111 |
+
table.excluded_categories .column-count {
|
112 |
+
width: 74px;
|
113 |
+
}
|
114 |
+
|
115 |
+
table.excluded_categories .column-actions,
|
116 |
+
table.excluded_products .column-actions {
|
117 |
+
width: 100px;
|
118 |
+
}
|
119 |
+
|
120 |
+
.wp-core-ui .yith-plugin-ui .ywzm-admin-wrap-content .button-secondary,
|
121 |
+
.wp-core-ui .yith-plugin-ui .ywzm-admin-wrap-content .button-primary {
|
122 |
+
line-height: 30px;
|
123 |
+
}
|
124 |
+
.ywzm-admin-wrap-content {
|
125 |
+
background: white;
|
126 |
+
padding: 20px;
|
127 |
+
}
|
128 |
+
|
129 |
+
.ywzm-admin-wrap-content input#add {
|
130 |
+
margin-top: 7px;
|
131 |
+
}
|
assets/css/frontend.css
CHANGED
@@ -1,103 +1,103 @@
|
|
1 |
-
/* gallery */
|
2 |
-
.yith_magnifier_gallery {
|
3 |
-
margin: 0;
|
4 |
-
padding: 0;
|
5 |
-
text-align: center;
|
6 |
-
}
|
7 |
-
|
8 |
-
.yith_magnifier_gallery li {
|
9 |
-
position: relative;
|
10 |
-
display: inline-block;
|
11 |
-
vertical-align: center;
|
12 |
-
top: 0;
|
13 |
-
}
|
14 |
-
|
15 |
-
/* .yith_magnifier_gallery li.last {
|
16 |
-
margin-right: 0;
|
17 |
-
} */
|
18 |
-
|
19 |
-
.yith_magnifier_gallery li a {
|
20 |
-
width: 100% !important;
|
21 |
-
display: block;
|
22 |
-
margin-top: 10px;
|
23 |
-
height: auto !important;
|
24 |
-
overflow: hidden;
|
25 |
-
}
|
26 |
-
|
27 |
-
/* next/prev */
|
28 |
-
.single-product.woocommerce .thumbnails {
|
29 |
-
position: relative;
|
30 |
-
overflow: hidden;
|
31 |
-
}
|
32 |
-
|
33 |
-
.single-product.woocommerce .thumbnails .dashicons{
|
34 |
-
display: table-cell;
|
35 |
-
text-align: center;
|
36 |
-
vertical-align: middle;
|
37 |
-
padding-bottom: 2px;
|
38 |
-
}
|
39 |
-
|
40 |
-
|
41 |
-
.single-product.woocommerce .thumbnails #slider-prev,
|
42 |
-
.single-product.woocommerce .thumbnails #slider-next {
|
43 |
-
display: none;
|
44 |
-
cursor: pointer;
|
45 |
-
width: 25px;
|
46 |
-
height: 25px;
|
47 |
-
position: absolute;
|
48 |
-
top: 50%;
|
49 |
-
transform: translateY( -50% );
|
50 |
-
}
|
51 |
-
|
52 |
-
.single-product.woocommerce .thumbnails #slider-prev {
|
53 |
-
background-position: left center;
|
54 |
-
left: 1px;
|
55 |
-
}
|
56 |
-
|
57 |
-
.single-product.woocommerce .thumbnails #slider-next {
|
58 |
-
background-position: right center;
|
59 |
-
right: 0px;
|
60 |
-
}
|
61 |
-
|
62 |
-
.single-product.woocommerce .thumbnails:hover #slider-prev,
|
63 |
-
.single-product.woocommerce .thumbnails:hover #slider-next {
|
64 |
-
display: block !important;
|
65 |
-
}
|
66 |
-
|
67 |
-
span.onsale {
|
68 |
-
z-index: 10000
|
69 |
-
}
|
70 |
-
|
71 |
-
div.pp_woocommerce a.yith_expand {
|
72 |
-
/*background: url("../icons/lightbox.svg") no-repeat center center;*/
|
73 |
-
display: inline;
|
74 |
-
cursor: pointer;
|
75 |
-
font-size: 25px;
|
76 |
-
position: absolute;
|
77 |
-
text-decoration: none;
|
78 |
-
text-indent: -10000px;
|
79 |
-
z-index: 20000;
|
80 |
-
height: 25px;
|
81 |
-
width: 25px;
|
82 |
-
line-height: 1em;
|
83 |
-
}
|
84 |
-
|
85 |
-
.expand-button-hidden svg{
|
86 |
-
display: block;
|
87 |
-
padding: 2px;
|
88 |
-
}
|
89 |
-
|
90 |
-
.zoom-button-hidden svg{
|
91 |
-
display: block;
|
92 |
-
padding: 5px;
|
93 |
-
}
|
94 |
-
|
95 |
-
.expand-button-hidden svg {
|
96 |
-
display: block;
|
97 |
-
padding: 5px;
|
98 |
-
}
|
99 |
-
|
100 |
-
|
101 |
-
.elementor-widget-wrap .yith_magnifier_zoom.woocommerce-main-image img{
|
102 |
-
width: 100%;
|
103 |
-
}
|
1 |
+
/* gallery */
|
2 |
+
.yith_magnifier_gallery {
|
3 |
+
margin: 0;
|
4 |
+
padding: 0;
|
5 |
+
text-align: center;
|
6 |
+
}
|
7 |
+
|
8 |
+
.yith_magnifier_gallery li {
|
9 |
+
position: relative;
|
10 |
+
display: inline-block;
|
11 |
+
vertical-align: center;
|
12 |
+
top: 0;
|
13 |
+
}
|
14 |
+
|
15 |
+
/* .yith_magnifier_gallery li.last {
|
16 |
+
margin-right: 0;
|
17 |
+
} */
|
18 |
+
|
19 |
+
.yith_magnifier_gallery li a {
|
20 |
+
width: 100% !important;
|
21 |
+
display: block;
|
22 |
+
margin-top: 10px;
|
23 |
+
height: auto !important;
|
24 |
+
overflow: hidden;
|
25 |
+
}
|
26 |
+
|
27 |
+
/* next/prev */
|
28 |
+
.single-product.woocommerce .thumbnails {
|
29 |
+
position: relative;
|
30 |
+
overflow: hidden;
|
31 |
+
}
|
32 |
+
|
33 |
+
.single-product.woocommerce .thumbnails .dashicons{
|
34 |
+
display: table-cell;
|
35 |
+
text-align: center;
|
36 |
+
vertical-align: middle;
|
37 |
+
padding-bottom: 2px;
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
.single-product.woocommerce .thumbnails #slider-prev,
|
42 |
+
.single-product.woocommerce .thumbnails #slider-next {
|
43 |
+
display: none;
|
44 |
+
cursor: pointer;
|
45 |
+
width: 25px;
|
46 |
+
height: 25px;
|
47 |
+
position: absolute;
|
48 |
+
top: 50%;
|
49 |
+
transform: translateY( -50% );
|
50 |
+
}
|
51 |
+
|
52 |
+
.single-product.woocommerce .thumbnails #slider-prev {
|
53 |
+
background-position: left center;
|
54 |
+
left: 1px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.single-product.woocommerce .thumbnails #slider-next {
|
58 |
+
background-position: right center;
|
59 |
+
right: 0px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.single-product.woocommerce .thumbnails:hover #slider-prev,
|
63 |
+
.single-product.woocommerce .thumbnails:hover #slider-next {
|
64 |
+
display: block !important;
|
65 |
+
}
|
66 |
+
|
67 |
+
span.onsale {
|
68 |
+
z-index: 10000
|
69 |
+
}
|
70 |
+
|
71 |
+
div.pp_woocommerce a.yith_expand {
|
72 |
+
/*background: url("../icons/lightbox.svg") no-repeat center center;*/
|
73 |
+
display: inline;
|
74 |
+
cursor: pointer;
|
75 |
+
font-size: 25px;
|
76 |
+
position: absolute;
|
77 |
+
text-decoration: none;
|
78 |
+
text-indent: -10000px;
|
79 |
+
z-index: 20000;
|
80 |
+
height: 25px;
|
81 |
+
width: 25px;
|
82 |
+
line-height: 1em;
|
83 |
+
}
|
84 |
+
|
85 |
+
.expand-button-hidden svg{
|
86 |
+
display: block;
|
87 |
+
padding: 2px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.zoom-button-hidden svg{
|
91 |
+
display: block;
|
92 |
+
padding: 5px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.expand-button-hidden svg {
|
96 |
+
display: block;
|
97 |
+
padding: 5px;
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
.elementor-widget-wrap .yith_magnifier_zoom.woocommerce-main-image img{
|
102 |
+
width: 100%;
|
103 |
+
}
|
assets/css/yith_magnifier.css
CHANGED
@@ -1,85 +1,90 @@
|
|
1 |
-
.yith_magnifier_zoom_wrap {
|
2 |
-
top: 0;
|
3 |
-
position: relative;
|
4 |
-
}
|
5 |
-
|
6 |
-
.yith_magnifier_loading {
|
7 |
-
color:white;
|
8 |
-
background:#222;
|
9 |
-
padding:3px;
|
10 |
-
border:1px solid #000;
|
11 |
-
position: absolute;
|
12 |
-
text-align: center;
|
13 |
-
top: 10%;
|
14 |
-
z-index: 9999;
|
15 |
-
}
|
16 |
-
|
17 |
-
.yith_magnifier_zoom {
|
18 |
-
position: relative;
|
19 |
-
display: block;
|
20 |
-
}
|
21 |
-
|
22 |
-
.yith_magnifier_zoom img {
|
23 |
-
display: block;
|
24 |
-
}
|
25 |
-
|
26 |
-
.yith_magnifier_mousetrap {
|
27 |
-
z-index: 999;
|
28 |
-
position: absolute;
|
29 |
-
width: 0px;
|
30 |
-
height :0px;
|
31 |
-
left: 0;
|
32 |
-
top: 0;
|
33 |
-
}
|
34 |
-
|
35 |
-
/* ie fix */
|
36 |
-
.ie .yith_magnifier_mousetrap {
|
37 |
-
background-image: url(".");
|
38 |
-
}
|
39 |
-
|
40 |
-
.yith_magnifier_lens {
|
41 |
-
display: none;
|
42 |
-
z-index:98;
|
43 |
-
position:absolute;
|
44 |
-
overflow: hidden;
|
45 |
-
|
46 |
-
border: 1px solid #ccc;
|
47 |
-
}
|
48 |
-
|
49 |
-
.yith_magnifier_lens img {
|
50 |
-
width: auto !important;
|
51 |
-
max-width: none !important;
|
52 |
-
|
53 |
-
-webkit-transition: all ease-in-out 0s !important;
|
54 |
-
-moz-transition: all ease-in-out 0s !important;
|
55 |
-
-o-transition: all ease-in-out 0s !important;
|
56 |
-
transition: all ease-in-out 0s !important;
|
57 |
-
}
|
58 |
-
|
59 |
-
.yith_magnifier_zoom_magnifier {
|
60 |
-
display:none;
|
61 |
-
position:absolute;
|
62 |
-
z-index: 99;
|
63 |
-
|
64 |
-
border:4px solid #ccc;
|
65 |
-
overflow:hidden;
|
66 |
-
}
|
67 |
-
|
68 |
-
.yith_magnifier_gallery {
|
69 |
-
list-style: none;
|
70 |
-
}
|
71 |
-
|
72 |
-
|
73 |
-
/* ul.yith_magnifier_gallery li {
|
74 |
-
margin-right: 10px;
|
75 |
-
text-align: center;
|
76 |
-
overflow: hidden;
|
77 |
-
}
|
78 |
-
|
79 |
-
ul.yith_magnifier_gallery li:last-child {
|
80 |
-
margin-right: 0px;
|
81 |
-
} */
|
82 |
-
|
83 |
-
.yith_magnifier_thumbnail {
|
84 |
-
margin-right: 1px;
|
85 |
-
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
.yith_magnifier_zoom_wrap {
|
2 |
+
top: 0;
|
3 |
+
position: relative;
|
4 |
+
}
|
5 |
+
|
6 |
+
.yith_magnifier_loading {
|
7 |
+
color:white;
|
8 |
+
background:#222;
|
9 |
+
padding:3px;
|
10 |
+
border:1px solid #000;
|
11 |
+
position: absolute;
|
12 |
+
text-align: center;
|
13 |
+
top: 10%;
|
14 |
+
z-index: 9999;
|
15 |
+
}
|
16 |
+
|
17 |
+
.yith_magnifier_zoom {
|
18 |
+
position: relative;
|
19 |
+
display: block;
|
20 |
+
}
|
21 |
+
|
22 |
+
.yith_magnifier_zoom img {
|
23 |
+
display: block;
|
24 |
+
}
|
25 |
+
|
26 |
+
.yith_magnifier_mousetrap {
|
27 |
+
z-index: 999;
|
28 |
+
position: absolute;
|
29 |
+
width: 0px;
|
30 |
+
height :0px;
|
31 |
+
left: 0;
|
32 |
+
top: 0;
|
33 |
+
}
|
34 |
+
|
35 |
+
/* ie fix */
|
36 |
+
.ie .yith_magnifier_mousetrap {
|
37 |
+
background-image: url(".");
|
38 |
+
}
|
39 |
+
|
40 |
+
.yith_magnifier_lens {
|
41 |
+
display: none;
|
42 |
+
z-index:98;
|
43 |
+
position:absolute;
|
44 |
+
overflow: hidden;
|
45 |
+
|
46 |
+
border: 1px solid #ccc;
|
47 |
+
}
|
48 |
+
|
49 |
+
.yith_magnifier_lens img {
|
50 |
+
width: auto !important;
|
51 |
+
max-width: none !important;
|
52 |
+
|
53 |
+
-webkit-transition: all ease-in-out 0s !important;
|
54 |
+
-moz-transition: all ease-in-out 0s !important;
|
55 |
+
-o-transition: all ease-in-out 0s !important;
|
56 |
+
transition: all ease-in-out 0s !important;
|
57 |
+
}
|
58 |
+
|
59 |
+
.yith_magnifier_zoom_magnifier {
|
60 |
+
display:none;
|
61 |
+
position:absolute;
|
62 |
+
z-index: 99;
|
63 |
+
|
64 |
+
border:4px solid #ccc;
|
65 |
+
overflow:hidden;
|
66 |
+
}
|
67 |
+
|
68 |
+
.yith_magnifier_gallery {
|
69 |
+
list-style: none;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
/* ul.yith_magnifier_gallery li {
|
74 |
+
margin-right: 10px;
|
75 |
+
text-align: center;
|
76 |
+
overflow: hidden;
|
77 |
+
}
|
78 |
+
|
79 |
+
ul.yith_magnifier_gallery li:last-child {
|
80 |
+
margin-right: 0px;
|
81 |
+
} */
|
82 |
+
|
83 |
+
.yith_magnifier_thumbnail {
|
84 |
+
margin-right: 1px;
|
85 |
+
}
|
86 |
+
|
87 |
+
/* Fix the blocked zoom box */
|
88 |
+
.woocommerce-product-gallery__image > .yith_magnifier_zoom_magnifier{
|
89 |
+
display: none !important;
|
90 |
+
}
|
assets/icons/lightbox.svg
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<svg width="19px" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
-
<title>arrow / expand</title>
|
4 |
-
<defs>
|
5 |
-
<rect id="path-1" x="0" y="0" width="30" height="30"></rect>
|
6 |
-
</defs>
|
7 |
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8 |
-
<g id="Product-page---example-1" transform="translate(-940.000000, -1014.000000)">
|
9 |
-
<g id="arrow-/-expand" transform="translate(934.500000, 1008.500000)">
|
10 |
-
<mask id="mask-2" fill="white">
|
11 |
-
<use xlink:href="#path-1"></use>
|
12 |
-
</mask>
|
13 |
-
<g id="arrow-/-expand-(Background/Mask)"></g>
|
14 |
-
<path d="M21.25,8.75 L15,8.75 L15,6.25 L23.75,6.25 L23.740468,15.0000006 L21.25,15.0000006 L21.25,8.75 Z M8.75,21.25 L15,21.25 L15,23.75 L6.25,23.75 L6.25953334,14.9999988 L8.75,14.9999988 L8.75,21.25 Z" fill="#000000" mask="url(#mask-2)"></path>
|
15 |
-
</g>
|
16 |
-
</g>
|
17 |
-
</g>
|
18 |
Â
</svg>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<svg width="19px" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
+
<title>arrow / expand</title>
|
4 |
+
<defs>
|
5 |
+
<rect id="path-1" x="0" y="0" width="30" height="30"></rect>
|
6 |
+
</defs>
|
7 |
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8 |
+
<g id="Product-page---example-1" transform="translate(-940.000000, -1014.000000)">
|
9 |
+
<g id="arrow-/-expand" transform="translate(934.500000, 1008.500000)">
|
10 |
+
<mask id="mask-2" fill="white">
|
11 |
+
<use xlink:href="#path-1"></use>
|
12 |
+
</mask>
|
13 |
+
<g id="arrow-/-expand-(Background/Mask)"></g>
|
14 |
+
<path d="M21.25,8.75 L15,8.75 L15,6.25 L23.75,6.25 L23.740468,15.0000006 L21.25,15.0000006 L21.25,8.75 Z M8.75,21.25 L15,21.25 L15,23.75 L6.25,23.75 L6.25953334,14.9999988 L8.75,14.9999988 L8.75,21.25 Z" fill="#000000" mask="url(#mask-2)"></path>
|
15 |
+
</g>
|
16 |
+
</g>
|
17 |
+
</g>
|
18 |
Â
</svg>
|
assets/icons/zoom.svg
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
-
<title>edit / search</title>
|
4 |
-
<defs>
|
5 |
-
<rect id="path-1" x="0" y="0" width="30" height="30"></rect>
|
6 |
-
</defs>
|
7 |
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8 |
-
<g id="Product-page---example-1" transform="translate(-990.000000, -1013.000000)">
|
9 |
-
<g id="edit-/-search" transform="translate(986.000000, 1010.000000)">
|
10 |
-
<mask id="mask-2" fill="white">
|
11 |
-
<use xlink:href="#path-1"></use>
|
12 |
-
</mask>
|
13 |
-
<g id="edit-/-search-(Background/Mask)"></g>
|
14 |
-
<path d="M17.9704714,15.5960917 C20.0578816,12.6670864 19.7876957,8.57448101 17.1599138,5.94669908 C14.2309815,3.01776677 9.4822444,3.01776707 6.55331239,5.94669908 C3.62438008,8.87563139 3.62438008,13.6243683 6.55331239,16.5533006 C9.18109432,19.1810825 13.2736993,19.4512688 16.2027049,17.3638582 L23.3470976,24.5082521 L25.1148653,22.7404845 L17.9704714,15.5960917 C19.3620782,13.6434215 19.3620782,13.6434215 17.9704714,15.5960917 Z M15.3921473,7.71446586 C17.3447686,9.6670872 17.3447686,12.8329128 15.3921473,14.7855341 C13.4395258,16.7381556 10.273701,16.7381555 8.32107961,14.7855341 C6.36845812,12.8329127 6.36845812,9.66708735 8.32107961,7.71446586 C10.273701,5.76184452 13.4395258,5.76184437 15.3921473,7.71446586 C16.6938949,9.01621342 16.6938949,9.01621342 15.3921473,7.71446586 Z" fill="#000000" mask="url(#mask-2)"></path>
|
15 |
-
</g>
|
16 |
-
</g>
|
17 |
-
</g>
|
18 |
-
</svg>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
+
<title>edit / search</title>
|
4 |
+
<defs>
|
5 |
+
<rect id="path-1" x="0" y="0" width="30" height="30"></rect>
|
6 |
+
</defs>
|
7 |
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8 |
+
<g id="Product-page---example-1" transform="translate(-990.000000, -1013.000000)">
|
9 |
+
<g id="edit-/-search" transform="translate(986.000000, 1010.000000)">
|
10 |
+
<mask id="mask-2" fill="white">
|
11 |
+
<use xlink:href="#path-1"></use>
|
12 |
+
</mask>
|
13 |
+
<g id="edit-/-search-(Background/Mask)"></g>
|
14 |
+
<path d="M17.9704714,15.5960917 C20.0578816,12.6670864 19.7876957,8.57448101 17.1599138,5.94669908 C14.2309815,3.01776677 9.4822444,3.01776707 6.55331239,5.94669908 C3.62438008,8.87563139 3.62438008,13.6243683 6.55331239,16.5533006 C9.18109432,19.1810825 13.2736993,19.4512688 16.2027049,17.3638582 L23.3470976,24.5082521 L25.1148653,22.7404845 L17.9704714,15.5960917 C19.3620782,13.6434215 19.3620782,13.6434215 17.9704714,15.5960917 Z M15.3921473,7.71446586 C17.3447686,9.6670872 17.3447686,12.8329128 15.3921473,14.7855341 C13.4395258,16.7381556 10.273701,16.7381555 8.32107961,14.7855341 C6.36845812,12.8329127 6.36845812,9.66708735 8.32107961,7.71446586 C10.273701,5.76184452 13.4395258,5.76184437 15.3921473,7.71446586 C16.6938949,9.01621342 16.6938949,9.01621342 15.3921473,7.71446586 Z" fill="#000000" mask="url(#mask-2)"></path>
|
15 |
+
</g>
|
16 |
+
</g>
|
17 |
+
</g>
|
18 |
+
</svg>
|
assets/js/init.prettyPhoto.js
CHANGED
@@ -1,935 +1,935 @@
|
|
1 |
-
/* ------------------------------------------------------------------------
|
2 |
-
Class: prettyPhoto
|
3 |
-
Use: Lightbox clone for jQuery
|
4 |
-
Author: Stephane Caron (http://www.no-margin-for-errors.com)
|
5 |
-
Version: 3.1.6
|
6 |
-
------------------------------------------------------------------------- */
|
7 |
-
(function($) {
|
8 |
-
$.prettyPhoto = {version: '3.1.6'};
|
9 |
-
|
10 |
-
$.fn.prettyPhoto = function(pp_settings) {
|
11 |
-
pp_settings = jQuery.extend({
|
12 |
-
hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
|
13 |
-
animation_speed: 'fast', /* fast/slow/normal */
|
14 |
-
ajaxcallback: function() {},
|
15 |
-
slideshow: 5000, /* false OR interval time in ms */
|
16 |
-
autoplay_slideshow: false, /* true/false */
|
17 |
-
opacity: 0.80, /* Value between 0 and 1 */
|
18 |
-
show_title: true, /* true/false */
|
19 |
-
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
|
20 |
-
allow_expand: true, /* Allow the user to expand a resized image. true/false */
|
21 |
-
default_width: 500,
|
22 |
-
default_height: 344,
|
23 |
-
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
|
24 |
-
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
|
25 |
-
horizontal_padding: 20, /* The padding on each side of the picture */
|
26 |
-
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
|
27 |
-
wmode: 'opaque', /* Set the flash wmode attribute */
|
28 |
-
autoplay: true, /* Automatically start videos: True/False */
|
29 |
-
modal: false, /* If set to true, only the close button will close the window */
|
30 |
-
deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
|
31 |
-
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
|
32 |
-
overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
|
33 |
-
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
|
34 |
-
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
|
35 |
-
callback: function(){}, /* Called when prettyPhoto is closed */
|
36 |
-
ie6_fallback: true,
|
37 |
-
markup: '<div class="pp_pic_holder"> \
|
38 |
-
<div class="ppt"> </div> \
|
39 |
-
<div class="pp_top"> \
|
40 |
-
<div class="pp_left"></div> \
|
41 |
-
<div class="pp_middle"></div> \
|
42 |
-
<div class="pp_right"></div> \
|
43 |
-
</div> \
|
44 |
-
<div class="pp_content_container"> \
|
45 |
-
<div class="pp_left"> \
|
46 |
-
<div class="pp_right"> \
|
47 |
-
<div class="pp_content"> \
|
48 |
-
<div class="pp_loaderIcon"></div> \
|
49 |
-
<div class="pp_fade"> \
|
50 |
-
<a href="#" class="pp_expand" title="Expand the image">\
|
51 |
-
<div class="expand-button-hidden">\
|
52 |
-
\t<svg width="19px" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\
|
53 |
-
\t\t<defs>\
|
54 |
-
\t\t\t<rect id="path-1" x="0" y="0" width="30" height="30"></rect>\
|
55 |
-
\t\t</defs>\
|
56 |
-
\t\t<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\
|
57 |
-
\t\t\t<g id="Product-page---example-1" transform="translate(-940.000000, -1014.000000)">\
|
58 |
-
\t\t\t\t<g id="arrow-/-expand" transform="translate(934.500000, 1008.500000)">\
|
59 |
-
\t\t\t\t\t<mask id="mask-2" fill="white">\
|
60 |
-
\t\t\t\t\t\t<use xlink:href="#path-1"></use>\
|
61 |
-
\t\t\t\t\t</mask>\
|
62 |
-
\t\t\t\t\t<g id="arrow-/-expand-(Background/Mask)"></g>\
|
63 |
-
\t\t\t\t\t<path d="M21.25,8.75 L15,8.75 L15,6.25 L23.75,6.25 L23.740468,15.0000006 L21.25,15.0000006 L21.25,8.75 Z M8.75,21.25 L15,21.25 L15,23.75 L6.25,23.75 L6.25953334,14.9999988 L8.75,14.9999988 L8.75,21.25 Z" fill="#000000" mask="url(#mask-2)"></path>\
|
64 |
-
\t\t\t\t</g>\
|
65 |
-
\t\t\t</g>\
|
66 |
-
\t\t</g>\
|
67 |
-
\t</svg>\
|
68 |
-
\t</div></a> \
|
69 |
-
<div class="pp_hoverContainer"> \
|
70 |
-
<a class="pp_next" href="#">next</a> \
|
71 |
-
<a class="pp_previous" href="#">previous</a> \
|
72 |
-
</div> \
|
73 |
-
<div id="pp_full_res"></div> \
|
74 |
-
<div class="pp_details"> \
|
75 |
-
<div class="pp_nav"> \
|
76 |
-
<a href="#" class="pp_arrow_previous">Previous</a> \
|
77 |
-
<p class="currentTextHolder">0/0</p> \
|
78 |
-
<a href="#" class="pp_arrow_next">Next</a> \
|
79 |
-
</div> \
|
80 |
-
<p class="pp_description"></p> \
|
81 |
-
<div class="pp_social">{pp_social}</div> \
|
82 |
-
<a class="pp_close" href="#">Close</a> \
|
83 |
-
</div> \
|
84 |
-
</div> \
|
85 |
-
</div> \
|
86 |
-
</div> \
|
87 |
-
</div> \
|
88 |
-
</div> \
|
89 |
-
<div class="pp_bottom"> \
|
90 |
-
<div class="pp_left"></div> \
|
91 |
-
<div class="pp_middle"></div> \
|
92 |
-
<div class="pp_right"></div> \
|
93 |
-
</div> \
|
94 |
-
</div> \
|
95 |
-
<div class="pp_overlay"></div>',
|
96 |
-
gallery_markup: '<div class="pp_gallery"> \
|
97 |
-
<a href="#" class="pp_arrow_previous">Previous</a> \
|
98 |
-
<div> \
|
99 |
-
<ul> \
|
100 |
-
{gallery} \
|
101 |
-
</ul> \
|
102 |
-
</div> \
|
103 |
-
<a href="#" class="pp_arrow_next">Next</a> \
|
104 |
-
</div>',
|
105 |
-
image_markup: '<img id="fullResImage" src="{path}" />',
|
106 |
-
flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
|
107 |
-
quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="https://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="https://www.apple.com/quicktime/download/"></embed></object>',
|
108 |
-
iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
|
109 |
-
inline_markup: '<div class="pp_inline">{content}</div>',
|
110 |
-
custom_markup: '',
|
111 |
-
social_tools: '<div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
|
112 |
-
}, pp_settings);
|
113 |
-
|
114 |
-
// Global variables accessible only by prettyPhoto
|
115 |
-
var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
|
116 |
-
|
117 |
-
// prettyPhoto container specific
|
118 |
-
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
|
119 |
-
|
120 |
-
// Window size
|
121 |
-
windowHeight = $(window).height(), windowWidth = $(window).width(),
|
122 |
-
|
123 |
-
// Global elements
|
124 |
-
pp_slideshow;
|
125 |
-
|
126 |
-
doresize = true, scroll_pos = _get_scroll();
|
127 |
-
|
128 |
-
// Window/Keyboard events
|
129 |
-
$(window).off('resize.prettyphoto').on('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
|
130 |
-
|
131 |
-
|
132 |
-
if(pp_settings.keyboard_shortcuts) {
|
133 |
-
$(document).off('keydown.prettyphoto').on('keydown.prettyphoto',function(e){
|
134 |
-
if(typeof $pp_pic_holder != 'undefined'){
|
135 |
-
if($pp_pic_holder.is(':visible')){
|
136 |
-
switch(e.keyCode){
|
137 |
-
case 37:
|
138 |
-
$.prettyPhoto.changePage('previous');
|
139 |
-
e.preventDefault();
|
140 |
-
break;
|
141 |
-
case 39:
|
142 |
-
$.prettyPhoto.changePage('next');
|
143 |
-
e.preventDefault();
|
144 |
-
break;
|
145 |
-
case 27:
|
146 |
-
if(!settings.modal)
|
147 |
-
$.prettyPhoto.close();
|
148 |
-
e.preventDefault();
|
149 |
-
break;
|
150 |
-
};
|
151 |
-
// return false;
|
152 |
-
};
|
153 |
-
};
|
154 |
-
});
|
155 |
-
};
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Initialize prettyPhoto.
|
159 |
-
*/
|
160 |
-
$.prettyPhoto.initialize = function() {
|
161 |
-
|
162 |
-
settings = pp_settings;
|
163 |
-
|
164 |
-
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
|
165 |
-
|
166 |
-
// Find out if the picture is part of a set
|
167 |
-
theRel = $(this).attr(settings.hook);
|
168 |
-
galleryRegExp = /\[(?:.*)\]/;
|
169 |
-
isSet = (galleryRegExp.exec(theRel)) ? true : false;
|
170 |
-
|
171 |
-
// Put the SRCs, TITLEs, ALTs into an array.
|
172 |
-
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
|
173 |
-
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
|
174 |
-
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
|
175 |
-
|
176 |
-
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
|
177 |
-
|
178 |
-
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
|
179 |
-
rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
|
180 |
-
|
181 |
-
_build_overlay(this); // Build the overlay {this} being the caller
|
182 |
-
|
183 |
-
if(settings.allow_resize)
|
184 |
-
$(window).on('scroll.prettyphoto',function(){ _center_overlay(); });
|
185 |
-
|
186 |
-
|
187 |
-
$.prettyPhoto.open();
|
188 |
-
|
189 |
-
|
190 |
-
return false;
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Opens the prettyPhoto modal box.
|
196 |
-
* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
|
197 |
-
* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
|
198 |
-
* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
|
199 |
-
*/
|
200 |
-
$.prettyPhoto.open = function(event) {
|
201 |
-
if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
|
202 |
-
settings = pp_settings;
|
203 |
-
pp_images = $.makeArray(arguments[0]);
|
204 |
-
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
|
205 |
-
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
|
206 |
-
isSet = (pp_images.length > 1) ? true : false;
|
207 |
-
set_position = (arguments[3])? arguments[3]: 0;
|
208 |
-
_build_overlay(event.target); // Build the overlay {this} being the caller
|
209 |
-
}
|
210 |
-
|
211 |
-
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
|
212 |
-
|
213 |
-
_checkPosition($(pp_images).length); // Hide the next/previous links if on first or last images.
|
214 |
-
|
215 |
-
$('.pp_loaderIcon').show();
|
216 |
-
|
217 |
-
if(settings.deeplinking)
|
218 |
-
setHashtag();
|
219 |
-
|
220 |
-
// Rebuild Facebook Like Button with updated href
|
221 |
-
if(settings.social_tools){
|
222 |
-
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
|
223 |
-
$pp_pic_holder.find('.pp_social').html(facebook_like_link);
|
224 |
-
}
|
225 |
-
|
226 |
-
// Fade the content in
|
227 |
-
if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
|
228 |
-
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
|
229 |
-
|
230 |
-
// Display the current position
|
231 |
-
$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).length);
|
232 |
-
|
233 |
-
// Set the description
|
234 |
-
if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
|
235 |
-
$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
|
236 |
-
}else{
|
237 |
-
$pp_pic_holder.find('.pp_description').hide();
|
238 |
-
}
|
239 |
-
|
240 |
-
// Get the dimensions
|
241 |
-
movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
|
242 |
-
movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
|
243 |
-
|
244 |
-
// If the size is % based, calculate according to window dimensions
|
245 |
-
percentBased=false;
|
246 |
-
if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
|
247 |
-
if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
|
248 |
-
|
249 |
-
// Fade the holder
|
250 |
-
$pp_pic_holder.fadeIn(function(){
|
251 |
-
// Set the title
|
252 |
-
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' ');
|
253 |
-
|
254 |
-
imgPreloader = "";
|
255 |
-
skipInjection = false;
|
256 |
-
|
257 |
-
// Inject the proper content
|
258 |
-
switch(_getFileType(pp_images[set_position])){
|
259 |
-
case 'image':
|
260 |
-
imgPreloader = new Image();
|
261 |
-
|
262 |
-
// Preload the neighbour images
|
263 |
-
nextImage = new Image();
|
264 |
-
if(isSet && set_position < $(pp_images).length -1) nextImage.src = pp_images[set_position + 1];
|
265 |
-
prevImage = new Image();
|
266 |
-
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
|
267 |
-
|
268 |
-
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
|
269 |
-
|
270 |
-
imgPreloader.onload = function(){
|
271 |
-
// Fit item to viewport
|
272 |
-
pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
|
273 |
-
|
274 |
-
_showContent();
|
275 |
-
};
|
276 |
-
|
277 |
-
imgPreloader.onerror = function(){
|
278 |
-
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
|
279 |
-
$.prettyPhoto.close();
|
280 |
-
};
|
281 |
-
|
282 |
-
imgPreloader.src = pp_images[set_position];
|
283 |
-
break;
|
284 |
-
|
285 |
-
case 'youtube':
|
286 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
287 |
-
|
288 |
-
// Regular youtube link
|
289 |
-
movie_id = getParam('v',pp_images[set_position]);
|
290 |
-
|
291 |
-
// youtu.be link
|
292 |
-
if(movie_id == ""){
|
293 |
-
movie_id = pp_images[set_position].split('youtu.be/');
|
294 |
-
movie_id = movie_id[1];
|
295 |
-
if(movie_id.indexOf('?') > 0)
|
296 |
-
movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
|
297 |
-
|
298 |
-
if(movie_id.indexOf('&') > 0)
|
299 |
-
movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
|
300 |
-
}
|
301 |
-
|
302 |
-
movie = '//www.youtube.com/embed/'+movie_id;
|
303 |
-
(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
|
304 |
-
|
305 |
-
if(settings.autoplay) movie += "&autoplay=1";
|
306 |
-
|
307 |
-
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
|
308 |
-
break;
|
309 |
-
|
310 |
-
case 'vimeo':
|
311 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
312 |
-
|
313 |
-
movie_id = pp_images[set_position];
|
314 |
-
var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
|
315 |
-
var match = movie_id.match(regExp);
|
316 |
-
|
317 |
-
movie = '//player.vimeo.com/video/'+ match[3] +'?title=0&byline=0&portrait=0';
|
318 |
-
if(settings.autoplay) movie += "&autoplay=1;";
|
319 |
-
|
320 |
-
vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
|
321 |
-
|
322 |
-
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
|
323 |
-
break;
|
324 |
-
|
325 |
-
case 'quicktime':
|
326 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
327 |
-
pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
|
328 |
-
|
329 |
-
toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
|
330 |
-
break;
|
331 |
-
|
332 |
-
case 'flash':
|
333 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
334 |
-
|
335 |
-
flash_vars = pp_images[set_position];
|
336 |
-
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
|
337 |
-
|
338 |
-
filename = pp_images[set_position];
|
339 |
-
filename = filename.substring(0,filename.indexOf('?'));
|
340 |
-
|
341 |
-
toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
|
342 |
-
break;
|
343 |
-
|
344 |
-
case 'iframe':
|
345 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
346 |
-
|
347 |
-
frame_url = pp_images[set_position];
|
348 |
-
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
|
349 |
-
|
350 |
-
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
|
351 |
-
break;
|
352 |
-
|
353 |
-
case 'ajax':
|
354 |
-
doresize = false; // Make sure the dimensions are not resized.
|
355 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height);
|
356 |
-
doresize = true; // Reset the dimensions
|
357 |
-
|
358 |
-
skipInjection = true;
|
359 |
-
$.get(pp_images[set_position],function(responseHTML){
|
360 |
-
toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
|
361 |
-
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
362 |
-
_showContent();
|
363 |
-
});
|
364 |
-
|
365 |
-
break;
|
366 |
-
|
367 |
-
case 'custom':
|
368 |
-
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
369 |
-
|
370 |
-
toInject = settings.custom_markup;
|
371 |
-
break;
|
372 |
-
|
373 |
-
case 'inline':
|
374 |
-
// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
|
375 |
-
myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
|
376 |
-
doresize = false; // Make sure the dimensions are not resized.
|
377 |
-
pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
|
378 |
-
doresize = true; // Reset the dimensions
|
379 |
-
$(myClone).remove();
|
380 |
-
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
|
381 |
-
break;
|
382 |
-
};
|
383 |
-
|
384 |
-
if(!imgPreloader && !skipInjection){
|
385 |
-
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
386 |
-
|
387 |
-
// Show content
|
388 |
-
_showContent();
|
389 |
-
|
390 |
-
|
391 |
-
};
|
392 |
-
});
|
393 |
-
|
394 |
-
return false;
|
395 |
-
};
|
396 |
-
|
397 |
-
|
398 |
-
/**
|
399 |
-
* Change page in the prettyPhoto modal box
|
400 |
-
* @param direction {String} Direction of the paging, previous or next.
|
401 |
-
*/
|
402 |
-
$.prettyPhoto.changePage = function(direction){
|
403 |
-
currentGalleryPage = 0;
|
404 |
-
|
405 |
-
if(direction == 'previous') {
|
406 |
-
set_position--;
|
407 |
-
if (set_position < 0) set_position = $(pp_images).length-1;
|
408 |
-
}else if(direction == 'next'){
|
409 |
-
set_position++;
|
410 |
-
if(set_position > $(pp_images).length-1) set_position = 0;
|
411 |
-
}else{
|
412 |
-
set_position=direction;
|
413 |
-
};
|
414 |
-
|
415 |
-
rel_index = set_position;
|
416 |
-
|
417 |
-
if(!doresize) doresize = true; // Allow the resizing of the images
|
418 |
-
if(settings.allow_expand) {
|
419 |
-
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
|
420 |
-
}
|
421 |
-
|
422 |
-
_hideContent(function(){ $.prettyPhoto.open(); });
|
423 |
-
};
|
424 |
-
|
425 |
-
|
426 |
-
/**
|
427 |
-
* Change gallery page in the prettyPhoto modal box
|
428 |
-
* @param direction {String} Direction of the paging, previous or next.
|
429 |
-
*/
|
430 |
-
$.prettyPhoto.changeGalleryPage = function(direction){
|
431 |
-
if(direction=='next'){
|
432 |
-
currentGalleryPage ++;
|
433 |
-
|
434 |
-
if(currentGalleryPage > totalPage) currentGalleryPage = 0;
|
435 |
-
}else if(direction=='previous'){
|
436 |
-
currentGalleryPage --;
|
437 |
-
|
438 |
-
if(currentGalleryPage < 0) currentGalleryPage = totalPage;
|
439 |
-
}else{
|
440 |
-
currentGalleryPage = direction;
|
441 |
-
};
|
442 |
-
|
443 |
-
slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
|
444 |
-
|
445 |
-
slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
|
446 |
-
|
447 |
-
$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
|
448 |
-
};
|
449 |
-
|
450 |
-
|
451 |
-
/**
|
452 |
-
* Start the slideshow...
|
453 |
-
*/
|
454 |
-
$.prettyPhoto.startSlideshow = function(){
|
455 |
-
if(typeof pp_slideshow == 'undefined'){
|
456 |
-
$pp_pic_holder.find('.pp_play').off('click').removeClass('pp_play').addClass('pp_pause').on( 'click', function(){
|
457 |
-
$.prettyPhoto.stopSlideshow();
|
458 |
-
return false;
|
459 |
-
});
|
460 |
-
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
|
461 |
-
}else{
|
462 |
-
$.prettyPhoto.changePage('next');
|
463 |
-
};
|
464 |
-
}
|
465 |
-
|
466 |
-
|
467 |
-
/**
|
468 |
-
* Stop the slideshow...
|
469 |
-
*/
|
470 |
-
$.prettyPhoto.stopSlideshow = function(){
|
471 |
-
$pp_pic_holder.find('.pp_pause').off('click').removeClass('pp_pause').addClass('pp_play').on( 'click', function(){
|
472 |
-
$.prettyPhoto.startSlideshow();
|
473 |
-
return false;
|
474 |
-
});
|
475 |
-
clearInterval(pp_slideshow);
|
476 |
-
pp_slideshow=undefined;
|
477 |
-
}
|
478 |
-
|
479 |
-
|
480 |
-
/**
|
481 |
-
* Closes prettyPhoto.
|
482 |
-
*/
|
483 |
-
$.prettyPhoto.close = function(){
|
484 |
-
if($pp_overlay.is(":animated")) return;
|
485 |
-
|
486 |
-
$.prettyPhoto.stopSlideshow();
|
487 |
-
|
488 |
-
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
|
489 |
-
|
490 |
-
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
|
491 |
-
|
492 |
-
$pp_overlay.fadeOut(settings.animation_speed, function(){
|
493 |
-
|
494 |
-
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
|
495 |
-
|
496 |
-
$(this).remove(); // No more need for the prettyPhoto markup
|
497 |
-
|
498 |
-
$(window).off('scroll.prettyphoto');
|
499 |
-
|
500 |
-
clearHashtag();
|
501 |
-
|
502 |
-
settings.callback();
|
503 |
-
|
504 |
-
doresize = true;
|
505 |
-
|
506 |
-
pp_open = false;
|
507 |
-
|
508 |
-
delete settings;
|
509 |
-
});
|
510 |
-
};
|
511 |
-
|
512 |
-
/**
|
513 |
-
* Set the proper sizes on the containers and animate the content in.
|
514 |
-
*/
|
515 |
-
function _showContent(){
|
516 |
-
$('.pp_loaderIcon').hide();
|
517 |
-
|
518 |
-
// Calculate the opened top position of the pic holder
|
519 |
-
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
|
520 |
-
if(projectedTop < 0) projectedTop = 0;
|
521 |
-
|
522 |
-
$ppt.fadeTo(settings.animation_speed,1);
|
523 |
-
|
524 |
-
// Resize the content holder
|
525 |
-
$pp_pic_holder.find('.pp_content')
|
526 |
-
.animate({
|
527 |
-
height:pp_dimensions['contentHeight'],
|
528 |
-
width:pp_dimensions['contentWidth']
|
529 |
-
},settings.animation_speed);
|
530 |
-
|
531 |
-
// Resize picture the holder
|
532 |
-
$pp_pic_holder.animate({
|
533 |
-
'top': projectedTop,
|
534 |
-
'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
|
535 |
-
width:pp_dimensions['containerWidth']
|
536 |
-
},settings.animation_speed,function(){
|
537 |
-
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
|
538 |
-
|
539 |
-
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
|
540 |
-
|
541 |
-
// Show the nav
|
542 |
-
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
|
543 |
-
|
544 |
-
if(settings.allow_expand) {
|
545 |
-
if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
|
546 |
-
$('a.pp_expand,a.pp_contract').show();
|
547 |
-
}else{
|
548 |
-
$('a.pp_expand').hide();
|
549 |
-
}
|
550 |
-
}
|
551 |
-
|
552 |
-
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
|
553 |
-
|
554 |
-
settings.changepicturecallback(); // Callback!
|
555 |
-
|
556 |
-
pp_open = true;
|
557 |
-
});
|
558 |
-
|
559 |
-
_insert_gallery();
|
560 |
-
pp_settings.ajaxcallback();
|
561 |
-
|
562 |
-
};
|
563 |
-
|
564 |
-
/**
|
565 |
-
* Hide the content...DUH!
|
566 |
-
*/
|
567 |
-
function _hideContent(callback){
|
568 |
-
// Fade out the current picture
|
569 |
-
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
|
570 |
-
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
|
571 |
-
$('.pp_loaderIcon').show();
|
572 |
-
|
573 |
-
callback();
|
574 |
-
});
|
575 |
-
};
|
576 |
-
|
577 |
-
/**
|
578 |
-
* Check the item position in the gallery array, hide or show the navigation links
|
579 |
-
* @param setCount {integer} The total number of items in the set
|
580 |
-
*/
|
581 |
-
function _checkPosition(setCount){
|
582 |
-
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
|
583 |
-
};
|
584 |
-
|
585 |
-
/**
|
586 |
-
* Resize the item dimensions if it's bigger than the viewport
|
587 |
-
* @param width {integer} Width of the item to be opened
|
588 |
-
* @param height {integer} Height of the item to be opened
|
589 |
-
* @return An array containin the "fitted" dimensions
|
590 |
-
*/
|
591 |
-
function _fitToViewport(width,height){
|
592 |
-
resized = false;
|
593 |
-
|
594 |
-
_getDimensions(width,height);
|
595 |
-
|
596 |
-
// Define them in case there's no resize needed
|
597 |
-
imageWidth = width, imageHeight = height;
|
598 |
-
|
599 |
-
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
|
600 |
-
resized = true, fitting = false;
|
601 |
-
|
602 |
-
while (!fitting){
|
603 |
-
if((pp_containerWidth > windowWidth)){
|
604 |
-
imageWidth = (windowWidth - 200);
|
605 |
-
imageHeight = (height/width) * imageWidth;
|
606 |
-
}else if((pp_containerHeight > windowHeight)){
|
607 |
-
imageHeight = (windowHeight - 200);
|
608 |
-
imageWidth = (width/height) * imageHeight;
|
609 |
-
}else{
|
610 |
-
fitting = true;
|
611 |
-
};
|
612 |
-
|
613 |
-
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
|
614 |
-
};
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
|
619 |
-
_fitToViewport(pp_containerWidth,pp_containerHeight)
|
620 |
-
};
|
621 |
-
|
622 |
-
_getDimensions(imageWidth,imageHeight);
|
623 |
-
};
|
624 |
-
|
625 |
-
return {
|
626 |
-
width:Math.floor(imageWidth),
|
627 |
-
height:Math.floor(imageHeight),
|
628 |
-
containerHeight:Math.floor(pp_containerHeight),
|
629 |
-
containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
|
630 |
-
contentHeight:Math.floor(pp_contentHeight),
|
631 |
-
contentWidth:Math.floor(pp_contentWidth),
|
632 |
-
resized:resized
|
633 |
-
};
|
634 |
-
};
|
635 |
-
|
636 |
-
/**
|
637 |
-
* Get the containers dimensions according to the item size
|
638 |
-
* @param width {integer} Width of the item to be opened
|
639 |
-
* @param height {integer} Height of the item to be opened
|
640 |
-
*/
|
641 |
-
function _getDimensions(width,height){
|
642 |
-
width = parseFloat(width);
|
643 |
-
height = parseFloat(height);
|
644 |
-
|
645 |
-
// Get the details height, to do so, I need to clone it since it's invisible
|
646 |
-
$pp_details = $pp_pic_holder.find('.pp_details');
|
647 |
-
$pp_details.width(width);
|
648 |
-
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
|
649 |
-
|
650 |
-
$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
|
651 |
-
'position':'absolute',
|
652 |
-
'top':-10000
|
653 |
-
});
|
654 |
-
detailsHeight += $pp_details.height();
|
655 |
-
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
|
656 |
-
$pp_details.remove();
|
657 |
-
|
658 |
-
// Get the titles height, to do so, I need to clone it since it's invisible
|
659 |
-
$pp_title = $pp_pic_holder.find('.ppt');
|
660 |
-
$pp_title.width(width);
|
661 |
-
titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
|
662 |
-
$pp_title = $pp_title.clone().appendTo($('body')).css({
|
663 |
-
'position':'absolute',
|
664 |
-
'top':-10000
|
665 |
-
});
|
666 |
-
titleHeight += $pp_title.height();
|
667 |
-
$pp_title.remove();
|
668 |
-
|
669 |
-
// Get the container size, to resize the holder to the right dimensions
|
670 |
-
pp_contentHeight = height + detailsHeight;
|
671 |
-
pp_contentWidth = width;
|
672 |
-
pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
|
673 |
-
pp_containerWidth = width;
|
674 |
-
}
|
675 |
-
|
676 |
-
function _getFileType(itemSrc){
|
677 |
-
if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
|
678 |
-
return 'youtube';
|
679 |
-
}else if (itemSrc.match(/vimeo\.com/i)) {
|
680 |
-
return 'vimeo';
|
681 |
-
}else if(itemSrc.match(/\b.mov\b/i)){
|
682 |
-
return 'quicktime';
|
683 |
-
}else if(itemSrc.match(/\b.swf\b/i)){
|
684 |
-
return 'flash';
|
685 |
-
}else if(itemSrc.match(/\biframe=true\b/i)){
|
686 |
-
return 'iframe';
|
687 |
-
}else if(itemSrc.match(/\bajax=true\b/i)){
|
688 |
-
return 'ajax';
|
689 |
-
}else if(itemSrc.match(/\bcustom=true\b/i)){
|
690 |
-
return 'custom';
|
691 |
-
}else if(itemSrc.substr(0,1) == '#'){
|
692 |
-
return 'inline';
|
693 |
-
}else{
|
694 |
-
return 'image';
|
695 |
-
};
|
696 |
-
};
|
697 |
-
|
698 |
-
function _center_overlay(){
|
699 |
-
if(doresize && typeof $pp_pic_holder != 'undefined') {
|
700 |
-
scroll_pos = _get_scroll();
|
701 |
-
contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
|
702 |
-
|
703 |
-
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
|
704 |
-
if(projectedTop < 0) projectedTop = 0;
|
705 |
-
|
706 |
-
if(contentHeight > windowHeight)
|
707 |
-
return;
|
708 |
-
|
709 |
-
$pp_pic_holder.css({
|
710 |
-
'top': projectedTop,
|
711 |
-
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
|
712 |
-
});
|
713 |
-
};
|
714 |
-
};
|
715 |
-
|
716 |
-
function _get_scroll(){
|
717 |
-
if (self.pageYOffset) {
|
718 |
-
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
|
719 |
-
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
|
720 |
-
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
|
721 |
-
} else if (document.body) {// all other Explorers
|
722 |
-
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
|
723 |
-
};
|
724 |
-
};
|
725 |
-
|
726 |
-
function _resize_overlay() {
|
727 |
-
windowHeight = $(window).height(), windowWidth = $(window).width();
|
728 |
-
|
729 |
-
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
|
730 |
-
};
|
731 |
-
|
732 |
-
function _insert_gallery(){
|
733 |
-
if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
|
734 |
-
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
735 |
-
navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
|
736 |
-
|
737 |
-
itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
|
738 |
-
itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
|
739 |
-
totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
|
740 |
-
|
741 |
-
// Hide the nav in the case there's no need for links
|
742 |
-
if(totalPage == 0){
|
743 |
-
navWidth = 0; // No nav means no width!
|
744 |
-
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
|
745 |
-
}else{
|
746 |
-
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
|
747 |
-
};
|
748 |
-
|
749 |
-
galleryWidth = itemsPerPage * itemWidth;
|
750 |
-
fullGalleryWidth = pp_images.length * itemWidth;
|
751 |
-
|
752 |
-
// Set the proper width to the gallery items
|
753 |
-
$pp_gallery
|
754 |
-
.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
|
755 |
-
.find('div:first').width(galleryWidth+5)
|
756 |
-
.find('ul').width(fullGalleryWidth)
|
757 |
-
.find('li.selected').removeClass('selected');
|
758 |
-
|
759 |
-
goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
|
760 |
-
|
761 |
-
$.prettyPhoto.changeGalleryPage(goToPage);
|
762 |
-
|
763 |
-
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
|
764 |
-
}else{
|
765 |
-
$pp_pic_holder.find('.pp_content').off('mouseenter mouseleave');
|
766 |
-
// $pp_gallery.hide();
|
767 |
-
}
|
768 |
-
}
|
769 |
-
|
770 |
-
function _build_overlay(caller){
|
771 |
-
// Inject Social Tool markup into General markup
|
772 |
-
if(settings.social_tools)
|
773 |
-
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
|
774 |
-
|
775 |
-
settings.markup = settings.markup.replace('{pp_social}','');
|
776 |
-
|
777 |
-
$('body').append(settings.markup); // Inject the markup
|
778 |
-
|
779 |
-
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
|
780 |
-
|
781 |
-
// Inject the inline gallery!
|
782 |
-
if(isSet && settings.overlay_gallery) {
|
783 |
-
currentGalleryPage = 0;
|
784 |
-
toInject = "";
|
785 |
-
for (var i=0; i < pp_images.length; i++) {
|
786 |
-
if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
|
787 |
-
classname = 'default';
|
788 |
-
img_src = '';
|
789 |
-
}else{
|
790 |
-
classname = '';
|
791 |
-
img_src = pp_images[i];
|
792 |
-
}
|
793 |
-
toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
|
794 |
-
};
|
795 |
-
|
796 |
-
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
|
797 |
-
|
798 |
-
$pp_pic_holder.find('#pp_full_res').after(toInject);
|
799 |
-
|
800 |
-
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
|
801 |
-
|
802 |
-
$pp_gallery.find('.pp_arrow_next').on( 'click', function(){
|
803 |
-
$.prettyPhoto.changeGalleryPage('next');
|
804 |
-
$.prettyPhoto.stopSlideshow();
|
805 |
-
return false;
|
806 |
-
});
|
807 |
-
|
808 |
-
$pp_gallery.find('.pp_arrow_previous').on( 'click', function(){
|
809 |
-
$.prettyPhoto.changeGalleryPage('previous');
|
810 |
-
$.prettyPhoto.stopSlideshow();
|
811 |
-
return false;
|
812 |
-
});
|
813 |
-
|
814 |
-
$pp_pic_holder.find('.pp_content').on( 'mouseenter',
|
815 |
-
function(){
|
816 |
-
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
|
817 |
-
} ).on( 'mouseleave',
|
818 |
-
function(){
|
819 |
-
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
|
820 |
-
});
|
821 |
-
|
822 |
-
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
823 |
-
$pp_gallery_li.each(function(i){
|
824 |
-
$(this)
|
825 |
-
.find('a')
|
826 |
-
.on( 'click', function(){
|
827 |
-
$.prettyPhoto.changePage(i);
|
828 |
-
$.prettyPhoto.stopSlideshow();
|
829 |
-
return false;
|
830 |
-
});
|
831 |
-
});
|
832 |
-
};
|
833 |
-
|
834 |
-
|
835 |
-
// Inject the play/pause if it's a slideshow
|
836 |
-
if(settings.slideshow){
|
837 |
-
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
|
838 |
-
$pp_pic_holder.find('.pp_nav .pp_play').on( 'click', function(){
|
839 |
-
$.prettyPhoto.startSlideshow();
|
840 |
-
return false;
|
841 |
-
});
|
842 |
-
}
|
843 |
-
|
844 |
-
$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
|
845 |
-
|
846 |
-
$pp_overlay
|
847 |
-
.css({
|
848 |
-
'opacity':0,
|
849 |
-
'height':$(document).height(),
|
850 |
-
'width':$(window).width()
|
851 |
-
})
|
852 |
-
.on('click',function(){
|
853 |
-
if(!settings.modal) $.prettyPhoto.close();
|
854 |
-
});
|
855 |
-
|
856 |
-
$('a.pp_close').on('click',function(){ $.prettyPhoto.close(); return false; });
|
857 |
-
|
858 |
-
|
859 |
-
if(settings.allow_expand) {
|
860 |
-
$('a.pp_expand').on('click',function(e){
|
861 |
-
// Expand the image
|
862 |
-
if($(this).hasClass('pp_expand')){
|
863 |
-
$(this).removeClass('pp_expand').addClass('pp_contract');
|
864 |
-
doresize = false;
|
865 |
-
}else{
|
866 |
-
$(this).removeClass('pp_contract').addClass('pp_expand');
|
867 |
-
doresize = true;
|
868 |
-
};
|
869 |
-
|
870 |
-
_hideContent(function(){ $.prettyPhoto.open(); });
|
871 |
-
|
872 |
-
return false;
|
873 |
-
});
|
874 |
-
}
|
875 |
-
|
876 |
-
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').on('click',function(){
|
877 |
-
$.prettyPhoto.changePage('previous');
|
878 |
-
$.prettyPhoto.stopSlideshow();
|
879 |
-
return false;
|
880 |
-
});
|
881 |
-
|
882 |
-
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').on('click',function(){
|
883 |
-
$.prettyPhoto.changePage('next');
|
884 |
-
$.prettyPhoto.stopSlideshow();
|
885 |
-
return false;
|
886 |
-
});
|
887 |
-
|
888 |
-
_center_overlay(); // Center it
|
889 |
-
};
|
890 |
-
|
891 |
-
if(!pp_alreadyInitialized && getHashtag()){
|
892 |
-
pp_alreadyInitialized = true;
|
893 |
-
|
894 |
-
// Grab the rel index to trigger the click on the correct element
|
895 |
-
hashIndex = getHashtag();
|
896 |
-
hashRel = hashIndex;
|
897 |
-
hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
|
898 |
-
hashRel = hashRel.substring(0,hashRel.indexOf('/'));
|
899 |
-
|
900 |
-
// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
|
901 |
-
// Useful in the event the page contain several init scripts.
|
902 |
-
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
|
903 |
-
}
|
904 |
-
|
905 |
-
return this.off('click.prettyphoto').on('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
|
906 |
-
};
|
907 |
-
|
908 |
-
function getHashtag(){
|
909 |
-
var url = location.href;
|
910 |
-
hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
|
911 |
-
if(hashtag){ hashtag = hashtag.replace(/<|>/g,''); }
|
912 |
-
return hashtag;
|
913 |
-
};
|
914 |
-
|
915 |
-
function setHashtag(){
|
916 |
-
if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
|
917 |
-
location.hash = theRel + '/'+rel_index+'/';
|
918 |
-
};
|
919 |
-
|
920 |
-
function clearHashtag(){
|
921 |
-
if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
|
922 |
-
}
|
923 |
-
|
924 |
-
function getParam(name,url){
|
925 |
-
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
926 |
-
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
927 |
-
var regex = new RegExp( regexS );
|
928 |
-
var results = regex.exec( url );
|
929 |
-
return ( results == null ) ? "" : results[1];
|
930 |
-
}
|
931 |
-
|
932 |
-
|
933 |
-
})(jQuery);
|
934 |
-
|
935 |
-
var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.
|
1 |
+
/* ------------------------------------------------------------------------
|
2 |
+
Class: prettyPhoto
|
3 |
+
Use: Lightbox clone for jQuery
|
4 |
+
Author: Stephane Caron (http://www.no-margin-for-errors.com)
|
5 |
+
Version: 3.1.6
|
6 |
+
------------------------------------------------------------------------- */
|
7 |
+
(function($) {
|
8 |
+
$.prettyPhoto = {version: '3.1.6'};
|
9 |
+
|
10 |
+
$.fn.prettyPhoto = function(pp_settings) {
|
11 |
+
pp_settings = jQuery.extend({
|
12 |
+
hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
|
13 |
+
animation_speed: 'fast', /* fast/slow/normal */
|
14 |
+
ajaxcallback: function() {},
|
15 |
+
slideshow: 5000, /* false OR interval time in ms */
|
16 |
+
autoplay_slideshow: false, /* true/false */
|
17 |
+
opacity: 0.80, /* Value between 0 and 1 */
|
18 |
+
show_title: true, /* true/false */
|
19 |
+
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
|
20 |
+
allow_expand: true, /* Allow the user to expand a resized image. true/false */
|
21 |
+
default_width: 500,
|
22 |
+
default_height: 344,
|
23 |
+
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
|
24 |
+
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
|
25 |
+
horizontal_padding: 20, /* The padding on each side of the picture */
|
26 |
+
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
|
27 |
+
wmode: 'opaque', /* Set the flash wmode attribute */
|
28 |
+
autoplay: true, /* Automatically start videos: True/False */
|
29 |
+
modal: false, /* If set to true, only the close button will close the window */
|
30 |
+
deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
|
31 |
+
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
|
32 |
+
overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
|
33 |
+
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
|
34 |
+
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
|
35 |
+
callback: function(){}, /* Called when prettyPhoto is closed */
|
36 |
+
ie6_fallback: true,
|
37 |
+
markup: '<div class="pp_pic_holder"> \
|
38 |
+
<div class="ppt"> </div> \
|
39 |
+
<div class="pp_top"> \
|
40 |
+
<div class="pp_left"></div> \
|
41 |
+
<div class="pp_middle"></div> \
|
42 |
+
<div class="pp_right"></div> \
|
43 |
+
</div> \
|
44 |
+
<div class="pp_content_container"> \
|
45 |
+
<div class="pp_left"> \
|
46 |
+
<div class="pp_right"> \
|
47 |
+
<div class="pp_content"> \
|
48 |
+
<div class="pp_loaderIcon"></div> \
|
49 |
+
<div class="pp_fade"> \
|
50 |
+
<a href="#" class="pp_expand" title="Expand the image">\
|
51 |
+
<div class="expand-button-hidden">\
|
52 |
+
\t<svg width="19px" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\
|
53 |
+
\t\t<defs>\
|
54 |
+
\t\t\t<rect id="path-1" x="0" y="0" width="30" height="30"></rect>\
|
55 |
+
\t\t</defs>\
|
56 |
+
\t\t<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\
|
57 |
+
\t\t\t<g id="Product-page---example-1" transform="translate(-940.000000, -1014.000000)">\
|
58 |
+
\t\t\t\t<g id="arrow-/-expand" transform="translate(934.500000, 1008.500000)">\
|
59 |
+
\t\t\t\t\t<mask id="mask-2" fill="white">\
|
60 |
+
\t\t\t\t\t\t<use xlink:href="#path-1"></use>\
|
61 |
+
\t\t\t\t\t</mask>\
|
62 |
+
\t\t\t\t\t<g id="arrow-/-expand-(Background/Mask)"></g>\
|
63 |
+
\t\t\t\t\t<path d="M21.25,8.75 L15,8.75 L15,6.25 L23.75,6.25 L23.740468,15.0000006 L21.25,15.0000006 L21.25,8.75 Z M8.75,21.25 L15,21.25 L15,23.75 L6.25,23.75 L6.25953334,14.9999988 L8.75,14.9999988 L8.75,21.25 Z" fill="#000000" mask="url(#mask-2)"></path>\
|
64 |
+
\t\t\t\t</g>\
|
65 |
+
\t\t\t</g>\
|
66 |
+
\t\t</g>\
|
67 |
+
\t</svg>\
|
68 |
+
\t</div></a> \
|
69 |
+
<div class="pp_hoverContainer"> \
|
70 |
+
<a class="pp_next" href="#">next</a> \
|
71 |
+
<a class="pp_previous" href="#">previous</a> \
|
72 |
+
</div> \
|
73 |
+
<div id="pp_full_res"></div> \
|
74 |
+
<div class="pp_details"> \
|
75 |
+
<div class="pp_nav"> \
|
76 |
+
<a href="#" class="pp_arrow_previous">Previous</a> \
|
77 |
+
<p class="currentTextHolder">0/0</p> \
|
78 |
+
<a href="#" class="pp_arrow_next">Next</a> \
|
79 |
+
</div> \
|
80 |
+
<p class="pp_description"></p> \
|
81 |
+
<div class="pp_social">{pp_social}</div> \
|
82 |
+
<a class="pp_close" href="#">Close</a> \
|
83 |
+
</div> \
|
84 |
+
</div> \
|
85 |
+
</div> \
|
86 |
+
</div> \
|
87 |
+
</div> \
|
88 |
+
</div> \
|
89 |
+
<div class="pp_bottom"> \
|
90 |
+
<div class="pp_left"></div> \
|
91 |
+
<div class="pp_middle"></div> \
|
92 |
+
<div class="pp_right"></div> \
|
93 |
+
</div> \
|
94 |
+
</div> \
|
95 |
+
<div class="pp_overlay"></div>',
|
96 |
+
gallery_markup: '<div class="pp_gallery"> \
|
97 |
+
<a href="#" class="pp_arrow_previous">Previous</a> \
|
98 |
+
<div> \
|
99 |
+
<ul> \
|
100 |
+
{gallery} \
|
101 |
+
</ul> \
|
102 |
+
</div> \
|
103 |
+
<a href="#" class="pp_arrow_next">Next</a> \
|
104 |
+
</div>',
|
105 |
+
image_markup: '<img id="fullResImage" src="{path}" />',
|
106 |
+
flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
|
107 |
+
quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="https://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="https://www.apple.com/quicktime/download/"></embed></object>',
|
108 |
+
iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
|
109 |
+
inline_markup: '<div class="pp_inline">{content}</div>',
|
110 |
+
custom_markup: '',
|
111 |
+
social_tools: '<div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
|
112 |
+
}, pp_settings);
|
113 |
+
|
114 |
+
// Global variables accessible only by prettyPhoto
|
115 |
+
var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
|
116 |
+
|
117 |
+
// prettyPhoto container specific
|
118 |
+
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
|
119 |
+
|
120 |
+
// Window size
|
121 |
+
windowHeight = $(window).height(), windowWidth = $(window).width(),
|
122 |
+
|
123 |
+
// Global elements
|
124 |
+
pp_slideshow;
|
125 |
+
|
126 |
+
doresize = true, scroll_pos = _get_scroll();
|
127 |
+
|
128 |
+
// Window/Keyboard events
|
129 |
+
$(window).off('resize.prettyphoto').on('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
|
130 |
+
|
131 |
+
|
132 |
+
if(pp_settings.keyboard_shortcuts) {
|
133 |
+
$(document).off('keydown.prettyphoto').on('keydown.prettyphoto',function(e){
|
134 |
+
if(typeof $pp_pic_holder != 'undefined'){
|
135 |
+
if($pp_pic_holder.is(':visible')){
|
136 |
+
switch(e.keyCode){
|
137 |
+
case 37:
|
138 |
+
$.prettyPhoto.changePage('previous');
|
139 |
+
e.preventDefault();
|
140 |
+
break;
|
141 |
+
case 39:
|
142 |
+
$.prettyPhoto.changePage('next');
|
143 |
+
e.preventDefault();
|
144 |
+
break;
|
145 |
+
case 27:
|
146 |
+
if(!settings.modal)
|
147 |
+
$.prettyPhoto.close();
|
148 |
+
e.preventDefault();
|
149 |
+
break;
|
150 |
+
};
|
151 |
+
// return false;
|
152 |
+
};
|
153 |
+
};
|
154 |
+
});
|
155 |
+
};
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Initialize prettyPhoto.
|
159 |
+
*/
|
160 |
+
$.prettyPhoto.initialize = function() {
|
161 |
+
|
162 |
+
settings = pp_settings;
|
163 |
+
|
164 |
+
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
|
165 |
+
|
166 |
+
// Find out if the picture is part of a set
|
167 |
+
theRel = $(this).attr(settings.hook);
|
168 |
+
galleryRegExp = /\[(?:.*)\]/;
|
169 |
+
isSet = (galleryRegExp.exec(theRel)) ? true : false;
|
170 |
+
|
171 |
+
// Put the SRCs, TITLEs, ALTs into an array.
|
172 |
+
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
|
173 |
+
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
|
174 |
+
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
|
175 |
+
|
176 |
+
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
|
177 |
+
|
178 |
+
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
|
179 |
+
rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
|
180 |
+
|
181 |
+
_build_overlay(this); // Build the overlay {this} being the caller
|
182 |
+
|
183 |
+
if(settings.allow_resize)
|
184 |
+
$(window).on('scroll.prettyphoto',function(){ _center_overlay(); });
|
185 |
+
|
186 |
+
|
187 |
+
$.prettyPhoto.open();
|
188 |
+
|
189 |
+
|
190 |
+
return false;
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Opens the prettyPhoto modal box.
|
196 |
+
* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
|
197 |
+
* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
|
198 |
+
* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
|
199 |
+
*/
|
200 |
+
$.prettyPhoto.open = function(event) {
|
201 |
+
if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
|
202 |
+
settings = pp_settings;
|
203 |
+
pp_images = $.makeArray(arguments[0]);
|
204 |
+
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
|
205 |
+
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
|
206 |
+
isSet = (pp_images.length > 1) ? true : false;
|
207 |
+
set_position = (arguments[3])? arguments[3]: 0;
|
208 |
+
_build_overlay(event.target); // Build the overlay {this} being the caller
|
209 |
+
}
|
210 |
+
|
211 |
+
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
|
212 |
+
|
213 |
+
_checkPosition($(pp_images).length); // Hide the next/previous links if on first or last images.
|
214 |
+
|
215 |
+
$('.pp_loaderIcon').show();
|
216 |
+
|
217 |
+
if(settings.deeplinking)
|
218 |
+
setHashtag();
|
219 |
+
|
220 |
+
// Rebuild Facebook Like Button with updated href
|
221 |
+
if(settings.social_tools){
|
222 |
+
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
|
223 |
+
$pp_pic_holder.find('.pp_social').html(facebook_like_link);
|
224 |
+
}
|
225 |
+
|
226 |
+
// Fade the content in
|
227 |
+
if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
|
228 |
+
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
|
229 |
+
|
230 |
+
// Display the current position
|
231 |
+
$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).length);
|
232 |
+
|
233 |
+
// Set the description
|
234 |
+
if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
|
235 |
+
$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
|
236 |
+
}else{
|
237 |
+
$pp_pic_holder.find('.pp_description').hide();
|
238 |
+
}
|
239 |
+
|
240 |
+
// Get the dimensions
|
241 |
+
movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
|
242 |
+
movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
|
243 |
+
|
244 |
+
// If the size is % based, calculate according to window dimensions
|
245 |
+
percentBased=false;
|
246 |
+
if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
|
247 |
+
if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
|
248 |
+
|
249 |
+
// Fade the holder
|
250 |
+
$pp_pic_holder.fadeIn(function(){
|
251 |
+
// Set the title
|
252 |
+
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' ');
|
253 |
+
|
254 |
+
imgPreloader = "";
|
255 |
+
skipInjection = false;
|
256 |
+
|
257 |
+
// Inject the proper content
|
258 |
+
switch(_getFileType(pp_images[set_position])){
|
259 |
+
case 'image':
|
260 |
+
imgPreloader = new Image();
|
261 |
+
|
262 |
+
// Preload the neighbour images
|
263 |
+
nextImage = new Image();
|
264 |
+
if(isSet && set_position < $(pp_images).length -1) nextImage.src = pp_images[set_position + 1];
|
265 |
+
prevImage = new Image();
|
266 |
+
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
|
267 |
+
|
268 |
+
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
|
269 |
+
|
270 |
+
imgPreloader.onload = function(){
|
271 |
+
// Fit item to viewport
|
272 |
+
pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
|
273 |
+
|
274 |
+
_showContent();
|
275 |
+
};
|
276 |
+
|
277 |
+
imgPreloader.onerror = function(){
|
278 |
+
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
|
279 |
+
$.prettyPhoto.close();
|
280 |
+
};
|
281 |
+
|
282 |
+
imgPreloader.src = pp_images[set_position];
|
283 |
+
break;
|
284 |
+
|
285 |
+
case 'youtube':
|
286 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
287 |
+
|
288 |
+
// Regular youtube link
|
289 |
+
movie_id = getParam('v',pp_images[set_position]);
|
290 |
+
|
291 |
+
// youtu.be link
|
292 |
+
if(movie_id == ""){
|
293 |
+
movie_id = pp_images[set_position].split('youtu.be/');
|
294 |
+
movie_id = movie_id[1];
|
295 |
+
if(movie_id.indexOf('?') > 0)
|
296 |
+
movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
|
297 |
+
|
298 |
+
if(movie_id.indexOf('&') > 0)
|
299 |
+
movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
|
300 |
+
}
|
301 |
+
|
302 |
+
movie = '//www.youtube.com/embed/'+movie_id;
|
303 |
+
(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
|
304 |
+
|
305 |
+
if(settings.autoplay) movie += "&autoplay=1";
|
306 |
+
|
307 |
+
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
|
308 |
+
break;
|
309 |
+
|
310 |
+
case 'vimeo':
|
311 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
312 |
+
|
313 |
+
movie_id = pp_images[set_position];
|
314 |
+
var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
|
315 |
+
var match = movie_id.match(regExp);
|
316 |
+
|
317 |
+
movie = '//player.vimeo.com/video/'+ match[3] +'?title=0&byline=0&portrait=0';
|
318 |
+
if(settings.autoplay) movie += "&autoplay=1;";
|
319 |
+
|
320 |
+
vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
|
321 |
+
|
322 |
+
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
|
323 |
+
break;
|
324 |
+
|
325 |
+
case 'quicktime':
|
326 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
327 |
+
pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
|
328 |
+
|
329 |
+
toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
|
330 |
+
break;
|
331 |
+
|
332 |
+
case 'flash':
|
333 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
334 |
+
|
335 |
+
flash_vars = pp_images[set_position];
|
336 |
+
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
|
337 |
+
|
338 |
+
filename = pp_images[set_position];
|
339 |
+
filename = filename.substring(0,filename.indexOf('?'));
|
340 |
+
|
341 |
+
toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
|
342 |
+
break;
|
343 |
+
|
344 |
+
case 'iframe':
|
345 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
346 |
+
|
347 |
+
frame_url = pp_images[set_position];
|
348 |
+
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
|
349 |
+
|
350 |
+
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
|
351 |
+
break;
|
352 |
+
|
353 |
+
case 'ajax':
|
354 |
+
doresize = false; // Make sure the dimensions are not resized.
|
355 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height);
|
356 |
+
doresize = true; // Reset the dimensions
|
357 |
+
|
358 |
+
skipInjection = true;
|
359 |
+
$.get(pp_images[set_position],function(responseHTML){
|
360 |
+
toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
|
361 |
+
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
362 |
+
_showContent();
|
363 |
+
});
|
364 |
+
|
365 |
+
break;
|
366 |
+
|
367 |
+
case 'custom':
|
368 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
369 |
+
|
370 |
+
toInject = settings.custom_markup;
|
371 |
+
break;
|
372 |
+
|
373 |
+
case 'inline':
|
374 |
+
// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
|
375 |
+
myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
|
376 |
+
doresize = false; // Make sure the dimensions are not resized.
|
377 |
+
pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
|
378 |
+
doresize = true; // Reset the dimensions
|
379 |
+
$(myClone).remove();
|
380 |
+
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
|
381 |
+
break;
|
382 |
+
};
|
383 |
+
|
384 |
+
if(!imgPreloader && !skipInjection){
|
385 |
+
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
386 |
+
|
387 |
+
// Show content
|
388 |
+
_showContent();
|
389 |
+
|
390 |
+
|
391 |
+
};
|
392 |
+
});
|
393 |
+
|
394 |
+
return false;
|
395 |
+
};
|
396 |
+
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Change page in the prettyPhoto modal box
|
400 |
+
* @param direction {String} Direction of the paging, previous or next.
|
401 |
+
*/
|
402 |
+
$.prettyPhoto.changePage = function(direction){
|
403 |
+
currentGalleryPage = 0;
|
404 |
+
|
405 |
+
if(direction == 'previous') {
|
406 |
+
set_position--;
|
407 |
+
if (set_position < 0) set_position = $(pp_images).length-1;
|
408 |
+
}else if(direction == 'next'){
|
409 |
+
set_position++;
|
410 |
+
if(set_position > $(pp_images).length-1) set_position = 0;
|
411 |
+
}else{
|
412 |
+
set_position=direction;
|
413 |
+
};
|
414 |
+
|
415 |
+
rel_index = set_position;
|
416 |
+
|
417 |
+
if(!doresize) doresize = true; // Allow the resizing of the images
|
418 |
+
if(settings.allow_expand) {
|
419 |
+
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
|
420 |
+
}
|
421 |
+
|
422 |
+
_hideContent(function(){ $.prettyPhoto.open(); });
|
423 |
+
};
|
424 |
+
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Change gallery page in the prettyPhoto modal box
|
428 |
+
* @param direction {String} Direction of the paging, previous or next.
|
429 |
+
*/
|
430 |
+
$.prettyPhoto.changeGalleryPage = function(direction){
|
431 |
+
if(direction=='next'){
|
432 |
+
currentGalleryPage ++;
|
433 |
+
|
434 |
+
if(currentGalleryPage > totalPage) currentGalleryPage = 0;
|
435 |
+
}else if(direction=='previous'){
|
436 |
+
currentGalleryPage --;
|
437 |
+
|
438 |
+
if(currentGalleryPage < 0) currentGalleryPage = totalPage;
|
439 |
+
}else{
|
440 |
+
currentGalleryPage = direction;
|
441 |
+
};
|
442 |
+
|
443 |
+
slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
|
444 |
+
|
445 |
+
slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
|
446 |
+
|
447 |
+
$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
|
448 |
+
};
|
449 |
+
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Start the slideshow...
|
453 |
+
*/
|
454 |
+
$.prettyPhoto.startSlideshow = function(){
|
455 |
+
if(typeof pp_slideshow == 'undefined'){
|
456 |
+
$pp_pic_holder.find('.pp_play').off('click').removeClass('pp_play').addClass('pp_pause').on( 'click', function(){
|
457 |
+
$.prettyPhoto.stopSlideshow();
|
458 |
+
return false;
|
459 |
+
});
|
460 |
+
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
|
461 |
+
}else{
|
462 |
+
$.prettyPhoto.changePage('next');
|
463 |
+
};
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Stop the slideshow...
|
469 |
+
*/
|
470 |
+
$.prettyPhoto.stopSlideshow = function(){
|
471 |
+
$pp_pic_holder.find('.pp_pause').off('click').removeClass('pp_pause').addClass('pp_play').on( 'click', function(){
|
472 |
+
$.prettyPhoto.startSlideshow();
|
473 |
+
return false;
|
474 |
+
});
|
475 |
+
clearInterval(pp_slideshow);
|
476 |
+
pp_slideshow=undefined;
|
477 |
+
}
|
478 |
+
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Closes prettyPhoto.
|
482 |
+
*/
|
483 |
+
$.prettyPhoto.close = function(){
|
484 |
+
if($pp_overlay.is(":animated")) return;
|
485 |
+
|
486 |
+
$.prettyPhoto.stopSlideshow();
|
487 |
+
|
488 |
+
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
|
489 |
+
|
490 |
+
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
|
491 |
+
|
492 |
+
$pp_overlay.fadeOut(settings.animation_speed, function(){
|
493 |
+
|
494 |
+
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
|
495 |
+
|
496 |
+
$(this).remove(); // No more need for the prettyPhoto markup
|
497 |
+
|
498 |
+
$(window).off('scroll.prettyphoto');
|
499 |
+
|
500 |
+
clearHashtag();
|
501 |
+
|
502 |
+
settings.callback();
|
503 |
+
|
504 |
+
doresize = true;
|
505 |
+
|
506 |
+
pp_open = false;
|
507 |
+
|
508 |
+
delete settings;
|
509 |
+
});
|
510 |
+
};
|
511 |
+
|
512 |
+
/**
|
513 |
+
* Set the proper sizes on the containers and animate the content in.
|
514 |
+
*/
|
515 |
+
function _showContent(){
|
516 |
+
$('.pp_loaderIcon').hide();
|
517 |
+
|
518 |
+
// Calculate the opened top position of the pic holder
|
519 |
+
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
|
520 |
+
if(projectedTop < 0) projectedTop = 0;
|
521 |
+
|
522 |
+
$ppt.fadeTo(settings.animation_speed,1);
|
523 |
+
|
524 |
+
// Resize the content holder
|
525 |
+
$pp_pic_holder.find('.pp_content')
|
526 |
+
.animate({
|
527 |
+
height:pp_dimensions['contentHeight'],
|
528 |
+
width:pp_dimensions['contentWidth']
|
529 |
+
},settings.animation_speed);
|
530 |
+
|
531 |
+
// Resize picture the holder
|
532 |
+
$pp_pic_holder.animate({
|
533 |
+
'top': projectedTop,
|
534 |
+
'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
|
535 |
+
width:pp_dimensions['containerWidth']
|
536 |
+
},settings.animation_speed,function(){
|
537 |
+
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
|
538 |
+
|
539 |
+
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
|
540 |
+
|
541 |
+
// Show the nav
|
542 |
+
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
|
543 |
+
|
544 |
+
if(settings.allow_expand) {
|
545 |
+
if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
|
546 |
+
$('a.pp_expand,a.pp_contract').show();
|
547 |
+
}else{
|
548 |
+
$('a.pp_expand').hide();
|
549 |
+
}
|
550 |
+
}
|
551 |
+
|
552 |
+
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
|
553 |
+
|
554 |
+
settings.changepicturecallback(); // Callback!
|
555 |
+
|
556 |
+
pp_open = true;
|
557 |
+
});
|
558 |
+
|
559 |
+
_insert_gallery();
|
560 |
+
pp_settings.ajaxcallback();
|
561 |
+
|
562 |
+
};
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Hide the content...DUH!
|
566 |
+
*/
|
567 |
+
function _hideContent(callback){
|
568 |
+
// Fade out the current picture
|
569 |
+
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
|
570 |
+
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
|
571 |
+
$('.pp_loaderIcon').show();
|
572 |
+
|
573 |
+
callback();
|
574 |
+
});
|
575 |
+
};
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Check the item position in the gallery array, hide or show the navigation links
|
579 |
+
* @param setCount {integer} The total number of items in the set
|
580 |
+
*/
|
581 |
+
function _checkPosition(setCount){
|
582 |
+
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
|
583 |
+
};
|
584 |
+
|
585 |
+
/**
|
586 |
+
* Resize the item dimensions if it's bigger than the viewport
|
587 |
+
* @param width {integer} Width of the item to be opened
|
588 |
+
* @param height {integer} Height of the item to be opened
|
589 |
+
* @return An array containin the "fitted" dimensions
|
590 |
+
*/
|
591 |
+
function _fitToViewport(width,height){
|
592 |
+
resized = false;
|
593 |
+
|
594 |
+
_getDimensions(width,height);
|
595 |
+
|
596 |
+
// Define them in case there's no resize needed
|
597 |
+
imageWidth = width, imageHeight = height;
|
598 |
+
|
599 |
+
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
|
600 |
+
resized = true, fitting = false;
|
601 |
+
|
602 |
+
while (!fitting){
|
603 |
+
if((pp_containerWidth > windowWidth)){
|
604 |
+
imageWidth = (windowWidth - 200);
|
605 |
+
imageHeight = (height/width) * imageWidth;
|
606 |
+
}else if((pp_containerHeight > windowHeight)){
|
607 |
+
imageHeight = (windowHeight - 200);
|
608 |
+
imageWidth = (width/height) * imageHeight;
|
609 |
+
}else{
|
610 |
+
fitting = true;
|
611 |
+
};
|
612 |
+
|
613 |
+
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
|
614 |
+
};
|
615 |
+
|
616 |
+
|
617 |
+
|
618 |
+
if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
|
619 |
+
_fitToViewport(pp_containerWidth,pp_containerHeight)
|
620 |
+
};
|
621 |
+
|
622 |
+
_getDimensions(imageWidth,imageHeight);
|
623 |
+
};
|
624 |
+
|
625 |
+
return {
|
626 |
+
width:Math.floor(imageWidth),
|
627 |
+
height:Math.floor(imageHeight),
|
628 |
+
containerHeight:Math.floor(pp_containerHeight),
|
629 |
+
containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
|
630 |
+
contentHeight:Math.floor(pp_contentHeight),
|
631 |
+
contentWidth:Math.floor(pp_contentWidth),
|
632 |
+
resized:resized
|
633 |
+
};
|
634 |
+
};
|
635 |
+
|
636 |
+
/**
|
637 |
+
* Get the containers dimensions according to the item size
|
638 |
+
* @param width {integer} Width of the item to be opened
|
639 |
+
* @param height {integer} Height of the item to be opened
|
640 |
+
*/
|
641 |
+
function _getDimensions(width,height){
|
642 |
+
width = parseFloat(width);
|
643 |
+
height = parseFloat(height);
|
644 |
+
|
645 |
+
// Get the details height, to do so, I need to clone it since it's invisible
|
646 |
+
$pp_details = $pp_pic_holder.find('.pp_details');
|
647 |
+
$pp_details.width(width);
|
648 |
+
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
|
649 |
+
|
650 |
+
$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
|
651 |
+
'position':'absolute',
|
652 |
+
'top':-10000
|
653 |
+
});
|
654 |
+
detailsHeight += $pp_details.height();
|
655 |
+
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
|
656 |
+
$pp_details.remove();
|
657 |
+
|
658 |
+
// Get the titles height, to do so, I need to clone it since it's invisible
|
659 |
+
$pp_title = $pp_pic_holder.find('.ppt');
|
660 |
+
$pp_title.width(width);
|
661 |
+
titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
|
662 |
+
$pp_title = $pp_title.clone().appendTo($('body')).css({
|
663 |
+
'position':'absolute',
|
664 |
+
'top':-10000
|
665 |
+
});
|
666 |
+
titleHeight += $pp_title.height();
|
667 |
+
$pp_title.remove();
|
668 |
+
|
669 |
+
// Get the container size, to resize the holder to the right dimensions
|
670 |
+
pp_contentHeight = height + detailsHeight;
|
671 |
+
pp_contentWidth = width;
|
672 |
+
pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
|
673 |
+
pp_containerWidth = width;
|
674 |
+
}
|
675 |
+
|
676 |
+
function _getFileType(itemSrc){
|
677 |
+
if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
|
678 |
+
return 'youtube';
|
679 |
+
}else if (itemSrc.match(/vimeo\.com/i)) {
|
680 |
+
return 'vimeo';
|
681 |
+
}else if(itemSrc.match(/\b.mov\b/i)){
|
682 |
+
return 'quicktime';
|
683 |
+
}else if(itemSrc.match(/\b.swf\b/i)){
|
684 |
+
return 'flash';
|
685 |
+
}else if(itemSrc.match(/\biframe=true\b/i)){
|
686 |
+
return 'iframe';
|
687 |
+
}else if(itemSrc.match(/\bajax=true\b/i)){
|
688 |
+
return 'ajax';
|
689 |
+
}else if(itemSrc.match(/\bcustom=true\b/i)){
|
690 |
+
return 'custom';
|
691 |
+
}else if(itemSrc.substr(0,1) == '#'){
|
692 |
+
return 'inline';
|
693 |
+
}else{
|
694 |
+
return 'image';
|
695 |
+
};
|
696 |
+
};
|
697 |
+
|
698 |
+
function _center_overlay(){
|
699 |
+
if(doresize && typeof $pp_pic_holder != 'undefined') {
|
700 |
+
scroll_pos = _get_scroll();
|
701 |
+
contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
|
702 |
+
|
703 |
+
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
|
704 |
+
if(projectedTop < 0) projectedTop = 0;
|
705 |
+
|
706 |
+
if(contentHeight > windowHeight)
|
707 |
+
return;
|
708 |
+
|
709 |
+
$pp_pic_holder.css({
|
710 |
+
'top': projectedTop,
|
711 |
+
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
|
712 |
+
});
|
713 |
+
};
|
714 |
+
};
|
715 |
+
|
716 |
+
function _get_scroll(){
|
717 |
+
if (self.pageYOffset) {
|
718 |
+
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
|
719 |
+
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
|
720 |
+
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
|
721 |
+
} else if (document.body) {// all other Explorers
|
722 |
+
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
|
723 |
+
};
|
724 |
+
};
|
725 |
+
|
726 |
+
function _resize_overlay() {
|
727 |
+
windowHeight = $(window).height(), windowWidth = $(window).width();
|
728 |
+
|
729 |
+
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
|
730 |
+
};
|
731 |
+
|
732 |
+
function _insert_gallery(){
|
733 |
+
if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
|
734 |
+
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
735 |
+
navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
|
736 |
+
|
737 |
+
itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
|
738 |
+
itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
|
739 |
+
totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
|
740 |
+
|
741 |
+
// Hide the nav in the case there's no need for links
|
742 |
+
if(totalPage == 0){
|
743 |
+
navWidth = 0; // No nav means no width!
|
744 |
+
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
|
745 |
+
}else{
|
746 |
+
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
|
747 |
+
};
|
748 |
+
|
749 |
+
galleryWidth = itemsPerPage * itemWidth;
|
750 |
+
fullGalleryWidth = pp_images.length * itemWidth;
|
751 |
+
|
752 |
+
// Set the proper width to the gallery items
|
753 |
+
$pp_gallery
|
754 |
+
.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
|
755 |
+
.find('div:first').width(galleryWidth+5)
|
756 |
+
.find('ul').width(fullGalleryWidth)
|
757 |
+
.find('li.selected').removeClass('selected');
|
758 |
+
|
759 |
+
goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
|
760 |
+
|
761 |
+
$.prettyPhoto.changeGalleryPage(goToPage);
|
762 |
+
|
763 |
+
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
|
764 |
+
}else{
|
765 |
+
$pp_pic_holder.find('.pp_content').off('mouseenter mouseleave');
|
766 |
+
// $pp_gallery.hide();
|
767 |
+
}
|
768 |
+
}
|
769 |
+
|
770 |
+
function _build_overlay(caller){
|
771 |
+
// Inject Social Tool markup into General markup
|
772 |
+
if(settings.social_tools)
|
773 |
+
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
|
774 |
+
|
775 |
+
settings.markup = settings.markup.replace('{pp_social}','');
|
776 |
+
|
777 |
+
$('body').append(settings.markup); // Inject the markup
|
778 |
+
|
779 |
+
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
|
780 |
+
|
781 |
+
// Inject the inline gallery!
|
782 |
+
if(isSet && settings.overlay_gallery) {
|
783 |
+
currentGalleryPage = 0;
|
784 |
+
toInject = "";
|
785 |
+
for (var i=0; i < pp_images.length; i++) {
|
786 |
+
if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
|
787 |
+
classname = 'default';
|
788 |
+
img_src = '';
|
789 |
+
}else{
|
790 |
+
classname = '';
|
791 |
+
img_src = pp_images[i];
|
792 |
+
}
|
793 |
+
toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
|
794 |
+
};
|
795 |
+
|
796 |
+
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
|
797 |
+
|
798 |
+
$pp_pic_holder.find('#pp_full_res').after(toInject);
|
799 |
+
|
800 |
+
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
|
801 |
+
|
802 |
+
$pp_gallery.find('.pp_arrow_next').on( 'click', function(){
|
803 |
+
$.prettyPhoto.changeGalleryPage('next');
|
804 |
+
$.prettyPhoto.stopSlideshow();
|
805 |
+
return false;
|
806 |
+
});
|
807 |
+
|
808 |
+
$pp_gallery.find('.pp_arrow_previous').on( 'click', function(){
|
809 |
+
$.prettyPhoto.changeGalleryPage('previous');
|
810 |
+
$.prettyPhoto.stopSlideshow();
|
811 |
+
return false;
|
812 |
+
});
|
813 |
+
|
814 |
+
$pp_pic_holder.find('.pp_content').on( 'mouseenter',
|
815 |
+
function(){
|
816 |
+
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
|
817 |
+
} ).on( 'mouseleave',
|
818 |
+
function(){
|
819 |
+
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
|
820 |
+
});
|
821 |
+
|
822 |
+
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
823 |
+
$pp_gallery_li.each(function(i){
|
824 |
+
$(this)
|
825 |
+
.find('a')
|
826 |
+
.on( 'click', function(){
|
827 |
+
$.prettyPhoto.changePage(i);
|
828 |
+
$.prettyPhoto.stopSlideshow();
|
829 |
+
return false;
|
830 |
+
});
|
831 |
+
});
|
832 |
+
};
|
833 |
+
|
834 |
+
|
835 |
+
// Inject the play/pause if it's a slideshow
|
836 |
+
if(settings.slideshow){
|
837 |
+
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
|
838 |
+
$pp_pic_holder.find('.pp_nav .pp_play').on( 'click', function(){
|
839 |
+
$.prettyPhoto.startSlideshow();
|
840 |
+
return false;
|
841 |
+
});
|
842 |
+
}
|
843 |
+
|
844 |
+
$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
|
845 |
+
|
846 |
+
$pp_overlay
|
847 |
+
.css({
|
848 |
+
'opacity':0,
|
849 |
+
'height':$(document).height(),
|
850 |
+
'width':$(window).width()
|
851 |
+
})
|
852 |
+
.on('click',function(){
|
853 |
+
if(!settings.modal) $.prettyPhoto.close();
|
854 |
+
});
|
855 |
+
|
856 |
+
$('a.pp_close').on('click',function(){ $.prettyPhoto.close(); return false; });
|
857 |
+
|
858 |
+
|
859 |
+
if(settings.allow_expand) {
|
860 |
+
$('a.pp_expand').on('click',function(e){
|
861 |
+
// Expand the image
|
862 |
+
if($(this).hasClass('pp_expand')){
|
863 |
+
$(this).removeClass('pp_expand').addClass('pp_contract');
|
864 |
+
doresize = false;
|
865 |
+
}else{
|
866 |
+
$(this).removeClass('pp_contract').addClass('pp_expand');
|
867 |
+
doresize = true;
|
868 |
+
};
|
869 |
+
|
870 |
+
_hideContent(function(){ $.prettyPhoto.open(); });
|
871 |
+
|
872 |
+
return false;
|
873 |
+
});
|
874 |
+
}
|
875 |
+
|
876 |
+
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').on('click',function(){
|
877 |
+
$.prettyPhoto.changePage('previous');
|
878 |
+
$.prettyPhoto.stopSlideshow();
|
879 |
+
return false;
|
880 |
+
});
|
881 |
+
|
882 |
+
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').on('click',function(){
|
883 |
+
$.prettyPhoto.changePage('next');
|
884 |
+
$.prettyPhoto.stopSlideshow();
|
885 |
+
return false;
|
886 |
+
});
|
887 |
+
|
888 |
+
_center_overlay(); // Center it
|
889 |
+
};
|
890 |
+
|
891 |
+
if(!pp_alreadyInitialized && getHashtag()){
|
892 |
+
pp_alreadyInitialized = true;
|
893 |
+
|
894 |
+
// Grab the rel index to trigger the click on the correct element
|
895 |
+
hashIndex = getHashtag();
|
896 |
+
hashRel = hashIndex;
|
897 |
+
hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
|
898 |
+
hashRel = hashRel.substring(0,hashRel.indexOf('/'));
|
899 |
+
|
900 |
+
// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
|
901 |
+
// Useful in the event the page contain several init scripts.
|
902 |
+
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
|
903 |
+
}
|
904 |
+
|
905 |
+
return this.off('click.prettyphoto').on('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
|
906 |
+
};
|
907 |
+
|
908 |
+
function getHashtag(){
|
909 |
+
var url = location.href;
|
910 |
+
hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
|
911 |
+
if(hashtag){ hashtag = hashtag.replace(/<|>/g,''); }
|
912 |
+
return hashtag;
|
913 |
+
};
|
914 |
+
|
915 |
+
function setHashtag(){
|
916 |
+
if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
|
917 |
+
location.hash = theRel + '/'+rel_index+'/';
|
918 |
+
};
|
919 |
+
|
920 |
+
function clearHashtag(){
|
921 |
+
if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
|
922 |
+
}
|
923 |
+
|
924 |
+
function getParam(name,url){
|
925 |
+
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
926 |
+
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
927 |
+
var regex = new RegExp( regexS );
|
928 |
+
var results = regex.exec( url );
|
929 |
+
return ( results == null ) ? "" : results[1];
|
930 |
+
}
|
931 |
+
|
932 |
+
|
933 |
+
})(jQuery);
|
934 |
+
|
935 |
+
var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.
|
assets/js/jquery.carouFredSel.js
CHANGED
@@ -1,3823 +1,3823 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery carouFredSel 6.2.1
|
3 |
-
* Demo's and documentation:
|
4 |
-
* caroufredsel.dev7studios.com
|
5 |
-
*
|
6 |
-
* Copyright (c) 2013 Fred Heusschen
|
7 |
-
* www.frebsite.nl
|
8 |
-
*
|
9 |
-
* Dual licensed under the MIT and GPL licenses.
|
10 |
-
* http://en.wikipedia.org/wiki/MIT_License
|
11 |
-
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
12 |
-
*/
|
13 |
-
|
14 |
-
|
15 |
-
(function ($) {
|
16 |
-
|
17 |
-
|
18 |
-
// LOCAL
|
19 |
-
|
20 |
-
if ($.fn.carouFredSel) {
|
21 |
-
return;
|
22 |
-
}
|
23 |
-
|
24 |
-
$.fn.caroufredsel = $.fn.carouFredSel = function (options, configs) {
|
25 |
-
|
26 |
-
// no element
|
27 |
-
if (this.length == 0) {
|
28 |
-
debug(true, 'No element found for "' + this.selector + '".');
|
29 |
-
return this;
|
30 |
-
}
|
31 |
-
|
32 |
-
// multiple elements
|
33 |
-
if (this.length > 1) {
|
34 |
-
return this.each(function () {
|
35 |
-
$(this).carouFredSel(options, configs);
|
36 |
-
});
|
37 |
-
}
|
38 |
-
|
39 |
-
|
40 |
-
var $cfs = this,
|
41 |
-
$tt0 = this[0],
|
42 |
-
starting_position = false;
|
43 |
-
|
44 |
-
if ($cfs.data('_cfs_isCarousel')) {
|
45 |
-
starting_position = $cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition');
|
46 |
-
$cfs.trigger('_cfs_triggerEvent', ['destroy', true]);
|
47 |
-
}
|
48 |
-
|
49 |
-
var FN = {};
|
50 |
-
|
51 |
-
FN._init = function (o, setOrig, start) {
|
52 |
-
o = go_getObject($tt0, o);
|
53 |
-
|
54 |
-
o.items = go_getItemsObject($tt0, o.items);
|
55 |
-
o.scroll = go_getScrollObject($tt0, o.scroll);
|
56 |
-
o.auto = go_getAutoObject($tt0, o.auto);
|
57 |
-
o.prev = go_getPrevNextObject($tt0, o.prev);
|
58 |
-
o.next = go_getPrevNextObject($tt0, o.next);
|
59 |
-
o.pagination = go_getPaginationObject($tt0, o.pagination);
|
60 |
-
o.swipe = go_getSwipeObject($tt0, o.swipe);
|
61 |
-
o.mousewheel = go_getMousewheelObject($tt0, o.mousewheel);
|
62 |
-
|
63 |
-
if (setOrig) {
|
64 |
-
opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
|
65 |
-
}
|
66 |
-
|
67 |
-
opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
|
68 |
-
opts.d = cf_getDimensions(opts);
|
69 |
-
|
70 |
-
crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';
|
71 |
-
|
72 |
-
var a_itm = $cfs.children(),
|
73 |
-
avail_primary = ms_getParentSize($wrp, opts, 'width');
|
74 |
-
|
75 |
-
if (is_true(opts.cookie)) {
|
76 |
-
opts.cookie = 'caroufredsel_cookie_' + conf.serialNumber;
|
77 |
-
}
|
78 |
-
|
79 |
-
opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
|
80 |
-
|
81 |
-
// complement items and sizes
|
82 |
-
opts.items = in_complementItems(opts.items, opts, a_itm, start);
|
83 |
-
opts[opts.d['width']] = in_complementPrimarySize(opts[opts.d['width']], opts, a_itm);
|
84 |
-
opts[opts.d['height']] = in_complementSecondarySize(opts[opts.d['height']], opts, a_itm);
|
85 |
-
|
86 |
-
// primary size not set for a responsive carousel
|
87 |
-
if (opts.responsive) {
|
88 |
-
if (!is_percentage(opts[opts.d['width']])) {
|
89 |
-
opts[opts.d['width']] = '100%';
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
// primary size is percentage
|
94 |
-
if (is_percentage(opts[opts.d['width']])) {
|
95 |
-
crsl.upDateOnWindowResize = true;
|
96 |
-
crsl.primarySizePercentage = opts[opts.d['width']];
|
97 |
-
opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
|
98 |
-
if (!opts.items.visible) {
|
99 |
-
opts.items.visibleConf.variable = true;
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
if (opts.responsive) {
|
104 |
-
opts.usePadding = true;
|
105 |
-
opts.padding = [5, 5, 5, 5];
|
106 |
-
opts.align = false;
|
107 |
-
opts.items.visibleConf.variable = false;
|
108 |
-
}
|
109 |
-
else {
|
110 |
-
// visible-items not set
|
111 |
-
if (!opts.items.visible) {
|
112 |
-
opts = in_complementVisibleItems(opts, avail_primary);
|
113 |
-
}
|
114 |
-
|
115 |
-
// primary size not set -> calculate it or set to "variable"
|
116 |
-
if (!opts[opts.d['width']]) {
|
117 |
-
if (!opts.items.visibleConf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*') {
|
118 |
-
opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
|
119 |
-
opts.align = false;
|
120 |
-
}
|
121 |
-
else {
|
122 |
-
opts[opts.d['width']] = 'variable';
|
123 |
-
}
|
124 |
-
}
|
125 |
-
// align not set -> set to center if primary size is number
|
126 |
-
if (is_undefined(opts.align)) {
|
127 |
-
opts.align = (is_number(opts[opts.d['width']]))
|
128 |
-
? 'center'
|
129 |
-
: false;
|
130 |
-
}
|
131 |
-
// set variabe visible-items
|
132 |
-
if (opts.items.visibleConf.variable) {
|
133 |
-
opts.items.visible = gn_getVisibleItemsNext(a_itm, opts, 0);
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
// set visible items by filter
|
138 |
-
if (opts.items.filter != '*' && !opts.items.visibleConf.variable) {
|
139 |
-
opts.items.visibleConf.org = opts.items.visible;
|
140 |
-
opts.items.visible = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
|
141 |
-
}
|
142 |
-
|
143 |
-
opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0);
|
144 |
-
opts.items.visibleConf.old = opts.items.visible;
|
145 |
-
|
146 |
-
if (opts.responsive) {
|
147 |
-
if (!opts.items.visibleConf.min) {
|
148 |
-
opts.items.visibleConf.min = opts.items.visible;
|
149 |
-
}
|
150 |
-
if (!opts.items.visibleConf.max) {
|
151 |
-
opts.items.visibleConf.max = opts.items.visible;
|
152 |
-
}
|
153 |
-
opts = in_getResponsiveValues(opts, a_itm, avail_primary);
|
154 |
-
}
|
155 |
-
else {
|
156 |
-
opts.padding = cf_getPadding(opts.padding);
|
157 |
-
|
158 |
-
if (opts.align == 'top') {
|
159 |
-
opts.align = 'left';
|
160 |
-
}
|
161 |
-
else if (opts.align == 'bottom') {
|
162 |
-
opts.align = 'right';
|
163 |
-
}
|
164 |
-
|
165 |
-
switch (opts.align) {
|
166 |
-
// align: center, left or right
|
167 |
-
case 'center':
|
168 |
-
case 'left':
|
169 |
-
case 'right':
|
170 |
-
if (opts[opts.d['width']] != 'variable') {
|
171 |
-
opts = in_getAlignPadding(opts, a_itm);
|
172 |
-
opts.usePadding = true;
|
173 |
-
}
|
174 |
-
break;
|
175 |
-
|
176 |
-
// padding
|
177 |
-
default:
|
178 |
-
opts.align = false;
|
179 |
-
opts.usePadding = (
|
180 |
-
opts.padding[0] == 0 &&
|
181 |
-
opts.padding[1] == 0 &&
|
182 |
-
opts.padding[2] == 0 &&
|
183 |
-
opts.padding[3] == 0
|
184 |
-
) ? false : true;
|
185 |
-
break;
|
186 |
-
}
|
187 |
-
}
|
188 |
-
|
189 |
-
if (!is_number(opts.scroll.duration)) {
|
190 |
-
opts.scroll.duration = 500;
|
191 |
-
}
|
192 |
-
if (is_undefined(opts.scroll.items)) {
|
193 |
-
opts.scroll.items = (opts.responsive || opts.items.visibleConf.variable || opts.items.filter != '*')
|
194 |
-
? 'visible'
|
195 |
-
: opts.items.visible;
|
196 |
|