Crelly Slider - Version 1.3.7

Version Description

  • Fixed PHP warning "Array and string offset access syntax with curly braces is deprecated" as reported here
Download this release

Release Info

Developer fabiorino
Plugin Icon 128x128 Crelly Slider
Version 1.3.7
Comparing to
See all releases

Code changes from version 1.3.6 to 1.3.7

LICENSE.txt CHANGED
@@ -1,9 +1,9 @@
1
- MIT License
2
-
3
- Copyright <2014 - 2019> <The Crelly Slider authors>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright <2014 - 2020> <The Crelly Slider authors>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
README.md CHANGED
@@ -1,31 +1,31 @@
1
- # Crelly Slider
2
- __Crelly Slider has Layers Animations, is Free, Responsive and Easy to Use__
3
-
4
- Crelly Slider in the WordPress plugins reposity: https://wordpress.org/plugins/crelly-slider
5
-
6
- Official plugin website (with live demo): http://crellyslider.altervista.org/
7
-
8
- Documentation: http://crellyslider.altervista.org/documentation/
9
-
10
- ## Description
11
- Crelly Slider is a Free / Open Source WordPress slider with a powerful Drag & Drop Builder. You can add Texts, Images, YouTube/Vimeo videos and animate each of them. It's perfect to display your creative content in posts and pages. With it's tons of features, Crelly Slider is the best free solution for your online WebSite.
12
-
13
-
14
-
15
- #### User Friendly Admin Panel
16
- Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
17
-
18
- #### High Cross Browser Compatibility
19
- Most of the animations and the transitions are written in jQuery (using the "animate" function). In this way we can assure the compatibility with modern (even Android and iOs) and older browsers.
20
-
21
- #### Drag and Drop Builder
22
- How can you position all the elements in to the slider area? You just simply drag them in to the desired position. Like in Powerpoint, you just have to move the object around the Slide.
23
-
24
- #### Transitions & Animations
25
- Foreach element and slide you can choose an in animation and an out animation using a simple selection menu. You can set the transition speeds and how long the element will take to get in and out.
26
-
27
- #### Completely Responsive
28
- Responsive means that the Slider will be displayed correctly in every resolution that the user will use. If the display is small (like in a smartphone), the slides and the elements will be scaled to be adapted.
29
-
30
- #### Full & Fixed Width Modes
31
- Using Crelly Slider you can select between a fixed or a full-width layout (both of them can be responsive). You are the designer, you own the WebSite, just choose the best for it.
1
+ # Crelly Slider
2
+ __Crelly Slider has Layers Animations, is Free, Responsive and Easy to Use__
3
+
4
+ Crelly Slider in the WordPress plugins reposity: https://wordpress.org/plugins/crelly-slider
5
+
6
+ Official plugin website (with live demo): http://crellyslider.altervista.org/
7
+
8
+ Documentation: http://crellyslider.altervista.org/documentation/
9
+
10
+ ## Description
11
+ Crelly Slider is a Free / Open Source WordPress slider with a powerful Drag & Drop Builder. You can add Texts, Images, YouTube/Vimeo videos and animate each of them. It's perfect to display your creative content in posts and pages. With it's tons of features, Crelly Slider is the best free solution for your online WebSite.
12
+
13
+
14
+
15
+ #### User Friendly Admin Panel
16
+ Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
17
+
18
+ #### High Cross Browser Compatibility
19
+ Most of the animations and the transitions are written in jQuery (using the "animate" function). In this way we can assure the compatibility with modern (even Android and iOs) and older browsers.
20
+
21
+ #### Drag and Drop Builder
22
+ How can you position all the elements in to the slider area? You just simply drag them in to the desired position. Like in Powerpoint, you just have to move the object around the Slide.
23
+
24
+ #### Transitions & Animations
25
+ Foreach element and slide you can choose an in animation and an out animation using a simple selection menu. You can set the transition speeds and how long the element will take to get in and out.
26
+
27
+ #### Completely Responsive
28
+ Responsive means that the Slider will be displayed correctly in every resolution that the user will use. If the display is small (like in a smartphone), the slides and the elements will be scaled to be adapted.
29
+
30
+ #### Full & Fixed Width Modes
31
+ Using Crelly Slider you can select between a fixed or a full-width layout (both of them can be responsive). You are the designer, you own the WebSite, just choose the best for it.
crellyslider.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
- /**
3
- * Plugin Name: Crelly Slider
4
- * Plugin URI: https://wordpress.org/plugins/crelly-slider/
5
- * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
- * Version: 1.3.6
7
- * Author: Fabio Rinaldi
8
- * Author URI: https://github.com/fabiorino
9
- * Text Domain: crelly-slider
10
- * License: MIT
11
- */
12
-
13
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
-
15
- /*************/
16
- /** GLOBALS **/
17
- /*************/
18
-
19
- define('CS_DEBUG', false);
20
-
21
- define('CS_VERSION', '1.3.6');
22
- define('CS_MIN_CAPABILITY', 'manage_options');
23
- define('CS_PATH', plugin_dir_path(__FILE__));
24
- define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
25
-
26
- require_once CS_PATH . 'wordpress/common.php';
27
- require_once CS_PATH . 'wordpress/tables.php';
28
- require_once CS_PATH . 'wordpress/frontend.php';
29
-
30
- // Create (or remove) 3 tables: the sliders settings, the slides settings and the elements proprieties. We will also store the current version of the plugin
31
- register_activation_hook(__FILE__, array('CrellySliderTables', 'setVersion'));
32
- register_activation_hook(__FILE__, array('CrellySliderTables', 'setTables'));
33
- register_uninstall_hook(__FILE__, array('CrellySliderTables', 'clearDatabase'));
34
-
35
- // CSS and Javascript
36
- CrellySliderCommon::setEnqueues();
37
-
38
- CrellySliderFrontend::addShortcode();
39
-
40
- if(is_admin()) {
41
- require_once CS_PATH . 'wordpress/admin.php';
42
-
43
- // Tables
44
- if(CS_DEBUG || CS_VERSION != get_option('cs_version')) {
45
- CrellySliderTables::setTables();
46
- }
47
- if(CS_VERSION != get_option('cs_version')) {
48
- CrellySliderTables::setVersion();
49
- }
50
-
51
- CrellySliderAdmin::loadAssets();
52
- CrellySliderAdmin::showSettings();
53
-
54
- // Ajax functions
55
- require_once CS_PATH . 'wordpress/ajax.php';
56
- }
57
- ?>
1
+ <?php
2
+ /**
3
+ * Plugin Name: Crelly Slider
4
+ * Plugin URI: https://wordpress.org/plugins/crelly-slider/
5
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
+ * Version: 1.3.7
7
+ * Author: Fabio Rinaldi
8
+ * Author URI: https://github.com/fabiorino
9
+ * Text Domain: crelly-slider
10
+ * License: MIT
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
+
15
+ /*************/
16
+ /** GLOBALS **/
17
+ /*************/
18
+
19
+ define('CS_DEBUG', false);
20
+
21
+ define('CS_VERSION', '1.3.7');
22
+ define('CS_MIN_CAPABILITY', 'manage_options');
23
+ define('CS_PATH', plugin_dir_path(__FILE__));
24
+ define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
25
+
26
+ require_once CS_PATH . 'wordpress/common.php';
27
+ require_once CS_PATH . 'wordpress/tables.php';
28
+ require_once CS_PATH . 'wordpress/frontend.php';
29
+
30
+ // Create (or remove) 3 tables: the sliders settings, the slides settings and the elements proprieties. We will also store the current version of the plugin
31
+ register_activation_hook(__FILE__, array('CrellySliderTables', 'setVersion'));
32
+ register_activation_hook(__FILE__, array('CrellySliderTables', 'setTables'));
33
+ register_uninstall_hook(__FILE__, array('CrellySliderTables', 'clearDatabase'));
34
+
35
+ // CSS and Javascript
36
+ CrellySliderCommon::setEnqueues();
37
+
38
+ CrellySliderFrontend::addShortcode();
39
+
40
+ if(is_admin()) {
41
+ require_once CS_PATH . 'wordpress/admin.php';
42
+
43
+ // Tables
44
+ if(CS_DEBUG || CS_VERSION != get_option('cs_version')) {
45
+ CrellySliderTables::setTables();
46
+ }
47
+ if(CS_VERSION != get_option('cs_version')) {
48
+ CrellySliderTables::setVersion();
49
+ }
50
+
51
+ CrellySliderAdmin::loadAssets();
52
+ CrellySliderAdmin::showSettings();
53
+
54
+ // Ajax functions
55
+ require_once CS_PATH . 'wordpress/ajax.php';
56
+ }
57
+ ?>
css/crellyslider.css CHANGED
@@ -1,301 +1,301 @@
1
- /**
2
- * Plugin Name: Crelly Slider
3
- * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
- * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.6
6
- * Author: Fabio Rinaldi
7
- * Author URI: https://github.com/fabiorino
8
- * License: MIT
9
- */
10
-
11
- .crellyslider {
12
- margin: 0 auto;
13
- position: relative;
14
- white-space: nowrap;
15
- overflow: hidden;
16
- line-height: 1.5;
17
- font-size: 14px;
18
- color: #000;
19
- font-family: 'Verdana', sans-serif;
20
- }
21
-
22
- .crellyslider a {
23
- color: #0073aa;
24
- }
25
-
26
- .crellyslider a:hover {
27
- color: #0073aa;
28
- }
29
-
30
- .crellyslider > .cs-preloader {
31
- width: 100%;
32
- height: 100%;
33
- z-index: 999;
34
- background-color: #fff;
35
- position: relative;
36
- overflow: hidden;
37
- }
38
-
39
- .crellyslider > .cs-preloader > .cs-bg {
40
- position: absolute;
41
- top: 0;
42
- left: 0;
43
- z-index: 11;
44
- display: block;
45
- width: 100%;
46
- height: 100%;
47
- filter: blur(5px);
48
- -webkit-filter: blur(5px);
49
- -moz-filter: blur(5px);
50
- -o-filter: blur(5px);
51
- -ms-filter: blur(5px);
52
- }
53
-
54
- .crellyslider > .cs-preloader > .cs-loader {
55
- width: 50px;
56
- height: 50px;
57
- position: absolute;
58
- top: 50%;
59
- left: 50%;
60
- margin-top: -25px;
61
- margin-left: -25px;
62
- z-index: 12;
63
- background-color:#fff;
64
- box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
65
- background-repeat: no-repeat;
66
- background-position: center center;
67
- border: 10px;
68
- border-radius: 50%;
69
- }
70
-
71
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner {
72
- top: 16px;
73
- left: 50%;
74
- margin-left: -2px;
75
- }
76
-
77
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
78
- width: 4px;
79
- height: 18px;
80
- background-color: #0b60a9;
81
- border-radius: 2px;
82
- }
83
-
84
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner {
85
- display: inline-block;
86
- position: relative;
87
- }
88
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
89
- content: "";
90
- position: absolute;
91
- display: block;
92
- top: 0px;
93
- }
94
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before {
95
- left: -6px;
96
- }
97
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
98
- left: 6px;
99
- }
100
-
101
- @-webkit-keyframes cs-bounce-middle {
102
- 0% {
103
- height: 4px;
104
- margin-top: 8px;
105
- margin-bottom: 8px;
106
- }
107
- 50% {
108
- height: 20px;
109
- margin-top: 0px;
110
- margin-bottom: 0px;
111
- }
112
- 100% {
113
- height: 4px;
114
- margin-top: 8px;
115
- margin-bottom: 8px;
116
- }
117
- }
118
- @keyframes cs-bounce-middle {
119
- 0% {
120
- height: 4px;
121
- margin-top: 8px;
122
- margin-bottom: 8px;
123
- }
124
- 50% {
125
- height: 20px;
126
- margin-top: 0px;
127
- margin-bottom: 0px;
128
- }
129
- 100% {
130
- height: 4px;
131
- margin-top: 8px;
132
- margin-bottom: 8px;
133
- }
134
- }
135
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner {
136
- -webkit-animation: cs-bounce-middle 0.6s ease 0.1s infinite;
137
- animation: cs-bounce-middle 0.6s ease 0.1s infinite;
138
- }
139
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
140
- top: 50%;
141
- -webkit-transform: translateY(-10px) translateZ(0);
142
- transform: translateY(-10px) translateZ(0);
143
- }
144
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before {
145
- -webkit-animation: cs-bounce-middle 0.6s ease 0s infinite;
146
- animation: cs-bounce-middle 0.6s ease 0s infinite;
147
- }
148
- .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
149
- -webkit-animation: cs-bounce-middle 0.6s ease 0.2s infinite;
150
- animation: cs-bounce-middle 0.6s ease 0.2s infinite;
151
- }
152
-
153
- .crellyslider > .cs-controls,
154
- .crellyslider > .cs-navigation {
155
- z-index: 999;
156
- -webkit-transition: all 0.2s;
157
- -moz-transition: all 0.2s;
158
- -o-transition: all 0.2s;
159
- -ms-transition: all 0.2s;
160
- transition: all 0.2s;
161
- opacity: 0;
162
- filter: alpha(opacity=0);
163
- }
164
-
165
- .crellyslider:hover > .cs-controls,
166
- .crellyslider:hover > .cs-navigation {
167
- opacity: 1;
168
- filter: alpha(opacity=100);
169
- }
170
-
171
- .crellyslider > .cs-slides {
172
- list-style: none;
173
- margin: 0;
174
- padding: 0;
175
- }
176
-
177
- .crellyslider > .cs-slides > .cs-slide {
178
- margin: 0;
179
- padding: 0;
180
- position: absolute;
181
- overflow: hidden;
182
- -webkit-touch-callout: none;
183
- -webkit-user-select: none;
184
- -khtml-user-select: none;
185
- -moz-user-select: none;
186
- -ms-user-select: none;
187
- user-select: none;
188
- }
189
-
190
- .crellyslider > .cs-slides > .cs-slide > .cs-background-link {
191
- opacity: 0;
192
- z-index: 0;
193
- padding: 0;
194
- width: 100% !important;
195
- height: 100% !important;
196
- top: 0 !important;
197
- left: 0 !important;
198
- }
199
-
200
- .crellyslider > .cs-slides > .cs-slide > * {
201
- position: absolute;
202
- display: block;
203
- cursor: default;
204
- -webkit-transition: none;
205
- -moz-transition: none;
206
- -ms-transition: none;
207
- -o-transition: none;
208
- transition: none;
209
- font-size: 14px;
210
- }
211
-
212
- .crellyslider > .cs-slides > .cs-slide > a {
213
- cursor: pointer;
214
- }
215
-
216
- .crellyslider > .cs-slides > .cs-slide > img,
217
- .crellyslider > .cs-slides > .cs-slide > a > img {
218
- max-width: none !important;
219
- }
220
-
221
- .crellyslider > .cs-slides > .cs-slide a,
222
- .crellyslider > .cs-slides > .cs-slide > a > img {
223
- text-decoration: none;
224
- outline: none;
225
- border: none;
226
- }
227
-
228
- .crellyslider > .cs-controls {
229
- position: absolute;
230
- width: 100%;
231
- top: 50%;
232
- margin-top: -9px;
233
- }
234
-
235
- .crellyslider > .cs-controls > .cs-previous,
236
- .crellyslider > .cs-controls > .cs-next {
237
- display: block;
238
- width: 35px;
239
- height: 35px;
240
- position: absolute;
241
- cursor: pointer;
242
- background-color:#fff;
243
- box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
244
- background-repeat: no-repeat;
245
- background-position: center center;
246
- border: 10px;
247
- border-radius: 50%;
248
- }
249
-
250
- .crellyslider > .cs-controls > .cs-previous {
251
- background-image: url('../images/arrow-left.png');
252
- left: 30px;
253
- }
254
-
255
- .crellyslider > .cs-controls > .cs-next {
256
- background-image: url('../images/arrow-right.png');
257
- right: 30px;
258
- }
259
-
260
- .crellyslider > .cs-navigation {
261
- position: absolute;
262
- width: 100%;
263
- height: 0;
264
- bottom: 40px;
265
- text-align: center;
266
- }
267
-
268
- .crellyslider > .cs-navigation > .cs-slide-link {
269
- width: 15px;
270
- height: 15px;
271
- display: inline-block;
272
- cursor: pointer;
273
- margin: 6px;
274
- background-color:#fff;
275
- box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
276
- border: 10px;
277
- border-radius: 50%;
278
- opacity: .5;
279
- filter: alpha(opacity=50);
280
- }
281
-
282
- .crellyslider > .cs-navigation > .cs-slide-link.cs-active {
283
- opacity: 1;
284
- filter: alpha(opacity=100);
285
- }
286
-
287
- .crellyslider > .cs-progress-bar {
288
- width: 0%;
289
- height: 4px;
290
- position: absolute;
291
- top: 0;
292
- background-color: #fff;
293
- opacity: .5;
294
- filter: alpha(opacity=50);
295
- z-index: 999;
296
- }
297
-
298
- .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
299
- opacity: 0;
300
- filter: alpha(opacity=0);
301
- }
1
+ /**
2
+ * Plugin Name: Crelly Slider
3
+ * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.7
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
+ * License: MIT
9
+ */
10
+
11
+ .crellyslider {
12
+ margin: 0 auto;
13
+ position: relative;
14
+ white-space: nowrap;
15
+ overflow: hidden;
16
+ line-height: 1.5;
17
+ font-size: 14px;
18
+ color: #000;
19
+ font-family: 'Verdana', sans-serif;
20
+ }
21
+
22
+ .crellyslider a {
23
+ color: #0073aa;
24
+ }
25
+
26
+ .crellyslider a:hover {
27
+ color: #0073aa;
28
+ }
29
+
30
+ .crellyslider > .cs-preloader {
31
+ width: 100%;
32
+ height: 100%;
33
+ z-index: 999;
34
+ background-color: #fff;
35
+ position: relative;
36
+ overflow: hidden;
37
+ }
38
+
39
+ .crellyslider > .cs-preloader > .cs-bg {
40
+ position: absolute;
41
+ top: 0;
42
+ left: 0;
43
+ z-index: 11;
44
+ display: block;
45
+ width: 100%;
46
+ height: 100%;
47
+ filter: blur(5px);
48
+ -webkit-filter: blur(5px);
49
+ -moz-filter: blur(5px);
50
+ -o-filter: blur(5px);
51
+ -ms-filter: blur(5px);
52
+ }
53
+
54
+ .crellyslider > .cs-preloader > .cs-loader {
55
+ width: 50px;
56
+ height: 50px;
57
+ position: absolute;
58
+ top: 50%;
59
+ left: 50%;
60
+ margin-top: -25px;
61
+ margin-left: -25px;
62
+ z-index: 12;
63
+ background-color:#fff;
64
+ box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
65
+ background-repeat: no-repeat;
66
+ background-position: center center;
67
+ border: 10px;
68
+ border-radius: 50%;
69
+ }
70
+
71
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner {
72
+ top: 16px;
73
+ left: 50%;
74
+ margin-left: -2px;
75
+ }
76
+
77
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
78
+ width: 4px;
79
+ height: 18px;
80
+ background-color: #0b60a9;
81
+ border-radius: 2px;
82
+ }
83
+
84
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner {
85
+ display: inline-block;
86
+ position: relative;
87
+ }
88
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
89
+ content: "";
90
+ position: absolute;
91
+ display: block;
92
+ top: 0px;
93
+ }
94
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before {
95
+ left: -6px;
96
+ }
97
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
98
+ left: 6px;
99
+ }
100
+
101
+ @-webkit-keyframes cs-bounce-middle {
102
+ 0% {
103
+ height: 4px;
104
+ margin-top: 8px;
105
+ margin-bottom: 8px;
106
+ }
107
+ 50% {
108
+ height: 20px;
109
+ margin-top: 0px;
110
+ margin-bottom: 0px;
111
+ }
112
+ 100% {
113
+ height: 4px;
114
+ margin-top: 8px;
115
+ margin-bottom: 8px;
116
+ }
117
+ }
118
+ @keyframes cs-bounce-middle {
119
+ 0% {
120
+ height: 4px;
121
+ margin-top: 8px;
122
+ margin-bottom: 8px;
123
+ }
124
+ 50% {
125
+ height: 20px;
126
+ margin-top: 0px;
127
+ margin-bottom: 0px;
128
+ }
129
+ 100% {
130
+ height: 4px;
131
+ margin-top: 8px;
132
+ margin-bottom: 8px;
133
+ }
134
+ }
135
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner {
136
+ -webkit-animation: cs-bounce-middle 0.6s ease 0.1s infinite;
137
+ animation: cs-bounce-middle 0.6s ease 0.1s infinite;
138
+ }
139
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before, .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
140
+ top: 50%;
141
+ -webkit-transform: translateY(-10px) translateZ(0);
142
+ transform: translateY(-10px) translateZ(0);
143
+ }
144
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:before {
145
+ -webkit-animation: cs-bounce-middle 0.6s ease 0s infinite;
146
+ animation: cs-bounce-middle 0.6s ease 0s infinite;
147
+ }
148
+ .crellyslider > .cs-preloader > .cs-loader > .cs-spinner:after {
149
+ -webkit-animation: cs-bounce-middle 0.6s ease 0.2s infinite;
150
+ animation: cs-bounce-middle 0.6s ease 0.2s infinite;
151
+ }
152
+
153
+ .crellyslider > .cs-controls,
154
+ .crellyslider > .cs-navigation {
155
+ z-index: 999;
156
+ -webkit-transition: all 0.2s;
157
+ -moz-transition: all 0.2s;
158
+ -o-transition: all 0.2s;
159
+ -ms-transition: all 0.2s;
160
+ transition: all 0.2s;
161
+ opacity: 0;
162
+ filter: alpha(opacity=0);
163
+ }
164
+
165
+ .crellyslider:hover > .cs-controls,
166
+ .crellyslider:hover > .cs-navigation {
167
+ opacity: 1;
168
+ filter: alpha(opacity=100);
169
+ }
170
+
171
+ .crellyslider > .cs-slides {
172
+ list-style: none;
173
+ margin: 0;
174
+ padding: 0;
175
+ }
176
+
177
+ .crellyslider > .cs-slides > .cs-slide {
178
+ margin: 0;
179
+ padding: 0;
180
+ position: absolute;
181
+ overflow: hidden;
182
+ -webkit-touch-callout: none;
183
+ -webkit-user-select: none;
184
+ -khtml-user-select: none;
185
+ -moz-user-select: none;
186
+ -ms-user-select: none;
187
+ user-select: none;
188
+ }
189
+
190
+ .crellyslider > .cs-slides > .cs-slide > .cs-background-link {
191
+ opacity: 0;
192
+ z-index: 0;
193
+ padding: 0;
194
+ width: 100% !important;
195
+ height: 100% !important;
196
+ top: 0 !important;
197
+ left: 0 !important;
198
+ }
199
+
200
+ .crellyslider > .cs-slides > .cs-slide > * {
201
+ position: absolute;
202
+ display: block;
203
+ cursor: default;
204
+ -webkit-transition: none;
205
+ -moz-transition: none;
206
+ -ms-transition: none;
207
+ -o-transition: none;
208
+ transition: none;
209
+ font-size: 14px;
210
+ }
211
+
212
+ .crellyslider > .cs-slides > .cs-slide > a {
213
+ cursor: pointer;
214
+ }
215
+
216
+ .crellyslider > .cs-slides > .cs-slide > img,
217
+ .crellyslider > .cs-slides > .cs-slide > a > img {
218
+ max-width: none !important;
219
+ }
220
+
221
+ .crellyslider > .cs-slides > .cs-slide a,
222
+ .crellyslider > .cs-slides > .cs-slide > a > img {
223
+ text-decoration: none;
224
+ outline: none;
225
+ border: none;
226
+ }
227
+
228
+ .crellyslider > .cs-controls {
229
+ position: absolute;
230
+ width: 100%;
231
+ top: 50%;
232
+ margin-top: -9px;
233
+ }
234
+
235
+ .crellyslider > .cs-controls > .cs-previous,
236
+ .crellyslider > .cs-controls > .cs-next {
237
+ display: block;
238
+ width: 35px;
239
+ height: 35px;
240
+ position: absolute;
241
+ cursor: pointer;
242
+ background-color:#fff;
243
+ box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
244
+ background-repeat: no-repeat;
245
+ background-position: center center;
246
+ border: 10px;
247
+ border-radius: 50%;
248
+ }
249
+
250
+ .crellyslider > .cs-controls > .cs-previous {
251
+ background-image: url('../images/arrow-left.png');
252
+ left: 30px;
253
+ }
254
+
255
+ .crellyslider > .cs-controls > .cs-next {
256
+ background-image: url('../images/arrow-right.png');
257
+ right: 30px;
258
+ }
259
+
260
+ .crellyslider > .cs-navigation {
261
+ position: absolute;
262
+ width: 100%;
263
+ height: 0;
264
+ bottom: 40px;
265
+ text-align: center;
266
+ }
267
+
268
+ .crellyslider > .cs-navigation > .cs-slide-link {
269
+ width: 15px;
270
+ height: 15px;
271
+ display: inline-block;
272
+ cursor: pointer;
273
+ margin: 6px;
274
+ background-color:#fff;
275
+ box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
276
+ border: 10px;
277
+ border-radius: 50%;
278
+ opacity: .5;
279
+ filter: alpha(opacity=50);
280
+ }
281
+
282
+ .crellyslider > .cs-navigation > .cs-slide-link.cs-active {
283
+ opacity: 1;
284
+ filter: alpha(opacity=100);
285
+ }
286
+
287
+ .crellyslider > .cs-progress-bar {
288
+ width: 0%;
289
+ height: 4px;
290
+ position: absolute;
291
+ top: 0;
292
+ background-color: #fff;
293
+ opacity: .5;
294
+ filter: alpha(opacity=50);
295
+ z-index: 999;
296
+ }
297
+
298
+ .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
299
+ opacity: 0;
300
+ filter: alpha(opacity=0);
301
+ }
css/crellyslider.min.css CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * Plugin Name: Crelly Slider
3
- * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
- * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.6
6
- * Author: Fabio Rinaldi
7
- * Author URI: https://github.com/fabiorino
8
- * License: MIT
9
- */
10
-
11
  .crellyslider>.cs-controls>.cs-next,.crellyslider>.cs-controls>.cs-previous,.crellyslider>.cs-preloader>.cs-loader{background-repeat:no-repeat;background-position:center center;border:10px;box-shadow:0 3px 10px rgba(0,0,0,.16),0 3px 10px rgba(0,0,0,.23)}.crellyslider{margin:0 auto;position:relative;white-space:nowrap;overflow:hidden;line-height:1.5;font-size:14px;color:#000;font-family:Verdana,sans-serif}.crellyslider a,.crellyslider a:hover{color:#0073aa}.crellyslider>.cs-preloader{width:100%;height:100%;z-index:999;background-color:#fff;position:relative;overflow:hidden}.crellyslider>.cs-preloader>.cs-bg{position:absolute;top:0;left:0;z-index:11;display:block;width:100%;height:100%;filter:blur(5px);-webkit-filter:blur(5px);-moz-filter:blur(5px);-o-filter:blur(5px);-ms-filter:blur(5px)}.crellyslider>.cs-preloader>.cs-loader{width:50px;height:50px;position:absolute;top:50%;left:50%;margin-top:-25px;margin-left:-25px;z-index:12;background-color:#fff;border-radius:50%}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner{top:16px;left:50%;margin-left:-2px;display:inline-block;position:relative;-webkit-animation:cs-bounce-middle .6s ease .1s infinite;animation:cs-bounce-middle .6s ease .1s infinite}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner,.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:after,.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:before{width:4px;height:18px;background-color:#0b60a9;border-radius:2px}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:after,.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:before{content:"";position:absolute;display:block;top:50%;-webkit-transform:translateY(-10px) translateZ(0);transform:translateY(-10px) translateZ(0)}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:before{left:-6px;-webkit-animation:cs-bounce-middle .6s ease 0s infinite;animation:cs-bounce-middle .6s ease 0s infinite}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:after{left:6px;-webkit-animation:cs-bounce-middle .6s ease .2s infinite;animation:cs-bounce-middle .6s ease .2s infinite}@-webkit-keyframes cs-bounce-middle{0%,100%{height:4px;margin-top:8px;margin-bottom:8px}50%{height:20px;margin-top:0;margin-bottom:0}}@keyframes cs-bounce-middle{0%,100%{height:4px;margin-top:8px;margin-bottom:8px}50%{height:20px;margin-top:0;margin-bottom:0}}.crellyslider>.cs-controls,.crellyslider>.cs-navigation{z-index:999;-webkit-transition:all .2s;-moz-transition:all .2s;-o-transition:all .2s;-ms-transition:all .2s;transition:all .2s;opacity:0;filter:alpha(opacity=0)}.crellyslider:hover>.cs-controls,.crellyslider:hover>.cs-navigation{opacity:1;filter:alpha(opacity=100)}.crellyslider>.cs-slides{list-style:none;margin:0;padding:0}.crellyslider>.cs-slides>.cs-slide{margin:0;padding:0;position:absolute;overflow:hidden;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.crellyslider>.cs-slides>.cs-slide>.cs-background-link{opacity:0;z-index:0;padding:0;width:100%!important;height:100%!important;top:0!important;left:0!important}.crellyslider>.cs-slides>.cs-slide>*{position:absolute;display:block;cursor:default;-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;font-size:14px}.crellyslider>.cs-slides>.cs-slide>a{cursor:pointer}.crellyslider>.cs-slides>.cs-slide>a>img,.crellyslider>.cs-slides>.cs-slide>img{max-width:none!important}.crellyslider>.cs-slides>.cs-slide a,.crellyslider>.cs-slides>.cs-slide>a>img{text-decoration:none;outline:0;border:none}.crellyslider>.cs-controls{position:absolute;width:100%;top:50%;margin-top:-9px}.crellyslider>.cs-controls>.cs-next,.crellyslider>.cs-controls>.cs-previous{display:block;width:35px;height:35px;position:absolute;cursor:pointer;background-color:#fff;border-radius:50%}.crellyslider>.cs-controls>.cs-previous{background-image:url(../images/arrow-left.png);left:30px}.crellyslider>.cs-controls>.cs-next{background-image:url(../images/arrow-right.png);right:30px}.crellyslider>.cs-navigation{position:absolute;width:100%;height:0;bottom:40px;text-align:center}.crellyslider>.cs-navigation>.cs-slide-link{width:15px;height:15px;display:inline-block;cursor:pointer;margin:6px;background-color:#fff;box-shadow:0 3px 10px rgba(0,0,0,.16),0 3px 10px rgba(0,0,0,.23);border:10px;border-radius:50%;opacity:.5;filter:alpha(opacity=50)}.crellyslider>.cs-navigation>.cs-slide-link.cs-active{opacity:1;filter:alpha(opacity=100)}.crellyslider>.cs-progress-bar{width:0%;height:4px;position:absolute;top:0;background-color:#fff;opacity:.5;filter:alpha(opacity=50);z-index:999}.crellyslider>.cs-progress-bar.cs-progress-bar-hidden{opacity:0;filter:alpha(opacity=0)}
1
+ /**
2
+ * Plugin Name: Crelly Slider
3
+ * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.7
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
+ * License: MIT
9
+ */
10
+
11
  .crellyslider>.cs-controls>.cs-next,.crellyslider>.cs-controls>.cs-previous,.crellyslider>.cs-preloader>.cs-loader{background-repeat:no-repeat;background-position:center center;border:10px;box-shadow:0 3px 10px rgba(0,0,0,.16),0 3px 10px rgba(0,0,0,.23)}.crellyslider{margin:0 auto;position:relative;white-space:nowrap;overflow:hidden;line-height:1.5;font-size:14px;color:#000;font-family:Verdana,sans-serif}.crellyslider a,.crellyslider a:hover{color:#0073aa}.crellyslider>.cs-preloader{width:100%;height:100%;z-index:999;background-color:#fff;position:relative;overflow:hidden}.crellyslider>.cs-preloader>.cs-bg{position:absolute;top:0;left:0;z-index:11;display:block;width:100%;height:100%;filter:blur(5px);-webkit-filter:blur(5px);-moz-filter:blur(5px);-o-filter:blur(5px);-ms-filter:blur(5px)}.crellyslider>.cs-preloader>.cs-loader{width:50px;height:50px;position:absolute;top:50%;left:50%;margin-top:-25px;margin-left:-25px;z-index:12;background-color:#fff;border-radius:50%}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner{top:16px;left:50%;margin-left:-2px;display:inline-block;position:relative;-webkit-animation:cs-bounce-middle .6s ease .1s infinite;animation:cs-bounce-middle .6s ease .1s infinite}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner,.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:after,.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:before{width:4px;height:18px;background-color:#0b60a9;border-radius:2px}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:after,.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:before{content:"";position:absolute;display:block;top:50%;-webkit-transform:translateY(-10px) translateZ(0);transform:translateY(-10px) translateZ(0)}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:before{left:-6px;-webkit-animation:cs-bounce-middle .6s ease 0s infinite;animation:cs-bounce-middle .6s ease 0s infinite}.crellyslider>.cs-preloader>.cs-loader>.cs-spinner:after{left:6px;-webkit-animation:cs-bounce-middle .6s ease .2s infinite;animation:cs-bounce-middle .6s ease .2s infinite}@-webkit-keyframes cs-bounce-middle{0%,100%{height:4px;margin-top:8px;margin-bottom:8px}50%{height:20px;margin-top:0;margin-bottom:0}}@keyframes cs-bounce-middle{0%,100%{height:4px;margin-top:8px;margin-bottom:8px}50%{height:20px;margin-top:0;margin-bottom:0}}.crellyslider>.cs-controls,.crellyslider>.cs-navigation{z-index:999;-webkit-transition:all .2s;-moz-transition:all .2s;-o-transition:all .2s;-ms-transition:all .2s;transition:all .2s;opacity:0;filter:alpha(opacity=0)}.crellyslider:hover>.cs-controls,.crellyslider:hover>.cs-navigation{opacity:1;filter:alpha(opacity=100)}.crellyslider>.cs-slides{list-style:none;margin:0;padding:0}.crellyslider>.cs-slides>.cs-slide{margin:0;padding:0;position:absolute;overflow:hidden;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.crellyslider>.cs-slides>.cs-slide>.cs-background-link{opacity:0;z-index:0;padding:0;width:100%!important;height:100%!important;top:0!important;left:0!important}.crellyslider>.cs-slides>.cs-slide>*{position:absolute;display:block;cursor:default;-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;font-size:14px}.crellyslider>.cs-slides>.cs-slide>a{cursor:pointer}.crellyslider>.cs-slides>.cs-slide>a>img,.crellyslider>.cs-slides>.cs-slide>img{max-width:none!important}.crellyslider>.cs-slides>.cs-slide a,.crellyslider>.cs-slides>.cs-slide>a>img{text-decoration:none;outline:0;border:none}.crellyslider>.cs-controls{position:absolute;width:100%;top:50%;margin-top:-9px}.crellyslider>.cs-controls>.cs-next,.crellyslider>.cs-controls>.cs-previous{display:block;width:35px;height:35px;position:absolute;cursor:pointer;background-color:#fff;border-radius:50%}.crellyslider>.cs-controls>.cs-previous{background-image:url(../images/arrow-left.png);left:30px}.crellyslider>.cs-controls>.cs-next{background-image:url(../images/arrow-right.png);right:30px}.crellyslider>.cs-navigation{position:absolute;width:100%;height:0;bottom:40px;text-align:center}.crellyslider>.cs-navigation>.cs-slide-link{width:15px;height:15px;display:inline-block;cursor:pointer;margin:6px;background-color:#fff;box-shadow:0 3px 10px rgba(0,0,0,.16),0 3px 10px rgba(0,0,0,.23);border:10px;border-radius:50%;opacity:.5;filter:alpha(opacity=50)}.crellyslider>.cs-navigation>.cs-slide-link.cs-active{opacity:1;filter:alpha(opacity=100)}.crellyslider>.cs-progress-bar{width:0%;height:4px;position:absolute;top:0;background-color:#fff;opacity:.5;filter:alpha(opacity=50);z-index:999}.crellyslider>.cs-progress-bar.cs-progress-bar-hidden{opacity:0;filter:alpha(opacity=0)}
js/jquery.crellyslider.js CHANGED
@@ -1,2268 +1,2268 @@
1
- /**
2
- * Plugin Name: Crelly Slider
3
- * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
- * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.6
6
- * Author: Fabio Rinaldi
7
- * Author URI: https://github.com/fabiorino
8
- * License: MIT
9
- */
10
-
11
- /*************/
12
- /** GLOBALS **/
13
- /*************/
14
-
15
- // Using these two variables we can check if we still need to load the APIs for YouTube and Vimeo
16
- var crellyslider_youtube_api_ready = false;
17
- var crellyslider_vimeo_api_ready = false;
18
-
19
- (function($) {
20
-
21
- /************************/
22
- /** EXTERNAL RESOURCES **/
23
- /************************/
24
-
25
- // Custom build of jQuery mobile. I need it for swipeleft and swiperight
26
- (function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout(function(){c=0,O()},e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}function j(e){if(g)return;d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),!r&&o===e.target?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
27
-
28
- // YouTube API:
29
- function loadYoutubeAPI() {
30
- var tag = document.createElement('script');
31
- tag.src = "https://www.youtube.com/iframe_api";
32
- var firstScriptTag = document.getElementsByTagName('script')[0];
33
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
34
-
35
- crellyslider_youtube_api_ready = true;
36
- }
37
-
38
- // Vimeo API
39
- function loadVimeoAPI() {
40
- var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
41
- return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1;
42
- var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=
43
- window.$f=e}();
44
-
45
- crellyslider_vimeo_api_ready = true;
46
- }
47
-
48
- /*******************/
49
- /** CRELLY SLIDER **/
50
- /*******************/
51
-
52
- $.CrellySlider = function(target, settings) {
53
-
54
- /**********************/
55
- /** USEFUL VARIABLES **/
56
- /**********************/
57
-
58
- // HTML classes of the slider
59
- var SLIDER = $(target);
60
- var CRELLY = 'div.crellyslider';
61
- var SLIDES = 'ul.cs-slides';
62
- var SLIDE = 'li.cs-slide';
63
- var ELEMENTS = '> *';
64
-
65
- var total_slides;
66
- var current_slide = 0;
67
-
68
- var paused = false;
69
- var can_pause = false; // Also used as "can change slide"
70
- var prevent_hover_interactions = 0; // Allow the user to trigger an action on mouse over. This is used to prevent the slider from resuming while watching a video
71
- var executed_slide = false; // Will be true as soon as the current slide is executed
72
- var first_play = true;
73
-
74
- // Slide timer: only current slide. Elements timers: all the elements. This prevents conflicts during changes and pauses
75
- var current_slide_time_timer = new Timer(function() {}, 0);
76
- var elements_times_timers = new Array();
77
- var elements_delays_timers = new Array();
78
-
79
- // The arrays "link" every DOM iframe element to its player element that can interact with APIs
80
- var youtube_videos = {};
81
- var vimeo_videos = {};
82
-
83
- var scale = 1;
84
- var window_width_before_setResponsive = 0; // This variable is useful ONLY to prevent that window.resize fires on vertical resizing or on a right window width
85
-
86
- /********************/
87
- /** INITIALIZATION **/
88
- /********************/
89
-
90
- // EVERYTHING BEGINS HERE
91
-
92
- // Load necessary APIs
93
- if(! crellyslider_youtube_api_ready && thereAreVideos('youtube')) {
94
- loadYoutubeAPI();
95
- }
96
- if(! crellyslider_vimeo_api_ready && thereAreVideos('vimeo')) {
97
- loadVimeoAPI();
98
- }
99
-
100
- // Before initializing Crelly Slider, we have to wait for the YouTube API. I use the setInterval method to prevent compatibility issues with other plugins and to be sure that, if there is more than a slider loaded on the page, everything works
101
- if(crellyslider_youtube_api_ready && (typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined')) {
102
- var temp = setInterval(function() {
103
- if(typeof(YT) != 'undefined' && typeof(YT.Player) != 'undefined') {
104
- clearInterval(temp);
105
- init();
106
- }
107
- }, 100);
108
- }
109
- else {
110
- init();
111
- }
112
-
113
- // Returns an array like this: {youtube = true, vimeo = false} if there are YouTube videos but not Vimeo videos
114
- // This function can be called before init()
115
- function thereAreVideos(platform) {
116
- if(platform == 'youtube') {
117
- return SLIDER.find('.cs-yt-iframe').length > 0 ? true : false;
118
- }
119
- if(platform == 'vimeo') {
120
- return SLIDER.find('.cs-vimeo-iframe').length > 0 ? true : false;
121
- }
122
-
123
- return -1;
124
- }
125
-
126
- // The slider constructor: runs automatically only the first time, sets the basic needs of the slider and the preloader then runs Crelly Slider
127
- function init() {
128
- // Add wrappers and classes
129
- SLIDER.wrapInner('<div class="crellyslider" />');
130
- SLIDER.find(CRELLY + ' > ul').addClass('cs-slides');
131
- SLIDER.find(CRELLY + ' ' + SLIDES + ' > li').addClass('cs-slide');
132
-
133
- // Set total_slides
134
- total_slides = getSlides().length;
135
-
136
- // If the slider is empty, stop
137
- if(total_slides == 0) {
138
- return false;
139
- }
140
-
141
- // If there is only a slide, clone it
142
- if(total_slides == 1) {
143
- var clone = getSlide(0);
144
- var prepend = SLIDER.find(CRELLY).find(SLIDES);
145
- clone.clone().prependTo(prepend);
146
- total_slides++;
147
- }
148
-
149
- orderSlides();
150
-
151
- // Show controls (previous and next arrows)
152
- if(settings.showControls) {
153
- SLIDER.find(CRELLY).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>');
154
- }
155
-
156
- // Show navigation
157
- if(settings.showNavigation) {
158
- var nav = '<div class="cs-navigation">';
159
- for(var i = 0; i < total_slides; i++) {
160
- nav += '<span class="cs-slide-link"></span>';
161
- }
162
- nav += '</div>';
163
- SLIDER.find(CRELLY).append(nav);
164
- }
165
-
166
- // Show progress bar
167
- if(settings.showProgressBar) {
168
- SLIDER.find(CRELLY).append('<div class="cs-progress-bar"></div>');
169
- }
170
- else {
171
- SLIDER.find(CRELLY).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>');
172
- }
173
-
174
- // Display slider
175
- SLIDER.css('display', 'block');
176
-
177
- // Set layout for the first time
178
- if(settings.responsive) {
179
- setScale();
180
- }
181
- setLayout();
182
-
183
- // Set slides links
184
- getSlides().find('.cs-background-link')
185
- .html(' ')
186
- .data({
187
- 'left' : 0,
188
- 'top' : 0,
189
- 'in' : 'none',
190
- 'out' : 'none',
191
- 'easeIn' : 0,
192
- 'easeOut' : 0,
193
- 'delay' : 0,
194
- 'time' : 'all',
195
- });
196
-
197
- setPreloader();
198
-
199
- initVideos().done(function() {
200
- // Timeout needed to prevent compatibility issues
201
- var loading = setInterval(function() {
202
- if(document.readyState == 'complete' && SLIDER.find(CRELLY).find('.cs-preloader').length > 0) { // If window.load and preloader is loaded
203
- clearInterval(loading);
204
- loadedWindow();
205
- }
206
- }, 100);
207
- });
208
- }
209
-
210
- // Orders the slides by rearranging them in the DOM
211
- function orderSlides() {
212
- // If randomOrder is disabled and the initial slide is the first, the slides are already ordered
213
- if(! settings.randomOrder && settings.startFromSlide == 0) {
214
- return;
215
- }
216
-
217
- var slides_order = new Array();
218
- var ordered_slides = new Array();
219
-
220
- // Set the first slide according to the settings
221
- if(settings.startFromSlide == -1) {
222
- var index = Math.floor((Math.random() * total_slides));
223
- slides_order[0] = index;
224
- ordered_slides[0] = getSlide(index);
225
- }
226
- else {
227
- slides_order[0] = settings.startFromSlide;
228
- ordered_slides[0] = getSlide(settings.startFromSlide);
229
- }
230
-
231
- // Set all the other slides
232
- for(var i = 1; i < total_slides; i++) {
233
- var index;
234
-
235
- if(settings.randomOrder) { // Get a random slide index that was never generated before
236
- do {
237
- index = Math.floor((Math.random() * total_slides));
238
- } while(slides_order.indexOf(index) != -1);
239
- }
240
- else { // Get the next index
241
- if(i + slides_order[0] < total_slides) {
242
- index = i + slides_order[0];
243
- }
244
- else {
245
- index = i + slides_order[0] - total_slides;
246
- }
247
- }
248
-
249
- slides_order[i] = index;
250
- ordered_slides[i] = getSlide(index);
251
- }
252
-
253
- // Delete all the slides
254
- SLIDER.find(CRELLY).find(SLIDES).empty();
255
-
256
- // Put the slides that are now ordered
257
- for(var i = 0; i < total_slides; i++) {
258
- SLIDER.find(CRELLY).find(SLIDES).append(ordered_slides[i]);
259
- }
260
- }
261
-
262
- // Inits Youtube and Vimeo videos
263
- function initVideos() {
264
- var def = new $.Deferred();
265
- var total_iframes = getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').length;
266
- var loaded_iframes = 0;
267
-
268
- if(total_iframes == 0) {
269
- return def.resolve().promise();
270
- }
271
-
272
- // When iframes are loaded...
273
- getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').each(function() {
274
- var iframe = $(this);
275
-
276
- iframe.one('load', function() {
277
- loaded_iframes++;
278
- if(loaded_iframes == total_iframes) {
279
- // ...init videos
280
- initYoutubeVideos().done(function() {
281
- initVimeoVideos().done(function() {
282
- def.resolve();
283
- });
284
- });
285
- }
286
- })
287
- });
288
-
289
- return def.promise();
290
- }
291
-
292
- // Generates an unique id for each youtube iframe, then links them to a new YouTube player
293
- function initYoutubeVideos() {
294
- var def = new $.Deferred();
295
- var slides = getSlides();
296
- var total_yt_videos = slides.find(ELEMENTS + '.cs-yt-iframe').length;
297
- var loaded_videos = 0;
298
- var temp;
299
-
300
- if(total_yt_videos == 0) {
301
- return def.resolve().promise();
302
- }
303
-
304
- slides.each(function() {
305
- var slide = $(this);
306
- var elements = slide.find(ELEMENTS + '.cs-yt-iframe');
307
-
308
- elements.each(function() {
309
- var element = $(this);
310
-
311
- element.uniqueId();
312
- element.attr('id', 'cs-yt-iframe-' + element.attr('id'));
313
-
314
- var player = new YT.Player(element.attr('id'), {
315
- events: {
316
- 'onReady' : function() {
317
- if(getItemData(element, 'start-mute')) {
318
- player.mute();
319
- }
320
- loaded_videos++;
321
- if(loaded_videos == total_yt_videos) {
322
- def.resolve();
323
- }
324
- },
325
-
326
- 'onStateChange' : function(e) {
327
- if(can_pause) {
328
- if(e.data === YT.PlayerState.PAUSED) {
329
- youtube_videos[element.attr('id')].manually_paused = true;
330
- }
331
- if(e.data === YT.PlayerState.PLAYING) {
332
- youtube_videos[element.attr('id')].manually_paused = false;
333
- }
334
- }
335
-
336
- if(e.data === YT.PlayerState.PLAYING) {
337
- if(getItemData(element, 'pause-while-watching')) {
338
- prevent_hover_interactions = true;
339
- pause();
340
- }
341
- }
342
- else if(e.data === YT.PlayerState.PAUSED || e.data === YT.PlayerState.ENDED) {
343
- if(!watchingAndWait()) {
344
- prevent_hover_interactions = false;
345
- resume();
346
- }
347
- }
348
- },
349
- },
350
- });
351
-
352
- temp = {
353
- player : player,
354
- played_once : false,
355
- manually_paused : false,
356
- };
357
-
358
- youtube_videos[element.attr('id')] = temp;
359
- });
360
- });
361
-
362
- return def.promise();
363
- }
364
-
365
- // Generates an unique id for each Vimeo iframe, then links them to a new Vimeo player
366
- function initVimeoVideos() {
367
- var def = new $.Deferred();
368
- var slides = getSlides();
369
- var total_vimeo_videos = slides.find(ELEMENTS + '.cs-vimeo-iframe').length;
370
- var loaded_videos = 0;
371
- var temp;
372
-
373
- if(total_vimeo_videos == 0) {
374
- return def.resolve().promise();
375
- }
376
-
377
- slides.each(function() {
378
- var slide = $(this);
379
- var elements = slide.find(ELEMENTS + '.cs-vimeo-iframe');
380
-
381
- elements.each(function() {
382
- var element = $(this);
383
-
384
- element.uniqueId();
385
- element.attr('id', 'cs-vimeo-iframe-' + element.attr('id'));
386
- element.attr('src', element.attr('src') + '&player_id=' + element.attr('id'));
387
-
388
- var player = $f(element[0]);
389
-
390
- player.addEvent('ready', function() {
391
- if(getItemData(element, 'start-mute')) {
392
- player.api('setVolume', 0);
393
- }
394
-
395
- player.addEvent('finish', function() {
396
- vimeo_videos[element.attr('id')].ended = true;
397
- vimeo_videos[element.attr('id')].playing = false;
398
-
399
- if(!watchingAndWait()) {
400
- prevent_hover_interactions = false;
401
- resume();
402
- }
403
- });
404
-
405
- player.addEvent('play', function() {
406
- vimeo_videos[element.attr('id')].played_once = true;
407
- vimeo_videos[element.attr('id')].ended = false;
408
- vimeo_videos[element.attr('id')].playing = true;
409
-
410
- if(can_pause) {
411
- vimeo_videos[element.attr('id')].manually_paused = false;
412
- }
413
-
414
- if(getItemData(element, 'pause-while-watching')) {
415
- prevent_hover_interactions = true;
416
- pause();
417
- }
418
- });
419
-
420
- player.addEvent('pause', function() {
421
- if(can_pause) {
422
- vimeo_videos[element.attr('id')].manually_paused = true;
423
- }
424
- vimeo_videos[element.attr('id')].playing = false;
425
-
426
- if(!watchingAndWait()) {
427
- prevent_hover_interactions = false;
428
- resume();
429
- }
430
- });
431
-
432
- if(getItemData(element, 'loop')) {
433
- player.api('setLoop', true);
434
- }
435
-
436
- loaded_videos++;
437
- if(loaded_videos == total_vimeo_videos) {
438
- def.resolve();
439
- }
440
- });
441
-
442
- temp = {
443
- player : player,
444
- played_once : false,
445
- ended : false,
446
- manually_paused : false,
447
- playing : false,
448
- };
449
-
450
- vimeo_videos[element.attr('id')] = temp;
451
- });
452
- });
453
-
454
- return def.promise();
455
- }
456
-
457
- // Does operations after window.load is complete. Need to do it as a function for back-end compatibility
458
- function loadedWindow() {
459
- // Set layout for the second time
460
- if(settings.responsive) {
461
- setScale();
462
- }
463
- setLayout();
464
-
465
- window_width_before_setResponsive = $(window).width();
466
-
467
- initProperties();
468
-
469
- addListeners();
470
-
471
- unsetPreloader();
472
-
473
- settings.beforeStart();
474
-
475
- // Positions and responsive dimensions then run
476
- if(settings.responsive) {
477
- setResponsive();
478
- }
479
- else {
480
- play();
481
- }
482
- }
483
-
484
- // Stores original slides, elements and elements contents values then hides all the slides
485
- function initProperties() {
486
- getSlides().each(function() {
487
- var slide = $(this);
488
-
489
- slide.find(ELEMENTS).each(function() {
490
- var element = $(this);
491
-
492
- element.find('*').each(function() {
493
- var element_content = $(this);
494
- setElementData(element_content);
495
- });
496
-
497
- setElementData(element);
498
- });
499
-
500
- slide.css('display', 'none');
501
- slide.data('opacity', parseFloat(slide.css('opacity')));
502
- });
503
- }
504
-
505
- // Initializes the element with original values
506
- function setElementData(element) {
507
- element.data('width', parseFloat(element.width()));
508
- element.data('height', parseFloat(element.height()));
509
- element.data('letter-spacing', parseFloat(element.css('letter-spacing')));
510
- element.data('font-size', parseFloat(element.css('font-size')));
511
-
512
- if(element.css('line-height').slice(-2).toLowerCase() == 'px') {
513
- // if pixel values are given, use those
514
- element.data('line-height', parseFloat(element.css('line-height')));
515
- }
516
- else if(element.css('line-height') == 'normal') {
517
- // if the browser returns 'normal' then use a default factor of 1.15 * font-size
518
- // see: http://meyerweb.com/eric/thoughts/2008/05/06/line-height-abnormal/
519
- element.data('line-height', getItemData(element, 'font-size') * 1.15);
520
- }
521
- else {
522
- // otherwise assume that the returned value is a factor and multiply it with the font-size
523
- element.data('line-height', parseFloat(element.css('line-height')) * getItemData(element, 'font-size'));
524
- }
525
-
526
- element.data('padding-top', parseFloat(element.css('padding-top')));
527
- element.data('padding-right', parseFloat(element.css('padding-right')));
528
- element.data('padding-bottom', parseFloat(element.css('padding-bottom')));
529
- element.data('padding-left', parseFloat(element.css('padding-left')));
530
- element.data('opacity', parseFloat(element.css('opacity')));
531
- }
532
-
533
- // Sets all listeners for the user interaction
534
- function addListeners() {
535
- // Make responsive. Run if resizing horizontally and the slider is not at the right dimension
536
- if(settings.responsive) {
537
- $(window).resize(function() {
538
- if(window_width_before_setResponsive != $(window).width() && ((settings.layout == 'full-width' && getWidth() != $(SLIDER).width()) || ($(SLIDER).width() < getWidth() || (($(SLIDER).width() > getWidth()) && getWidth() < settings.startWidth)))) {
539
- setResponsive();
540
- }
541
- });
542
- }
543
-
544
- // Compatibility with Popup Maker (https://wordpress.org/plugins/popup-maker/)
545
- /*$(document).on('pumAfterOpen', '.pum', function() {
546
- if($(this).find(CRELLY).length > 0) {
547
- setResponsive();
548
- }
549
- });*/
550
-
551
- // Previous control click
552
- SLIDER.find(CRELLY).find('.cs-controls > .cs-previous').click(function() {
553
- changeSlide(getPreviousSlide());
554
- });
555
-
556
- // Next Control click
557
- SLIDER.find(CRELLY).find('.cs-controls > .cs-next').click(function() {
558
- changeSlide(getNextSlide());
559
- });
560
-
561
- // Swipe and drag
562
- if(settings.enableSwipe) {
563
- SLIDER.find(CRELLY).on('swipeleft', function() {
564
- resume();
565
- changeSlide(getNextSlide());
566
- });
567
-
568
- SLIDER.find(CRELLY).on('swiperight', function() {
569
- resume();
570
- changeSlide(getPreviousSlide());
571
- });
572
- }
573
-
574
- // Navigation link click
575
- SLIDER.find(CRELLY).find('.cs-navigation > .cs-slide-link').click(function() {
576
- changeSlide($(this).index());
577
- });
578
-
579
- // Pause on hover
580
- if(settings.pauseOnHover) {
581
- SLIDER.find(CRELLY).find(SLIDES).hover(function() {
582
- if(prevent_hover_interactions == 0) {
583
- pause();
584
- }
585
- });
586
-
587
- SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
588
- if(prevent_hover_interactions == 0) {
589
- resume();
590
- }
591
- });
592
- }
593
- }
594
-
595
- // Hides the unnecessary divs and sets the blurred preloader and the gif spinner
596
- function setPreloader() {
597
- // Setup
598
- SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'hidden');
599
- SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'none');
600
- SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'none');
601
- SLIDER.find(CRELLY).find('.cs-controls').css('display', 'none');
602
-
603
- // Get the URL of the background image of the first slide
604
- var img_url = getSlide(0).css('background-image');
605
- img_url = img_url.replace(/^url\(["']?/, '').replace(/["']?\)$/, '');
606
-
607
- if(! img_url.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)) { // If there isn't a background image
608
- addPreloaderHTML();
609
- }
610
- else {
611
- // When the background image of the first slide is loaded
612
- $('<img>')
613
- .load(function() {
614
- addPreloaderHTML();
615
- })
616
- .attr('src', img_url)
617
- .each(function() {
618
- if(this.complete) {
619
- $(this).load();
620
- }
621
- });
622
- }
623
-
624
- function addPreloaderHTML() {
625
- // Add preloader
626
- SLIDER.find(CRELLY).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>');
627
-
628
- // Set background. Background is set to both the preloader div and the bg div to fix the CSS blur effect
629
- SLIDER.find(CRELLY).find('.cs-preloader').css({
630
- 'background-color' : getSlide(current_slide).css('background-color'),
631
- 'background-image' : getSlide(current_slide).css('background-image'),
632
- 'background-position' : getSlide(current_slide).css('background-position'),
633
- 'background-repeat' : getSlide(current_slide).css('background-repeat'),
634
- 'background-size' : getSlide(current_slide).css('background-size'),
635
- });
636
- SLIDER.find(CRELLY).find('.cs-preloader > .cs-bg').css({
637
- 'background-color' : getSlide(current_slide).css('background-color'),
638
- 'background-image' : getSlide(current_slide).css('background-image'),
639
- 'background-position' : getSlide(current_slide).css('background-position'),
640
- 'background-repeat' : getSlide(current_slide).css('background-repeat'),
641
- 'background-size' : getSlide(current_slide).css('background-size'),
642
- });
643
- }
644
- }
645
-
646
- // Shows the necessary divs and fades out the preloader
647
- function unsetPreloader() {
648
- // Setup
649
- SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'visible');
650
- SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'block');
651
- SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'block');
652
- SLIDER.find(CRELLY).find('.cs-controls').css('display', 'block');
653
-
654
- // Display the first slide to avoid the slide in animation
655
- slideIn(getSlide(0));
656
- getSlide(0).finish();
657
-
658
- // Fade out
659
- SLIDER.find(CRELLY).find('.cs-preloader').animate({
660
- 'opacity' : 0,
661
- }, 300, function() {
662
- SLIDER.find(CRELLY).find('.cs-preloader').remove();
663
- });
664
- }
665
-
666
- /*******************************/
667
- /** LAYOUT AND RESPONSIVENESS **/
668
- /*******************************/
669
-
670
- // Sets slider and slides. Width and height are scaled
671
- function setLayout() {
672
- var layout = settings.layout;
673
- var width, height;
674
-
675
- switch(layout) {
676
- case 'fixed':
677
- width = settings.startWidth;
678
- height = settings.startHeight;
679
- SLIDER.find(CRELLY).css({
680
- 'width' : getScaled(width),
681
- 'height' : getScaled(height),
682
- });
683
- getSlides().css({
684
- 'width' : getScaled(width),
685
- 'height' : getScaled(height),
686
- });
687
- break;
688
-
689
- case 'full-width':
690
- width = SLIDER.width();
691
- height = settings.startHeight;
692
- SLIDER.find(CRELLY).css({
693
- 'width' : width,
694
- 'height' : getScaled(height),
695
- });
696
- getSlides().css({
697
- 'width' : width,
698
- 'height' : getScaled(height),
699
- });
700
- break;
701
- default:
702
- return false;
703
- break;
704
- }
705
- }
706
-
707
- // Returns the element top end left gaps (when the slider is full-width is very useful)
708
- function getLayoutGaps(element) {
709
- var top_gap = (getHeight() - settings.startHeight) / 2;
710
- var left_gap = (getWidth() - settings.startWidth) / 2;
711
-
712
- var new_top = 0;
713
- var new_left = 0;
714
-
715
- if(top_gap > 0) {
716
- new_top = top_gap;
717
- }
718
- if(left_gap > 0) {
719
- new_left = left_gap;
720
- }
721
-
722
- return {
723
- top: new_top,
724
- left: new_left,
725
- };
726
- }
727
-
728
- // Scales every element to make it responsive. It automatically restarts the current slide
729
- function setResponsive() {
730
- settings.beforeSetResponsive();
731
-
732
- var slides = getSlides();
733
-
734
- stop(true);
735
-
736
- slides.each(function() {
737
- var slide = $(this);
738
- var elements = slide.find(ELEMENTS);
739
-
740
- slide.finish();
741
- slideIn(slide);
742
- slide.finish();
743
-
744
- elements.each(function() {
745
- var element = $(this);
746
-
747
- element.finish();
748
- elementIn(element);
749
- element.finish();
750
-
751
- if(isVideo(element)) {
752
- pauseVideo(element);
753
- }
754
- });
755
- });
756
-
757
- setScale();
758
-
759
- setLayout();
760
-
761
- slides.each(function() {
762
- var slide = $(this);
763
- var elements = slide.find(ELEMENTS);
764
-
765
- elements.each(function() {
766
- var element = $(this);
767
-
768
- element.find('*').each(function() {
769
- var element_content = $(this);
770
- scaleElement(element_content);
771
- });
772
-
773
- scaleElement(element);
774
-
775
- element.finish();
776
- elementOut(element);
777
- element.finish();
778
-
779
- if(isVideo(element)) {
780
- pauseVideo(element);
781
- }
782
- });
783
-
784
- slide.finish();
785
- slideOut(slide);
786
- slide.finish();
787
- });
788
-
789
- window_width_before_setResponsive = $(window).width();
790
-
791
- play();
792
- }
793
-
794
- // Scales a text or an image and their contents
795
- function scaleElement(element) {
796
- // Standard element
797
- element.css({
798
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top),
799
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left),
800
- 'padding-top' : getScaled(getItemData(element, 'padding-top')),
801
- 'padding-right' : getScaled(getItemData(element, 'padding-right')),
802
- 'padding-bottom' : getScaled(getItemData(element, 'padding-bottom')),
803
- 'padding-left' : getScaled(getItemData(element, 'padding-left')),
804
- });
805
-
806
- // Element contains text
807
- if(element.is('input') || element.is('button') || element.text().trim().length) {
808
- element.css({
809
- 'line-height' : getScaled(getItemData(element, 'line-height')) + 'px',
810
- 'letter-spacing' : getScaled(getItemData(element, 'letter-spacing')),
811
- 'font-size' : getScaled(getItemData(element, 'font-size')),
812
- });
813
- }
814
-
815
- // Element doesn't contain text (like images or iframes)
816
- else {
817
- element.css({
818
- 'width' : getScaled(getItemData(element, 'width')),
819
- 'height' : getScaled(getItemData(element, 'height')),
820
- });
821
- }
822
- }
823
-
824
- // Using the start dimensions, sets how the slider and it's elements should be scaled
825
- function setScale() {
826
- var slider_width = SLIDER.width();
827
- var start_width = settings.startWidth;
828
-
829
- if(slider_width >= start_width || ! settings.responsive) {
830
- scale = 1;
831
- }
832
- else {
833
- scale = slider_width / start_width;
834
- }
835
- }
836
-
837
- // Using the current scale variable, returns the value that receives correctly scaled. Remember to always use getScaled() to get positions & dimensions of the elements
838
- function getScaled(value) {
839
- return value * scale;
840
- }
841
-
842
- /*********************/
843
- /** SLIDER COMMANDS **/
844
- /*********************/
845
-
846
- // Runs Crelly from the current slide
847
- function play() {
848
- if(settings.automaticSlide) {
849
- loopSlides();
850
- }
851
- else {
852
- executeSlide(current_slide);
853
- }
854
-
855
- first_play = false;
856
- }
857
-
858
- // Stops all the slides and the elements and resets the progress bar
859
- function stop(finish_queues) {
860
- for(var i = 0; i < elements_times_timers.length; i++) {
861
- elements_times_timers[i].clear();
862
- }
863
-
864
- for(var i = 0; i < elements_delays_timers.length; i++) {
865
- elements_delays_timers[i].clear();
866
- }
867
-
868
- current_slide_time_timer.clear();
869
-
870
- getSlides().each(function() {
871
- var temp_slide = $(this);
872
- if(finish_queues) {
873
- temp_slide.finish();
874
- }
875
- else {
876
- temp_slide.stop(true, true);
877
- }
878
- temp_slide.find(ELEMENTS).each(function() {
879
- var temp_element = $(this);
880
- if(finish_queues) {
881
- temp_element.finish();
882
- }
883
- else {
884
- temp_element.stop(true, true);
885
- }
886
- });
887
- });
888
-
889
- resetProgressBar();
890
- }
891
-
892
- // Stops the progress bar and the slide time timer
893
- function pause() {
894
- if(! paused && can_pause) {
895
- settings.beforePause();
896
-
897
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
898
- progress_bar.stop(true);
899
- current_slide_time_timer.pause();
900
-
901
- paused = true;
902
- }
903
- }
904
-
905
- // Animates until the end the progress bar and resumes the current slide time timer
906
- function resume() {
907
- if(paused && can_pause) {
908
- settings.beforeResume();
909
-
910
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
911
- var slide_time = getItemData(getSlide(current_slide), 'time');
912
- var remained_delay = current_slide_time_timer.getRemaining();
913
-
914
- progress_bar.animate({
915
- 'width' : '100%',
916
- }, remained_delay);
917
-
918
- current_slide_time_timer.resume();
919
-
920
- paused = false;
921
- }
922
- }
923
-
924
- /****************************************/
925
- /** SLIDER OR SLIDES DATAS / UTILITIES **/
926
- /****************************************/
927
-
928
- // Returns the Crelly Slider container width
929
- function getWidth() {
930
- return SLIDER.find(CRELLY).width();
931
- }
932
-
933
- // Returns the Crelly Slider container height
934
- function getHeight() {
935
- return SLIDER.find(CRELLY).height();
936
- }
937
-
938
- // Returns the index of the next slide
939
- function getNextSlide() {
940
- if(current_slide + 1 == total_slides) {
941
- return 0;
942
- }
943
- return current_slide + 1;
944
- }
945
-
946
- // Returns the index of the previous slide
947
- function getPreviousSlide() {
948
- if(current_slide - 1 < 0) {
949
- return total_slides - 1;
950
- }
951
- return current_slide - 1;
952
- }
953
-
954
- // Returns a "data" of an item (slide or element). If is an integer || float, returns the parseInt() || parseFloat() of it. If the slide or the element has no data returns the default value
955
- function getItemData(item, data) {
956
- var is_slide;
957
-
958
- if(item.parent('ul').hasClass('cs-slides')) {
959
- is_slide = true;
960
- }
961
- else {
962
- is_slide = false;
963
- }
964
-
965
- switch(data) {
966
- case 'ease-in' :
967
- if(is_slide) {
968
- return isNaN(parseInt(item.data(data))) ? settings.slidesEaseIn : parseInt(item.data(data));
969
- }
970
- else {
971
- return isNaN(parseInt(item.data(data))) ? settings.elementsEaseIn : parseInt(item.data(data));
972
- }
973
- break;
974
-
975
- case 'ease-out' :
976
- if(is_slide) {
977
- return isNaN(parseInt(item.data(data))) ? settings.slidesEaseOut : parseInt(item.data(data));
978
- }
979
- else {
980
- return isNaN(parseInt(item.data(data))) ? settings.elementsEaseOut : parseInt(item.data(data));
981
- }
982
- break;
983
-
984
- case 'delay' :
985
- return isNaN(parseInt(item.data(data))) ? settings.elementsDelay : parseInt(item.data(data));
986
-
987
- break;
988
-
989
- case 'time' :
990
- if(is_slide) {
991
- return isNaN(parseInt(item.data(data))) ? settings.slidesTime : parseInt(item.data(data));
992
- }
993
- else {
994
- if(item.data(data) == 'all') {
995
- return 'all';
996
- }
997
- else {
998
- return isNaN(parseInt(item.data(data))) ? settings.itemsTime : parseInt(item.data(data));
999
- }
1000
- }
1001
- break;
1002
-
1003
- case 'ignore-ease-out' :
1004
- if(parseInt(item.data(data)) == 1) {
1005
- return true;
1006
- }
1007
- else if(parseInt(item.data(data)) == 0) {
1008
- return false;
1009
- }
1010
- return settings.ignoreElementsEaseOut;
1011
- break;
1012
-
1013
- case 'autoplay' :
1014
- if(parseInt(item.data(data)) == 1) {
1015
- return true;
1016
- }
1017
- else if(parseInt(item.data(data)) == 0) {
1018
- return false;
1019
- }
1020
- return settings.videoAutoplay;
1021
- break;
1022
-
1023
- case 'loop' :
1024
- if(parseInt(item.data(data)) == 1) {
1025
- return true;
1026
- }
1027
- else if(parseInt(item.data(data)) == 0) {
1028
- return false;
1029
- }
1030
- return settings.videoLoop;
1031
- break;
1032
-
1033
- case 'start-mute' :
1034
- if(parseInt(item.data(data)) == 1) {
1035
- return true;
1036
- }
1037
- else if(parseInt(item.data(data)) == 0) {
1038
- return false;
1039
- }
1040
- return settings.videoStartMute;
1041
- break;
1042
-
1043
- case 'pause-while-watching' :
1044
- if(parseInt(item.data(data)) == 1) {
1045
- return true;
1046
- }
1047
- else if(parseInt(item.data(data)) == 0) {
1048
- return false;
1049
- }
1050
- return settings.videoPauseWhileWatching;
1051
- break;
1052
-
1053
- case 'top' :
1054
- case 'left' :
1055
- case 'width' :
1056
- case 'height' :
1057
- case 'padding-top' :
1058
- case 'padding-right' :
1059
- case 'padding-bottom' :
1060
- case 'padding-left' :
1061
- case 'line-height' :
1062
- case 'letter-spacing' :
1063
- case 'font-size' :
1064
- return isNaN(parseFloat(item.data(data))) ? 0 : parseFloat(item.data(data));
1065
- break;
1066
-
1067
- case 'in' :
1068
- case 'out' :
1069
- case 'opacity' :
1070
- return item.data(data);
1071
- break;
1072
-
1073
- default :
1074
- return false;
1075
- break;
1076
- }
1077
- }
1078
-
1079
- // Returns the slides DOM elements
1080
- function getSlides() {
1081
- return SLIDER.find(CRELLY).find(SLIDES).find(SLIDE);
1082
- }
1083
-
1084
- // Returns the slide DOM element
1085
- function getSlide(slide_index) {
1086
- return getSlides().eq(slide_index);
1087
- }
1088
-
1089
- // Timeout with useful methods
1090
- function Timer(callback, delay) {
1091
- var id;
1092
- var start;
1093
- var remaining = delay;
1094
-
1095
- this.pause = function() {
1096
- clearTimeout(id);
1097
- remaining -= new Date() - start;
1098
- };
1099
-
1100
- this.resume = function() {
1101
- start = new Date();
1102
- clearTimeout(id);
1103
- id = window.setTimeout(function() {
1104
- callback();
1105
- }, remaining);
1106
- };
1107
-
1108
- this.clear = function () {
1109
- clearTimeout(id);
1110
- };
1111
-
1112
- // For now, works only after this.pause(). No need to calculate in other moments
1113
- this.getRemaining = function() {
1114
- return remaining;
1115
- };
1116
-
1117
- this.resume();
1118
- }
1119
-
1120
- // Returns true if the user is using a mobile browser
1121
- function isMobile() {
1122
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1123
- }
1124
-
1125
- /*****************/
1126
- /** SLIDER CORE **/
1127
- /*****************/
1128
-
1129
- // Loops trough the slides
1130
- function loopSlides() {
1131
- executeSlide(current_slide).done(function() {
1132
- if(! paused) {
1133
- current_slide = getNextSlide();
1134
-
1135
- loopSlides();
1136
- }
1137
- });
1138
- }
1139
-
1140
- // Resets the progress bar and draws the progress bar of the current slide
1141
- function drawProgressBar() {
1142
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1143
-
1144
- resetProgressBar();
1145
-
1146
- progress_bar.animate({
1147
- 'width' : '100%',
1148
- }, getItemData(getSlide(current_slide), 'time'));
1149
- }
1150
-
1151
- // Resets the progress bar animation and CSS
1152
- function resetProgressBar() {
1153
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1154
-
1155
- progress_bar.stop();
1156
- progress_bar.css('width', 0);
1157
- }
1158
-
1159
- // Sets the right HTML classes of the navigation links
1160
- function setNavigationLink() {
1161
- var nav = SLIDER.find(CRELLY).find('.cs-navigation');
1162
- var links = nav.find('> .cs-slide-link');
1163
-
1164
- links.each(function() {
1165
- var link = $(this);
1166
-
1167
- if(link.index() == current_slide) {
1168
- link.addClass('cs-active');
1169
- }
1170
- else {
1171
- link.removeClass('cs-active');
1172
- }
1173
- });
1174
- }
1175
-
1176
- // Finishes the current slide (animations out of elements and slide) and then plays the new slide
1177
- function changeSlide(slide_index) {
1178
- if(slide_index == current_slide) {
1179
- return;
1180
- }
1181
-
1182
- if(can_pause || executed_slide) {
1183
- stop(false);
1184
-
1185
- finishSlide(current_slide, false, true).done(function() {
1186
- current_slide = slide_index;
1187
- play();
1188
- });
1189
- }
1190
- }
1191
-
1192
- // Executes a slide completely. If the auto loop is disabled won't animate out the slide and the elements with time == "all"
1193
- function executeSlide(slide_index) {
1194
- settings.beforeSlideStart();
1195
-
1196
- var def = new $.Deferred();
1197
-
1198
- executed_slide = false;
1199
-
1200
- // If something is still animating, reset
1201
- for(var i = 0; i < elements_times_timers.length; i++) {
1202
- elements_times_timers[i].clear();
1203
- }
1204
- for(var i = 0; i < elements_delays_timers.length; i++) {
1205
- elements_delays_timers[i].clear();
1206
- }
1207
- current_slide_time_timer.clear();
1208
- getSlide(slide_index).finish();
1209
- slideOut(slide_index);
1210
- getSlide(slide_index).finish();
1211
- var elements = getSlide(slide_index).find(ELEMENTS);
1212
- elements.each(function() {
1213
- var element = $(this);
1214
- element.finish();
1215
- elementOut(element);
1216
- element.finish();
1217
- });
1218
-
1219
-
1220
- setNavigationLink();
1221
-
1222
- runSlide(slide_index);
1223
-
1224
- if(settings.automaticSlide) {
1225
- finishSlide(slide_index, true, true).done(function() {
1226
- executed_slide = true;
1227
- def.resolve();
1228
- });
1229
- }
1230
- else {
1231
- finishSlide(slide_index, true, false).done(function() {
1232
- executed_slide = true;
1233
- def.resolve();
1234
- });
1235
- }
1236
-
1237
- return def.promise();
1238
- }
1239
-
1240
- // Executes the in animation of the slide and it's elements
1241
- function runSlide(slide_index) {
1242
- var slide = getSlide(slide_index);
1243
- var elements = slide.find(ELEMENTS);
1244
-
1245
- var elements_in_completed = 0;
1246
- var slide_in_completed = false;
1247
-
1248
- var def = new $.Deferred();
1249
-
1250
- can_pause = false;
1251
-
1252
- // Do slide in animation
1253
- slideIn(slide_index).done(function() {
1254
- drawProgressBar();
1255
-
1256
- can_pause = true;
1257
-
1258
- slide_in_completed = true;
1259
- if(slide_in_completed && elements_in_completed == elements.length) {
1260
- def.resolve();
1261
- }
1262
- });
1263
-
1264
- // Do elements in animation
1265
- elements.each(function() {
1266
- var element = $(this);
1267
- var element_delay = getItemData(element, 'delay');
1268
-
1269
- elements_delays_timers.push(new Timer(function() {
1270
- elementIn(element).done(function() {
1271
- if(isVideo(element)) {
1272
- playVideo(element);
1273
- }
1274
-
1275
- elements_in_completed++;
1276
- if(slide_in_completed && elements_in_completed == elements.length) {
1277
- def.resolve();
1278
- }
1279
- });
1280
- }, element_delay));
1281
- });
1282
-
1283
- return def.promise();
1284
- }
1285
-
1286
- // Does all times, elements out animations and slide out animation
1287
- // execute_time, if true, will do the slide and the elements timers. If false, the timers will be = 0 so the plugin will execute the code of the callback function immediately.
1288
- // animate_all_out, if false, will execute the elements with time != all out animations but not the slide and the elements with time == all out animations. If true, executes all the out animations
1289
- function finishSlide(slide_index, execute_time, animate_all_out) {
1290
- var slide = getSlide(slide_index);
1291
- var elements = slide.find(ELEMENTS);
1292
- var data_time = execute_time ? getItemData(slide, 'time') + getItemData(slide, 'ease-in') : 0;
1293
-
1294
- var elements_out_completed = 0;
1295
- var slide_time_completed = false;
1296
-
1297
- var def = new $.Deferred();
1298
-
1299
- // Elements with time != "all"
1300
- elements.each(function() {
1301
- var element = $(this);
1302
- var time = getItemData(element, 'time');
1303
-
1304
- if(time != 'all') {
1305
- var final_element_time = execute_time ? time : 0;
1306
-
1307
- if(getItemData(element, 'ignore-ease-out')) {
1308
- elements_out_completed++;
1309
-
1310
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1311
- pauseVideos(slide_index);
1312
- slideOut(slide_index);
1313
- def.resolve();
1314
- }
1315
- }
1316
-
1317
- elements_times_timers.push(new Timer(function() {
1318
- elementOut(element).done(function() {
1319
- if(! getItemData(element, 'ignore-ease-out')) {
1320
- elements_out_completed++;
1321
-
1322
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1323
- pauseVideos(slide_index);
1324
- slideOut(slide_index);
1325
- def.resolve();
1326
- }
1327
- }
1328
- });
1329
- }, final_element_time));
1330
- }
1331
- });
1332
-
1333
- // Execute slide time
1334
- current_slide_time_timer = new Timer(function() {
1335
- can_pause = false;
1336
-
1337
- resetProgressBar();
1338
-
1339
- slide_time_completed = true;
1340
-
1341
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1342
- pauseVideos(slide_index);
1343
- slideOut(slide_index);
1344
- def.resolve();
1345
- }
1346
-
1347
- if(! animate_all_out) {
1348
- def.resolve();
1349
- }
1350
- else {
1351
- // Elements with time == "all"
1352
- elements.each(function() {
1353
- var element = $(this);
1354
- var time = getItemData(element, 'time');
1355
-
1356
- if(time == 'all') {
1357
- if(getItemData(element, 'ignore-ease-out')) {
1358
- elements_out_completed++;
1359
-
1360
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1361
- pauseVideos(slide_index);
1362
- slideOut(slide_index);
1363
- def.resolve();
1364
- }
1365
- }
1366
-
1367
- elementOut(element).done(function() {
1368
- if(! getItemData(element, 'ignore-ease-out')) {
1369
- elements_out_completed++;
1370
-
1371
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1372
- pauseVideos(slide_index);
1373
- slideOut(slide_index);
1374
- def.resolve();
1375
- }
1376
- }
1377
- });
1378
- }
1379
- });
1380
- }
1381
- }, data_time);
1382
-
1383
- return def.promise();
1384
- }
1385
-
1386
- // VIDEOS FUNCTIONS
1387
-
1388
- // Returns true if the element is a YouTube or a Vimeo iframe
1389
- function isVideo(element) {
1390
- return isYoutubeVideo(element) || isVimeoVideo(element);
1391
- }
1392
-
1393
- // Checks what's the source of the video, then plays it
1394
- function playVideo(element) {
1395
- if(isYoutubeVideo(element)) {
1396
- playYoutubeVideo(element);
1397
- }
1398
- else {
1399
- playVimeoVideo(element);
1400
- }
1401
- }
1402
-
1403
- // Pauses all the YouTube and Vimeo videos
1404
- function pauseVideos(slide_index) {
1405
- pauseYoutubeVideos(slide_index);
1406
- pauseVimeoVideos(slide_index);
1407
- }
1408
-
1409
- // Checks what's the source of the video, then pauses it
1410
- function pauseVideo(element) {
1411
- if(isYoutubeVideo(element)) {
1412
- pauseYoutubeVideo(element);
1413
- }
1414
- else {
1415
- pauseVimeoVideo(element);
1416
- }
1417
- }
1418
-
1419
- // Checks if the element is a YouTube video
1420
- function isYoutubeVideo(element) {
1421
- return element.hasClass('cs-yt-iframe');
1422
- }
1423
-
1424
- // Returns the player associated to the element
1425
- function getYoutubePlayer(element) {
1426
- return youtube_videos[element.attr('id')].player;
1427
- }
1428
-
1429
- /*
1430
- Returns:
1431
- -1 – unstarted
1432
- 0 – ended
1433
- 1 – playing
1434
- 2 – paused
1435
- 3 – buffering
1436
- 5 – video cued
1437
- */
1438
- function getYoutubePlayerState(element) {
1439
- return getYoutubePlayer(element).getPlayerState();
1440
- }
1441
-
1442
- // Checks if the video can be played and plays it
1443
- function playYoutubeVideo(element) {
1444
- // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Youtube's website)
1445
- if(getItemData(element, 'autoplay') && ! youtube_videos[element.attr('id')].played_once && ! isMobile()) {
1446
- getYoutubePlayer(element).playVideo();
1447
- }
1448
-
1449
- // If was paused, but not manually
1450
- if(getYoutubePlayerState(element) == 2 && !youtube_videos[element.attr('id')].manually_paused) {
1451
- getYoutubePlayer(element).playVideo();
1452
- }
1453
-
1454
- youtube_videos[element.attr('id')].played_once = true;
1455
- }
1456
-
1457
- // Pause all the videos in a slide
1458
- function pauseYoutubeVideos(slide_index) {
1459
- getSlide(slide_index).each(function() {
1460
- var slide = $(this);
1461
-
1462
- slide.find(ELEMENTS + '.cs-yt-iframe').each(function() {
1463
- pauseYoutubeVideo($(this));
1464
- });
1465
- });
1466
- }
1467
-
1468
- // Checks if the video can be paused and pauses it
1469
- function pauseYoutubeVideo(element) {
1470
- if(getYoutubePlayerState(element) == 1) {
1471
- getYoutubePlayer(element).pauseVideo();
1472
- }
1473
- }
1474
-
1475
- // Checks if the element is a Vimeo video
1476
- function isVimeoVideo(element) {
1477
- return element.hasClass('cs-vimeo-iframe');
1478
- }
1479
-
1480
- // Returns the player associated to the element
1481
- function getVimeoPlayer(element) {
1482
- return vimeo_videos[element.attr('id')].player;
1483
- }
1484
-
1485
- // Plays the video
1486
- function playVimeoVideo(element) {
1487
- // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Vimeo's website)
1488
- if(getItemData(element, 'autoplay') && ! vimeo_videos[element.attr('id')].played_once && ! isMobile()) {
1489
- getVimeoPlayer(element).api('play');
1490
- }
1491
-
1492
- // If was paused
1493
- if(getVimeoPlayer(element).api('paused') && ! vimeo_videos[element.attr('id')].ended && vimeo_videos[element.attr('id')].played_once && !vimeo_videos[element.attr('id')].manually_paused) {
1494
- getVimeoPlayer(element).api('play');
1495
- }
1496
- }
1497
-
1498
- // Pause all the videos in a slide
1499
- function pauseVimeoVideos(slide_index) {
1500
- getSlide(slide_index).each(function() {
1501
- var slide = $(this);
1502
-
1503
- slide.find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1504
- pauseVimeoVideo($(this));
1505
- });
1506
- });
1507
- }
1508
-
1509
- // Pauses the video
1510
- function pauseVimeoVideo(element) {
1511
- getVimeoPlayer(element).api('pause');
1512
- }
1513
-
1514
- // Returns true if there is at least one video playing with "pauseWhileWatching" enabled
1515
- function watchingAndWait() {
1516
- var ret = false;
1517
-
1518
- getSlide(current_slide).find(ELEMENTS + '.cs-yt-iframe').each(function() {
1519
- if(ret) {
1520
- return;
1521
- }
1522
-
1523
- var element = $(this);
1524
-
1525
- if(!getItemData(element, 'pause-while-watching')) {
1526
- return;
1527
- }
1528
-
1529
- if(getYoutubePlayerState(element) == 1) {
1530
- ret = true;
1531
- }
1532
- });
1533
-
1534
- if(ret) {
1535
- return true;
1536
- }
1537
-
1538
- getSlide(current_slide).find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1539
- if(ret) {
1540
- return;
1541
- }
1542
-
1543
- var element = $(this);
1544
-
1545
- if(!getItemData(element, 'pause-while-watching')) {
1546
- return;
1547
- }
1548
-
1549
- if(vimeo_videos[element.attr('id')].playing) {
1550
- ret = true;
1551
- }
1552
- });
1553
-
1554
- return ret;
1555
- }
1556
-
1557
- /****************/
1558
- /** ANIMATIONS **/
1559
- /****************/
1560
-
1561
- // WARNING: slideIn and elementIn must reset every CSS propriety to the correct value before starting
1562
-
1563
- // Does slide in animation
1564
- function slideIn(slide_index) {
1565
- var slide = getSlide(slide_index);
1566
- var data_in = getItemData(slide, 'in');
1567
- var data_ease_in = getItemData(slide, 'ease-in');
1568
-
1569
- var def = new $.Deferred();
1570
-
1571
- if(slide.css('display') == 'block') {
1572
- return def.resolve().promise();
1573
- }
1574
-
1575
- // If first play, don't execute the animation
1576
- if(first_play) {
1577
- slide.css({
1578
- 'display' : 'block',
1579
- 'top' : 0,
1580
- 'left' : 0,
1581
- 'opacity' : getItemData(slide, 'opacity'),
1582
- });
1583
- return def.resolve().promise();
1584
- }
1585
-
1586
- switch(data_in) {
1587
- case 'fade' :
1588
- slide.css({
1589
- 'display' : 'block',
1590
- 'top' : 0,
1591
- 'left' : 0,
1592
- 'opacity' : 0,
1593
- });
1594
- slide.animate({
1595
- 'opacity' : getItemData(slide, 'opacity'),
1596
- }, data_ease_in, function() { def.resolve(); });
1597
- break;
1598
-
1599
- case 'fadeLeft' :
1600
- slide.css({
1601
- 'display' : 'block',
1602
- 'top' : 0,
1603
- 'left' : getWidth(),
1604
- 'opacity' : 0,
1605
- });
1606
- slide.animate({
1607
- 'opacity' : getItemData(slide, 'opacity'),
1608
- 'left' : 0,
1609
- }, data_ease_in, function() { def.resolve(); });
1610
- break;
1611
-
1612
- case 'fadeRight' :
1613
- slide.css({
1614
- 'display' : 'block',
1615
- 'top' : 0,
1616
- 'left' : -getWidth(),
1617
- 'opacity' : 0,
1618
- });
1619
- slide.animate({
1620
- 'opacity' : getItemData(slide, 'opacity'),
1621
- 'left' : 0,
1622
- }, data_ease_in, function() { def.resolve(); });
1623
- break;
1624
-
1625
- case 'slideLeft' :
1626
- slide.css({
1627
- 'display' : 'block',
1628
- 'top' : 0,
1629
- 'left' : getWidth(),
1630
- 'opacity' : getItemData(slide, 'opacity'),
1631
- });
1632
- slide.animate({
1633
- 'left' : 0,
1634
- }, data_ease_in, function() { def.resolve(); });
1635
- break;
1636
-
1637
- case 'slideRight' :
1638
- slide.css({
1639
- 'display' : 'block',
1640
- 'top' : 0,
1641
- 'left' : -getWidth(),
1642
- 'opacity' : getItemData(slide, 'opacity'),
1643
- });
1644
- slide.animate({
1645
- 'left' : 0,
1646
- }, data_ease_in, function() { def.resolve(); });
1647
- break;
1648
-
1649
- case 'slideUp' :
1650
- slide.css({
1651
- 'display' : 'block',
1652
- 'top' : getHeight(),
1653
- 'left' : 0,
1654
- 'opacity' : getItemData(slide, 'opacity'),
1655
- });
1656
- slide.animate({
1657
- 'top' : 0,
1658
- }, data_ease_in, function() { def.resolve(); });
1659
- break;
1660
-
1661
- case 'slideDown' :
1662
- slide.css({
1663
- 'display' : 'block',
1664
- 'top' : -getHeight(),
1665
- 'left' : 0,
1666
- 'opacity' : getItemData(slide, 'opacity'),
1667
- });
1668
- slide.animate({
1669
- 'top' : 0,
1670
- }, data_ease_in, function() { def.resolve(); });
1671
- break;
1672
-
1673
- default:
1674
- slide.css({
1675
- 'display' : 'block',
1676
- 'top' : 0,
1677
- 'left' : 0,
1678
- 'opacity' : getItemData(slide, 'opacity'),
1679
- });
1680
- def.resolve();
1681
- break;
1682
- }
1683
-
1684
- return def.promise();
1685
- }
1686
-
1687
- // Does slide out animation
1688
- function slideOut(slide_index) {
1689
- var slide = getSlide(slide_index);
1690
- var data_out = getItemData(slide, 'out');
1691
- var data_ease_out = getItemData(slide, 'ease-out');
1692
-
1693
- var def = new $.Deferred();
1694
-
1695
- if(slide.css('display') == 'none') {
1696
- return def.resolve().promise();
1697
- }
1698
-
1699
- switch(data_out) {
1700
- case 'fade' :
1701
- slide.animate({
1702
- 'opacity' : 0,
1703
- }, data_ease_out,
1704
- function() {
1705
- slide.css({
1706
- 'display' : 'none',
1707
- 'opacity' : getItemData(slide, 'opacity'),
1708
- });
1709
- def.resolve();
1710
- });
1711
- break;
1712
-
1713
- case 'fadeLeft' :
1714
- slide.animate({
1715
- 'opacity' : 0,
1716
- 'left' : -getWidth(),
1717
- }, data_ease_out,
1718
- function() {
1719
- slide.css({
1720
- 'display' : 'none',
1721
- 'opacity' : getItemData(slide, 'opacity'),
1722
- 'left' : 0,
1723
- });
1724
- def.resolve();
1725
- });
1726
- break;
1727
-
1728
- case 'fadeRight' :
1729
- slide.animate({
1730
- 'opacity' : 0,
1731
- 'left' : getWidth(),
1732
- }, data_ease_out,
1733
- function() {
1734
- slide.css({
1735
- 'display' : 'none',
1736
- 'opacity' : getItemData(slide, 'opacity'),
1737
- 'left' : 0,
1738
- });
1739
- def.resolve();
1740
- });
1741
- break;
1742
-
1743
- case 'slideLeft' :
1744
- slide.animate({
1745
- 'left' : -getWidth(),
1746
- }, data_ease_out,
1747
- function() {
1748
- slide.css({
1749
- 'display' : 'none',
1750
- 'left' : 0,
1751
- });
1752
- def.resolve();
1753
- });
1754
- break;
1755
-
1756
- case 'slideRight' :
1757
- slide.animate({
1758
- 'left' : getWidth(),
1759
- }, data_ease_out,
1760
- function() {
1761
- slide.css({
1762
- 'display' : 'none',
1763
- 'left' : 0,
1764
- });
1765
- def.resolve();
1766
- });
1767
- break;
1768
-
1769
- case 'slideUp' :
1770
- slide.animate({
1771
- 'top' : -getHeight(),
1772
- }, data_ease_out,
1773
- function() {
1774
- slide.css({
1775
- 'display' : 'none',
1776
- 'top' : 0,
1777
- });
1778
- def.resolve();
1779
- });
1780
- break;
1781
-
1782
- case 'slideDown' :
1783
- slide.animate({
1784
- 'top' : getHeight(),
1785
- }, data_ease_out,
1786
- function() {
1787
- slide.css({
1788
- 'display' : 'none',
1789
- 'top' : 0,
1790
- });
1791
- def.resolve();
1792
- });
1793
- break;
1794
-
1795
- default :
1796
- slide.css({
1797
- 'display' : 'none',
1798
- });
1799
- def.resolve();
1800
- break;
1801
- }
1802
-
1803
- return def.promise();
1804
- }
1805
-
1806
- // Does element in animation
1807
- function elementIn(element) {
1808
- var element_width = element.outerWidth();
1809
- var element_height = element.outerHeight();
1810
- var data_in = getItemData(element, 'in');
1811
- var data_ease_in = getItemData(element, 'ease-in');
1812
- var data_top = getItemData(element, 'top');
1813
- var data_left = getItemData(element, 'left');
1814
-
1815
- var def = new $.Deferred();
1816
-
1817
- if(element.css('display') == 'block') {
1818
- return def.resolve().promise();
1819
- }
1820
-
1821
- switch(data_in) {
1822
- case 'slideDown' :
1823
- element.css({
1824
- 'display' : 'block',
1825
- 'top' : -element_height,
1826
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1827
- 'opacity' : getItemData(element, 'opacity'),
1828
- }).animate({
1829
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1830
- }, data_ease_in, function() { def.resolve(); });
1831
- break;
1832
-
1833
- case 'slideUp' :
1834
- element.css({
1835
- 'display' : 'block',
1836
- 'top' : getHeight(),
1837
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1838
- 'opacity' : getItemData(element, 'opacity'),
1839
- }).animate({
1840
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1841
- }, data_ease_in, function() { def.resolve(); });
1842
- break;
1843
-
1844
- case 'slideLeft' :
1845
- element.css({
1846
- 'display' : 'block',
1847
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1848
- 'left' : getWidth(),
1849
- 'opacity' : getItemData(element, 'opacity'),
1850
- }).animate({
1851
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1852
- }, data_ease_in, function() { def.resolve(); });
1853
- break;
1854
-
1855
- case 'slideRight' :
1856
- element.css({
1857
- 'display' : 'block',
1858
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1859
- 'left' : -element_width,
1860
- 'opacity' : getItemData(element, 'opacity'),
1861
- }).animate({
1862
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1863
- }, data_ease_in, function() { def.resolve(); });
1864
- break;
1865
-
1866
- case 'fade' :
1867
- element.css({
1868
- 'display' : 'block',
1869
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1870
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1871
- 'opacity' : 0,
1872
- }).animate({
1873
- 'opacity' : getItemData(element, 'opacity'),
1874
- }, data_ease_in, function() { def.resolve(); });
1875
- break;
1876
-
1877
- case 'fadeDown' :
1878
- element.css({
1879
- 'display' : 'block',
1880
- 'top' : -element_height,
1881
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1882
- 'opacity' : 0,
1883
- }).animate({
1884
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1885
- 'opacity' : getItemData(element, 'opacity'),
1886
- }, data_ease_in, function() { def.resolve(); });
1887
- break;
1888
-
1889
- case 'fadeUp' :
1890
- element.css({
1891
- 'display' : 'block',
1892
- 'top' : getHeight(),
1893
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1894
- 'opacity' : 0,
1895
- }).animate({
1896
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1897
- 'opacity' : getItemData(element, 'opacity'),
1898
- }, data_ease_in, function() { def.resolve(); });
1899
- break;
1900
-
1901
- case 'fadeLeft' :
1902
- element.css({
1903
- 'display' : 'block',
1904
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1905
- 'left' : getWidth(),
1906
- 'opacity' : 0,
1907
- }).animate({
1908
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1909
- 'opacity' : getItemData(element, 'opacity'),
1910
- }, data_ease_in, function() { def.resolve(); });
1911
- break;
1912
-
1913
- case 'fadeRight' :
1914
- element.css({
1915
- 'display' : 'block',
1916
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1917
- 'left' : -element_width,
1918
- 'opacity' : 0,
1919
- }).animate({
1920
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1921
- 'opacity' : getItemData(element, 'opacity'),
1922
- }, data_ease_in, function() { def.resolve(); });
1923
- break;
1924
-
1925
- case 'fadeSmallDown' :
1926
- element.css({
1927
- 'display' : 'block',
1928
- 'top' : getScaled(data_top + getLayoutGaps(element).top -30),
1929
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1930
- 'opacity' : 0,
1931
- }).animate({
1932
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1933
- 'opacity' : getItemData(element, 'opacity'),
1934
- }, data_ease_in, function() { def.resolve(); });
1935
- break;
1936
-
1937
- case 'fadeSmallUp' :
1938
- element.css({
1939
- 'display' : 'block',
1940
- 'top' : getScaled(data_top + getLayoutGaps(element).top + 30),
1941
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1942
- 'opacity' : 0,
1943
- }).animate({
1944
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1945
- 'opacity' : getItemData(element, 'opacity'),
1946
- }, data_ease_in, function() { def.resolve(); });
1947
- break;
1948
-
1949
- case 'fadeSmallLeft' :
1950
- element.css({
1951
- 'display' : 'block',
1952
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1953
- 'left' : getScaled(data_left + getLayoutGaps(element).left + 30),
1954
- 'opacity' : 0,
1955
- }).animate({
1956
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1957
- 'opacity' : getItemData(element, 'opacity'),
1958
- }, data_ease_in, function() { def.resolve(); });
1959
- break;
1960
-
1961
- case 'fadeSmallRight' :
1962
- element.css({
1963
- 'display' : 'block',
1964
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1965
- 'left' : getScaled(data_left + getLayoutGaps(element).left - 30),
1966
- 'opacity' : 0,
1967
- }).animate({
1968
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1969
- 'opacity' : getItemData(element, 'opacity'),
1970
- }, data_ease_in, function() { def.resolve(); });
1971
- break;
1972
-
1973
- default :
1974
- element.css({
1975
- 'display' : 'block',
1976
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1977
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1978
- 'opacity' : getItemData(element, 'opacity'),
1979
- });
1980
- def.resolve();
1981
- break;
1982
- }
1983
-
1984
- return def.promise();
1985
- }
1986
-
1987
- // Does element out animation
1988
- function elementOut(element) {
1989
- var element_width = element.outerWidth();
1990
- var element_height = element.outerHeight();
1991
- var data_out = getItemData(element, 'out');
1992
- var data_ease_out = getItemData(element, 'ease-out');
1993
-
1994
- var def = new $.Deferred();
1995
-
1996
- if(element.css('display') == 'none') {
1997
- return def.resolve().promise();
1998
- }
1999
-
2000
- switch(data_out) {
2001
- case 'slideDown' :
2002
- element.animate({
2003
- 'top' : getHeight(),
2004
- }, data_ease_out,
2005
- function() {
2006
- element.css({
2007
- 'display' : 'none',
2008
- });
2009
- def.resolve();
2010
- });
2011
- break;
2012
-
2013
- case 'slideUp' :
2014
- element.animate({
2015
- 'top' : - element_height,
2016
- }, data_ease_out,
2017
- function() {
2018
- element.css({
2019
- 'display' : 'none',
2020
- });
2021
- def.resolve();
2022
- });
2023
- break;
2024
-
2025
- case 'slideLeft' :
2026
- element.animate({
2027
- 'left' : - element_width,
2028
- }, data_ease_out,
2029
- function() {
2030
- element.css({
2031
- 'display' : 'none',
2032
- });
2033
- def.resolve();
2034
- });
2035
- break;
2036
-
2037
- case 'slideRight' :
2038
- element.animate({
2039
- 'left' : getWidth(),
2040
- }, data_ease_out,
2041
- function() {
2042
- element.css({
2043
- 'display' : 'none',
2044
- });
2045
- def.resolve();
2046
- });
2047
- break;
2048
-
2049
- case 'fade' :
2050
- element.animate({
2051
- 'opacity' : 0,
2052
- }, data_ease_out,
2053
- function() {
2054
- element.css({
2055
- 'display' : 'none',
2056
- 'opacity' : getItemData(element, 'opacity'),
2057
- });
2058
- def.resolve();
2059
- });
2060
- break;
2061
-
2062
- case 'fadeDown' :
2063
- element.animate({
2064
- 'top' : getHeight(),
2065
- 'opacity' : 0,
2066
- }, data_ease_out,
2067
- function() {
2068
- element.css({
2069
- 'display' : 'none',
2070
- 'opacity' : getItemData(element, 'opacity'),
2071
- });
2072
- def.resolve();
2073
- });
2074
- break;
2075
-
2076
- case 'fadeUp' :
2077
- element.animate({
2078
- 'top' : - element_height,
2079
- 'opacity' : 0,
2080
- }, data_ease_out,
2081
- function() {
2082
- element.css({
2083
- 'display' : 'none',
2084
- 'opacity' : getItemData(element, 'opacity'),
2085
- });
2086
- def.resolve();
2087
- });
2088
- break;
2089
-
2090
- case 'fadeLeft' :
2091
- element.animate({
2092
- 'left' : - element_width,
2093
- 'opacity' : 0,
2094
- }, data_ease_out,
2095
- function() {
2096
- element.css({
2097
- 'display' : 'none',
2098
- 'opacity' : getItemData(element, 'opacity'),
2099
- });
2100
- def.resolve();
2101
- });
2102
- break;
2103
-
2104
- case 'fadeRight' :
2105
- element.animate({
2106
- 'left' : getWidth(),
2107
- 'opacity' : 0,
2108
- }, data_ease_out,
2109
- function() {
2110
- element.css({
2111
- 'display' : 'none',
2112
- 'opacity' : getItemData(element, 'opacity'),
2113
- });
2114
- def.resolve();
2115
- });
2116
- break;
2117
-
2118
- case 'fadeSmallDown' :
2119
- element.animate({
2120
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top + 30),
2121
- 'opacity' : 0,
2122
- }, data_ease_out,
2123
- function() {
2124
- element.css({
2125
- 'display' : 'none',
2126
- 'opacity' : getItemData(element, 'opacity'),
2127
- });
2128
- def.resolve();
2129
- });
2130
- break;
2131
-
2132
- case 'fadeSmallUp' :
2133
- element.animate({
2134
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top - 30),
2135
- 'opacity' : 0,
2136
- }, data_ease_out,
2137
- function() {
2138
- element.css({
2139
- 'display' : 'none',
2140
- 'opacity' : getItemData(element, 'opacity'),
2141
- });
2142
- def.resolve();
2143
- });
2144
- break;
2145
-
2146
- case 'fadeSmallLeft' :
2147
- element.animate({
2148
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left - 30),
2149
- 'opacity' : 0,
2150
- }, data_ease_out,
2151
- function() {
2152
- element.css({
2153
- 'display' : 'none',
2154
- 'opacity' : getItemData(element, 'opacity'),
2155
- });
2156
- def.resolve();
2157
- });
2158
- break;
2159
-
2160
- case 'fadeSmallRight' :
2161
- element.animate({
2162
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left + 30),
2163
- 'opacity' : 0,
2164
- }, data_ease_out,
2165
- function() {
2166
- element.css({
2167
- 'display' : 'none',
2168
- 'opacity' : getItemData(element, 'opacity'),
2169
- });
2170
- def.resolve();
2171
- });
2172
- break;
2173
-
2174
- default :
2175
- element.css({
2176
- 'display' : 'none',
2177
- });
2178
- def.resolve();
2179
- break;
2180
- }
2181
-
2182
- return def.promise();
2183
- }
2184
-
2185
- /**********************/
2186
- /** PUBLIC FUNCTIONS **/
2187
- /**********************/
2188
-
2189
- this.resume = function() {
2190
- resume();
2191
- }
2192
-
2193
- this.pause = function() {
2194
- pause();
2195
- }
2196
-
2197
- this.nextSlide = function() {
2198
- changeSlide(getNextSlide());
2199
- }
2200
-
2201
- this.previousSlide = function() {
2202
- changeSlide(getPreviousSlide());
2203
- }
2204
-
2205
- this.changeSlide = function(slide_index) {
2206
- changeSlide(slide_index);
2207
- }
2208
-
2209
- this.getCurrentSlide = function() {
2210
- return current_slide;
2211
- }
2212
-
2213
- this.getTotalSlides = function() {
2214
- return total_slides;
2215
- }
2216
-
2217
- };
2218
-
2219
- /**************************/
2220
- /** CRELLY SLIDER PLUGIN **/
2221
- /**************************/
2222
-
2223
- $.fn.crellySlider = function(options) {
2224
- var settings = $.extend({
2225
- layout : 'fixed',
2226
- responsive : true,
2227
- startWidth : 1140,
2228
- startHeight : 500,
2229
-
2230
- pauseOnHover : true,
2231
- automaticSlide : true,
2232
- randomOrder : true,
2233
- startFromSlide : 0, // -1 means random, >= 0 means the exact index
2234
- showControls : true,
2235
- showNavigation : true,
2236
- showProgressBar : true,
2237
- enableSwipe : true,
2238
-
2239
- slidesTime : 3000,
2240
- elementsDelay : 0,
2241
- elementsTime : 'all',
2242
- slidesEaseIn : 300,
2243
- elementsEaseIn : 300,
2244
- slidesEaseOut : 300,
2245
- elementsEaseOut : 300,
2246
- ignoreElementsEaseOut : false,
2247
-
2248
- videoAutoplay : false,
2249
- videoLoop : false,
2250
- videoStartMute : false,
2251
- videoPauseWhileWatching : true,
2252
-
2253
- beforeStart : function() {},
2254
- beforeSetResponsive : function() {},
2255
- beforeSlideStart : function() {},
2256
- beforePause : function() {},
2257
- beforeResume : function() {},
2258
- }, options);
2259
-
2260
- return this.each(function() {
2261
- if(undefined == $(this).data('crellySlider')) {
2262
- var plugin = new $.CrellySlider(this, settings);
2263
- $(this).data('crellySlider', plugin);
2264
- }
2265
- });
2266
- };
2267
-
2268
- })(jQuery);
1
+ /**
2
+ * Plugin Name: Crelly Slider
3
+ * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.7
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
+ * License: MIT
9
+ */
10
+
11
+ /*************/
12
+ /** GLOBALS **/
13
+ /*************/
14
+
15
+ // Using these two variables we can check if we still need to load the APIs for YouTube and Vimeo
16
+ var crellyslider_youtube_api_ready = false;
17
+ var crellyslider_vimeo_api_ready = false;
18
+
19
+ (function($) {
20
+
21
+ /************************/
22
+ /** EXTERNAL RESOURCES **/
23
+ /************************/
24
+
25
+ // Custom build of jQuery mobile. I need it for swipeleft and swiperight
26
+ (function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout(function(){c=0,O()},e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}function j(e){if(g)return;d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),!r&&o===e.target?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
27
+
28
+ // YouTube API:
29
+ function loadYoutubeAPI() {
30
+ var tag = document.createElement('script');
31
+ tag.src = "https://www.youtube.com/iframe_api";
32
+ var firstScriptTag = document.getElementsByTagName('script')[0];
33
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
34
+
35
+ crellyslider_youtube_api_ready = true;
36
+ }
37
+
38
+ // Vimeo API
39
+ function loadVimeoAPI() {
40
+ var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
41
+ return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1;
42
+ var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=
43
+ window.$f=e}();
44
+
45
+ crellyslider_vimeo_api_ready = true;
46
+ }
47
+
48
+ /*******************/
49
+ /** CRELLY SLIDER **/
50
+ /*******************/
51
+
52
+ $.CrellySlider = function(target, settings) {
53
+
54
+ /**********************/
55
+ /** USEFUL VARIABLES **/
56
+ /**********************/
57
+
58
+ // HTML classes of the slider
59
+ var SLIDER = $(target);
60
+ var CRELLY = 'div.crellyslider';
61
+ var SLIDES = 'ul.cs-slides';
62
+ var SLIDE = 'li.cs-slide';
63
+ var ELEMENTS = '> *';
64
+
65
+ var total_slides;
66
+ var current_slide = 0;
67
+
68
+ var paused = false;
69
+ var can_pause = false; // Also used as "can change slide"
70
+ var prevent_hover_interactions = 0; // Allow the user to trigger an action on mouse over. This is used to prevent the slider from resuming while watching a video
71
+ var executed_slide = false; // Will be true as soon as the current slide is executed
72
+ var first_play = true;
73
+
74
+ // Slide timer: only current slide. Elements timers: all the elements. This prevents conflicts during changes and pauses
75
+ var current_slide_time_timer = new Timer(function() {}, 0);
76
+ var elements_times_timers = new Array();
77
+ var elements_delays_timers = new Array();
78
+
79
+ // The arrays "link" every DOM iframe element to its player element that can interact with APIs
80
+ var youtube_videos = {};
81
+ var vimeo_videos = {};
82
+
83
+ var scale = 1;
84
+ var window_width_before_setResponsive = 0; // This variable is useful ONLY to prevent that window.resize fires on vertical resizing or on a right window width
85
+
86
+ /********************/
87
+ /** INITIALIZATION **/
88
+ /********************/
89
+
90
+ // EVERYTHING BEGINS HERE
91
+
92
+ // Load necessary APIs
93
+ if(! crellyslider_youtube_api_ready && thereAreVideos('youtube')) {
94
+ loadYoutubeAPI();
95
+ }
96
+ if(! crellyslider_vimeo_api_ready && thereAreVideos('vimeo')) {
97
+ loadVimeoAPI();
98
+ }
99
+
100
+ // Before initializing Crelly Slider, we have to wait for the YouTube API. I use the setInterval method to prevent compatibility issues with other plugins and to be sure that, if there is more than a slider loaded on the page, everything works
101
+ if(crellyslider_youtube_api_ready && (typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined')) {
102
+ var temp = setInterval(function() {
103
+ if(typeof(YT) != 'undefined' && typeof(YT.Player) != 'undefined') {
104
+ clearInterval(temp);
105
+ init();
106
+ }
107
+ }, 100);
108
+ }
109
+ else {
110
+ init();
111
+ }
112
+
113
+ // Returns an array like this: {youtube = true, vimeo = false} if there are YouTube videos but not Vimeo videos
114
+ // This function can be called before init()
115
+ function thereAreVideos(platform) {
116
+ if(platform == 'youtube') {
117
+ return SLIDER.find('.cs-yt-iframe').length > 0 ? true : false;
118
+ }
119
+ if(platform == 'vimeo') {
120
+ return SLIDER.find('.cs-vimeo-iframe').length > 0 ? true : false;
121
+ }
122
+
123
+ return -1;
124
+ }
125
+
126
+ // The slider constructor: runs automatically only the first time, sets the basic needs of the slider and the preloader then runs Crelly Slider
127
+ function init() {
128
+ // Add wrappers and classes
129
+ SLIDER.wrapInner('<div class="crellyslider" />');
130
+ SLIDER.find(CRELLY + ' > ul').addClass('cs-slides');
131
+ SLIDER.find(CRELLY + ' ' + SLIDES + ' > li').addClass('cs-slide');
132
+
133
+ // Set total_slides
134
+ total_slides = getSlides().length;
135
+
136
+ // If the slider is empty, stop
137
+ if(total_slides == 0) {
138
+ return false;
139
+ }
140
+
141
+ // If there is only a slide, clone it
142
+ if(total_slides == 1) {
143
+ var clone = getSlide(0);
144
+ var prepend = SLIDER.find(CRELLY).find(SLIDES);
145
+ clone.clone().prependTo(prepend);
146
+ total_slides++;
147
+ }
148
+
149
+ orderSlides();
150
+
151
+ // Show controls (previous and next arrows)
152
+ if(settings.showControls) {
153
+ SLIDER.find(CRELLY).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>');
154
+ }
155
+
156
+ // Show navigation
157
+ if(settings.showNavigation) {
158
+ var nav = '<div class="cs-navigation">';
159
+ for(var i = 0; i < total_slides; i++) {
160
+ nav += '<span class="cs-slide-link"></span>';
161
+ }
162
+ nav += '</div>';
163
+ SLIDER.find(CRELLY).append(nav);
164
+ }
165
+
166
+ // Show progress bar
167
+ if(settings.showProgressBar) {
168
+ SLIDER.find(CRELLY).append('<div class="cs-progress-bar"></div>');
169
+ }
170
+ else {
171
+ SLIDER.find(CRELLY).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>');
172
+ }
173
+
174
+ // Display slider
175
+ SLIDER.css('display', 'block');
176
+
177
+ // Set layout for the first time
178
+ if(settings.responsive) {
179
+ setScale();
180
+ }
181
+ setLayout();
182
+
183
+ // Set slides links
184
+ getSlides().find('.cs-background-link')
185
+ .html(' ')
186
+ .data({
187
+ 'left' : 0,
188
+ 'top' : 0,
189
+ 'in' : 'none',
190
+ 'out' : 'none',
191
+ 'easeIn' : 0,
192
+ 'easeOut' : 0,
193
+ 'delay' : 0,
194
+ 'time' : 'all',
195
+ });
196
+
197
+ setPreloader();
198
+
199
+ initVideos().done(function() {
200
+ // Timeout needed to prevent compatibility issues
201
+ var loading = setInterval(function() {
202
+ if(document.readyState == 'complete' && SLIDER.find(CRELLY).find('.cs-preloader').length > 0) { // If window.load and preloader is loaded
203
+ clearInterval(loading);
204
+ loadedWindow();
205
+ }
206
+ }, 100);
207
+ });
208
+ }
209
+
210
+ // Orders the slides by rearranging them in the DOM
211
+ function orderSlides() {
212
+ // If randomOrder is disabled and the initial slide is the first, the slides are already ordered
213
+ if(! settings.randomOrder && settings.startFromSlide == 0) {
214
+ return;
215
+ }
216
+
217
+ var slides_order = new Array();
218
+ var ordered_slides = new Array();
219
+
220
+ // Set the first slide according to the settings
221
+ if(settings.startFromSlide == -1) {
222
+ var index = Math.floor((Math.random() * total_slides));
223
+ slides_order[0] = index;
224
+ ordered_slides[0] = getSlide(index);
225
+ }
226
+ else {
227
+ slides_order[0] = settings.startFromSlide;
228
+ ordered_slides[0] = getSlide(settings.startFromSlide);
229
+ }
230
+
231
+ // Set all the other slides
232
+ for(var i = 1; i < total_slides; i++) {
233
+ var index;
234
+
235
+ if(settings.randomOrder) { // Get a random slide index that was never generated before
236
+ do {
237
+ index = Math.floor((Math.random() * total_slides));
238
+ } while(slides_order.indexOf(index) != -1);
239
+ }
240
+ else { // Get the next index
241
+ if(i + slides_order[0] < total_slides) {
242
+ index = i + slides_order[0];
243
+ }
244
+ else {
245
+ index = i + slides_order[0] - total_slides;
246
+ }
247
+ }
248
+
249
+ slides_order[i] = index;
250
+ ordered_slides[i] = getSlide(index);
251
+ }
252
+
253
+ // Delete all the slides
254
+ SLIDER.find(CRELLY).find(SLIDES).empty();
255
+
256
+ // Put the slides that are now ordered
257
+ for(var i = 0; i < total_slides; i++) {
258
+ SLIDER.find(CRELLY).find(SLIDES).append(ordered_slides[i]);
259
+ }
260
+ }
261
+
262
+ // Inits Youtube and Vimeo videos
263
+ function initVideos() {
264
+ var def = new $.Deferred();
265
+ var total_iframes = getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').length;
266
+ var loaded_iframes = 0;
267
+
268
+ if(total_iframes == 0) {
269
+ return def.resolve().promise();
270
+ }
271
+
272
+ // When iframes are loaded...
273
+ getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').each(function() {
274
+ var iframe = $(this);
275
+
276
+ iframe.one('load', function() {
277
+ loaded_iframes++;
278
+ if(loaded_iframes == total_iframes) {
279
+ // ...init videos
280
+ initYoutubeVideos().done(function() {
281
+ initVimeoVideos().done(function() {
282
+ def.resolve();
283
+ });
284
+ });
285
+ }
286
+ })
287
+ });
288
+
289
+ return def.promise();
290
+ }
291
+
292
+ // Generates an unique id for each youtube iframe, then links them to a new YouTube player
293
+ function initYoutubeVideos() {
294
+ var def = new $.Deferred();
295
+ var slides = getSlides();
296
+ var total_yt_videos = slides.find(ELEMENTS + '.cs-yt-iframe').length;
297
+ var loaded_videos = 0;
298
+ var temp;
299
+
300
+ if(total_yt_videos == 0) {
301
+ return def.resolve().promise();
302
+ }
303
+
304
+ slides.each(function() {
305
+ var slide = $(this);
306
+ var elements = slide.find(ELEMENTS + '.cs-yt-iframe');
307
+
308
+ elements.each(function() {
309
+ var element = $(this);
310
+
311
+ element.uniqueId();
312
+ element.attr('id', 'cs-yt-iframe-' + element.attr('id'));
313
+
314
+ var player = new YT.Player(element.attr('id'), {
315
+ events: {
316
+ 'onReady' : function() {
317
+ if(getItemData(element, 'start-mute')) {
318
+ player.mute();
319
+ }
320
+ loaded_videos++;
321
+ if(loaded_videos == total_yt_videos) {
322
+ def.resolve();
323
+ }
324
+ },
325
+
326
+ 'onStateChange' : function(e) {
327
+ if(can_pause) {
328
+ if(e.data === YT.PlayerState.PAUSED) {
329
+ youtube_videos[element.attr('id')].manually_paused = true;
330
+ }
331
+ if(e.data === YT.PlayerState.PLAYING) {
332
+ youtube_videos[element.attr('id')].manually_paused = false;
333
+ }
334
+ }
335
+
336
+ if(e.data === YT.PlayerState.PLAYING) {
337
+ if(getItemData(element, 'pause-while-watching')) {
338
+ prevent_hover_interactions = true;
339
+ pause();
340
+ }
341
+ }
342
+ else if(e.data === YT.PlayerState.PAUSED || e.data === YT.PlayerState.ENDED) {
343
+ if(!watchingAndWait()) {
344
+ prevent_hover_interactions = false;
345
+ resume();
346
+ }
347
+ }
348
+ },
349
+ },
350
+ });
351
+
352
+ temp = {
353
+ player : player,
354
+ played_once : false,
355
+ manually_paused : false,
356
+ };
357
+
358
+ youtube_videos[element.attr('id')] = temp;
359
+ });
360
+ });
361
+
362
+ return def.promise();
363
+ }
364
+
365
+ // Generates an unique id for each Vimeo iframe, then links them to a new Vimeo player
366
+ function initVimeoVideos() {
367
+ var def = new $.Deferred();
368
+ var slides = getSlides();
369
+ var total_vimeo_videos = slides.find(ELEMENTS + '.cs-vimeo-iframe').length;
370
+ var loaded_videos = 0;
371
+ var temp;
372
+
373
+ if(total_vimeo_videos == 0) {
374
+ return def.resolve().promise();
375
+ }
376
+
377
+ slides.each(function() {
378
+ var slide = $(this);
379
+ var elements = slide.find(ELEMENTS + '.cs-vimeo-iframe');
380
+
381
+ elements.each(function() {
382
+ var element = $(this);
383
+
384
+ element.uniqueId();
385
+ element.attr('id', 'cs-vimeo-iframe-' + element.attr('id'));
386
+ element.attr('src', element.attr('src') + '&player_id=' + element.attr('id'));
387
+
388
+ var player = $f(element[0]);
389
+
390
+ player.addEvent('ready', function() {
391
+ if(getItemData(element, 'start-mute')) {
392
+ player.api('setVolume', 0);
393
+ }
394
+
395
+ player.addEvent('finish', function() {
396
+ vimeo_videos[element.attr('id')].ended = true;
397
+ vimeo_videos[element.attr('id')].playing = false;
398
+
399
+ if(!watchingAndWait()) {
400
+ prevent_hover_interactions = false;
401
+ resume();
402
+ }
403
+ });
404
+
405
+ player.addEvent('play', function() {
406
+ vimeo_videos[element.attr('id')].played_once = true;
407
+ vimeo_videos[element.attr('id')].ended = false;
408
+ vimeo_videos[element.attr('id')].playing = true;
409
+
410
+ if(can_pause) {
411
+ vimeo_videos[element.attr('id')].manually_paused = false;
412
+ }
413
+
414
+ if(getItemData(element, 'pause-while-watching')) {
415
+ prevent_hover_interactions = true;
416
+ pause();
417
+ }
418
+ });
419
+
420
+ player.addEvent('pause', function() {
421
+ if(can_pause) {
422
+ vimeo_videos[element.attr('id')].manually_paused = true;
423
+ }
424
+ vimeo_videos[element.attr('id')].playing = false;
425
+
426
+ if(!watchingAndWait()) {
427
+ prevent_hover_interactions = false;
428
+ resume();
429
+ }
430
+ });
431
+
432
+ if(getItemData(element, 'loop')) {
433
+ player.api('setLoop', true);
434
+ }
435
+
436
+ loaded_videos++;
437
+ if(loaded_videos == total_vimeo_videos) {
438
+ def.resolve();
439
+ }
440
+ });
441
+
442
+ temp = {
443
+ player : player,
444
+ played_once : false,
445
+ ended : false,
446
+ manually_paused : false,
447
+ playing : false,
448
+ };
449
+
450
+ vimeo_videos[element.attr('id')] = temp;
451
+ });
452
+ });
453
+
454
+ return def.promise();
455
+ }
456
+
457
+ // Does operations after window.load is complete. Need to do it as a function for back-end compatibility
458
+ function loadedWindow() {
459
+ // Set layout for the second time
460
+ if(settings.responsive) {
461
+ setScale();
462
+ }
463
+ setLayout();
464
+
465
+ window_width_before_setResponsive = $(window).width();
466
+
467
+ initProperties();
468
+
469
+ addListeners();
470
+
471
+ unsetPreloader();
472
+
473
+ settings.beforeStart();
474
+
475
+ // Positions and responsive dimensions then run
476
+ if(settings.responsive) {
477
+ setResponsive();
478
+ }
479
+ else {
480
+ play();
481
+ }
482
+ }
483
+
484
+ // Stores original slides, elements and elements contents values then hides all the slides
485
+ function initProperties() {
486
+ getSlides().each(function() {
487
+ var slide = $(this);
488
+
489
+ slide.find(ELEMENTS).each(function() {
490
+ var element = $(this);
491
+
492
+ element.find('*').each(function() {
493
+ var element_content = $(this);
494
+ setElementData(element_content);
495
+ });
496
+
497
+ setElementData(element);
498
+ });
499
+
500
+ slide.css('display', 'none');
501
+ slide.data('opacity', parseFloat(slide.css('opacity')));
502
+ });
503
+ }
504
+
505
+ // Initializes the element with original values
506
+ function setElementData(element) {
507
+ element.data('width', parseFloat(element.width()));
508
+ element.data('height', parseFloat(element.height()));
509
+ element.data('letter-spacing', parseFloat(element.css('letter-spacing')));
510
+ element.data('font-size', parseFloat(element.css('font-size')));
511
+
512
+ if(element.css('line-height').slice(-2).toLowerCase() == 'px') {
513
+ // if pixel values are given, use those
514
+ element.data('line-height', parseFloat(element.css('line-height')));
515
+ }
516
+ else if(element.css('line-height') == 'normal') {
517
+ // if the browser returns 'normal' then use a default factor of 1.15 * font-size
518
+ // see: http://meyerweb.com/eric/thoughts/2008/05/06/line-height-abnormal/
519
+ element.data('line-height', getItemData(element, 'font-size') * 1.15);
520
+ }
521
+ else {
522
+ // otherwise assume that the returned value is a factor and multiply it with the font-size
523
+ element.data('line-height', parseFloat(element.css('line-height')) * getItemData(element, 'font-size'));
524
+ }
525
+
526
+ element.data('padding-top', parseFloat(element.css('padding-top')));
527
+ element.data('padding-right', parseFloat(element.css('padding-right')));
528
+ element.data('padding-bottom', parseFloat(element.css('padding-bottom')));
529
+ element.data('padding-left', parseFloat(element.css('padding-left')));
530
+ element.data('opacity', parseFloat(element.css('opacity')));
531
+ }
532
+
533
+ // Sets all listeners for the user interaction
534
+ function addListeners() {
535
+ // Make responsive. Run if resizing horizontally and the slider is not at the right dimension
536
+ if(settings.responsive) {
537
+ $(window).resize(function() {
538
+ if(window_width_before_setResponsive != $(window).width() && ((settings.layout == 'full-width' && getWidth() != $(SLIDER).width()) || ($(SLIDER).width() < getWidth() || (($(SLIDER).width() > getWidth()) && getWidth() < settings.startWidth)))) {
539
+ setResponsive();
540
+ }
541
+ });
542
+ }
543
+
544
+ // Compatibility with Popup Maker (https://wordpress.org/plugins/popup-maker/)
545
+ /*$(document).on('pumAfterOpen', '.pum', function() {
546
+ if($(this).find(CRELLY).length > 0) {
547
+ setResponsive();
548
+ }
549
+ });*/
550
+
551
+ // Previous control click
552
+ SLIDER.find(CRELLY).find('.cs-controls > .cs-previous').click(function() {
553
+ changeSlide(getPreviousSlide());
554
+ });
555
+
556
+ // Next Control click
557
+ SLIDER.find(CRELLY).find('.cs-controls > .cs-next').click(function() {
558
+ changeSlide(getNextSlide());
559
+ });
560
+
561
+ // Swipe and drag
562
+ if(settings.enableSwipe) {
563
+ SLIDER.find(CRELLY).on('swipeleft', function() {
564
+ resume();
565
+ changeSlide(getNextSlide());
566
+ });
567
+
568
+ SLIDER.find(CRELLY).on('swiperight', function() {
569
+ resume();
570
+ changeSlide(getPreviousSlide());
571
+ });
572
+ }
573
+
574
+ // Navigation link click
575
+ SLIDER.find(CRELLY).find('.cs-navigation > .cs-slide-link').click(function() {
576
+ changeSlide($(this).index());
577
+ });
578
+
579
+ // Pause on hover
580
+ if(settings.pauseOnHover) {
581
+ SLIDER.find(CRELLY).find(SLIDES).hover(function() {
582
+ if(prevent_hover_interactions == 0) {
583
+ pause();
584
+ }
585
+ });
586
+
587
+ SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
588
+ if(prevent_hover_interactions == 0) {
589
+ resume();
590
+ }
591
+ });
592
+ }
593
+ }
594
+
595
+ // Hides the unnecessary divs and sets the blurred preloader and the gif spinner
596
+ function setPreloader() {
597
+ // Setup
598
+ SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'hidden');
599
+ SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'none');
600
+ SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'none');
601
+ SLIDER.find(CRELLY).find('.cs-controls').css('display', 'none');
602
+
603
+ // Get the URL of the background image of the first slide
604
+ var img_url = getSlide(0).css('background-image');
605
+ img_url = img_url.replace(/^url\(["']?/, '').replace(/["']?\)$/, '');
606
+
607
+ if(! img_url.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)) { // If there isn't a background image
608
+ addPreloaderHTML();
609
+ }
610
+ else {
611
+ // When the background image of the first slide is loaded
612
+ $('<img>')
613
+ .load(function() {
614
+ addPreloaderHTML();
615
+ })
616
+ .attr('src', img_url)
617
+ .each(function() {
618
+ if(this.complete) {
619
+ $(this).load();
620
+ }
621
+ });
622
+ }
623
+
624
+ function addPreloaderHTML() {
625
+ // Add preloader
626
+ SLIDER.find(CRELLY).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>');
627
+
628
+ // Set background. Background is set to both the preloader div and the bg div to fix the CSS blur effect
629
+ SLIDER.find(CRELLY).find('.cs-preloader').css({
630
+ 'background-color' : getSlide(current_slide).css('background-color'),
631
+ 'background-image' : getSlide(current_slide).css('background-image'),
632
+ 'background-position' : getSlide(current_slide).css('background-position'),
633
+ 'background-repeat' : getSlide(current_slide).css('background-repeat'),
634
+ 'background-size' : getSlide(current_slide).css('background-size'),
635
+ });
636
+ SLIDER.find(CRELLY).find('.cs-preloader > .cs-bg').css({
637
+ 'background-color' : getSlide(current_slide).css('background-color'),
638
+ 'background-image' : getSlide(current_slide).css('background-image'),
639
+ 'background-position' : getSlide(current_slide).css('background-position'),
640
+ 'background-repeat' : getSlide(current_slide).css('background-repeat'),
641
+ 'background-size' : getSlide(current_slide).css('background-size'),
642
+ });
643
+ }
644
+ }
645
+
646
+ // Shows the necessary divs and fades out the preloader
647
+ function unsetPreloader() {
648
+ // Setup
649
+ SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'visible');
650
+ SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'block');
651
+ SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'block');
652
+ SLIDER.find(CRELLY).find('.cs-controls').css('display', 'block');
653
+
654
+ // Display the first slide to avoid the slide in animation
655
+ slideIn(getSlide(0));
656
+ getSlide(0).finish();
657
+
658
+ // Fade out
659
+ SLIDER.find(CRELLY).find('.cs-preloader').animate({
660
+ 'opacity' : 0,
661
+ }, 300, function() {
662
+ SLIDER.find(CRELLY).find('.cs-preloader').remove();
663
+ });
664
+ }
665
+
666
+ /*******************************/
667
+ /** LAYOUT AND RESPONSIVENESS **/
668
+ /*******************************/
669
+
670
+ // Sets slider and slides. Width and height are scaled
671
+ function setLayout() {
672
+ var layout = settings.layout;
673
+ var width, height;
674
+
675
+ switch(layout) {
676
+ case 'fixed':
677
+ width = settings.startWidth;
678
+ height = settings.startHeight;
679
+ SLIDER.find(CRELLY).css({
680
+ 'width' : getScaled(width),
681
+ 'height' : getScaled(height),
682
+ });
683
+ getSlides().css({
684
+ 'width' : getScaled(width),
685
+ 'height' : getScaled(height),
686
+ });
687
+ break;
688
+
689
+ case 'full-width':
690
+ width = SLIDER.width();
691
+ height = settings.startHeight;
692
+ SLIDER.find(CRELLY).css({
693
+ 'width' : width,
694
+ 'height' : getScaled(height),
695
+ });
696
+ getSlides().css({
697
+ 'width' : width,
698
+ 'height' : getScaled(height),
699
+ });
700
+ break;
701
+ default:
702
+ return false;
703
+ break;
704
+ }
705
+ }
706
+
707
+ // Returns the element top end left gaps (when the slider is full-width is very useful)
708
+ function getLayoutGaps(element) {
709
+ var top_gap = (getHeight() - settings.startHeight) / 2;
710
+ var left_gap = (getWidth() - settings.startWidth) / 2;
711
+
712
+ var new_top = 0;
713
+ var new_left = 0;
714
+
715
+ if(top_gap > 0) {
716
+ new_top = top_gap;
717
+ }
718
+ if(left_gap > 0) {
719
+ new_left = left_gap;
720
+ }
721
+
722
+ return {
723
+ top: new_top,
724
+ left: new_left,
725
+ };
726
+ }
727
+
728
+ // Scales every element to make it responsive. It automatically restarts the current slide
729
+ function setResponsive() {
730
+ settings.beforeSetResponsive();
731
+
732
+ var slides = getSlides();
733
+
734
+ stop(true);
735
+
736
+ slides.each(function() {
737
+ var slide = $(this);
738
+ var elements = slide.find(ELEMENTS);
739
+
740
+ slide.finish();
741
+ slideIn(slide);
742
+ slide.finish();
743
+
744
+ elements.each(function() {
745
+ var element = $(this);
746
+
747
+ element.finish();
748
+ elementIn(element);
749
+ element.finish();
750
+
751
+ if(isVideo(element)) {
752
+ pauseVideo(element);
753
+ }
754
+ });
755
+ });
756
+
757
+ setScale();
758
+
759
+ setLayout();
760
+
761
+ slides.each(function() {
762
+ var slide = $(this);
763
+ var elements = slide.find(ELEMENTS);
764
+
765
+ elements.each(function() {
766
+ var element = $(this);
767
+
768
+ element.find('*').each(function() {
769
+ var element_content = $(this);
770
+ scaleElement(element_content);
771
+ });
772
+
773
+ scaleElement(element);
774
+
775
+ element.finish();
776
+ elementOut(element);
777
+ element.finish();
778
+
779
+ if(isVideo(element)) {
780
+ pauseVideo(element);
781
+ }
782
+ });
783
+
784
+ slide.finish();
785
+ slideOut(slide);
786
+ slide.finish();
787
+ });
788
+
789
+ window_width_before_setResponsive = $(window).width();
790
+
791
+ play();
792
+ }
793
+
794
+ // Scales a text or an image and their contents
795
+ function scaleElement(element) {
796
+ // Standard element
797
+ element.css({
798
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top),
799
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left),
800
+ 'padding-top' : getScaled(getItemData(element, 'padding-top')),
801
+ 'padding-right' : getScaled(getItemData(element, 'padding-right')),
802
+ 'padding-bottom' : getScaled(getItemData(element, 'padding-bottom')),
803
+ 'padding-left' : getScaled(getItemData(element, 'padding-left')),
804
+ });
805
+
806
+ // Element contains text
807
+ if(element.is('input') || element.is('button') || element.text().trim().length) {
808
+ element.css({
809
+ 'line-height' : getScaled(getItemData(element, 'line-height')) + 'px',
810
+ 'letter-spacing' : getScaled(getItemData(element, 'letter-spacing')),
811
+ 'font-size' : getScaled(getItemData(element, 'font-size')),
812
+ });
813
+ }
814
+
815
+ // Element doesn't contain text (like images or iframes)
816
+ else {
817
+ element.css({
818
+ 'width' : getScaled(getItemData(element, 'width')),
819
+ 'height' : getScaled(getItemData(element, 'height')),
820
+ });
821
+ }
822
+ }
823
+
824
+ // Using the start dimensions, sets how the slider and it's elements should be scaled
825
+ function setScale() {
826
+ var slider_width = SLIDER.width();
827
+ var start_width = settings.startWidth;
828
+
829
+ if(slider_width >= start_width || ! settings.responsive) {
830
+ scale = 1;
831
+ }
832
+ else {
833
+ scale = slider_width / start_width;
834
+ }
835
+ }
836
+
837
+ // Using the current scale variable, returns the value that receives correctly scaled. Remember to always use getScaled() to get positions & dimensions of the elements
838
+ function getScaled(value) {
839
+ return value * scale;
840
+ }
841
+
842
+ /*********************/
843
+ /** SLIDER COMMANDS **/
844
+ /*********************/
845
+
846
+ // Runs Crelly from the current slide
847
+ function play() {
848
+ if(settings.automaticSlide) {
849
+ loopSlides();
850
+ }
851
+ else {
852
+ executeSlide(current_slide);
853
+ }
854
+
855
+ first_play = false;
856
+ }
857
+
858
+ // Stops all the slides and the elements and resets the progress bar
859
+ function stop(finish_queues) {
860
+ for(var i = 0; i < elements_times_timers.length; i++) {
861
+ elements_times_timers[i].clear();
862
+ }
863
+
864
+ for(var i = 0; i < elements_delays_timers.length; i++) {
865
+ elements_delays_timers[i].clear();
866
+ }
867
+
868
+ current_slide_time_timer.clear();
869
+
870
+ getSlides().each(function() {
871
+ var temp_slide = $(this);
872
+ if(finish_queues) {
873
+ temp_slide.finish();
874
+ }
875
+ else {
876
+ temp_slide.stop(true, true);
877
+ }
878
+ temp_slide.find(ELEMENTS).each(function() {
879
+ var temp_element = $(this);
880
+ if(finish_queues) {
881
+ temp_element.finish();
882
+ }
883
+ else {
884
+ temp_element.stop(true, true);
885
+ }
886
+ });
887
+ });
888
+
889
+ resetProgressBar();
890
+ }
891
+
892
+ // Stops the progress bar and the slide time timer
893
+ function pause() {
894
+ if(! paused && can_pause) {
895
+ settings.beforePause();
896
+
897
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
898
+ progress_bar.stop(true);
899
+ current_slide_time_timer.pause();
900
+
901
+ paused = true;
902
+ }
903
+ }
904
+
905
+ // Animates until the end the progress bar and resumes the current slide time timer
906
+ function resume() {
907
+ if(paused && can_pause) {
908
+ settings.beforeResume();
909
+
910
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
911
+ var slide_time = getItemData(getSlide(current_slide), 'time');
912
+ var remained_delay = current_slide_time_timer.getRemaining();
913
+
914
+ progress_bar.animate({
915
+ 'width' : '100%',
916
+ }, remained_delay);
917
+
918
+ current_slide_time_timer.resume();
919
+
920
+ paused = false;
921
+ }
922
+ }
923
+
924
+ /****************************************/
925
+ /** SLIDER OR SLIDES DATAS / UTILITIES **/
926
+ /****************************************/
927
+
928
+ // Returns the Crelly Slider container width
929
+ function getWidth() {
930
+ return SLIDER.find(CRELLY).width();
931
+ }
932
+
933
+ // Returns the Crelly Slider container height
934
+ function getHeight() {
935
+ return SLIDER.find(CRELLY).height();
936
+ }
937
+
938
+ // Returns the index of the next slide
939
+ function getNextSlide() {
940
+ if(current_slide + 1 == total_slides) {
941
+ return 0;
942
+ }
943
+ return current_slide + 1;
944
+ }
945
+
946
+ // Returns the index of the previous slide
947
+ function getPreviousSlide() {
948
+ if(current_slide - 1 < 0) {
949
+ return total_slides - 1;
950
+ }
951
+ return current_slide - 1;
952
+ }
953
+
954
+ // Returns a "data" of an item (slide or element). If is an integer || float, returns the parseInt() || parseFloat() of it. If the slide or the element has no data returns the default value
955
+ function getItemData(item, data) {
956
+ var is_slide;
957
+
958
+ if(item.parent('ul').hasClass('cs-slides')) {
959
+ is_slide = true;
960
+ }
961
+ else {
962
+ is_slide = false;
963
+ }
964
+
965
+ switch(data) {
966
+ case 'ease-in' :
967
+ if(is_slide) {
968
+ return isNaN(parseInt(item.data(data))) ? settings.slidesEaseIn : parseInt(item.data(data));
969
+ }
970
+ else {
971
+ return isNaN(parseInt(item.data(data))) ? settings.elementsEaseIn : parseInt(item.data(data));
972
+ }
973
+ break;
974
+
975
+ case 'ease-out' :
976
+ if(is_slide) {
977
+ return isNaN(parseInt(item.data(data))) ? settings.slidesEaseOut : parseInt(item.data(data));
978
+ }
979
+ else {
980
+ return isNaN(parseInt(item.data(data))) ? settings.elementsEaseOut : parseInt(item.data(data));
981
+ }
982
+ break;
983
+
984
+ case 'delay' :
985
+ return isNaN(parseInt(item.data(data))) ? settings.elementsDelay : parseInt(item.data(data));
986
+
987
+ break;
988
+
989
+ case 'time' :
990
+ if(is_slide) {
991
+ return isNaN(parseInt(item.data(data))) ? settings.slidesTime : parseInt(item.data(data));
992
+ }
993
+ else {
994
+ if(item.data(data) == 'all') {
995
+ return 'all';
996
+ }
997
+ else {
998
+ return isNaN(parseInt(item.data(data))) ? settings.itemsTime : parseInt(item.data(data));
999
+ }
1000
+ }
1001
+ break;
1002
+
1003
+ case 'ignore-ease-out' :
1004
+ if(parseInt(item.data(data)) == 1) {
1005
+ return true;
1006
+ }
1007
+ else if(parseInt(item.data(data)) == 0) {
1008
+ return false;
1009
+ }
1010
+ return settings.ignoreElementsEaseOut;
1011
+ break;
1012
+
1013
+ case 'autoplay' :
1014
+ if(parseInt(item.data(data)) == 1) {
1015
+ return true;
1016
+ }
1017
+ else if(parseInt(item.data(data)) == 0) {
1018
+ return false;
1019
+ }
1020
+ return settings.videoAutoplay;
1021
+ break;
1022
+
1023
+ case 'loop' :
1024
+ if(parseInt(item.data(data)) == 1) {
1025
+ return true;
1026
+ }
1027
+ else if(parseInt(item.data(data)) == 0) {
1028
+ return false;
1029
+ }
1030
+ return settings.videoLoop;
1031
+ break;
1032
+
1033
+ case 'start-mute' :
1034
+ if(parseInt(item.data(data)) == 1) {
1035
+ return true;
1036
+ }
1037
+ else if(parseInt(item.data(data)) == 0) {
1038
+ return false;
1039
+ }
1040
+ return settings.videoStartMute;
1041
+ break;
1042
+
1043
+ case 'pause-while-watching' :
1044
+ if(parseInt(item.data(data)) == 1) {
1045
+ return true;
1046
+ }
1047
+ else if(parseInt(item.data(data)) == 0) {
1048
+ return false;
1049
+ }
1050
+ return settings.videoPauseWhileWatching;
1051
+ break;
1052
+
1053
+ case 'top' :
1054
+ case 'left' :
1055
+ case 'width' :
1056
+ case 'height' :
1057
+ case 'padding-top' :
1058
+ case 'padding-right' :
1059
+ case 'padding-bottom' :
1060
+ case 'padding-left' :
1061
+ case 'line-height' :
1062
+ case 'letter-spacing' :
1063
+ case 'font-size' :
1064
+ return isNaN(parseFloat(item.data(data))) ? 0 : parseFloat(item.data(data));
1065
+ break;
1066
+
1067
+ case 'in' :
1068
+ case 'out' :
1069
+ case 'opacity' :
1070
+ return item.data(data);
1071
+ break;
1072
+
1073
+ default :
1074
+ return false;
1075
+ break;
1076
+ }
1077
+ }
1078
+
1079
+ // Returns the slides DOM elements
1080
+ function getSlides() {
1081
+ return SLIDER.find(CRELLY).find(SLIDES).find(SLIDE);
1082
+ }
1083
+
1084
+ // Returns the slide DOM element
1085
+ function getSlide(slide_index) {
1086
+ return getSlides().eq(slide_index);
1087
+ }
1088
+
1089
+ // Timeout with useful methods
1090
+ function Timer(callback, delay) {
1091
+ var id;
1092
+ var start;
1093
+ var remaining = delay;
1094
+
1095
+ this.pause = function() {
1096
+ clearTimeout(id);
1097
+ remaining -= new Date() - start;
1098
+ };
1099
+
1100
+ this.resume = function() {
1101
+ start = new Date();
1102
+ clearTimeout(id);
1103
+ id = window.setTimeout(function() {
1104
+ callback();
1105
+ }, remaining);
1106
+ };
1107
+
1108
+ this.clear = function () {
1109
+ clearTimeout(id);
1110
+ };
1111
+
1112
+ // For now, works only after this.pause(). No need to calculate in other moments
1113
+ this.getRemaining = function() {
1114
+ return remaining;
1115
+ };
1116
+
1117
+ this.resume();
1118
+ }
1119
+
1120
+ // Returns true if the user is using a mobile browser
1121
+ function isMobile() {
1122
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1123
+ }
1124
+
1125
+ /*****************/
1126
+ /** SLIDER CORE **/
1127
+ /*****************/
1128
+
1129
+ // Loops trough the slides
1130
+ function loopSlides() {
1131
+ executeSlide(current_slide).done(function() {
1132
+ if(! paused) {
1133
+ current_slide = getNextSlide();
1134
+
1135
+ loopSlides();
1136
+ }
1137
+ });
1138
+ }
1139
+
1140
+ // Resets the progress bar and draws the progress bar of the current slide
1141
+ function drawProgressBar() {
1142
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1143
+
1144
+ resetProgressBar();
1145
+
1146
+ progress_bar.animate({
1147
+ 'width' : '100%',
1148
+ }, getItemData(getSlide(current_slide), 'time'));
1149
+ }
1150
+
1151
+ // Resets the progress bar animation and CSS
1152
+ function resetProgressBar() {
1153
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1154
+
1155
+ progress_bar.stop();
1156
+ progress_bar.css('width', 0);
1157
+ }
1158
+
1159
+ // Sets the right HTML classes of the navigation links
1160
+ function setNavigationLink() {
1161
+ var nav = SLIDER.find(CRELLY).find('.cs-navigation');
1162
+ var links = nav.find('> .cs-slide-link');
1163
+
1164
+ links.each(function() {
1165
+ var link = $(this);
1166
+
1167
+ if(link.index() == current_slide) {
1168
+ link.addClass('cs-active');
1169
+ }
1170
+ else {
1171
+ link.removeClass('cs-active');
1172
+ }
1173
+ });
1174
+ }
1175
+
1176
+ // Finishes the current slide (animations out of elements and slide) and then plays the new slide
1177
+ function changeSlide(slide_index) {
1178
+ if(slide_index == current_slide) {
1179
+ return;
1180
+ }
1181
+
1182
+ if(can_pause || executed_slide) {
1183
+ stop(false);
1184
+
1185
+ finishSlide(current_slide, false, true).done(function() {
1186
+ current_slide = slide_index;
1187
+ play();
1188
+ });
1189
+ }
1190
+ }
1191
+
1192
+ // Executes a slide completely. If the auto loop is disabled won't animate out the slide and the elements with time == "all"
1193
+ function executeSlide(slide_index) {
1194
+ settings.beforeSlideStart();
1195
+
1196
+ var def = new $.Deferred();
1197
+
1198
+ executed_slide = false;
1199
+
1200
+ // If something is still animating, reset
1201
+ for(var i = 0; i < elements_times_timers.length; i++) {
1202
+ elements_times_timers[i].clear();
1203
+ }
1204
+ for(var i = 0; i < elements_delays_timers.length; i++) {
1205
+ elements_delays_timers[i].clear();
1206
+ }
1207
+ current_slide_time_timer.clear();
1208
+ getSlide(slide_index).finish();
1209
+ slideOut(slide_index);
1210
+ getSlide(slide_index).finish();
1211
+ var elements = getSlide(slide_index).find(ELEMENTS);
1212
+ elements.each(function() {
1213
+ var element = $(this);
1214
+ element.finish();
1215
+ elementOut(element);
1216
+ element.finish();
1217
+ });
1218
+
1219
+
1220
+ setNavigationLink();
1221
+
1222
+ runSlide(slide_index);
1223
+
1224
+ if(settings.automaticSlide) {
1225
+ finishSlide(slide_index, true, true).done(function() {
1226
+ executed_slide = true;
1227
+ def.resolve();
1228
+ });
1229
+ }
1230
+ else {
1231
+ finishSlide(slide_index, true, false).done(function() {
1232
+ executed_slide = true;
1233
+ def.resolve();
1234
+ });
1235
+ }
1236
+
1237
+ return def.promise();
1238
+ }
1239
+
1240
+ // Executes the in animation of the slide and it's elements
1241
+ function runSlide(slide_index) {
1242
+ var slide = getSlide(slide_index);
1243
+ var elements = slide.find(ELEMENTS);
1244
+
1245
+ var elements_in_completed = 0;
1246
+ var slide_in_completed = false;
1247
+
1248
+ var def = new $.Deferred();
1249
+
1250
+ can_pause = false;
1251
+
1252
+ // Do slide in animation
1253
+ slideIn(slide_index).done(function() {
1254
+ drawProgressBar();
1255
+
1256
+ can_pause = true;
1257
+
1258
+ slide_in_completed = true;
1259
+ if(slide_in_completed && elements_in_completed == elements.length) {
1260
+ def.resolve();
1261
+ }
1262
+ });
1263
+
1264
+ // Do elements in animation
1265
+ elements.each(function() {
1266
+ var element = $(this);
1267
+ var element_delay = getItemData(element, 'delay');
1268
+
1269
+ elements_delays_timers.push(new Timer(function() {
1270
+ elementIn(element).done(function() {
1271
+ if(isVideo(element)) {
1272
+ playVideo(element);
1273
+ }
1274
+
1275
+ elements_in_completed++;
1276
+ if(slide_in_completed && elements_in_completed == elements.length) {
1277
+ def.resolve();
1278
+ }
1279
+ });
1280
+ }, element_delay));
1281
+ });
1282
+
1283
+ return def.promise();
1284
+ }
1285
+
1286
+ // Does all times, elements out animations and slide out animation
1287
+ // execute_time, if true, will do the slide and the elements timers. If false, the timers will be = 0 so the plugin will execute the code of the callback function immediately.
1288
+ // animate_all_out, if false, will execute the elements with time != all out animations but not the slide and the elements with time == all out animations. If true, executes all the out animations
1289
+ function finishSlide(slide_index, execute_time, animate_all_out) {
1290
+ var slide = getSlide(slide_index);
1291
+ var elements = slide.find(ELEMENTS);
1292
+ var data_time = execute_time ? getItemData(slide, 'time') + getItemData(slide, 'ease-in') : 0;
1293
+
1294
+ var elements_out_completed = 0;
1295
+ var slide_time_completed = false;
1296
+
1297
+ var def = new $.Deferred();
1298
+
1299
+ // Elements with time != "all"
1300
+ elements.each(function() {
1301
+ var element = $(this);
1302
+ var time = getItemData(element, 'time');
1303
+
1304
+ if(time != 'all') {
1305
+ var final_element_time = execute_time ? time : 0;
1306
+
1307
+ if(getItemData(element, 'ignore-ease-out')) {
1308
+ elements_out_completed++;
1309
+
1310
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1311
+ pauseVideos(slide_index);
1312
+ slideOut(slide_index);
1313
+ def.resolve();
1314
+ }
1315
+ }
1316
+
1317
+ elements_times_timers.push(new Timer(function() {
1318
+ elementOut(element).done(function() {
1319
+ if(! getItemData(element, 'ignore-ease-out')) {
1320
+ elements_out_completed++;
1321
+
1322
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1323
+ pauseVideos(slide_index);
1324
+ slideOut(slide_index);
1325
+ def.resolve();
1326
+ }
1327
+ }
1328
+ });
1329
+ }, final_element_time));
1330
+ }
1331
+ });
1332
+
1333
+ // Execute slide time
1334
+ current_slide_time_timer = new Timer(function() {
1335
+ can_pause = false;
1336
+
1337
+ resetProgressBar();
1338
+
1339
+ slide_time_completed = true;
1340
+
1341
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1342
+ pauseVideos(slide_index);
1343
+ slideOut(slide_index);
1344
+ def.resolve();
1345
+ }
1346
+
1347
+ if(! animate_all_out) {
1348
+ def.resolve();
1349
+ }
1350
+ else {
1351
+ // Elements with time == "all"
1352
+ elements.each(function() {
1353
+ var element = $(this);
1354
+ var time = getItemData(element, 'time');
1355
+
1356
+ if(time == 'all') {
1357
+ if(getItemData(element, 'ignore-ease-out')) {
1358
+ elements_out_completed++;
1359
+
1360
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1361
+ pauseVideos(slide_index);
1362
+ slideOut(slide_index);
1363
+ def.resolve();
1364
+ }
1365
+ }
1366
+
1367
+ elementOut(element).done(function() {
1368
+ if(! getItemData(element, 'ignore-ease-out')) {
1369
+ elements_out_completed++;
1370
+
1371
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1372
+ pauseVideos(slide_index);
1373
+ slideOut(slide_index);
1374
+ def.resolve();
1375
+ }
1376
+ }
1377
+ });
1378
+ }
1379
+ });
1380
+ }
1381
+ }, data_time);
1382
+
1383
+ return def.promise();
1384
+ }
1385
+
1386
+ // VIDEOS FUNCTIONS
1387
+
1388
+ // Returns true if the element is a YouTube or a Vimeo iframe
1389
+ function isVideo(element) {
1390
+ return isYoutubeVideo(element) || isVimeoVideo(element);
1391
+ }
1392
+
1393
+ // Checks what's the source of the video, then plays it
1394
+ function playVideo(element) {
1395
+ if(isYoutubeVideo(element)) {
1396
+ playYoutubeVideo(element);
1397
+ }
1398
+ else {
1399
+ playVimeoVideo(element);
1400
+ }
1401
+ }
1402
+
1403
+ // Pauses all the YouTube and Vimeo videos
1404
+ function pauseVideos(slide_index) {
1405
+ pauseYoutubeVideos(slide_index);
1406
+ pauseVimeoVideos(slide_index);
1407
+ }
1408
+
1409
+ // Checks what's the source of the video, then pauses it
1410
+ function pauseVideo(element) {
1411
+ if(isYoutubeVideo(element)) {
1412
+ pauseYoutubeVideo(element);
1413
+ }
1414
+ else {
1415
+ pauseVimeoVideo(element);
1416
+ }
1417
+ }
1418
+
1419
+ // Checks if the element is a YouTube video
1420
+ function isYoutubeVideo(element) {
1421
+ return element.hasClass('cs-yt-iframe');
1422
+ }
1423
+
1424
+ // Returns the player associated to the element
1425
+ function getYoutubePlayer(element) {
1426
+ return youtube_videos[element.attr('id')].player;
1427
+ }
1428
+
1429
+ /*
1430
+ Returns:
1431
+ -1 – unstarted
1432
+ 0 – ended
1433
+ 1 – playing
1434
+ 2 – paused
1435
+ 3 – buffering
1436
+ 5 – video cued
1437
+ */
1438
+ function getYoutubePlayerState(element) {
1439
+ return getYoutubePlayer(element).getPlayerState();
1440
+ }
1441
+
1442
+ // Checks if the video can be played and plays it
1443
+ function playYoutubeVideo(element) {
1444
+ // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Youtube's website)
1445
+ if(getItemData(element, 'autoplay') && ! youtube_videos[element.attr('id')].played_once && ! isMobile()) {
1446
+ getYoutubePlayer(element).playVideo();
1447
+ }
1448
+
1449
+ // If was paused, but not manually
1450
+ if(getYoutubePlayerState(element) == 2 && !youtube_videos[element.attr('id')].manually_paused) {
1451
+ getYoutubePlayer(element).playVideo();
1452
+ }
1453
+
1454
+ youtube_videos[element.attr('id')].played_once = true;
1455
+ }
1456
+
1457
+ // Pause all the videos in a slide
1458
+ function pauseYoutubeVideos(slide_index) {
1459
+ getSlide(slide_index).each(function() {
1460
+ var slide = $(this);
1461
+
1462
+ slide.find(ELEMENTS + '.cs-yt-iframe').each(function() {
1463
+ pauseYoutubeVideo($(this));
1464
+ });
1465
+ });
1466
+ }
1467
+
1468
+ // Checks if the video can be paused and pauses it
1469
+ function pauseYoutubeVideo(element) {
1470
+ if(getYoutubePlayerState(element) == 1) {
1471
+ getYoutubePlayer(element).pauseVideo();
1472
+ }
1473
+ }
1474
+
1475
+ // Checks if the element is a Vimeo video
1476
+ function isVimeoVideo(element) {
1477
+ return element.hasClass('cs-vimeo-iframe');
1478
+ }
1479
+
1480
+ // Returns the player associated to the element
1481
+ function getVimeoPlayer(element) {
1482
+ return vimeo_videos[element.attr('id')].player;
1483
+ }
1484
+
1485
+ // Plays the video
1486
+ function playVimeoVideo(element) {
1487
+ // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Vimeo's website)
1488
+ if(getItemData(element, 'autoplay') && ! vimeo_videos[element.attr('id')].played_once && ! isMobile()) {
1489
+ getVimeoPlayer(element).api('play');
1490
+ }
1491
+
1492
+ // If was paused
1493
+ if(getVimeoPlayer(element).api('paused') && ! vimeo_videos[element.attr('id')].ended && vimeo_videos[element.attr('id')].played_once && !vimeo_videos[element.attr('id')].manually_paused) {
1494
+ getVimeoPlayer(element).api('play');
1495
+ }
1496
+ }
1497
+
1498
+ // Pause all the videos in a slide
1499
+ function pauseVimeoVideos(slide_index) {
1500
+ getSlide(slide_index).each(function() {
1501
+ var slide = $(this);
1502
+
1503
+ slide.find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1504
+ pauseVimeoVideo($(this));
1505
+ });
1506
+ });
1507
+ }
1508
+
1509
+ // Pauses the video
1510
+ function pauseVimeoVideo(element) {
1511
+ getVimeoPlayer(element).api('pause');
1512
+ }
1513
+
1514
+ // Returns true if there is at least one video playing with "pauseWhileWatching" enabled
1515
+ function watchingAndWait() {
1516
+ var ret = false;
1517
+
1518
+ getSlide(current_slide).find(ELEMENTS + '.cs-yt-iframe').each(function() {
1519
+ if(ret) {
1520
+ return;
1521
+ }
1522
+
1523
+ var element = $(this);
1524
+
1525
+ if(!getItemData(element, 'pause-while-watching')) {
1526
+ return;
1527
+ }
1528
+
1529
+ if(getYoutubePlayerState(element) == 1) {
1530
+ ret = true;
1531
+ }
1532
+ });
1533
+
1534
+ if(ret) {
1535
+ return true;
1536
+ }
1537
+
1538
+ getSlide(current_slide).find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1539
+ if(ret) {
1540
+ return;
1541
+ }
1542
+
1543
+ var element = $(this);
1544
+
1545
+ if(!getItemData(element, 'pause-while-watching')) {
1546
+ return;
1547
+ }
1548
+
1549
+ if(vimeo_videos[element.attr('id')].playing) {
1550
+ ret = true;
1551
+ }
1552
+ });
1553
+
1554
+ return ret;
1555
+ }
1556
+
1557
+ /****************/
1558
+ /** ANIMATIONS **/
1559
+ /****************/
1560
+
1561
+ // WARNING: slideIn and elementIn must reset every CSS propriety to the correct value before starting
1562
+
1563
+ // Does slide in animation
1564
+ function slideIn(slide_index) {
1565
+ var slide = getSlide(slide_index);
1566
+ var data_in = getItemData(slide, 'in');
1567
+ var data_ease_in = getItemData(slide, 'ease-in');
1568
+
1569
+ var def = new $.Deferred();
1570
+
1571
+ if(slide.css('display') == 'block') {
1572
+ return def.resolve().promise();
1573
+ }
1574
+
1575
+ // If first play, don't execute the animation
1576
+ if(first_play) {
1577
+ slide.css({
1578
+ 'display' : 'block',
1579
+ 'top' : 0,
1580
+ 'left' : 0,
1581
+ 'opacity' : getItemData(slide, 'opacity'),
1582
+ });
1583
+ return def.resolve().promise();
1584
+ }
1585
+
1586
+ switch(data_in) {
1587
+ case 'fade' :
1588
+ slide.css({
1589
+ 'display' : 'block',
1590
+ 'top' : 0,
1591
+ 'left' : 0,
1592
+ 'opacity' : 0,
1593
+ });
1594
+ slide.animate({
1595
+ 'opacity' : getItemData(slide, 'opacity'),
1596
+ }, data_ease_in, function() { def.resolve(); });
1597
+ break;
1598
+
1599
+ case 'fadeLeft' :
1600
+ slide.css({
1601
+ 'display' : 'block',
1602
+ 'top' : 0,
1603
+ 'left' : getWidth(),
1604
+ 'opacity' : 0,
1605
+ });
1606
+ slide.animate({
1607
+ 'opacity' : getItemData(slide, 'opacity'),
1608
+ 'left' : 0,
1609
+ }, data_ease_in, function() { def.resolve(); });
1610
+ break;
1611
+
1612
+ case 'fadeRight' :
1613
+ slide.css({
1614
+ 'display' : 'block',
1615
+ 'top' : 0,
1616
+ 'left' : -getWidth(),
1617
+ 'opacity' : 0,
1618
+ });
1619
+ slide.animate({
1620
+ 'opacity' : getItemData(slide, 'opacity'),
1621
+ 'left' : 0,
1622
+ }, data_ease_in, function() { def.resolve(); });
1623
+ break;
1624
+
1625
+ case 'slideLeft' :
1626
+ slide.css({
1627
+ 'display' : 'block',
1628
+ 'top' : 0,
1629
+ 'left' : getWidth(),
1630
+ 'opacity' : getItemData(slide, 'opacity'),
1631
+ });
1632
+ slide.animate({
1633
+ 'left' : 0,
1634
+ }, data_ease_in, function() { def.resolve(); });
1635
+ break;
1636
+
1637
+ case 'slideRight' :
1638
+ slide.css({
1639
+ 'display' : 'block',
1640
+ 'top' : 0,
1641
+ 'left' : -getWidth(),
1642
+ 'opacity' : getItemData(slide, 'opacity'),
1643
+ });
1644
+ slide.animate({
1645
+ 'left' : 0,
1646
+ }, data_ease_in, function() { def.resolve(); });
1647
+ break;
1648
+
1649
+ case 'slideUp' :
1650
+ slide.css({
1651
+ 'display' : 'block',
1652
+ 'top' : getHeight(),
1653
+ 'left' : 0,
1654
+ 'opacity' : getItemData(slide, 'opacity'),
1655
+ });
1656
+ slide.animate({
1657
+ 'top' : 0,
1658
+ }, data_ease_in, function() { def.resolve(); });
1659
+ break;
1660
+
1661
+ case 'slideDown' :
1662
+ slide.css({
1663
+ 'display' : 'block',
1664
+ 'top' : -getHeight(),
1665
+ 'left' : 0,
1666
+ 'opacity' : getItemData(slide, 'opacity'),
1667
+ });
1668
+ slide.animate({
1669
+ 'top' : 0,
1670
+ }, data_ease_in, function() { def.resolve(); });
1671
+ break;
1672
+
1673
+ default:
1674
+ slide.css({
1675
+ 'display' : 'block',
1676
+ 'top' : 0,
1677
+ 'left' : 0,
1678
+ 'opacity' : getItemData(slide, 'opacity'),
1679
+ });
1680
+ def.resolve();
1681
+ break;
1682
+ }
1683
+
1684
+ return def.promise();
1685
+ }
1686
+
1687
+ // Does slide out animation
1688
+ function slideOut(slide_index) {
1689
+ var slide = getSlide(slide_index);
1690
+ var data_out = getItemData(slide, 'out');
1691
+ var data_ease_out = getItemData(slide, 'ease-out');
1692
+
1693
+ var def = new $.Deferred();
1694
+
1695
+ if(slide.css('display') == 'none') {
1696
+ return def.resolve().promise();
1697
+ }
1698
+
1699
+ switch(data_out) {
1700
+ case 'fade' :
1701
+ slide.animate({
1702
+ 'opacity' : 0,
1703
+ }, data_ease_out,
1704
+ function() {
1705
+ slide.css({
1706
+ 'display' : 'none',
1707
+ 'opacity' : getItemData(slide, 'opacity'),
1708
+ });
1709
+ def.resolve();
1710
+ });
1711
+ break;
1712
+
1713
+ case 'fadeLeft' :
1714
+ slide.animate({
1715
+ 'opacity' : 0,
1716
+ 'left' : -getWidth(),
1717
+ }, data_ease_out,
1718
+ function() {
1719
+ slide.css({
1720
+ 'display' : 'none',
1721
+ 'opacity' : getItemData(slide, 'opacity'),
1722
+ 'left' : 0,
1723
+ });
1724
+ def.resolve();
1725
+ });
1726
+ break;
1727
+
1728
+ case 'fadeRight' :
1729
+ slide.animate({
1730
+ 'opacity' : 0,
1731
+ 'left' : getWidth(),
1732
+ }, data_ease_out,
1733
+ function() {
1734
+ slide.css({
1735
+ 'display' : 'none',
1736
+ 'opacity' : getItemData(slide, 'opacity'),
1737
+ 'left' : 0,
1738
+ });
1739
+ def.resolve();
1740
+ });
1741
+ break;
1742
+
1743
+ case 'slideLeft' :
1744
+ slide.animate({
1745
+ 'left' : -getWidth(),
1746
+ }, data_ease_out,
1747
+ function() {
1748
+ slide.css({
1749
+ 'display' : 'none',
1750
+ 'left' : 0,
1751
+ });
1752
+ def.resolve();
1753
+ });
1754
+ break;
1755
+
1756
+ case 'slideRight' :
1757
+ slide.animate({
1758
+ 'left' : getWidth(),
1759
+ }, data_ease_out,
1760
+ function() {
1761
+ slide.css({
1762
+ 'display' : 'none',
1763
+ 'left' : 0,
1764
+ });
1765
+ def.resolve();
1766
+ });
1767
+ break;
1768
+
1769
+ case 'slideUp' :
1770
+ slide.animate({
1771
+ 'top' : -getHeight(),
1772
+ }, data_ease_out,
1773
+ function() {
1774
+ slide.css({
1775
+ 'display' : 'none',
1776
+ 'top' : 0,
1777
+ });
1778
+ def.resolve();
1779
+ });
1780
+ break;
1781
+
1782
+ case 'slideDown' :
1783
+ slide.animate({
1784
+ 'top' : getHeight(),
1785
+ }, data_ease_out,
1786
+ function() {
1787
+ slide.css({
1788
+ 'display' : 'none',
1789
+ 'top' : 0,
1790
+ });
1791
+ def.resolve();
1792
+ });
1793
+ break;
1794
+
1795
+ default :
1796
+ slide.css({
1797
+ 'display' : 'none',
1798
+ });
1799
+ def.resolve();
1800
+ break;
1801
+ }
1802
+
1803
+ return def.promise();
1804
+ }
1805
+
1806
+ // Does element in animation
1807
+ function elementIn(element) {
1808
+ var element_width = element.outerWidth();
1809
+ var element_height = element.outerHeight();
1810
+ var data_in = getItemData(element, 'in');
1811
+ var data_ease_in = getItemData(element, 'ease-in');
1812
+ var data_top = getItemData(element, 'top');
1813
+ var data_left = getItemData(element, 'left');
1814
+
1815
+ var def = new $.Deferred();
1816
+
1817
+ if(element.css('display') == 'block') {
1818
+ return def.resolve().promise();
1819
+ }
1820
+
1821
+ switch(data_in) {
1822
+ case 'slideDown' :
1823
+ element.css({
1824
+ 'display' : 'block',
1825
+ 'top' : -element_height,
1826
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1827
+ 'opacity' : getItemData(element, 'opacity'),
1828
+ }).animate({
1829
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1830
+ }, data_ease_in, function() { def.resolve(); });
1831
+ break;
1832
+
1833
+ case 'slideUp' :
1834
+ element.css({
1835
+ 'display' : 'block',
1836
+ 'top' : getHeight(),
1837
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1838
+ 'opacity' : getItemData(element, 'opacity'),
1839
+ }).animate({
1840
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1841
+ }, data_ease_in, function() { def.resolve(); });
1842
+ break;
1843
+
1844
+ case 'slideLeft' :
1845
+ element.css({
1846
+ 'display' : 'block',
1847
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1848
+ 'left' : getWidth(),
1849
+ 'opacity' : getItemData(element, 'opacity'),
1850
+ }).animate({
1851
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1852
+ }, data_ease_in, function() { def.resolve(); });
1853
+ break;
1854
+
1855
+ case 'slideRight' :
1856
+ element.css({
1857
+ 'display' : 'block',
1858
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1859
+ 'left' : -element_width,
1860
+ 'opacity' : getItemData(element, 'opacity'),
1861
+ }).animate({
1862
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1863
+ }, data_ease_in, function() { def.resolve(); });
1864
+ break;
1865
+
1866
+ case 'fade' :
1867
+ element.css({
1868
+ 'display' : 'block',
1869
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1870
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1871
+ 'opacity' : 0,
1872
+ }).animate({
1873
+ 'opacity' : getItemData(element, 'opacity'),
1874
+ }, data_ease_in, function() { def.resolve(); });
1875
+ break;
1876
+
1877
+ case 'fadeDown' :
1878
+ element.css({
1879
+ 'display' : 'block',
1880
+ 'top' : -element_height,
1881
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1882
+ 'opacity' : 0,
1883
+ }).animate({
1884
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1885
+ 'opacity' : getItemData(element, 'opacity'),
1886
+ }, data_ease_in, function() { def.resolve(); });
1887
+ break;
1888
+
1889
+ case 'fadeUp' :
1890
+ element.css({
1891
+ 'display' : 'block',
1892
+ 'top' : getHeight(),
1893
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1894
+ 'opacity' : 0,
1895
+ }).animate({
1896
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1897
+ 'opacity' : getItemData(element, 'opacity'),
1898
+ }, data_ease_in, function() { def.resolve(); });
1899
+ break;
1900
+
1901
+ case 'fadeLeft' :
1902
+ element.css({
1903
+ 'display' : 'block',
1904
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1905
+ 'left' : getWidth(),
1906
+ 'opacity' : 0,
1907
+ }).animate({
1908
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1909
+ 'opacity' : getItemData(element, 'opacity'),
1910
+ }, data_ease_in, function() { def.resolve(); });
1911
+ break;
1912
+
1913
+ case 'fadeRight' :
1914
+ element.css({
1915
+ 'display' : 'block',
1916
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1917
+ 'left' : -element_width,
1918
+ 'opacity' : 0,
1919
+ }).animate({
1920
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1921
+ 'opacity' : getItemData(element, 'opacity'),
1922
+ }, data_ease_in, function() { def.resolve(); });
1923
+ break;
1924
+
1925
+ case 'fadeSmallDown' :
1926
+ element.css({
1927
+ 'display' : 'block',
1928
+ 'top' : getScaled(data_top + getLayoutGaps(element).top -30),
1929
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1930
+ 'opacity' : 0,
1931
+ }).animate({
1932
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1933
+ 'opacity' : getItemData(element, 'opacity'),
1934
+ }, data_ease_in, function() { def.resolve(); });
1935
+ break;
1936
+
1937
+ case 'fadeSmallUp' :
1938
+ element.css({
1939
+ 'display' : 'block',
1940
+ 'top' : getScaled(data_top + getLayoutGaps(element).top + 30),
1941
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1942
+ 'opacity' : 0,
1943
+ }).animate({
1944
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1945
+ 'opacity' : getItemData(element, 'opacity'),
1946
+ }, data_ease_in, function() { def.resolve(); });
1947
+ break;
1948
+
1949
+ case 'fadeSmallLeft' :
1950
+ element.css({
1951
+ 'display' : 'block',
1952
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1953
+ 'left' : getScaled(data_left + getLayoutGaps(element).left + 30),
1954
+ 'opacity' : 0,
1955
+ }).animate({
1956
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1957
+ 'opacity' : getItemData(element, 'opacity'),
1958
+ }, data_ease_in, function() { def.resolve(); });
1959
+ break;
1960
+
1961
+ case 'fadeSmallRight' :
1962
+ element.css({
1963
+ 'display' : 'block',
1964
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1965
+ 'left' : getScaled(data_left + getLayoutGaps(element).left - 30),
1966
+ 'opacity' : 0,
1967
+ }).animate({
1968
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1969
+ 'opacity' : getItemData(element, 'opacity'),
1970
+ }, data_ease_in, function() { def.resolve(); });
1971
+ break;
1972
+
1973
+ default :
1974
+ element.css({
1975
+ 'display' : 'block',
1976
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1977
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1978
+ 'opacity' : getItemData(element, 'opacity'),
1979
+ });
1980
+ def.resolve();
1981
+ break;
1982
+ }
1983
+
1984
+ return def.promise();
1985
+ }
1986
+
1987
+ // Does element out animation
1988
+ function elementOut(element) {
1989
+ var element_width = element.outerWidth();
1990
+ var element_height = element.outerHeight();
1991
+ var data_out = getItemData(element, 'out');
1992
+ var data_ease_out = getItemData(element, 'ease-out');
1993
+
1994
+ var def = new $.Deferred();
1995
+
1996
+ if(element.css('display') == 'none') {
1997
+ return def.resolve().promise();
1998
+ }
1999
+
2000
+ switch(data_out) {
2001
+ case 'slideDown' :
2002
+ element.animate({
2003
+ 'top' : getHeight(),
2004
+ }, data_ease_out,
2005
+ function() {
2006
+ element.css({
2007
+ 'display' : 'none',
2008
+ });
2009
+ def.resolve();
2010
+ });
2011
+ break;
2012
+
2013
+ case 'slideUp' :
2014
+ element.animate({
2015
+ 'top' : - element_height,
2016
+ }, data_ease_out,
2017
+ function() {
2018
+ element.css({
2019
+ 'display' : 'none',
2020
+ });
2021
+ def.resolve();
2022
+ });
2023
+ break;
2024
+
2025
+ case 'slideLeft' :
2026
+ element.animate({
2027
+ 'left' : - element_width,
2028
+ }, data_ease_out,
2029
+ function() {
2030
+ element.css({
2031
+ 'display' : 'none',
2032
+ });
2033
+ def.resolve();
2034
+ });
2035
+ break;
2036
+
2037
+ case 'slideRight' :
2038
+ element.animate({
2039
+ 'left' : getWidth(),
2040
+ }, data_ease_out,
2041
+ function() {
2042
+ element.css({
2043
+ 'display' : 'none',
2044
+ });
2045
+ def.resolve();
2046
+ });
2047
+ break;
2048
+
2049
+ case 'fade' :
2050
+ element.animate({
2051
+ 'opacity' : 0,
2052
+ }, data_ease_out,
2053
+ function() {
2054
+ element.css({
2055
+ 'display' : 'none',
2056
+ 'opacity' : getItemData(element, 'opacity'),
2057
+ });
2058
+ def.resolve();
2059
+ });
2060
+ break;
2061
+
2062
+ case 'fadeDown' :
2063
+ element.animate({
2064
+ 'top' : getHeight(),
2065
+ 'opacity' : 0,
2066
+ }, data_ease_out,
2067
+ function() {
2068
+ element.css({
2069
+ 'display' : 'none',
2070
+ 'opacity' : getItemData(element, 'opacity'),
2071
+ });
2072
+ def.resolve();
2073
+ });
2074
+ break;
2075
+
2076
+ case 'fadeUp' :
2077
+ element.animate({
2078
+ 'top' : - element_height,
2079
+ 'opacity' : 0,
2080
+ }, data_ease_out,
2081
+ function() {
2082
+ element.css({
2083
+ 'display' : 'none',
2084
+ 'opacity' : getItemData(element, 'opacity'),
2085
+ });
2086
+ def.resolve();
2087
+ });
2088
+ break;
2089
+
2090
+ case 'fadeLeft' :
2091
+ element.animate({
2092
+ 'left' : - element_width,
2093
+ 'opacity' : 0,
2094
+ }, data_ease_out,
2095
+ function() {
2096
+ element.css({
2097
+ 'display' : 'none',
2098
+ 'opacity' : getItemData(element, 'opacity'),
2099
+ });
2100
+ def.resolve();
2101
+ });
2102
+ break;
2103
+
2104
+ case 'fadeRight' :
2105
+ element.animate({
2106
+ 'left' : getWidth(),
2107
+ 'opacity' : 0,
2108
+ }, data_ease_out,
2109
+ function() {
2110
+ element.css({
2111
+ 'display' : 'none',
2112
+ 'opacity' : getItemData(element, 'opacity'),
2113
+ });
2114
+ def.resolve();
2115
+ });
2116
+ break;
2117
+
2118
+ case 'fadeSmallDown' :
2119
+ element.animate({
2120
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top + 30),
2121
+ 'opacity' : 0,
2122
+ }, data_ease_out,
2123
+ function() {
2124
+ element.css({
2125
+ 'display' : 'none',
2126
+ 'opacity' : getItemData(element, 'opacity'),
2127
+ });
2128
+ def.resolve();
2129
+ });
2130
+ break;
2131
+
2132
+ case 'fadeSmallUp' :
2133
+ element.animate({
2134
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top - 30),
2135
+ 'opacity' : 0,
2136
+ }, data_ease_out,
2137
+ function() {
2138
+ element.css({
2139
+ 'display' : 'none',
2140
+ 'opacity' : getItemData(element, 'opacity'),
2141
+ });
2142
+ def.resolve();
2143
+ });
2144
+ break;
2145
+
2146
+ case 'fadeSmallLeft' :
2147
+ element.animate({
2148
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left - 30),
2149
+ 'opacity' : 0,
2150
+ }, data_ease_out,
2151
+ function() {
2152
+ element.css({
2153
+ 'display' : 'none',
2154
+ 'opacity' : getItemData(element, 'opacity'),
2155
+ });
2156
+ def.resolve();
2157
+ });
2158
+ break;
2159
+
2160
+ case 'fadeSmallRight' :
2161
+ element.animate({
2162
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left + 30),
2163
+ 'opacity' : 0,
2164
+ }, data_ease_out,
2165
+ function() {
2166
+ element.css({
2167
+ 'display' : 'none',
2168
+ 'opacity' : getItemData(element, 'opacity'),
2169
+ });
2170
+ def.resolve();
2171
+ });
2172
+ break;
2173
+
2174
+ default :
2175
+ element.css({
2176
+ 'display' : 'none',
2177
+ });
2178
+ def.resolve();
2179
+ break;
2180
+ }
2181
+
2182
+ return def.promise();
2183
+ }
2184
+
2185
+ /**********************/
2186
+ /** PUBLIC FUNCTIONS **/
2187
+ /**********************/
2188
+
2189
+ this.resume = function() {
2190
+ resume();
2191
+ }
2192
+
2193
+ this.pause = function() {
2194
+ pause();
2195
+ }
2196
+
2197
+ this.nextSlide = function() {
2198
+ changeSlide(getNextSlide());
2199
+ }
2200
+
2201
+ this.previousSlide = function() {
2202
+ changeSlide(getPreviousSlide());
2203
+ }
2204
+
2205
+ this.changeSlide = function(slide_index) {
2206
+ changeSlide(slide_index);
2207
+ }
2208
+
2209
+ this.getCurrentSlide = function() {
2210
+ return current_slide;
2211
+ }
2212
+
2213
+ this.getTotalSlides = function() {
2214
+ return total_slides;
2215
+ }
2216
+
2217
+ };
2218
+
2219
+ /**************************/
2220
+ /** CRELLY SLIDER PLUGIN **/
2221
+ /**************************/
2222
+
2223
+ $.fn.crellySlider = function(options) {
2224
+ var settings = $.extend({
2225
+ layout : 'fixed',
2226
+ responsive : true,
2227
+ startWidth : 1140,
2228
+ startHeight : 500,
2229
+
2230
+ pauseOnHover : true,
2231
+ automaticSlide : true,
2232
+ randomOrder : true,
2233
+ startFromSlide : 0, // -1 means random, >= 0 means the exact index
2234
+ showControls : true,
2235
+ showNavigation : true,
2236
+ showProgressBar : true,
2237
+ enableSwipe : true,
2238
+
2239
+ slidesTime : 3000,
2240
+ elementsDelay : 0,
2241
+ elementsTime : 'all',
2242
+ slidesEaseIn : 300,
2243
+ elementsEaseIn : 300,
2244
+ slidesEaseOut : 300,
2245
+ elementsEaseOut : 300,
2246
+ ignoreElementsEaseOut : false,
2247
+
2248
+ videoAutoplay : false,
2249
+ videoLoop : false,
2250
+ videoStartMute : false,
2251
+ videoPauseWhileWatching : true,
2252
+
2253
+ beforeStart : function() {},
2254
+ beforeSetResponsive : function() {},
2255
+ beforeSlideStart : function() {},
2256
+ beforePause : function() {},
2257
+ beforeResume : function() {},
2258
+ }, options);
2259
+
2260
+ return this.each(function() {
2261
+ if(undefined == $(this).data('crellySlider')) {
2262
+ var plugin = new $.CrellySlider(this, settings);
2263
+ $(this).data('crellySlider', plugin);
2264
+ }
2265
+ });
2266
+ };
2267
+
2268
+ })(jQuery);
js/jquery.crellyslider.min.js CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * Plugin Name: Crelly Slider
3
- * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
- * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.6
6
- * Author: Fabio Rinaldi
7
- * Author URI: https://github.com/fabiorino
8
- * License: MIT
9
- */
10
-
11
  var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(e){var t,i,n;t=this,i=document,n=function(e,t,i,n){var a,o;(function(e,t,i,n){function a(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(t){for(var i,n,a={};t;){for(n in i=e.data(t,k))i[n]&&(a[n]=a.hasVirtualBinding=!0);t=t.parentNode}return a}function s(){M=!0}function r(){M=!1}function c(){l(),P=setTimeout(function(){P=0,C=0,Y.length=0,O=!1,s()},e.vmouse.resetTimerDuration)}function l(){P&&(clearTimeout(P),P=0)}function d(t,i,o){var s;return(o&&o[t]||!o&&function(t,i){for(var n;t;){if((n=e.data(t,k))&&(!i||n[i]))return t;t=t.parentNode}return null}(i.target,t))&&(s=function(t,i){var o,s,r,c,l,d,p,f,u,h=t.type;if((t=e.Event(t)).type=i,o=t.originalEvent,s=e.event.props,h.search(/^(mouse|click)/)>-1&&(s=E),o)for(p=s.length;p;)t[c=s[--p]]=o[c];if(h.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==h.search(/^touch/)&&(h=(r=a(o)).touches,l=r.changedTouches,d=h&&h.length?h[0]:l&&l.length?l[0]:n))for(f=0,u=D.length;f<u;f++)t[c=D[f]]=d[c];return t}(i,t),e(i.target).trigger(s)),s}function p(t){var i,n=e.data(t.target,S);!O&&(!C||C!==n)&&((i=d("v"+t.type,t))&&(i.isDefaultPrevented()&&t.preventDefault(),i.isPropagationStopped()&&t.stopPropagation(),i.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function f(t){var i,n,s,c=a(t).touches;c&&1===c.length&&((n=o(i=t.target)).hasVirtualBinding&&(C=z++,e.data(i,S,C),l(),r(),F=!1,s=a(t).touches[0],N=s.pageX,L=s.pageY,d("vmouseover",t,n),d("vmousedown",t,n)))}function u(e){M||(F||d("vmousecancel",e,o(e.target)),F=!0,c())}function h(t){if(!M){var i=a(t).touches[0],n=F,s=e.vmouse.moveDistanceThreshold,r=o(t.target);(F=F||Math.abs(i.pageX-N)>s||Math.abs(i.pageY-L)>s)&&!n&&d("vmousecancel",t,r),d("vmousemove",t,r),c()}}function v(e){if(!M){s();var t,i,n=o(e.target);d("vmouseup",e,n),F||(t=d("vclick",e,n))&&t.isDefaultPrevented()&&(i=a(e).changedTouches[0],Y.push({touchID:C,x:i.clientX,y:i.clientY}),O=!0),d("vmouseout",e,n),F=!1,c()}}function y(t){var i,n=e.data(t,k);if(n)for(i in n)if(n[i])return!0;return!1}function m(){}function g(t){var i=t.substr(1);return{setup:function(){y(this)||e.data(this,k,{}),e.data(this,k)[t]=!0,_[t]=(_[t]||0)+1,1===_[t]&&R.bind(i,p),e(this).bind(i,m),x&&(_.touchstart=(_.touchstart||0)+1,1===_.touchstart&&R.bind("touchstart",f).bind("touchend",v).bind("touchmove",h).bind("scroll",u))},teardown:function(){--_[t],_[t]||R.unbind(i,p),x&&(--_.touchstart,_.touchstart||R.unbind("touchstart",f).unbind("touchmove",h).unbind("touchend",v).unbind("scroll",u));var n=e(this),a=e.data(this,k);a&&(a[t]=!1),n.unbind(i,m),y(this)||n.removeData(k)}}}var b,w,k="virtualMouseBindings",S="virtualTouchID",T="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),D="clientX clientY pageX pageY screenX screenY".split(" "),I=e.event.mouseHooks?e.event.mouseHooks.props:[],E=e.event.props.concat(I),_={},P=0,N=0,L=0,F=!1,Y=[],O=!1,M=!1,x="addEventListener"in i,R=e(i),z=1,C=0;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},w=0;w<T.length;w++)e.event.special[T[w]]=g(T[w]);x&&i.addEventListener("click",function(t){var i,n,a,o,s,r=Y.length,c=t.target;if(r)for(i=t.clientX,n=t.clientY,b=e.vmouse.clickDistanceThreshold,a=c;a;){for(o=0;o<r;o++)if(s=Y[o],0,a===c&&Math.abs(s.x-i)<b&&Math.abs(s.y-n)<b||e.data(a,S)===s.touchID)return t.preventDefault(),void t.stopPropagation();a=a.parentNode}},!0)})(e,0,i),e.mobile={},o={touch:"ontouchend"in i},(a=e).mobile.support=a.mobile.support||{},a.extend(a.support,o),a.extend(a.mobile.support,o),function(e,t,n){function a(t,i,a,o){var s=a.type;a.type=i,o?e.event.trigger(a,n,t):e.event.dispatch.call(t,a),a.type=s}var o=e(i),s=e.mobile.support.touch,r="touchmove scroll",c=s?"touchstart":"mousedown",l=s?"touchend":"mouseup",d=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,i){e.fn[i]=function(e){return e?this.bind(i,e):this.trigger(i)},e.attrFn&&(e.attrFn[i]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){a(o,(i=t)?"scrollstart":"scrollstop",e)}var i,n,o=this;e(o).bind(r,function(a){e.event.special.scrollstart.enabled&&(i||t(a,!0),clearTimeout(n),n=setTimeout(function(){t(a,!1)},50))})},teardown:function(){e(this).unbind(r)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,i=e(t),n=!1;i.bind("vmousedown",function(s){function r(){clearTimeout(d)}function c(){r(),i.unbind("vclick",l).unbind("vmouseup",r),o.unbind("vmousecancel",c)}function l(e){c(),n||p!==e.target?n&&e.preventDefault():a(t,"tap",e)}if(n=!1,s.which&&1!==s.which)return!1;var d,p=s.target;i.bind("vmouseup",r).bind("vclick",l),o.bind("vmousecancel",c),d=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(n=!0),a(t,"taphold",e.Event("taphold",{target:p}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),o.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var i=t.pageXOffset,n=t.pageYOffset,a=e.clientX,o=e.clientY;return 0===e.pageY&&Math.floor(o)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(a)>Math.floor(e.pageX)?(a-=i,o-=n):(o<e.pageY-n||a<e.pageX-i)&&(a=e.pageX-i,o=e.pageY-n),{x:a,y:o}},start:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y],origin:e(t.target)}},stop:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y]}},handleSwipe:function(t,i,n,o){if(i.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-i.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-i.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>i.coords[0]?"swipeleft":"swiperight";return a(n,"swipe",e.Event("swipe",{target:o,swipestart:t,swipestop:i}),!0),a(n,s,e.Event(s,{target:o,swipestart:t,swipestop:i}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,i=this,n=e(i),a={};(t=e.data(this,"mobile-events"))||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=a,a.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var n,s=e.event.special.swipe.start(t),r=t.target,c=!1;a.move=function(t){s&&!t.isDefaultPrevented()&&(n=e.event.special.swipe.stop(t),c||(c=e.event.special.swipe.handleSwipe(s,n,i,r))&&(e.event.special.swipe.eventInProgress=!1),Math.abs(s.coords[0]-n.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault())},a.stop=function(){c=!0,e.event.special.swipe.eventInProgress=!1,o.off(d,a.move),a.move=null},o.on(d,a.move).one(l,a.stop)}},n.on(c,a.start)},teardown:function(){var t,i;(t=e.data(this,"mobile-events"))&&(i=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),i&&(i.start&&e(this).off(c,i.start),i.move&&o.off(d,i.move),i.stop&&o.off(l,i.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,i){e.event.special[t]={setup:function(){e(this).bind(i,e.noop)},teardown:function(){e(this).unbind(i)}}})}(e,this)},"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(e,0,i),e.mobile}):n(t.jQuery,0,i),e.CrellySlider=function(t,i){var n,a=e(t),o="div.crellyslider",s="ul.cs-slides",r="li.cs-slide",c="> *",l=0,d=!1,p=!1,f=!1,u=!0,h=new H(function(){},0),v=new Array,y=new Array,m={},g={},b=1,w=0;if(!crellyslider_youtube_api_ready&&S("youtube")&&function(){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),crellyslider_youtube_api_ready=!0}(),!crellyslider_vimeo_api_ready&&S("vimeo")&&(!function(){function e(t){return new e.fn.init(t)}function t(e,t,i){if(!i.contentWindow.postMessage)return!1;e=JSON.stringify({method:e,value:t}),i.contentWindow.postMessage(e,s)}function i(e){var t,i;try{i=(t=JSON.parse(e.data)).event||t.method}catch(e){}if("ready"!=i||o||(o=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===s&&(s=e.origin),e=t.value;var n=t.data,r=""===r?null:t.player_id;return t=r?a[r][i]:a[i],i=[],!!t&&(void 0!==e&&i.push(e),n&&i.push(n),r&&i.push(r),0<i.length?t.apply(null,i):t.call())}function n(e,t,i){i?(a[i]||(a[i]={}),a[i][e]=t):a[e]=t}var a={},o=!1,s="*";e.fn=e.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,i){if(!this.element||!e)return!1;var a=this.element,o=""!==a.id?a.id:null,s=i&&i.constructor&&i.call&&i.apply?null:i,r=i&&i.constructor&&i.call&&i.apply?i:null;return r&&n(e,r,o),t(e,s,a),this},addEvent:function(e,i){if(!this.element)return!1;var a=this.element,s=""!==a.id?a.id:null;return n(e,i,s),"ready"!=e?t("addEventListener",e,a):"ready"==e&&o&&i.call(null,s),this},removeEvent:function(e){if(!this.element)return!1;var i=this.element,n=""!==i.id?i.id:null;e:{if(n&&a[n]){if(!a[n][e]){n=!1;break e}a[n][e]=null}else{if(!a[e]){n=!1;break e}a[e]=null}n=!0}"ready"!=e&&n&&t("removeEventListener",e,i)}},e.fn.init.prototype=e.fn,window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent("onmessage",i),window.Froogaloop=window.$f=e}(),crellyslider_vimeo_api_ready=!0),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&void 0!==YT.Player)T();else var k=setInterval(function(){"undefined"!=typeof YT&&void 0!==YT.Player&&(clearInterval(k),T())},100);function S(e){return"youtube"==e?a.find(".cs-yt-iframe").length>0:"vimeo"==e?a.find(".cs-vimeo-iframe").length>0:-1}function T(){if(a.wrapInner('<div class="crellyslider" />'),a.find(o+" > ul").addClass("cs-slides"),a.find(o+" "+s+" > li").addClass("cs-slide"),0==(n=A().length))return!1;if(1==n){var t=B(0),r=a.find(o).find(s);t.clone().prependTo(r),n++}if(function(){if(!i.randomOrder&&0==i.startFromSlide)return;var e=new Array,t=new Array;if(-1==i.startFromSlide){var r=Math.floor(Math.random()*n);e[0]=r,t[0]=B(r)}else e[0]=i.startFromSlide,t[0]=B(i.startFromSlide);for(var c=1;c<n;c++){if(i.randomOrder)do{r=Math.floor(Math.random()*n)}while(-1!=e.indexOf(r));else r=c+e[0]<n?c+e[0]:c+e[0]-n;e[c]=r,t[c]=B(r)}a.find(o).find(s).empty();for(var c=0;c<n;c++)a.find(o).find(s).append(t[c])}(),i.showControls&&a.find(o).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),i.showNavigation){for(var d='<div class="cs-navigation">',f=0;f<n;f++)d+='<span class="cs-slide-link"></span>';d+="</div>",a.find(o).append(d)}i.showProgressBar?a.find(o).append('<div class="cs-progress-bar"></div>'):a.find(o).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),a.css("display","block"),i.responsive&&N(),I(),A().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),function(){a.find(o).find(s).css("visibility","hidden"),a.find(o).find(".cs-progress-bar").css("display","none"),a.find(o).find(".cs-navigation").css("display","none"),a.find(o).find(".cs-controls").css("display","none");var t=B(0).css("background-image");(t=t.replace(/^url\(["']?/,"").replace(/["']?\)$/,"")).match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?e("<img>").load(function(){i()}).attr("src",t).each(function(){this.complete&&e(this).load()}):i();function i(){a.find(o).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),a.find(o).find(".cs-preloader").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")}),a.find(o).find(".cs-preloader > .cs-bg").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")})}}(),function(){var t=new e.Deferred,i=A().find(".cs-yt-iframe, .cs-vimeo-iframe").length,n=0;if(0==i)return t.resolve().promise();return A().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){e(this).one("load",function(){var a,o,s,r,l;++n==i&&(o=new e.Deferred,s=A(),r=s.find(c+".cs-yt-iframe").length,l=0,0==r?o.resolve().promise():(s.each(function(){e(this).find(c+".cs-yt-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-yt-iframe-"+t.attr("id"));var i=new YT.Player(t.attr("id"),{events:{onReady:function(){++l==r&&o.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&X(t,"loop")&&i.playVideo(),p&&(e.data===YT.PlayerState.PAUSED&&(m[t.attr("id")].manually_paused=!0),e.data===YT.PlayerState.PLAYING&&(m[t.attr("id")].manually_paused=!1))}}});a={player:i,played_once:!1,manually_paused:!1},m[t.attr("id")]=a})}),o.promise())).done(function(){var i,n,a,o,s;(n=new e.Deferred,a=A(),o=a.find(c+".cs-vimeo-iframe").length,s=0,0==o?n.resolve().promise():(a.each(function(){e(this).find(c+".cs-vimeo-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-vimeo-iframe-"+t.attr("id")),t.attr("src",t.attr("src")+"&player_id="+t.attr("id"));var a=$f(t[0]);a.addEvent("ready",function(){a.addEvent("finish",function(){g[t.attr("id")].ended=!0}),a.addEvent("play",function(){g[t.attr("id")].played_once=!0,g[t.attr("id")].ended=!1,p&&(g[t.attr("id")].manually_paused=!1)}),a.addEvent("pause",function(){p&&(g[t.attr("id")].manually_paused=!0)}),X(t,"loop")&&a.api("setLoop",!0),++s==o&&n.resolve()}),i={player:a,played_once:!1,ended:!1,manually_paused:!1},g[t.attr("id")]=i})}),n.promise())).done(function(){t.resolve()})})})}),t.promise()}().done(function(){var t=setInterval(function(){"complete"==document.readyState&&a.find(o).find(".cs-preloader").length>0&&(clearInterval(t),function(){i.responsive&&N();I(),w=e(window).width(),A().each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);D(t)}),D(t)}),t.css("display","none"),t.data("opacity",parseFloat(t.css("opacity")))}),i.responsive&&e(window).resize(function(){w!=e(window).width()&&("full-width"==i.layout&&x()!=e(a).width()||e(a).width()<x()||e(a).width()>x()&&x()<i.startWidth)&&_()}),a.find(o).find(".cs-controls > .cs-previous").click(function(){V(C())}),a.find(o).find(".cs-controls > .cs-next").click(function(){V(z())}),i.enableSwipe&&(a.find(o).on("swipeleft",function(){M(),V(z())}),a.find(o).on("swiperight",function(){M(),V(C())})),a.find(o).find(".cs-navigation > .cs-slide-link").click(function(){V(e(this).index())}),i.pauseOnHover&&(a.find(o).find(s).hover(function(){O()}),a.find(o).find(s).mouseleave(function(){M()})),a.find(o).find(s).css("visibility","visible"),a.find(o).find(".cs-progress-bar").css("display","block"),a.find(o).find(".cs-navigation").css("display","block"),a.find(o).find(".cs-controls").css("display","block"),ne(B(0)),B(0).finish(),a.find(o).find(".cs-preloader").animate({opacity:0},300,function(){a.find(o).find(".cs-preloader").remove()}),i.beforeStart(),i.responsive?_():F()}())},100)})}function D(e){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):"normal"==e.css("line-height")?e.data("line-height",1.15*X(e,"font-size")):e.data("line-height",parseFloat(e.css("line-height"))*X(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity")))}function I(){var e,t;switch(i.layout){case"fixed":e=i.startWidth,t=i.startHeight,a.find(o).css({width:L(e),height:L(t)}),A().css({width:L(e),height:L(t)});break;case"full-width":e=a.width(),t=i.startHeight,a.find(o).css({width:e,height:L(t)}),A().css({width:e,height:L(t)});break;default:return!1}}function E(e){var t=(R()-i.startHeight)/2,n=(x()-i.startWidth)/2,a=0,o=0;return t>0&&(a=t),n>0&&(o=n),{top:a,left:o}}function _(){i.beforeSetResponsive();var t=A();Y(!0),t.each(function(){var t=e(this),i=t.find(c);t.finish(),ne(t),t.finish(),i.each(function(){var t=e(this);t.finish(),oe(t),t.finish(),$(t)&&Q(t)})}),N(),I(),t.each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){P(e(this))}),P(t),t.finish(),se(t),t.finish(),$(t)&&Q(t)}),t.finish(),ae(t),t.finish()}),w=e(window).width(),F()}function P(e){e.css({top:L(X(e,"top")+E().top),left:L(X(e,"left")+E().left),"padding-top":L(X(e,"padding-top")),"padding-right":L(X(e,"padding-right")),"padding-bottom":L(X(e,"padding-bottom")),"padding-left":L(X(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":L(X(e,"line-height"))+"px","letter-spacing":L(X(e,"letter-spacing")),"font-size":L(X(e,"font-size"))}):e.css({width:L(X(e,"width")),height:L(X(e,"height"))})}function N(){var e=a.width(),t=i.startWidth;b=e>=t||!i.responsive?1:e/t}function L(e){return e*b}function F(){i.automaticSlide?function e(){j(l).done(function(){d||(l=z(),e())})}():j(l),u=!1}function Y(t){for(var i=0;i<v.length;i++)v[i].clear();for(i=0;i<y.length;i++)y[i].clear();h.clear(),A().each(function(){var i=e(this);t?i.finish():i.stop(!0,!0),i.find(c).each(function(){var i=e(this);t?i.finish():i.stop(!0,!0)})}),W()}function O(){!d&&p&&(i.beforePause(),a.find(o).find(".cs-progress-bar").stop(!0),h.pause(),d=!0)}function M(){if(d&&p){i.beforeResume();var e=a.find(o).find(".cs-progress-bar"),t=(X(B(l),"time"),h.getRemaining());e.animate({width:"100%"},t),h.resume(),d=!1}}function x(){return a.find(o).width()}function R(){return a.find(o).height()}function z(){return l+1==n?0:l+1}function C(){return l-1<0?n-1:l-1}function X(e,t){var n;switch(n=!!e.parent("ul").hasClass("cs-slides"),t){case"ease-in":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseIn:parseInt(e.data(t));case"ease-out":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?i.elementsDelay:parseInt(e.data(t));case"time":return n?isNaN(parseInt(e.data(t)))?i.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?i.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoAutoplay;case"loop":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));case"in":case"out":case"opacity":return e.data(t);default:return!1}}function A(){return a.find(o).find(s).find(r)}function B(e){return A().eq(e)}function H(e,t){var i,n,a=t;this.pause=function(){clearTimeout(i),a-=new Date-n},this.resume=function(){n=new Date,clearTimeout(i),i=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(i)},this.getRemaining=function(){return a},this.resume()}function U(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function W(){var e=a.find(o).find(".cs-progress-bar");e.stop(),e.css("width",0)}function V(e){e!=l&&(p||f)&&(Y(!1),q(l,!1,!0).done(function(){l=e,F()}))}function j(t){i.beforeSlideStart();var n,s,r,d,u,b=new e.Deferred;f=!1;for(var w=0;w<v.length;w++)v[w].clear();for(w=0;w<y.length;w++)y[w].clear();return h.clear(),B(t).finish(),ae(t),B(t).finish(),B(t).find(c).each(function(){var t=e(this);t.finish(),se(t),t.finish()}),a.find(o).find(".cs-navigation").find("> .cs-slide-link").each(function(){var t=e(this);t.index()==l?t.addClass("cs-active"):t.removeClass("cs-active")}),s=B(n=t).find(c),r=0,d=!1,u=new e.Deferred,p=!1,ne(n).done(function(){var e;e=a.find(o).find(".cs-progress-bar"),W(),e.animate({width:"100%"},X(B(l),"time")),p=!0,(d=!0)&&r==s.length&&u.resolve()}),s.each(function(){var t=e(this),i=X(t,"delay");y.push(new H(function(){oe(t).done(function(){var e,i,n;$(t)&&(G(n=t)?(!X(i=n,"autoplay")||m[i.attr("id")].played_once||U()||K(i).playVideo(),2!=Z(i)||m[i.attr("id")].manually_paused||K(i).playVideo(),m[i.attr("id")].played_once=!0):(!X(e=n,"autoplay")||g[e.attr("id")].played_once||U()||te(e).api("play"),te(e).api("paused")&&!g[e.attr("id")].ended&&g[e.attr("id")].played_once&&!g[e.attr("id")].manually_paused&&te(e).api("play"))),r++,d&&r==s.length&&u.resolve()})},i))}),u.promise(),i.automaticSlide?q(t,!0,!0).done(function(){f=!0,b.resolve()}):q(t,!0,!1).done(function(){f=!0,b.resolve()}),b.promise()}function q(t,i,n){var a=B(t),o=a.find(c),s=i?X(a,"time")+X(a,"ease-in"):0,r=0,l=!1,d=new e.Deferred;return o.each(function(){var a=e(this),s=X(a,"time");if("all"!=s){var c=i?s:0;X(a,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),v.push(new H(function(){se(a).done(function(){X(a,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))})},c))}}),h=new H(function(){p=!1,W(),l=!0,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()),n?o.each(function(){var i=e(this);"all"==X(i,"time")&&(X(i,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),se(i).done(function(){X(i,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))}))}):d.resolve()},s),d.promise()}function $(e){return G(e)||e.hasClass("cs-vimeo-iframe")}function J(t){B(t).each(function(){var t=e(this);t.find(c+".cs-yt-iframe").each(function(){ee(e(this))})}),B(t).each(function(){var t=e(this);t.find(c+".cs-vimeo-iframe").each(function(){ie(e(this))})})}function Q(e){G(e)?ee(e):ie(e)}function G(e){return e.hasClass("cs-yt-iframe")}function K(e){return m[e.attr("id")].player}function Z(e){return K(e).getPlayerState()}function ee(e){1==Z(e)&&K(e).pauseVideo()}function te(e){return g[e.attr("id")].player}function ie(e){te(e).api("pause")}function ne(t){var i=B(t),n=X(i,"in"),a=X(i,"ease-in"),o=new e.Deferred;if("block"==i.css("display"))return o.resolve().promise();if(u)return i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve().promise();switch(n){case"fade":i.css({display:"block",top:0,left:0,opacity:0}),i.animate({opacity:X(i,"opacity")},a,function(){o.resolve()});break;case"fadeLeft":i.css({display:"block",top:0,left:x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"fadeRight":i.css({display:"block",top:0,left:-x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"slideLeft":i.css({display:"block",top:0,left:x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideRight":i.css({display:"block",top:0,left:-x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideUp":i.css({display:"block",top:R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;case"slideDown":i.css({display:"block",top:-R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;default:i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve()}return o.promise()}function ae(t){var i=B(t),n=X(i,"out"),a=X(i,"ease-out"),o=new e.Deferred;if("none"==i.css("display"))return o.resolve().promise();switch(n){case"fade":i.animate({opacity:0},a,function(){i.css({display:"none",opacity:X(i,"opacity")}),o.resolve()});break;case"fadeLeft":i.animate({opacity:0,left:-x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"fadeRight":i.animate({opacity:0,left:x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"slideLeft":i.animate({left:-x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideRight":i.animate({left:x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideUp":i.animate({top:-R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;case"slideDown":i.animate({top:R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;default:i.css({display:"none"}),o.resolve()}return o.promise()}function oe(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"in"),o=X(t,"ease-in"),s=X(t,"top"),r=X(t,"left"),c=new e.Deferred;if("block"==t.css("display"))return c.resolve().promise();switch(a){case"slideDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"slideRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"fade":t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:0}).animate({opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallDown":t.css({display:"block",top:L(s+E().top-30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallUp":t.css({display:"block",top:L(s+E().top+30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallLeft":t.css({display:"block",top:L(s+E().top),left:L(r+E().left+30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallRight":t.css({display:"block",top:L(s+E().top),left:L(r+E().left-30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;default:t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:X(t,"opacity")}),c.resolve()}return c.promise()}function se(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"out"),o=X(t,"ease-out"),s=new e.Deferred;if("none"==t.css("display"))return s.resolve().promise();switch(a){case"slideDown":t.animate({top:R()},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideUp":t.animate({top:-n},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideLeft":t.animate({left:-i},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideRight":t.animate({left:x()},o,function(){t.css({display:"none"}),s.resolve()});break;case"fade":t.animate({opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeDown":t.animate({top:R(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeUp":t.animate({top:-n,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeLeft":t.animate({left:-i,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeRight":t.animate({left:x(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallDown":t.animate({top:L(X(t,"top")+E().top+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallUp":t.animate({top:L(X(t,"top")+E().top-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallLeft":t.animate({left:L(X(t,"left")+E().left-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallRight":t.animate({left:L(X(t,"left")+E().left+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;default:t.css({display:"none"}),s.resolve()}return s.promise()}this.resume=function(){M()},this.pause=function(){O()},this.nextSlide=function(){V(z())},this.previousSlide=function(){V(C())},this.changeSlide=function(e){V(e)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return n}},e.fn.crellySlider=function(t){var i=e.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},t);return this.each(function(){if(null==e(this).data("crellySlider")){var t=new e.CrellySlider(this,i);e(this).data("crellySlider",t)}})}}(jQuery);
1
+ /**
2
+ * Plugin Name: Crelly Slider
3
+ * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.7
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
+ * License: MIT
9
+ */
10
+
11
  var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(e){var t,i,n;t=this,i=document,n=function(e,t,i,n){var a,o;(function(e,t,i,n){function a(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(t){for(var i,n,a={};t;){for(n in i=e.data(t,k))i[n]&&(a[n]=a.hasVirtualBinding=!0);t=t.parentNode}return a}function s(){M=!0}function r(){M=!1}function c(){l(),P=setTimeout(function(){P=0,C=0,Y.length=0,O=!1,s()},e.vmouse.resetTimerDuration)}function l(){P&&(clearTimeout(P),P=0)}function d(t,i,o){var s;return(o&&o[t]||!o&&function(t,i){for(var n;t;){if((n=e.data(t,k))&&(!i||n[i]))return t;t=t.parentNode}return null}(i.target,t))&&(s=function(t,i){var o,s,r,c,l,d,p,f,u,h=t.type;if((t=e.Event(t)).type=i,o=t.originalEvent,s=e.event.props,h.search(/^(mouse|click)/)>-1&&(s=E),o)for(p=s.length;p;)t[c=s[--p]]=o[c];if(h.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==h.search(/^touch/)&&(h=(r=a(o)).touches,l=r.changedTouches,d=h&&h.length?h[0]:l&&l.length?l[0]:n))for(f=0,u=D.length;f<u;f++)t[c=D[f]]=d[c];return t}(i,t),e(i.target).trigger(s)),s}function p(t){var i,n=e.data(t.target,S);!O&&(!C||C!==n)&&((i=d("v"+t.type,t))&&(i.isDefaultPrevented()&&t.preventDefault(),i.isPropagationStopped()&&t.stopPropagation(),i.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function f(t){var i,n,s,c=a(t).touches;c&&1===c.length&&((n=o(i=t.target)).hasVirtualBinding&&(C=z++,e.data(i,S,C),l(),r(),F=!1,s=a(t).touches[0],N=s.pageX,L=s.pageY,d("vmouseover",t,n),d("vmousedown",t,n)))}function u(e){M||(F||d("vmousecancel",e,o(e.target)),F=!0,c())}function h(t){if(!M){var i=a(t).touches[0],n=F,s=e.vmouse.moveDistanceThreshold,r=o(t.target);(F=F||Math.abs(i.pageX-N)>s||Math.abs(i.pageY-L)>s)&&!n&&d("vmousecancel",t,r),d("vmousemove",t,r),c()}}function v(e){if(!M){s();var t,i,n=o(e.target);d("vmouseup",e,n),F||(t=d("vclick",e,n))&&t.isDefaultPrevented()&&(i=a(e).changedTouches[0],Y.push({touchID:C,x:i.clientX,y:i.clientY}),O=!0),d("vmouseout",e,n),F=!1,c()}}function y(t){var i,n=e.data(t,k);if(n)for(i in n)if(n[i])return!0;return!1}function m(){}function g(t){var i=t.substr(1);return{setup:function(){y(this)||e.data(this,k,{}),e.data(this,k)[t]=!0,_[t]=(_[t]||0)+1,1===_[t]&&R.bind(i,p),e(this).bind(i,m),x&&(_.touchstart=(_.touchstart||0)+1,1===_.touchstart&&R.bind("touchstart",f).bind("touchend",v).bind("touchmove",h).bind("scroll",u))},teardown:function(){--_[t],_[t]||R.unbind(i,p),x&&(--_.touchstart,_.touchstart||R.unbind("touchstart",f).unbind("touchmove",h).unbind("touchend",v).unbind("scroll",u));var n=e(this),a=e.data(this,k);a&&(a[t]=!1),n.unbind(i,m),y(this)||n.removeData(k)}}}var b,w,k="virtualMouseBindings",S="virtualTouchID",T="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),D="clientX clientY pageX pageY screenX screenY".split(" "),I=e.event.mouseHooks?e.event.mouseHooks.props:[],E=e.event.props.concat(I),_={},P=0,N=0,L=0,F=!1,Y=[],O=!1,M=!1,x="addEventListener"in i,R=e(i),z=1,C=0;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},w=0;w<T.length;w++)e.event.special[T[w]]=g(T[w]);x&&i.addEventListener("click",function(t){var i,n,a,o,s,r=Y.length,c=t.target;if(r)for(i=t.clientX,n=t.clientY,b=e.vmouse.clickDistanceThreshold,a=c;a;){for(o=0;o<r;o++)if(s=Y[o],0,a===c&&Math.abs(s.x-i)<b&&Math.abs(s.y-n)<b||e.data(a,S)===s.touchID)return t.preventDefault(),void t.stopPropagation();a=a.parentNode}},!0)})(e,0,i),e.mobile={},o={touch:"ontouchend"in i},(a=e).mobile.support=a.mobile.support||{},a.extend(a.support,o),a.extend(a.mobile.support,o),function(e,t,n){function a(t,i,a,o){var s=a.type;a.type=i,o?e.event.trigger(a,n,t):e.event.dispatch.call(t,a),a.type=s}var o=e(i),s=e.mobile.support.touch,r="touchmove scroll",c=s?"touchstart":"mousedown",l=s?"touchend":"mouseup",d=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,i){e.fn[i]=function(e){return e?this.bind(i,e):this.trigger(i)},e.attrFn&&(e.attrFn[i]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){a(o,(i=t)?"scrollstart":"scrollstop",e)}var i,n,o=this;e(o).bind(r,function(a){e.event.special.scrollstart.enabled&&(i||t(a,!0),clearTimeout(n),n=setTimeout(function(){t(a,!1)},50))})},teardown:function(){e(this).unbind(r)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,i=e(t),n=!1;i.bind("vmousedown",function(s){function r(){clearTimeout(d)}function c(){r(),i.unbind("vclick",l).unbind("vmouseup",r),o.unbind("vmousecancel",c)}function l(e){c(),n||p!==e.target?n&&e.preventDefault():a(t,"tap",e)}if(n=!1,s.which&&1!==s.which)return!1;var d,p=s.target;i.bind("vmouseup",r).bind("vclick",l),o.bind("vmousecancel",c),d=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(n=!0),a(t,"taphold",e.Event("taphold",{target:p}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),o.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var i=t.pageXOffset,n=t.pageYOffset,a=e.clientX,o=e.clientY;return 0===e.pageY&&Math.floor(o)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(a)>Math.floor(e.pageX)?(a-=i,o-=n):(o<e.pageY-n||a<e.pageX-i)&&(a=e.pageX-i,o=e.pageY-n),{x:a,y:o}},start:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y],origin:e(t.target)}},stop:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y]}},handleSwipe:function(t,i,n,o){if(i.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-i.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-i.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>i.coords[0]?"swipeleft":"swiperight";return a(n,"swipe",e.Event("swipe",{target:o,swipestart:t,swipestop:i}),!0),a(n,s,e.Event(s,{target:o,swipestart:t,swipestop:i}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,i=this,n=e(i),a={};(t=e.data(this,"mobile-events"))||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=a,a.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var n,s=e.event.special.swipe.start(t),r=t.target,c=!1;a.move=function(t){s&&!t.isDefaultPrevented()&&(n=e.event.special.swipe.stop(t),c||(c=e.event.special.swipe.handleSwipe(s,n,i,r))&&(e.event.special.swipe.eventInProgress=!1),Math.abs(s.coords[0]-n.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault())},a.stop=function(){c=!0,e.event.special.swipe.eventInProgress=!1,o.off(d,a.move),a.move=null},o.on(d,a.move).one(l,a.stop)}},n.on(c,a.start)},teardown:function(){var t,i;(t=e.data(this,"mobile-events"))&&(i=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),i&&(i.start&&e(this).off(c,i.start),i.move&&o.off(d,i.move),i.stop&&o.off(l,i.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,i){e.event.special[t]={setup:function(){e(this).bind(i,e.noop)},teardown:function(){e(this).unbind(i)}}})}(e,this)},"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(e,0,i),e.mobile}):n(t.jQuery,0,i),e.CrellySlider=function(t,i){var n,a=e(t),o="div.crellyslider",s="ul.cs-slides",r="li.cs-slide",c="> *",l=0,d=!1,p=!1,f=!1,u=!0,h=new H(function(){},0),v=new Array,y=new Array,m={},g={},b=1,w=0;if(!crellyslider_youtube_api_ready&&S("youtube")&&function(){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),crellyslider_youtube_api_ready=!0}(),!crellyslider_vimeo_api_ready&&S("vimeo")&&(!function(){function e(t){return new e.fn.init(t)}function t(e,t,i){if(!i.contentWindow.postMessage)return!1;e=JSON.stringify({method:e,value:t}),i.contentWindow.postMessage(e,s)}function i(e){var t,i;try{i=(t=JSON.parse(e.data)).event||t.method}catch(e){}if("ready"!=i||o||(o=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===s&&(s=e.origin),e=t.value;var n=t.data,r=""===r?null:t.player_id;return t=r?a[r][i]:a[i],i=[],!!t&&(void 0!==e&&i.push(e),n&&i.push(n),r&&i.push(r),0<i.length?t.apply(null,i):t.call())}function n(e,t,i){i?(a[i]||(a[i]={}),a[i][e]=t):a[e]=t}var a={},o=!1,s="*";e.fn=e.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,i){if(!this.element||!e)return!1;var a=this.element,o=""!==a.id?a.id:null,s=i&&i.constructor&&i.call&&i.apply?null:i,r=i&&i.constructor&&i.call&&i.apply?i:null;return r&&n(e,r,o),t(e,s,a),this},addEvent:function(e,i){if(!this.element)return!1;var a=this.element,s=""!==a.id?a.id:null;return n(e,i,s),"ready"!=e?t("addEventListener",e,a):"ready"==e&&o&&i.call(null,s),this},removeEvent:function(e){if(!this.element)return!1;var i=this.element,n=""!==i.id?i.id:null;e:{if(n&&a[n]){if(!a[n][e]){n=!1;break e}a[n][e]=null}else{if(!a[e]){n=!1;break e}a[e]=null}n=!0}"ready"!=e&&n&&t("removeEventListener",e,i)}},e.fn.init.prototype=e.fn,window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent("onmessage",i),window.Froogaloop=window.$f=e}(),crellyslider_vimeo_api_ready=!0),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&void 0!==YT.Player)T();else var k=setInterval(function(){"undefined"!=typeof YT&&void 0!==YT.Player&&(clearInterval(k),T())},100);function S(e){return"youtube"==e?a.find(".cs-yt-iframe").length>0:"vimeo"==e?a.find(".cs-vimeo-iframe").length>0:-1}function T(){if(a.wrapInner('<div class="crellyslider" />'),a.find(o+" > ul").addClass("cs-slides"),a.find(o+" "+s+" > li").addClass("cs-slide"),0==(n=A().length))return!1;if(1==n){var t=B(0),r=a.find(o).find(s);t.clone().prependTo(r),n++}if(function(){if(!i.randomOrder&&0==i.startFromSlide)return;var e=new Array,t=new Array;if(-1==i.startFromSlide){var r=Math.floor(Math.random()*n);e[0]=r,t[0]=B(r)}else e[0]=i.startFromSlide,t[0]=B(i.startFromSlide);for(var c=1;c<n;c++){if(i.randomOrder)do{r=Math.floor(Math.random()*n)}while(-1!=e.indexOf(r));else r=c+e[0]<n?c+e[0]:c+e[0]-n;e[c]=r,t[c]=B(r)}a.find(o).find(s).empty();for(var c=0;c<n;c++)a.find(o).find(s).append(t[c])}(),i.showControls&&a.find(o).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),i.showNavigation){for(var d='<div class="cs-navigation">',f=0;f<n;f++)d+='<span class="cs-slide-link"></span>';d+="</div>",a.find(o).append(d)}i.showProgressBar?a.find(o).append('<div class="cs-progress-bar"></div>'):a.find(o).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),a.css("display","block"),i.responsive&&N(),I(),A().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),function(){a.find(o).find(s).css("visibility","hidden"),a.find(o).find(".cs-progress-bar").css("display","none"),a.find(o).find(".cs-navigation").css("display","none"),a.find(o).find(".cs-controls").css("display","none");var t=B(0).css("background-image");(t=t.replace(/^url\(["']?/,"").replace(/["']?\)$/,"")).match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?e("<img>").load(function(){i()}).attr("src",t).each(function(){this.complete&&e(this).load()}):i();function i(){a.find(o).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),a.find(o).find(".cs-preloader").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")}),a.find(o).find(".cs-preloader > .cs-bg").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")})}}(),function(){var t=new e.Deferred,i=A().find(".cs-yt-iframe, .cs-vimeo-iframe").length,n=0;if(0==i)return t.resolve().promise();return A().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){e(this).one("load",function(){var a,o,s,r,l;++n==i&&(o=new e.Deferred,s=A(),r=s.find(c+".cs-yt-iframe").length,l=0,0==r?o.resolve().promise():(s.each(function(){e(this).find(c+".cs-yt-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-yt-iframe-"+t.attr("id"));var i=new YT.Player(t.attr("id"),{events:{onReady:function(){++l==r&&o.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&X(t,"loop")&&i.playVideo(),p&&(e.data===YT.PlayerState.PAUSED&&(m[t.attr("id")].manually_paused=!0),e.data===YT.PlayerState.PLAYING&&(m[t.attr("id")].manually_paused=!1))}}});a={player:i,played_once:!1,manually_paused:!1},m[t.attr("id")]=a})}),o.promise())).done(function(){var i,n,a,o,s;(n=new e.Deferred,a=A(),o=a.find(c+".cs-vimeo-iframe").length,s=0,0==o?n.resolve().promise():(a.each(function(){e(this).find(c+".cs-vimeo-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-vimeo-iframe-"+t.attr("id")),t.attr("src",t.attr("src")+"&player_id="+t.attr("id"));var a=$f(t[0]);a.addEvent("ready",function(){a.addEvent("finish",function(){g[t.attr("id")].ended=!0}),a.addEvent("play",function(){g[t.attr("id")].played_once=!0,g[t.attr("id")].ended=!1,p&&(g[t.attr("id")].manually_paused=!1)}),a.addEvent("pause",function(){p&&(g[t.attr("id")].manually_paused=!0)}),X(t,"loop")&&a.api("setLoop",!0),++s==o&&n.resolve()}),i={player:a,played_once:!1,ended:!1,manually_paused:!1},g[t.attr("id")]=i})}),n.promise())).done(function(){t.resolve()})})})}),t.promise()}().done(function(){var t=setInterval(function(){"complete"==document.readyState&&a.find(o).find(".cs-preloader").length>0&&(clearInterval(t),function(){i.responsive&&N();I(),w=e(window).width(),A().each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);D(t)}),D(t)}),t.css("display","none"),t.data("opacity",parseFloat(t.css("opacity")))}),i.responsive&&e(window).resize(function(){w!=e(window).width()&&("full-width"==i.layout&&x()!=e(a).width()||e(a).width()<x()||e(a).width()>x()&&x()<i.startWidth)&&_()}),a.find(o).find(".cs-controls > .cs-previous").click(function(){V(C())}),a.find(o).find(".cs-controls > .cs-next").click(function(){V(z())}),i.enableSwipe&&(a.find(o).on("swipeleft",function(){M(),V(z())}),a.find(o).on("swiperight",function(){M(),V(C())})),a.find(o).find(".cs-navigation > .cs-slide-link").click(function(){V(e(this).index())}),i.pauseOnHover&&(a.find(o).find(s).hover(function(){O()}),a.find(o).find(s).mouseleave(function(){M()})),a.find(o).find(s).css("visibility","visible"),a.find(o).find(".cs-progress-bar").css("display","block"),a.find(o).find(".cs-navigation").css("display","block"),a.find(o).find(".cs-controls").css("display","block"),ne(B(0)),B(0).finish(),a.find(o).find(".cs-preloader").animate({opacity:0},300,function(){a.find(o).find(".cs-preloader").remove()}),i.beforeStart(),i.responsive?_():F()}())},100)})}function D(e){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):"normal"==e.css("line-height")?e.data("line-height",1.15*X(e,"font-size")):e.data("line-height",parseFloat(e.css("line-height"))*X(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity")))}function I(){var e,t;switch(i.layout){case"fixed":e=i.startWidth,t=i.startHeight,a.find(o).css({width:L(e),height:L(t)}),A().css({width:L(e),height:L(t)});break;case"full-width":e=a.width(),t=i.startHeight,a.find(o).css({width:e,height:L(t)}),A().css({width:e,height:L(t)});break;default:return!1}}function E(e){var t=(R()-i.startHeight)/2,n=(x()-i.startWidth)/2,a=0,o=0;return t>0&&(a=t),n>0&&(o=n),{top:a,left:o}}function _(){i.beforeSetResponsive();var t=A();Y(!0),t.each(function(){var t=e(this),i=t.find(c);t.finish(),ne(t),t.finish(),i.each(function(){var t=e(this);t.finish(),oe(t),t.finish(),$(t)&&Q(t)})}),N(),I(),t.each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){P(e(this))}),P(t),t.finish(),se(t),t.finish(),$(t)&&Q(t)}),t.finish(),ae(t),t.finish()}),w=e(window).width(),F()}function P(e){e.css({top:L(X(e,"top")+E().top),left:L(X(e,"left")+E().left),"padding-top":L(X(e,"padding-top")),"padding-right":L(X(e,"padding-right")),"padding-bottom":L(X(e,"padding-bottom")),"padding-left":L(X(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":L(X(e,"line-height"))+"px","letter-spacing":L(X(e,"letter-spacing")),"font-size":L(X(e,"font-size"))}):e.css({width:L(X(e,"width")),height:L(X(e,"height"))})}function N(){var e=a.width(),t=i.startWidth;b=e>=t||!i.responsive?1:e/t}function L(e){return e*b}function F(){i.automaticSlide?function e(){j(l).done(function(){d||(l=z(),e())})}():j(l),u=!1}function Y(t){for(var i=0;i<v.length;i++)v[i].clear();for(i=0;i<y.length;i++)y[i].clear();h.clear(),A().each(function(){var i=e(this);t?i.finish():i.stop(!0,!0),i.find(c).each(function(){var i=e(this);t?i.finish():i.stop(!0,!0)})}),W()}function O(){!d&&p&&(i.beforePause(),a.find(o).find(".cs-progress-bar").stop(!0),h.pause(),d=!0)}function M(){if(d&&p){i.beforeResume();var e=a.find(o).find(".cs-progress-bar"),t=(X(B(l),"time"),h.getRemaining());e.animate({width:"100%"},t),h.resume(),d=!1}}function x(){return a.find(o).width()}function R(){return a.find(o).height()}function z(){return l+1==n?0:l+1}function C(){return l-1<0?n-1:l-1}function X(e,t){var n;switch(n=!!e.parent("ul").hasClass("cs-slides"),t){case"ease-in":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseIn:parseInt(e.data(t));case"ease-out":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?i.elementsDelay:parseInt(e.data(t));case"time":return n?isNaN(parseInt(e.data(t)))?i.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?i.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoAutoplay;case"loop":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));case"in":case"out":case"opacity":return e.data(t);default:return!1}}function A(){return a.find(o).find(s).find(r)}function B(e){return A().eq(e)}function H(e,t){var i,n,a=t;this.pause=function(){clearTimeout(i),a-=new Date-n},this.resume=function(){n=new Date,clearTimeout(i),i=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(i)},this.getRemaining=function(){return a},this.resume()}function U(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function W(){var e=a.find(o).find(".cs-progress-bar");e.stop(),e.css("width",0)}function V(e){e!=l&&(p||f)&&(Y(!1),q(l,!1,!0).done(function(){l=e,F()}))}function j(t){i.beforeSlideStart();var n,s,r,d,u,b=new e.Deferred;f=!1;for(var w=0;w<v.length;w++)v[w].clear();for(w=0;w<y.length;w++)y[w].clear();return h.clear(),B(t).finish(),ae(t),B(t).finish(),B(t).find(c).each(function(){var t=e(this);t.finish(),se(t),t.finish()}),a.find(o).find(".cs-navigation").find("> .cs-slide-link").each(function(){var t=e(this);t.index()==l?t.addClass("cs-active"):t.removeClass("cs-active")}),s=B(n=t).find(c),r=0,d=!1,u=new e.Deferred,p=!1,ne(n).done(function(){var e;e=a.find(o).find(".cs-progress-bar"),W(),e.animate({width:"100%"},X(B(l),"time")),p=!0,(d=!0)&&r==s.length&&u.resolve()}),s.each(function(){var t=e(this),i=X(t,"delay");y.push(new H(function(){oe(t).done(function(){var e,i,n;$(t)&&(G(n=t)?(!X(i=n,"autoplay")||m[i.attr("id")].played_once||U()||K(i).playVideo(),2!=Z(i)||m[i.attr("id")].manually_paused||K(i).playVideo(),m[i.attr("id")].played_once=!0):(!X(e=n,"autoplay")||g[e.attr("id")].played_once||U()||te(e).api("play"),te(e).api("paused")&&!g[e.attr("id")].ended&&g[e.attr("id")].played_once&&!g[e.attr("id")].manually_paused&&te(e).api("play"))),r++,d&&r==s.length&&u.resolve()})},i))}),u.promise(),i.automaticSlide?q(t,!0,!0).done(function(){f=!0,b.resolve()}):q(t,!0,!1).done(function(){f=!0,b.resolve()}),b.promise()}function q(t,i,n){var a=B(t),o=a.find(c),s=i?X(a,"time")+X(a,"ease-in"):0,r=0,l=!1,d=new e.Deferred;return o.each(function(){var a=e(this),s=X(a,"time");if("all"!=s){var c=i?s:0;X(a,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),v.push(new H(function(){se(a).done(function(){X(a,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))})},c))}}),h=new H(function(){p=!1,W(),l=!0,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()),n?o.each(function(){var i=e(this);"all"==X(i,"time")&&(X(i,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),se(i).done(function(){X(i,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))}))}):d.resolve()},s),d.promise()}function $(e){return G(e)||e.hasClass("cs-vimeo-iframe")}function J(t){B(t).each(function(){var t=e(this);t.find(c+".cs-yt-iframe").each(function(){ee(e(this))})}),B(t).each(function(){var t=e(this);t.find(c+".cs-vimeo-iframe").each(function(){ie(e(this))})})}function Q(e){G(e)?ee(e):ie(e)}function G(e){return e.hasClass("cs-yt-iframe")}function K(e){return m[e.attr("id")].player}function Z(e){return K(e).getPlayerState()}function ee(e){1==Z(e)&&K(e).pauseVideo()}function te(e){return g[e.attr("id")].player}function ie(e){te(e).api("pause")}function ne(t){var i=B(t),n=X(i,"in"),a=X(i,"ease-in"),o=new e.Deferred;if("block"==i.css("display"))return o.resolve().promise();if(u)return i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve().promise();switch(n){case"fade":i.css({display:"block",top:0,left:0,opacity:0}),i.animate({opacity:X(i,"opacity")},a,function(){o.resolve()});break;case"fadeLeft":i.css({display:"block",top:0,left:x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"fadeRight":i.css({display:"block",top:0,left:-x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"slideLeft":i.css({display:"block",top:0,left:x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideRight":i.css({display:"block",top:0,left:-x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideUp":i.css({display:"block",top:R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;case"slideDown":i.css({display:"block",top:-R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;default:i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve()}return o.promise()}function ae(t){var i=B(t),n=X(i,"out"),a=X(i,"ease-out"),o=new e.Deferred;if("none"==i.css("display"))return o.resolve().promise();switch(n){case"fade":i.animate({opacity:0},a,function(){i.css({display:"none",opacity:X(i,"opacity")}),o.resolve()});break;case"fadeLeft":i.animate({opacity:0,left:-x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"fadeRight":i.animate({opacity:0,left:x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"slideLeft":i.animate({left:-x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideRight":i.animate({left:x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideUp":i.animate({top:-R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;case"slideDown":i.animate({top:R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;default:i.css({display:"none"}),o.resolve()}return o.promise()}function oe(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"in"),o=X(t,"ease-in"),s=X(t,"top"),r=X(t,"left"),c=new e.Deferred;if("block"==t.css("display"))return c.resolve().promise();switch(a){case"slideDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"slideRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"fade":t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:0}).animate({opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallDown":t.css({display:"block",top:L(s+E().top-30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallUp":t.css({display:"block",top:L(s+E().top+30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallLeft":t.css({display:"block",top:L(s+E().top),left:L(r+E().left+30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallRight":t.css({display:"block",top:L(s+E().top),left:L(r+E().left-30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;default:t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:X(t,"opacity")}),c.resolve()}return c.promise()}function se(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"out"),o=X(t,"ease-out"),s=new e.Deferred;if("none"==t.css("display"))return s.resolve().promise();switch(a){case"slideDown":t.animate({top:R()},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideUp":t.animate({top:-n},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideLeft":t.animate({left:-i},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideRight":t.animate({left:x()},o,function(){t.css({display:"none"}),s.resolve()});break;case"fade":t.animate({opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeDown":t.animate({top:R(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeUp":t.animate({top:-n,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeLeft":t.animate({left:-i,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeRight":t.animate({left:x(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallDown":t.animate({top:L(X(t,"top")+E().top+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallUp":t.animate({top:L(X(t,"top")+E().top-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallLeft":t.animate({left:L(X(t,"left")+E().left-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallRight":t.animate({left:L(X(t,"left")+E().left+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;default:t.css({display:"none"}),s.resolve()}return s.promise()}this.resume=function(){M()},this.pause=function(){O()},this.nextSlide=function(){V(z())},this.previousSlide=function(){V(C())},this.changeSlide=function(e){V(e)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return n}},e.fn.crellySlider=function(t){var i=e.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},t);return this.each(function(){if(null==e(this).data("crellySlider")){var t=new e.CrellySlider(this,i);e(this).data("crellySlider",t)}})}}(jQuery);
readme.txt CHANGED
@@ -1,190 +1,193 @@
1
- === Crelly Slider ===
2
- Contributors: fabiorino
3
- Donate link: http://crellyslider.altervista.org/contribute-and-support/
4
- Tags: animations, layers, texts, images, videos
5
- Requires at least: 3.9
6
- Tested up to: 5.4
7
- Stable tag: 1.3.6
8
- License: MIT
9
- License URI: http://opensource.org/licenses/MIT
10
-
11
- A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
12
-
13
- == Description ==
14
-
15
- Crelly Slider is a Free / Open Source responsive WordPress slider that supports layers. You can add Texts, Images, YouTube/Vimeo videos using a powerful Drag & Drop Builder and animate each of them. It is perfect to display your creative content in posts and pages.
16
- <br />
17
- <br />
18
- <a href="http://crellyslider.altervista.org/">Official WebSite (with live demo)</a>
19
- <br />
20
- = User Friendly Admin Panel =
21
- Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
22
-
23
- = High Cross Browser Compatibility =
24
- Most of the animations and the transitions are written in jQuery (using the "animate" function). In this way we can assure the compatibility with modern (even Android and iOs) and older browsers.
25
-
26
- = Drag and Drop Builder =
27
- How can you position all the elements in to the slider area? You just simply drag them in to the desired position. Like in Powerpoint, you just have to move the object around the Slide.
28
-
29
- = Transitions & Animations =
30
- Foreach element and slide you can choose an in animation and an out animation using a simple selection menu. You can set the transition speeds and how long the element will take to get in and out.
31
-
32
- = Completely Responsive =
33
- Responsive means that the Slider will be displayed correctly in every resolution that the user will use. If the display is small (like in a smartphone), the slides and the elements will be scaled to be adapted.
34
-
35
- = Full & Fixed Width Modes =
36
- Using Crelly Slider you can select between a fixed or a full-width layout (both of them can be responsive). You are the designer, you own the WebSite, just choose the best for it.
37
-
38
- == Installation ==
39
-
40
- Download this plugin directly from your Wordpress Admin Page.
41
- <br />
42
- Click Install.
43
- <br />
44
- Click Activate.
45
- <br />
46
- You can find the documentation <a href="http://crellyslider.altervista.org/documentation/">here</a>.
47
-
48
- == Screenshots ==
49
-
50
- 1. An example of a slide you can create
51
- 2. Unlimited sliders
52
- 3. Slider settings
53
- 4. Slides and elements options (in this case, a text element)
54
-
55
- == Changelog ==
56
-
57
- = 1.3.6 =
58
- * Fixed PHP warning "Cannot modify header information - headers already sent" as reported <a href="https://wordpress.org/support/topic/incompatibility-with-athemes-sydney-pros-customizer">here</a>
59
-
60
- = 1.3.5 =
61
- * Security patch
62
- * Improved import/export slider functions. They should now be compatible with web hosting services that block file_get_contents
63
- * Minor changes and bux fixes
64
-
65
- = 1.3.4 =
66
- * French translation moved to Polyglots. If you want to contribute to translate Crelly Slider in your language, check out <a href="https://translate.wordpress.org/projects/wp-plugins/crelly-slider">this page</a>
67
- * Fixed error with old PHP versions
68
-
69
- = 1.3.3 =
70
- * Fixed responsiveness on small devices
71
- * Spanish, Serbian and Slovak translations moved to Polyglots. If you want to contribute to translate Crelly Slider in your language, check out <a href="https://translate.wordpress.org/projects/wp-plugins/crelly-slider">this page</a>
72
-
73
- = 1.3.2 =
74
- * Fixed slide link not working
75
-
76
- = 1.3.1 =
77
- * Fixed syntax error in old php versions
78
-
79
- = 1.3.0 =
80
- * New feature: sliders can be scheduled (you can specify from when and how long they should be displayed for)
81
- * When a video is manually paused by the user, it won't resume automatically at the next slides loop
82
- * For developers: TinyMCE settings are now hookable (credits to dlaxar https://github.com/fabiorino/crelly-slider/commits?author=dlaxar)
83
- * For developers: sliders can be imported via code
84
- * Other minor changes and bug fixes
85
-
86
- = 1.2.3 =
87
- * Bug fix: align left/center/right buttons not working
88
-
89
- = 1.2.2 =
90
- * Bug fix: fixed incompatibility with WordPress 4.8
91
-
92
- = 1.2.1 =
93
- * Bug fix: if the user setting "Disable the visual editor when writing" was enabled, there were JavaScript errors
94
- * Other minor changes and bug fixes
95
-
96
- = 1.2.0 =
97
- * New feature: texts can be edited with the default WordPress editor (TinyMCE)
98
- * New feature: the order of the slides can be set to "random"
99
- * New feature: you can select the first slide that will be displayed
100
- * New feature: slides can be marked as "draft"
101
- * New feature: Crelly Slider is now compatible with WP Offload S3
102
- * Improvement: the YouTube and the Vimeo APIs won't be loaded unless there is a video in the slider
103
- * Bug fix: when a text element was selected and then modified, the black box around it wasn't correctly adapted to fit the new dimensions
104
- * Bug fix: when a slide was cloned, it was impossible to change its background color and to move its elements, unless by refreshing the page
105
- * Bug fix: improved compatibility for some web hosting providers that restricted the import/export functions
106
- * Bug fix: when you added a really large image element, the element options were covered by the image
107
- * Other minor changes and bug fixes
108
-
109
- = 1.1.2 =
110
- * Bug fix: security issues
111
- * Other minor changes and bug fixes
112
-
113
- = 1.1.1 =
114
- * Bug fix: sometimes, the slider got stuck at loading screen
115
-
116
- = 1.1.0 =
117
- * Awesome community: the slider is now translated in 8 different languages! Thank you!<br />English,<br />Italian,<br />Spanish (<a href="https://github.com/eduardoarandah">Eduardo Aranda</a>),<br />Russian (<a href="http://dymskiy.ru/">Andrey Dymskiy</a>),<br />Slovak (<a href="https://github.com/webmandesign">Oliver Juhas</a>),<br />Serbian (Branislav Pakic),<br />French (sLy kereven),<br />German (Andreas Dolinar, <a href="http://elokron.de/">Jan Adams</a>)
118
- * New feature: Duplicate sliders and slides
119
- * New feature: Import/Export sliders
120
- * New feature: Support for YouTube and Vimeo videos
121
- * New feature: The slides can be linked (the entire background is a link)
122
- * New feature: New preloader: when loading, the background is no more grey. Now the first slide background image is automatically blurred and used as background for the preloader. When the slider is loaded, the blurred background will fade away and the first slide will be displayed
123
- * New feature: Navigation and controls are much better looking now
124
- * New feature: Added public methods to control the slider. pause(), resume(), nextSlide(), previousSlide(), changeSlide(slide_index), getCurrentSlide(), getTotalSlides()
125
- * New feature: Slides background color can now be set manually
126
- * New feature: Custom CSS classes can now be added to elements
127
- * New feature: Added "Center vertically" and "Center horizontally" buttons to align elements
128
- * New feature: The slides background image can now be quickly set as "responsive full width image" or "pattern"
129
- * Bug fix: Sometimes slides and elements weren't saved correctly
130
- * Bug fix: Text elements were displayed on two lines when an inline tag was added
131
- * Bug fix: When automatic slide was set to "no", the out animations were still performed
132
- * Bug fix: When the backend interface was loading there were some graphical glitches
133
- * Bug fix: Background position wasn't correct on Firefox
134
- * Minor change: Texts have now a default line height, color and font. In this way, I can be sure that they are displayed exactly in the same way in the backend and in the frontend
135
- * Minor change: dropped support for IE < 11
136
- * Other minor changes and bug fixes
137
-
138
- = 0.8.2 =
139
- * Fixed: broken admin layout on Firefox (<a href="https://github.com/fabiorino/crelly-slider/pull/5">Thanks eduardoarandah</a>)
140
- * Crelly Slider is now translated in Spanish (<a href="https://github.com/eduardoarandah/crelly-slider/commit/3b7d49b63d9dbe60c420669edea898de34cd720f">Again, thanks eduardoarandah</a>) and in Italian!
141
- * Do you want to translate the plugin in your language? <a href="http://fabiorino1.altervista.org/projects/crellyslider/documentation/#translate">Check the documentation</a>
142
-
143
- = 0.8.1 =
144
- * Fixed: padding broken in IE8
145
- * Fixed: background images with a long name weren't stored correctly into the database
146
-
147
- = 0.8.0 =
148
- * Changed: by default, elements out animations start before the slide out animation. In this way, they result more visible, therefore better than before. The option is customizable for each element
149
- * Added: support for touch, swipe and drag
150
- * Improved progress bar animation: now has a cool swing effect
151
- * The current editing slide tab is now highlighted
152
- * Fixed: before preloader, for about a second, the slider was displayed as an unordered list
153
- * Fixed: now if you specify the opacity in custom CSS, that value won't be overwritten
154
- * Changed: by default, line-height is now 1.5. Please, if you want to change it, specify a pure number to avoid compatibility issues
155
- * Fixed: blue border around linked images in IE
156
- * The text / HTML of a text element is now wrapped in a textarea (no more in an input)
157
- * Fixed: apostrophes in text elements are now displayed correctly
158
- * Removed useless file from the package.
159
- * Removed afterSlideEnd(), afterSetResponsive(), afterPause(). They were useless
160
- * Other minor bug fixes and changes
161
-
162
- = 0.7.0 =
163
- * Fixed "Error saving elements" if there are no elements
164
-
165
- = 0.6.9 =
166
- * Added the possibility to insert links in images and texts
167
- * Added slider preloader (with a gif image)
168
- * Added icon in the style of WordPress to the lateral sidebar in the admin panel
169
- * Added confirm alert when you delete a slider
170
- * Fixed: now HTML codes inserted in text elements are working properly
171
- * Fixed: when you selected an element into the editing area weren't shown the correct element options
172
- * Fixed invisible progress bar in Internet Explorer 8
173
- * Fixed invisible slider navigation in Internet Explorer 8
174
- * Changed: text output is now wrapped by a "div" and not a "p" for a better compatibility and a cleaner code
175
- * Changed name to the "add image" button in the element options
176
- * Other minor bug fixes and changes
177
-
178
- = 0.6.8 =
179
- * Added callback functions: beforeStart, beforeSetResponsive, afterSetResponsive, beforeSlideStart, afterSlideEnd, beforePause, afterPause, beforeResume
180
- * Fixed responsive methods that restarted the slide in particular moments uselessly
181
-
182
- = 0.6.7 =
183
- * Fixed "Add image" not working on Firefox and Internet Explorer
184
- * Fixed "Duplicate element" on animations
185
-
186
- = 0.6.6 =
187
- * Fixed directory error
188
-
189
- = 0.6.5 =
190
- * Initial release
 
 
 
1
+ === Crelly Slider ===
2
+ Contributors: fabiorino
3
+ Donate link: http://crellyslider.altervista.org/contribute-and-support/
4
+ Tags: animations, layers, texts, images, videos
5
+ Requires at least: 3.9
6
+ Tested up to: 5.4
7
+ Stable tag: 1.3.7
8
+ License: MIT
9
+ License URI: http://opensource.org/licenses/MIT
10
+
11
+ A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
12
+
13
+ == Description ==
14
+
15
+ Crelly Slider is a Free / Open Source responsive WordPress slider that supports layers. You can add Texts, Images, YouTube/Vimeo videos using a powerful Drag & Drop Builder and animate each of them. It is perfect to display your creative content in posts and pages.
16
+ <br />
17
+ <br />
18
+ <a href="http://crellyslider.altervista.org/">Official WebSite (with live demo)</a>
19
+ <br />
20
+ = User Friendly Admin Panel =
21
+ Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
22
+
23
+ = High Cross Browser Compatibility =
24
+ Most of the animations and the transitions are written in jQuery (using the "animate" function). In this way we can assure the compatibility with modern (even Android and iOs) and older browsers.
25
+
26
+ = Drag and Drop Builder =
27
+ How can you position all the elements in to the slider area? You just simply drag them in to the desired position. Like in Powerpoint, you just have to move the object around the Slide.
28
+
29
+ = Transitions & Animations =
30
+ Foreach element and slide you can choose an in animation and an out animation using a simple selection menu. You can set the transition speeds and how long the element will take to get in and out.
31
+
32
+ = Completely Responsive =
33
+ Responsive means that the Slider will be displayed correctly in every resolution that the user will use. If the display is small (like in a smartphone), the slides and the elements will be scaled to be adapted.
34
+
35
+ = Full & Fixed Width Modes =
36
+ Using Crelly Slider you can select between a fixed or a full-width layout (both of them can be responsive). You are the designer, you own the WebSite, just choose the best for it.
37
+
38
+ == Installation ==
39
+
40
+ Download this plugin directly from your Wordpress Admin Page.
41
+ <br />
42
+ Click Install.
43
+ <br />
44
+ Click Activate.
45
+ <br />
46
+ You can find the documentation <a href="http://crellyslider.altervista.org/documentation/">here</a>.
47
+
48
+ == Screenshots ==
49
+
50
+ 1. An example of a slide you can create
51
+ 2. Unlimited sliders
52
+ 3. Slider settings
53
+ 4. Slides and elements options (in this case, a text element)
54
+
55
+ == Changelog ==
56
+
57
+ = 1.3.7 =
58
+ * Fixed PHP warning "Array and string offset access syntax with curly braces is deprecated" as reported <a href="https://wordpress.org/support/topic/syntax-with-curly-braces-is-deprecated">here</a>
59
+
60
+ = 1.3.6 =
61
+ * Fixed PHP warning "Cannot modify header information - headers already sent" as reported <a href="https://wordpress.org/support/topic/incompatibility-with-athemes-sydney-pros-customizer">here</a>
62
+
63
+ = 1.3.5 =
64
+ * Security patch
65
+ * Improved import/export slider functions. They should now be compatible with web hosting services that block file_get_contents
66
+ * Minor changes and bux fixes
67
+
68
+ = 1.3.4 =
69
+ * French translation moved to Polyglots. If you want to contribute to translate Crelly Slider in your language, check out <a href="https://translate.wordpress.org/projects/wp-plugins/crelly-slider">this page</a>
70
+ * Fixed error with old PHP versions
71
+
72
+ = 1.3.3 =
73
+ * Fixed responsiveness on small devices
74
+ * Spanish, Serbian and Slovak translations moved to Polyglots. If you want to contribute to translate Crelly Slider in your language, check out <a href="https://translate.wordpress.org/projects/wp-plugins/crelly-slider">this page</a>
75
+
76
+ = 1.3.2 =
77
+ * Fixed slide link not working
78
+
79
+ = 1.3.1 =
80
+ * Fixed syntax error in old php versions
81
+
82
+ = 1.3.0 =
83
+ * New feature: sliders can be scheduled (you can specify from when and how long they should be displayed for)
84
+ * When a video is manually paused by the user, it won't resume automatically at the next slides loop
85
+ * For developers: TinyMCE settings are now hookable (credits to dlaxar https://github.com/fabiorino/crelly-slider/commits?author=dlaxar)
86
+ * For developers: sliders can be imported via code
87
+ * Other minor changes and bug fixes
88
+
89
+ = 1.2.3 =
90
+ * Bug fix: align left/center/right buttons not working
91
+
92
+ = 1.2.2 =
93
+ * Bug fix: fixed incompatibility with WordPress 4.8
94
+
95
+ = 1.2.1 =
96
+ * Bug fix: if the user setting "Disable the visual editor when writing" was enabled, there were JavaScript errors
97
+ * Other minor changes and bug fixes
98
+
99
+ = 1.2.0 =
100
+ * New feature: texts can be edited with the default WordPress editor (TinyMCE)
101
+ * New feature: the order of the slides can be set to "random"
102
+ * New feature: you can select the first slide that will be displayed
103
+ * New feature: slides can be marked as "draft"
104
+ * New feature: Crelly Slider is now compatible with WP Offload S3
105
+ * Improvement: the YouTube and the Vimeo APIs won't be loaded unless there is a video in the slider
106
+ * Bug fix: when a text element was selected and then modified, the black box around it wasn't correctly adapted to fit the new dimensions
107
+ * Bug fix: when a slide was cloned, it was impossible to change its background color and to move its elements, unless by refreshing the page
108
+ * Bug fix: improved compatibility for some web hosting providers that restricted the import/export functions
109
+ * Bug fix: when you added a really large image element, the element options were covered by the image
110
+ * Other minor changes and bug fixes
111
+
112
+ = 1.1.2 =
113
+ * Bug fix: security issues
114
+ * Other minor changes and bug fixes
115
+
116
+ = 1.1.1 =
117
+ * Bug fix: sometimes, the slider got stuck at loading screen
118
+
119
+ = 1.1.0 =
120
+ * Awesome community: the slider is now translated in 8 different languages! Thank you!<br />English,<br />Italian,<br />Spanish (<a href="https://github.com/eduardoarandah">Eduardo Aranda</a>),<br />Russian (<a href="http://dymskiy.ru/">Andrey Dymskiy</a>),<br />Slovak (<a href="https://github.com/webmandesign">Oliver Juhas</a>),<br />Serbian (Branislav Pakic),<br />French (sLy kereven),<br />German (Andreas Dolinar, <a href="http://elokron.de/">Jan Adams</a>)
121
+ * New feature: Duplicate sliders and slides
122
+ * New feature: Import/Export sliders
123
+ * New feature: Support for YouTube and Vimeo videos
124
+ * New feature: The slides can be linked (the entire background is a link)
125
+ * New feature: New preloader: when loading, the background is no more grey. Now the first slide background image is automatically blurred and used as background for the preloader. When the slider is loaded, the blurred background will fade away and the first slide will be displayed
126
+ * New feature: Navigation and controls are much better looking now
127
+ * New feature: Added public methods to control the slider. pause(), resume(), nextSlide(), previousSlide(), changeSlide(slide_index), getCurrentSlide(), getTotalSlides()
128
+ * New feature: Slides background color can now be set manually
129
+ * New feature: Custom CSS classes can now be added to elements
130
+ * New feature: Added "Center vertically" and "Center horizontally" buttons to align elements
131
+ * New feature: The slides background image can now be quickly set as "responsive full width image" or "pattern"
132
+ * Bug fix: Sometimes slides and elements weren't saved correctly
133
+ * Bug fix: Text elements were displayed on two lines when an inline tag was added
134
+ * Bug fix: When automatic slide was set to "no", the out animations were still performed
135
+ * Bug fix: When the backend interface was loading there were some graphical glitches
136
+ * Bug fix: Background position wasn't correct on Firefox
137
+ * Minor change: Texts have now a default line height, color and font. In this way, I can be sure that they are displayed exactly in the same way in the backend and in the frontend
138
+ * Minor change: dropped support for IE < 11
139
+ * Other minor changes and bug fixes
140
+
141
+ = 0.8.2 =
142
+ * Fixed: broken admin layout on Firefox (<a href="https://github.com/fabiorino/crelly-slider/pull/5">Thanks eduardoarandah</a>)
143
+ * Crelly Slider is now translated in Spanish (<a href="https://github.com/eduardoarandah/crelly-slider/commit/3b7d49b63d9dbe60c420669edea898de34cd720f">Again, thanks eduardoarandah</a>) and in Italian!
144
+ * Do you want to translate the plugin in your language? <a href="http://fabiorino1.altervista.org/projects/crellyslider/documentation/#translate">Check the documentation</a>
145
+
146
+ = 0.8.1 =
147
+ * Fixed: padding broken in IE8
148
+ * Fixed: background images with a long name weren't stored correctly into the database
149
+
150
+ = 0.8.0 =
151
+ * Changed: by default, elements out animations start before the slide out animation. In this way, they result more visible, therefore better than before. The option is customizable for each element
152
+ * Added: support for touch, swipe and drag
153
+ * Improved progress bar animation: now has a cool swing effect
154
+ * The current editing slide tab is now highlighted
155
+ * Fixed: before preloader, for about a second, the slider was displayed as an unordered list
156
+ * Fixed: now if you specify the opacity in custom CSS, that value won't be overwritten
157
+ * Changed: by default, line-height is now 1.5. Please, if you want to change it, specify a pure number to avoid compatibility issues
158
+ * Fixed: blue border around linked images in IE
159
+ * The text / HTML of a text element is now wrapped in a textarea (no more in an input)
160
+ * Fixed: apostrophes in text elements are now displayed correctly
161
+ * Removed useless file from the package.
162
+ * Removed afterSlideEnd(), afterSetResponsive(), afterPause(). They were useless
163
+ * Other minor bug fixes and changes
164
+
165
+ = 0.7.0 =
166
+ * Fixed "Error saving elements" if there are no elements
167
+
168
+ = 0.6.9 =
169
+ * Added the possibility to insert links in images and texts
170
+ * Added slider preloader (with a gif image)
171
+ * Added icon in the style of WordPress to the lateral sidebar in the admin panel
172
+ * Added confirm alert when you delete a slider
173
+ * Fixed: now HTML codes inserted in text elements are working properly
174
+ * Fixed: when you selected an element into the editing area weren't shown the correct element options
175
+ * Fixed invisible progress bar in Internet Explorer 8
176
+ * Fixed invisible slider navigation in Internet Explorer 8
177
+ * Changed: text output is now wrapped by a "div" and not a "p" for a better compatibility and a cleaner code
178
+ * Changed name to the "add image" button in the element options
179
+ * Other minor bug fixes and changes
180
+
181
+ = 0.6.8 =
182
+ * Added callback functions: beforeStart, beforeSetResponsive, afterSetResponsive, beforeSlideStart, afterSlideEnd, beforePause, afterPause, beforeResume
183
+ * Fixed responsive methods that restarted the slide in particular moments uselessly
184
+
185
+ = 0.6.7 =
186
+ * Fixed "Add image" not working on Firefox and Internet Explorer
187
+ * Fixed "Duplicate element" on animations
188
+
189
+ = 0.6.6 =
190
+ * Fixed directory error
191
+
192
+ = 0.6.5 =
193
+ * Initial release
wordpress/admin.php CHANGED
@@ -1,444 +1,444 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- class CrellySliderAdmin {
5
-
6
- private static $mceSettings = array();
7
-
8
- // Creates the menu and the admin panel
9
- public static function showSettings() {
10
- add_action('admin_menu', 'CrellySliderAdmin::pluginMenus');
11
- }
12
-
13
- public static function pluginMenus() {
14
- add_menu_page('Crelly Slider', 'Crelly Slider', CS_MIN_CAPABILITY, 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
15
- }
16
-
17
- // Go to the correct page
18
- public static function displayPage() {
19
- if(!isset($_GET['view'])) {
20
- $index = 'home';
21
- }
22
- else {
23
- $index = esc_sql($_GET['view']);
24
- if($index != 'add' && $index != 'edit') {
25
- die();
26
- }
27
- }
28
-
29
- global $wpdb;
30
-
31
- // Check what the user is doing: is it adding or modifying a slider?
32
- $edit = true;
33
- $id = NULL;
34
- if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
35
- $edit = false;
36
- $id = NULL;
37
- }
38
- else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
39
- $edit = true;
40
- $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
41
- if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
42
- die();
43
- }
44
-
45
- $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
46
- }
47
-
48
- ?>
49
- <div
50
- class="wrap cs-admin"
51
- <?php if($edit && isset($slider)): ?>
52
- style="width: <?php echo esc_attr($slider->startWidth); ?>px;"
53
- <?php else: ?>
54
- style="width: 1140px;"
55
- <?php endif; ?>
56
- >
57
-
58
- <noscript class="cs-no-js">
59
- <div class="cs-message cs-message-error" style="display: block;"><?php _e('JavaScript must be enabled to view this page correctly.', 'crelly-slider'); ?></div>
60
- </noscript>
61
-
62
- <div class="cs-message cs-message-ok" style="display: none;"><?php _e('Operation completed successfully.', 'crelly-slider'); ?></div>
63
- <div class="cs-message cs-message-error" style="display: none;"><?php _e('Something went wrong.', 'crelly-slider'); ?></div>
64
- <div class="cs-message cs-message-wait" style="display: none;"><?php _e('Please wait', 'crelly-slider'); ?></div>
65
- <?php if(! $edit): ?>
66
- <div class="cs-message cs-message-warning"><?php _e('When you\'ll click "Save Settings", you\'ll be able to add slides and elements.', 'crelly-slider'); ?></div>
67
- <?php endif; ?>
68
-
69
- <h2 class="cs-logo" title="Crelly Slider">
70
- <a href="?page=crellyslider">
71
- <img src="<?php echo CS_PLUGIN_URL . '/wordpress/images/logo2.png' ?>" alt="Crelly Slider" />
72
- </a>
73
- </h2>
74
-
75
- <br />
76
- <br />
77
-
78
- <?php
79
-
80
- switch($index) {
81
- case 'home':
82
- self::displayHome();
83
- break;
84
-
85
- case 'add':
86
- case 'edit':
87
- self::displaySlider();
88
- break;
89
- }
90
-
91
- ?>
92
-
93
- </div>
94
- <?php
95
- }
96
-
97
- // Displays the main plugin page
98
- public static function displayHome() {
99
- ?>
100
- <div class="cs-home">
101
- <?php require_once CS_PATH . 'wordpress/home.php'; ?>
102
- </div>
103
- <?php
104
- }
105
-
106
- // Displays the slider page in wich you can add or modify sliders, slides and elements
107
- public static function displaySlider() {
108
- global $wpdb;
109
-
110
- $edit = true;
111
- $id = NULL;
112
- if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
113
- $edit = false;
114
- $id = NULL;
115
- }
116
- else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
117
- $edit = true;
118
- $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
119
- if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
120
- die();
121
- }
122
-
123
- $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
124
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $id));
125
- // The elements variable are updated in the foreach() loop directly in the "slides.php" file
126
- }
127
- ?>
128
-
129
- <div class="cs-useless-wp_editor" style="display: none;">
130
- <?php
131
- // I need to call wp_editor just to include TinyMCE's javascript
132
- wp_editor('', 'cs-element-editor-useless');
133
- self::setTinyMCEOptions();
134
- ?>
135
- </div>
136
-
137
- <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
138
- <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
139
- <?php if($edit): ?>
140
- <script type="text/javascript">
141
- <?php
142
- $currentSliderNonce = CrellySliderHelpers::getNonce($id);
143
- if(! $currentSliderNonce) {
144
- die('Could not get nonce for current slider');
145
- }
146
- ?>
147
- var crellyslider_currentSliderNonce = "<?php echo $currentSliderNonce; ?>";
148
- </script>
149
-
150
- <ul>
151
-
152
- <li>
153
- <span class="cs-icon icon-settings"></span>
154
- <a id="cs-show-slider-settings"><?php _e('Slider Settings', 'crelly-slider'); ?></a>
155
- </li>
156
- <li>
157
- <span class="cs-icon icon-edit"></span>
158
- <a id="cs-show-slides"><?php _e('Edit Slides', 'crelly-slider'); ?></a>
159
- </li>
160
- </ul>
161
-
162
- <br />
163
- <br />
164
- <br />
165
- <?php endif; ?>
166
-
167
- <?php require_once CS_PATH . 'wordpress/slider.php'; ?>
168
- <?php
169
- if($edit) {
170
- require_once CS_PATH . 'wordpress/elements.php';
171
- require_once CS_PATH . 'wordpress/slides.php';
172
- }
173
- ?>
174
- </div>
175
-
176
- <br />
177
-
178
- <a class="cs-button cs-is-primary cs-save-settings" data-id="<?php echo $id; ?>" href="#"><?php _e('Save Settings', 'crelly-slider'); ?></a>
179
-
180
- </div>
181
-
182
- <?php
183
- }
184
-
185
- public static function rawHeadAssets() {
186
- ?>
187
- <script type="text/javascript">
188
- var crellyslider_locale = '<?php echo get_locale(); ?>';
189
- </script>
190
- <?php
191
- $wp_version = get_bloginfo('version');
192
- $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
193
- if($wp_version < 3.8) {
194
- ?>
195
- <style type="text/css">
196
- #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
197
- background-image: url('<?php echo $menu_icon_url; ?>');
198
- background-repeat: no-repeat;
199
- background-position: -20px center;
200
- }
201
-
202
- #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
203
- background-position: -20px center;
204
- }
205
-
206
- #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
207
- background-position: 8px center;
208
- }
209
-
210
- #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
211
- background-position: 8px center;
212
- }
213
- </style>
214
- <?php
215
- }
216
- else {
217
- ?>
218
- <style type="text/css">
219
- #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
220
- background-image: url('<?php echo $menu_icon_url; ?>');
221
- background-repeat: no-repeat;
222
- background-position: 8px center;
223
- opacity: .6;
224
- filter: alpha(opacity=60);
225
- }
226
-
227
- #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
228
- background-position: -20px center;
229
- opacity: 1;
230
- filter: alpha(opacity=100);
231
- }
232
-
233
- #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
234
- opacity: 1;
235
- filter: alpha(opacity=100);
236
- }
237
-
238
- #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
239
- background-position: 8px center;
240
- opacity: 1;
241
- filter: alpha(opacity=100);
242
- }
243
- </style>
244
- <?php
245
- }
246
- }
247
-
248
- // Include CSS and JavaScript
249
- public static function enqueues() {
250
- wp_enqueue_script('jquery-ui-draggable');
251
- wp_enqueue_script('jquery-ui-tabs');
252
- wp_enqueue_script('jquery-ui-sortable');
253
- wp_enqueue_script('jquery-ui-dialog');
254
- wp_enqueue_script('jquery-ui-datepicker');
255
- wp_enqueue_style('wp-color-picker');
256
- wp_enqueue_media();
257
-
258
- wp_register_script('datetimepicker', CS_PLUGIN_URL . '/wordpress/js/jquery.datetimepicker.js', array('jquery'), "2.5.17", true);
259
- wp_enqueue_script('datetimepicker');
260
- wp_enqueue_style('datetimepicker', CS_PLUGIN_URL . '/wordpress/css/jquery.datetimepicker.css', array(), "2.5.17");
261
-
262
- add_action('admin_print_footer_scripts', array( __CLASS__, 'printTinyMCEOptions'), 1);
263
- wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
264
-
265
- wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
266
- self::createNonces();
267
- self::localization();
268
-
269
- wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
270
- wp_enqueue_script('crellyslider-admin');
271
- }
272
-
273
- public static function loadAssets() {
274
- add_action('admin_head', 'CrellySliderAdmin::rawHeadAssets');
275
- add_action('admin_enqueue_scripts', 'CrellySliderAdmin::enqueues');
276
- }
277
-
278
- public static function localization() {
279
- // Here the translations for the admin.js file
280
- $crellyslider_translations = array(
281
- 'slide' => __('Slide', 'crelly-slider'),
282
- 'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crelly-slider'),
283
- 'slide_delete_just_one' => __('You can\'t delete this. You must have at least one slide.', 'crelly-slider'),
284
- 'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crelly-slider'),
285
- 'text_element_default_html' => __('Text element', 'crelly-slider'),
286
- 'slide_live_preview' => __('Live preview', 'crelly-slider'),
287
- 'slide_stop_preview' => __('Stop preview', 'crelly-slider'),
288
- 'duplicate_slide' => __('Duplicate slide', 'crelly-slider'),
289
- 'remove_slide' => __('Delete slide', 'crelly-slider'),
290
- 'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
291
- 'switch_editor' => __('Switch editor', 'crelly-slider'),
292
- );
293
- wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
294
- }
295
-
296
- public static function createNonces() {
297
- $nonces = array(
298
- 'addSlider' => wp_create_nonce('crellyslider_add-slider'),
299
- 'deleteSlider' => wp_create_nonce('crellyslider_delete-slider'),
300
- 'duplicateSlider' => wp_create_nonce('crellyslider_duplicate-slider'),
301
- 'exportSlider' => wp_create_nonce('crellyslider_export-slider'),
302
- 'importSlider' => wp_create_nonce('crellyslider_import-slider'),
303
- );
304
-
305
- wp_localize_script('crellyslider-admin', 'crellyslider_nonces', $nonces);
306
- }
307
-
308
- /**
309
- * Invokes the filter for the tinyMCE init options
310
- */
311
- public static function setTinyMCEOptions() {
312
- self::$mceSettings = apply_filters( 'crellyslider_tiny_mce_before_init', self::tinyMCEDefaultOptions());
313
- }
314
-
315
- /**
316
- * Generates the default tinyMCE options
317
- *
318
- * @return array Default options for the tinyMCE editor
319
- */
320
- private static function tinyMCEDefaultOptions() {
321
- $fontSizes = '';
322
- for($i = 1; $i <= 200; $i++) {
323
- $fontSizes .= $i . 'px ';
324
- }
325
- $fontSizes = trim($fontSizes);
326
-
327
- $language = explode('_', get_locale());
328
- if($language == false || count($language) == 0) {
329
- $language = 'en';
330
- }
331
- else {
332
- $language = $language[0];
333
- }
334
-
335
- return array(
336
- 'toolbar1' => 'bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor',
337
- 'toolbar2' => 'fontselect,fontsizeselect',
338
- 'toolbar3' => '',
339
- 'toolbar4' => '',
340
- 'height' => 200,
341
- 'forced_root_block' => false,
342
- 'wpautop' => false,
343
- 'fontsize_formats' => $fontSizes,
344
- 'wp_lang_attr' => get_locale(),
345
- 'content_css' => '',
346
- 'cache_suffix' => '',
347
- 'language' => $language,
348
- 'theme' => 'modern',
349
- 'skin' => 'lightgray',
350
- 'formats' => '{' .
351
- 'alignleft: [' .
352
- '{'.
353
- 'selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", ' .
354
- 'styles: {textAlign:"left", lineHeight:"inherit"}, ' .
355
- 'inline: "div"'.
356
- '},' .
357
- '{' .
358
- 'selector: "img,table,dl.wp-caption", ' .
359
- 'classes: "alignleft"' .
360
- '}' .
361
- '],' .
362
- 'aligncenter: [' .
363
- '{' .
364
- 'selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", ' .
365
- 'styles: {textAlign:"center", lineHeight:"inherit"}, ' .
366
- 'inline: "div"' .
367
- '},' .
368
- '{' .
369
- 'selector: "img,table,dl.wp-caption", ' .
370
- 'classes: "aligncenter"' .
371
- '}' .
372
- '],' .
373
- 'alignright: [' .
374
- '{' .
375
- 'selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", ' .
376
- 'styles: {textAlign:"right", lineHeight:"inherit"}, ' .
377
- 'inline: "div"' .
378
- '},' .
379
- '{' .
380
- 'selector: "img,table,dl.wp-caption", ' .
381
- 'classes: "alignright"' .
382
- '}' .
383
- '],' .
384
- 'strikethrough: {inline: "del"}' .
385
- '}',
386
- 'relative_urls' => false,
387
- 'remove_script_host' => false,
388
- 'convert_urls' => false,
389
- 'browser_spellcheck' => true,
390
- 'fix_list_elements' => true,
391
- 'entities' => '38,amp,60,lt,62,gt',
392
- 'entity_encoding' => 'raw',
393
- 'keep_styles' => false,
394
- 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
395
- 'end_container_on_empty_block' => true,
396
- 'wpeditimage_disable_captions' => false,
397
- 'wpeditimage_html5_captions' => true,
398
- 'plugins' => 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview,image',
399
- 'resize' => 'vertical',
400
- 'menubar' => false,
401
- 'indent' => true,
402
- 'tabfocus_elements' => ':prev,:next',
403
- );
404
- }
405
-
406
- /**
407
- * Outputs the previously set tinyMCE options (init Options)
408
- *
409
- * A <script> tag containing the global variable crellyslider_tinyMCEInit is printed
410
- */
411
- public static function printTinyMCEOptions() {
412
- $options = self::$mceSettings;
413
-
414
- $serialized = '';
415
- foreach($options as $key => $value) {
416
- if (is_bool($value)) {
417
- $serialized .= $key . ':' . ($value ? 'true' : 'false') . ',';
418
- } else {
419
- $length = !empty($value) && is_string($value) ? strlen($value) : 0;
420
-
421
- // don't wrap objects, arrays or functions in quotes
422
- if ($length > 0
423
- && (('{' == $value{0} && '}' == $value{$length - 1}) ||
424
- ('[' == $value{0} && ']' == $value{$length - 1}) ||
425
- preg_match('/^\(?function ?\(/', $value))) {
426
-
427
- $serialized .= $key . ':' . $value . ',';
428
- } else {
429
- $serialized .= $key . ':"' . $value . '",';
430
- }
431
- }
432
- }
433
-
434
- // remove trailing spaces and commas and enclose in JSON { }
435
- $serialized = '{' . trim($serialized, ' ,') . '}';
436
- ?>
437
- <script type="text/javascript">
438
- crellyslider_tinyMCEInit = <?php echo $serialized; ?>;
439
- </script>
440
- <?php
441
- }
442
- }
443
-
444
- ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class CrellySliderAdmin {
5
+
6
+ private static $mceSettings = array();
7
+
8
+ // Creates the menu and the admin panel
9
+ public static function showSettings() {
10
+ add_action('admin_menu', 'CrellySliderAdmin::pluginMenus');
11
+ }
12
+
13
+ public static function pluginMenus() {
14
+ add_menu_page('Crelly Slider', 'Crelly Slider', CS_MIN_CAPABILITY, 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
15
+ }
16
+
17
+ // Go to the correct page
18
+ public static function displayPage() {
19
+ if(!isset($_GET['view'])) {
20
+ $index = 'home';
21
+ }
22
+ else {
23
+ $index = esc_sql($_GET['view']);
24
+ if($index != 'add' && $index != 'edit') {
25
+ die();
26
+ }
27
+ }
28
+
29
+ global $wpdb;
30
+
31
+ // Check what the user is doing: is it adding or modifying a slider?
32
+ $edit = true;
33
+ $id = NULL;
34
+ if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
35
+ $edit = false;
36
+ $id = NULL;
37
+ }
38
+ else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
39
+ $edit = true;
40
+ $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
41
+ if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
42
+ die();
43
+ }
44
+
45
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
46
+ }
47
+
48
+ ?>
49
+ <div
50
+ class="wrap cs-admin"
51
+ <?php if($edit && isset($slider)): ?>
52
+ style="width: <?php echo esc_attr($slider->startWidth); ?>px;"
53
+ <?php else: ?>
54
+ style="width: 1140px;"
55
+ <?php endif; ?>
56
+ >
57
+
58
+ <noscript class="cs-no-js">
59
+ <div class="cs-message cs-message-error" style="display: block;"><?php _e('JavaScript must be enabled to view this page correctly.', 'crelly-slider'); ?></div>
60
+ </noscript>
61
+
62
+ <div class="cs-message cs-message-ok" style="display: none;"><?php _e('Operation completed successfully.', 'crelly-slider'); ?></div>
63
+ <div class="cs-message cs-message-error" style="display: none;"><?php _e('Something went wrong.', 'crelly-slider'); ?></div>
64
+ <div class="cs-message cs-message-wait" style="display: none;"><?php _e('Please wait', 'crelly-slider'); ?></div>
65
+ <?php if(! $edit): ?>
66
+ <div class="cs-message cs-message-warning"><?php _e('When you\'ll click "Save Settings", you\'ll be able to add slides and elements.', 'crelly-slider'); ?></div>
67
+ <?php endif; ?>
68
+
69
+ <h2 class="cs-logo" title="Crelly Slider">
70
+ <a href="?page=crellyslider">
71
+ <img src="<?php echo CS_PLUGIN_URL . '/wordpress/images/logo2.png' ?>" alt="Crelly Slider" />
72
+ </a>
73
+ </h2>
74
+
75
+ <br />
76
+ <br />
77
+
78
+ <?php
79
+
80
+ switch($index) {
81
+ case 'home':
82
+ self::displayHome();
83
+ break;
84
+
85
+ case 'add':
86
+ case 'edit':
87
+ self::displaySlider();
88
+ break;
89
+ }
90
+
91
+ ?>
92
+
93
+ </div>
94
+ <?php
95
+ }
96
+
97
+ // Displays the main plugin page
98
+ public static function displayHome() {
99
+ ?>
100
+ <div class="cs-home">
101
+ <?php require_once CS_PATH . 'wordpress/home.php'; ?>
102
+ </div>
103
+ <?php
104
+ }
105
+
106
+ // Displays the slider page in wich you can add or modify sliders, slides and elements
107
+ public static function displaySlider() {
108
+ global $wpdb;
109
+
110
+ $edit = true;
111
+ $id = NULL;
112
+ if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
113
+ $edit = false;
114
+ $id = NULL;
115
+ }
116
+ else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
117
+ $edit = true;
118
+ $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
119
+ if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
120
+ die();
121
+ }
122
+
123
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
124
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $id));
125
+ // The elements variable are updated in the foreach() loop directly in the "slides.php" file
126
+ }
127
+ ?>
128
+
129
+ <div class="cs-useless-wp_editor" style="display: none;">
130
+ <?php
131
+ // I need to call wp_editor just to include TinyMCE's javascript
132
+ wp_editor('', 'cs-element-editor-useless');
133
+ self::setTinyMCEOptions();
134
+ ?>
135
+ </div>
136
+
137
+ <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
138
+ <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
139
+ <?php if($edit): ?>
140
+ <script type="text/javascript">
141
+ <?php
142
+ $currentSliderNonce = CrellySliderHelpers::getNonce($id);
143
+ if(! $currentSliderNonce) {
144
+ die('Could not get nonce for current slider');
145
+ }
146
+ ?>
147
+ var crellyslider_currentSliderNonce = "<?php echo $currentSliderNonce; ?>";
148
+ </script>
149
+
150
+ <ul>
151
+
152
+ <li>
153
+ <span class="cs-icon icon-settings"></span>
154
+ <a id="cs-show-slider-settings"><?php _e('Slider Settings', 'crelly-slider'); ?></a>
155
+ </li>
156
+ <li>
157
+ <span class="cs-icon icon-edit"></span>
158
+ <a id="cs-show-slides"><?php _e('Edit Slides', 'crelly-slider'); ?></a>
159
+ </li>
160
+ </ul>
161
+
162
+ <br />
163
+ <br />
164
+ <br />
165
+ <?php endif; ?>
166
+
167
+ <?php require_once CS_PATH . 'wordpress/slider.php'; ?>
168
+ <?php
169
+ if($edit) {
170
+ require_once CS_PATH . 'wordpress/elements.php';
171
+ require_once CS_PATH . 'wordpress/slides.php';
172
+ }
173
+ ?>
174
+ </div>
175
+
176
+ <br />
177
+
178
+ <a class="cs-button cs-is-primary cs-save-settings" data-id="<?php echo $id; ?>" href="#"><?php _e('Save Settings', 'crelly-slider'); ?></a>
179
+
180
+ </div>
181
+
182
+ <?php
183
+ }
184
+
185
+ public static function rawHeadAssets() {
186
+ ?>
187
+ <script type="text/javascript">
188
+ var crellyslider_locale = '<?php echo get_locale(); ?>';
189
+ </script>
190
+ <?php
191
+ $wp_version = get_bloginfo('version');
192
+ $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
193
+ if($wp_version < 3.8) {
194
+ ?>
195
+ <style type="text/css">
196
+ #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
197
+ background-image: url('<?php echo $menu_icon_url; ?>');
198
+ background-repeat: no-repeat;
199
+ background-position: -20px center;
200
+ }
201
+
202
+ #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
203
+ background-position: -20px center;
204
+ }
205
+
206
+ #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
207
+ background-position: 8px center;
208
+ }
209
+
210
+ #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
211
+ background-position: 8px center;
212
+ }
213
+ </style>
214
+ <?php
215
+ }
216
+ else {
217
+ ?>
218
+ <style type="text/css">
219
+ #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
220
+ background-image: url('<?php echo $menu_icon_url; ?>');
221
+ background-repeat: no-repeat;
222
+ background-position: 8px center;
223
+ opacity: .6;
224
+ filter: alpha(opacity=60);
225
+ }
226
+
227
+ #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
228
+ background-position: -20px center;
229
+ opacity: 1;
230
+ filter: alpha(opacity=100);
231
+ }
232
+
233
+ #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
234
+ opacity: 1;
235
+ filter: alpha(opacity=100);
236
+ }
237
+
238
+ #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
239
+ background-position: 8px center;
240
+ opacity: 1;
241
+ filter: alpha(opacity=100);
242
+ }
243
+ </style>
244
+ <?php
245
+ }
246
+ }
247
+
248
+ // Include CSS and JavaScript
249
+ public static function enqueues() {
250
+ wp_enqueue_script('jquery-ui-draggable');
251
+ wp_enqueue_script('jquery-ui-tabs');
252
+ wp_enqueue_script('jquery-ui-sortable');
253
+ wp_enqueue_script('jquery-ui-dialog');
254
+ wp_enqueue_script('jquery-ui-datepicker');
255
+ wp_enqueue_style('wp-color-picker');
256
+ wp_enqueue_media();
257
+
258
+ wp_register_script('datetimepicker', CS_PLUGIN_URL . '/wordpress/js/jquery.datetimepicker.js', array('jquery'), "2.5.17", true);
259
+ wp_enqueue_script('datetimepicker');
260
+ wp_enqueue_style('datetimepicker', CS_PLUGIN_URL . '/wordpress/css/jquery.datetimepicker.css', array(), "2.5.17");
261
+
262
+ add_action('admin_print_footer_scripts', array( __CLASS__, 'printTinyMCEOptions'), 1);
263
+ wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
264
+
265
+ wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
266
+ self::createNonces();
267
+ self::localization();
268
+
269
+ wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
270
+ wp_enqueue_script('crellyslider-admin');
271
+ }
272
+
273
+ public static function loadAssets() {
274
+ add_action('admin_head', 'CrellySliderAdmin::rawHeadAssets');
275
+ add_action('admin_enqueue_scripts', 'CrellySliderAdmin::enqueues');
276
+ }
277
+
278
+ public static function localization() {
279
+ // Here the translations for the admin.js file
280
+ $crellyslider_translations = array(
281
+ 'slide' => __('Slide', 'crelly-slider'),
282
+ 'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crelly-slider'),
283
+ 'slide_delete_just_one' => __('You can\'t delete this. You must have at least one slide.', 'crelly-slider'),
284
+ 'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crelly-slider'),
285
+ 'text_element_default_html' => __('Text element', 'crelly-slider'),
286
+ 'slide_live_preview' => __('Live preview', 'crelly-slider'),
287
+ 'slide_stop_preview' => __('Stop preview', 'crelly-slider'),
288
+ 'duplicate_slide' => __('Duplicate slide', 'crelly-slider'),
289
+ 'remove_slide' => __('Delete slide', 'crelly-slider'),
290
+ 'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
291
+ 'switch_editor' => __('Switch editor', 'crelly-slider'),
292
+ );
293
+ wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
294
+ }
295
+
296
+ public static function createNonces() {
297
+ $nonces = array(
298
+ 'addSlider' => wp_create_nonce('crellyslider_add-slider'),
299
+ 'deleteSlider' => wp_create_nonce('crellyslider_delete-slider'),
300
+ 'duplicateSlider' => wp_create_nonce('crellyslider_duplicate-slider'),
301
+ 'exportSlider' => wp_create_nonce('crellyslider_export-slider'),
302
+ 'importSlider' => wp_create_nonce('crellyslider_import-slider'),
303
+ );
304
+
305
+ wp_localize_script('crellyslider-admin', 'crellyslider_nonces', $nonces);
306
+ }
307
+
308
+ /**
309
+ * Invokes the filter for the tinyMCE init options
310
+ */
311
+ public static function setTinyMCEOptions() {
312
+ self::$mceSettings = apply_filters( 'crellyslider_tiny_mce_before_init', self::tinyMCEDefaultOptions());
313
+ }
314
+
315
+ /**
316
+ * Generates the default tinyMCE options
317
+ *
318
+ * @return array Default options for the tinyMCE editor
319
+ */
320
+ private static function tinyMCEDefaultOptions() {
321
+ $fontSizes = '';
322
+ for($i = 1; $i <= 200; $i++) {
323
+ $fontSizes .= $i . 'px ';
324
+ }
325
+ $fontSizes = trim($fontSizes);
326
+
327
+ $language = explode('_', get_locale());
328
+ if($language == false || count($language) == 0) {
329
+ $language = 'en';
330
+ }
331
+ else {
332
+ $language = $language[0];
333
+ }
334
+
335
+ return array(
336
+ 'toolbar1' => 'bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor',
337
+ 'toolbar2' => 'fontselect,fontsizeselect',
338
+ 'toolbar3' => '',
339
+ 'toolbar4' => '',
340
+ 'height' => 200,
341
+ 'forced_root_block' => false,
342
+ 'wpautop' => false,
343
+ 'fontsize_formats' => $fontSizes,
344
+ 'wp_lang_attr' => get_locale(),
345
+ 'content_css' => '',
346
+ 'cache_suffix' => '',
347
+ 'language' => $language,
348
+ 'theme' => 'modern',
349
+ 'skin' => 'lightgray',
350
+ 'formats' => '{' .
351
+ 'alignleft: [' .
352
+ '{'.
353
+ 'selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", ' .
354
+ 'styles: {textAlign:"left", lineHeight:"inherit"}, ' .
355
+ 'inline: "div"'.
356
+ '},' .
357
+ '{' .
358
+ 'selector: "img,table,dl.wp-caption", ' .
359
+ 'classes: "alignleft"' .
360
+ '}' .
361
+ '],' .
362
+ 'aligncenter: [' .
363
+ '{' .
364
+ 'selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", ' .
365
+ 'styles: {textAlign:"center", lineHeight:"inherit"}, ' .
366
+ 'inline: "div"' .
367
+ '},' .
368
+ '{' .
369
+ 'selector: "img,table,dl.wp-caption", ' .
370
+ 'classes: "aligncenter"' .
371
+ '}' .
372
+ '],' .
373
+ 'alignright: [' .
374
+ '{' .
375
+ 'selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", ' .
376
+ 'styles: {textAlign:"right", lineHeight:"inherit"}, ' .
377
+ 'inline: "div"' .
378
+ '},' .
379
+ '{' .
380
+ 'selector: "img,table,dl.wp-caption", ' .
381
+ 'classes: "alignright"' .
382
+ '}' .
383
+ '],' .
384
+ 'strikethrough: {inline: "del"}' .
385
+ '}',
386
+ 'relative_urls' => false,
387
+ 'remove_script_host' => false,
388
+ 'convert_urls' => false,
389
+ 'browser_spellcheck' => true,
390
+ 'fix_list_elements' => true,
391
+ 'entities' => '38,amp,60,lt,62,gt',
392
+ 'entity_encoding' => 'raw',
393
+ 'keep_styles' => false,
394
+ 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
395
+ 'end_container_on_empty_block' => true,
396
+ 'wpeditimage_disable_captions' => false,
397
+ 'wpeditimage_html5_captions' => true,
398
+ 'plugins' => 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview,image',
399
+ 'resize' => 'vertical',
400
+ 'menubar' => false,
401
+ 'indent' => true,
402
+ 'tabfocus_elements' => ':prev,:next',
403
+ );
404
+ }
405
+
406
+ /**
407
+ * Outputs the previously set tinyMCE options (init Options)
408
+ *
409
+ * A <script> tag containing the global variable crellyslider_tinyMCEInit is printed
410
+ */
411
+ public static function printTinyMCEOptions() {
412
+ $options = self::$mceSettings;
413
+
414
+ $serialized = '';
415
+ foreach($options as $key => $value) {
416
+ if (is_bool($value)) {
417
+ $serialized .= $key . ':' . ($value ? 'true' : 'false') . ',';
418
+ } else {
419
+ $length = !empty($value) && is_string($value) ? strlen($value) : 0;
420
+
421
+ // don't wrap objects, arrays or functions in quotes
422
+ if ($length > 0
423
+ && (('{' == $value[0] && '}' == $value[$length - 1]) ||
424
+ ('[' == $value[0] && ']' == $value[$length - 1]) ||
425
+ preg_match('/^\(?function ?\(/', $value))) {
426
+
427
+ $serialized .= $key . ':' . $value . ',';
428
+ } else {
429
+ $serialized .= $key . ':"' . $value . '",';
430
+ }
431
+ }
432
+ }
433
+
434
+ // remove trailing spaces and commas and enclose in JSON { }
435
+ $serialized = '{' . trim($serialized, ' ,') . '}';
436
+ ?>
437
+ <script type="text/javascript">
438
+ crellyslider_tinyMCEInit = <?php echo $serialized; ?>;
439
+ </script>
440
+ <?php
441
+ }
442
+ }
443
+
444
+ ?>
wordpress/ajax.php CHANGED
@@ -1,859 +1,859 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- require_once CS_PATH . 'wordpress/helpers.php';
5
-
6
- /********************/
7
- /** AJAX CALLBACKS **/
8
- /********************/
9
-
10
- // Inserts an array into the database
11
- // https://github.com/mirzazeyrek/wp-multiple-insert
12
- function crellyslider_wp_insert_rows($row_arrays = array(), $wp_table_name) {
13
- global $wpdb;
14
- $wp_table_name = esc_sql($wp_table_name);
15
- // Setup arrays for Actual Values, and Placeholders
16
- $values = array();
17
- $place_holders = array();
18
- $query = "";
19
- $query_columns = "";
20
-
21
- $query .= "INSERT INTO {$wp_table_name} (";
22
-
23
- foreach($row_arrays as $count => $row_array)
24
- {
25
-
26
- foreach($row_array as $key => $value) {
27
-
28
- if($count == 0) {
29
- if($query_columns) {
30
- $query_columns .= ",".$key."";
31
- } else {
32
- $query_columns .= "".$key."";
33
- }
34
- }
35
-
36
- $values[] = $value;
37
-
38
- if(is_numeric($value)) {
39
- if(isset($place_holders[$count])) {
40
- $place_holders[$count] .= ", '%d'";
41
- } else {
42
- $place_holders[$count] = "( '%d'";
43
- }
44
- } else {
45
- if(isset($place_holders[$count])) {
46
- $place_holders[$count] .= ", '%s'";
47
- } else {
48
- $place_holders[$count] = "( '%s'";
49
- }
50
- }
51
- }
52
- // mind closing the GAP
53
- $place_holders[$count] .= ")";
54
- }
55
-
56
- $query .= " $query_columns ) VALUES ";
57
-
58
- $query .= implode(', ', $place_holders);
59
-
60
- if($wpdb->query($wpdb->prepare($query, $values))){
61
- return true;
62
- } else {
63
- return false;
64
- }
65
-
66
- }
67
-
68
- // Add slider
69
- add_action('wp_ajax_crellyslider_addSlider', 'crellyslider_addSlider_callback');
70
- function crellyslider_addSlider_callback() {
71
- if(! current_user_can(CS_MIN_CAPABILITY)) {
72
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
73
- }
74
- if(! check_ajax_referer('crellyslider_add-slider', 'security', false)) {
75
- die('Could not verify nonce');
76
- }
77
-
78
- global $wpdb;
79
- $options = $_POST['datas'];
80
-
81
- $output = crellyslider_insertSliderSQL($options);
82
-
83
- // Returning
84
- $output = json_encode(esc_sql($wpdb->insert_id));
85
- if(is_array($output)) print_r($output);
86
- else echo $output;
87
-
88
- die();
89
- }
90
-
91
- function crellyslider_insertSliderSQL($options) {
92
- global $wpdb;
93
-
94
- return $wpdb->insert(
95
- $wpdb->prefix . 'crellyslider_sliders',
96
- array(
97
- 'name' => sanitize_text_field($options['name']),
98
- 'alias' => sanitize_text_field($options['alias']),
99
- 'layout' => sanitize_key($options['layout']),
100
- 'responsive' => $options['responsive'],
101
- 'startWidth' => $options['startWidth'],
102
- 'startHeight' => $options['startHeight'],
103
- 'automaticSlide' => $options['automaticSlide'],
104
- 'showControls' => $options['showControls'],
105
- 'showNavigation' => $options['showNavigation'],
106
- 'showProgressBar' => $options['showProgressBar'],
107
- 'pauseOnHover' => $options['pauseOnHover'],
108
- 'callbacks' => $options['callbacks'],
109
- 'randomOrder' => $options['randomOrder'],
110
- 'startFromSlide' => $options['startFromSlide'],
111
- 'enableSwipe' => $options['enableSwipe'],
112
- 'fromDate' => sanitize_text_field($options['fromDate']),
113
- 'toDate' => sanitize_text_field($options['toDate']),
114
- ),
115
- array(
116
- '%s',
117
- '%s',
118
- '%s',
119
- '%d',
120
- '%d',
121
- '%d',
122
- '%d',
123
- '%d',
124
- '%d',
125
- '%d',
126
- '%d',
127
- '%s',
128
- '%d',
129
- '%d',
130
- '%d',
131
- '%s',
132
- '%s',
133
- )
134
- );
135
- }
136
-
137
- // Edit slider
138
- add_action('wp_ajax_crellyslider_editSlider', 'crellyslider_editSlider_callback');
139
- function crellyslider_editSlider_callback() {
140
- if(! current_user_can(CS_MIN_CAPABILITY)) {
141
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
142
- }
143
-
144
- global $wpdb;
145
- $options = $_POST['datas'];
146
- $table_name = $wpdb->prefix . 'crellyslider_sliders';
147
-
148
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
149
- echo json_encode(false);
150
- return;
151
- }
152
-
153
- if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['id']), esc_sql($_POST['security']))) {
154
- die('Could not verify nonce');
155
- }
156
-
157
- $output = $wpdb->update(
158
- $table_name,
159
- array(
160
- 'name' => sanitize_text_field($options['name']),
161
- 'alias' => sanitize_text_field($options['alias']),
162
- 'layout' => sanitize_key($options['layout']),
163
- 'responsive' => $options['responsive'],
164
- 'startWidth' => $options['startWidth'],
165
- 'startHeight' => $options['startHeight'],
166
- 'automaticSlide' => $options['automaticSlide'],
167
- 'showControls' => $options['showControls'],
168
- 'showNavigation' => $options['showNavigation'],
169
- 'showProgressBar' => $options['showProgressBar'],
170
- 'pauseOnHover' => $options['pauseOnHover'],
171
- 'callbacks' => $options['callbacks'],
172
- 'randomOrder' => $options['randomOrder'],
173
- 'startFromSlide' => $options['startFromSlide'],
174
- 'enableSwipe' => $options['enableSwipe'],
175
- 'fromDate' => sanitize_text_field($options['fromDate']),
176
- 'toDate' => sanitize_text_field($options['toDate']),
177
- ),
178
- array('id' => esc_sql($options['id'])),
179
- array(
180
- '%s',
181
- '%s',
182
- '%s',
183
- '%d',
184
- '%d',
185
- '%d',
186
- '%d',
187
- '%d',
188
- '%d',
189
- '%d',
190
- '%d',
191
- '%s',
192
- '%d',
193
- '%d',
194
- '%d',
195
- '%s',
196
- '%s',
197
- ),
198
- array('%d')
199
- );
200
-
201
- // Returning
202
- $output = json_encode($output);
203
- if(is_array($output)) print_r($output);
204
- else echo $output;
205
-
206
- die();
207
- }
208
-
209
- // Edit slides. Receives an array with all the slides options. Delete al the old slides (performs a backup first) then recreate them
210
- add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
211
- function crellyslider_editSlides_callback() {
212
- if(! current_user_can(CS_MIN_CAPABILITY)) {
213
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
214
- }
215
-
216
- global $wpdb;
217
- $options = $_POST['datas'];
218
-
219
- if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
220
- echo json_encode(false);
221
- return;
222
- }
223
-
224
- if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['slider_parent']), esc_sql($_POST['security']))) {
225
- die('Could not verify nonce');
226
- }
227
-
228
- // Get the latest slide ID. If we are able to save the new slides succesfully, we remove the old ones, otherwise we do the opposite
229
- $latestID = $wpdb->get_results($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY id DESC LIMIT 0, 1', esc_sql($options['slider_parent'])), ARRAY_A);
230
- if(!empty($latestID)) {
231
- $latestID = $latestID[0]['id'];
232
- }
233
- else {
234
- $latestID = null;
235
- }
236
-
237
- // It's impossible to have 0 slides (jQuery checks it)
238
- if(count($options['options']) == 0) {
239
- echo json_encode(false);
240
- return;
241
- }
242
-
243
- $options_array = array();
244
- for($i = 0; $i < count($options['options']); $i++) {
245
- $options_array[$i] = (object)($options['options'][$i]);
246
- }
247
-
248
- $output = crellyslider_insertSlidesSQL($options_array);
249
-
250
- if($output) {
251
- // Remove all the old slides
252
- if($latestID != null) {
253
- $output = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d AND id <= %d', esc_sql($options['slider_parent']), $latestID));
254
- }
255
- }
256
- else {
257
- // Remove all the new slides
258
- if($latestID != null) {
259
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d AND id > %d', esc_sql($options['slider_parent']), $latestID));
260
- }
261
- }
262
-
263
- // Returning
264
- $output = json_encode($output);
265
- if(is_array($output)) print_r($output);
266
- else echo $output;
267
-
268
- die();
269
- }
270
-
271
- function crellyslider_insertSlidesSQL($options) {
272
- global $wpdb;
273
-
274
- // Sanitize input
275
- for($i = 0; $i < count($options); $i++) {
276
- $options[$i]->background_type_image = sanitize_text_field($options[$i]->background_type_image);
277
- $options[$i]->background_type_color = sanitize_text_field($options[$i]->background_type_color);
278
- $options[$i]->background_repeat = sanitize_text_field($options[$i]->background_repeat);
279
- $options[$i]->background_propriety_size = sanitize_text_field($options[$i]->background_propriety_size);
280
- $options[$i]->data_in = sanitize_text_field($options[$i]->data_in);
281
- $options[$i]->data_out = sanitize_text_field($options[$i]->data_out);
282
- $options[$i]->link = sanitize_text_field($options[$i]->link);
283
- $options[$i]->custom_css = sanitize_textarea_field($options[$i]->custom_css);
284
- }
285
-
286
- return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_slides');
287
- }
288
-
289
- // Edit elements. Receives an array with all the elements options. Delete al the old elements (performs a backup first) then recreate them
290
- add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
291
- function crellyslider_editElements_callback() {
292
- if(! current_user_can(CS_MIN_CAPABILITY)) {
293
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
294
- }
295
-
296
- global $wpdb;
297
- $options = $_POST['datas'];
298
-
299
- if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
300
- echo json_encode(false);
301
- return;
302
- }
303
-
304
- if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['slider_parent']), esc_sql($_POST['security']))) {
305
- die('Could not verify nonce');
306
- }
307
-
308
- $output = true;
309
-
310
- // If no elements just delete the existing ones
311
- if(empty(json_decode(stripslashes($options['options'])))) {
312
- // Remove all the old elements
313
- $output = $wpdb->delete($wpdb->prefix . 'crellyslider_elements', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
314
- if(! $output) {
315
- echo json_encode(false);
316
- }
317
- // Generate new nonce and return it
318
- else {
319
- $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
320
- echo json_encode($newNonce);
321
- }
322
- }
323
- else {
324
- // Get the latest element ID. If we are able to save the new elements succesfully, we remove the old ones, otherwise we do the opposite
325
- $latestID = $wpdb->get_results($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d ORDER BY id DESC LIMIT 0, 1', esc_sql($options['slider_parent'])), ARRAY_A);
326
- if(!empty($latestID)) {
327
- $latestID = $latestID[0]['id'];
328
- }
329
- else {
330
- $latestID = null;
331
- }
332
-
333
- $options_array = json_decode(stripslashes($options['options']));
334
-
335
- $output = crellyslider_insertElementsSQL($options_array);
336
-
337
- if($output) {
338
- // Remove all the old elements
339
- if($latestID != null) {
340
- $output = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND id <= %d', esc_sql($options['slider_parent']), $latestID));
341
- }
342
-
343
- // Generate new nonce and return it
344
- $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
345
- echo json_encode($newNonce);
346
- die();
347
- }
348
- else {
349
- // Remove all the new elements
350
- if($latestID != null) {
351
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND id > %d', esc_sql($options['slider_parent']), $latestID));
352
- }
353
- }
354
-
355
- // Returning
356
- $output = json_encode($output);
357
- if(is_array($output)) print_r($output);
358
- else echo $output;
359
- }
360
-
361
- die();
362
- }
363
-
364
- function crellyslider_insertElementsSQL($options) {
365
- global $wpdb;
366
-
367
- // Sanitize input
368
- for($i = 0; $i < count($options); $i++) {
369
- $options[$i]->image_src = sanitize_text_field($options[$i]->image_src);
370
- $options[$i]->image_alt = sanitize_text_field($options[$i]->image_alt);
371
- $options[$i]->data_in = sanitize_text_field($options[$i]->data_in);
372
- $options[$i]->data_out = sanitize_text_field($options[$i]->data_out);
373
- $options[$i]->custom_css_classes = sanitize_text_field($options[$i]->custom_css_classes);
374
- $options[$i]->link = sanitize_text_field($options[$i]->link);
375
- $options[$i]->video_id = sanitize_text_field($options[$i]->video_id);
376
- }
377
-
378
- return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_elements');
379
- }
380
-
381
- // Delete slider and its content
382
- add_action('wp_ajax_crellyslider_deleteSlider', 'crellyslider_deleteSlider_callback');
383
- function crellyslider_deleteSlider_callback() {
384
- if(! current_user_can(CS_MIN_CAPABILITY)) {
385
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
386
- }
387
- if(! check_ajax_referer('crellyslider_delete-slider', 'security', false)) {
388
- die('Could not verify nonce');
389
- }
390
-
391
- global $wpdb;
392
- $options = $_POST['datas'];
393
-
394
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
395
- echo json_encode(false);
396
- return;
397
- }
398
-
399
- $real_output = true;
400
-
401
- // Delete slider
402
- $table_name = $wpdb->prefix . 'crellyslider_sliders';
403
- $output = $wpdb->delete($table_name, array('id' => esc_sql($options['id'])), array('%d'));
404
- if($output === false) {
405
- $real_output = false;
406
- }
407
-
408
- // Delete slides
409
- $table_name = $wpdb->prefix . 'crellyslider_slides';
410
- $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
411
- if($output === false) {
412
- $real_output = false;
413
- }
414
-
415
- // Delete elements
416
- $table_name = $wpdb->prefix . 'crellyslider_elements';
417
- $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
418
- if($output === false) {
419
- $real_output = false;
420
- }
421
-
422
- $output = CrellySliderHelpers::removeNonce(esc_sql($options['id']));
423
- if($output === false) {
424
- $real_output = false;
425
- }
426
-
427
- // Returning
428
- $real_output = json_encode($real_output);
429
- if(is_array($real_output)) print_r($real_output);
430
- else echo $real_output;
431
-
432
- die();
433
- }
434
-
435
- // Duplicate slider and its content
436
- add_action('wp_ajax_crellyslider_duplicateSlider', 'crellyslider_duplicateSlider_callback');
437
- function crellyslider_duplicateSlider_callback() {
438
- if(! current_user_can(CS_MIN_CAPABILITY)) {
439
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
440
- }
441
- if(! check_ajax_referer('crellyslider_duplicate-slider', 'security', false)) {
442
- die('Could not verify nonce');
443
- }
444
-
445
- global $wpdb;
446
- $options = $_POST['datas'];
447
-
448
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
449
- echo json_encode(false);
450
- return;
451
- }
452
-
453
- $output = true;
454
- $real_output = true;
455
-
456
- $slider_id = esc_sql($options['id']);
457
-
458
- $cloned_slider_name = '';
459
- $cloned_slider_alias = '';
460
-
461
- $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $slider_id), ARRAY_A);
462
- foreach($sliders as $slider) {
463
- $cloned_slider_name = $slider['name'] = $slider['name'] . '_' . __('Copy', 'crelly-slider');
464
- $cloned_slider_alias = $slider['alias'] = $slider['alias'] . '_' . __('copy', 'crelly-slider');
465
- $output = crellyslider_insertSliderSQL($slider);
466
- }
467
-
468
- if($output === false) {
469
- $real_output = false;
470
- }
471
- else {
472
- $cloned_slider_id = $wpdb->insert_id;
473
-
474
- // Clone slides
475
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $slider_id), ARRAY_A);
476
- if(empty($slides)) {
477
- $output = true;
478
- }
479
- else {
480
- foreach($slides as $key => $slide) {
481
- unset($slides[$key]['id']);
482
- $slides[$key]['slider_parent'] = $cloned_slider_id;
483
- }
484
- $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
485
- if($temp === false) {
486
- $output = false;
487
- }
488
- }
489
-
490
- // Clone elements
491
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', $slider_id), ARRAY_A);
492
- if(empty($elements)) {
493
- $output = true;
494
- }
495
- else {
496
- foreach($elements as $key => $element) {
497
- unset($elements[$key]['id']);
498
- $elements[$key]['slider_parent'] = $cloned_slider_id;
499
- }
500
- $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
501
- if($temp === false) {
502
- $output = false;
503
- }
504
-
505
- if($output === false) {
506
- $real_output = false;
507
- }
508
- }
509
- }
510
-
511
- if($real_output === true) {
512
- $real_output = array(
513
- 'response' => true,
514
- 'cloned_slider_id' => $cloned_slider_id,
515
- 'cloned_slider_name' => $cloned_slider_name,
516
- 'cloned_slider_alias' => $cloned_slider_alias,
517
- );
518
- }
519
- else {
520
- $real_output = array(
521
- 'response' => false,
522
- 'cloned_slider_id' => false,
523
- 'cloned_slider_name' => false,
524
- 'cloned_slider_alias' => false,
525
- );
526
- }
527
-
528
- // Returning
529
- $real_output = json_encode($real_output);
530
- if(is_array($real_output)) print_r($real_output);
531
- else echo $real_output;
532
-
533
- die();
534
- }
535
-
536
- // Exports the slider in .zip
537
- add_action('wp_ajax_crellyslider_exportSlider', 'crellyslider_exportSlider_callback');
538
- function crellyslider_exportSlider_callback() {
539
- if(! current_user_can(CS_MIN_CAPABILITY)) {
540
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
541
- }
542
- if(! check_ajax_referer('crellyslider_export-slider', 'security', false)) {
543
- die('Could not verify nonce');
544
- }
545
-
546
- global $wpdb;
547
-
548
- $options = $_POST['datas'];
549
-
550
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
551
- echo json_encode(false);
552
- return;
553
- }
554
-
555
- // Make dir with random name
556
- $dirName = uniqid();
557
- $tmpDir = CS_PATH . '/wordpress/temp/' . $dirName;
558
- mkdir($tmpDir);
559
-
560
- $real_output = true;
561
-
562
- $result = array();
563
-
564
- // Get the slider
565
- $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($options['id'])), ARRAY_A);
566
- if(empty($sliders)) {
567
- $real_output = false;
568
- }
569
- else {
570
- foreach($sliders as $key => $temp) {
571
- unset($sliders[$key]['id']);
572
- }
573
- $result['sliders'] = $sliders;
574
- }
575
-
576
- $zip = new ZipArchive();
577
- $filename = 'crellyslider-' . $sliders[0]['alias'] . '.zip';
578
- if($zip->open($tmpDir . '/' . $filename, ZipArchive::CREATE) !== TRUE) {
579
- echo false;
580
- CrellySliderHelpers::delTree($tmpDir);
581
- die();
582
- }
583
-
584
- // Get the slides
585
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', esc_sql($options['id'])), ARRAY_A);
586
- if(! empty($slides)) {
587
- foreach($slides as $key => $temp) {
588
- unset($slides[$key]['id']);
589
- unset($slides[$key]['slider_parent']);
590
-
591
- // Add images to zip and remove media directory URLs
592
- if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
593
- $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
594
- $imgFile = download_url($img);
595
- if(is_wp_error($imgFile)) {
596
- echo false;
597
- die();
598
- }
599
- $zip->addFile($imgFile, basename($img));
600
- $slides[$key]['background_type_image'] = basename($img);
601
- }
602
- }
603
- $result['slides'] = $slides;
604
- }
605
-
606
- // Get the elements
607
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', esc_sql($options['id'])), ARRAY_A);
608
- if(! empty($elements)) {
609
- foreach($elements as $key => $temp) {
610
- unset($elements[$key]['id']);
611
- unset($elements[$key]['slider_parent']);
612
-
613
- // Add images to zip and remove media directory URLs
614
- if($elements[$key]['type'] == 'image') {
615
- $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
616
- $imgFile = download_url($img);
617
- if(is_wp_error($imgFile)) {
618
- echo false;
619
- die();
620
- }
621
- $zip->addFile($imgFile, basename($img));
622
- $elements[$key]['image_src'] = basename($img);
623
- }
624
- }
625
- $result['elements'] = $elements;
626
- }
627
-
628
- $json = json_encode($result);
629
- $zip->addFromString("slider.json", $json);
630
-
631
- $zip->close();
632
-
633
- if($real_output === true) {
634
- $real_output = array(
635
- 'response' => true,
636
- 'url' => CS_PLUGIN_URL . "/wordpress/temp/$dirName/$filename",
637
- );
638
- }
639
- else {
640
- $real_output = array(
641
- 'response' => false,
642
- 'url' => false,
643
- );
644
- }
645
-
646
- // Returning
647
- $real_output = json_encode($real_output);
648
- if(is_array($real_output)) print_r($real_output);
649
- else echo $real_output;
650
-
651
- die();
652
- }
653
-
654
- // Imports a slider given a .zip in $_FILES
655
- add_action('wp_ajax_crellyslider_importSlider', 'crellyslider_importSlider_callback');
656
- function crellyslider_importSlider_callback() {
657
- if(! current_user_can(CS_MIN_CAPABILITY)) {
658
- die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
659
- }
660
- if (! isset($_POST['security']) || ! wp_verify_nonce($_POST['security'], 'crellyslider_import-slider')) {
661
- die('Could not verify nonce');
662
- }
663
-
664
- foreach($_FILES as $file) {
665
- $real_output = crellyslider_importSlider($file['tmp_name']);
666
-
667
- if($real_output == false) {
668
- echo false;
669
- die();
670
- }
671
-
672
- $real_output = json_encode($real_output);
673
- if(is_array($real_output)) print_r($real_output);
674
- else echo $real_output;
675
-
676
- die();
677
- }
678
- }
679
-
680
- // Imports a slider given a .zip file path
681
- function crellyslider_importSlider($filePath) {
682
- global $wpdb;
683
-
684
- // Make dir with random name
685
- $dirName = uniqid();
686
- $tmpDir = CS_PATH . '/wordpress/temp/' . $dirName;
687
- mkdir($tmpDir);
688
-
689
- $output = true;
690
- $real_output = true;
691
-
692
- $zip = new ZipArchive();
693
- if($zip->open($filePath) !== TRUE) {
694
- return false;
695
- }
696
-
697
- // The zip archive should only contain a json file and images.
698
- $safeFiles = array(
699
- 'slider.json'
700
- );
701
- $safeExtensions = array(
702
- // List of common images extensions stolen from https://github.com/dyne/file-extension-list/blob/master/data/image
703
- '3dm',
704
- '3ds',
705
- 'max',
706
- 'bmp',
707
- 'dds',
708
- 'gif',
709
- 'jpg',
710
- 'jpeg',
711
- 'png',
712
- 'psd',
713
- 'xcf',
714
- 'tga',
715
- 'thm',
716
- 'tif',
717
- 'tiff',
718
- 'yuv',
719
- 'ai',
720
- 'eps',
721
- 'ps',
722
- 'svg',
723
- 'dwg',
724
- 'dxf',
725
- 'gpx',
726
- 'kml',
727
- 'kmz',
728
- );
729
- for($i = 0; ! empty($zip->statIndex($i)['name']); $i++) {
730
- $fileName = $zip->statIndex($i)['name'];
731
- $ext = pathinfo($fileName, PATHINFO_EXTENSION);
732
-
733
- if(! in_array($fileName, $safeFiles) && ! in_array($ext, $safeExtensions)) {
734
- CrellySliderHelpers::delTree($tmpDir);
735
- die('Attempting to extract an unsupported file: ' . $fileName);
736
- }
737
- }
738
-
739
- $zip->extractTo($tmpDir);
740
-
741
- $imported_array = json_decode(file_get_contents($tmpDir . '/slider.json'));
742
-
743
- $sliders = $imported_array->sliders;
744
- foreach($sliders as $slider) {
745
- // Prevent compatiblity issues with old .zip exported sliders (< 1.2.0)
746
- if(! isset($slider->randomOrder)) {
747
- $slider->randomOrder = 0;
748
- }
749
- if(! isset($slider->startFromSlide)) {
750
- $slider->startFromSlide = 0;
751
- }
752
-
753
- $output = crellyslider_insertSliderSQL((array) $slider);
754
- }
755
-
756
- if($output === false) {
757
- $real_output = false;
758
- }
759
- else {
760
- $imported_slider_id = $wpdb->insert_id;
761
-
762
- // Import slides
763
- $slides = $imported_array->slides;
764
- if(empty($slides)) {
765
- $output = true;
766
- }
767
- else {
768
- foreach($slides as $key => $slide) {
769
- $slides[$key]->slider_parent = $imported_slider_id;
770
-
771
- // Set background images
772
- if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
773
- $url = $tmpDir . '/' . $slides[$key]->background_type_image;
774
- $id = crellyslider_importImage($url);
775
- $slides[$key]->background_type_image = $id;
776
- }
777
- }
778
- $temp = crellyslider_insertSlidesSQL((array) $slides);
779
- if($temp === false) {
780
- $output = false;
781
- }
782
- }
783
-
784
- // Import elements
785
- $elements = isset($imported_array->elements) ? (array) $imported_array->elements : array();
786
- if(empty($elements)) {
787
- $output = true;
788
- }
789
- else {
790
- foreach($elements as $key => $element) {
791
- $elements[$key]->slider_parent = $imported_slider_id;
792
-
793
- // Set images
794
- if($elements[$key]->type == 'image') {
795
- $url = $tmpDir . '/' . $elements[$key]->image_src;
796
- $id = crellyslider_importImage($url);
797
- $elements[$key]->image_src = $id;
798
- }
799
- }
800
- $temp = crellyslider_insertElementsSQL((array) $elements);
801
- if($temp === false) {
802
- $output = false;
803
- }
804
-
805
- if($output === false) {
806
- $real_output = false;
807
- }
808
- }
809
- }
810
-
811
- if($real_output === true) {
812
- $real_output = array(
813
- 'response' => true,
814
- 'imported_slider_id' => $imported_slider_id,
815
- 'imported_slider_name' => $imported_array->sliders[0]->name,
816
- 'imported_slider_alias' => $imported_array->sliders[0]->alias,
817
- );
818
- }
819
- else {
820
- $real_output = array(
821
- 'response' => false,
822
- 'imported_slider_id' => false,
823
- 'imported_slider_name' => false,
824
- 'imported_slider_alias' => false,
825
- );
826
- }
827
-
828
- CrellySliderHelpers::delTree($tmpDir);
829
-
830
- return $real_output;
831
- }
832
-
833
- // Imports an image to the WordPress media library. Returns the attachment ID
834
- // Original script: https://gist.github.com/hissy/7352933
835
- function crellyslider_importImage($local_url) {
836
- $file = $local_url;
837
- $filename = basename($file);
838
-
839
- $upload_file = wp_upload_bits($filename, null, file_get_contents($file));
840
- if (!$upload_file['error']) {
841
- $wp_filetype = wp_check_filetype($filename, null );
842
- $attachment = array(
843
- 'post_mime_type' => $wp_filetype['type'],
844
- 'post_parent' => 0,
845
- 'post_title' => preg_replace('/\.[^.]+$/', '', $filename),
846
- 'post_content' => '',
847
- 'post_status' => 'inherit'
848
- );
849
- $attachment_id = wp_insert_attachment($attachment, $upload_file['file'], 0);
850
- if (!is_wp_error($attachment_id)) {
851
- require_once(ABSPATH . "wp-admin" . '/includes/image.php');
852
- $attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload_file['file'] );
853
- wp_update_attachment_metadata( $attachment_id, $attachment_data );
854
- }
855
- }
856
-
857
- return $attachment_id;
858
- }
859
- ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ require_once CS_PATH . 'wordpress/helpers.php';
5
+
6
+ /********************/
7
+ /** AJAX CALLBACKS **/
8
+ /********************/
9
+
10
+ // Inserts an array into the database
11
+ // https://github.com/mirzazeyrek/wp-multiple-insert
12
+ function crellyslider_wp_insert_rows($row_arrays = array(), $wp_table_name) {
13
+ global $wpdb;
14
+ $wp_table_name = esc_sql($wp_table_name);
15
+ // Setup arrays for Actual Values, and Placeholders
16
+ $values = array();
17
+ $place_holders = array();
18
+ $query = "";
19
+ $query_columns = "";
20
+
21
+ $query .= "INSERT INTO {$wp_table_name} (";
22
+
23
+ foreach($row_arrays as $count => $row_array)
24
+ {
25
+
26
+ foreach($row_array as $key => $value) {
27
+
28
+ if($count == 0) {
29
+ if($query_columns) {
30
+ $query_columns .= ",".$key."";
31
+ } else {
32
+ $query_columns .= "".$key."";
33
+ }
34
+ }
35
+
36
+ $values[] = $value;
37
+
38
+ if(is_numeric($value)) {
39
+ if(isset($place_holders[$count])) {
40
+ $place_holders[$count] .= ", '%d'";
41
+ } else {
42
+ $place_holders[$count] = "( '%d'";
43
+ }
44
+ } else {
45
+ if(isset($place_holders[$count])) {
46
+ $place_holders[$count] .= ", '%s'";
47
+ } else {
48
+ $place_holders[$count] = "( '%s'";
49
+ }
50
+ }
51
+ }
52
+ // mind closing the GAP
53
+ $place_holders[$count] .= ")";
54
+ }
55
+
56
+ $query .= " $query_columns ) VALUES ";
57
+
58
+ $query .= implode(', ', $place_holders);
59
+
60
+ if($wpdb->query($wpdb->prepare($query, $values))){
61
+ return true;
62
+ } else {
63
+ return false;
64
+ }
65
+
66
+ }
67
+
68
+ // Add slider
69
+ add_action('wp_ajax_crellyslider_addSlider', 'crellyslider_addSlider_callback');
70
+ function crellyslider_addSlider_callback() {
71
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
72
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
73
+ }
74
+ if(! check_ajax_referer('crellyslider_add-slider', 'security', false)) {
75
+ die('Could not verify nonce');
76
+ }
77
+
78
+ global $wpdb;
79
+ $options = $_POST['datas'];
80
+
81
+ $output = crellyslider_insertSliderSQL($options);
82
+
83
+ // Returning
84
+ $output = json_encode(esc_sql($wpdb->insert_id));
85
+ if(is_array($output)) print_r($output);
86
+ else echo $output;
87
+
88
+ die();
89
+ }
90
+
91
+ function crellyslider_insertSliderSQL($options) {
92
+ global $wpdb;
93
+
94
+ return $wpdb->insert(
95
+ $wpdb->prefix . 'crellyslider_sliders',
96
+ array(
97
+ 'name' => sanitize_text_field($options['name']),
98
+ 'alias' => sanitize_text_field($options['alias']),
99
+ 'layout' => sanitize_key($options['layout']),
100
+ 'responsive' => $options['responsive'],
101
+ 'startWidth' => $options['startWidth'],
102
+ 'startHeight' => $options['startHeight'],
103
+ 'automaticSlide' => $options['automaticSlide'],
104
+ 'showControls' => $options['showControls'],
105
+ 'showNavigation' => $options['showNavigation'],
106
+ 'showProgressBar' => $options['showProgressBar'],
107
+ 'pauseOnHover' => $options['pauseOnHover'],
108
+ 'callbacks' => $options['callbacks'],
109
+ 'randomOrder' => $options['randomOrder'],
110
+ 'startFromSlide' => $options['startFromSlide'],
111
+ 'enableSwipe' => $options['enableSwipe'],
112
+ 'fromDate' => sanitize_text_field($options['fromDate']),
113
+ 'toDate' => sanitize_text_field($options['toDate']),
114
+ ),
115
+ array(
116
+ '%s',
117
+ '%s',
118
+ '%s',
119
+ '%d',
120
+ '%d',
121
+ '%d',
122
+ '%d',
123
+ '%d',
124
+ '%d',
125
+ '%d',
126
+ '%d',
127
+ '%s',
128
+ '%d',
129
+ '%d',
130
+ '%d',
131
+ '%s',
132
+ '%s',
133
+ )
134
+ );
135
+ }
136
+
137
+ // Edit slider
138
+ add_action('wp_ajax_crellyslider_editSlider', 'crellyslider_editSlider_callback');
139
+ function crellyslider_editSlider_callback() {
140
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
141
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
142
+ }
143
+
144
+ global $wpdb;
145
+ $options = $_POST['datas'];
146
+ $table_name = $wpdb->prefix . 'crellyslider_sliders';
147
+
148
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
149
+ echo json_encode(false);
150
+ return;
151
+ }
152
+
153
+ if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['id']), esc_sql($_POST['security']))) {
154
+ die('Could not verify nonce');
155
+ }
156
+
157
+ $output = $wpdb->update(
158
+ $table_name,
159
+ array(
160
+ 'name' => sanitize_text_field($options['name']),
161
+ 'alias' => sanitize_text_field($options['alias']),
162
+ 'layout' => sanitize_key($options['layout']),
163
+ 'responsive' => $options['responsive'],
164
+ 'startWidth' => $options['startWidth'],
165
+ 'startHeight' => $options['startHeight'],
166
+ 'automaticSlide' => $options['automaticSlide'],
167
+ 'showControls' => $options['showControls'],
168
+ 'showNavigation' => $options['showNavigation'],
169
+ 'showProgressBar' => $options['showProgressBar'],
170
+ 'pauseOnHover' => $options['pauseOnHover'],
171
+ 'callbacks' => $options['callbacks'],
172
+ 'randomOrder' => $options['randomOrder'],
173
+ 'startFromSlide' => $options['startFromSlide'],
174
+ 'enableSwipe' => $options['enableSwipe'],
175
+ 'fromDate' => sanitize_text_field($options['fromDate']),
176
+ 'toDate' => sanitize_text_field($options['toDate']),
177
+ ),
178
+ array('id' => esc_sql($options['id'])),
179
+ array(
180
+ '%s',
181
+ '%s',
182
+ '%s',
183
+ '%d',
184
+ '%d',
185
+ '%d',
186
+ '%d',
187
+ '%d',
188
+ '%d',
189
+ '%d',
190
+ '%d',
191
+ '%s',
192
+ '%d',
193
+ '%d',
194
+ '%d',
195
+ '%s',
196
+ '%s',
197
+ ),
198
+ array('%d')
199
+ );
200
+
201
+ // Returning
202
+ $output = json_encode($output);
203
+ if(is_array($output)) print_r($output);
204
+ else echo $output;
205
+
206
+ die();
207
+ }
208
+
209
+ // Edit slides. Receives an array with all the slides options. Delete al the old slides (performs a backup first) then recreate them
210
+ add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
211
+ function crellyslider_editSlides_callback() {
212
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
213
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
214
+ }
215
+
216
+ global $wpdb;
217
+ $options = $_POST['datas'];
218
+
219
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
220
+ echo json_encode(false);
221
+ return;
222
+ }
223
+
224
+ if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['slider_parent']), esc_sql($_POST['security']))) {
225
+ die('Could not verify nonce');
226
+ }
227
+
228
+ // Get the latest slide ID. If we are able to save the new slides succesfully, we remove the old ones, otherwise we do the opposite
229
+ $latestID = $wpdb->get_results($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY id DESC LIMIT 0, 1', esc_sql($options['slider_parent'])), ARRAY_A);
230
+ if(!empty($latestID)) {
231
+ $latestID = $latestID[0]['id'];
232
+ }
233
+ else {
234
+ $latestID = null;
235
+ }
236
+
237
+ // It's impossible to have 0 slides (jQuery checks it)
238
+ if(count($options['options']) == 0) {
239
+ echo json_encode(false);
240
+ return;
241
+ }
242
+
243
+ $options_array = array();
244
+ for($i = 0; $i < count($options['options']); $i++) {
245
+ $options_array[$i] = (object)($options['options'][$i]);
246
+ }
247
+
248
+ $output = crellyslider_insertSlidesSQL($options_array);
249
+
250
+ if($output) {
251
+ // Remove all the old slides
252
+ if($latestID != null) {
253
+ $output = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d AND id <= %d', esc_sql($options['slider_parent']), $latestID));
254
+ }
255
+ }
256
+ else {
257
+ // Remove all the new slides
258
+ if($latestID != null) {
259
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d AND id > %d', esc_sql($options['slider_parent']), $latestID));
260
+ }
261
+ }
262
+
263
+ // Returning
264
+ $output = json_encode($output);
265
+ if(is_array($output)) print_r($output);
266
+ else echo $output;
267
+
268
+ die();
269
+ }
270
+
271
+ function crellyslider_insertSlidesSQL($options) {
272
+ global $wpdb;
273
+
274
+ // Sanitize input
275
+ for($i = 0; $i < count($options); $i++) {
276
+ $options[$i]->background_type_image = sanitize_text_field($options[$i]->background_type_image);
277
+ $options[$i]->background_type_color = sanitize_text_field($options[$i]->background_type_color);
278
+ $options[$i]->background_repeat = sanitize_text_field($options[$i]->background_repeat);
279
+ $options[$i]->background_propriety_size = sanitize_text_field($options[$i]->background_propriety_size);
280
+ $options[$i]->data_in = sanitize_text_field($options[$i]->data_in);
281
+ $options[$i]->data_out = sanitize_text_field($options[$i]->data_out);
282
+ $options[$i]->link = sanitize_text_field($options[$i]->link);
283
+ $options[$i]->custom_css = sanitize_textarea_field($options[$i]->custom_css);
284
+ }
285
+
286
+ return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_slides');
287
+ }
288
+
289
+ // Edit elements. Receives an array with all the elements options. Delete al the old elements (performs a backup first) then recreate them
290
+ add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
291
+ function crellyslider_editElements_callback() {
292
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
293
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
294
+ }
295
+
296
+ global $wpdb;
297
+ $options = $_POST['datas'];
298
+
299
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
300
+ echo json_encode(false);
301
+ return;
302
+ }
303
+
304
+ if(! isset($_POST['security']) || ! CrellySliderHelpers::verifyNonce(esc_sql($options['slider_parent']), esc_sql($_POST['security']))) {
305
+ die('Could not verify nonce');
306
+ }
307
+
308
+ $output = true;
309
+
310
+ // If no elements just delete the existing ones
311
+ if(empty(json_decode(stripslashes($options['options'])))) {
312
+ // Remove all the old elements
313
+ $output = $wpdb->delete($wpdb->prefix . 'crellyslider_elements', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
314
+ if(! $output) {
315
+ echo json_encode(false);
316
+ }
317
+ // Generate new nonce and return it
318
+ else {
319
+ $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
320
+ echo json_encode($newNonce);
321
+ }
322
+ }
323
+ else {
324
+ // Get the latest element ID. If we are able to save the new elements succesfully, we remove the old ones, otherwise we do the opposite
325
+ $latestID = $wpdb->get_results($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d ORDER BY id DESC LIMIT 0, 1', esc_sql($options['slider_parent'])), ARRAY_A);
326
+ if(!empty($latestID)) {
327
+ $latestID = $latestID[0]['id'];
328
+ }
329
+ else {
330
+ $latestID = null;
331
+ }
332
+
333
+ $options_array = json_decode(stripslashes($options['options']));
334
+
335
+ $output = crellyslider_insertElementsSQL($options_array);
336
+
337
+ if($output) {
338
+ // Remove all the old elements
339
+ if($latestID != null) {
340
+ $output = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND id <= %d', esc_sql($options['slider_parent']), $latestID));
341
+ }
342
+
343
+ // Generate new nonce and return it
344
+ $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
345
+ echo json_encode($newNonce);
346
+ die();
347
+ }
348
+ else {
349
+ // Remove all the new elements
350
+ if($latestID != null) {
351
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND id > %d', esc_sql($options['slider_parent']), $latestID));
352
+ }
353
+ }
354
+
355
+ // Returning
356
+ $output = json_encode($output);
357
+ if(is_array($output)) print_r($output);
358
+ else echo $output;
359
+ }
360
+
361
+ die();
362
+ }
363
+
364
+ function crellyslider_insertElementsSQL($options) {
365
+ global $wpdb;
366
+
367
+ // Sanitize input
368
+ for($i = 0; $i < count($options); $i++) {
369
+ $options[$i]->image_src = sanitize_text_field($options[$i]->image_src);
370
+ $options[$i]->image_alt = sanitize_text_field($options[$i]->image_alt);
371
+ $options[$i]->data_in = sanitize_text_field($options[$i]->data_in);
372
+ $options[$i]->data_out = sanitize_text_field($options[$i]->data_out);
373
+ $options[$i]->custom_css_classes = sanitize_text_field($options[$i]->custom_css_classes);
374
+ $options[$i]->link = sanitize_text_field($options[$i]->link);
375
+ $options[$i]->video_id = sanitize_text_field($options[$i]->video_id);
376
+ }
377
+
378
+ return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_elements');
379
+ }
380
+
381
+ // Delete slider and its content
382
+ add_action('wp_ajax_crellyslider_deleteSlider', 'crellyslider_deleteSlider_callback');
383
+ function crellyslider_deleteSlider_callback() {
384
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
385
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
386
+ }
387
+ if(! check_ajax_referer('crellyslider_delete-slider', 'security', false)) {
388
+ die('Could not verify nonce');
389
+ }
390
+
391
+ global $wpdb;
392
+ $options = $_POST['datas'];
393
+
394
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
395
+ echo json_encode(false);
396
+ return;
397
+ }
398
+
399
+ $real_output = true;
400
+
401
+ // Delete slider
402
+ $table_name = $wpdb->prefix . 'crellyslider_sliders';
403
+ $output = $wpdb->delete($table_name, array('id' => esc_sql($options['id'])), array('%d'));
404
+ if($output === false) {
405
+ $real_output = false;
406
+ }
407
+
408
+ // Delete slides
409
+ $table_name = $wpdb->prefix . 'crellyslider_slides';
410
+ $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
411
+ if($output === false) {
412
+ $real_output = false;
413
+ }
414
+
415
+ // Delete elements
416
+ $table_name = $wpdb->prefix . 'crellyslider_elements';
417
+ $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
418
+ if($output === false) {
419
+ $real_output = false;
420
+ }
421
+
422
+ $output = CrellySliderHelpers::removeNonce(esc_sql($options['id']));
423
+ if($output === false) {
424
+ $real_output = false;
425
+ }
426
+
427
+ // Returning
428
+ $real_output = json_encode($real_output);
429
+ if(is_array($real_output)) print_r($real_output);
430
+ else echo $real_output;
431
+
432
+ die();
433
+ }
434
+
435
+ // Duplicate slider and its content
436
+ add_action('wp_ajax_crellyslider_duplicateSlider', 'crellyslider_duplicateSlider_callback');
437
+ function crellyslider_duplicateSlider_callback() {
438
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
439
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
440
+ }
441
+ if(! check_ajax_referer('crellyslider_duplicate-slider', 'security', false)) {
442
+ die('Could not verify nonce');
443
+ }
444
+
445
+ global $wpdb;
446
+ $options = $_POST['datas'];
447
+
448
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
449
+ echo json_encode(false);
450
+ return;
451
+ }
452
+
453
+ $output = true;
454
+ $real_output = true;
455
+
456
+ $slider_id = esc_sql($options['id']);
457
+
458
+ $cloned_slider_name = '';
459
+ $cloned_slider_alias = '';
460
+
461
+ $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $slider_id), ARRAY_A);
462
+ foreach($sliders as $slider) {
463
+ $cloned_slider_name = $slider['name'] = $slider['name'] . '_' . __('Copy', 'crelly-slider');
464
+ $cloned_slider_alias = $slider['alias'] = $slider['alias'] . '_' . __('copy', 'crelly-slider');
465
+ $output = crellyslider_insertSliderSQL($slider);
466
+ }
467
+
468
+ if($output === false) {
469
+ $real_output = false;
470
+ }
471
+ else {
472
+ $cloned_slider_id = $wpdb->insert_id;
473
+
474
+ // Clone slides
475
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $slider_id), ARRAY_A);
476
+ if(empty($slides)) {
477
+ $output = true;
478
+ }
479
+ else {
480
+ foreach($slides as $key => $slide) {
481
+ unset($slides[$key]['id']);
482
+ $slides[$key]['slider_parent'] = $cloned_slider_id;
483
+ }
484
+ $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
485
+ if($temp === false) {
486
+ $output = false;
487
+ }
488
+ }
489
+
490
+ // Clone elements
491
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', $slider_id), ARRAY_A);
492
+ if(empty($elements)) {
493
+ $output = true;
494
+ }
495
+ else {
496
+ foreach($elements as $key => $element) {
497
+ unset($elements[$key]['id']);
498
+ $elements[$key]['slider_parent'] = $cloned_slider_id;
499
+ }
500
+ $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
501
+ if($temp === false) {
502
+ $output = false;
503
+ }
504
+
505
+ if($output === false) {
506
+ $real_output = false;
507
+ }
508
+ }
509
+ }
510
+
511
+ if($real_output === true) {
512
+ $real_output = array(
513
+ 'response' => true,
514
+ 'cloned_slider_id' => $cloned_slider_id,
515
+ 'cloned_slider_name' => $cloned_slider_name,
516
+ 'cloned_slider_alias' => $cloned_slider_alias,
517
+ );
518
+ }
519
+ else {
520
+ $real_output = array(
521
+ 'response' => false,
522
+ 'cloned_slider_id' => false,
523
+ 'cloned_slider_name' => false,
524
+ 'cloned_slider_alias' => false,
525
+ );
526
+ }
527
+
528
+ // Returning
529
+ $real_output = json_encode($real_output);
530
+ if(is_array($real_output)) print_r($real_output);
531
+ else echo $real_output;
532
+
533
+ die();
534
+ }
535
+
536
+ // Exports the slider in .zip
537
+ add_action('wp_ajax_crellyslider_exportSlider', 'crellyslider_exportSlider_callback');
538
+ function crellyslider_exportSlider_callback() {
539
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
540
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
541
+ }
542
+ if(! check_ajax_referer('crellyslider_export-slider', 'security', false)) {
543
+ die('Could not verify nonce');
544
+ }
545
+
546
+ global $wpdb;
547
+
548
+ $options = $_POST['datas'];
549
+
550
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
551
+ echo json_encode(false);
552
+ return;
553
+ }
554
+
555
+ // Make dir with random name
556
+ $dirName = uniqid();
557
+ $tmpDir = CS_PATH . '/wordpress/temp/' . $dirName;
558
+ mkdir($tmpDir);
559
+
560
+ $real_output = true;
561
+
562
+ $result = array();
563
+
564
+ // Get the slider
565
+ $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($options['id'])), ARRAY_A);
566
+ if(empty($sliders)) {
567
+ $real_output = false;
568
+ }
569
+ else {
570
+ foreach($sliders as $key => $temp) {
571
+ unset($sliders[$key]['id']);
572
+ }
573
+ $result['sliders'] = $sliders;
574
+ }
575
+
576
+ $zip = new ZipArchive();
577
+ $filename = 'crellyslider-' . $sliders[0]['alias'] . '.zip';
578
+ if($zip->open($tmpDir . '/' . $filename, ZipArchive::CREATE) !== TRUE) {
579
+ echo false;
580
+ CrellySliderHelpers::delTree($tmpDir);
581
+ die();
582
+ }
583
+
584
+ // Get the slides
585
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', esc_sql($options['id'])), ARRAY_A);
586
+ if(! empty($slides)) {
587
+ foreach($slides as $key => $temp) {
588
+ unset($slides[$key]['id']);
589
+ unset($slides[$key]['slider_parent']);
590
+
591
+ // Add images to zip and remove media directory URLs
592
+ if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
593
+ $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
594
+ $imgFile = download_url($img);
595
+ if(is_wp_error($imgFile)) {
596
+ echo false;
597
+ die();
598
+ }
599
+ $zip->addFile($imgFile, basename($img));
600
+ $slides[$key]['background_type_image'] = basename($img);
601
+ }
602
+ }
603
+ $result['slides'] = $slides;
604
+ }
605
+
606
+ // Get the elements
607
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', esc_sql($options['id'])), ARRAY_A);
608
+ if(! empty($elements)) {
609
+ foreach($elements as $key => $temp) {
610
+ unset($elements[$key]['id']);
611
+ unset($elements[$key]['slider_parent']);
612
+
613
+ // Add images to zip and remove media directory URLs
614
+ if($elements[$key]['type'] == 'image') {
615
+ $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
616
+ $imgFile = download_url($img);
617
+ if(is_wp_error($imgFile)) {
618
+ echo false;
619
+ die();
620
+ }
621
+ $zip->addFile($imgFile, basename($img));
622
+ $elements[$key]['image_src'] = basename($img);
623
+ }
624
+ }
625
+ $result['elements'] = $elements;
626
+ }
627
+
628
+ $json = json_encode($result);
629
+ $zip->addFromString("slider.json", $json);
630
+
631
+ $zip->close();
632
+
633
+ if($real_output === true) {
634
+ $real_output = array(
635
+ 'response' => true,
636
+ 'url' => CS_PLUGIN_URL . "/wordpress/temp/$dirName/$filename",
637
+ );
638
+ }
639
+ else {
640
+ $real_output = array(
641
+ 'response' => false,
642
+ 'url' => false,
643
+ );
644
+ }
645
+
646
+ // Returning
647
+ $real_output = json_encode($real_output);
648
+ if(is_array($real_output)) print_r($real_output);
649
+ else echo $real_output;
650
+
651
+ die();
652
+ }
653
+
654
+ // Imports a slider given a .zip in $_FILES
655
+ add_action('wp_ajax_crellyslider_importSlider', 'crellyslider_importSlider_callback');
656
+ function crellyslider_importSlider_callback() {
657
+ if(! current_user_can(CS_MIN_CAPABILITY)) {
658
+ die('User must be able to ' . CS_MIN_CAPABILITY . ' to execute this function');
659
+ }
660
+ if (! isset($_POST['security']) || ! wp_verify_nonce($_POST['security'], 'crellyslider_import-slider')) {
661
+ die('Could not verify nonce');
662
+ }
663
+
664
+ foreach($_FILES as $file) {
665
+ $real_output = crellyslider_importSlider($file['tmp_name']);
666
+
667
+ if($real_output == false) {
668
+ echo false;
669
+ die();
670
+ }
671
+
672
+ $real_output = json_encode($real_output);
673
+ if(is_array($real_output)) print_r($real_output);
674
+ else echo $real_output;
675
+
676
+ die();
677
+ }
678
+ }
679
+
680
+ // Imports a slider given a .zip file path
681
+ function crellyslider_importSlider($filePath) {
682
+ global $wpdb;
683
+
684
+ // Make dir with random name
685
+ $dirName = uniqid();
686
+ $tmpDir = CS_PATH . '/wordpress/temp/' . $dirName;
687
+ mkdir($tmpDir);
688
+
689
+ $output = true;
690
+ $real_output = true;
691
+
692
+ $zip = new ZipArchive();
693
+ if($zip->open($filePath) !== TRUE) {
694
+ return false;
695
+ }
696
+
697
+ // The zip archive should only contain a json file and images.
698
+ $safeFiles = array(
699
+ 'slider.json'
700
+ );
701
+ $safeExtensions = array(
702
+ // List of common images extensions stolen from https://github.com/dyne/file-extension-list/blob/master/data/image
703
+ '3dm',
704
+ '3ds',
705
+ 'max',
706
+ 'bmp',
707
+ 'dds',
708
+ 'gif',
709
+ 'jpg',
710
+ 'jpeg',
711
+ 'png',
712
+ 'psd',
713
+ 'xcf',
714
+ 'tga',
715
+ 'thm',
716
+ 'tif',
717
+ 'tiff',
718
+ 'yuv',
719
+ 'ai',
720
+ 'eps',
721
+ 'ps',
722
+ 'svg',
723
+ 'dwg',
724
+ 'dxf',
725
+ 'gpx',
726
+ 'kml',
727
+ 'kmz',
728
+ );
729
+ for($i = 0; ! empty($zip->statIndex($i)['name']); $i++) {
730
+ $fileName = $zip->statIndex($i)['name'];
731
+ $ext = pathinfo($fileName, PATHINFO_EXTENSION);
732
+
733
+ if(! in_array($fileName, $safeFiles) && ! in_array($ext, $safeExtensions)) {
734
+ CrellySliderHelpers::delTree($tmpDir);
735
+ die('Attempting to extract an unsupported file: ' . $fileName);
736
+ }
737
+ }
738
+
739
+ $zip->extractTo($tmpDir);
740
+
741
+ $imported_array = json_decode(file_get_contents($tmpDir . '/slider.json'));
742
+
743
+ $sliders = $imported_array->sliders;
744
+ foreach($sliders as $slider) {
745
+ // Prevent compatiblity issues with old .zip exported sliders (< 1.2.0)
746
+ if(! isset($slider->randomOrder)) {
747
+ $slider->randomOrder = 0;
748
+ }
749
+ if(! isset($slider->startFromSlide)) {
750
+ $slider->startFromSlide = 0;
751
+ }
752
+
753
+ $output = crellyslider_insertSliderSQL((array) $slider);
754
+ }
755
+
756
+ if($output === false) {
757
+ $real_output = false;
758
+ }
759
+ else {
760
+ $imported_slider_id = $wpdb->insert_id;
761
+
762
+ // Import slides
763
+ $slides = $imported_array->slides;
764
+ if(empty($slides)) {
765
+ $output = true;
766
+ }
767
+ else {
768
+ foreach($slides as $key => $slide) {
769
+ $slides[$key]->slider_parent = $imported_slider_id;
770
+
771
+ // Set background images
772
+ if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
773
+ $url = $tmpDir . '/' . $slides[$key]->background_type_image;
774
+ $id = crellyslider_importImage($url);
775
+ $slides[$key]->background_type_image = $id;
776
+ }
777
+ }
778
+ $temp = crellyslider_insertSlidesSQL((array) $slides);
779
+ if($temp === false) {
780
+ $output = false;
781
+ }
782
+ }
783
+
784
+ // Import elements
785
+ $elements = isset($imported_array->elements) ? (array) $imported_array->elements : array();
786
+ if(empty($elements)) {
787
+ $output = true;
788
+ }
789
+ else {
790
+ foreach($elements as $key => $element) {
791
+ $elements[$key]->slider_parent = $imported_slider_id;
792
+
793
+ // Set images
794
+ if($elements[$key]->type == 'image') {
795
+ $url = $tmpDir . '/' . $elements[$key]->image_src;
796
+ $id = crellyslider_importImage($url);
797
+ $elements[$key]->image_src = $id;
798
+ }
799
+ }
800
+ $temp = crellyslider_insertElementsSQL((array) $elements);
801
+ if($temp === false) {
802
+ $output = false;
803
+ }
804
+
805
+ if($output === false) {
806
+ $real_output = false;
807
+ }
808
+ }
809
+ }
810
+
811
+ if($real_output === true) {
812
+ $real_output = array(
813
+ 'response' => true,
814
+ 'imported_slider_id' => $imported_slider_id,
815
+ 'imported_slider_name' => $imported_array->sliders[0]->name,
816
+ 'imported_slider_alias' => $imported_array->sliders[0]->alias,
817
+ );
818
+ }
819
+ else {
820
+ $real_output = array(
821
+ 'response' => false,
822
+ 'imported_slider_id' => false,
823
+ 'imported_slider_name' => false,
824
+ 'imported_slider_alias' => false,
825
+ );
826
+ }
827
+
828
+ CrellySliderHelpers::delTree($tmpDir);
829
+
830
+ return $real_output;
831
+ }
832
+
833
+ // Imports an image to the WordPress media library. Returns the attachment ID
834
+ // Original script: https://gist.github.com/hissy/7352933
835
+ function crellyslider_importImage($local_url) {
836
+ $file = $local_url;
837
+ $filename = basename($file);
838
+
839
+ $upload_file = wp_upload_bits($filename, null, file_get_contents($file));
840
+ if (!$upload_file['error']) {
841
+ $wp_filetype = wp_check_filetype($filename, null );
842
+ $attachment = array(
843
+ 'post_mime_type' => $wp_filetype['type'],
844
+ 'post_parent' => 0,
845
+ 'post_title' => preg_replace('/\.[^.]+$/', '', $filename),
846
+ 'post_content' => '',
847
+ 'post_status' => 'inherit'
848
+ );
849
+ $attachment_id = wp_insert_attachment($attachment, $upload_file['file'], 0);
850
+ if (!is_wp_error($attachment_id)) {
851
+ require_once(ABSPATH . "wp-admin" . '/includes/image.php');
852
+ $attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload_file['file'] );
853
+ wp_update_attachment_metadata( $attachment_id, $attachment_data );
854
+ }
855
+ }
856
+
857
+ return $attachment_id;
858
+ }
859
+ ?>
wordpress/common.php CHANGED
@@ -1,68 +1,68 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- class CrellySliderCommon {
5
- // Includes CSS and JavaScript
6
- public static function enqueues() {
7
- wp_enqueue_script('jquery');
8
- wp_enqueue_script('jquery-ui-core');
9
-
10
- if(CS_DEBUG) {
11
- wp_enqueue_script('jquery.crellyslider', CS_PLUGIN_URL . '/js/jquery.crellyslider.js', array('jquery', 'jquery-ui-core'), CS_VERSION, false);
12
- wp_enqueue_style('crellyslider', CS_PLUGIN_URL . '/css/crellyslider.css', array(), CS_VERSION);
13
- }
14
- else {
15
- wp_enqueue_script('jquery.crellyslider.min', CS_PLUGIN_URL . '/js/jquery.crellyslider.min.js', array('jquery', 'jquery-ui-core'), CS_VERSION, false);
16
- wp_enqueue_style('crellyslider.min', CS_PLUGIN_URL . '/css/crellyslider.min.css', array(), CS_VERSION);
17
- }
18
- }
19
-
20
- public static function setEnqueues() {
21
- add_action('wp_enqueue_scripts', 'CrellySliderCommon::enqueues');
22
- add_action('admin_enqueue_scripts', 'CrellySliderCommon::enqueues');
23
- }
24
-
25
- public static function loadPluginTextDomain() {
26
- add_action('plugins_loaded', 'CrellySliderCommon::textDomain');
27
- }
28
-
29
- // Returns true if a slider exists into the database. False if it doesn't
30
- public static function sliderExists($id) {
31
- global $wpdb;
32
- $slider = $wpdb->get_row($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($id)));
33
- if($slider != NULL) {
34
- return true;
35
- }
36
- return false;
37
- }
38
-
39
- // Returns the correct URL of an attachment
40
- public static function getURL($attachment_url) {
41
- // If the attachment ID is provided, get the URL
42
- if(is_numeric($attachment_url)) {
43
- return wp_get_attachment_url(intval($attachment_url));
44
- }
45
-
46
- // If a URL is provided, return the filtered URL
47
- if($attachment_url != 'none' && $attachment_url != 'undefined' && $attachment_url != '') {
48
- global $wpdb;
49
- $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s'", $attachment_url));
50
-
51
- if($attachment_id == NULL) {
52
- return $attachment_url;
53
- }
54
-
55
- $ret = wp_get_attachment_url($attachment_id);
56
-
57
- if($ret == false) {
58
- return $attachment_url;
59
- }
60
-
61
- return $ret;
62
- }
63
-
64
- // If something else is provided, do not touch it
65
- return $attachment_url;
66
- }
67
- }
68
- ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class CrellySliderCommon {
5
+ // Includes CSS and JavaScript
6
+ public static function enqueues() {
7
+ wp_enqueue_script('jquery');
8
+ wp_enqueue_script('jquery-ui-core');
9
+
10
+ if(CS_DEBUG) {
11
+ wp_enqueue_script('jquery.crellyslider', CS_PLUGIN_URL . '/js/jquery.crellyslider.js', array('jquery', 'jquery-ui-core'), CS_VERSION, false);
12
+ wp_enqueue_style('crellyslider', CS_PLUGIN_URL . '/css/crellyslider.css', array(), CS_VERSION);
13
+ }
14
+ else {
15
+ wp_enqueue_script('jquery.crellyslider.min', CS_PLUGIN_URL . '/js/jquery.crellyslider.min.js', array('jquery', 'jquery-ui-core'), CS_VERSION, false);
16
+ wp_enqueue_style('crellyslider.min', CS_PLUGIN_URL . '/css/crellyslider.min.css', array(), CS_VERSION);
17
+ }
18
+ }
19
+
20
+ public static function setEnqueues() {
21
+ add_action('wp_enqueue_scripts', 'CrellySliderCommon::enqueues');
22
+ add_action('admin_enqueue_scripts', 'CrellySliderCommon::enqueues');
23
+ }
24
+
25
+ public static function loadPluginTextDomain() {
26
+ add_action('plugins_loaded', 'CrellySliderCommon::textDomain');
27
+ }
28
+
29
+ // Returns true if a slider exists into the database. False if it doesn't
30
+ public static function sliderExists($id) {
31
+ global $wpdb;
32
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($id)));
33
+ if($slider != NULL) {
34
+ return true;
35
+ }
36
+ return false;
37
+ }
38
+
39
+ // Returns the correct URL of an attachment
40
+ public static function getURL($attachment_url) {
41
+ // If the attachment ID is provided, get the URL
42
+ if(is_numeric($attachment_url)) {
43
+ return wp_get_attachment_url(intval($attachment_url));
44
+ }
45
+
46
+ // If a URL is provided, return the filtered URL
47
+ if($attachment_url != 'none' && $attachment_url != 'undefined' && $attachment_url != '') {
48
+ global $wpdb;
49
+ $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s'", $attachment_url));
50
+
51
+ if($attachment_id == NULL) {
52
+ return $attachment_url;
53
+ }
54
+
55
+ $ret = wp_get_attachment_url($attachment_id);
56
+
57
+ if($ret == false) {
58
+ return $attachment_url;
59
+ }
60
+
61
+ return $ret;
62
+ }
63
+
64
+ // If something else is provided, do not touch it
65
+ return $attachment_url;
66
+ }
67
+ }
68
+ ?>
wordpress/css/admin.css CHANGED
@@ -1,591 +1,591 @@
1
- .cs-admin {
2
- margin: 10px auto 0 auto;
3
- padding-right: 20px;
4
- min-width: 960px;
5
- }
6
-
7
- .cs-admin a {
8
- text-decoration: none;
9
- outline: none;
10
- cursor: pointer;
11
- box-shadow: none;
12
- }
13
-
14
- .cs-admin input[name='cs-slide-background_type_color'][value='1'] {
15
- margin-top: 8px;
16
- }
17
-
18
- .cs-admin .wp-picker-container {
19
- display: inline-block;
20
- }
21
-
22
- .cs-admin .cs-style-list {
23
- list-style-type: disc;
24
- padding-left: 20px;
25
- }
26
-
27
- .cs-admin .cs-close,
28
- .cs-admin .cs-duplicate {
29
- display: inline-block;
30
- width: 13px;
31
- height: 13px;
32
- cursor: pointer;
33
- margin-top: -3px;
34
- vertical-align: middle;
35
- }
36
-
37
- .cs-admin .cs-close {
38
- background-image: url('../images/close.png');
39
- margin-left: 5px;
40
- }
41
-
42
- .cs-admin .cs-duplicate {
43
- background-image: url('../images/plus.png');
44
- margin-left: 10px;
45
- }
46
-
47
- .cs-admin .cs-button {
48
- position: relative;
49
- display: inline-block;
50
- -webkit-box-sizing: border-box;
51
- -moz-box-sizing: border-box;
52
- box-sizing: border-box;
53
- margin: 0;
54
- padding: 5px 14px;
55
- border: 1px solid transparent;
56
- border-radius: 2px;
57
- background-color: transparent;
58
- color: inherit;
59
- vertical-align: middle;
60
- text-align: center;
61
- text-decoration: none;
62
- text-transform: none;
63
- white-space: normal;
64
- font-weight: 400;
65
- font-style: normal;
66
- font-size: 13px;
67
- line-height: 20px;
68
- cursor: pointer;
69
- -webkit-transition: all .15s ease;
70
- transition: all .15s ease;
71
- -webkit-user-select: none;
72
- -moz-user-select: none;
73
- -ms-user-select: none;
74
- user-select: none;
75
- -webkit-appearance: none;
76
- -webkit-font-smoothing: antialiased;
77
- text-rendering: optimizeLegibility;
78
- }
79
-
80
- .cs-admin .cs-button:hover,.cs-button:focus {
81
- outline: 0;
82
- text-decoration: none;
83
- }
84
-
85
- .cs-admin .cs-button:active,.cs-button.cs-is-active {
86
- -webkit-box-shadow: none;
87
- box-shadow: none;
88
- text-decoration: none;
89
- }
90
-
91
- .cs-admin .cs-button[disabled],
92
- .cs-admin .cs-button.cs-is-disabled {
93
- opacity: 0.7;
94
- filter: alpha(opacity=70);
95
- cursor: not-allowed;
96
- pointer-events: none;
97
- }
98
-
99
- .cs-admin .cs-button.cs-is-default {
100
- border-color: #656d78;
101
- background-color: #f5f7fa;
102
- color: #434a54;
103
- }
104
-
105
- .cs-admin .cs-button.cs-is-default:hover,.cs-button.cs-is-default:focus {
106
- border-color: #737c89;
107
- background-color: #FFF;
108
- }
109
-
110
- .cs-admin .cs-button.cs-is-default:active,
111
- .cs-admin .cs-button.cs-is-default.cs-is-active {
112
- border-color: #575e67;
113
- background-color: #e1e7f0;
114
- }
115
-
116
- .cs-admin .cs-button.cs-is-primary {
117
- border-color: #2494be;
118
- background-color: #3bafda;
119
- color: #FFF;
120
- }
121
-
122
- .cs-admin .cs-button.cs-is-primary:hover,
123
- .cs-admin .cs-button.cs-is-primary:focus {
124
- border-color: #2aa8d7;
125
- background-color: #55badf;
126
- }
127
-
128
- .cs-admin .cs-button.cs-is-primary:active,
129
- .cs-admin .cs-button.cs-is-primary.cs-is-active {
130
- border-color: #1f80a4;
131
- background-color: #27a2cf;
132
- }
133
-
134
- .cs-admin .cs-button.cs-is-secondary {
135
- border-color: #7652d1;
136
- background-color: #967adc;
137
- color: #FFF;
138
- }
139
-
140
- .cs-admin .cs-button.cs-is-secondary:hover,
141
- .cs-admin .cs-button.cs-is-secondary:focus {
142
- border-color: #896ad7;
143
- background-color: #a992e2;
144
- }
145
-
146
- .cs-admin .cs-button.cs-is-secondary:active,
147
- .cs-admin .cs-button.cs-is-secondary.cs-is-active {
148
- border-color: #633acb;
149
- background-color: #8362d6;
150
- }
151
-
152
- .cs-admin .cs-button.cs-is-success {
153
- border-color: #72a53b;
154
- background-color: #8cc152;
155
- color: #FFF;
156
- }
157
-
158
- .cs-admin .cs-button.cs-is-success:hover,
159
- .cs-admin .cs-button.cs-is-success:focus {
160
- border-color: #82bc43;
161
- background-color: #9bc969;
162
- }
163
-
164
- .cs-admin .cs-button.cs-is-success:active,
165
- .cs-admin .cs-button.cs-is-success.cs-is-active {
166
- border-color: #628e33;
167
- background-color: #7db440;
168
- }
169
-
170
- .cs-admin .cs-button.cs-is-warning {
171
- border-color: #f4a911;
172
- background-color: #f6bb42;
173
- color: #FFF;
174
- }
175
-
176
- .cs-admin .cs-button.cs-is-warning:hover,
177
- .cs-admin .cs-button.cs-is-warning:focus {
178
- border-color: #f5b42e;
179
- background-color: #f7c65f;
180
- }
181
-
182
- .cs-admin .cs-button.cs-is-warning:active,
183
- .cs-admin .cs-button.cs-is-warning.cs-is-active {
184
- border-color: #dc970a;
185
- background-color: #f5b025;
186
- }
187
-
188
- .cs-admin .cs-button.cs-is-danger {
189
- border-color: #c42737;
190
- background-color: #da4453;
191
- color: #FFF;
192
- }
193
-
194
- .cs-admin .cs-button.cs-is-danger:hover,
195
- .cs-admin .cs-button.cs-is-danger:focus {
196
- border-color: #d63344;
197
- background-color: #df5e6a;
198
- }
199
-
200
- .cs-admin .cs-button.cs-is-danger:active,
201
- .cs-admin .cs-button.cs-is-danger.cs-is-active {
202
- border-color: #aa2230;
203
- background-color: #d52a3c;
204
- }
205
-
206
- .cs-admin .cs-button.cs-is-inverse {
207
- border-color: #434a54;
208
- background-color: #656d78;
209
- color: #FFF;
210
- }
211
-
212
- .cs-admin .cs-button.cs-is-inverse:hover,
213
- .cs-admin .cs-button.cs-is-inverse:focus {
214
- border-color: #515965;
215
- background-color: #737c89;
216
- }
217
-
218
- .cs-admin .cs-button.cs-is-inverse:active,
219
- .cs-admin .cs-button.cs-is-inverse.cs-is-active {
220
- border-color: #353b43;
221
- background-color: #575e67;
222
- }
223
-
224
- .cs-admin .cs-table {
225
- overflow:hidden;
226
- border:1px solid #d3d3d3;
227
- background:#fefefe;
228
- -moz-border-radius:5px;
229
- -webkit-border-radius:5px;
230
- border-radius:5px;
231
- width: 100%;
232
- border-spacing: 0px;
233
- border-collapse: separate;
234
- clear: left;
235
- position: relative;
236
- z-index: 999;
237
- }
238
-
239
- .cs-admin .cs-table th,
240
- .cs-admin .cs-table td {
241
- padding:15px 28px;
242
- }
243
-
244
- .cs-admin .cs-table th {
245
- padding-top: 15px;
246
- text-shadow: 1px 1px 1px #fff;
247
- background: #e8eaeb;
248
- }
249
-
250
- .cs-admin .cs-table td {
251
- border-top: 1px solid #e0e0e0;
252
- border-right: 1px solid #e0e0e0;
253
- }
254
-
255
- .cs-admin .cs-table td input[type=checkbox] {
256
- vertical-align: bottom;
257
- }
258
-
259
- .cs-admin .cs-table td:last-child {
260
- border-right: none;
261
- }
262
-
263
- .cs-admin .cs-table tr.odd-row td {
264
- background: #f6f6f6;
265
- }
266
-
267
- .cs-admin .cs-table td.first,
268
- .cs-admin .cs-table th.first {
269
- text-align: left;
270
- }
271
-
272
- .cs-admin .cs-table td.last {
273
- border-right: none;
274
- }
275
-
276
- .cs-admin .cs-table tr.odd-row td {
277
- background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
278
- background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
279
- }
280
-
281
- .cs-admin .cs-table th {
282
- background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
283
- background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
284
- }
285
-
286
- .cs-admin .cs-table tr:first-child th.first {
287
- -moz-border-radius-topleft: 5px;
288
- -webkit-border-top-left-radius: 5px;
289
- }
290
-
291
- .cs-admin .cs-table tr:first-child th.last {
292
- -moz-border-radius-topright: 5px;
293
- -webkit-border-top-right-radius: 5px;
294
- }
295
-
296
- .cs-admin .cs-table tr:last-child td.first {
297
- -moz-border-radius-bottomleft: 5px;
298
- -webkit-border-bottom-left-radius: 5px;
299
- }
300
-
301
- .cs-admin .cs-table tr:last-child td.last {
302
- -moz-border-radius-bottomright: 5px;
303
- -webkit-border-bottom-right-radius: 5px;
304
- }
305
-
306
- .cs-admin .cs-table .cs-table-header {
307
- text-align: center;
308
- font-weight: bold;
309
- }
310
-
311
- .cs-admin .cs-table .cs-name,
312
- .cs-admin .cs-table .cs-description {
313
- width: 25%;
314
- }
315
-
316
- .cs-admin .cs-table .cs-content {
317
- width: 50%;
318
- }
319
-
320
- .cs-admin textarea {
321
- width: 100%;
322
- height: 200px;
323
- }
324
-
325
- .cs-admin #cs-slider-name {
326
- width: 100%;
327
- padding: 10px;
328
- }
329
-
330
- .cs-admin .cs-message {
331
- padding: 15px;
332
- border-radius: 4px;
333
- border: solid 1px;
334
- margin-top: 15px;
335
- margin-bottom: 25px;
336
- }
337
-
338
- .cs-admin .cs-message.cs-message-ok {
339
- background-color: #dff0d8;
340
- border-color: #72a53b;
341
- color: #3c763d;
342
- }
343
-
344
- .cs-admin .cs-message.cs-message-error {
345
- background-color: #f2dede;
346
- border-color: #c42737;
347
- color: #a94442;
348
- }
349
-
350
- .cs-admin .cs-message.cs-message-warning {
351
- color: #8a6d3b;
352
- background-color: #fcf8e3;
353
- border-color: #f4a911;
354
- }
355
-
356
- .cs-admin .cs-message.cs-message-wait {
357
- color: #444444;
358
- background-color: #e6e6e6;
359
- border-color: #525252;
360
- }
361
-
362
- #cs-slides {
363
- display: none;
364
- }
365
-
366
- .cs-admin .cs-slides .cs-slide-build {
367
- border: solid 1px #ddd;
368
- }
369
-
370
- .cs-admin .cs-tabs > ul {
371
- width: auto;
372
- }
373
-
374
- .cs-admin .cs-tabs > ul {
375
- margin: 0;
376
- }
377
-
378
- .cs-admin .cs-tabs > ul > li {
379
- float: left;
380
- margin-bottom: 0;
381
- padding-right: 20px;
382
- margin-right: 20px;
383
- border-right: solid 1px #ddd;
384
- text-transform: uppercase;
385
- font-weight: bold;
386
- outline: none;
387
- display: block;
388
- white-space: nowrap;
389
- }
390
-
391
- .cs-admin .cs-tabs.cs-tabs-border > ul > li {
392
- border-top: solid 1px #ddd;
393
- margin-right: 0;
394
- padding-top: 20px;
395
- padding-bottom: 20px;
396
- padding-left: 30px;
397
- padding-right: 30px;
398
- }
399
-
400
- .cs-admin .cs-tabs.cs-tabs-border > ul > li:hover,
401
- .cs-admin .cs-tabs.cs-tabs-border > ul > li.active {
402
- background-color: #e9e9e9;
403
- }
404
-
405
- .cs-admin .cs-tabs > ul > li > a {
406
- margin-left: 5px;
407
- }
408
-
409
- .cs-admin .cs-tabs.cs-tabs-border > ul > li:first-child {
410
- border-left: solid 1px #ddd;
411
- }
412
-
413
- .cs-admin .cs-tabs.cs-tabs-border > ul > li:last-child {
414
- border-right: solid 1px #ddd;
415
- }
416
-
417
- .cs-admin .cs-tabs > ul > li:last-child {
418
- border-right: none;
419
- }
420
-
421
- .cs-admin .cs-slide-tabs > ul > li,
422
- .cs-admin .cs-slide-tabs > ul > li > a {
423
- cursor: move;
424
- }
425
-
426
- .cs-admin .cs-slide-tabs > ul > li > a > .cs-slide-name-text {
427
- cursor: pointer;
428
- }
429
-
430
- .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled,
431
- .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled a {
432
- cursor: pointer;
433
- }
434
-
435
- .cs-admin .cs-icon {
436
- display: inline-block;
437
- width: 13px;
438
- height: 13px;
439
- }
440
-
441
- .cs-admin .cs-icon.icon-settings {
442
- background-image: url('../images/settings.png');
443
- }
444
- .cs-admin .cs-icon.icon-edit {
445
- background-image: url('../images/edit.png');
446
- }
447
-
448
- .cs-admin .cs-slide-build {
449
- margin: 0 auto;
450
- }
451
-
452
- .cs-admin .cs-slides-list > .cs-slide,
453
- .cs-admin .cs-void-slide {
454
- display: none;
455
- }
456
-
457
- .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list form {
458
- display: inline;
459
- }
460
-
461
- .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input {
462
- display: none !important;
463
- }
464
-
465
- .cs-admin .wp-picker-holder {
466
- position: absolute;
467
- }
468
-
469
- .cs-admin .cs-slide .cs-slide-editing-area {
470
- position: relative;
471
- background-color: #fff;
472
- -moz-border-radius: 4px;
473
- border-radius: 4px;
474
- margin: 0 auto;
475
- line-height: 1.5;
476
- white-space: nowrap;
477
-
478
- line-height: 1.5;
479
- font-size: 14px;
480
- color: #000;
481
- font-family: 'Verdana', sans-serif;
482
-
483
- /* Default slide background settings: */
484
- background-repeat: no-repeat;
485
- background-size: cover;
486
- background-position: center center;
487
- }
488
-
489
- .cs-admin .cs-slide .cs-slide-editing-area a {
490
- color: #0073aa;
491
- }
492
-
493
- .cs-admin .cs-slide .cs-slide-editing-area a:hover {
494
- color: #0073aa;
495
- }
496
-
497
- .cs-admin .cs-slide .cs-slide-editing-area:before,
498
- .cs-admin .cs-slide .cs-slide-editing-area:after{
499
- z-index: -1;
500
- position: absolute;
501
- content: "";
502
- bottom: 15px;
503
- left: 10px;
504
- width: 50%;
505
- top: 80%;
506
- max-width:300px;
507
- background: rgba(0, 0, 0, 0.7);
508
- -webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.4);
509
- -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
510
- box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
511
- -webkit-transform: rotate(-3deg);
512
- -moz-transform: rotate(-3deg);
513
- -o-transform: rotate(-3deg);
514
- -ms-transform: rotate(-3deg);
515
- transform: rotate(-3deg);
516
- }
517
-
518
- .cs-admin .cs-slide .cs-slide-editing-area:after{
519
- -webkit-transform: rotate(3deg);
520
- -moz-transform: rotate(3deg);
521
- -o-transform: rotate(3deg);
522
- -ms-transform: rotate(3deg);
523
- transform: rotate(3deg);
524
- right: 10px;
525
- left: auto;
526
- }
527
-
528
- .cs-admin .cs-slide .cs-elements .cs-elements-actions {
529
- text-align: center;
530
- z-index: 999;
531
- position: relative;
532
- }
533
-
534
- .cs-admin .cs-slide .cs-elements .cs-void-element-settings {
535
- display: none;
536
- }
537
-
538
- .cs-admin .cs-slide .cs-slide-editing-area .cs-element {
539
- position: absolute;
540
- margin: 0;
541
- padding: 0;
542
- left: 0;
543
- top: 0;
544
- cursor: move;
545
- font-size: 14px;
546
- }
547
-
548
- .crellyslider ul li * {
549
- cursor: auto !important;
550
- }
551
-
552
- .cs-admin .cs-slide .cs-slide-live-preview-area > ul,
553
- .cs-admin .cs-slide .cs-slide-live-preview-area > ul > li {
554
- margin: 0;
555
- padding: 0;
556
- }
557
-
558
- .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element {
559
- min-width: 560px;
560
- min-height: 315px;
561
- background-color: #000;
562
- }
563
-
564
- .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element .cs-avoid-interaction {
565
- width: 100%;
566
- height: 100%;
567
- position: absolute;
568
- top: 0;
569
- left: 0;
570
- }
571
-
572
- .cs-admin .cs-slide .cs-slide-editing-area .cs-element.active {
573
- -webkit-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
574
- -moz-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
575
- box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
576
- }
577
-
578
- .cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-switch-editor {
579
- margin-bottom: 15px;
580
- text-align: right;
581
- }
582
-
583
- .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
584
- display: block !important;
585
- }
586
-
587
- .cs-admin .cs-label-input label {
588
- display: inline-block;
589
- width: 110px;
590
- cursor: default;
591
- }
1
+ .cs-admin {
2
+ margin: 10px auto 0 auto;
3
+ padding-right: 20px;
4
+ min-width: 960px;
5
+ }
6
+
7
+ .cs-admin a {
8
+ text-decoration: none;
9
+ outline: none;
10
+ cursor: pointer;
11
+ box-shadow: none;
12
+ }
13
+
14
+ .cs-admin input[name='cs-slide-background_type_color'][value='1'] {
15
+ margin-top: 8px;
16
+ }
17
+
18
+ .cs-admin .wp-picker-container {
19
+ display: inline-block;
20
+ }
21
+
22
+ .cs-admin .cs-style-list {
23
+ list-style-type: disc;
24
+ padding-left: 20px;
25
+ }
26
+
27
+ .cs-admin .cs-close,
28
+ .cs-admin .cs-duplicate {
29
+ display: inline-block;
30
+ width: 13px;
31
+ height: 13px;
32
+ cursor: pointer;
33
+ margin-top: -3px;
34
+ vertical-align: middle;
35
+ }
36
+
37
+ .cs-admin .cs-close {
38
+ background-image: url('../images/close.png');
39
+ margin-left: 5px;
40
+ }
41
+
42
+ .cs-admin .cs-duplicate {
43
+ background-image: url('../images/plus.png');
44
+ margin-left: 10px;
45
+ }
46
+
47
+ .cs-admin .cs-button {
48
+ position: relative;
49
+ display: inline-block;
50
+ -webkit-box-sizing: border-box;
51
+ -moz-box-sizing: border-box;
52
+ box-sizing: border-box;
53
+ margin: 0;
54
+ padding: 5px 14px;
55
+ border: 1px solid transparent;
56
+ border-radius: 2px;
57
+ background-color: transparent;
58
+ color: inherit;
59
+ vertical-align: middle;
60
+ text-align: center;
61
+ text-decoration: none;
62
+ text-transform: none;
63
+ white-space: normal;
64
+ font-weight: 400;
65
+ font-style: normal;
66
+ font-size: 13px;
67
+ line-height: 20px;
68
+ cursor: pointer;
69
+ -webkit-transition: all .15s ease;
70
+ transition: all .15s ease;
71
+ -webkit-user-select: none;
72
+ -moz-user-select: none;
73
+ -ms-user-select: none;
74
+ user-select: none;
75
+ -webkit-appearance: none;
76
+ -webkit-font-smoothing: antialiased;
77
+ text-rendering: optimizeLegibility;
78
+ }
79
+
80
+ .cs-admin .cs-button:hover,.cs-button:focus {
81
+ outline: 0;
82
+ text-decoration: none;
83
+ }
84
+
85
+ .cs-admin .cs-button:active,.cs-button.cs-is-active {
86
+ -webkit-box-shadow: none;
87
+ box-shadow: none;
88
+ text-decoration: none;
89
+ }
90
+
91
+ .cs-admin .cs-button[disabled],
92
+ .cs-admin .cs-button.cs-is-disabled {
93
+ opacity: 0.7;
94
+ filter: alpha(opacity=70);
95
+ cursor: not-allowed;
96
+ pointer-events: none;
97
+ }
98
+
99
+ .cs-admin .cs-button.cs-is-default {
100
+ border-color: #656d78;
101
+ background-color: #f5f7fa;
102
+ color: #434a54;
103
+ }
104
+
105
+ .cs-admin .cs-button.cs-is-default:hover,.cs-button.cs-is-default:focus {
106
+ border-color: #737c89;
107
+ background-color: #FFF;
108
+ }
109
+
110
+ .cs-admin .cs-button.cs-is-default:active,
111
+ .cs-admin .cs-button.cs-is-default.cs-is-active {
112
+ border-color: #575e67;
113
+ background-color: #e1e7f0;
114
+ }
115
+
116
+ .cs-admin .cs-button.cs-is-primary {
117
+ border-color: #2494be;
118
+ background-color: #3bafda;
119
+ color: #FFF;
120
+ }
121
+
122
+ .cs-admin .cs-button.cs-is-primary:hover,
123
+ .cs-admin .cs-button.cs-is-primary:focus {
124
+ border-color: #2aa8d7;
125
+ background-color: #55badf;
126
+ }
127
+
128
+ .cs-admin .cs-button.cs-is-primary:active,
129
+ .cs-admin .cs-button.cs-is-primary.cs-is-active {
130
+ border-color: #1f80a4;
131
+ background-color: #27a2cf;
132
+ }
133
+
134
+ .cs-admin .cs-button.cs-is-secondary {
135
+ border-color: #7652d1;
136
+ background-color: #967adc;
137
+ color: #FFF;
138
+ }
139
+
140
+ .cs-admin .cs-button.cs-is-secondary:hover,
141
+ .cs-admin .cs-button.cs-is-secondary:focus {
142
+ border-color: #896ad7;
143
+ background-color: #a992e2;
144
+ }
145
+
146
+ .cs-admin .cs-button.cs-is-secondary:active,
147
+ .cs-admin .cs-button.cs-is-secondary.cs-is-active {
148
+ border-color: #633acb;
149
+ background-color: #8362d6;
150
+ }
151
+
152
+ .cs-admin .cs-button.cs-is-success {
153
+ border-color: #72a53b;
154
+ background-color: #8cc152;
155
+ color: #FFF;
156
+ }
157
+
158
+ .cs-admin .cs-button.cs-is-success:hover,
159
+ .cs-admin .cs-button.cs-is-success:focus {
160
+ border-color: #82bc43;
161
+ background-color: #9bc969;
162
+ }
163
+
164
+ .cs-admin .cs-button.cs-is-success:active,
165
+ .cs-admin .cs-button.cs-is-success.cs-is-active {
166
+ border-color: #628e33;
167
+ background-color: #7db440;
168
+ }
169
+
170
+ .cs-admin .cs-button.cs-is-warning {
171
+ border-color: #f4a911;
172
+ background-color: #f6bb42;
173
+ color: #FFF;
174
+ }
175
+
176
+ .cs-admin .cs-button.cs-is-warning:hover,
177
+ .cs-admin .cs-button.cs-is-warning:focus {
178
+ border-color: #f5b42e;
179
+ background-color: #f7c65f;
180
+ }
181
+
182
+ .cs-admin .cs-button.cs-is-warning:active,
183
+ .cs-admin .cs-button.cs-is-warning.cs-is-active {
184
+ border-color: #dc970a;
185
+ background-color: #f5b025;
186
+ }
187
+
188
+ .cs-admin .cs-button.cs-is-danger {
189
+ border-color: #c42737;
190
+ background-color: #da4453;
191
+ color: #FFF;
192
+ }
193
+
194
+ .cs-admin .cs-button.cs-is-danger:hover,
195
+ .cs-admin .cs-button.cs-is-danger:focus {
196
+ border-color: #d63344;
197
+ background-color: #df5e6a;
198
+ }
199
+
200
+ .cs-admin .cs-button.cs-is-danger:active,
201
+ .cs-admin .cs-button.cs-is-danger.cs-is-active {
202
+ border-color: #aa2230;
203
+ background-color: #d52a3c;
204
+ }
205
+
206
+ .cs-admin .cs-button.cs-is-inverse {
207
+ border-color: #434a54;
208
+ background-color: #656d78;
209
+ color: #FFF;
210
+ }
211
+
212
+ .cs-admin .cs-button.cs-is-inverse:hover,
213
+ .cs-admin .cs-button.cs-is-inverse:focus {
214
+ border-color: #515965;
215
+ background-color: #737c89;
216
+ }
217
+
218
+ .cs-admin .cs-button.cs-is-inverse:active,
219
+ .cs-admin .cs-button.cs-is-inverse.cs-is-active {
220
+ border-color: #353b43;
221
+ background-color: #575e67;
222
+ }
223
+
224
+ .cs-admin .cs-table {
225
+ overflow:hidden;
226
+ border:1px solid #d3d3d3;
227
+ background:#fefefe;
228
+ -moz-border-radius:5px;
229
+ -webkit-border-radius:5px;
230
+ border-radius:5px;
231
+ width: 100%;
232
+ border-spacing: 0px;
233
+ border-collapse: separate;
234
+ clear: left;
235
+ position: relative;
236
+ z-index: 999;
237
+ }
238
+
239
+ .cs-admin .cs-table th,
240
+ .cs-admin .cs-table td {
241
+ padding:15px 28px;
242
+ }
243
+
244
+ .cs-admin .cs-table th {
245
+ padding-top: 15px;
246
+ text-shadow: 1px 1px 1px #fff;
247
+ background: #e8eaeb;
248
+ }
249
+
250
+ .cs-admin .cs-table td {
251
+ border-top: 1px solid #e0e0e0;
252
+ border-right: 1px solid #e0e0e0;
253
+ }
254
+
255
+ .cs-admin .cs-table td input[type=checkbox] {
256
+ vertical-align: bottom;
257
+ }
258
+
259
+ .cs-admin .cs-table td:last-child {
260
+ border-right: none;
261
+ }
262
+
263
+ .cs-admin .cs-table tr.odd-row td {
264
+ background: #f6f6f6;
265
+ }
266
+
267
+ .cs-admin .cs-table td.first,
268
+ .cs-admin .cs-table th.first {
269
+ text-align: left;
270
+ }
271
+
272
+ .cs-admin .cs-table td.last {
273
+ border-right: none;
274
+ }
275
+
276
+ .cs-admin .cs-table tr.odd-row td {
277
+ background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
278
+ background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
279
+ }
280
+
281
+ .cs-admin .cs-table th {
282
+ background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
283
+ background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
284
+ }
285
+
286
+ .cs-admin .cs-table tr:first-child th.first {
287
+ -moz-border-radius-topleft: 5px;
288
+ -webkit-border-top-left-radius: 5px;
289
+ }
290
+
291
+ .cs-admin .cs-table tr:first-child th.last {
292
+ -moz-border-radius-topright: 5px;
293
+ -webkit-border-top-right-radius: 5px;
294
+ }
295
+
296
+ .cs-admin .cs-table tr:last-child td.first {
297
+ -moz-border-radius-bottomleft: 5px;
298
+ -webkit-border-bottom-left-radius: 5px;
299
+ }
300
+
301
+ .cs-admin .cs-table tr:last-child td.last {
302
+ -moz-border-radius-bottomright: 5px;
303
+ -webkit-border-bottom-right-radius: 5px;
304
+ }
305
+
306
+ .cs-admin .cs-table .cs-table-header {
307
+ text-align: center;
308
+ font-weight: bold;
309
+ }
310
+
311
+ .cs-admin .cs-table .cs-name,
312
+ .cs-admin .cs-table .cs-description {
313
+ width: 25%;
314
+ }
315
+
316
+ .cs-admin .cs-table .cs-content {
317
+ width: 50%;
318
+ }
319
+
320
+ .cs-admin textarea {
321
+ width: 100%;
322
+ height: 200px;
323
+ }
324
+
325
+ .cs-admin #cs-slider-name {
326
+ width: 100%;
327
+ padding: 10px;
328
+ }
329
+
330
+ .cs-admin .cs-message {
331
+ padding: 15px;
332
+ border-radius: 4px;
333
+ border: solid 1px;
334
+ margin-top: 15px;
335
+ margin-bottom: 25px;
336
+ }
337
+
338
+ .cs-admin .cs-message.cs-message-ok {
339
+ background-color: #dff0d8;
340
+ border-color: #72a53b;
341
+ color: #3c763d;
342
+ }
343
+
344
+ .cs-admin .cs-message.cs-message-error {
345
+ background-color: #f2dede;
346
+ border-color: #c42737;
347
+ color: #a94442;
348
+ }
349
+
350
+ .cs-admin .cs-message.cs-message-warning {
351
+ color: #8a6d3b;
352
+ background-color: #fcf8e3;
353
+ border-color: #f4a911;
354
+ }
355
+
356
+ .cs-admin .cs-message.cs-message-wait {
357
+ color: #444444;
358
+ background-color: #e6e6e6;
359
+ border-color: #525252;
360
+ }
361
+
362
+ #cs-slides {
363
+ display: none;
364
+ }
365
+
366
+ .cs-admin .cs-slides .cs-slide-build {
367
+ border: solid 1px #ddd;
368
+ }
369
+
370
+ .cs-admin .cs-tabs > ul {
371
+ width: auto;
372
+ }
373
+
374
+ .cs-admin .cs-tabs > ul {
375
+ margin: 0;
376
+ }
377
+
378
+ .cs-admin .cs-tabs > ul > li {
379
+ float: left;
380
+ margin-bottom: 0;
381
+ padding-right: 20px;
382
+ margin-right: 20px;
383
+ border-right: solid 1px #ddd;
384
+ text-transform: uppercase;
385
+ font-weight: bold;
386
+ outline: none;
387
+ display: block;
388
+ white-space: nowrap;
389
+ }
390
+
391
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li {
392
+ border-top: solid 1px #ddd;
393
+ margin-right: 0;
394
+ padding-top: 20px;
395
+ padding-bottom: 20px;
396
+ padding-left: 30px;
397
+ padding-right: 30px;
398
+ }
399
+
400
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li:hover,
401
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li.active {
402
+ background-color: #e9e9e9;
403
+ }
404
+
405
+ .cs-admin .cs-tabs > ul > li > a {
406
+ margin-left: 5px;
407
+ }
408
+
409
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li:first-child {
410
+ border-left: solid 1px #ddd;
411
+ }
412
+
413
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li:last-child {
414
+ border-right: solid 1px #ddd;
415
+ }
416
+
417
+ .cs-admin .cs-tabs > ul > li:last-child {
418
+ border-right: none;
419
+ }
420
+
421
+ .cs-admin .cs-slide-tabs > ul > li,
422
+ .cs-admin .cs-slide-tabs > ul > li > a {
423
+ cursor: move;
424
+ }
425
+
426
+ .cs-admin .cs-slide-tabs > ul > li > a > .cs-slide-name-text {
427
+ cursor: pointer;
428
+ }
429
+
430
+ .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled,
431
+ .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled a {
432
+ cursor: pointer;
433
+ }
434
+
435
+ .cs-admin .cs-icon {
436
+ display: inline-block;
437
+ width: 13px;
438
+ height: 13px;
439
+ }
440
+
441
+ .cs-admin .cs-icon.icon-settings {
442
+ background-image: url('../images/settings.png');
443
+ }
444
+ .cs-admin .cs-icon.icon-edit {
445
+ background-image: url('../images/edit.png');
446
+ }
447
+
448
+ .cs-admin .cs-slide-build {
449
+ margin: 0 auto;
450
+ }
451
+
452
+ .cs-admin .cs-slides-list > .cs-slide,
453
+ .cs-admin .cs-void-slide {
454
+ display: none;
455
+ }
456
+
457
+ .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list form {
458
+ display: inline;
459
+ }
460
+
461
+ .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input {
462
+ display: none !important;
463
+ }
464
+
465
+ .cs-admin .wp-picker-holder {
466
+ position: absolute;
467
+ }
468
+
469
+ .cs-admin .cs-slide .cs-slide-editing-area {
470
+ position: relative;
471
+ background-color: #fff;
472
+ -moz-border-radius: 4px;
473
+ border-radius: 4px;
474
+ margin: 0 auto;
475
+ line-height: 1.5;
476
+ white-space: nowrap;
477
+
478
+ line-height: 1.5;
479
+ font-size: 14px;
480
+ color: #000;
481
+ font-family: 'Verdana', sans-serif;
482
+
483
+ /* Default slide background settings: */
484
+ background-repeat: no-repeat;
485
+ background-size: cover;
486
+ background-position: center center;
487
+ }
488
+
489
+ .cs-admin .cs-slide .cs-slide-editing-area a {
490
+ color: #0073aa;
491
+ }
492
+
493
+ .cs-admin .cs-slide .cs-slide-editing-area a:hover {
494
+ color: #0073aa;
495
+ }
496
+
497
+ .cs-admin .cs-slide .cs-slide-editing-area:before,
498
+ .cs-admin .cs-slide .cs-slide-editing-area:after{
499
+ z-index: -1;
500
+ position: absolute;
501
+ content: "";
502
+ bottom: 15px;
503
+ left: 10px;
504
+ width: 50%;
505
+ top: 80%;
506
+ max-width:300px;
507
+ background: rgba(0, 0, 0, 0.7);
508
+ -webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.4);
509
+ -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
510
+ box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
511
+ -webkit-transform: rotate(-3deg);
512
+ -moz-transform: rotate(-3deg);
513
+ -o-transform: rotate(-3deg);
514
+ -ms-transform: rotate(-3deg);
515
+ transform: rotate(-3deg);
516
+ }
517
+
518
+ .cs-admin .cs-slide .cs-slide-editing-area:after{
519
+ -webkit-transform: rotate(3deg);
520
+ -moz-transform: rotate(3deg);
521
+ -o-transform: rotate(3deg);
522
+ -ms-transform: rotate(3deg);
523
+ transform: rotate(3deg);
524
+ right: 10px;
525
+ left: auto;
526
+ }
527
+
528
+ .cs-admin .cs-slide .cs-elements .cs-elements-actions {
529
+ text-align: center;
530
+ z-index: 999;
531
+ position: relative;
532
+ }
533
+
534
+ .cs-admin .cs-slide .cs-elements .cs-void-element-settings {
535
+ display: none;
536
+ }
537
+
538
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-element {
539
+ position: absolute;
540
+ margin: 0;
541
+ padding: 0;
542
+ left: 0;
543
+ top: 0;
544
+ cursor: move;
545
+ font-size: 14px;
546
+ }
547
+
548
+ .crellyslider ul li * {
549
+ cursor: auto !important;
550
+ }
551
+
552
+ .cs-admin .cs-slide .cs-slide-live-preview-area > ul,
553
+ .cs-admin .cs-slide .cs-slide-live-preview-area > ul > li {
554
+ margin: 0;
555
+ padding: 0;
556
+ }
557
+
558
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element {
559
+ min-width: 560px;
560
+ min-height: 315px;
561
+ background-color: #000;
562
+ }
563
+
564
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element .cs-avoid-interaction {
565
+ width: 100%;
566
+ height: 100%;
567
+ position: absolute;
568
+ top: 0;
569
+ left: 0;
570
+ }
571
+
572
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-element.active {
573
+ -webkit-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
574
+ -moz-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
575
+ box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
576
+ }
577
+
578
+ .cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-switch-editor {
579
+ margin-bottom: 15px;
580
+ text-align: right;
581
+ }
582
+
583
+ .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
584
+ display: block !important;
585
+ }
586
+
587
+ .cs-admin .cs-label-input label {
588
+ display: inline-block;
589
+ width: 110px;
590
+ cursor: default;
591
+ }
wordpress/css/jquery.datetimepicker.css CHANGED
@@ -1,568 +1,568 @@
1
- .xdsoft_datetimepicker {
2
- box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
3
- background: #fff;
4
- border-bottom: 1px solid #bbb;
5
- border-left: 1px solid #ccc;
6
- border-right: 1px solid #ccc;
7
- border-top: 1px solid #ccc;
8
- color: #333;
9
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
10
- padding: 8px;
11
- padding-left: 0;
12
- padding-top: 2px;
13
- position: absolute;
14
- z-index: 9999;
15
- -moz-box-sizing: border-box;
16
- box-sizing: border-box;
17
- display: none;
18
- }
19
- .xdsoft_datetimepicker.xdsoft_rtl {
20
- padding: 8px 0 8px 8px;
21
- }
22
-
23
- .xdsoft_datetimepicker iframe {
24
- position: absolute;
25
- left: 0;
26
- top: 0;
27
- width: 75px;
28
- height: 210px;
29
- background: transparent;
30
- border: none;
31
- }
32
-
33
- /*For IE8 or lower*/
34
- .xdsoft_datetimepicker button {
35
- border: none !important;
36
- }
37
-
38
- .xdsoft_noselect {
39
- -webkit-touch-callout: none;
40
- -webkit-user-select: none;
41
- -khtml-user-select: none;
42
- -moz-user-select: none;
43
- -ms-user-select: none;
44
- -o-user-select: none;
45
- user-select: none;
46
- }
47
-
48
- .xdsoft_noselect::selection { background: transparent }
49
- .xdsoft_noselect::-moz-selection { background: transparent }
50
-
51
- .xdsoft_datetimepicker.xdsoft_inline {
52
- display: inline-block;
53
- position: static;
54
- box-shadow: none;
55
- }
56
-
57
- .xdsoft_datetimepicker * {
58
- -moz-box-sizing: border-box;
59
- box-sizing: border-box;
60
- padding: 0;
61
- margin: 0;
62
- }
63
-
64
- .xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker {
65
- display: none;
66
- }
67
-
68
- .xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active {
69
- display: block;
70
- }
71
-
72
- .xdsoft_datetimepicker .xdsoft_datepicker {
73
- width: 224px;
74
- float: left;
75
- margin-left: 8px;
76
- }
77
- .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_datepicker {
78
- float: right;
79
- margin-right: 8px;
80
- margin-left: 0;
81
- }
82
-
83
- .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker {
84
- width: 256px;
85
- }
86
-
87
- .xdsoft_datetimepicker .xdsoft_timepicker {
88
- width: 58px;
89
- float: left;
90
- text-align: center;
91
- margin-left: 8px;
92
- margin-top: 0;
93
- }
94
- .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker {
95
- float: right;
96
- margin-right: 8px;
97
- margin-left: 0;
98
- }
99
-
100
- .xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker {
101
- margin-top: 8px;
102
- margin-bottom: 3px
103
- }
104
-
105
- .xdsoft_datetimepicker .xdsoft_monthpicker {
106
- position: relative;
107
- text-align: center;
108
- }
109
-
110
- .xdsoft_datetimepicker .xdsoft_label i,
111
- .xdsoft_datetimepicker .xdsoft_prev,
112
- .xdsoft_datetimepicker .xdsoft_next,
113
- .xdsoft_datetimepicker .xdsoft_today_button {
114
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
115
- }
116
-
117
- .xdsoft_datetimepicker .xdsoft_label i {
118
- opacity: 0.5;
119
- background-position: -92px -19px;
120
- display: inline-block;
121
- width: 9px;
122
- height: 20px;
123
- vertical-align: middle;
124
- }
125
-
126
- .xdsoft_datetimepicker .xdsoft_prev {
127
- float: left;
128
- background-position: -20px 0;
129
- }
130
- .xdsoft_datetimepicker .xdsoft_today_button {
131
- float: left;
132
- background-position: -70px 0;
133
- margin-left: 5px;
134
- }
135
-
136
- .xdsoft_datetimepicker .xdsoft_next {
137
- float: right;
138
- background-position: 0 0;
139
- }
140
-
141
- .xdsoft_datetimepicker .xdsoft_next,
142
- .xdsoft_datetimepicker .xdsoft_prev ,
143
- .xdsoft_datetimepicker .xdsoft_today_button {
144
- background-color: transparent;
145
- background-repeat: no-repeat;
146
- border: 0 none;
147
- cursor: pointer;
148
- display: block;
149
- height: 30px;
150
- opacity: 0.5;
151
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
152
- outline: medium none;
153
- overflow: hidden;
154
- padding: 0;
155
- position: relative;
156
- text-indent: 100%;
157
- white-space: nowrap;
158
- width: 20px;
159
- min-width: 0;
160
- }
161
-
162
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
163
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next {
164
- float: none;
165
- background-position: -40px -15px;
166
- height: 15px;
167
- width: 30px;
168
- display: block;
169
- margin-left: 14px;
170
- margin-top: 7px;
171
- }
172
- .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_prev,
173
- .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_next {
174
- float: none;
175
- margin-left: 0;
176
- margin-right: 14px;
177
- }
178
-
179
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev {
180
- background-position: -40px 0;
181
- margin-bottom: 7px;
182
- margin-top: 0;
183
- }
184
-
185
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
186
- height: 151px;
187
- overflow: hidden;
188
- border-bottom: 1px solid #ddd;
189
- }
190
-
191
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div {
192
- background: #f5f5f5;
193
- border-top: 1px solid #ddd;
194
- color: #666;
195
- font-size: 12px;
196
- text-align: center;
197
- border-collapse: collapse;
198
- cursor: pointer;
199
- border-bottom-width: 0;
200
- height: 25px;
201
- line-height: 25px;
202
- }
203
-
204
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child {
205
- border-top-width: 0;
206
- }
207
-
208
- .xdsoft_datetimepicker .xdsoft_today_button:hover,
209
- .xdsoft_datetimepicker .xdsoft_next:hover,
210
- .xdsoft_datetimepicker .xdsoft_prev:hover {
211
- opacity: 1;
212
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
213
- }
214
-
215
- .xdsoft_datetimepicker .xdsoft_label {
216
- display: inline;
217
- position: relative;
218
- z-index: 9999;
219
- margin: 0;
220
- padding: 5px 3px;
221
- font-size: 14px;
222
- line-height: 20px;
223
- font-weight: bold;
224
- background-color: #fff;
225
- float: left;
226
- width: 182px;
227
- text-align: center;
228
- cursor: pointer;
229
- }
230
-
231
- .xdsoft_datetimepicker .xdsoft_label:hover>span {
232
- text-decoration: underline;
233
- }
234
-
235
- .xdsoft_datetimepicker .xdsoft_label:hover i {
236
- opacity: 1.0;
237
- }
238
-
239
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select {
240
- border: 1px solid #ccc;
241
- position: absolute;
242
- right: 0;
243
- top: 30px;
244
- z-index: 101;
245
- display: none;
246
- background: #fff;
247
- max-height: 160px;
248
- overflow-y: hidden;
249
- }
250
-
251
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px }
252
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px }
253
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
254
- color: #fff;
255
- background: #ff8000;
256
- }
257
-
258
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option {
259
- padding: 2px 10px 2px 5px;
260
- text-decoration: none !important;
261
- }
262
-
263
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
264
- background: #33aaff;
265
- box-shadow: #178fe5 0 1px 3px 0 inset;
266
- color: #fff;
267
- font-weight: 700;
268
- }
269
-
270
- .xdsoft_datetimepicker .xdsoft_month {
271
- width: 100px;
272
- text-align: right;
273
- }
274
-
275
- .xdsoft_datetimepicker .xdsoft_calendar {
276
- clear: both;
277
- }
278
-
279
- .xdsoft_datetimepicker .xdsoft_year{
280
- width: 48px;
281
- margin-left: 5px;
282
- }
283
-
284
- .xdsoft_datetimepicker .xdsoft_calendar table {
285
- border-collapse: collapse;
286
- width: 100%;
287
-
288
- }
289
-
290
- .xdsoft_datetimepicker .xdsoft_calendar td > div {
291
- padding-right: 5px;
292
- }
293
-
294
- .xdsoft_datetimepicker .xdsoft_calendar th {
295
- height: 25px;
296
- }
297
-
298
- .xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th {
299
- width: 14.2857142%;
300
- background: #f5f5f5;
301
- border: 1px solid #ddd;
302
- color: #666;
303
- font-size: 12px;
304
- text-align: right;
305
- vertical-align: middle;
306
- padding: 0;
307
- border-collapse: collapse;
308
- cursor: pointer;
309
- height: 25px;
310
- }
311
- .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th {
312
- width: 12.5%;
313
- }
314
-
315
- .xdsoft_datetimepicker .xdsoft_calendar th {
316
- background: #f1f1f1;
317
- }
318
-
319
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today {
320
- color: #33aaff;
321
- }
322
-
323
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default {
324
- background: #ffe9d2;
325
- box-shadow: #ffb871 0 1px 4px 0 inset;
326
- color: #000;
327
- }
328
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint {
329
- background: #c1ffc9;
330
- box-shadow: #00dd1c 0 1px 4px 0 inset;
331
- color: #000;
332
- }
333
-
334
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
335
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
336
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
337
- background: #33aaff;
338
- box-shadow: #178fe5 0 1px 3px 0 inset;
339
- color: #fff;
340
- font-weight: 700;
341
- }
342
-
343
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
344
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
345
- .xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled {
346
- opacity: 0.5;
347
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
348
- cursor: default;
349
- }
350
-
351
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled {
352
- opacity: 0.2;
353
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
354
- }
355
-
356
- .xdsoft_datetimepicker .xdsoft_calendar td:hover,
357
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
358
- color: #fff !important;
359
- background: #ff8000 !important;
360
- box-shadow: none !important;
361
- }
362
-
363
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover,
364
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover {
365
- background: #33aaff !important;
366
- box-shadow: #178fe5 0 1px 3px 0 inset !important;
367
- color: #fff !important;
368
- }
369
-
370
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
371
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover {
372
- color: inherit !important;
373
- background: inherit !important;
374
- box-shadow: inherit !important;
375
- }
376
-
377
- .xdsoft_datetimepicker .xdsoft_calendar th {
378
- font-weight: 700;
379
- text-align: center;
380
- color: #999;
381
- cursor: default;
382
- }
383
-
384
- .xdsoft_datetimepicker .xdsoft_copyright {
385
- color: #ccc !important;
386
- font-size: 10px;
387
- clear: both;
388
- float: none;
389
- margin-left: 8px;
390
- }
391
-
392
- .xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important }
393
- .xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important }
394
-
395
- .xdsoft_time_box {
396
- position: relative;
397
- border: 1px solid #ccc;
398
- }
399
- .xdsoft_scrollbar >.xdsoft_scroller {
400
- background: #ccc !important;
401
- height: 20px;
402
- border-radius: 3px;
403
- }
404
- .xdsoft_scrollbar {
405
- position: absolute;
406
- width: 7px;
407
- right: 0;
408
- top: 0;
409
- bottom: 0;
410
- cursor: pointer;
411
- }
412
- .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_scrollbar {
413
- left: 0;
414
- right: auto;
415
- }
416
- .xdsoft_scroller_box {
417
- position: relative;
418
- }
419
-
420
- .xdsoft_datetimepicker.xdsoft_dark {
421
- box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
422
- background: #000;
423
- border-bottom: 1px solid #444;
424
- border-left: 1px solid #333;
425
- border-right: 1px solid #333;
426
- border-top: 1px solid #333;
427
- color: #ccc;
428
- }
429
-
430
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box {
431
- border-bottom: 1px solid #222;
432
- }
433
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div {
434
- background: #0a0a0a;
435
- border-top: 1px solid #222;
436
- color: #999;
437
- }
438
-
439
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label {
440
- background-color: #000;
441
- }
442
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select {
443
- border: 1px solid #333;
444
- background: #000;
445
- }
446
-
447
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
448
- color: #000;
449
- background: #007fff;
450
- }
451
-
452
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
453
- background: #cc5500;
454
- box-shadow: #b03e00 0 1px 3px 0 inset;
455
- color: #000;
456
- }
457
-
458
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i,
459
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev,
460
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_next,
461
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button {
462
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==);
463
- }
464
-
465
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td,
466
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
467
- background: #0a0a0a;
468
- border: 1px solid #222;
469
- color: #999;
470
- }
471
-
472
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
473
- background: #0e0e0e;
474
- }
475
-
476
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today {
477
- color: #cc5500;
478
- }
479
-
480
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default {
481
- background: #ffe9d2;
482
- box-shadow: #ffb871 0 1px 4px 0 inset;
483
- color:#000;
484
- }
485
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint {
486
- background: #c1ffc9;
487
- box-shadow: #00dd1c 0 1px 4px 0 inset;
488
- color:#000;
489
- }
490
-
491
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default,
492
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
493
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
494
- background: #cc5500;
495
- box-shadow: #b03e00 0 1px 3px 0 inset;
496
- color: #000;
497
- }
498
-
499
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover,
500
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
501
- color: #000 !important;
502
- background: #007fff !important;
503
- }
504
-
505
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
506
- color: #666;
507
- }
508
-
509
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important }
510
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a { color: #111 !important }
511
- .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important }
512
-
513
- .xdsoft_dark .xdsoft_time_box {
514
- border: 1px solid #333;
515
- }
516
-
517
- .xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller {
518
- background: #333 !important;
519
- }
520
- .xdsoft_datetimepicker .xdsoft_save_selected {
521
- display: block;
522
- border: 1px solid #dddddd !important;
523
- margin-top: 5px;
524
- width: 100%;
525
- color: #454551;
526
- font-size: 13px;
527
- }
528
- .xdsoft_datetimepicker .blue-gradient-button {
529
- font-family: "museo-sans", "Book Antiqua", sans-serif;
530
- font-size: 12px;
531
- font-weight: 300;
532
- color: #82878c;
533
- height: 28px;
534
- position: relative;
535
- padding: 4px 17px 4px 33px;
536
- border: 1px solid #d7d8da;
537
- background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%);
538
- /* FF3.6+ */
539
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa));
540
- /* Chrome,Safari4+ */
541
- background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%);
542
- /* Chrome10+,Safari5.1+ */
543
- background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%);
544
- /* Opera 11.10+ */
545
- background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%);
546
- /* IE10+ */
547
- background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%);
548
- /* W3C */
549
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 );
550
- /* IE6-9 */
551
- }
552
- .xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span {
553
- color: #454551;
554
- background: -moz-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
555
- /* FF3.6+ */
556
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f8fa), color-stop(73%, #FFF));
557
- /* Chrome,Safari4+ */
558
- background: -webkit-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
559
- /* Chrome10+,Safari5.1+ */
560
- background: -o-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
561
- /* Opera 11.10+ */
562
- background: -ms-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
563
- /* IE10+ */
564
- background: linear-gradient(to bottom, #f4f8fa 0%, #FFF 73%);
565
- /* W3C */
566
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f8fa', endColorstr='#FFF',GradientType=0 );
567
- /* IE6-9 */
568
- }
1
+ .xdsoft_datetimepicker {
2
+ box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
3
+ background: #fff;
4
+ border-bottom: 1px solid #bbb;
5
+ border-left: 1px solid #ccc;
6
+ border-right: 1px solid #ccc;
7
+ border-top: 1px solid #ccc;
8
+ color: #333;
9
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
10
+ padding: 8px;
11
+ padding-left: 0;
12
+ padding-top: 2px;
13
+ position: absolute;
14
+ z-index: 9999;
15
+ -moz-box-sizing: border-box;
16
+ box-sizing: border-box;
17
+ display: none;
18
+ }
19
+ .xdsoft_datetimepicker.xdsoft_rtl {
20
+ padding: 8px 0 8px 8px;
21
+ }
22
+
23
+ .xdsoft_datetimepicker iframe {
24
+ position: absolute;
25
+ left: 0;
26
+ top: 0;
27
+ width: 75px;
28
+ height: 210px;
29
+ background: transparent;
30
+ border: none;
31
+ }
32
+
33
+ /*For IE8 or lower*/
34
+ .xdsoft_datetimepicker button {
35
+ border: none !important;
36
+ }
37
+
38
+ .xdsoft_noselect {
39
+ -webkit-touch-callout: none;
40
+ -webkit-user-select: none;
41
+ -khtml-user-select: none;
42
+ -moz-user-select: none;
43
+ -ms-user-select: none;
44
+ -o-user-select: none;
45
+ user-select: none;
46
+ }
47
+
48
+ .xdsoft_noselect::selection { background: transparent }
49
+ .xdsoft_noselect::-moz-selection { background: transparent }
50
+
51
+ .xdsoft_datetimepicker.xdsoft_inline {
52
+ display: inline-block;
53
+ position: static;
54
+ box-shadow: none;
55
+ }
56
+
57
+ .xdsoft_datetimepicker * {
58
+ -moz-box-sizing: border-box;
59
+ box-sizing: border-box;
60
+ padding: 0;
61
+ margin: 0;
62
+ }
63
+
64
+ .xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker {
65
+ display: none;
66
+ }
67
+
68
+ .xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active {
69
+ display: block;
70
+ }
71
+
72
+ .xdsoft_datetimepicker .xdsoft_datepicker {
73
+ width: 224px;
74
+ float: left;
75
+ margin-left: 8px;
76
+ }
77
+ .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_datepicker {
78
+ float: right;
79
+ margin-right: 8px;
80
+ margin-left: 0;
81
+ }
82
+
83
+ .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker {
84
+ width: 256px;
85
+ }
86
+
87
+ .xdsoft_datetimepicker .xdsoft_timepicker {
88
+ width: 58px;
89
+ float: left;
90
+ text-align: center;
91
+ margin-left: 8px;
92
+ margin-top: 0;
93
+ }
94
+ .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker {
95
+ float: right;
96
+ margin-right: 8px;
97
+ margin-left: 0;
98
+ }
99
+
100
+ .xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker {
101
+ margin-top: 8px;
102
+ margin-bottom: 3px
103
+ }
104
+
105
+ .xdsoft_datetimepicker .xdsoft_monthpicker {
106
+ position: relative;
107
+ text-align: center;
108
+ }
109
+
110
+ .xdsoft_datetimepicker .xdsoft_label i,
111
+ .xdsoft_datetimepicker .xdsoft_prev,
112
+ .xdsoft_datetimepicker .xdsoft_next,
113
+ .xdsoft_datetimepicker .xdsoft_today_button {
114
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
115
+ }
116
+
117
+ .xdsoft_datetimepicker .xdsoft_label i {
118
+ opacity: 0.5;
119
+ background-position: -92px -19px;
120
+ display: inline-block;
121
+ width: 9px;
122
+ height: 20px;
123
+ vertical-align: middle;
124
+ }
125
+
126
+ .xdsoft_datetimepicker .xdsoft_prev {
127
+ float: left;
128
+ background-position: -20px 0;
129
+ }
130
+ .xdsoft_datetimepicker .xdsoft_today_button {
131
+ float: left;
132
+ background-position: -70px 0;
133
+ margin-left: 5px;
134
+ }
135
+
136
+ .xdsoft_datetimepicker .xdsoft_next {
137
+ float: right;
138
+ background-position: 0 0;
139
+ }
140
+
141
+ .xdsoft_datetimepicker .xdsoft_next,
142
+ .xdsoft_datetimepicker .xdsoft_prev ,
143
+ .xdsoft_datetimepicker .xdsoft_today_button {
144
+ background-color: transparent;
145
+ background-repeat: no-repeat;
146
+ border: 0 none;
147
+ cursor: pointer;
148
+ display: block;
149
+ height: 30px;
150
+ opacity: 0.5;
151
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
152
+ outline: medium none;
153
+ overflow: hidden;
154
+ padding: 0;
155
+ position: relative;
156
+ text-indent: 100%;
157
+ white-space: nowrap;
158
+ width: 20px;
159
+ min-width: 0;
160
+ }
161
+
162
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
163
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next {
164
+ float: none;
165
+ background-position: -40px -15px;
166
+ height: 15px;
167
+ width: 30px;
168
+ display: block;
169
+ margin-left: 14px;
170
+ margin-top: 7px;
171
+ }
172
+ .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_prev,
173
+ .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_next {
174
+ float: none;
175
+ margin-left: 0;
176
+ margin-right: 14px;
177
+ }
178
+
179
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev {
180
+ background-position: -40px 0;
181
+ margin-bottom: 7px;
182
+ margin-top: 0;
183
+ }
184
+
185
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
186
+ height: 151px;
187
+ overflow: hidden;
188
+ border-bottom: 1px solid #ddd;
189
+ }
190
+
191
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div {
192
+ background: #f5f5f5;
193
+ border-top: 1px solid #ddd;
194
+ color: #666;
195
+ font-size: 12px;
196
+ text-align: center;
197
+ border-collapse: collapse;
198
+ cursor: pointer;
199
+ border-bottom-width: 0;
200
+ height: 25px;
201
+ line-height: 25px;
202
+ }
203
+
204
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child {
205
+ border-top-width: 0;
206
+ }
207
+
208
+ .xdsoft_datetimepicker .xdsoft_today_button:hover,
209
+ .xdsoft_datetimepicker .xdsoft_next:hover,
210
+ .xdsoft_datetimepicker .xdsoft_prev:hover {
211
+ opacity: 1;
212
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
213
+ }
214
+
215
+ .xdsoft_datetimepicker .xdsoft_label {
216
+ display: inline;
217
+ position: relative;
218
+ z-index: 9999;
219
+ margin: 0;
220
+ padding: 5px 3px;
221
+ font-size: 14px;
222
+ line-height: 20px;
223
+ font-weight: bold;
224
+ background-color: #fff;
225
+ float: left;
226
+ width: 182px;
227
+ text-align: center;
228
+ cursor: pointer;
229
+ }
230
+
231
+ .xdsoft_datetimepicker .xdsoft_label:hover>span {
232
+ text-decoration: underline;
233
+ }
234
+
235
+ .xdsoft_datetimepicker .xdsoft_label:hover i {
236
+ opacity: 1.0;
237
+ }
238
+
239
+ .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select {
240
+ border: 1px solid #ccc;
241
+ position: absolute;
242
+ right: 0;
243
+ top: 30px;
244
+ z-index: 101;
245
+ display: none;
246
+ background: #fff;
247
+ max-height: 160px;
248
+ overflow-y: hidden;
249
+ }
250
+
251
+ .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px }
252
+ .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px }
253
+ .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
254
+ color: #fff;
255
+ background: #ff8000;
256
+ }
257
+
258
+ .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option {
259
+ padding: 2px 10px 2px 5px;
260
+ text-decoration: none !important;
261
+ }
262
+
263
+ .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
264
+ background: #33aaff;
265
+ box-shadow: #178fe5 0 1px 3px 0 inset;
266
+ color: #fff;
267
+ font-weight: 700;
268
+ }
269
+
270
+ .xdsoft_datetimepicker .xdsoft_month {
271
+ width: 100px;
272
+ text-align: right;
273
+ }
274
+
275
+ .xdsoft_datetimepicker .xdsoft_calendar {
276
+ clear: both;
277
+ }
278
+
279
+ .xdsoft_datetimepicker .xdsoft_year{
280
+ width: 48px;
281
+ margin-left: 5px;
282
+ }
283
+
284
+ .xdsoft_datetimepicker .xdsoft_calendar table {
285
+ border-collapse: collapse;
286
+ width: 100%;
287
+
288
+ }
289
+
290
+ .xdsoft_datetimepicker .xdsoft_calendar td > div {
291
+ padding-right: 5px;
292
+ }
293
+
294
+ .xdsoft_datetimepicker .xdsoft_calendar th {
295
+ height: 25px;
296
+ }
297
+
298
+ .xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th {
299
+ width: 14.2857142%;
300
+ background: #f5f5f5;
301
+ border: 1px solid #ddd;
302
+ color: #666;
303
+ font-size: 12px;
304
+ text-align: right;
305
+ vertical-align: middle;
306
+ padding: 0;
307
+ border-collapse: collapse;
308
+ cursor: pointer;
309
+ height: 25px;
310
+ }
311
+ .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th {
312
+ width: 12.5%;
313
+ }
314
+
315
+ .xdsoft_datetimepicker .xdsoft_calendar th {
316
+ background: #f1f1f1;
317
+ }
318
+
319
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today {
320
+ color: #33aaff;
321
+ }
322
+
323
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default {
324
+ background: #ffe9d2;
325
+ box-shadow: #ffb871 0 1px 4px 0 inset;
326
+ color: #000;
327
+ }
328
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint {
329
+ background: #c1ffc9;
330
+ box-shadow: #00dd1c 0 1px 4px 0 inset;
331
+ color: #000;
332
+ }
333
+
334
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
335
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
336
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
337
+ background: #33aaff;
338
+ box-shadow: #178fe5 0 1px 3px 0 inset;
339
+ color: #fff;
340
+ font-weight: 700;
341
+ }
342
+
343
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
344
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
345
+ .xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled {
346
+ opacity: 0.5;
347
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
348
+ cursor: default;
349
+ }
350
+
351
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled {
352
+ opacity: 0.2;
353
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
354
+ }
355
+
356
+ .xdsoft_datetimepicker .xdsoft_calendar td:hover,
357
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
358
+ color: #fff !important;
359
+ background: #ff8000 !important;
360
+ box-shadow: none !important;
361
+ }
362
+
363
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover,
364
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover {
365
+ background: #33aaff !important;
366
+ box-shadow: #178fe5 0 1px 3px 0 inset !important;
367
+ color: #fff !important;
368
+ }
369
+
370
+ .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
371
+ .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover {
372
+ color: inherit !important;
373
+ background: inherit !important;
374
+ box-shadow: inherit !important;
375
+ }
376
+
377
+ .xdsoft_datetimepicker .xdsoft_calendar th {
378
+ font-weight: 700;
379
+ text-align: center;
380
+ color: #999;
381
+ cursor: default;
382
+ }
383
+
384
+ .xdsoft_datetimepicker .xdsoft_copyright {
385
+ color: #ccc !important;
386
+ font-size: 10px;
387
+ clear: both;
388
+ float: none;
389
+ margin-left: 8px;
390
+ }
391
+
392
+ .xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important }
393
+ .xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important }
394
+
395
+ .xdsoft_time_box {
396
+ position: relative;
397
+ border: 1px solid #ccc;
398
+ }
399
+ .xdsoft_scrollbar >.xdsoft_scroller {
400
+ background: #ccc !important;
401
+ height: 20px;
402
+ border-radius: 3px;
403
+ }
404
+ .xdsoft_scrollbar {
405
+ position: absolute;
406
+ width: 7px;
407
+ right: 0;
408
+ top: 0;
409
+ bottom: 0;
410
+ cursor: pointer;
411
+ }
412
+ .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_scrollbar {
413
+ left: 0;
414
+ right: auto;
415
+ }
416
+ .xdsoft_scroller_box {
417
+ position: relative;
418
+ }
419
+
420
+ .xdsoft_datetimepicker.xdsoft_dark {
421
+ box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
422
+ background: #000;
423
+ border-bottom: 1px solid #444;
424
+ border-left: 1px solid #333;
425
+ border-right: 1px solid #333;
426
+ border-top: 1px solid #333;
427
+ color: #ccc;
428
+ }
429
+
430
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box {
431
+ border-bottom: 1px solid #222;
432
+ }
433
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div {
434
+ background: #0a0a0a;
435
+ border-top: 1px solid #222;
436
+ color: #999;
437
+ }
438
+
439
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label {
440
+ background-color: #000;
441
+ }
442
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select {
443
+ border: 1px solid #333;
444
+ background: #000;
445
+ }
446
+
447
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
448
+ color: #000;
449
+ background: #007fff;
450
+ }
451
+
452
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
453
+ background: #cc5500;
454
+ box-shadow: #b03e00 0 1px 3px 0 inset;
455
+ color: #000;
456
+ }
457
+
458
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i,
459
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev,
460
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_next,
461
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button {
462
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==);
463
+ }
464
+
465
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td,
466
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
467
+ background: #0a0a0a;
468
+ border: 1px solid #222;
469
+ color: #999;
470
+ }
471
+
472
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
473
+ background: #0e0e0e;
474
+ }
475
+
476
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today {
477
+ color: #cc5500;
478
+ }
479
+
480
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default {
481
+ background: #ffe9d2;
482
+ box-shadow: #ffb871 0 1px 4px 0 inset;
483
+ color:#000;
484
+ }
485
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint {
486
+ background: #c1ffc9;
487
+ box-shadow: #00dd1c 0 1px 4px 0 inset;
488
+ color:#000;
489
+ }
490
+
491
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default,
492
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
493
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
494
+ background: #cc5500;
495
+ box-shadow: #b03e00 0 1px 3px 0 inset;
496
+ color: #000;
497
+ }
498
+
499
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover,
500
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
501
+ color: #000 !important;
502
+ background: #007fff !important;
503
+ }
504
+
505
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
506
+ color: #666;
507
+ }
508
+
509
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important }
510
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a { color: #111 !important }
511
+ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important }
512
+
513
+ .xdsoft_dark .xdsoft_time_box {
514
+ border: 1px solid #333;
515
+ }
516
+
517
+ .xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller {
518
+ background: #333 !important;
519
+ }
520
+ .xdsoft_datetimepicker .xdsoft_save_selected {
521
+ display: block;
522
+ border: 1px solid #dddddd !important;
523
+ margin-top: 5px;
524
+ width: 100%;
525
+ color: #454551;
526
+ font-size: 13px;
527
+ }
528
+ .xdsoft_datetimepicker .blue-gradient-button {
529
+ font-family: "museo-sans", "Book Antiqua", sans-serif;
530
+ font-size: 12px;
531
+ font-weight: 300;
532
+ color: #82878c;
533
+ height: 28px;
534
+ position: relative;
535
+ padding: 4px 17px 4px 33px;
536
+ border: 1px solid #d7d8da;
537
+ background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%);
538
+ /* FF3.6+ */
539
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa));
540
+ /* Chrome,Safari4+ */
541
+ background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%);
542
+ /* Chrome10+,Safari5.1+ */
543
+ background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%);
544
+ /* Opera 11.10+ */
545
+ background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%);
546
+ /* IE10+ */
547
+ background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%);
548
+ /* W3C */
549
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 );
550
+ /* IE6-9 */
551
+ }
552
+ .xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span {
553
+ color: #454551;
554
+ background: -moz-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
555
+ /* FF3.6+ */
556
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f8fa), color-stop(73%, #FFF));
557
+ /* Chrome,Safari4+ */
558
+ background: -webkit-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
559
+ /* Chrome10+,Safari5.1+ */
560
+ background: -o-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
561
+ /* Opera 11.10+ */
562
+ background: -ms-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
563
+ /* IE10+ */
564
+ background: linear-gradient(to bottom, #f4f8fa 0%, #FFF 73%);
565
+ /* W3C */
566
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f8fa', endColorstr='#FFF',GradientType=0 );
567
+ /* IE6-9 */
568
+ }
wordpress/elements.php CHANGED
@@ -1,1024 +1,1024 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- function crellyslider_printElements($edit, $slider, $slide, $elements) {
5
- ?>
6
- <div class="cs-elements">
7
-
8
- <div
9
- class="cs-slide-editing-area"
10
- <?php if($edit && $slide): ?>
11
- <?php
12
- if($slide->background_type_image != 'none') {
13
- echo 'data-background-image-src="' . stripslashes($slide->background_type_image) . '"';
14
- }
15
-
16
- $background_url = CrellySliderCommon::getURL(stripslashes($slide->background_type_image));
17
-
18
- ?>
19
- style="
20
- width: <?php echo esc_attr($slider->startWidth); ?>px;
21
- height: <?php echo esc_attr($slider->startHeight); ?>px;
22
- background-image: url('<?php echo $background_url; ?>');
23
- background-color: <?php echo esc_attr($slide->background_type_color) == 'transparent' ? 'rgb(255, 255, 255)' : esc_attr($slide->background_type_color); ?>;
24
- background-position: <?php echo esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y); ?>;
25
- background-repeat: <?php echo esc_attr($slide->background_repeat); ?>;
26
- background-size: <?php echo esc_attr($slide->background_propriety_size); ?>;
27
- <?php echo stripslashes($slide->custom_css); ?>
28
- "
29
- <?php endif; ?>
30
- >
31
- <?php
32
- if($edit && $elements != NULL) {
33
- foreach($elements as $element) {
34
- if($element->link != '') {
35
- $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
36
-
37
- $link_output = '<a' . "\n" .
38
- 'class="cs-element cs-' . esc_attr($element->type) . '-element"' . "\n" .
39
- 'href="' . stripslashes($element->link) . '"' . "\n" .
40
- $target . "\n" .
41
- 'style="' .
42
- 'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
43
- 'top: ' . esc_attr($element->data_top) . 'px;' . "\n" .
44
- 'left: ' . esc_attr($element->data_left) . 'px;' . "\n" .
45
- '">' . "\n";
46
-
47
- echo $link_output;
48
- }
49
-
50
- switch($element->type) {
51
- case 'text':
52
- ?>
53
- <div
54
- style="
55
- <?php
56
- if($element->link == '') {
57
- echo 'z-index: ' . esc_attr($element->z_index) . ';';
58
- echo 'left: ' . esc_attr($element->data_left) . 'px;';
59
- echo 'top: ' . esc_attr($element->data_top) . 'px;';
60
- }
61
- echo stripslashes($element->custom_css);
62
- ?>
63
- "
64
- <?php
65
- if($element->link == '') {
66
- echo 'class="cs-element cs-text-element ' . stripslashes($element->custom_css_classes) . '"';
67
- }
68
- else {
69
- echo 'class="' . stripslashes($element->custom_css_classes) . '"';
70
- }
71
- ?>
72
- >
73
- <?php echo stripslashes($element->inner_html); ?>
74
- </div>
75
- <?php
76
- break;
77
-
78
- case 'image':
79
- ?>
80
- <img
81
- src="<?php echo CrellySliderCommon::getURL(stripslashes($element->image_src)); ?>"
82
- alt="<?php echo esc_attr($element->image_alt); ?>"
83
- style="
84
- <?php
85
- if($element->link == '') {
86
- echo 'z-index: ' . esc_attr($element->z_index) . ';';
87
- echo 'left: ' . esc_attr($element->data_left) . 'px;';
88
- echo 'top: ' . esc_attr($element->data_top) . 'px;';
89
- }
90
- echo stripslashes($element->custom_css);
91
- ?>
92
- "
93
- <?php
94
- if($element->link == '') {
95
- echo 'class="cs-element cs-image-element ' . stripslashes($element->custom_css_classes) . '"';
96
- }
97
- else {
98
- echo 'class="' . stripslashes($element->custom_css_classes) . '"';
99
- }
100
- ?>
101
- />
102
- <?php
103
- break;
104
-
105
- case 'youtube_video':
106
- ?>
107
- <div
108
- class="cs-element cs-video-element"
109
- style="
110
- <?php
111
- if($element->link == '') {
112
- echo 'z-index: ' . esc_attr($element->z_index) . ';';
113
- echo 'left: ' . esc_attr($element->data_left) . 'px;';
114
- echo 'top: ' . esc_attr($element->data_top) . 'px;';
115
- }
116
- ?>
117
- "
118
- >
119
- <div class="cs-avoid-interaction"></div>
120
- <iframe allow="autoplay" style="<?php echo stripslashes($element->custom_css); ?>" class="cs-yt-iframe <?php echo stripslashes($element->custom_css_classes); ?>" type="text/html" width="560" height="315" src="<?php echo esc_url('http://www.youtube.com/embed/' . $element->video_id); ?>?enablejsapi=1" frameborder="0"></iframe>
121
- </div>
122
- <?php
123
- break;
124
-
125
- case 'vimeo_video':
126
- ?>
127
- <div
128
- class="cs-element cs-video-element"
129
- style="
130
- <?php
131
- if($element->link == '') {
132
- echo 'z-index: ' . esc_attr($element->z_index) . ';';
133
- echo 'left: ' . esc_attr($element->data_left) . 'px;';
134
- echo 'top: ' . esc_attr($element->data_top) . 'px;';
135
- }
136
- ?>
137
- "
138
- >
139
- <div class="cs-avoid-interaction"></div>
140
- <iframe allow="autoplay" style="<?php echo stripslashes($element->custom_css); ?>" class="cs-vimeo-iframe <?php echo stripslashes($element->custom_css_classes); ?>" src="<?php echo esc_url('https://player.vimeo.com/video/' . $element->video_id); ?>?api=1" width="560" height="315" frameborder="0" ></iframe>
141
- </div>
142
- <?php
143
- break;
144
- }
145
-
146
- if($element->link != '') {
147
- echo '</a>' . "\n";
148
- }
149
- }
150
- }
151
- ?>
152
- </div>
153
-
154
- <br />
155
- <br />
156
-
157
- <div class="cs-elements-actions">
158
- <div style="float: left;">
159
- <a class="cs-add-text-element cs-button cs-is-warning"><?php _e('Add text', 'crelly-slider'); ?></a>
160
- <a class="cs-add-image-element cs-button cs-is-warning"><?php _e('Add image', 'crelly-slider'); ?></a>
161
- <a class="cs-add-video-element cs-button cs-is-warning"><?php _e('Add video', 'crelly-slider'); ?></a>
162
- </div>
163
- <div style="float: right;">
164
- <a class="cs-live-preview cs-button cs-is-success"><?php _e('Live preview', 'crelly-slider'); ?></a>
165
- <a class="cs-delete-element cs-button cs-is-danger cs-is-disabled"><?php _e('Delete element', 'crelly-slider'); ?></a>
166
- <a class="cs-duplicate-element cs-button cs-is-primary cs-is-disabled"><?php _e('Duplicate element', 'crelly-slider'); ?></a>
167
- </div>
168
- <div style="clear: both;"></div>
169
- </div>
170
-
171
- <br />
172
- <br />
173
-
174
- <div class="cs-elements-list">
175
- <?php
176
- if($edit && $elements != NULL) {
177
- foreach($elements as $element) {
178
- switch($element->type) {
179
- case 'text':
180
- echo '<div class="cs-element-settings cs-text-element-settings" style="display: none;">';
181
- crellyslider_printTextElement($element);
182
- echo '</div>';
183
- break;
184
-
185
- case 'image':
186
- echo '<div class="cs-element-settings cs-image-element-settings" style="display: none;">';
187
- crellyslider_printImageElement($element);
188
- echo '</div>';
189
- break;
190
-
191
- case 'youtube_video':
192
- case 'vimeo_video':
193
- echo '<div class="cs-element-settings cs-video-element-settings" style="display: none;">';
194
- crellyslider_printVideoElement($element);
195
- echo '</div>';
196
- break;
197
- }
198
- }
199
- }
200
- echo '<div class="cs-void-element-settings cs-void-text-element-settings cs-element-settings cs-text-element-settings">';
201
- crellyslider_printTextElement(false);
202
- echo '</div>';
203
- echo '<div class="cs-void-element-settings cs-void-image-element-settings cs-element-settings cs-image-element-settings">';
204
- crellyslider_printImageElement(false);
205
- echo '</div>';
206
- echo '<div class="cs-void-element-settings cs-void-video-element-settings cs-element-settings cs-video-element-settings">';
207
- crellyslider_printVideoElement(false);
208
- echo '</div>';
209
- ?>
210
- </div>
211
-
212
- </div>
213
- <?php
214
- }
215
-
216
- function crellyslider_printTextElement($element) {
217
- $void = !$element ? true : false;
218
-
219
- $animations = array(
220
- 'none' => array(__('None', 'crelly-slider'), false),
221
- 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
222
- 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
223
- 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
224
- 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
225
- 'fade' => array(__('Fade', 'crelly-slider'), true),
226
- 'fadeDown' => array(__('Fade down', 'crelly-slider'), false),
227
- 'fadeUp' => array(__('Fade up', 'crelly-slider'), false),
228
- 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
229
- 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
230
- 'fadeSmallDown' => array(__('Fade small down', 'crelly-slider'), false),
231
- 'fadeSmallUp' => array(__('Fade small up', 'crelly-slider'), false),
232
- 'fadeSmallLeft' => array(__('Fade small left', 'crelly-slider'), false),
233
- 'fadeSmallRight' => array(__('Fade small right', 'crelly-slider'), false),
234
- );
235
-
236
- ?>
237
- <table class="cs-element-settings-list cs-text-element-settings-list cs-table">
238
- <thead>
239
- <tr class="odd-row">
240
- <th colspan="3"><?php _e('Element Options', 'crelly-slider'); ?></th>
241
- </tr>
242
- </thead>
243
-
244
- <tbody>
245
- <tr class="cs-table-header">
246
- <td><?php _e('Option', 'crelly-slider'); ?></td>
247
- <td><?php _e('Parameter', 'crelly-slider'); ?></td>
248
- <td><?php _e('Description', 'crelly-slider'); ?></td>
249
- </tr>
250
- <tr>
251
- <td class="cs-name"><?php _e('Text', 'crelly-slider'); ?></td>
252
- <td class="cs-content">
253
- <?php
254
- if($void) echo '<textarea class="cs-element-inner_html">' . __('Text element', 'crelly-slider') . '</textarea>';
255
- else echo '<textarea class="cs-element-inner_html">' . esc_textarea(stripslashes($element->inner_html)) . '</textarea>';
256
- ?>
257
- </td>
258
- <td class="cs-description">
259
- <?php _e('Write the text or the HTML.', 'crelly-slider'); ?>
260
- </td>
261
- </tr>
262
- <tr>
263
- <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
264
- <td class="cs-content">
265
- <?php
266
- if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
267
- else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
268
- ?>
269
- px
270
- <br />
271
- <br />
272
- <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
273
- </td>
274
- <td class="cs-description">
275
- <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
276
- </td>
277
- </tr>
278
- <tr>
279
- <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
280
- <td class="cs-content">
281
- <?php
282
- if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
283
- else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
284
- ?>
285
- px
286
- <br />
287
- <br />
288
- <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
289
- </td>
290
- <td class="cs-description">
291
- <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
292
- </td>
293
- </tr>
294
- <tr>
295
- <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
296
- <td class="cs-content">
297
- <?php
298
- if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
299
- else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
300
- ?>
301
- </td>
302
- <td class="cs-description">
303
- <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
304
- </td>
305
- </tr>
306
- <tr>
307
- <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
308
- <td class="cs-content">
309
- <?php
310
- if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
311
- else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
312
- ?>
313
- ms
314
- </td>
315
- <td class="cs-description">
316
- <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
317
- </td>
318
- </tr>
319
- <tr>
320
- <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
321
- <td class="cs-content">
322
- <?php
323
- if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
324
- else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
325
- ?>
326
- ms
327
- </td>
328
- <td class="cs-description">
329
- <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
330
- <br />
331
- <br />
332
- <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
333
- <br />
334
- <br />
335
- <?php _e('Write "3000" to set 3000 milliseconds minus delay time (so, if the delay time is 1000 milliseconds, the element will be displayed for 3000-1000=2000 milliseconds).', 'crelly-slider'); ?>
336
- </td>
337
- </tr>
338
- <tr>
339
- <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
340
- <td class="cs-content">
341
- <select class="cs-element-data_in">
342
- <?php
343
- foreach($animations as $key => $value) {
344
- echo '<option value="' . $key . '"';
345
- if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
346
- echo ' selected';
347
- }
348
- echo '>' . $value[0] . '</option>';
349
- }
350
- ?>
351
- </select>
352
- </td>
353
- <td class="cs-description">
354
- <?php _e('The in animation of the element.', 'crelly-slider'); ?>
355
- </td>
356
- </tr>
357
- <tr>
358
- <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
359
- <td class="cs-content">
360
- <select class="cs-element-data_out">
361
- <?php
362
- foreach($animations as $key => $value) {
363
- echo '<option value="' . $key . '"';
364
- if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
365
- echo ' selected';
366
- }
367
- echo '>' . $value[0] . '</option>';
368
- }
369
- ?>
370
- </select>
371
- <br />
372
- <?php
373
- if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
374
- else {
375
- if($element->data_ignoreEaseOut) {
376
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
377
- }
378
- else {
379
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
380
- }
381
- }
382
- ?>
383
- </td>
384
- <td class="cs-description">
385
- <?php _e('The out animation of the element.<br /><br />Disable synchronization with slide out animation: if not checked, the slide out animation won\'t start until all the elements that have this option unchecked are animated out.', 'crelly-slider'); ?>
386
- </td>
387
- </tr>
388
- <tr>
389
- <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
390
- <td class="cs-content">
391
- <?php
392
- if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
393
- else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
394
- ?>
395
- ms
396
- </td>
397
- <td class="cs-description">
398
- <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
399
- </td>
400
- </tr>
401
- <tr>
402
- <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
403
- <td class="cs-content">
404
- <?php
405
- if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
406
- else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
407
- ?>
408
- ms
409
- </td>
410
- <td class="cs-description">
411
- <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
412
- </td>
413
- </tr>
414
- <tr>
415
- <td class="cs-name"><?php _e('Link', 'crelly-slider'); ?></td>
416
- <td class="cs-content">
417
- <?php
418
- if($void) echo '<input class="cs-element-link" type="text" value="" />';
419
- else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
420
- ?>
421
- <br />
422
- <?php
423
- if($void) echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
424
- else {
425
- if($element->link_new_tab) {
426
- echo '<input class="cs-element-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crelly-slider');
427
- }
428
- else {
429
- echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
430
- }
431
- }
432
- ?>
433
- </td>
434
- <td class="cs-description">
435
- <?php _e('Open the link (e.g.: http://www.google.it) on click. Leave it empty if you don\'t want it.', 'crelly-slider'); ?>
436
- </td>
437
- </tr>
438
- <tr>
439
- <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
440
- <td class="cs-content">
441
- <?php
442
- if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
443
- else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
444
- ?>
445
- </td>
446
- <td class="cs-description">
447
- <?php _e('Style the element.', 'crelly-slider'); ?>
448
- </td>
449
- </tr>
450
- <tr>
451
- <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
452
- <td class="cs-content">
453
- <?php
454
- if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
455
- else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
456
- ?>
457
- </td>
458
- <td class="cs-description">
459
- <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
460
- </td>
461
- </tr>
462
- </tbody>
463
- </table>
464
- <?php
465
- }
466
-
467
- function crellyslider_printImageElement($element) {
468
- $void = !$element ? true : false;
469
-
470
- $animations = array(
471
- 'none' => array(__('None', 'crelly-slider'), false),
472
- 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
473
- 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
474
- 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
475
- 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
476
- 'fade' => array(__('Fade', 'crelly-slider'), true),
477
- 'fadeDown' => array(__('Fade down', 'crelly-slider'), false),
478
- 'fadeUp' => array(__('Fade up', 'crelly-slider'), false),
479
- 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
480
- 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
481
- 'fadeSmallDown' => array(__('Fade small down', 'crelly-slider'), false),
482
- 'fadeSmallUp' => array(__('Fade small up', 'crelly-slider'), false),
483
- 'fadeSmallLeft' => array(__('Fade small left', 'crelly-slider'), false),
484
- 'fadeSmallRight' => array(__('Fade small right', 'crelly-slider'), false),
485
- );
486
-
487
- ?>
488
- <table class="cs-element-settings-list cs-image-element-settings-list cs-table">
489
- <thead>
490
- <tr class="odd-row">
491
- <th colspan="3"><?php _e('Element Options', 'crelly-slider'); ?></th>
492
- </tr>
493
- </thead>
494
- <tbody>
495
- <tr class="cs-table-header">
496
- <td><?php _e('Option', 'crelly-slider'); ?></td>
497
- <td><?php _e('Parameter', 'crelly-slider'); ?></td>
498
- <td><?php _e('Description', 'crelly-slider'); ?></td>
499
- </tr>
500
- <tr>
501
- <td class="cs-name"><?php _e('Modify image', 'crelly-slider'); ?></td>
502
- <td class="cs-content">
503
- <?php
504
- if($void) echo '<input class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
505
- else echo '<input data-src="' . stripslashes($element->image_src) . '" data-alt="' . esc_attr($element->image_alt) . '" class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
506
- ?>
507
- </td>
508
- <td class="cs-description">
509
- <?php _e('Change the image source or the alt text.', 'crelly-slider'); ?>
510
- </td>
511
- </tr>
512
- <tr>
513
- <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
514
- <td class="cs-content">
515
- <?php
516
- if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
517
- else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
518
- ?>
519
- px
520
- <br />
521
- <br />
522
- <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
523
- </td>
524
- <td class="cs-description">
525
- <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
526
- </td>
527
- </tr>
528
- <tr>
529
- <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
530
- <td class="cs-content">
531
- <?php
532
- if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
533
- else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
534
- ?>
535
- px
536
- <br />
537
- <br />
538
- <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
539
- </td>
540
- <td class="cs-description">
541
- <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
542
- </td>
543
- </tr>
544
- <tr>
545
- <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
546
- <td class="cs-content">
547
- <?php
548
- if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
549
- else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
550
- ?>
551
- </td>
552
- <td class="cs-description">
553
- <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
554
- </td>
555
- </tr>
556
- <tr>
557
- <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
558
- <td class="cs-content">
559
- <?php
560
- if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
561
- else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
562
- ?>
563
- ms
564
- </td>
565
- <td class="cs-description">
566
- <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
567
- </td>
568
- </tr>
569
- <tr>
570
- <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
571
- <td class="cs-content">
572
- <?php
573
- if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
574
- else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
575
- ?>
576
- ms
577
- </td>
578
- <td class="cs-description">
579
- <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
580
- <br />
581
- <br />
582
- <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
583
- <br />
584
- <br />
585
- <?php _e('Write "3000" to set 3000 milliseconds minus delay time (so, if the delay time is 1000 milliseconds, the element will be displayed for 3000-1000=2000 milliseconds).', 'crelly-slider'); ?>
586
- </td>
587
- </tr>
588
- <tr>
589
- <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
590
- <td class="cs-content">
591
- <select class="cs-element-data_in">
592
- <?php
593
- foreach($animations as $key => $value) {
594
- echo '<option value="' . $key . '"';
595
- if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
596
- echo ' selected';
597
- }
598
- echo '>' . $value[0] . '</option>';
599
- }
600
- ?>
601
- </select>
602
- </td>
603
- <td class="cs-description">
604
- <?php _e('The in animation of the element.', 'crelly-slider'); ?>
605
- </td>
606
- </tr>
607
- <tr>
608
- <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
609
- <td class="cs-content">
610
- <select class="cs-element-data_out">
611
- <?php
612
- foreach($animations as $key => $value) {
613
- echo '<option value="' . $key . '"';
614
- if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
615
- echo ' selected';
616
- }
617
- echo '>' . $value[0] . '</option>';
618
- }
619
- ?>
620
- </select>
621
- <br />
622
- <?php
623
- if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
624
- else {
625
- if($element->data_ignoreEaseOut) {
626
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
627
- }
628
- else {
629
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
630
- }
631
- }
632
- ?>
633
- </td>
634
- <td class="cs-description">
635
- <?php _e('The out animation of the element.<br /><br />Disable synchronization with slide out animation: if not checked, the slide out animation won\'t start until all the elements that have this option unchecked are animated out.', 'crelly-slider'); ?>
636
- </td>
637
- </tr>
638
- <tr>
639
- <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
640
- <td class="cs-content">
641
- <?php
642
- if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
643
- else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
644
- ?>
645
- ms
646
- </td>
647
- <td class="cs-description">
648
- <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
649
- </td>
650
- </tr>
651
- <tr>
652
- <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
653
- <td class="cs-content">
654
- <?php
655
- if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
656
- else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
657
- ?>
658
- ms
659
- </td>
660
- <td class="cs-description">
661
- <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
662
- </td>
663
- </tr>
664
- <tr>
665
- <td class="cs-name"><?php _e('Link', 'crelly-slider'); ?></td>
666
- <td class="cs-content">
667
- <?php
668
- if($void) echo '<input class="cs-element-link" type="text" value="" />';
669
- else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
670
- ?>
671
- <br />
672
- <?php
673
- if($void) echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
674
- else {
675
- if($element->link_new_tab) {
676
- echo '<input class="cs-element-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crelly-slider');
677
- }
678
- else {
679
- echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
680
- }
681
- }
682
- ?>
683
- </td>
684
- <td class="cs-description">
685
- <?php _e('Open the link (e.g.: http://www.google.it) on click. Leave it empty if you don\'t want it.', 'crelly-slider'); ?>
686
- </td>
687
- </tr>
688
- <tr>
689
- <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
690
- <td class="cs-content">
691
- <?php
692
- if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
693
- else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
694
- ?>
695
- </td>
696
- <td class="cs-description">
697
- <?php _e('Style the element.', 'crelly-slider'); ?>
698
- </td>
699
- </tr>
700
- <tr>
701
- <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
702
- <td class="cs-content">
703
- <?php
704
- if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
705
- else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
706
- ?>
707
- </td>
708
- <td class="cs-description">
709
- <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
710
- </td>
711
- </tr>
712
- </tbody>
713
- </table>
714
- <?php
715
- }
716
-
717
- function crellyslider_printVideoElement($element) {
718
- $void = !$element ? true : false;
719
-
720
- $animations = array(
721
- 'none' => array(__('None', 'crelly-slider'), false),
722
- 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
723
- 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
724
- 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
725
- 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
726
- 'fade' => array(__('Fade', 'crelly-slider'), true),
727
- 'fadeDown' => array(__('Fade down', 'crelly-slider'), false),
728
- 'fadeUp' => array(__('Fade up', 'crelly-slider'), false),
729
- 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
730
- 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
731
- 'fadeSmallDown' => array(__('Fade small down', 'crelly-slider'), false),
732
- 'fadeSmallUp' => array(__('Fade small up', 'crelly-slider'), false),
733
- 'fadeSmallLeft' => array(__('Fade small left', 'crelly-slider'), false),
734
- 'fadeSmallRight' => array(__('Fade small right', 'crelly-slider'), false),
735
- );
736
-
737
- ?>
738
- <table class="cs-element-settings-list cs-video-element-settings-list cs-table">
739
- <thead>
740
- <tr class="odd-row">
741
- <th colspan="3"><?php _e('Element Options', 'crelly-slider'); ?></th>
742
- </tr>
743
- </thead>
744
-
745
- <tbody>
746
- <tr class="cs-table-header">
747
- <td><?php _e('Option', 'crelly-slider'); ?></td>
748
- <td><?php _e('Parameter', 'crelly-slider'); ?></td>
749
- <td><?php _e('Description', 'crelly-slider'); ?></td>
750
- </tr>
751
- <tr>
752
- <td class="cs-name"><?php _e('Video source', 'crelly-slider'); ?></td>
753
- <td class="cs-content">
754
- <?php
755
- if($void) echo '<select class="cs-element-video_src"><option selected value="youtube">YouTube</option><option value="vimeo">Vimeo</option></select>';
756
- else {
757
- if($element->type == 'youtube_video') {
758
- echo '<select class="cs-element-video_src"><option selected value="youtube">YouTube</option><option value="vimeo">Vimeo</option></select>';
759
- }
760
- else {
761
- echo '<select class="cs-element-video_src"><option value="youtube">YouTube</option><option selected value="vimeo">Vimeo</option></select>';
762
- }
763
- }
764
-
765
- echo '<br /><br />';
766
-
767
- if($void) echo '<input placeholder="Video ID" class="cs-element-video_id" type="text" />';
768
- else echo '<input placeholder="Video ID" class="cs-element-video_id" type="text" value="' . sanitize_text_field($element->video_id) .'" />';
769
- ?>
770
- </td>
771
- <td class="cs-description">
772
- <?php _e('Set source and ID.', 'crelly-slider'); ?>
773
- </td>
774
- </tr>
775
- <tr>
776
- <td class="cs-name"><?php _e('Player settings', 'crelly-slider'); ?></td>
777
- <td class="cs-content">
778
- <div class="cs-label-input">
779
- <label><?php _e('Loop video', 'crelly-slider'); ?></label>
780
- <?php
781
- if($void) echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
782
- else {
783
- if($element->video_loop == 0) {
784
- echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
785
- }
786
- else {
787
- echo '<select class="cs-element-video_loop"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
788
- }
789
- }
790
- ?>
791
- </div>
792
-
793
- <div class="cs-label-input">
794
- <label><?php _e('Autoplay', 'crelly-slider'); ?></label>
795
- <?php
796
- if($void) echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
797
- else {
798
- if($element->video_autoplay == 0) {
799
- echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
800
- }
801
- else {
802
- echo '<select class="cs-element-video_autoplay"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
803
- }
804
- }
805
- ?>
806
- </div>
807
-
808
- <div class="cs-label-input">
809
- <label><?php _e('Mute on start', 'crelly-slider'); ?></label>
810
- <?php
811
- if($void) echo '<select class="cs-element-video_start_mute"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
812
- else {
813
- if($element->video_start_mute == 0) {
814
- echo '<select class="cs-element-video_start_mute"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
815
- }
816
- else {
817
- echo '<select class="cs-element-video_start_mute"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
818
- }
819
- }
820
- ?>
821
- </div>
822
- </td>
823
- <td class="cs-description">
824
- <?php _e('Video player settings.', 'crelly-slider'); ?>
825
- </td>
826
- </tr>
827
- <tr>
828
- <td class="cs-name"><?php _e('Pause while watching', 'crelly-slider'); ?></td>
829
- <td class="cs-content">
830
- <?php
831
- if($void) echo '<select class="cs-element-video_pause_while_watching"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
832
- else {
833
- if($element->video_pause_while_watching == 0) {
834
- echo '<select class="cs-element-video_pause_while_watching"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
835
- }
836
- else {
837
- echo '<select class="cs-element-video_pause_while_watching"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
838
- }
839
- }
840
- ?>
841
- </td>
842
- <td class="cs-description">
843
- <?php _e('Pause the current slide timer while the user is watching the video.', 'crelly-slider'); ?>
844
- </td>
845
- </tr>
846
- <tr>
847
- <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
848
- <td class="cs-content">
849
- <?php
850
- if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
851
- else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
852
- ?>
853
- px
854
- <br />
855
- <br />
856
- <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
857
- </td>
858
- <td class="cs-description">
859
- <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
860
- </td>
861
- </tr>
862
- <tr>
863
- <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
864
- <td class="cs-content">
865
- <?php
866
- if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
867
- else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
868
- ?>
869
- px
870
- <br />
871
- <br />
872
- <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
873
- </td>
874
- <td class="cs-description">
875
- <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
876
- </td>
877
- </tr>
878
- <tr>
879
- <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
880
- <td class="cs-content">
881
- <?php
882
- if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
883
- else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
884
- ?>
885
- </td>
886
- <td class="cs-description">
887
- <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
888
- </td>
889
- </tr>
890
- <tr>
891
- <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
892
- <td class="cs-content">
893
- <?php
894
- if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
895
- else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
896
- ?>
897
- ms
898
- </td>
899
- <td class="cs-description">
900
- <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
901
- </td>
902
- </tr>
903
- <tr>
904
- <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
905
- <td class="cs-content">
906
- <?php
907
- if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
908
- else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
909
- ?>
910
- ms
911
- </td>
912
- <td class="cs-description">
913
- <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
914
- <br />
915
- <br />
916
- <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
917
- <br />
918
- <br />
919
- <?php _e('Write "3000" to set 3000 milliseconds minus delay time (so, if the delay time is 1000 milliseconds, the element will be displayed for 3000-1000=2000 milliseconds).', 'crelly-slider'); ?>
920
- </td>
921
- </tr>
922
- <tr>
923
- <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
924
- <td class="cs-content">
925
- <select class="cs-element-data_in">
926
- <?php
927
- foreach($animations as $key => $value) {
928
- echo '<option value="' . $key . '"';
929
- if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
930
- echo ' selected';
931
- }
932
- echo '>' . $value[0] . '</option>';
933
- }
934
- ?>
935
- </select>
936
- </td>
937
- <td class="cs-description">
938
- <?php _e('The in animation of the element.', 'crelly-slider'); ?>
939
- </td>
940
- </tr>
941
- <tr>
942
- <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
943
- <td class="cs-content">
944
- <select class="cs-element-data_out">
945
- <?php
946
- foreach($animations as $key => $value) {
947
- echo '<option value="' . $key . '"';
948
- if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
949
- echo ' selected';
950
- }
951
- echo '>' . $value[0] . '</option>';
952
- }
953
- ?>
954
- </select>
955
- <br />
956
- <?php
957
- if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
958
- else {
959
- if($element->data_ignoreEaseOut) {
960
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
961
- }
962
- else {
963
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
964
- }
965
- }
966
- ?>
967
- </td>
968
- <td class="cs-description">
969
- <?php _e('The out animation of the element.<br /><br />Disable synchronization with slide out animation: if not checked, the slide out animation won\'t start until all the elements that have this option unchecked are animated out.', 'crelly-slider'); ?>
970
- </td>
971
- </tr>
972
- <tr>
973
- <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
974
- <td class="cs-content">
975
- <?php
976
- if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
977
- else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
978
- ?>
979
- ms
980
- </td>
981
- <td class="cs-description">
982
- <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
983
- </td>
984
- </tr>
985
- <tr>
986
- <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
987
- <td class="cs-content">
988
- <?php
989
- if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
990
- else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
991
- ?>
992
- ms
993
- </td>
994
- <td class="cs-description">
995
- <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
996
- </td>
997
- </tr>
998
- <tr>
999
- <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
1000
- <td class="cs-content">
1001
- <?php
1002
- if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
1003
- else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
1004
- ?>
1005
- </td>
1006
- <td class="cs-description">
1007
- <?php _e('Style the element.', 'crelly-slider'); ?>
1008
- </td>
1009
- </tr>
1010
- <tr>
1011
- <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
1012
- <td class="cs-content">
1013
- <?php
1014
- if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
1015
- else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
1016
- ?>
1017
- </td>
1018
- <td class="cs-description">
1019
- <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
1020
- </td>
1021
- </tr>
1022
- </tbody>
1023
- </table>
1024
- <?php } ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ function crellyslider_printElements($edit, $slider, $slide, $elements) {
5
+ ?>
6
+ <div class="cs-elements">
7
+
8
+ <div
9
+ class="cs-slide-editing-area"
10
+ <?php if($edit && $slide): ?>
11
+ <?php
12
+ if($slide->background_type_image != 'none') {
13
+ echo 'data-background-image-src="' . stripslashes($slide->background_type_image) . '"';
14
+ }
15
+
16
+ $background_url = CrellySliderCommon::getURL(stripslashes($slide->background_type_image));
17
+
18
+ ?>
19
+ style="
20
+ width: <?php echo esc_attr($slider->startWidth); ?>px;
21
+ height: <?php echo esc_attr($slider->startHeight); ?>px;
22
+ background-image: url('<?php echo $background_url; ?>');
23
+ background-color: <?php echo esc_attr($slide->background_type_color) == 'transparent' ? 'rgb(255, 255, 255)' : esc_attr($slide->background_type_color); ?>;
24
+ background-position: <?php echo esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y); ?>;
25
+ background-repeat: <?php echo esc_attr($slide->background_repeat); ?>;
26
+ background-size: <?php echo esc_attr($slide->background_propriety_size); ?>;
27
+ <?php echo stripslashes($slide->custom_css); ?>
28
+ "
29
+ <?php endif; ?>
30
+ >
31
+ <?php
32
+ if($edit && $elements != NULL) {
33
+ foreach($elements as $element) {
34
+ if($element->link != '') {
35
+ $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
36
+
37
+ $link_output = '<a' . "\n" .
38
+ 'class="cs-element cs-' . esc_attr($element->type) . '-element"' . "\n" .
39
+ 'href="' . stripslashes($element->link) . '"' . "\n" .
40
+ $target . "\n" .
41
+ 'style="' .
42
+ 'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
43
+ 'top: ' . esc_attr($element->data_top) . 'px;' . "\n" .
44
+ 'left: ' . esc_attr($element->data_left) . 'px;' . "\n" .
45
+ '">' . "\n";
46
+
47
+ echo $link_output;
48
+ }
49
+
50
+ switch($element->type) {
51
+ case 'text':
52
+ ?>
53
+ <div
54
+ style="
55
+ <?php
56
+ if($element->link == '') {
57
+ echo 'z-index: ' . esc_attr($element->z_index) . ';';
58
+ echo 'left: ' . esc_attr($element->data_left) . 'px;';
59
+ echo 'top: ' . esc_attr($element->data_top) . 'px;';
60
+ }
61
+ echo stripslashes($element->custom_css);
62
+ ?>
63
+ "
64
+ <?php
65
+ if($element->link == '') {
66
+ echo 'class="cs-element cs-text-element ' . stripslashes($element->custom_css_classes) . '"';
67
+ }
68
+ else {
69
+ echo 'class="' . stripslashes($element->custom_css_classes) . '"';
70
+ }
71
+ ?>
72
+ >
73
+ <?php echo stripslashes($element->inner_html); ?>
74
+ </div>
75
+ <?php
76
+ break;
77
+
78
+ case 'image':
79
+ ?>
80
+ <img
81
+ src="<?php echo CrellySliderCommon::getURL(stripslashes($element->image_src)); ?>"
82
+ alt="<?php echo esc_attr($element->image_alt); ?>"
83
+ style="
84
+ <?php
85
+ if($element->link == '') {
86
+ echo 'z-index: ' . esc_attr($element->z_index) . ';';
87
+ echo 'left: ' . esc_attr($element->data_left) . 'px;';
88
+ echo 'top: ' . esc_attr($element->data_top) . 'px;';
89
+ }
90
+ echo stripslashes($element->custom_css);
91
+ ?>
92
+ "
93
+ <?php
94
+ if($element->link == '') {
95
+ echo 'class="cs-element cs-image-element ' . stripslashes($element->custom_css_classes) . '"';
96
+ }
97
+ else {
98
+ echo 'class="' . stripslashes($element->custom_css_classes) . '"';
99
+ }
100
+ ?>
101
+ />
102
+ <?php
103
+ break;
104
+
105
+ case 'youtube_video':
106
+ ?>
107
+ <div
108
+ class="cs-element cs-video-element"
109
+ style="
110
+ <?php
111
+ if($element->link == '') {
112
+ echo 'z-index: ' . esc_attr($element->z_index) . ';';
113
+ echo 'left: ' . esc_attr($element->data_left) . 'px;';
114
+ echo 'top: ' . esc_attr($element->data_top) . 'px;';
115
+ }
116
+ ?>
117
+ "
118
+ >
119
+ <div class="cs-avoid-interaction"></div>
120
+ <iframe allow="autoplay" style="<?php echo stripslashes($element->custom_css); ?>" class="cs-yt-iframe <?php echo stripslashes($element->custom_css_classes); ?>" type="text/html" width="560" height="315" src="<?php echo esc_url('http://www.youtube.com/embed/' . $element->video_id); ?>?enablejsapi=1" frameborder="0"></iframe>
121
+ </div>
122
+ <?php
123
+ break;
124
+
125
+ case 'vimeo_video':
126
+ ?>
127
+ <div
128
+ class="cs-element cs-video-element"
129
+ style="
130
+ <?php
131
+ if($element->link == '') {
132
+ echo 'z-index: ' . esc_attr($element->z_index) . ';';
133
+ echo 'left: ' . esc_attr($element->data_left) . 'px;';
134
+ echo 'top: ' . esc_attr($element->data_top) . 'px;';
135
+ }
136
+ ?>
137
+ "
138
+ >
139
+ <div class="cs-avoid-interaction"></div>
140
+ <iframe allow="autoplay" style="<?php echo stripslashes($element->custom_css); ?>" class="cs-vimeo-iframe <?php echo stripslashes($element->custom_css_classes); ?>" src="<?php echo esc_url('https://player.vimeo.com/video/' . $element->video_id); ?>?api=1" width="560" height="315" frameborder="0" ></iframe>
141
+ </div>
142
+ <?php
143
+ break;
144
+ }
145
+
146
+ if($element->link != '') {
147
+ echo '</a>' . "\n";
148
+ }
149
+ }
150
+ }
151
+ ?>
152
+ </div>
153
+
154
+ <br />
155
+ <br />
156
+
157
+ <div class="cs-elements-actions">
158
+ <div style="float: left;">
159
+ <a class="cs-add-text-element cs-button cs-is-warning"><?php _e('Add text', 'crelly-slider'); ?></a>
160
+ <a class="cs-add-image-element cs-button cs-is-warning"><?php _e('Add image', 'crelly-slider'); ?></a>
161
+ <a class="cs-add-video-element cs-button cs-is-warning"><?php _e('Add video', 'crelly-slider'); ?></a>
162
+ </div>
163
+ <div style="float: right;">
164
+ <a class="cs-live-preview cs-button cs-is-success"><?php _e('Live preview', 'crelly-slider'); ?></a>
165
+ <a class="cs-delete-element cs-button cs-is-danger cs-is-disabled"><?php _e('Delete element', 'crelly-slider'); ?></a>
166
+ <a class="cs-duplicate-element cs-button cs-is-primary cs-is-disabled"><?php _e('Duplicate element', 'crelly-slider'); ?></a>
167
+ </div>
168
+ <div style="clear: both;"></div>
169
+ </div>
170
+
171
+ <br />
172
+ <br />
173
+
174
+ <div class="cs-elements-list">
175
+ <?php
176
+ if($edit && $elements != NULL) {
177
+ foreach($elements as $element) {
178
+ switch($element->type) {
179
+ case 'text':
180
+ echo '<div class="cs-element-settings cs-text-element-settings" style="display: none;">';
181
+ crellyslider_printTextElement($element);
182
+ echo '</div>';
183
+ break;
184
+
185
+ case 'image':
186
+ echo '<div class="cs-element-settings cs-image-element-settings" style="display: none;">';
187
+ crellyslider_printImageElement($element);
188
+ echo '</div>';
189
+ break;
190
+
191
+ case 'youtube_video':
192
+ case 'vimeo_video':
193
+ echo '<div class="cs-element-settings cs-video-element-settings" style="display: none;">';
194
+ crellyslider_printVideoElement($element);
195
+ echo '</div>';
196
+ break;
197
+ }
198
+ }
199
+ }
200
+ echo '<div class="cs-void-element-settings cs-void-text-element-settings cs-element-settings cs-text-element-settings">';
201
+ crellyslider_printTextElement(false);
202
+ echo '</div>';
203
+ echo '<div class="cs-void-element-settings cs-void-image-element-settings cs-element-settings cs-image-element-settings">';
204
+ crellyslider_printImageElement(false);
205
+ echo '</div>';
206
+ echo '<div class="cs-void-element-settings cs-void-video-element-settings cs-element-settings cs-video-element-settings">';
207
+ crellyslider_printVideoElement(false);
208
+ echo '</div>';
209
+ ?>
210
+ </div>
211
+
212
+ </div>
213
+ <?php
214
+ }
215
+
216
+ function crellyslider_printTextElement($element) {
217
+ $void = !$element ? true : false;
218
+
219
+ $animations = array(
220
+ 'none' => array(__('None', 'crelly-slider'), false),
221
+ 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
222
+ 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
223
+ 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
224
+ 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
225
+ 'fade' => array(__('Fade', 'crelly-slider'), true),
226
+ 'fadeDown' => array(__('Fade down', 'crelly-slider'), false),
227
+ 'fadeUp' => array(__('Fade up', 'crelly-slider'), false),
228
+ 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
229
+ 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
230
+ 'fadeSmallDown' => array(__('Fade small down', 'crelly-slider'), false),
231
+ 'fadeSmallUp' => array(__('Fade small up', 'crelly-slider'), false),
232
+ 'fadeSmallLeft' => array(__('Fade small left', 'crelly-slider'), false),
233
+ 'fadeSmallRight' => array(__('Fade small right', 'crelly-slider'), false),
234
+ );
235
+
236
+ ?>
237
+ <table class="cs-element-settings-list cs-text-element-settings-list cs-table">
238
+ <thead>
239
+ <tr class="odd-row">
240
+ <th colspan="3"><?php _e('Element Options', 'crelly-slider'); ?></th>
241
+ </tr>
242
+ </thead>
243
+
244
+ <tbody>
245
+ <tr class="cs-table-header">
246
+ <td><?php _e('Option', 'crelly-slider'); ?></td>
247
+ <td><?php _e('Parameter', 'crelly-slider'); ?></td>
248
+ <td><?php _e('Description', 'crelly-slider'); ?></td>
249
+ </tr>
250
+ <tr>
251
+ <td class="cs-name"><?php _e('Text', 'crelly-slider'); ?></td>
252
+ <td class="cs-content">
253
+ <?php
254
+ if($void) echo '<textarea class="cs-element-inner_html">' . __('Text element', 'crelly-slider') . '</textarea>';
255
+ else echo '<textarea class="cs-element-inner_html">' . esc_textarea(stripslashes($element->inner_html)) . '</textarea>';
256
+ ?>
257
+ </td>
258
+ <td class="cs-description">
259
+ <?php _e('Write the text or the HTML.', 'crelly-slider'); ?>
260
+ </td>
261
+ </tr>
262
+ <tr>
263
+ <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
264
+ <td class="cs-content">
265
+ <?php
266
+ if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
267
+ else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
268
+ ?>
269
+ px
270
+ <br />
271
+ <br />
272
+ <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
273
+ </td>
274
+ <td class="cs-description">
275
+ <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
276
+ </td>
277
+ </tr>
278
+ <tr>
279
+ <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
280
+ <td class="cs-content">
281
+ <?php
282
+ if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
283
+ else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
284
+ ?>
285
+ px
286
+ <br />
287
+ <br />
288
+ <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
289
+ </td>
290
+ <td class="cs-description">
291
+ <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
292
+ </td>
293
+ </tr>
294
+ <tr>
295
+ <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
296
+ <td class="cs-content">
297
+ <?php
298
+ if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
299
+ else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
300
+ ?>
301
+ </td>
302
+ <td class="cs-description">
303
+ <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
304
+ </td>
305
+ </tr>
306
+ <tr>
307
+ <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
308
+ <td class="cs-content">
309
+ <?php
310
+ if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
311
+ else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
312
+ ?>
313
+ ms
314
+ </td>
315
+ <td class="cs-description">
316
+ <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
317
+ </td>
318
+ </tr>
319
+ <tr>
320
+ <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
321
+ <td class="cs-content">
322
+ <?php
323
+ if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
324
+ else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
325
+ ?>
326
+ ms
327
+ </td>
328
+ <td class="cs-description">
329
+ <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
330
+ <br />
331
+ <br />
332
+ <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
333
+ <br />
334
+ <br />
335
+ <?php _e('Write "3000" to set 3000 milliseconds minus delay time (so, if the delay time is 1000 milliseconds, the element will be displayed for 3000-1000=2000 milliseconds).', 'crelly-slider'); ?>
336
+ </td>
337
+ </tr>
338
+ <tr>
339
+ <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
340
+ <td class="cs-content">
341
+ <select class="cs-element-data_in">
342
+ <?php
343
+ foreach($animations as $key => $value) {
344
+ echo '<option value="' . $key . '"';
345
+ if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
346
+ echo ' selected';
347
+ }
348
+ echo '>' . $value[0] . '</option>';
349
+ }
350
+ ?>
351
+ </select>
352
+ </td>
353
+ <td class="cs-description">
354
+ <?php _e('The in animation of the element.', 'crelly-slider'); ?>
355
+ </td>
356
+ </tr>
357
+ <tr>
358
+ <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
359
+ <td class="cs-content">
360
+ <select class="cs-element-data_out">
361
+ <?php
362
+ foreach($animations as $key => $value) {
363
+ echo '<option value="' . $key . '"';
364
+ if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
365
+ echo ' selected';
366
+ }
367
+ echo '>' . $value[0] . '</option>';
368
+ }
369
+ ?>
370
+ </select>
371
+ <br />
372
+ <?php
373
+ if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
374
+ else {
375
+ if($element->data_ignoreEaseOut) {
376
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
377
+ }
378
+ else {
379
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
380
+ }
381
+ }
382
+ ?>
383
+ </td>
384
+ <td class="cs-description">
385
+ <?php _e('The out animation of the element.<br /><br />Disable synchronization with slide out animation: if not checked, the slide out animation won\'t start until all the elements that have this option unchecked are animated out.', 'crelly-slider'); ?>
386
+ </td>
387
+ </tr>
388
+ <tr>
389
+ <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
390
+ <td class="cs-content">
391
+ <?php
392
+ if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
393
+ else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
394
+ ?>
395
+ ms
396
+ </td>
397
+ <td class="cs-description">
398
+ <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
399
+ </td>
400
+ </tr>
401
+ <tr>
402
+ <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
403
+ <td class="cs-content">
404
+ <?php
405
+ if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
406
+ else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
407
+ ?>
408
+ ms
409
+ </td>
410
+ <td class="cs-description">
411
+ <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
412
+ </td>
413
+ </tr>
414
+ <tr>
415
+ <td class="cs-name"><?php _e('Link', 'crelly-slider'); ?></td>
416
+ <td class="cs-content">
417
+ <?php
418
+ if($void) echo '<input class="cs-element-link" type="text" value="" />';
419
+ else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
420
+ ?>
421
+ <br />
422
+ <?php
423
+ if($void) echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
424
+ else {
425
+ if($element->link_new_tab) {
426
+ echo '<input class="cs-element-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crelly-slider');
427
+ }
428
+ else {
429
+ echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
430
+ }
431
+ }
432
+ ?>
433
+ </td>
434
+ <td class="cs-description">
435
+ <?php _e('Open the link (e.g.: http://www.google.it) on click. Leave it empty if you don\'t want it.', 'crelly-slider'); ?>
436
+ </td>
437
+ </tr>
438
+ <tr>
439
+ <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
440
+ <td class="cs-content">
441
+ <?php
442
+ if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
443
+ else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
444
+ ?>
445
+ </td>
446
+ <td class="cs-description">
447
+ <?php _e('Style the element.', 'crelly-slider'); ?>
448
+ </td>
449
+ </tr>
450
+ <tr>
451
+ <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
452
+ <td class="cs-content">
453
+ <?php
454
+ if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
455
+ else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
456
+ ?>
457
+ </td>
458
+ <td class="cs-description">
459
+ <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
460
+ </td>
461
+ </tr>
462
+ </tbody>
463
+ </table>
464
+ <?php
465
+ }
466
+
467
+ function crellyslider_printImageElement($element) {
468
+ $void = !$element ? true : false;
469
+
470
+ $animations = array(
471
+ 'none' => array(__('None', 'crelly-slider'), false),
472
+ 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
473
+ 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
474
+ 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
475
+ 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
476
+ 'fade' => array(__('Fade', 'crelly-slider'), true),
477
+ 'fadeDown' => array(__('Fade down', 'crelly-slider'), false),
478
+ 'fadeUp' => array(__('Fade up', 'crelly-slider'), false),
479
+ 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
480
+ 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
481
+ 'fadeSmallDown' => array(__('Fade small down', 'crelly-slider'), false),
482
+ 'fadeSmallUp' => array(__('Fade small up', 'crelly-slider'), false),
483
+ 'fadeSmallLeft' => array(__('Fade small left', 'crelly-slider'), false),
484
+ 'fadeSmallRight' => array(__('Fade small right', 'crelly-slider'), false),
485
+ );
486
+
487
+ ?>
488
+ <table class="cs-element-settings-list cs-image-element-settings-list cs-table">
489
+ <thead>
490
+ <tr class="odd-row">
491
+ <th colspan="3"><?php _e('Element Options', 'crelly-slider'); ?></th>
492
+ </tr>
493
+ </thead>
494
+ <tbody>
495
+ <tr class="cs-table-header">
496
+ <td><?php _e('Option', 'crelly-slider'); ?></td>
497
+ <td><?php _e('Parameter', 'crelly-slider'); ?></td>
498
+ <td><?php _e('Description', 'crelly-slider'); ?></td>
499
+ </tr>
500
+ <tr>
501
+ <td class="cs-name"><?php _e('Modify image', 'crelly-slider'); ?></td>
502
+ <td class="cs-content">
503
+ <?php
504
+ if($void) echo '<input class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
505
+ else echo '<input data-src="' . stripslashes($element->image_src) . '" data-alt="' . esc_attr($element->image_alt) . '" class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
506
+ ?>
507
+ </td>
508
+ <td class="cs-description">
509
+ <?php _e('Change the image source or the alt text.', 'crelly-slider'); ?>
510
+ </td>
511
+ </tr>
512
+ <tr>
513
+ <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
514
+ <td class="cs-content">
515
+ <?php
516
+ if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
517
+ else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
518
+ ?>
519
+ px
520
+ <br />
521
+ <br />
522
+ <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
523
+ </td>
524
+ <td class="cs-description">
525
+ <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
526
+ </td>
527
+ </tr>
528
+ <tr>
529
+ <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
530
+ <td class="cs-content">
531
+ <?php
532
+ if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
533
+ else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
534
+ ?>
535
+ px
536
+ <br />
537
+ <br />
538
+ <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
539
+ </td>
540
+ <td class="cs-description">
541
+ <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
542
+ </td>
543
+ </tr>
544
+ <tr>
545
+ <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
546
+ <td class="cs-content">
547
+ <?php
548
+ if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
549
+ else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
550
+ ?>
551
+ </td>
552
+ <td class="cs-description">
553
+ <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
554
+ </td>
555
+ </tr>
556
+ <tr>
557
+ <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
558
+ <td class="cs-content">
559
+ <?php
560
+ if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
561
+ else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
562
+ ?>
563
+ ms
564
+ </td>
565
+ <td class="cs-description">
566
+ <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
567
+ </td>
568
+ </tr>
569
+ <tr>
570
+ <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
571
+ <td class="cs-content">
572
+ <?php
573
+ if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
574
+ else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
575
+ ?>
576
+ ms
577
+ </td>
578
+ <td class="cs-description">
579
+ <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
580
+ <br />
581
+ <br />
582
+ <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
583
+ <br />
584
+ <br />
585
+ <?php _e('Write "3000" to set 3000 milliseconds minus delay time (so, if the delay time is 1000 milliseconds, the element will be displayed for 3000-1000=2000 milliseconds).', 'crelly-slider'); ?>
586
+ </td>
587
+ </tr>
588
+ <tr>
589
+ <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
590
+ <td class="cs-content">
591
+ <select class="cs-element-data_in">
592
+ <?php
593
+ foreach($animations as $key => $value) {
594
+ echo '<option value="' . $key . '"';
595
+ if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
596
+ echo ' selected';
597
+ }
598
+ echo '>' . $value[0] . '</option>';
599
+ }
600
+ ?>
601
+ </select>
602
+ </td>
603
+ <td class="cs-description">
604
+ <?php _e('The in animation of the element.', 'crelly-slider'); ?>
605
+ </td>
606
+ </tr>
607
+ <tr>
608
+ <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
609
+ <td class="cs-content">
610
+ <select class="cs-element-data_out">
611
+ <?php
612
+ foreach($animations as $key => $value) {
613
+ echo '<option value="' . $key . '"';
614
+ if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
615
+ echo ' selected';
616
+ }
617
+ echo '>' . $value[0] . '</option>';
618
+ }
619
+ ?>
620
+ </select>
621
+ <br />
622
+ <?php
623
+ if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
624
+ else {
625
+ if($element->data_ignoreEaseOut) {
626
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
627
+ }
628
+ else {
629
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
630
+ }
631
+ }
632
+ ?>
633
+ </td>
634
+ <td class="cs-description">
635
+ <?php _e('The out animation of the element.<br /><br />Disable synchronization with slide out animation: if not checked, the slide out animation won\'t start until all the elements that have this option unchecked are animated out.', 'crelly-slider'); ?>
636
+ </td>
637
+ </tr>
638
+ <tr>
639
+ <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
640
+ <td class="cs-content">
641
+ <?php
642
+ if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
643
+ else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
644
+ ?>
645
+ ms
646
+ </td>
647
+ <td class="cs-description">
648
+ <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
649
+ </td>
650
+ </tr>
651
+ <tr>
652
+ <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
653
+ <td class="cs-content">
654
+ <?php
655
+ if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
656
+ else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
657
+ ?>
658
+ ms
659
+ </td>
660
+ <td class="cs-description">
661
+ <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
662
+ </td>
663
+ </tr>
664
+ <tr>
665
+ <td class="cs-name"><?php _e('Link', 'crelly-slider'); ?></td>
666
+ <td class="cs-content">
667
+ <?php
668
+ if($void) echo '<input class="cs-element-link" type="text" value="" />';
669
+ else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
670
+ ?>
671
+ <br />
672
+ <?php
673
+ if($void) echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
674
+ else {
675
+ if($element->link_new_tab) {
676
+ echo '<input class="cs-element-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crelly-slider');
677
+ }
678
+ else {
679
+ echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
680
+ }
681
+ }
682
+ ?>
683
+ </td>
684
+ <td class="cs-description">
685
+ <?php _e('Open the link (e.g.: http://www.google.it) on click. Leave it empty if you don\'t want it.', 'crelly-slider'); ?>
686
+ </td>
687
+ </tr>
688
+ <tr>
689
+ <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
690
+ <td class="cs-content">
691
+ <?php
692
+ if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
693
+ else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
694
+ ?>
695
+ </td>
696
+ <td class="cs-description">
697
+ <?php _e('Style the element.', 'crelly-slider'); ?>
698
+ </td>
699
+ </tr>
700
+ <tr>
701
+ <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
702
+ <td class="cs-content">
703
+ <?php
704
+ if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
705
+ else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
706
+ ?>
707
+ </td>
708
+ <td class="cs-description">
709
+ <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
710
+ </td>
711
+ </tr>
712
+ </tbody>
713
+ </table>
714
+ <?php
715
+ }
716
+
717
+ function crellyslider_printVideoElement($element) {
718
+ $void = !$element ? true : false;
719
+
720
+ $animations = array(
721
+ 'none' => array(__('None', 'crelly-slider'), false),
722
+ 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
723
+ 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
724
+ 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
725
+ 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
726
+ 'fade' => array(__('Fade', 'crelly-slider'), true),
727
+ 'fadeDown' => array(__('Fade down', 'crelly-slider'), false),
728
+ 'fadeUp' => array(__('Fade up', 'crelly-slider'), false),
729
+ 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
730
+ 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
731
+ 'fadeSmallDown' => array(__('Fade small down', 'crelly-slider'), false),
732
+ 'fadeSmallUp' => array(__('Fade small up', 'crelly-slider'), false),
733
+ 'fadeSmallLeft' => array(__('Fade small left', 'crelly-slider'), false),
734
+ 'fadeSmallRight' => array(__('Fade small right', 'crelly-slider'), false),
735
+ );
736
+
737
+ ?>
738
+ <table class="cs-element-settings-list cs-video-element-settings-list cs-table">
739
+ <thead>
740
+ <tr class="odd-row">
741
+ <th colspan="3"><?php _e('Element Options', 'crelly-slider'); ?></th>
742
+ </tr>
743
+ </thead>
744
+
745
+ <tbody>
746
+ <tr class="cs-table-header">
747
+ <td><?php _e('Option', 'crelly-slider'); ?></td>
748
+ <td><?php _e('Parameter', 'crelly-slider'); ?></td>
749
+ <td><?php _e('Description', 'crelly-slider'); ?></td>
750
+ </tr>
751
+ <tr>
752
+ <td class="cs-name"><?php _e('Video source', 'crelly-slider'); ?></td>
753
+ <td class="cs-content">
754
+ <?php
755
+ if($void) echo '<select class="cs-element-video_src"><option selected value="youtube">YouTube</option><option value="vimeo">Vimeo</option></select>';
756
+ else {
757
+ if($element->type == 'youtube_video') {
758
+ echo '<select class="cs-element-video_src"><option selected value="youtube">YouTube</option><option value="vimeo">Vimeo</option></select>';
759
+ }
760
+ else {
761
+ echo '<select class="cs-element-video_src"><option value="youtube">YouTube</option><option selected value="vimeo">Vimeo</option></select>';
762
+ }
763
+ }
764
+
765
+ echo '<br /><br />';
766
+
767
+ if($void) echo '<input placeholder="Video ID" class="cs-element-video_id" type="text" />';
768
+ else echo '<input placeholder="Video ID" class="cs-element-video_id" type="text" value="' . sanitize_text_field($element->video_id) .'" />';
769
+ ?>
770
+ </td>
771
+ <td class="cs-description">
772
+ <?php _e('Set source and ID.', 'crelly-slider'); ?>
773
+ </td>
774
+ </tr>
775
+ <tr>
776
+ <td class="cs-name"><?php _e('Player settings', 'crelly-slider'); ?></td>
777
+ <td class="cs-content">
778
+ <div class="cs-label-input">
779
+ <label><?php _e('Loop video', 'crelly-slider'); ?></label>
780
+ <?php
781
+ if($void) echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
782
+ else {
783
+ if($element->video_loop == 0) {
784
+ echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
785
+ }
786
+ else {
787
+ echo '<select class="cs-element-video_loop"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
788
+ }
789
+ }
790
+ ?>
791
+ </div>
792
+
793
+ <div class="cs-label-input">
794
+ <label><?php _e('Autoplay', 'crelly-slider'); ?></label>
795
+ <?php
796
+ if($void) echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
797
+ else {
798
+ if($element->video_autoplay == 0) {
799
+ echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
800
+ }
801
+ else {
802
+ echo '<select class="cs-element-video_autoplay"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
803
+ }
804
+ }
805
+ ?>
806
+ </div>
807
+
808
+ <div class="cs-label-input">
809
+ <label><?php _e('Mute on start', 'crelly-slider'); ?></label>
810
+ <?php
811
+ if($void) echo '<select class="cs-element-video_start_mute"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
812
+ else {
813
+ if($element->video_start_mute == 0) {
814
+ echo '<select class="cs-element-video_start_mute"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
815
+ }
816
+ else {
817
+ echo '<select class="cs-element-video_start_mute"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
818
+ }
819
+ }
820
+ ?>
821
+ </div>
822
+ </td>
823
+ <td class="cs-description">
824
+ <?php _e('Video player settings.', 'crelly-slider'); ?>
825
+ </td>
826
+ </tr>
827
+ <tr>
828
+ <td class="cs-name"><?php _e('Pause while watching', 'crelly-slider'); ?></td>
829
+ <td class="cs-content">
830
+ <?php
831
+ if($void) echo '<select class="cs-element-video_pause_while_watching"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
832
+ else {
833
+ if($element->video_pause_while_watching == 0) {
834
+ echo '<select class="cs-element-video_pause_while_watching"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
835
+ }
836
+ else {
837
+ echo '<select class="cs-element-video_pause_while_watching"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
838
+ }
839
+ }
840
+ ?>
841
+ </td>
842
+ <td class="cs-description">
843
+ <?php _e('Pause the current slide timer while the user is watching the video.', 'crelly-slider'); ?>
844
+ </td>
845
+ </tr>
846
+ <tr>
847
+ <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
848
+ <td class="cs-content">
849
+ <?php
850
+ if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
851
+ else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
852
+ ?>
853
+ px
854
+ <br />
855
+ <br />
856
+ <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
857
+ </td>
858
+ <td class="cs-description">
859
+ <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
860
+ </td>
861
+ </tr>
862
+ <tr>
863
+ <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
864
+ <td class="cs-content">
865
+ <?php
866
+ if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
867
+ else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
868
+ ?>
869
+ px
870
+ <br />
871
+ <br />
872
+ <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
873
+ </td>
874
+ <td class="cs-description">
875
+ <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
876
+ </td>
877
+ </tr>
878
+ <tr>
879
+ <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
880
+ <td class="cs-content">
881
+ <?php
882
+ if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
883
+ else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
884
+ ?>
885
+ </td>
886
+ <td class="cs-description">
887
+ <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
888
+ </td>
889
+ </tr>
890
+ <tr>
891
+ <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
892
+ <td class="cs-content">
893
+ <?php
894
+ if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
895
+ else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
896
+ ?>
897
+ ms
898
+ </td>
899
+ <td class="cs-description">
900
+ <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
901
+ </td>
902
+ </tr>
903
+ <tr>
904
+ <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
905
+ <td class="cs-content">
906
+ <?php
907
+ if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
908
+ else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
909
+ ?>
910
+ ms
911
+ </td>
912
+ <td class="cs-description">
913
+ <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
914
+ <br />
915
+ <br />
916
+ <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
917
+ <br />
918
+ <br />
919
+ <?php _e('Write "3000" to set 3000 milliseconds minus delay time (so, if the delay time is 1000 milliseconds, the element will be displayed for 3000-1000=2000 milliseconds).', 'crelly-slider'); ?>
920
+ </td>
921
+ </tr>
922
+ <tr>
923
+ <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
924
+ <td class="cs-content">
925
+ <select class="cs-element-data_in">
926
+ <?php
927
+ foreach($animations as $key => $value) {
928
+ echo '<option value="' . $key . '"';
929
+ if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
930
+ echo ' selected';
931
+ }
932
+ echo '>' . $value[0] . '</option>';
933
+ }
934
+ ?>
935
+ </select>
936
+ </td>
937
+ <td class="cs-description">
938
+ <?php _e('The in animation of the element.', 'crelly-slider'); ?>
939
+ </td>
940
+ </tr>
941
+ <tr>
942
+ <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
943
+ <td class="cs-content">
944
+ <select class="cs-element-data_out">
945
+ <?php
946
+ foreach($animations as $key => $value) {
947
+ echo '<option value="' . $key . '"';
948
+ if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
949
+ echo ' selected';
950
+ }
951
+ echo '>' . $value[0] . '</option>';
952
+ }
953
+ ?>
954
+ </select>
955
+ <br />
956
+ <?php
957
+ if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
958
+ else {
959
+ if($element->data_ignoreEaseOut) {
960
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
961
+ }
962
+ else {
963
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
964
+ }
965
+ }
966
+ ?>
967
+ </td>
968
+ <td class="cs-description">
969
+ <?php _e('The out animation of the element.<br /><br />Disable synchronization with slide out animation: if not checked, the slide out animation won\'t start until all the elements that have this option unchecked are animated out.', 'crelly-slider'); ?>
970
+ </td>
971
+ </tr>
972
+ <tr>
973
+ <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
974
+ <td class="cs-content">
975
+ <?php
976
+ if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
977
+ else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
978
+ ?>
979
+ ms
980
+ </td>
981
+ <td class="cs-description">
982
+ <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
983
+ </td>
984
+ </tr>
985
+ <tr>
986
+ <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
987
+ <td class="cs-content">
988
+ <?php
989
+ if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
990
+ else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
991
+ ?>
992
+ ms
993
+ </td>
994
+ <td class="cs-description">
995
+ <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
996
+ </td>
997
+ </tr>
998
+ <tr>
999
+ <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
1000
+ <td class="cs-content">
1001
+ <?php
1002
+ if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
1003
+ else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
1004
+ ?>
1005
+ </td>
1006
+ <td class="cs-description">
1007
+ <?php _e('Style the element.', 'crelly-slider'); ?>
1008
+ </td>
1009
+ </tr>
1010
+ <tr>
1011
+ <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
1012
+ <td class="cs-content">
1013
+ <?php
1014
+ if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
1015
+ else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
1016
+ ?>
1017
+ </td>
1018
+ <td class="cs-description">
1019
+ <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
1020
+ </td>
1021
+ </tr>
1022
+ </tbody>
1023
+ </table>
1024
+ <?php } ?>
wordpress/frontend.php CHANGED
@@ -1,261 +1,261 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- // Code output
5
- function crellySlider($alias) {
6
- echo getCrellySlider($alias);
7
- }
8
-
9
- function getCrellySlider($alias) {
10
- return CrellySliderFrontend::output($alias);
11
- }
12
-
13
- class CrellySliderFrontend {
14
-
15
- public static function setNotAdminJs() {
16
- add_action('wp_enqueue_scripts', 'CrellySliderFrontend::notAdminJs');
17
- }
18
-
19
- // Shortcode
20
- public static function shortcode($atts) {
21
- $a = shortcode_atts( array(
22
- 'alias' => false,
23
- ), $atts );
24
-
25
- if(! $a['alias']) {
26
- return __('You have to insert a valid alias in the shortcode', 'crelly-slider');
27
- }
28
- else {
29
- return CrellySliderFrontend::output($a['alias']);
30
- }
31
- }
32
-
33
- public static function addShortcode() {
34
- add_shortcode('crellyslider', array( __CLASS__, 'shortcode'));
35
- }
36
-
37
- public static function output($alias) {
38
- global $wpdb;
39
-
40
- // Check if the slider exists
41
- $slider = $wpdb->get_row($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE alias = %s', esc_sql($alias)));
42
- if(! $slider) {
43
- return __('The slider hasn\'t been found', 'crelly-slider');
44
- }
45
-
46
- // Generate a unique ID for each slider. This is needed because we might want to display the same slider on the same page more than once.
47
- // The first slider of the page will have id="crellyslider-theSliderID". All the others will have id="crellyslider-theSliderID-aRandomString"
48
- static $loadedSliders = array();
49
- $uid = $slider->id;
50
- if(in_array($slider->id, $loadedSliders)) {
51
- $uid .= '-' . uniqid();
52
- }
53
- else {
54
- array_push($loadedSliders, $slider->id);
55
- }
56
-
57
- // Get the slider. Return if now() is not between from/to dates
58
- $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE NOW() BETWEEN fromDate AND toDate AND alias=%s', esc_sql($alias)));
59
- if(! $slider) {
60
- return '';
61
- }
62
-
63
- $slider_id = esc_sql($slider->id);
64
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE draft = 0 AND slider_parent = %d ORDER BY position', $slider_id));
65
-
66
- $output = '';
67
-
68
- $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . ' crellyslider-' . esc_attr($slider_id) . '" id="crellyslider-' . $uid . '">' . "\n";
69
- $output .= '<ul>' . "\n";
70
- foreach($slides as $slide) {
71
- $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . CrellySliderCommon::getURL($slide->background_type_image) . '\');';
72
- $output .= '<li' . "\n" .
73
- 'style="' . "\n" .
74
- 'background-color: ' . esc_attr($slide->background_type_color) . ';' . "\n" .
75
- 'background-image: ' . $background_type_image . "\n" .
76
- 'background-position: ' . esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y) . ';' . "\n" .
77
- 'background-repeat: ' . esc_attr($slide->background_repeat) . ';' . "\n" .
78
- 'background-size: ' . esc_attr($slide->background_propriety_size) . ';' . "\n" .
79
- stripslashes($slide->custom_css) . "\n" .
80
- '"' . "\n" .
81
-
82
- 'data-in="' . esc_attr($slide->data_in) . '"' . "\n" .
83
- 'data-ease-in="' . esc_attr($slide->data_easeIn) . '"' . "\n" .
84
- 'data-out="' . esc_attr($slide->data_out) . '"' . "\n" .
85
- 'data-ease-out="' . esc_attr($slide->data_easeOut) . '"' . "\n" .
86
- 'data-time="' . esc_attr($slide->data_time) . '"' . "\n" .
87
- '>' . "\n";
88
-
89
- if($slide->link != '') {
90
- if($slide->link_new_tab) {
91
- $output .= '<a class="cs-background-link" target="_blank" href="' . stripslashes($slide->link) . '"></a>';
92
- }
93
- else {
94
- $output .= '<a class="cs-background-link" href="' . stripslashes($slide->link) . '"></a>';
95
- }
96
- }
97
-
98
- $slide_parent = esc_sql($slide->position);
99
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND slide_parent = %d', $slider_id, $slide_parent));
100
-
101
- foreach($elements as $element) {
102
- if($element->link != '') {
103
- $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
104
-
105
- $output .= '<a' . "\n" .
106
- 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
107
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
108
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
109
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
110
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
111
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
112
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
113
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
114
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
115
- 'href="' . stripslashes($element->link) . '"' . "\n" .
116
- $target . "\n" .
117
- 'style="' .
118
- 'z-index: ' . $element->z_index . ';' . "\n" .
119
- '">' . "\n";
120
- }
121
-
122
- switch($element->type) {
123
- case 'text':
124
- $output .= '<div' . "\n" .
125
- 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
126
- 'style="';
127
- if($element->link == '') {
128
- $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
129
- }
130
- $output .= stripslashes($element->custom_css) . "\n" .
131
- '"' . "\n";
132
- if($element->link == '') {
133
- $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
134
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
135
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
136
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
137
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
138
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
139
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
140
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
141
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
142
- }
143
- $output .= '>' .
144
- stripslashes($element->inner_html) .
145
- '</div>' . "\n";
146
- break;
147
-
148
- case 'image':
149
- $output .= '<img' . "\n" .
150
- 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
151
- 'src="' . CrellySliderCommon::getURL($element->image_src) . '"' . "\n" .
152
- 'alt="' . esc_attr($element->image_alt) . '"' . "\n" .
153
- 'style="' . "\n";
154
- if($element->link == '') {
155
- $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
156
- }
157
- $output .= stripslashes($element->custom_css) . "\n" .
158
- '"' . "\n";
159
- if($element->link == '') {
160
- $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
161
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
162
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
163
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
164
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
165
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
166
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
167
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
168
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
169
- }
170
- $output .= '/>' . "\n";
171
- break;
172
-
173
- case 'youtube_video':
174
- $output .= '<iframe allow="autoplay" frameborder="0" type="text/html" width="560" height="315"' . "\n" .
175
- 'class="cs-yt-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
176
- 'src="' . esc_url('https://www.youtube.com/embed/' . $element->video_id . '?enablejsapi=1') . '"' . "\n" .
177
- 'data-autoplay="' . $element->video_autoplay . '"' . "\n" .
178
- 'data-loop="' . $element->video_loop . '"' . "\n" .
179
- 'data-start-mute="' . $element->video_start_mute . '"' . "\n" .
180
- 'data-pause-while-watching="' . $element->video_pause_while_watching . '"' . "\n" .
181
- 'style="' . "\n" .
182
- 'z-index: ' . $element->z_index . ';' . "\n" .
183
- stripslashes($element->custom_css) . "\n" .
184
- '"' . "\n" .
185
- 'data-delay="' . $element->data_delay . '"' . "\n" .
186
- 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
187
- 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
188
- 'data-in="' . $element->data_in . '"' . "\n" .
189
- 'data-out="' . $element->data_out . '"' . "\n" .
190
- 'data-ignore-ease-out="' . $element->data_ignoreEaseOut . '"' . "\n" .
191
- 'data-top="' . $element->data_top . '"' . "\n" .
192
- 'data-left="' . $element->data_left . '"' . "\n" .
193
- 'data-time="' . $element->data_time . '"' . "\n" .
194
- '></iframe>' . "\n";
195
- break;
196
-
197
- case 'vimeo_video':
198
- $output .= '<iframe allow="autoplay" frameborder="0" width="560" height="315"' . "\n" .
199
- 'class="cs-vimeo-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
200
- 'src="' . esc_url('https://player.vimeo.com/video/' . $element->video_id . '?api=1') . '"' . "\n" .
201
- 'data-autoplay="' . esc_attr($element->video_autoplay) . '"' . "\n" .
202
- 'data-loop="' . esc_attr($element->video_loop) . '"' . "\n" .
203
- 'data-start-mute="' . $element->video_start_mute . '"' . "\n" .
204
- 'data-pause-while-watching="' . $element->video_pause_while_watching . '"' . "\n" .
205
- 'style="' . "\n" .
206
- 'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
207
- stripslashes($element->custom_css) . "\n" .
208
- '"' . "\n" .
209
- 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
210
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
211
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
212
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
213
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
214
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
215
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
216
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
217
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
218
- '></iframe>' . "\n";
219
- break;
220
- }
221
-
222
- if($element->link != '') {
223
- $output .= '</a>' . "\n";
224
- }
225
- }
226
-
227
- $output .= '</li>' . "\n";
228
- }
229
- $output .= '</ul>' . "\n";
230
- $output .= '</div>' . "\n";
231
-
232
- $output .= '<script type="text/javascript">' . "\n";
233
- $output .= '(function($) {' . "\n";
234
- $output .= '$(document).ready(function() {' . "\n";
235
- $output .= '$("#crellyslider-' . $uid . '").crellySlider({' . "\n";
236
- $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
237
- $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
238
- $output .= 'startWidth: ' . $slider->startWidth . ',' . "\n";
239
- $output .= 'startHeight: ' . $slider->startHeight . ',' . "\n";
240
- $output .= 'automaticSlide: ' . $slider->automaticSlide . ',' . "\n";
241
- $output .= 'showControls: ' . $slider->showControls . ',' . "\n";
242
- $output .= 'showNavigation: ' . $slider->showNavigation . ',' . "\n";
243
- $output .= 'enableSwipe: ' . $slider->enableSwipe . ',' . "\n";
244
- $output .= 'showProgressBar: ' . $slider->showProgressBar . ',' . "\n";
245
- $output .= 'pauseOnHover: ' . $slider->pauseOnHover . ',' . "\n";
246
- if($slider->randomOrder != NULL) {
247
- $output .= 'randomOrder: ' . $slider->randomOrder . ',' . "\n";
248
- }
249
- if($slider->startFromSlide != NULL) {
250
- $output .= 'startFromSlide: ' . $slider->startFromSlide . ',' . "\n";
251
- }
252
- $output .= stripslashes($slider->callbacks) . "\n";
253
- $output .= '});' . "\n";
254
- $output .= '});' . "\n";
255
- $output .= '})(jQuery);' . "\n";
256
- $output .= '</script>' . "\n";
257
-
258
- return $output;
259
- }
260
-
261
- }
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ // Code output
5
+ function crellySlider($alias) {
6
+ echo getCrellySlider($alias);
7
+ }
8
+
9
+ function getCrellySlider($alias) {
10
+ return CrellySliderFrontend::output($alias);
11
+ }
12
+
13
+ class CrellySliderFrontend {
14
+
15
+ public static function setNotAdminJs() {
16
+ add_action('wp_enqueue_scripts', 'CrellySliderFrontend::notAdminJs');
17
+ }
18
+
19
+ // Shortcode
20
+ public static function shortcode($atts) {
21
+ $a = shortcode_atts( array(
22
+ 'alias' => false,
23
+ ), $atts );
24
+
25
+ if(! $a['alias']) {
26
+ return __('You have to insert a valid alias in the shortcode', 'crelly-slider');
27
+ }
28
+ else {
29
+ return CrellySliderFrontend::output($a['alias']);
30
+ }
31
+ }
32
+
33
+ public static function addShortcode() {
34
+ add_shortcode('crellyslider', array( __CLASS__, 'shortcode'));
35
+ }
36
+
37
+ public static function output($alias) {
38
+ global $wpdb;
39
+
40
+ // Check if the slider exists
41
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE alias = %s', esc_sql($alias)));
42
+ if(! $slider) {
43
+ return __('The slider hasn\'t been found', 'crelly-slider');
44
+ }
45
+
46
+ // Generate a unique ID for each slider. This is needed because we might want to display the same slider on the same page more than once.
47
+ // The first slider of the page will have id="crellyslider-theSliderID". All the others will have id="crellyslider-theSliderID-aRandomString"
48
+ static $loadedSliders = array();
49
+ $uid = $slider->id;
50
+ if(in_array($slider->id, $loadedSliders)) {
51
+ $uid .= '-' . uniqid();
52
+ }
53
+ else {
54
+ array_push($loadedSliders, $slider->id);
55
+ }
56
+
57
+ // Get the slider. Return if now() is not between from/to dates
58
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE NOW() BETWEEN fromDate AND toDate AND alias=%s', esc_sql($alias)));
59
+ if(! $slider) {
60
+ return '';
61
+ }
62
+
63
+ $slider_id = esc_sql($slider->id);
64
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE draft = 0 AND slider_parent = %d ORDER BY position', $slider_id));
65
+
66
+ $output = '';
67
+
68
+ $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . ' crellyslider-' . esc_attr($slider_id) . '" id="crellyslider-' . $uid . '">' . "\n";
69
+ $output .= '<ul>' . "\n";
70
+ foreach($slides as $slide) {
71
+ $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . CrellySliderCommon::getURL($slide->background_type_image) . '\');';
72
+ $output .= '<li' . "\n" .
73
+ 'style="' . "\n" .
74
+ 'background-color: ' . esc_attr($slide->background_type_color) . ';' . "\n" .
75
+ 'background-image: ' . $background_type_image . "\n" .
76
+ 'background-position: ' . esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y) . ';' . "\n" .
77
+ 'background-repeat: ' . esc_attr($slide->background_repeat) . ';' . "\n" .
78
+ 'background-size: ' . esc_attr($slide->background_propriety_size) . ';' . "\n" .
79
+ stripslashes($slide->custom_css) . "\n" .
80
+ '"' . "\n" .
81
+
82
+ 'data-in="' . esc_attr($slide->data_in) . '"' . "\n" .
83
+ 'data-ease-in="' . esc_attr($slide->data_easeIn) . '"' . "\n" .
84
+ 'data-out="' . esc_attr($slide->data_out) . '"' . "\n" .
85
+ 'data-ease-out="' . esc_attr($slide->data_easeOut) . '"' . "\n" .
86
+ 'data-time="' . esc_attr($slide->data_time) . '"' . "\n" .
87
+ '>' . "\n";
88
+
89
+ if($slide->link != '') {
90
+ if($slide->link_new_tab) {
91
+ $output .= '<a class="cs-background-link" target="_blank" href="' . stripslashes($slide->link) . '"></a>';
92
+ }
93
+ else {
94
+ $output .= '<a class="cs-background-link" href="' . stripslashes($slide->link) . '"></a>';
95
+ }
96
+ }
97
+
98
+ $slide_parent = esc_sql($slide->position);
99
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND slide_parent = %d', $slider_id, $slide_parent));
100
+
101
+ foreach($elements as $element) {
102
+ if($element->link != '') {
103
+ $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
104
+
105
+ $output .= '<a' . "\n" .
106
+ 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
107
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
108
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
109
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
110
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
111
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
112
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
113
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
114
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
115
+ 'href="' . stripslashes($element->link) . '"' . "\n" .
116
+ $target . "\n" .
117
+ 'style="' .
118
+ 'z-index: ' . $element->z_index . ';' . "\n" .
119
+ '">' . "\n";
120
+ }
121
+
122
+ switch($element->type) {
123
+ case 'text':
124
+ $output .= '<div' . "\n" .
125
+ 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
126
+ 'style="';
127
+ if($element->link == '') {
128
+ $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
129
+ }
130
+ $output .= stripslashes($element->custom_css) . "\n" .
131
+ '"' . "\n";
132
+ if($element->link == '') {
133
+ $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
134
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
135
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
136
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
137
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
138
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
139
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
140
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
141
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
142
+ }
143
+ $output .= '>' .
144
+ stripslashes($element->inner_html) .
145
+ '</div>' . "\n";
146
+ break;
147
+
148
+ case 'image':
149
+ $output .= '<img' . "\n" .
150
+ 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
151
+ 'src="' . CrellySliderCommon::getURL($element->image_src) . '"' . "\n" .
152
+ 'alt="' . esc_attr($element->image_alt) . '"' . "\n" .
153
+ 'style="' . "\n";
154
+ if($element->link == '') {
155
+ $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
156
+ }
157
+ $output .= stripslashes($element->custom_css) . "\n" .
158
+ '"' . "\n";
159
+ if($element->link == '') {
160
+ $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
161
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
162
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
163
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
164
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
165
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
166
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
167
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
168
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
169
+ }
170
+ $output .= '/>' . "\n";
171
+ break;
172
+
173
+ case 'youtube_video':
174
+ $output .= '<iframe allow="autoplay" frameborder="0" type="text/html" width="560" height="315"' . "\n" .
175
+ 'class="cs-yt-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
176
+ 'src="' . esc_url('https://www.youtube.com/embed/' . $element->video_id . '?enablejsapi=1') . '"' . "\n" .
177
+ 'data-autoplay="' . $element->video_autoplay . '"' . "\n" .
178
+ 'data-loop="' . $element->video_loop . '"' . "\n" .
179
+ 'data-start-mute="' . $element->video_start_mute . '"' . "\n" .
180
+ 'data-pause-while-watching="' . $element->video_pause_while_watching . '"' . "\n" .
181
+ 'style="' . "\n" .
182
+ 'z-index: ' . $element->z_index . ';' . "\n" .
183
+ stripslashes($element->custom_css) . "\n" .
184
+ '"' . "\n" .
185
+ 'data-delay="' . $element->data_delay . '"' . "\n" .
186
+ 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
187
+ 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
188
+ 'data-in="' . $element->data_in . '"' . "\n" .
189
+ 'data-out="' . $element->data_out . '"' . "\n" .
190
+ 'data-ignore-ease-out="' . $element->data_ignoreEaseOut . '"' . "\n" .
191
+ 'data-top="' . $element->data_top . '"' . "\n" .
192
+ 'data-left="' . $element->data_left . '"' . "\n" .
193
+ 'data-time="' . $element->data_time . '"' . "\n" .
194
+ '></iframe>' . "\n";
195
+ break;
196
+
197
+ case 'vimeo_video':
198
+ $output .= '<iframe allow="autoplay" frameborder="0" width="560" height="315"' . "\n" .
199
+ 'class="cs-vimeo-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
200
+ 'src="' . esc_url('https://player.vimeo.com/video/' . $element->video_id . '?api=1') . '"' . "\n" .
201
+ 'data-autoplay="' . esc_attr($element->video_autoplay) . '"' . "\n" .
202
+ 'data-loop="' . esc_attr($element->video_loop) . '"' . "\n" .
203
+ 'data-start-mute="' . $element->video_start_mute . '"' . "\n" .
204
+ 'data-pause-while-watching="' . $element->video_pause_while_watching . '"' . "\n" .
205
+ 'style="' . "\n" .
206
+ 'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
207
+ stripslashes($element->custom_css) . "\n" .
208
+ '"' . "\n" .
209
+ 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
210
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
211
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
212
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
213
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
214
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
215
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
216
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
217
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
218
+ '></iframe>' . "\n";
219
+ break;
220
+ }
221
+
222
+ if($element->link != '') {
223
+ $output .= '</a>' . "\n";
224
+ }
225
+ }
226
+
227
+ $output .= '</li>' . "\n";
228
+ }
229
+ $output .= '</ul>' . "\n";
230
+ $output .= '</div>' . "\n";
231
+
232
+ $output .= '<script type="text/javascript">' . "\n";
233
+ $output .= '(function($) {' . "\n";
234
+ $output .= '$(document).ready(function() {' . "\n";
235
+ $output .= '$("#crellyslider-' . $uid . '").crellySlider({' . "\n";
236
+ $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
237
+ $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
238
+ $output .= 'startWidth: ' . $slider->startWidth . ',' . "\n";
239
+ $output .= 'startHeight: ' . $slider->startHeight . ',' . "\n";
240
+ $output .= 'automaticSlide: ' . $slider->automaticSlide . ',' . "\n";
241
+ $output .= 'showControls: ' . $slider->showControls . ',' . "\n";
242
+ $output .= 'showNavigation: ' . $slider->showNavigation . ',' . "\n";
243
+ $output .= 'enableSwipe: ' . $slider->enableSwipe . ',' . "\n";
244
+ $output .= 'showProgressBar: ' . $slider->showProgressBar . ',' . "\n";
245
+ $output .= 'pauseOnHover: ' . $slider->pauseOnHover . ',' . "\n";
246
+ if($slider->randomOrder != NULL) {
247
+ $output .= 'randomOrder: ' . $slider->randomOrder . ',' . "\n";
248
+ }
249
+ if($slider->startFromSlide != NULL) {
250
+ $output .= 'startFromSlide: ' . $slider->startFromSlide . ',' . "\n";
251
+ }
252
+ $output .= stripslashes($slider->callbacks) . "\n";
253
+ $output .= '});' . "\n";
254
+ $output .= '});' . "\n";
255
+ $output .= '})(jQuery);' . "\n";
256
+ $output .= '</script>' . "\n";
257
+
258
+ return $output;
259
+ }
260
+
261
+ }
wordpress/helpers.php CHANGED
@@ -1,71 +1,71 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- class CrellySliderHelpers {
5
- // Removes a directory and its content
6
- public static function delTree($dir) {
7
- $files = array_diff(scandir($dir), array('.','..'));
8
- foreach ($files as $file) {
9
- (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
10
- }
11
- return rmdir($dir);
12
- }
13
-
14
- public static function setNonce($sliderID) {
15
- global $wpdb;
16
-
17
- $nonce = self::randomString(10);
18
-
19
- $replace = $wpdb->replace(
20
- $wpdb->prefix . 'crellyslider_nonces',
21
- array(
22
- 'slider_id' => $sliderID,
23
- 'nonce' => $nonce,
24
- ),
25
- array(
26
- '%d',
27
- '%s',
28
- )
29
- );
30
-
31
- if($replace) {
32
- return $nonce;
33
- }
34
- return false;
35
- }
36
-
37
- public static function getNonce($sliderID) {
38
- global $wpdb;
39
-
40
- $table_name = $wpdb->prefix . 'crellyslider_nonces';
41
-
42
- $nonce = $wpdb->get_var($wpdb->prepare("SELECT nonce FROM $table_name WHERE slider_id=%d", $sliderID));
43
- if($nonce == null) {
44
- return self::setNonce($sliderID);
45
- }
46
- return $nonce;
47
- }
48
-
49
- public static function verifyNonce($sliderID, $nonce) {
50
- global $wpdb;
51
- $table_name = $wpdb->prefix . 'crellyslider_nonces';
52
- $dbNonce = $wpdb->get_var($wpdb->prepare("SELECT nonce FROM $table_name WHERE slider_id=%d", $sliderID));
53
- return $nonce === $dbNonce;
54
- }
55
-
56
- public static function removeNonce($sliderID) {
57
- global $wpdb;
58
- return $wpdb->delete( $wpdb->prefix . 'crellyslider_nonces', array( 'slider_id' => $sliderID ), array( '%d' ) );
59
- }
60
-
61
- public static function randomString($length) {
62
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
63
- $charactersLength = strlen($characters);
64
- $randomString = '';
65
- for ($i = 0; $i < $length; $i++) {
66
- $randomString .= $characters[rand(0, $charactersLength - 1)];
67
- }
68
- return $randomString;
69
- }
70
- }
71
  ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class CrellySliderHelpers {
5
+ // Removes a directory and its content
6
+ public static function delTree($dir) {
7
+ $files = array_diff(scandir($dir), array('.','..'));
8
+ foreach ($files as $file) {
9
+ (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
10
+ }
11
+ return rmdir($dir);
12
+ }
13
+
14
+ public static function setNonce($sliderID) {
15
+ global $wpdb;
16
+
17
+ $nonce = self::randomString(10);
18
+
19
+ $replace = $wpdb->replace(
20
+ $wpdb->prefix . 'crellyslider_nonces',
21
+ array(
22
+ 'slider_id' => $sliderID,
23
+ 'nonce' => $nonce,
24
+ ),
25
+ array(
26
+ '%d',
27
+ '%s',
28
+ )
29
+ );
30
+
31
+ if($replace) {
32
+ return $nonce;
33
+ }
34
+ return false;
35
+ }
36
+
37
+ public static function getNonce($sliderID) {
38
+ global $wpdb;
39
+
40
+ $table_name = $wpdb->prefix . 'crellyslider_nonces';
41
+
42
+ $nonce = $wpdb->get_var($wpdb->prepare("SELECT nonce FROM $table_name WHERE slider_id=%d", $sliderID));
43
+ if($nonce == null) {
44
+ return self::setNonce($sliderID);
45
+ }
46
+ return $nonce;
47
+ }
48
+
49
+ public static function verifyNonce($sliderID, $nonce) {
50
+ global $wpdb;
51
+ $table_name = $wpdb->prefix . 'crellyslider_nonces';
52
+ $dbNonce = $wpdb->get_var($wpdb->prepare("SELECT nonce FROM $table_name WHERE slider_id=%d", $sliderID));
53
+ return $nonce === $dbNonce;
54
+ }
55
+
56
+ public static function removeNonce($sliderID) {
57
+ global $wpdb;
58
+ return $wpdb->delete( $wpdb->prefix . 'crellyslider_nonces', array( 'slider_id' => $sliderID ), array( '%d' ) );
59
+ }
60
+
61
+ public static function randomString($length) {
62
+ $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
63
+ $charactersLength = strlen($characters);
64
+ $randomString = '';
65
+ for ($i = 0; $i < $length; $i++) {
66
+ $randomString .= $characters[rand(0, $charactersLength - 1)];
67
+ }
68
+ return $randomString;
69
+ }
70
+ }
71
  ?>
wordpress/home.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- global $wpdb;
5
- $sliders = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders');
6
-
7
- if(!$sliders) {
8
- echo '<div class="cs-no-sliders">';
9
- _e('No Sliders found. Please add a new one.', 'crelly-slider');
10
- echo '</div>';
11
- echo '<br /><br />';
12
- }
13
- else {
14
- ?>
15
-
16
- <table class="cs-sliders-list cs-table">
17
- <thead>
18
- <tr>
19
- <th colspan="5"><?php _e('Sliders List', 'crelly-slider'); ?></th>
20
- </tr>
21
- </thead>
22
- <tbody>
23
- <tr class="cs-table-header">
24
- <td><?php _e('ID', 'crelly-slider'); ?></td>
25
- <td><?php _e('Name', 'crelly-slider'); ?></td>
26
- <td><?php _e('Alias', 'crelly-slider'); ?></td>
27
- <td><?php _e('Shortcode', 'crelly-slider'); ?></td>
28
- <td><?php _e('Actions', 'crelly-slider'); ?></td>
29
- </tr>
30
- <?php
31
- foreach($sliders as $slider) {
32
- echo '<tr>';
33
- echo '<td class="cs-slider-id">' . esc_html($slider->id) . '</td>';
34
- echo '<td class="cs-slider-name"><a href="?page=crellyslider&view=edit&id=' . esc_html($slider->id) . '">' . esc_html($slider->name) . '</a></td>';
35
- echo '<td class="cs-slider-alias">' . esc_html($slider->alias) . '</td>';
36
- echo '<td class="cs-slider-shortcode">[crellyslider alias="' . esc_html($slider->alias) . '"]</td>';
37
- echo '<td>
38
- <a class="cs-edit-slider cs-button cs-button cs-is-success" href="?page=crellyslider&view=edit&id=' . esc_html($slider->id) . '">' . __('Edit Slider', 'crelly-slider') . '</a>
39
- <a class="cs-duplicate-slider cs-button cs-button cs-is-primary" href="javascript:void(0)" data-duplicate="' . esc_html($slider->id) . '">' . __('Duplicate Slider', 'crelly-slider') . '</a>
40
- <a class="cs-export-slider cs-button cs-button cs-is-warning" href="javascript:void(0)" data-export="' . esc_html($slider->id) . '">' . __('Export Slider', 'crelly-slider') . '</a>
41
- <a class="cs-delete-slider cs-button cs-button cs-is-danger" href="javascript:void(0)" data-delete="' . esc_html($slider->id) . '">' . __('Delete Slider', 'crelly-slider') . '</a>
42
- </td>';
43
- echo '</tr>';
44
- }
45
- ?>
46
- </tbody>
47
- </table>
48
- <?php
49
- }
50
- ?>
51
-
52
- <br />
53
- <a class="cs-button cs-is-primary cs-add-slider" href="?page=crellyslider&view=add"><?php _e('Add Slider', 'crelly-slider'); ?></a>
54
- <a class="cs-button cs-is-warning cs-import-slider" href="javascript:void(0)"><?php _e('Import Slider', 'crelly-slider'); ?></a>
55
- <input id="cs-import-file" type="file" style="display: none;">
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ global $wpdb;
5
+ $sliders = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders');
6
+
7
+ if(!$sliders) {
8
+ echo '<div class="cs-no-sliders">';
9
+ _e('No Sliders found. Please add a new one.', 'crelly-slider');
10
+ echo '</div>';
11
+ echo '<br /><br />';
12
+ }
13
+ else {
14
+ ?>
15
+
16
+ <table class="cs-sliders-list cs-table">
17
+ <thead>
18
+ <tr>
19
+ <th colspan="5"><?php _e('Sliders List', 'crelly-slider'); ?></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <tr class="cs-table-header">
24
+ <td><?php _e('ID', 'crelly-slider'); ?></td>
25
+ <td><?php _e('Name', 'crelly-slider'); ?></td>
26
+ <td><?php _e('Alias', 'crelly-slider'); ?></td>
27
+ <td><?php _e('Shortcode', 'crelly-slider'); ?></td>
28
+ <td><?php _e('Actions', 'crelly-slider'); ?></td>
29
+ </tr>
30
+ <?php
31
+ foreach($sliders as $slider) {
32
+ echo '<tr>';
33
+ echo '<td class="cs-slider-id">' . esc_html($slider->id) . '</td>';
34
+ echo '<td class="cs-slider-name"><a href="?page=crellyslider&view=edit&id=' . esc_html($slider->id) . '">' . esc_html($slider->name) . '</a></td>';
35
+ echo '<td class="cs-slider-alias">' . esc_html($slider->alias) . '</td>';
36
+ echo '<td class="cs-slider-shortcode">[crellyslider alias="' . esc_html($slider->alias) . '"]</td>';
37
+ echo '<td>
38
+ <a class="cs-edit-slider cs-button cs-button cs-is-success" href="?page=crellyslider&view=edit&id=' . esc_html($slider->id) . '">' . __('Edit Slider', 'crelly-slider') . '</a>
39
+ <a class="cs-duplicate-slider cs-button cs-button cs-is-primary" href="javascript:void(0)" data-duplicate="' . esc_html($slider->id) . '">' . __('Duplicate Slider', 'crelly-slider') . '</a>
40
+ <a class="cs-export-slider cs-button cs-button cs-is-warning" href="javascript:void(0)" data-export="' . esc_html($slider->id) . '">' . __('Export Slider', 'crelly-slider') . '</a>
41
+ <a class="cs-delete-slider cs-button cs-button cs-is-danger" href="javascript:void(0)" data-delete="' . esc_html($slider->id) . '">' . __('Delete Slider', 'crelly-slider') . '</a>
42
+ </td>';
43
+ echo '</tr>';
44
+ }
45
+ ?>
46
+ </tbody>
47
+ </table>
48
+ <?php
49
+ }
50
+ ?>
51
+
52
+ <br />
53
+ <a class="cs-button cs-is-primary cs-add-slider" href="?page=crellyslider&view=add"><?php _e('Add Slider', 'crelly-slider'); ?></a>
54
+ <a class="cs-button cs-is-warning cs-import-slider" href="javascript:void(0)"><?php _e('Import Slider', 'crelly-slider'); ?></a>
55
+ <input id="cs-import-file" type="file" style="display: none;">
wordpress/js/admin.js CHANGED
@@ -1,1846 +1,1846 @@
1
- /************************/
2
- /** EXTERNAL RESOURCES **/
3
- /************************/
4
-
5
- // An improved jQuery clone function that fixes some jQuery issues. https://github.com/spencertipping/jquery.fix.clone
6
- // The function has been renamed and modified a bit to prevent compatibility issues
7
- (function (original) {
8
- jQuery.fn.crellyslider_betterClone = function () {
9
- var result = original.apply(this, arguments),
10
- my_textareas = this.find('textarea').add(this.filter('textarea')),
11
- result_textareas = result.find('textarea').add(result.filter('textarea')),
12
- my_selects = this.find('select').add(this.filter('select')),
13
- result_selects = result.find('select').add(result.filter('select'));
14
-
15
- for (var i = 0, l = my_textareas.length; i < l; ++i) jQuery(result_textareas[i]).val(jQuery(my_textareas[i]).val());
16
- for (var i = 0, l = my_selects.length; i < l; ++i) {
17
- for (var j = 0, m = my_selects[i].options.length; j < m; ++j) {
18
- if (my_selects[i].options[j].selected === true) {
19
- result_selects[i].options[j].selected = true;
20
- }
21
- }
22
- }
23
- return result;
24
- };
25
- }) (jQuery.fn.clone);
26
-
27
- /*************/
28
- /** BACKEND **/
29
- /*************/
30
-
31
- (function($) {
32
- $(window).load(function() {
33
-
34
- // Simulate keyup. Useful when textboxes change value
35
- function crellyslider_keyup(element) {
36
- $(element).trigger('keyup');
37
- }
38
-
39
- // Slider settings and slide tabs
40
- $('#cs-show-slider-settings').click(function() {
41
- $('#cs-slider-settings').fadeIn();
42
- $('#cs-slides').hide();
43
- });
44
- $('#cs-show-slides').click(function() {
45
- $('#cs-slides').fadeIn();
46
- $('#cs-slider-settings').hide();
47
- });
48
-
49
- // Run draggables
50
- crellyslider_draggableElements();
51
-
52
- function crellyslider_showSuccess() {
53
- $('.cs-admin .cs-message').css('display', 'none');
54
-
55
- var target = $('.cs-admin .cs-message.cs-message-ok');
56
- target.css({
57
- 'display' : 'block',
58
- 'opacity' : 0,
59
- });
60
- target.animate({
61
- 'opacity' : 1,
62
- }, 300)
63
- .delay(2000)
64
- .animate({
65
- 'opacity' : 0,
66
- }, 300, function() {
67
- target.css('display', 'none');
68
- });
69
- }
70
-
71
- function crellyslider_showError() {
72
- $('.cs-admin .cs-message').css('display', 'none');
73
-
74
- var target = $('.cs-admin .cs-message.cs-message-error');
75
- target.css({
76
- 'display' : 'block',
77
- 'opacity' : 0,
78
- });
79
- target.animate({
80
- 'opacity' : 1,
81
- }, 300)
82
- .delay(2000)
83
- .animate({
84
- 'opacity' : 0,
85
- }, 300, function() {
86
- target.css('display', 'none');
87
- });
88
- }
89
-
90
- function crellyslider_showWait() {
91
- $('.cs-admin .cs-message').css('display', 'none');
92
-
93
- var target = $('.cs-admin .cs-message.cs-message-wait');
94
-
95
- var untouchedMessage = target.text().split('.').join('');
96
- target.text(untouchedMessage);
97
-
98
- target.css({
99
- 'display' : 'block',
100
- 'opacity' : 1,
101
- });
102
-
103
- if(typeof crellyslider_showWait.dotsTimer != 'undefined' ) {
104
- clearInterval(crellyslider_showWait.dotsTimer);
105
- }
106
- var dots = 0;
107
- crellyslider_showWait.dotsTimer = setInterval(function() {
108
- if(dots == 3) {
109
- dots = 0;
110
- target.text(untouchedMessage);
111
- return;
112
- }
113
- target.text(target.text() + '.');
114
- dots++;
115
- }, 300);
116
- }
117
-
118
- /*************/
119
- /** SLIDERS **/
120
- /*************/
121
-
122
- // Set Alias
123
- $('.cs-slider').find('#cs-slider-name').keyup(function() {
124
- var alias = crellyslider_getAlias();
125
- $('.cs-slider').find('#cs-slider-alias').text(alias);
126
- });
127
-
128
- // Set shortcode
129
- $('.cs-slider').find('#cs-slider-name').keyup(function() {
130
- var alias = crellyslider_getAlias();
131
- var shortcode = '';
132
- shortcode += '[crellyslider alias="';
133
- shortcode += alias;
134
- shortcode += '"]';
135
- if(alias != '') {
136
- $('.cs-slider').find('#cs-slider-shortcode').text(shortcode);
137
- }
138
- else {
139
- $('.cs-slider').find('#cs-slider-shortcode').text('');
140
- }
141
- });
142
-
143
- // Set the new sizes of the editing area and of the slider if changing values
144
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').keyup(function() {
145
- crellyslider_setSlidesEditingAreaSizes();
146
- });
147
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').keyup(function() {
148
- crellyslider_setSlidesEditingAreaSizes();
149
- });
150
-
151
- // Get the alias starting form the name
152
- function crellyslider_getAlias() {
153
- var slider_name = $('.cs-slider').find('#cs-slider-name').val();
154
- var slider_alias = slider_name.toLowerCase();
155
- slider_alias = slider_alias.replace(/ /g, '_');
156
- return slider_alias;
157
- }
158
-
159
- // Init from/to datepickers
160
- jQuery.datetimepicker.setLocale(crellyslider_locale.substring(0, crellyslider_locale.indexOf('_'))); // If locale does not exists, datetimepicker defaults to English
161
- $('.cs-slider-datepicker').datetimepicker({
162
- format:'Y-m-d H:i',
163
- });
164
-
165
- $('#cs-slider-displayImmediately').on('change', function() {
166
- if(this.checked) {
167
- $('#cs-slider-displayFromWrapper').hide();
168
- }
169
- else{
170
- $('#cs-slider-displayFromWrapper').show();
171
- }
172
- });
173
- $('#cs-slider-displayForever').on('change', function() {
174
- if(this.checked) {
175
- $('#cs-slider-displayToWrapper').hide();
176
- }
177
- else{
178
- $('#cs-slider-displayToWrapper').show();
179
- }
180
- });
181
-
182
- /************/
183
- /** SLIDES **/
184
- /************/
185
-
186
- var slides_number = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length - 1;
187
-
188
- // Run sortable
189
- var slide_before; // Contains the index before the sorting
190
- var slide_after; // Contains the index after the sorting
191
- $('.cs-slide-tabs .cs-sortable').sortable({
192
- items: 'li:not(.ui-state-disabled)',
193
- cancel: '.ui-state-disabled',
194
- connectWith: '.cs-slide-tabs .cs-sortable',
195
- containment: 'parent',
196
- placeholder: 'sortable-placeholder',
197
-
198
- start: function(event, ui) {
199
- // Store the current index
200
- slide_before = $(ui.item).index();
201
-
202
- ui.placeholder.height(ui.helper.height() - 1);
203
- ui.placeholder.width(ui.helper.width() - 1);
204
- },
205
-
206
- // Change the .cs-slide order based on the new index and rename the tabs
207
- update: function(event, ui) {
208
- // Store the new index
209
- slide_after = $(ui.item).index();
210
-
211
- // Change the slide position
212
- var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_before + ')');
213
- var after = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_after + ')');
214
- if(slide_before < slide_after) {
215
- slide.insertAfter(after);
216
- }
217
- else {
218
- slide.insertBefore(after);
219
- }
220
-
221
- // Rename all the tabs
222
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').each(function() {
223
- var temp = $(this);
224
- if(!temp.find('a').hasClass('cs-add-new')) {
225
- temp.find('a').html('<span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (temp.index() + 1) + '</span></span>');
226
- }
227
- });
228
- }
229
- });
230
- $('.cs-slide-tabs .cs-sortable li').disableSelection();
231
-
232
- // Show the slide when clicking on the link
233
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li > a').live('click', function() {
234
- crellyslider_deselectElements();
235
-
236
- // Do only if is not click add new
237
- if($(this).parent().index() != slides_number) {
238
- // Stop previews
239
- $('.cs-admin #cs-slides .cs-slide .cs-elements .cs-elements-actions .cs-live-preview').each(function() {
240
- var btn = $(this);
241
- var slide_parent = btn.closest('.cs-slide');
242
-
243
- if(btn.hasClass('cs-live-preview-running')) {
244
- btn.removeClass('cs-live-preview-running');
245
- btn.text(crellyslider_translations.slide_live_preview);
246
- crellyslider_stopLivePreview(slide_parent);
247
- }
248
- });
249
-
250
- // Hide all tabs
251
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
252
- var tab = $(this).parent().index();
253
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + tab + ')').css('display', 'block');
254
-
255
- // Active class
256
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
257
- $(this).parent().addClass('active');
258
- }
259
- });
260
-
261
- // Add new
262
- function crellyslider_addSlide() {
263
- var add_btn = $('.cs-admin #cs-slides .cs-add-new');
264
-
265
- var void_slide = $('.cs-admin #cs-slides .cs-void-slide').html();
266
- // Insert the link at the end of the list
267
- add_btn.parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
268
- // jQuery UI tabs are not working here. For now, just use a manual created tab
269
- $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
270
- // Create the slide
271
- $('.cs-admin #cs-slides .cs-slides-list').append('<div class="cs-slide">' + void_slide + '</div>');
272
- slides_number++;
273
-
274
- // Open the tab just created
275
- var tab_index = add_btn.parent().index() - 1;
276
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).find('a').click();
277
-
278
- // Active class
279
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
280
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).addClass('active');
281
-
282
- // Set editing area sizes
283
- crellyslider_setSlidesEditingAreaSizes();
284
-
285
- crellyslider_slidesColorPicker();
286
-
287
- // Update "start from slide" in the slider settings
288
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
289
- }
290
-
291
- // Add new on click
292
- $('.cs-admin #cs-slides .cs-add-new').click(function() {
293
- crellyslider_addSlide();
294
- });
295
- // Also add a new slide if slides_number == 0
296
- if(slides_number == 0) {
297
- crellyslider_addSlide();
298
- // Start from first slide by default, unless the user specifically picked random order
299
- if(!$('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=-1]').is('[selected]')) {
300
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').val('0');
301
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=0]').attr('selected', 'selected');
302
- }
303
- }
304
- else {
305
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
306
- }
307
-
308
- // Delete
309
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-close').live('click', function() {
310
- if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length <= 2) {
311
- alert(crellyslider_translations.slide_delete_just_one);
312
- return;
313
- }
314
-
315
- var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
316
- if(!confirm) {
317
- return;
318
- }
319
-
320
- slides_number--;
321
-
322
- var slide_index = $(this).parent().index();
323
-
324
- // If is deleting the current viewing slide, set the first as active
325
- if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(slide_index).hasClass('active') && slides_number != 0) {
326
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).addClass('active');
327
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
328
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(0).css('display', 'block');
329
- }
330
-
331
- // Remove the anchor
332
- $(this).parent().remove();
333
- // Remove the slide itself
334
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index).remove();
335
-
336
- // Scale back all the slides text
337
- for(var i = slide_index; i < slides_number; i++) {
338
- var slide = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(i);
339
- var indx = parseInt(slide.find('.cs-slide-index').text());
340
- slide.find('.cs-slide-index').text(indx - 1);
341
- }
342
-
343
- // Update "start from slide" in the slider settings
344
- if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').val() >= slides_number) { console.log("sdfsd")
345
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').val('0');
346
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=0]').attr('selected', 'selected');
347
- }
348
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
349
- });
350
-
351
- // Duplicate
352
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-duplicate').live('click', function() {
353
- var slide_index = $(this).parent().index();
354
- var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index);
355
-
356
- // Clone the slide settings table
357
- slide.crellyslider_betterClone(true, false).appendTo(slide.parent()).css('display', 'none');
358
-
359
- // Fix TinyMCE
360
- slide.parent().last().find('.cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').each(function() {
361
- var cloned_options = $(this);
362
-
363
- cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
364
- cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
365
- crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
366
- });
367
-
368
- // Add a new color picker, then remove the old one
369
- crellyslider_slidesColorPicker();
370
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slides_number).find('.wp-picker-container > .wp-color-result').eq(0).remove();
371
-
372
- // Insert the link at the end of the list
373
- $(this).parent().parent().find('.cs-add-new').parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
374
- $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
375
-
376
- crellyslider_draggableElements();
377
-
378
- slides_number++;
379
-
380
- // Update "start from slide" in the slider settings
381
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
382
- });
383
-
384
- // Set correct size for the editing area
385
- function crellyslider_setSlidesEditingAreaSizes() {
386
- var width = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val());
387
- var height = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val());
388
-
389
- $('.cs-admin #cs-slides .cs-slide .cs-slide-editing-area').css({
390
- 'width' : width,
391
- 'height' : height,
392
- });
393
-
394
- $('.cs-admin').css({
395
- 'width' : width,
396
- });
397
- }
398
-
399
- crellyslider_slidesColorPicker();
400
-
401
- // Run background color picker
402
- function crellyslider_slidesColorPicker() {
403
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input').wpColorPicker({
404
- // a callback to fire whenever the color changes to a valid color
405
- change: function(event, ui){
406
- var btn = $(this);
407
- if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"]:checked').val() != '1') {
408
- btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"][value="1"]:radio').prop('checked', true);
409
- }
410
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
411
- area.css('background-color', ui.color.toString());
412
- },
413
- // a callback to fire when the input is emptied or an invalid color
414
- clear: function() {},
415
- // hide the color picker controls on load
416
- hide: true,
417
- // show a group of common colors beneath the square
418
- // or, supply an array of colors to customize further
419
- palettes: true
420
- });
421
- }
422
-
423
- // Set background color (transparent == 0, color-picker == 1 or manual == 2). For backward compatiblity, a "-1" is used to indicate that there were no way to set the bg color manually
424
- $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_color"]:radio', function() {
425
- var btn = $(this);
426
- var btn_val = btn.val();
427
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
428
-
429
- if(btn_val == '0') {
430
- area.css('background-color', '#fff');
431
- }
432
- else if(btn_val == '1') {
433
- var color_picker_value = btn.closest('.cs-content').find('.wp-color-result').css('background-color');
434
- area.css('background-color', color_picker_value);
435
- }
436
- else {
437
- area.css('background-color', btn.closest('.cs-content').find('.cs-slide-background_type_color-manual').val());
438
- }
439
- });
440
-
441
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-manual', function() {
442
- var text = $(this);
443
- var val = text.val();
444
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
445
-
446
- text.closest('.cs-slide').find('input[name="cs-slide-background_type_color"][value="2"]:radio').prop('checked', true);
447
- area.css('background-color', val);
448
- });
449
-
450
- // Set background image (none or image)
451
- $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_image"]:radio', function() {
452
- var btn = $(this);
453
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
454
-
455
- if(btn.val() == '0') {
456
- area.css('background-image', 'none');
457
- }
458
- else {
459
- var slide_parent = $(this).closest('.cs-slide');
460
- crellyslider_addSlideImageBackground(slide_parent);
461
- }
462
- });
463
-
464
- // Set Background image (the upload function)
465
- $('.cs-admin #cs-slides').on('click', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_image-upload-button', function() {
466
- var btn = $(this);
467
- if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]:checked').val() == '1') {
468
- var slide_parent = $(this).closest('.cs-slide');
469
- crellyslider_addSlideImageBackground(slide_parent);
470
- }
471
- else {
472
- btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]').prop('checked', true);
473
- var slide_parent = $(this).closest('.cs-slide');
474
- crellyslider_addSlideImageBackground(slide_parent);
475
- }
476
- });
477
- function crellyslider_addSlideImageBackground(slide_parent) {
478
- var area = slide_parent.find('.cs-slide-editing-area');
479
-
480
- // Upload
481
- var file_frame;
482
-
483
- // If the media frame already exists, reopen it.
484
- if ( file_frame ) {
485
- file_frame.open();
486
- return;
487
- }
488
-
489
- // Create the media frame.
490
- file_frame = wp.media.frames.file_frame = wp.media({
491
- title: jQuery( this ).data( 'uploader_title' ),
492
- button: {
493
- text: jQuery( this ).data( 'uploader_button_text' ),
494
- },
495
- multiple: false // Set to true to allow multiple files to be selected
496
- });
497
-
498
- // When an image is selected, run a callback.
499
- file_frame.on( 'select', function() {
500
- // We set multiple to false so only get one image from the uploader
501
- attachment = file_frame.state().get('selection').first().toJSON();
502
-
503
- // Do something with attachment.id and/or attachment.url here
504
- var image_src = attachment.url;
505
- var image_alt = attachment.alt;
506
- var image_id = attachment.id;
507
-
508
- // Set background
509
- area.css('background-image', 'url("' + image_src + '")');
510
-
511
- // Data that we'll store into the database
512
- area.data('background-image-src', image_id);
513
- });
514
-
515
- // Finally, open the modal
516
- file_frame.open();
517
- }
518
-
519
- // Background propriety: repeat or no-repeat
520
- $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_repeat"]:radio', function() {
521
- var btn = $(this);
522
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
523
-
524
- if(btn.val() == '0') {
525
- area.css('background-repeat', 'no-repeat');
526
- }
527
- else {
528
- area.css('background-repeat', 'repeat');
529
- }
530
- });
531
-
532
- // Background propriety: positions x and y
533
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_x', function() {
534
- var text = $(this);
535
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
536
-
537
- var x = text.val();
538
- var y = text.parent().find('.cs-slide-background_propriety_position_y').val();
539
-
540
- area.css('background-position', x + ' ' + y);
541
- });
542
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_y', function() {
543
- var text = $(this);
544
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
545
-
546
- var x = text.parent().find('.cs-slide-background_propriety_position_x').val();
547
- var y = text.val();
548
-
549
- area.css('background-position', x + ' ' + y);
550
- });
551
-
552
- // Background propriety: size
553
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_size', function() {
554
- var text = $(this);
555
- var val = text.val();
556
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
557
-
558
- area.css('background-size', val);
559
- });
560
-
561
- // Background presets
562
- $('.cs-slide-background-image-fullwidth-preset').click(function() {
563
- var text = $(this);
564
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
565
- var settings = text.closest('.cs-slide');
566
-
567
- settings.find('.cs-slide-background_propriety_position_x').val('center');
568
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
569
-
570
- settings.find('.cs-slide-background_propriety_position_y').val('center');
571
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
572
-
573
- settings.find('input[name="cs-slide-background_repeat"][value="0"]').prop('checked', true);
574
- area.css('background-repeat', 'no-repeat');
575
-
576
- settings.find('.cs-slide-background_propriety_size').val('cover');
577
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
578
- });
579
-
580
- $('.cs-slide-background-image-pattern-preset').click(function() {
581
- var text = $(this);
582
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
583
- var settings = text.closest('.cs-slide');
584
-
585
- settings.find('.cs-slide-background_propriety_position_x').val(0);
586
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
587
-
588
- settings.find('.cs-slide-background_propriety_position_y').val(0);
589
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
590
-
591
- settings.find('input[name="cs-slide-background_repeat"][value="1"]').prop('checked', true);
592
- area.css('background-repeat', 'repeat');
593
-
594
- settings.find('.cs-slide-background_propriety_size').val('auto');
595
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
596
- });
597
-
598
- // Apply custom CSS
599
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-custom_css', function() {
600
- var text = $(this);
601
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
602
- var css = text.val();
603
-
604
- // Save current styles
605
- var width = area.css('width');
606
- var height = area.css('height');
607
- var background_image = area.css('background-image');
608
- var background_color = area.css('background-color');
609
- var background_position = area.css('background-position');
610
- var background_repeat = area.css('background-repeat');
611
- var background_size = area.css('background-size');
612
-
613
- // Apply CSS
614
- area.attr('style', css);
615
- area.css({
616
- 'width' : width,
617
- 'height' : height,
618
- 'background-image' : background_image,
619
- 'background-color' : background_color,
620
- 'background-position' : background_position,
621
- 'background-repeat' : background_repeat,
622
- 'background-size' : background_size
623
- });
624
- });
625
-
626
- /**************/
627
- /** ELEMENTS **/
628
- /**************/
629
-
630
- // GENERAL
631
-
632
- // Make draggable
633
- function crellyslider_draggableElements() {
634
- $('.cs-admin .cs-elements .cs-element').draggable({
635
- 'containment' : 'parent',
636
-
637
- start: function() {
638
- // Select when dragging
639
- crellyslider_selectElement($(this));
640
- },
641
-
642
- drag: function(){
643
- // Set left and top positions on drag to the textbox
644
- var position = $(this).position();
645
- var left = position.left;
646
- var top = position.top;
647
- var index = $(this).index();
648
-
649
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
650
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
651
- },
652
- });
653
- }
654
-
655
- // Selects an element, shows its options and makes the delete element button available
656
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-slide-editing-area .cs-element', function(e) {
657
- // Do not click the editing-area
658
- e.stopPropagation();
659
-
660
- // Do not open links
661
- e.preventDefault();
662
-
663
- crellyslider_selectElement($(this));
664
- });
665
- function crellyslider_selectElement(element) {
666
- var index = element.index();
667
- var slide = element.closest('.cs-slide');
668
- var options = slide.find('.cs-elements .cs-elements-list');
669
-
670
- // Hide all options - .active class
671
- options.find('.cs-element-settings').css('display', 'none');
672
- options.find('.cs-element-settings').removeClass('active');
673
-
674
- // Show the correct options + .active class
675
- options.find('.cs-element-settings:eq(' + index + ')').css('display', 'block');
676
- options.find('.cs-element-settings:eq(' + index + ')').addClass('active');
677
-
678
- // Add .active class to the element in the editing area
679
- element.parent().children().removeClass('active');
680
- element.addClass('active');
681
-
682
- // Make the delete and the duplicate buttons working
683
- slide.find('.cs-elements-actions .cs-delete-element').removeClass('cs-is-disabled');
684
- slide.find('.cs-elements-actions .cs-duplicate-element').removeClass('cs-is-disabled');
685
- }
686
-
687
- // Deselect elements
688
- $('.cs-admin').on('click', '.cs-slide .cs-elements .cs-slide-editing-area', function() {
689
- crellyslider_deselectElements();
690
- });
691
- function crellyslider_deselectElements() {
692
- $('.cs-admin .cs-slide .cs-elements .cs-slide-editing-area .cs-element').removeClass('active');
693
- $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').removeClass('active');
694
- $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').css('display', 'none');
695
-
696
- // Hide delete and duplicate element btns
697
- $('.cs-admin .cs-slide .cs-elements-actions .cs-delete-element').addClass('cs-is-disabled');
698
- $('.cs-admin .cs-slide .cs-elements-actions .cs-duplicate-element').addClass('cs-is-disabled');
699
- }
700
-
701
- // Delete element. Remember that the button should be enabled / disabled somewhere else
702
- function crellyslider_deleteElement(element) {
703
- var index = element.index();
704
- var slide_parent = element.closest('.cs-slide');
705
-
706
- element.remove();
707
- var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
708
- element_options.remove();
709
- crellyslider_deselectElements();
710
- }
711
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-delete-element', function() {
712
- // Click only if an element is selected
713
- if($(this).hasClass('.cs-is-disabled')) {
714
- return;
715
- }
716
-
717
- var slide_parent = $(this).closest('.cs-slide');
718
- var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
719
- crellyslider_deleteElement(element);
720
- });
721
-
722
- function crellyslider_duplicateElement(element) {
723
- var index = element.index();
724
- var slide_parent = element.closest('.cs-slide');
725
-
726
- element.clone().appendTo(element.parent()).css({
727
- 'left' : '+=10',
728
- 'top' : '+=10',
729
- });
730
- var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
731
- element_options.crellyslider_betterClone(true).insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
732
-
733
- crellyslider_deselectElements();
734
- crellyslider_selectElement(element.parent().find('.cs-element').last());
735
-
736
- var cloned_options = element.parent().find('.cs-element').last().closest('.cs-slide').find('.cs-elements-list .cs-element-settings.active');
737
-
738
- // Move the element 10 pixels away
739
- cloned_options.find('.cs-element-data_left').val(parseInt(element_options.find('.cs-element-data_left').val()) + 10);
740
- cloned_options.find('.cs-element-data_top').val(parseInt(element_options.find('.cs-element-data_top').val()) + 10);
741
-
742
- // If it's a text, fix TinyMCE
743
- if(cloned_options.hasClass('cs-text-element-settings')) {
744
- cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
745
- cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
746
- crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
747
- }
748
-
749
- // Make draggable
750
- crellyslider_draggableElements();
751
- }
752
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-duplicate-element', function() {
753
- // Click only if an element is selected
754
- if($(this).hasClass('.cs-is-disabled')) {
755
- return;
756
- }
757
-
758
- var slide_parent = $(this).closest('.cs-slide');
759
- var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
760
- crellyslider_duplicateElement(element);
761
- });
762
-
763
- // Modify left position
764
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_left', function() {
765
- var index = $(this).closest('.cs-element-settings').index();
766
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', parseFloat($(this).val()));
767
- });
768
-
769
- // Center horizontally
770
- $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-x', function() {
771
- var index = $(this).closest('.cs-element-settings').index();
772
- var left = parseInt(($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val() / 2) - (parseFloat($(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').width()) / 2));
773
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
774
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
775
- });
776
-
777
- // Modify top position
778
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_top', function() {
779
- var index = $(this).closest('.cs-element-settings').index();
780
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', parseFloat($(this).val()));
781
- });
782
-
783
- // Center vertically
784
- $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-y', function() {
785
- var index = $(this).closest('.cs-element-settings').index();
786
- var top = parseInt(($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val() / 2) - (parseFloat($(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').height()) / 2));
787
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
788
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
789
- });
790
-
791
- // Modify z-index
792
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-z_index', function() {
793
- var index = $(this).closest('.cs-element-settings').index();
794
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
795
- });
796
-
797
- // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
798
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
799
- crellyslider_editElementsLink($(this));
800
- });
801
- $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link_new_tab', function() {
802
- var textbox = $(this).parent().find('.cs-element-link');
803
- crellyslider_editElementsLink(textbox);
804
- });
805
-
806
- // Wrap - unwrap elements with an <a href="" target="">
807
- function crellyslider_editElementsLink(textbox_link) {
808
- var index = textbox_link.closest('.cs-element-settings').index();
809
- var copy_attributes = false;
810
- var reapply_css = false;
811
-
812
- if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
813
- // Remove custom css classes
814
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
815
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
816
-
817
- var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
818
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
819
- copy_attributes = true;
820
- reapply_css = true;
821
- }
822
- else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
823
- var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
824
-
825
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
826
-
827
- if(link_new_tab) {
828
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
829
- }
830
- else {
831
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
832
- }
833
-
834
- copy_attributes = false;
835
- }
836
- else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
837
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('class', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('class')).removeClass('ui-draggable');
838
-
839
- // Reapply CSS and custom CSS
840
- applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
841
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('top', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('top'));
842
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('left', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('left'));
843
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('z-index', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('z-index'));
844
-
845
- // Reapply custom css classes
846
- crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
847
-
848
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
849
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
850
- copy_attributes = false;
851
- }
852
-
853
- if(copy_attributes) {
854
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').parent().attr('style', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style'));
855
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').parent().attr('class', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('class')).removeClass('ui-draggable');
856
-
857
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
858
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
859
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
860
- }
861
-
862
- crellyslider_draggableElements();
863
-
864
- if(reapply_css) {
865
- applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
866
- crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
867
- }
868
- }
869
-
870
- // Apply custom CSS
871
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
872
- applyCustomCss($(this));
873
- });
874
-
875
- function applyCustomCss(textarea) {
876
- var index = textarea.closest('.cs-element-settings').index();
877
- // Save current positions
878
- var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
879
- var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
880
- var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
881
-
882
- // Apply CSS
883
- if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
884
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
885
- }
886
- else {
887
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('style', textarea.val());
888
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction').removeAttr('style');
889
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeAttr('style');
890
- }
891
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
892
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
893
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
894
- }
895
-
896
- // Add custom CSS classes
897
- $('.cs-admin').on('keydown', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
898
- var textarea = $(this);
899
- var index = textarea.closest('.cs-element-settings').index();
900
-
901
- if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
902
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textarea.val());
903
- }
904
- else {
905
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textarea.val());
906
- var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
907
- avoid_interaction.removeAttr('class');
908
- avoid_interaction.addClass('cs-avoid-interaction');
909
- }
910
- });
911
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
912
- crellyslider_applyCustomCssClasses($(this));
913
- });
914
- function crellyslider_applyCustomCssClasses(textarea) {
915
- var index = textarea.closest('.cs-element-settings').index();
916
-
917
- if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
918
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').addClass(textarea.val());
919
- }
920
- else {
921
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').addClass(textarea.val());
922
- var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
923
- avoid_interaction.removeAttr('class');
924
- avoid_interaction.addClass('cs-avoid-interaction');
925
- }
926
- }
927
-
928
- // TEXT ELEMENTS
929
-
930
- // Convert textareas to WP editors
931
- $('.cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-element-inner_html').each(function() {
932
- var textarea = $(this);
933
-
934
- if(textarea.closest('.cs-text-element-settings').hasClass('cs-void-text-element-settings')) {
935
- return; // It means "continue;"
936
- }
937
-
938
- crellyslider_convertToWPEditor(textarea);
939
- });
940
-
941
- // Converts a textarea to something similar to wp_editor()
942
- function crellyslider_convertToWPEditor(textarea) {
943
- // Static counter: generates a new ID for each editor
944
- if(crellyslider_convertToWPEditor.static_counter == undefined) {
945
- crellyslider_convertToWPEditor.static_counter = 0;
946
- }
947
- else {
948
- crellyslider_convertToWPEditor.static_counter++;
949
- }
950
-
951
- textarea.attr('id', 'cs-element-editor-' + crellyslider_convertToWPEditor.static_counter);
952
-
953
- var settings = crellyslider_tinyMCEInit;
954
-
955
- settings.selector = '#cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter);
956
- settings.body_class = ('cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter) + ' locale-' + crellyslider_locale).toLowerCase();
957
- settings.setup = function(editor) {
958
- editor.on("KeyUp ExecCommand ContextMenu Change", function(e) {
959
- editor.save();
960
- crellyslider_triggerTinyMCE(editor.id);
961
- });
962
-
963
- editor.on("init", function() {
964
- // Set default CSS
965
- this.getDoc().body.style.fontSize = "14px";
966
- this.getDoc().body.style.fontFamily = "Verdana";
967
-
968
- // Insert switch button
969
- textarea.parent().prepend('<div class="cs-switch-editor"><div onclick="tinyMCE.execCommand(\'mceToggleEditor\', false, \'' + editor.id + '\')" class="cs-button cs-is-default cs-tinymce">' + crellyslider_translations.switch_editor + '</div></div>');
970
- });
971
- };
972
-
973
- if(typeof tinyMCE != 'undefined') {
974
- tinyMCE.init(settings);
975
- }
976
- }
977
-
978
- // When the user modifies the text in the TinyMCE editor, apply the changes to the preview area
979
- function crellyslider_triggerTinyMCE(editor_id) {
980
- crellyslider_changeText(jQuery('#' + editor_id));
981
- }
982
-
983
- // Add text click
984
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-text-element', function() {
985
- var slide_parent = $(this).closest('.cs-slide');
986
- crellyslider_addTextElement(slide_parent);
987
- });
988
-
989
- // Add text. Receives the slide as object
990
- function crellyslider_addTextElement(slide_parent) {
991
- var area = slide_parent.find('.cs-slide-editing-area');
992
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
993
- var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
994
-
995
- // Insert in editing area
996
- area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
997
-
998
- // Insert the options
999
- settings_div.before(settings);
1000
-
1001
- // Make draggable
1002
- crellyslider_draggableElements();
1003
-
1004
- // Convert textarea to WP editor
1005
- crellyslider_convertToWPEditor(slide_parent.find('.cs-elements .cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').last().find('.cs-element-inner_html'));
1006
-
1007
- // Display settings
1008
- crellyslider_selectElement(area.find('.cs-element').last());
1009
- }
1010
-
1011
- // Modify text
1012
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
1013
- crellyslider_changeText($(this));
1014
- });
1015
- crellyslider_changeText = function crellyslider_changeText(element) {
1016
- var index = element.closest('.cs-element-settings').index();
1017
- var text_element = element.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1018
-
1019
- if(! text_element.is('a')) {
1020
- text_element.html(element.val());
1021
-
1022
- text_element.css('width', '');
1023
- text_element.css('height', '');
1024
- }
1025
- else {
1026
- text_element.find('> div').html(element.val());
1027
-
1028
- text_element.find('> div').css('width', '');
1029
- text_element.find('> div').css('height', '');
1030
- }
1031
- }
1032
-
1033
- // IMAGE ELEMENTS
1034
-
1035
- // Add images click
1036
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-image-element', function() {
1037
- var slide_parent = $(this).closest('.cs-slide');
1038
- crellyslider_addImageElement(slide_parent);
1039
- });
1040
-
1041
- // Upload click
1042
- $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-image-element-settings .cs-image-element-upload-button', function() {
1043
- var slide_parent = $(this).closest('.cs-slide');
1044
- crellySliderUploadImageElement(slide_parent);
1045
- });
1046
-
1047
- // Add image. Receives the slide as object
1048
- function crellyslider_addImageElement(slide_parent) {
1049
- var area = slide_parent.find('.cs-slide-editing-area');
1050
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1051
- var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1052
-
1053
- // Temporarily insert an element with no src and alt
1054
- // Add the image into the editing area.
1055
- area.append('<img class="cs-element cs-image-element" src="nothing_now.jpg" style="z-index: 1;" />');
1056
-
1057
- // Insert the options
1058
- settings_div.before(settings);
1059
-
1060
- // Make draggable
1061
- crellyslider_draggableElements();
1062
-
1063
- // Display settings
1064
- crellyslider_selectElement(area.find('.cs-element').last());
1065
-
1066
- // Upload
1067
- crellySliderUploadImageElement(slide_parent);
1068
- }
1069
-
1070
- function crellySliderUploadImageElement(slide_parent) {
1071
- var area = slide_parent.find('.cs-slide-editing-area');
1072
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1073
- var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1074
-
1075
- var file_frame;
1076
-
1077
- // If the media frame already exists, reopen it.
1078
- if ( file_frame ) {
1079
- file_frame.open();
1080
- return;
1081
- }
1082
-
1083
- // Create the media frame.
1084
- file_frame = wp.media.frames.file_frame = wp.media({
1085
- title: jQuery( this ).data( 'uploader_title' ),
1086
- button: {
1087
- text: jQuery( this ).data( 'uploader_button_text' ),
1088
- },
1089
- multiple: false // Set to true to allow multiple files to be selected
1090
- });
1091
-
1092
- // When an image is selected, run a callback.
1093
- file_frame.on( 'select', function() {
1094
- // We set multiple to false so only get one image from the uploader
1095
- attachment = file_frame.state().get('selection').first().toJSON();
1096
-
1097
- // Do something with attachment.id and/or attachment.url here
1098
- var image_src = attachment.url;
1099
- var image_alt = attachment.alt;
1100
- var attachment_id = attachment.id;
1101
-
1102
- // Set attributes. If is a link, do the right thing
1103
- var image = area.find('.cs-image-element.active').last();
1104
-
1105
- if(! image.is('a')) {
1106
- image.attr('src', image_src);
1107
- image.attr('alt', image_alt);
1108
- }
1109
- else {
1110
- image.find('> img').attr('src', image_src);
1111
- image.find('> img').attr('alt', image_alt);
1112
- }
1113
-
1114
- // Set data (will be used in the ajax call)
1115
- settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', attachment_id);
1116
- settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
1117
- });
1118
-
1119
- // Finally, open the modal
1120
- file_frame.open();
1121
- }
1122
-
1123
- // VIDEO ELEMENTS
1124
-
1125
- // Add video click
1126
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-video-element', function() {
1127
- var slide_parent = $(this).closest('.cs-slide');
1128
- crellyslider_addVideoElement(slide_parent);
1129
- });
1130
-
1131
- // Adds a video container. Receives the slide as object
1132
- function crellyslider_addVideoElement(slide_parent) {
1133
- var area = slide_parent.find('.cs-slide-editing-area');
1134
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1135
- var settings = '<div class="cs-element-settings cs-video-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-video-element-settings').html() + '</div>';
1136
-
1137
- // Insert in editing area
1138
- area.append('<div class="cs-element cs-video-element" style="z-index: 1;"></div>');
1139
-
1140
- // Insert the options
1141
- settings_div.before(settings);
1142
-
1143
- // Make draggable
1144
- crellyslider_draggableElements();
1145
-
1146
- // Display settings
1147
- crellyslider_selectElement(area.find('.cs-element').last());
1148
-
1149
- // Select youtube video as default
1150
- area.find('.cs-element').last().closest('.cs-slide').find('.cs-elements .cs-elements-list .cs-element-video_src').trigger('change');
1151
- }
1152
-
1153
- // Change video id
1154
- $('.cs-admin').on('change keyup input', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_id', function() {
1155
- var index = $(this).closest('.cs-element-settings').index();
1156
- var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1157
-
1158
- crellyslider_changeVideo($(this), element, $(this).parent().find('.cs-element-video_src').val(), $(this).val());
1159
- });
1160
- // Change video source
1161
- $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_src', function() {
1162
- var index = $(this).closest('.cs-element-settings').index();
1163
- var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1164
-
1165
- crellyslider_changeVideo($(this), element, $(this).val(), $(this).parent().find('.cs-element-video_id').val());
1166
- });
1167
- function crellyslider_changeVideo(input, element, source, video_id) {
1168
- if(source == 'youtube') {
1169
- element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-yt-iframe" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/' + video_id + '?enablejsapi=1" frameborder="0"></iframe>');
1170
- }
1171
- else {
1172
- element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-vimeo-iframe" src="https://player.vimeo.com/video/' + video_id + '?api=1" width="560" height="315" frameborder="0" ></iframe>');
1173
- }
1174
-
1175
- // Re-apply custom CSS and custom CSS classes
1176
- crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css'));
1177
- crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
1178
- }
1179
-
1180
- /******************/
1181
- /** LIVE PREVIEW **/
1182
- /******************/
1183
-
1184
- // Live preview click
1185
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-live-preview', function() {
1186
- var btn = $(this);
1187
- var slide_parent = btn.closest('.cs-slide');
1188
-
1189
- if(! btn.hasClass('cs-live-preview-running')) {
1190
- btn.addClass('cs-live-preview-running');
1191
- btn.text(crellyslider_translations.slide_stop_preview);
1192
- crellyslider_startLivePreview(slide_parent);
1193
- }
1194
- else {
1195
- btn.removeClass('cs-live-preview-running');
1196
- btn.text(crellyslider_translations.slide_live_preview);
1197
- crellyslider_stopLivePreview(slide_parent);
1198
- }
1199
- });
1200
-
1201
- function crellyslider_startLivePreview(slide_parent) {
1202
- crellyslider_deselectElements();
1203
-
1204
- var area = slide_parent.find('.cs-slide-editing-area');
1205
-
1206
- area.clone().addClass('cs-slide-live-preview-area').insertAfter(area);
1207
- var prev = slide_parent.find('.cs-slide-live-preview-area');
1208
-
1209
- area.css('display', 'none');
1210
-
1211
- // Set elements data and styles
1212
- var elements = prev.find('.cs-element');
1213
- var original_elements = area.closest('.cs-slide').find('.cs-elements .cs-element-settings');
1214
- var i = 0;
1215
- elements.each(function() {
1216
- var element = $(this);
1217
-
1218
- // Video elements settings only
1219
- var html_class = false;
1220
- if(element.find('.cs-yt-iframe').length > 0) {
1221
- element.find('.cs-avoid-interaction').remove();
1222
- element = element.find('.cs-yt-iframe');
1223
- element.unwrap();
1224
- element.attr({
1225
- 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1226
- 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1227
- 'data-start-mute' : parseInt(original_elements.eq(i).find('.cs-element-video_start_mute').val()),
1228
- 'data-pause-while-watching' : parseInt(original_elements.eq(i).find('.cs-element-video_pause_while_watching').val()),
1229
- });
1230
- html_class = 'cs-yt-iframe';
1231
- }
1232
- else if(element.find('.cs-vimeo-iframe').length > 0) {
1233
- element.find('.cs-avoid-interaction').remove();
1234
- element = element.find('.cs-vimeo-iframe');
1235
- element.unwrap();
1236
- element.attr({
1237
- 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1238
- 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1239
- 'data-start-mute' : parseInt(original_elements.eq(i).find('.cs-element-video_start_mute').val()),
1240
- 'data-pause-while-watching' : parseInt(original_elements.eq(i).find('.cs-element-video_pause_while_watching').val()),
1241
- });
1242
- html_class = 'cs-vimeo-iframe';
1243
- }
1244
-
1245
- element.removeAttr('style');
1246
- element.attr('style', original_elements.eq(i).find('.cs-element-custom_css').val());
1247
- element.css({
1248
- 'z-index' : parseInt(original_elements.eq(i).find('.cs-element-z_index').val()),
1249
- 'display' : 'none',
1250
- });
1251
-
1252
- element.removeAttr('class');
1253
- element.addClass(original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1254
- if(html_class) {
1255
- element.addClass(html_class);
1256
- }
1257
-
1258
- element.attr({
1259
- 'data-left' : parseInt(original_elements.eq(i).find('.cs-element-data_left').val()),
1260
- 'data-top' : parseInt(original_elements.eq(i).find('.cs-element-data_top').val()),
1261
- 'data-delay' : parseInt(original_elements.eq(i).find('.cs-element-data_delay').val()),
1262
- 'data-time' : original_elements.eq(i).find('.cs-element-data_time').val(),
1263
- 'data-in' : original_elements.eq(i).find('.cs-element-data_in').val(),
1264
- 'data-out' : original_elements.eq(i).find('.cs-element-data_out').val(),
1265
- 'data-ignore-ease-out' : original_elements.eq(i).find('.cs-element-data_out').prop('checked') ? 1 : 0,
1266
- 'data-ease-in' : parseInt(original_elements.eq(i).find('.cs-element-data_easeIn').val()),
1267
- 'data-ease-out' : parseInt(original_elements.eq(i).find('.cs-element-data_easeOut').val()),
1268
- });
1269
-
1270
- i++;
1271
- });
1272
-
1273
- // Prepare HTML structure
1274
- prev.wrapInner('<li />');
1275
- prev.wrapInner('<ul />');
1276
-
1277
-
1278
- var slide = prev.find('ul > li');
1279
- var original_slide = area.closest('.cs-slide');
1280
- var content = original_slide.find('.cs-slide-settings-list');
1281
-
1282
- // Set slide link
1283
- if(content.find('.cs-background-link').val() != '') {
1284
- if(! content.find('.cs-background-link_new_tab').prop('checked')) {
1285
- slide.prepend('<a class="cs-background-link" href="' + content.find('.cs-background-link').val() + '"></a>');
1286
- }
1287
- else {
1288
- slide.prepend('<a class="cs-background-link" target="_blank" href="' + content.find('.cs-background-link').val() + '"></a>');
1289
- }
1290
- }
1291
-
1292
- // Set slide data and styles
1293
- slide.attr({
1294
- 'data-in' : content.find('.cs-slide-data_in').val(),
1295
- 'data-out' : content.find('.cs-slide-data_out').val(),
1296
- 'data-time' : parseInt(content.find('.cs-slide-data_time').val()),
1297
- 'data-ease-in' : parseInt(content.find('.cs-slide-data_easeIn').val()),
1298
- 'data-ease-out' : parseInt(content.find('.cs-slide-data_easeOut').val()),
1299
- });
1300
-
1301
- slide.attr('style', content.find('.cs-slide-custom_css').val());
1302
- slide.css({
1303
- 'background-image' : area.css('background-image') ,
1304
- 'background-color' : area.css('background-color') + "",
1305
- 'background-position' : content.find('.cs-slide-background_propriety_position_x').val() + ' ' + content.find('.cs-slide-background_propriety_position_y').val(),
1306
- 'background-repeat' : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1307
- 'background-size' : content.find('.cs-slide-background_propriety_size').val(),
1308
- });
1309
-
1310
- var slider = $('.cs-admin .cs-slider #cs-slider-settings');
1311
-
1312
- // Run Crelly Slider
1313
- prev.crellySlider({
1314
- 'layout' : 'fixed',
1315
- 'responsive' : false,
1316
- 'startWidth' : parseInt(slider.find('#cs-slider-startWidth').val()),
1317
- 'startHeight' : parseInt(slider.find('#cs-slider-startHeight').val()),
1318
-
1319
- 'automaticSlide' : true,
1320
- 'showControls' : false,
1321
- 'showNavigation' : false,
1322
- 'enableSwipe' : false,
1323
- 'showProgressBar' : false,
1324
- 'pauseOnHover' : false,
1325
- });
1326
-
1327
- // Warning: click on background links
1328
- $('.cs-slide-live-preview-area a').click(function(event) {
1329
- if($(this).prop('target') != '_blank') {
1330
- var confirm = window.confirm(crellyslider_translations.exit_without_saving);
1331
- if(! confirm) {
1332
- event.preventDefault();
1333
- }
1334
- }
1335
- });
1336
- }
1337
-
1338
- function crellyslider_stopLivePreview(slide_parent) {
1339
- var area = slide_parent.find('.cs-slide-editing-area');
1340
- var prev = slide_parent.find('.cs-slide-live-preview-area');
1341
-
1342
- prev.remove();
1343
- area.css('display', 'block');
1344
- }
1345
-
1346
- /****************/
1347
- /** AJAX CALLS **/
1348
- /****************/
1349
-
1350
- // Save or update the new slider in the database
1351
- $('.cs-admin .cs-slider .cs-save-settings').click(function() {
1352
- $('.cs-admin #cs-slides .cs-live-preview').each(function() {
1353
- var btn = $(this);
1354
- var slide_parent = btn.closest('.cs-slide');
1355
-
1356
- if(btn.hasClass('cs-live-preview-running')) {
1357
- btn.removeClass('cs-live-preview-running');
1358
- btn.text(crellyslider_translations.slide_live_preview);
1359
- crellyslider_stopLivePreview(slide_parent);
1360
- }
1361
- });
1362
-
1363
- crellyslider_saveSlider();
1364
- });
1365
-
1366
- // Delete slider
1367
- $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-delete-slider', function() {
1368
- var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
1369
- if(!confirm) {
1370
- return;
1371
- }
1372
-
1373
- crellyslider_deleteSlider($(this));
1374
- });
1375
-
1376
- // Duplicate slider
1377
- $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-duplicate-slider', function() {
1378
- crellyslider_duplicateSlider($(this));
1379
- });
1380
-
1381
- // Export slider
1382
- $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-export-slider', function() {
1383
- crellyslider_exportSlider($(this));
1384
- });
1385
-
1386
- // Import slider
1387
- $('.cs-admin .cs-home').on('click', '.cs-import-slider', function() {
1388
- $('#cs-import-file').trigger('click');
1389
- });
1390
- $('.cs-admin .cs-home').on('change', '#cs-import-file', function() {
1391
- crellyslider_importSlider();
1392
- });
1393
-
1394
- // Sends an array with the new or current slider options
1395
- function crellyslider_saveSlider() {
1396
- crellyslider_showWait();
1397
-
1398
- var content = $('.cs-admin .cs-slider #cs-slider-settings');
1399
- var options = {
1400
- id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
1401
- name : content.find('#cs-slider-name').val(),
1402
- alias : content.find('#cs-slider-alias').text(),
1403
- layout : content.find('#cs-slider-layout').val(),
1404
- responsive : parseInt(content.find('#cs-slider-responsive').val()),
1405
- startWidth : parseInt(content.find('#cs-slider-startWidth').val()),
1406
- startHeight : parseInt(content.find('#cs-slider-startHeight').val()),
1407
- automaticSlide : parseInt(content.find('#cs-slider-automaticSlide').val()),
1408
- showControls : parseInt(content.find('#cs-slider-showControls').val()),
1409
- showNavigation : parseInt(content.find('#cs-slider-showNavigation').val()),
1410
- enableSwipe : parseInt(content.find('#cs-slider-enableSwipe').val()),
1411
- showProgressBar : parseInt(content.find('#cs-slider-showProgressBar').val()),
1412
- pauseOnHover : parseInt(content.find('#cs-slider-pauseOnHover').val()),
1413
- randomOrder : parseInt(content.find('#cs-slider-randomOrder').val()),
1414
- startFromSlide : parseInt(content.find('#cs-slider-startFromSlide').val()),
1415
- fromDate : content.find('#cs-slider-displayImmediately').prop('checked') || content.find('#cs-slider-fromDate').val() == '' ? '1000-01-01 00:00:00' : content.find('#cs-slider-fromDate').val(),
1416
- toDate : content.find('#cs-slider-displayForever').prop('checked') || content.find('#cs-slider-toDate').val() == '' ? '9999-12-31 23:59:59' : content.find('#cs-slider-toDate').val(),
1417
- callbacks : content.find('#cs-slider-callbacks').val(),
1418
- };
1419
-
1420
- var sliderNonce;
1421
- if(typeof(crellyslider_currentSliderNonce) != "undefined") {
1422
- sliderNonce = crellyslider_currentSliderNonce;
1423
- }
1424
- else {
1425
- sliderNonce = crellyslider_nonces.addSlider;
1426
- }
1427
-
1428
- // Do the ajax call
1429
- jQuery.ajax({
1430
- type : 'POST',
1431
- dataType : 'json',
1432
- url : ajaxurl,
1433
- data : {
1434
- // Is it saving or updating?
1435
- action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1436
- security: sliderNonce,
1437
- datas : options,
1438
- },
1439
- success: function(response) {
1440
- //alert('Save slider response: ' + response);
1441
- // If adding a new slider, response will be the generated id, else will be the number of rows modified
1442
- if(response !== false) {
1443
- // If is adding a slider, redirect
1444
- if($('.cs-admin .cs-slider').hasClass('cs-add-slider')) {
1445
- window.location.href = '?page=crellyslider&view=edit&id=' + response;
1446
- return;
1447
- }
1448
-
1449
- crellyslider_saveSlides();
1450
- }
1451
- else {
1452
- crellyslider_showError();
1453
- }
1454
- },
1455
-
1456
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1457
- alert('Error saving slider');
1458
- console.log(XMLHttpRequest.responseText);
1459
- crellyslider_showError();
1460
- }
1461
- });
1462
- }
1463
-
1464
- // Sends an array with all the slides options
1465
- function crellyslider_saveSlides() {
1466
- var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1467
- var i = 0;
1468
- var final_options = {};
1469
-
1470
- final_options['options'] = new Array();
1471
- slides.each(function() {
1472
- var slide = $(this);
1473
- var content = slide.find('.cs-slide-settings-list');
1474
-
1475
- var background_type_color;
1476
- if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '0') {
1477
- background_type_color = 'transparent';
1478
- }
1479
- else if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '1') {
1480
- background_type_color = slide.find('.cs-slide-editing-area').css('background-color') + "";
1481
- }
1482
- else {
1483
- background_type_color = content.find('.cs-slide-background_type_color-manual').val();
1484
- }
1485
-
1486
- var options = {
1487
- slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1488
- position : i,
1489
-
1490
- draft : parseInt(content.find('.cs-slide-draft').val()),
1491
- background_type_image : slide.find('.cs-slide-editing-area').css('background-image') == 'none' ? 'none' : slide.find('.cs-slide-editing-area').data('background-image-src') + "",
1492
- background_type_color : background_type_color,
1493
- background_type_color_input : content.find('input[name="cs-slide-background_type_color"]:checked').val(),
1494
- background_propriety_position_x : content.find('.cs-slide-background_propriety_position_x').val(),
1495
- background_propriety_position_y : content.find('.cs-slide-background_propriety_position_y').val(),
1496
- background_repeat : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1497
- background_propriety_size : content.find('.cs-slide-background_propriety_size').val(),
1498
- data_in : content.find('.cs-slide-data_in').val(),
1499
- data_out : content.find('.cs-slide-data_out').val(),
1500
- data_time : parseInt(content.find('.cs-slide-data_time').val()),
1501
- data_easeIn : parseInt(content.find('.cs-slide-data_easeIn').val()),
1502
- data_easeOut : parseInt(content.find('.cs-slide-data_easeOut').val()),
1503
- link : slide.find('.cs-background-link').val(),
1504
- link_new_tab : slide.find('.cs-background-link_new_tab').prop('checked') ? 1 : 0,
1505
- custom_css : content.find('.cs-slide-custom_css').val(),
1506
- };
1507
-
1508
- final_options['options'][i] = options;
1509
-
1510
- i++;
1511
- });
1512
-
1513
- final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id')),
1514
-
1515
- // Do the ajax call
1516
- jQuery.ajax({
1517
- type : 'POST',
1518
- dataType : 'json',
1519
- url : ajaxurl,
1520
- data : {
1521
- action: 'crellyslider_editSlides',
1522
- security: crellyslider_currentSliderNonce,
1523
- datas : final_options,
1524
- },
1525
- success: function(response) {
1526
- //console.log('Save slides response: ' + response);
1527
- if(response !== false) {
1528
- crellyslider_saveElements();
1529
- }
1530
- else {
1531
- crellyslider_showError();
1532
- }
1533
- },
1534
-
1535
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1536
- alert('Error saving slides');
1537
- console.log(XMLHttpRequest.responseText);
1538
- crellyslider_showError();
1539
- }
1540
- });
1541
- }
1542
-
1543
- // Sends an array with all the elements options of each slide
1544
- function crellyslider_saveElements() {
1545
- var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1546
- var i = 0, j = 0;
1547
- var final_options = {};
1548
-
1549
- final_options['options'] = new Array();
1550
- slides.each(function() {
1551
- var slide = $(this);
1552
- var elements = slide.find('.cs-elements .cs-element-settings');
1553
-
1554
- elements.each(function() {
1555
- var element = $(this);
1556
-
1557
- // Stop each loop when reach the void element
1558
- if(element.hasClass('cs-void-element-settings')) {
1559
- return;
1560
- }
1561
-
1562
- // Get the type of the element
1563
- var type;
1564
- if(element.hasClass('cs-text-element-settings')) {
1565
- type = 'text';
1566
- }
1567
- else if(element.hasClass('cs-image-element-settings')) {
1568
- type = 'image';
1569
- }
1570
- else if(element.hasClass('cs-video-element-settings')) {
1571
- if(element.find('.cs-element-video_src').val() == 'youtube') {
1572
- type = 'youtube_video';
1573
- }
1574
- else {
1575
- type = 'vimeo_video';
1576
- }
1577
- }
1578
- else {
1579
- type = 'undefined';
1580
- }
1581
-
1582
- var options = {
1583
- slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1584
- slide_parent : i,
1585
- position : element.index(),
1586
- type : type,
1587
-
1588
- inner_html : element.hasClass('cs-text-element-settings') ? element.find('.cs-element-inner_html').val() : '',
1589
- image_src : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('src') : '',
1590
- image_alt : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('alt') : '',
1591
- data_left : parseInt(element.find('.cs-element-data_left').val()),
1592
- data_top : parseInt(element.find('.cs-element-data_top').val()),
1593
- z_index : parseInt(element.find('.cs-element-z_index').val()),
1594
- data_delay : parseInt(element.find('.cs-element-data_delay').val()),
1595
- data_time : element.find('.cs-element-data_time').val(),
1596
- data_in : element.find('.cs-element-data_in').val(),
1597
- data_out : element.find('.cs-element-data_out').val(),
1598
- data_ignoreEaseOut : element.find('.cs-element-data_ignoreEaseOut').prop('checked') ? 1 : 0,
1599
- data_easeIn : parseInt(element.find('.cs-element-data_easeIn').val()),
1600
- data_easeOut : parseInt(element.find('.cs-element-data_easeOut').val()),
1601
- custom_css : element.find('.cs-element-custom_css').val(),
1602
- custom_css_classes : element.find('.cs-element-custom_css_classes').val(),
1603
- link : element.hasClass('cs-video-element-settings') ? '' : element.find('.cs-element-link').val(),
1604
- link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1605
- video_id : element.hasClass('cs-video-element-settings') ? element.find('.cs-element-video_id').val() : '',
1606
- video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1607
- video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1608
- video_start_mute : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_start_mute').val()) : -1,
1609
- video_pause_while_watching : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_pause_while_watching').val()) : -1,
1610
- };
1611
-
1612
- final_options['options'][j] = options;
1613
-
1614
- j++;
1615
- });
1616
-
1617
- i++;
1618
- });
1619
-
1620
- // Proceed?
1621
- final_options['elements'] = 1;
1622
- if(final_options['options'].length == 0) {
1623
- final_options['elements'] = 0;
1624
- }
1625
-
1626
- final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1627
-
1628
- final_options['options'] = JSON.stringify(final_options['options']);
1629
-
1630
- // Do the ajax call
1631
- jQuery.ajax({
1632
- type : 'POST',
1633
- dataType : 'json',
1634
- url : ajaxurl,
1635
- data : {
1636
- action: 'crellyslider_editElements',
1637
- security: crellyslider_currentSliderNonce,
1638
- datas : final_options,
1639
- },
1640
- success: function(response) {
1641
- //console.log(response);
1642
- if(response !== false) {
1643
- crellyslider_currentSliderNonce = response;
1644
- crellyslider_showSuccess();
1645
- }
1646
- else {
1647
- crellyslider_showError();
1648
- }
1649
- },
1650
-
1651
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1652
- alert('Error saving elements');
1653
- console.log(XMLHttpRequest.responseText);
1654
- crellyslider_showError();
1655
- }
1656
- });
1657
- }
1658
-
1659
- function crellyslider_deleteSlider(content) {
1660
- crellyslider_showWait();
1661
-
1662
- // Get options
1663
- var options = {
1664
- id : parseInt(content.data('delete')),
1665
- };
1666
-
1667
- // Do the ajax call
1668
- jQuery.ajax({
1669
- type : 'POST',
1670
- dataType : 'json',
1671
- url : ajaxurl,
1672
- data : {
1673
- action: 'crellyslider_deleteSlider',
1674
- security: crellyslider_nonces.deleteSlider,
1675
- datas : options,
1676
- },
1677
- success: function(response) {
1678
- //alert('Delete slider response: ' + response);
1679
- if(response !== false) {
1680
- if($('.cs-sliders-list .cs-delete-slider').length > 1) {
1681
- content.parent().parent().remove();
1682
- }
1683
- else {
1684
- location.reload();
1685
- }
1686
- crellyslider_showSuccess();
1687
- }
1688
- else {
1689
- crellyslider_showError();
1690
- }
1691
- },
1692
-
1693
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1694
- alert('Error deleting slider');
1695
- console.log(XMLHttpRequest.responseText);
1696
- crellyslider_showError();
1697
- },
1698
- });
1699
- }
1700
-
1701
- function crellyslider_duplicateSlider(content) {
1702
- crellyslider_showWait();
1703
-
1704
- // Get options
1705
- var options = {
1706
- id : parseInt(content.data('duplicate')),
1707
- };
1708
-
1709
- // Do the ajax call
1710
- jQuery.ajax({
1711
- type : 'POST',
1712
- dataType : 'json',
1713
- url : ajaxurl,
1714
- data : {
1715
- action: 'crellyslider_duplicateSlider',
1716
- security: crellyslider_nonces.duplicateSlider,
1717
- datas : options,
1718
- },
1719
- success: function(response) {
1720
- //console.log(response);
1721
- if(response['response'] !== false) {
1722
- var cloned_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1723
- cloned_slider.find('.cs-slider-id').html(response['cloned_slider_id']);
1724
- cloned_slider.find('.cs-slider-name a').html(response['cloned_slider_name']);
1725
- cloned_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1726
- cloned_slider.find('.cs-slider-alias').html(response['cloned_slider_alias']);
1727
- cloned_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['cloned_slider_alias'] + '"]');
1728
- cloned_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1729
- cloned_slider.find('.cs-duplicate-slider').data('duplicate', response['cloned_slider_id']);
1730
- cloned_slider.find('.cs-delete-slider').data('delete', response['cloned_slider_id']);
1731
- cloned_slider.find('.cs-export-slider').data('export', response['cloned_slider_id']);
1732
-
1733
- crellyslider_showSuccess();
1734
- }
1735
- else {
1736
- crellyslider_showError();
1737
- }
1738
- },
1739
-
1740
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1741
- alert('Error duplicating slider');
1742
- console.log(XMLHttpRequest.responseText);
1743
- crellyslider_showError();
1744
- },
1745
- });
1746
- }
1747
-
1748
- function crellyslider_exportSlider(content) {
1749
- crellyslider_showWait();
1750
-
1751
- // Get options
1752
- var options = {
1753
- id : parseInt(content.data('export')),
1754
- };
1755
-
1756
- // Do the ajax call
1757
- jQuery.ajax({
1758
- type : 'POST',
1759
- dataType : 'json',
1760
- url : ajaxurl,
1761
- data : {
1762
- action: 'crellyslider_exportSlider',
1763
- security: crellyslider_nonces.exportSlider,
1764
- datas : options,
1765
- },
1766
- success: function(response) {
1767
- if(response['response'] !== false) {
1768
- window.location.href = response['url'];
1769
- crellyslider_showSuccess();
1770
- }
1771
- else {
1772
- crellyslider_showError();
1773
- }
1774
- },
1775
-
1776
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1777
- alert('Error while exporting the slider');
1778
- console.log(XMLHttpRequest.responseText);
1779
- crellyslider_showError();
1780
- },
1781
- });
1782
- }
1783
-
1784
- function crellyslider_importSlider() {
1785
- var file = $('#cs-import-file')[0].files[0];
1786
-
1787
- if(! file) {
1788
- return;
1789
- }
1790
-
1791
- // Reset input file. Prevents conflicts
1792
- $('#cs-import-file').val('');
1793
-
1794
- crellyslider_showWait();
1795
-
1796
- // Form data (for file uploads)
1797
- var fd = new FormData();
1798
- fd.append('file', file);
1799
- fd.append('action', 'crellyslider_importSlider');
1800
- fd.append('security', crellyslider_nonces.importSlider);
1801
-
1802
- // Do the ajax call
1803
- jQuery.ajax({
1804
- type : 'POST',
1805
- url : ajaxurl,
1806
- contentType: false,
1807
- processData : false,
1808
- data : fd,
1809
- success: function(response) {
1810
- response = JSON.parse(response);
1811
- //console.log(response);
1812
- if(response['response'] !== false) {
1813
- var content = $('.cs-sliders-list .cs-duplicate-slider:eq(0)');
1814
- if(content.length > 0) {
1815
- var imported_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1816
- imported_slider.find('.cs-slider-id').html(response['imported_slider_id']);
1817
- imported_slider.find('.cs-slider-name a').html(response['imported_slider_name']);
1818
- imported_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1819
- imported_slider.find('.cs-slider-alias').html(response['imported_slider_alias']);
1820
- imported_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['imported_slider_alias'] + '"]');
1821
- imported_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1822
- imported_slider.find('.cs-duplicate-slider').data('duplicate', response['imported_slider_id']);
1823
- imported_slider.find('.cs-delete-slider').data('delete', response['imported_slider_id']);
1824
- imported_slider.find('.cs-delete-slider').data('export', response['imported_slider_id']);
1825
- }
1826
- else {
1827
- location.reload();
1828
- }
1829
-
1830
- crellyslider_showSuccess();
1831
- }
1832
- else {
1833
- crellyslider_showError();
1834
- }
1835
- },
1836
-
1837
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1838
- alert('Error while importing the slider');
1839
- console.log(XMLHttpRequest.responseText);
1840
- crellyslider_showError();
1841
- },
1842
- });
1843
- }
1844
-
1845
- });
1846
- })(jQuery);
1
+ /************************/
2
+ /** EXTERNAL RESOURCES **/
3
+ /************************/
4
+
5
+ // An improved jQuery clone function that fixes some jQuery issues. https://github.com/spencertipping/jquery.fix.clone
6
+ // The function has been renamed and modified a bit to prevent compatibility issues
7
+ (function (original) {
8
+ jQuery.fn.crellyslider_betterClone = function () {
9
+ var result = original.apply(this, arguments),
10
+ my_textareas = this.find('textarea').add(this.filter('textarea')),
11
+ result_textareas = result.find('textarea').add(result.filter('textarea')),
12
+ my_selects = this.find('select').add(this.filter('select')),
13
+ result_selects = result.find('select').add(result.filter('select'));
14
+
15
+ for (var i = 0, l = my_textareas.length; i < l; ++i) jQuery(result_textareas[i]).val(jQuery(my_textareas[i]).val());
16
+ for (var i = 0, l = my_selects.length; i < l; ++i) {
17
+ for (var j = 0, m = my_selects[i].options.length; j < m; ++j) {
18
+ if (my_selects[i].options[j].selected === true) {
19
+ result_selects[i].options[j].selected = true;
20
+ }
21
+ }
22
+ }
23
+ return result;
24
+ };
25
+ }) (jQuery.fn.clone);
26
+
27
+ /*************/
28
+ /** BACKEND **/
29
+ /*************/
30
+
31
+ (function($) {
32
+ $(window).load(function() {
33
+
34
+ // Simulate keyup. Useful when textboxes change value
35
+ function crellyslider_keyup(element) {
36
+ $(element).trigger('keyup');
37
+ }
38
+
39
+ // Slider settings and slide tabs
40
+ $('#cs-show-slider-settings').click(function() {
41
+ $('#cs-slider-settings').fadeIn();
42
+ $('#cs-slides').hide();
43
+ });
44
+ $('#cs-show-slides').click(function() {
45
+ $('#cs-slides').fadeIn();
46
+ $('#cs-slider-settings').hide();
47
+ });
48
+
49
+ // Run draggables
50
+ crellyslider_draggableElements();
51
+
52
+ function crellyslider_showSuccess() {
53
+ $('.cs-admin .cs-message').css('display', 'none');
54
+
55
+ var target = $('.cs-admin .cs-message.cs-message-ok');
56
+ target.css({
57
+ 'display' : 'block',
58
+ 'opacity' : 0,
59
+ });
60
+ target.animate({
61
+ 'opacity' : 1,
62
+ }, 300)
63
+ .delay(2000)
64
+ .animate({
65
+ 'opacity' : 0,
66
+ }, 300, function() {
67
+ target.css('display', 'none');
68
+ });
69
+ }
70
+
71
+ function crellyslider_showError() {
72
+ $('.cs-admin .cs-message').css('display', 'none');
73
+
74
+ var target = $('.cs-admin .cs-message.cs-message-error');
75
+ target.css({
76
+ 'display' : 'block',
77
+ 'opacity' : 0,
78
+ });
79
+ target.animate({
80
+ 'opacity' : 1,
81
+ }, 300)
82
+ .delay(2000)
83
+ .animate({
84
+ 'opacity' : 0,
85
+ }, 300, function() {
86
+ target.css('display', 'none');
87
+ });
88
+ }
89
+
90
+ function crellyslider_showWait() {
91
+ $('.cs-admin .cs-message').css('display', 'none');
92
+
93
+ var target = $('.cs-admin .cs-message.cs-message-wait');
94
+
95
+ var untouchedMessage = target.text().split('.').join('');
96
+ target.text(untouchedMessage);
97
+
98
+ target.css({
99
+ 'display' : 'block',
100
+ 'opacity' : 1,
101
+ });
102
+
103
+ if(typeof crellyslider_showWait.dotsTimer != 'undefined' ) {
104
+ clearInterval(crellyslider_showWait.dotsTimer);
105
+ }
106
+ var dots = 0;
107
+ crellyslider_showWait.dotsTimer = setInterval(function() {
108
+ if(dots == 3) {
109
+ dots = 0;
110
+ target.text(untouchedMessage);
111
+ return;
112
+ }
113
+ target.text(target.text() + '.');
114
+ dots++;
115
+ }, 300);
116
+ }
117
+
118
+ /*************/
119
+ /** SLIDERS **/
120
+ /*************/
121
+
122
+ // Set Alias
123
+ $('.cs-slider').find('#cs-slider-name').keyup(function() {
124
+ var alias = crellyslider_getAlias();
125
+ $('.cs-slider').find('#cs-slider-alias').text(alias);
126
+ });
127
+
128
+ // Set shortcode
129
+ $('.cs-slider').find('#cs-slider-name').keyup(function() {
130
+ var alias = crellyslider_getAlias();
131
+ var shortcode = '';
132
+ shortcode += '[crellyslider alias="';
133
+ shortcode += alias;
134
+ shortcode += '"]';
135
+ if(alias != '') {
136
+ $('.cs-slider').find('#cs-slider-shortcode').text(shortcode);
137
+ }
138
+ else {
139
+ $('.cs-slider').find('#cs-slider-shortcode').text('');
140
+ }
141
+ });
142
+
143
+ // Set the new sizes of the editing area and of the slider if changing values
144
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').keyup(function() {
145
+ crellyslider_setSlidesEditingAreaSizes();
146
+ });
147
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').keyup(function() {
148
+ crellyslider_setSlidesEditingAreaSizes();
149
+ });
150
+
151
+ // Get the alias starting form the name
152
+ function crellyslider_getAlias() {
153
+ var slider_name = $('.cs-slider').find('#cs-slider-name').val();
154
+ var slider_alias = slider_name.toLowerCase();
155
+ slider_alias = slider_alias.replace(/ /g, '_');
156
+ return slider_alias;
157
+ }
158
+
159
+ // Init from/to datepickers
160
+ jQuery.datetimepicker.setLocale(crellyslider_locale.substring(0, crellyslider_locale.indexOf('_'))); // If locale does not exists, datetimepicker defaults to English
161
+ $('.cs-slider-datepicker').datetimepicker({
162
+ format:'Y-m-d H:i',
163
+ });
164
+
165
+ $('#cs-slider-displayImmediately').on('change', function() {
166
+ if(this.checked) {
167
+ $('#cs-slider-displayFromWrapper').hide();
168
+ }
169
+ else{
170
+ $('#cs-slider-displayFromWrapper').show();
171
+ }
172
+ });
173
+ $('#cs-slider-displayForever').on('change', function() {
174
+ if(this.checked) {
175
+ $('#cs-slider-displayToWrapper').hide();
176
+ }
177
+ else{
178
+ $('#cs-slider-displayToWrapper').show();
179
+ }
180
+ });
181
+
182
+ /************/
183
+ /** SLIDES **/
184
+ /************/
185
+
186
+ var slides_number = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length - 1;
187
+
188
+ // Run sortable
189
+ var slide_before; // Contains the index before the sorting
190
+ var slide_after; // Contains the index after the sorting
191
+ $('.cs-slide-tabs .cs-sortable').sortable({
192
+ items: 'li:not(.ui-state-disabled)',
193
+ cancel: '.ui-state-disabled',
194
+ connectWith: '.cs-slide-tabs .cs-sortable',
195
+ containment: 'parent',
196
+ placeholder: 'sortable-placeholder',
197
+
198
+ start: function(event, ui) {
199
+ // Store the current index
200
+ slide_before = $(ui.item).index();
201
+
202
+ ui.placeholder.height(ui.helper.height() - 1);
203
+ ui.placeholder.width(ui.helper.width() - 1);
204
+ },
205
+
206
+ // Change the .cs-slide order based on the new index and rename the tabs
207
+ update: function(event, ui) {
208
+ // Store the new index
209
+ slide_after = $(ui.item).index();
210
+
211
+ // Change the slide position
212
+ var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_before + ')');
213
+ var after = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_after + ')');
214
+ if(slide_before < slide_after) {
215
+ slide.insertAfter(after);
216
+ }
217
+ else {
218
+ slide.insertBefore(after);
219
+ }
220
+
221
+ // Rename all the tabs
222
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').each(function() {
223
+ var temp = $(this);
224
+ if(!temp.find('a').hasClass('cs-add-new')) {
225
+ temp.find('a').html('<span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (temp.index() + 1) + '</span></span>');
226
+ }
227
+ });
228
+ }
229
+ });
230
+ $('.cs-slide-tabs .cs-sortable li').disableSelection();
231
+
232
+ // Show the slide when clicking on the link
233
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li > a').live('click', function() {
234
+ crellyslider_deselectElements();
235
+
236
+ // Do only if is not click add new
237
+ if($(this).parent().index() != slides_number) {
238
+ // Stop previews
239
+ $('.cs-admin #cs-slides .cs-slide .cs-elements .cs-elements-actions .cs-live-preview').each(function() {
240
+ var btn = $(this);
241
+ var slide_parent = btn.closest('.cs-slide');
242
+
243
+ if(btn.hasClass('cs-live-preview-running')) {
244
+ btn.removeClass('cs-live-preview-running');
245
+ btn.text(crellyslider_translations.slide_live_preview);
246
+ crellyslider_stopLivePreview(slide_parent);
247
+ }
248
+ });
249
+
250
+ // Hide all tabs
251
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
252
+ var tab = $(this).parent().index();
253
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + tab + ')').css('display', 'block');
254
+
255
+ // Active class
256
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
257
+ $(this).parent().addClass('active');
258
+ }
259
+ });
260
+
261
+ // Add new
262
+ function crellyslider_addSlide() {
263
+ var add_btn = $('.cs-admin #cs-slides .cs-add-new');
264
+
265
+ var void_slide = $('.cs-admin #cs-slides .cs-void-slide').html();
266
+ // Insert the link at the end of the list
267
+ add_btn.parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
268
+ // jQuery UI tabs are not working here. For now, just use a manual created tab
269
+ $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
270
+ // Create the slide
271
+ $('.cs-admin #cs-slides .cs-slides-list').append('<div class="cs-slide">' + void_slide + '</div>');
272
+ slides_number++;
273
+
274
+ // Open the tab just created
275
+ var tab_index = add_btn.parent().index() - 1;
276
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).find('a').click();
277
+
278
+ // Active class
279
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
280
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).addClass('active');
281
+
282
+ // Set editing area sizes
283
+ crellyslider_setSlidesEditingAreaSizes();
284
+
285
+ crellyslider_slidesColorPicker();
286
+
287
+ // Update "start from slide" in the slider settings
288
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
289
+ }
290
+
291
+ // Add new on click
292
+ $('.cs-admin #cs-slides .cs-add-new').click(function() {
293
+ crellyslider_addSlide();
294
+ });
295
+ // Also add a new slide if slides_number == 0
296
+ if(slides_number == 0) {
297
+ crellyslider_addSlide();
298
+ // Start from first slide by default, unless the user specifically picked random order
299
+ if(!$('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=-1]').is('[selected]')) {
300
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').val('0');
301
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=0]').attr('selected', 'selected');
302
+ }
303
+ }
304
+ else {
305
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
306
+ }
307
+
308
+ // Delete
309
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-close').live('click', function() {
310
+ if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length <= 2) {
311
+ alert(crellyslider_translations.slide_delete_just_one);
312
+ return;
313
+ }
314
+
315
+ var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
316
+ if(!confirm) {
317
+ return;
318
+ }
319
+
320
+ slides_number--;
321
+
322
+ var slide_index = $(this).parent().index();
323
+
324
+ // If is deleting the current viewing slide, set the first as active
325
+ if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(slide_index).hasClass('active') && slides_number != 0) {
326
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).addClass('active');
327
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
328
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(0).css('display', 'block');
329
+ }
330
+
331
+ // Remove the anchor
332
+ $(this).parent().remove();
333
+ // Remove the slide itself
334
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index).remove();
335
+
336
+ // Scale back all the slides text
337
+ for(var i = slide_index; i < slides_number; i++) {
338
+ var slide = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(i);
339
+ var indx = parseInt(slide.find('.cs-slide-index').text());
340
+ slide.find('.cs-slide-index').text(indx - 1);
341
+ }
342
+
343
+ // Update "start from slide" in the slider settings
344
+ if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').val() >= slides_number) { console.log("sdfsd")
345
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').val('0');
346
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=0]').attr('selected', 'selected');
347
+ }
348
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
349
+ });
350
+
351
+ // Duplicate
352
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-duplicate').live('click', function() {
353
+ var slide_index = $(this).parent().index();
354
+ var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index);
355
+
356
+ // Clone the slide settings table
357
+ slide.crellyslider_betterClone(true, false).appendTo(slide.parent()).css('display', 'none');
358
+
359
+ // Fix TinyMCE
360
+ slide.parent().last().find('.cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').each(function() {
361
+ var cloned_options = $(this);
362
+
363
+ cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
364
+ cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
365
+ crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
366
+ });
367
+
368
+ // Add a new color picker, then remove the old one
369
+ crellyslider_slidesColorPicker();
370
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slides_number).find('.wp-picker-container > .wp-color-result').eq(0).remove();
371
+
372
+ // Insert the link at the end of the list
373
+ $(this).parent().parent().find('.cs-add-new').parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
374
+ $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
375
+
376
+ crellyslider_draggableElements();
377
+
378
+ slides_number++;
379
+
380
+ // Update "start from slide" in the slider settings
381
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
382
+ });
383
+
384
+ // Set correct size for the editing area
385
+ function crellyslider_setSlidesEditingAreaSizes() {
386
+ var width = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val());
387
+ var height = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val());
388
+
389
+ $('.cs-admin #cs-slides .cs-slide .cs-slide-editing-area').css({
390
+ 'width' : width,
391
+ 'height' : height,
392
+ });
393
+
394
+ $('.cs-admin').css({
395
+ 'width' : width,
396
+ });
397
+ }
398
+
399
+ crellyslider_slidesColorPicker();
400
+
401
+ // Run background color picker
402
+ function crellyslider_slidesColorPicker() {
403
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input').wpColorPicker({
404
+ // a callback to fire whenever the color changes to a valid color
405
+ change: function(event, ui){
406
+ var btn = $(this);
407
+ if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"]:checked').val() != '1') {
408
+ btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"][value="1"]:radio').prop('checked', true);
409
+ }
410
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
411
+ area.css('background-color', ui.color.toString());
412
+ },
413
+ // a callback to fire when the input is emptied or an invalid color
414
+ clear: function() {},
415
+ // hide the color picker controls on load
416
+ hide: true,
417
+ // show a group of common colors beneath the square
418
+ // or, supply an array of colors to customize further
419
+ palettes: true
420
+ });
421
+ }
422
+
423
+ // Set background color (transparent == 0, color-picker == 1 or manual == 2). For backward compatiblity, a "-1" is used to indicate that there were no way to set the bg color manually
424
+ $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_color"]:radio', function() {
425
+ var btn = $(this);
426
+ var btn_val = btn.val();
427
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
428
+
429
+ if(btn_val == '0') {
430
+ area.css('background-color', '#fff');
431
+ }
432
+ else if(btn_val == '1') {
433
+ var color_picker_value = btn.closest('.cs-content').find('.wp-color-result').css('background-color');
434
+ area.css('background-color', color_picker_value);
435
+ }
436
+ else {
437
+ area.css('background-color', btn.closest('.cs-content').find('.cs-slide-background_type_color-manual').val());
438
+ }
439
+ });
440
+
441
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-manual', function() {
442
+ var text = $(this);
443
+ var val = text.val();
444
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
445
+
446
+ text.closest('.cs-slide').find('input[name="cs-slide-background_type_color"][value="2"]:radio').prop('checked', true);
447
+ area.css('background-color', val);
448
+ });
449
+
450
+ // Set background image (none or image)
451
+ $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_image"]:radio', function() {
452
+ var btn = $(this);
453
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
454
+
455
+ if(btn.val() == '0') {
456
+ area.css('background-image', 'none');
457
+ }
458
+ else {
459
+ var slide_parent = $(this).closest('.cs-slide');
460
+ crellyslider_addSlideImageBackground(slide_parent);
461
+ }
462
+ });
463
+
464
+ // Set Background image (the upload function)
465
+ $('.cs-admin #cs-slides').on('click', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_image-upload-button', function() {
466
+ var btn = $(this);
467
+ if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]:checked').val() == '1') {
468
+ var slide_parent = $(this).closest('.cs-slide');
469
+ crellyslider_addSlideImageBackground(slide_parent);
470
+ }
471
+ else {
472
+ btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]').prop('checked', true);
473
+ var slide_parent = $(this).closest('.cs-slide');
474
+ crellyslider_addSlideImageBackground(slide_parent);
475
+ }
476
+ });
477
+ function crellyslider_addSlideImageBackground(slide_parent) {
478
+ var area = slide_parent.find('.cs-slide-editing-area');
479
+
480
+ // Upload
481
+ var file_frame;
482
+
483
+ // If the media frame already exists, reopen it.
484
+ if ( file_frame ) {
485
+ file_frame.open();
486
+ return;
487
+ }
488
+
489
+ // Create the media frame.
490
+ file_frame = wp.media.frames.file_frame = wp.media({
491
+ title: jQuery( this ).data( 'uploader_title' ),
492
+ button: {
493
+ text: jQuery( this ).data( 'uploader_button_text' ),
494
+ },
495
+ multiple: false // Set to true to allow multiple files to be selected
496
+ });
497
+
498
+ // When an image is selected, run a callback.
499
+ file_frame.on( 'select', function() {
500
+ // We set multiple to false so only get one image from the uploader
501
+ attachment = file_frame.state().get('selection').first().toJSON();
502
+
503
+ // Do something with attachment.id and/or attachment.url here
504
+ var image_src = attachment.url;
505
+ var image_alt = attachment.alt;
506
+ var image_id = attachment.id;
507
+
508
+ // Set background
509
+ area.css('background-image', 'url("' + image_src + '")');
510
+
511
+ // Data that we'll store into the database
512
+ area.data('background-image-src', image_id);
513
+ });
514
+
515
+ // Finally, open the modal
516
+ file_frame.open();
517
+ }
518
+
519
+ // Background propriety: repeat or no-repeat
520
+ $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_repeat"]:radio', function() {
521
+ var btn = $(this);
522
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
523
+
524
+ if(btn.val() == '0') {
525
+ area.css('background-repeat', 'no-repeat');
526
+ }
527
+ else {
528
+ area.css('background-repeat', 'repeat');
529
+ }
530
+ });
531
+
532
+ // Background propriety: positions x and y
533
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_x', function() {
534
+ var text = $(this);
535
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
536
+
537
+ var x = text.val();
538
+ var y = text.parent().find('.cs-slide-background_propriety_position_y').val();
539
+
540
+ area.css('background-position', x + ' ' + y);
541
+ });
542
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_y', function() {
543
+ var text = $(this);
544
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
545
+
546
+ var x = text.parent().find('.cs-slide-background_propriety_position_x').val();
547
+ var y = text.val();
548
+
549
+ area.css('background-position', x + ' ' + y);
550
+ });
551
+
552
+ // Background propriety: size
553
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_size', function() {
554
+ var text = $(this);
555
+ var val = text.val();
556
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
557
+
558
+ area.css('background-size', val);
559
+ });
560
+
561
+ // Background presets
562
+ $('.cs-slide-background-image-fullwidth-preset').click(function() {
563
+ var text = $(this);
564
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
565
+ var settings = text.closest('.cs-slide');
566
+
567
+ settings.find('.cs-slide-background_propriety_position_x').val('center');
568
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
569
+
570
+ settings.find('.cs-slide-background_propriety_position_y').val('center');
571
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
572
+
573
+ settings.find('input[name="cs-slide-background_repeat"][value="0"]').prop('checked', true);
574
+ area.css('background-repeat', 'no-repeat');
575
+
576
+ settings.find('.cs-slide-background_propriety_size').val('cover');
577
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
578
+ });
579
+
580
+ $('.cs-slide-background-image-pattern-preset').click(function() {
581
+ var text = $(this);
582
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
583
+ var settings = text.closest('.cs-slide');
584
+
585
+ settings.find('.cs-slide-background_propriety_position_x').val(0);
586
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
587
+
588
+ settings.find('.cs-slide-background_propriety_position_y').val(0);
589
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
590
+
591
+ settings.find('input[name="cs-slide-background_repeat"][value="1"]').prop('checked', true);
592
+ area.css('background-repeat', 'repeat');
593
+
594
+ settings.find('.cs-slide-background_propriety_size').val('auto');
595
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
596
+ });
597
+
598
+ // Apply custom CSS
599
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-custom_css', function() {
600
+ var text = $(this);
601
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
602
+ var css = text.val();
603
+
604
+ // Save current styles
605
+ var width = area.css('width');
606
+ var height = area.css('height');
607
+ var background_image = area.css('background-image');
608
+ var background_color = area.css('background-color');
609
+ var background_position = area.css('background-position');
610
+ var background_repeat = area.css('background-repeat');
611
+ var background_size = area.css('background-size');
612
+
613
+ // Apply CSS
614
+ area.attr('style', css);
615
+ area.css({
616
+ 'width' : width,
617
+ 'height' : height,
618
+ 'background-image' : background_image,
619
+ 'background-color' : background_color,
620
+ 'background-position' : background_position,
621
+ 'background-repeat' : background_repeat,
622
+ 'background-size' : background_size
623
+ });
624
+ });
625
+
626
+ /**************/
627
+ /** ELEMENTS **/
628
+ /**************/
629
+
630
+ // GENERAL
631
+
632
+ // Make draggable
633
+ function crellyslider_draggableElements() {
634
+ $('.cs-admin .cs-elements .cs-element').draggable({
635
+ 'containment' : 'parent',
636
+
637
+ start: function() {
638
+ // Select when dragging
639
+ crellyslider_selectElement($(this));
640
+ },
641
+
642
+ drag: function(){
643
+ // Set left and top positions on drag to the textbox
644
+ var position = $(this).position();
645
+ var left = position.left;
646
+ var top = position.top;
647
+ var index = $(this).index();
648
+
649
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
650
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
651
+ },
652
+ });
653
+ }
654
+
655
+ // Selects an element, shows its options and makes the delete element button available
656
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-slide-editing-area .cs-element', function(e) {
657
+ // Do not click the editing-area
658
+ e.stopPropagation();
659
+
660
+ // Do not open links
661
+ e.preventDefault();
662
+
663
+ crellyslider_selectElement($(this));
664
+ });
665
+ function crellyslider_selectElement(element) {
666
+ var index = element.index();
667
+ var slide = element.closest('.cs-slide');
668
+ var options = slide.find('.cs-elements .cs-elements-list');
669
+
670
+ // Hide all options - .active class
671
+ options.find('.cs-element-settings').css('display', 'none');
672
+ options.find('.cs-element-settings').removeClass('active');
673
+
674
+ // Show the correct options + .active class
675
+ options.find('.cs-element-settings:eq(' + index + ')').css('display', 'block');
676
+ options.find('.cs-element-settings:eq(' + index + ')').addClass('active');
677
+
678
+ // Add .active class to the element in the editing area
679
+ element.parent().children().removeClass('active');
680
+ element.addClass('active');
681
+
682
+ // Make the delete and the duplicate buttons working
683
+ slide.find('.cs-elements-actions .cs-delete-element').removeClass('cs-is-disabled');
684
+ slide.find('.cs-elements-actions .cs-duplicate-element').removeClass('cs-is-disabled');
685
+ }
686
+
687
+ // Deselect elements
688
+ $('.cs-admin').on('click', '.cs-slide .cs-elements .cs-slide-editing-area', function() {
689
+ crellyslider_deselectElements();
690
+ });
691
+ function crellyslider_deselectElements() {
692
+ $('.cs-admin .cs-slide .cs-elements .cs-slide-editing-area .cs-element').removeClass('active');
693
+ $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').removeClass('active');
694
+ $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').css('display', 'none');
695
+
696
+ // Hide delete and duplicate element btns
697
+ $('.cs-admin .cs-slide .cs-elements-actions .cs-delete-element').addClass('cs-is-disabled');
698
+ $('.cs-admin .cs-slide .cs-elements-actions .cs-duplicate-element').addClass('cs-is-disabled');
699
+ }
700
+
701
+ // Delete element. Remember that the button should be enabled / disabled somewhere else
702
+ function crellyslider_deleteElement(element) {
703
+ var index = element.index();
704
+ var slide_parent = element.closest('.cs-slide');
705
+
706
+ element.remove();
707
+ var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
708
+ element_options.remove();
709
+ crellyslider_deselectElements();
710
+ }
711
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-delete-element', function() {
712
+ // Click only if an element is selected
713
+ if($(this).hasClass('.cs-is-disabled')) {
714
+ return;
715
+ }
716
+
717
+ var slide_parent = $(this).closest('.cs-slide');
718
+ var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
719
+ crellyslider_deleteElement(element);
720
+ });
721
+
722
+ function crellyslider_duplicateElement(element) {
723
+ var index = element.index();
724
+ var slide_parent = element.closest('.cs-slide');
725
+
726
+ element.clone().appendTo(element.parent()).css({
727
+ 'left' : '+=10',
728
+ 'top' : '+=10',
729
+ });
730
+ var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
731
+ element_options.crellyslider_betterClone(true).insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
732
+
733
+ crellyslider_deselectElements();
734
+ crellyslider_selectElement(element.parent().find('.cs-element').last());
735
+
736
+ var cloned_options = element.parent().find('.cs-element').last().closest('.cs-slide').find('.cs-elements-list .cs-element-settings.active');
737
+
738
+ // Move the element 10 pixels away
739
+ cloned_options.find('.cs-element-data_left').val(parseInt(element_options.find('.cs-element-data_left').val()) + 10);
740
+ cloned_options.find('.cs-element-data_top').val(parseInt(element_options.find('.cs-element-data_top').val()) + 10);
741
+
742
+ // If it's a text, fix TinyMCE
743
+ if(cloned_options.hasClass('cs-text-element-settings')) {
744
+ cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
745
+ cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
746
+ crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
747
+ }
748
+
749
+ // Make draggable
750
+ crellyslider_draggableElements();
751
+ }
752
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-duplicate-element', function() {
753
+ // Click only if an element is selected
754
+ if($(this).hasClass('.cs-is-disabled')) {
755
+ return;
756
+ }
757
+
758
+ var slide_parent = $(this).closest('.cs-slide');
759
+ var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
760
+ crellyslider_duplicateElement(element);
761
+ });
762
+
763
+ // Modify left position
764
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_left', function() {
765
+ var index = $(this).closest('.cs-element-settings').index();
766
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', parseFloat($(this).val()));
767
+ });
768
+
769
+ // Center horizontally
770
+ $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-x', function() {
771
+ var index = $(this).closest('.cs-element-settings').index();
772
+ var left = parseInt(($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val() / 2) - (parseFloat($(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').width()) / 2));
773
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
774
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
775
+ });
776
+
777
+ // Modify top position
778
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_top', function() {
779
+ var index = $(this).closest('.cs-element-settings').index();
780
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', parseFloat($(this).val()));
781
+ });
782
+
783
+ // Center vertically
784
+ $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-y', function() {
785
+ var index = $(this).closest('.cs-element-settings').index();
786
+ var top = parseInt(($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val() / 2) - (parseFloat($(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').height()) / 2));
787
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
788
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
789
+ });
790
+
791
+ // Modify z-index
792
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-z_index', function() {
793
+ var index = $(this).closest('.cs-element-settings').index();
794
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
795
+ });
796
+
797
+ // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
798
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
799
+ crellyslider_editElementsLink($(this));
800
+ });
801
+ $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link_new_tab', function() {
802
+ var textbox = $(this).parent().find('.cs-element-link');
803
+ crellyslider_editElementsLink(textbox);
804
+ });
805
+
806
+ // Wrap - unwrap elements with an <a href="" target="">
807
+ function crellyslider_editElementsLink(textbox_link) {
808
+ var index = textbox_link.closest('.cs-element-settings').index();
809
+ var copy_attributes = false;
810
+ var reapply_css = false;
811
+
812
+ if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
813
+ // Remove custom css classes
814
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
815
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
816
+
817
+ var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
818
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
819
+ copy_attributes = true;
820
+ reapply_css = true;
821
+ }
822
+ else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
823
+ var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
824
+
825
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
826
+
827
+ if(link_new_tab) {
828
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
829
+ }
830
+ else {
831
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
832
+ }
833
+
834
+ copy_attributes = false;
835
+ }
836
+ else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
837
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('class', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('class')).removeClass('ui-draggable');
838
+
839
+ // Reapply CSS and custom CSS
840
+ applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
841
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('top', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('top'));
842
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('left', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('left'));
843
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('z-index', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('z-index'));
844
+
845
+ // Reapply custom css classes
846
+ crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
847
+
848
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
849
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
850
+ copy_attributes = false;
851
+ }
852
+
853
+ if(copy_attributes) {
854
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').parent().attr('style', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style'));
855
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').parent().attr('class', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('class')).removeClass('ui-draggable');
856
+
857
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
858
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
859
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
860
+ }
861
+
862
+ crellyslider_draggableElements();
863
+
864
+ if(reapply_css) {
865
+ applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
866
+ crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
867
+ }
868
+ }
869
+
870
+ // Apply custom CSS
871
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
872
+ applyCustomCss($(this));
873
+ });
874
+
875
+ function applyCustomCss(textarea) {
876
+ var index = textarea.closest('.cs-element-settings').index();
877
+ // Save current positions
878
+ var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
879
+ var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
880
+ var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
881
+
882
+ // Apply CSS
883
+ if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
884
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
885
+ }
886
+ else {
887
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('style', textarea.val());
888
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction').removeAttr('style');
889
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeAttr('style');
890
+ }
891
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
892
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
893
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
894
+ }
895
+
896
+ // Add custom CSS classes
897
+ $('.cs-admin').on('keydown', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
898
+ var textarea = $(this);
899
+ var index = textarea.closest('.cs-element-settings').index();
900
+
901
+ if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
902
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textarea.val());
903
+ }
904
+ else {
905
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textarea.val());
906
+ var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
907
+ avoid_interaction.removeAttr('class');
908
+ avoid_interaction.addClass('cs-avoid-interaction');
909
+ }
910
+ });
911
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
912
+ crellyslider_applyCustomCssClasses($(this));
913
+ });
914
+ function crellyslider_applyCustomCssClasses(textarea) {
915
+ var index = textarea.closest('.cs-element-settings').index();
916
+
917
+ if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
918
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').addClass(textarea.val());
919
+ }
920
+ else {
921
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').addClass(textarea.val());
922
+ var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
923
+ avoid_interaction.removeAttr('class');
924
+ avoid_interaction.addClass('cs-avoid-interaction');
925
+ }
926
+ }
927
+
928
+ // TEXT ELEMENTS
929
+
930
+ // Convert textareas to WP editors
931
+ $('.cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-element-inner_html').each(function() {
932
+ var textarea = $(this);
933
+
934
+ if(textarea.closest('.cs-text-element-settings').hasClass('cs-void-text-element-settings')) {
935
+ return; // It means "continue;"
936
+ }
937
+
938
+ crellyslider_convertToWPEditor(textarea);
939
+ });
940
+
941
+ // Converts a textarea to something similar to wp_editor()
942
+ function crellyslider_convertToWPEditor(textarea) {
943
+ // Static counter: generates a new ID for each editor
944
+ if(crellyslider_convertToWPEditor.static_counter == undefined) {
945
+ crellyslider_convertToWPEditor.static_counter = 0;
946
+ }
947
+ else {
948
+ crellyslider_convertToWPEditor.static_counter++;
949
+ }
950
+
951
+ textarea.attr('id', 'cs-element-editor-' + crellyslider_convertToWPEditor.static_counter);
952
+
953
+ var settings = crellyslider_tinyMCEInit;
954
+
955
+ settings.selector = '#cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter);
956
+ settings.body_class = ('cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter) + ' locale-' + crellyslider_locale).toLowerCase();
957
+ settings.setup = function(editor) {
958
+ editor.on("KeyUp ExecCommand ContextMenu Change", function(e) {
959
+ editor.save();
960
+ crellyslider_triggerTinyMCE(editor.id);
961
+ });
962
+
963
+ editor.on("init", function() {
964
+ // Set default CSS
965
+ this.getDoc().body.style.fontSize = "14px";
966
+ this.getDoc().body.style.fontFamily = "Verdana";
967
+
968
+ // Insert switch button
969
+ textarea.parent().prepend('<div class="cs-switch-editor"><div onclick="tinyMCE.execCommand(\'mceToggleEditor\', false, \'' + editor.id + '\')" class="cs-button cs-is-default cs-tinymce">' + crellyslider_translations.switch_editor + '</div></div>');
970
+ });
971
+ };
972
+
973
+ if(typeof tinyMCE != 'undefined') {
974
+ tinyMCE.init(settings);
975
+ }
976
+ }
977
+
978
+ // When the user modifies the text in the TinyMCE editor, apply the changes to the preview area
979
+ function crellyslider_triggerTinyMCE(editor_id) {
980
+ crellyslider_changeText(jQuery('#' + editor_id));
981
+ }
982
+
983
+ // Add text click
984
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-text-element', function() {
985
+ var slide_parent = $(this).closest('.cs-slide');
986
+ crellyslider_addTextElement(slide_parent);
987
+ });
988
+
989
+ // Add text. Receives the slide as object
990
+ function crellyslider_addTextElement(slide_parent) {
991
+ var area = slide_parent.find('.cs-slide-editing-area');
992
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
993
+ var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
994
+
995
+ // Insert in editing area
996
+ area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
997
+
998
+ // Insert the options
999
+ settings_div.before(settings);
1000
+
1001
+ // Make draggable
1002
+ crellyslider_draggableElements();
1003
+
1004
+ // Convert textarea to WP editor
1005
+ crellyslider_convertToWPEditor(slide_parent.find('.cs-elements .cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').last().find('.cs-element-inner_html'));
1006
+
1007
+ // Display settings
1008
+ crellyslider_selectElement(area.find('.cs-element').last());
1009
+ }
1010
+
1011
+ // Modify text
1012
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
1013
+ crellyslider_changeText($(this));
1014
+ });
1015
+ crellyslider_changeText = function crellyslider_changeText(element) {
1016
+ var index = element.closest('.cs-element-settings').index();
1017
+ var text_element = element.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1018
+
1019
+ if(! text_element.is('a')) {
1020
+ text_element.html(element.val());
1021
+
1022
+ text_element.css('width', '');
1023
+ text_element.css('height', '');
1024
+ }
1025
+ else {
1026
+ text_element.find('> div').html(element.val());
1027
+
1028
+ text_element.find('> div').css('width', '');
1029
+ text_element.find('> div').css('height', '');
1030
+ }
1031
+ }
1032
+
1033
+ // IMAGE ELEMENTS
1034
+
1035
+ // Add images click
1036
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-image-element', function() {
1037
+ var slide_parent = $(this).closest('.cs-slide');
1038
+ crellyslider_addImageElement(slide_parent);
1039
+ });
1040
+
1041
+ // Upload click
1042
+ $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-image-element-settings .cs-image-element-upload-button', function() {
1043
+ var slide_parent = $(this).closest('.cs-slide');
1044
+ crellySliderUploadImageElement(slide_parent);
1045
+ });
1046
+
1047
+ // Add image. Receives the slide as object
1048
+ function crellyslider_addImageElement(slide_parent) {
1049
+ var area = slide_parent.find('.cs-slide-editing-area');
1050
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1051
+ var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1052
+
1053
+ // Temporarily insert an element with no src and alt
1054
+ // Add the image into the editing area.
1055
+ area.append('<img class="cs-element cs-image-element" src="nothing_now.jpg" style="z-index: 1;" />');
1056
+
1057
+ // Insert the options
1058
+ settings_div.before(settings);
1059
+
1060
+ // Make draggable
1061
+ crellyslider_draggableElements();
1062
+
1063
+ // Display settings
1064
+ crellyslider_selectElement(area.find('.cs-element').last());
1065
+
1066
+ // Upload
1067
+ crellySliderUploadImageElement(slide_parent);
1068
+ }
1069
+
1070
+ function crellySliderUploadImageElement(slide_parent) {
1071
+ var area = slide_parent.find('.cs-slide-editing-area');
1072
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1073
+ var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1074
+
1075
+ var file_frame;
1076
+
1077
+ // If the media frame already exists, reopen it.
1078
+ if ( file_frame ) {
1079
+ file_frame.open();
1080
+ return;
1081
+ }
1082
+
1083
+ // Create the media frame.
1084
+ file_frame = wp.media.frames.file_frame = wp.media({
1085
+ title: jQuery( this ).data( 'uploader_title' ),
1086
+ button: {
1087
+ text: jQuery( this ).data( 'uploader_button_text' ),
1088
+ },
1089
+ multiple: false // Set to true to allow multiple files to be selected
1090
+ });
1091
+
1092
+ // When an image is selected, run a callback.
1093
+ file_frame.on( 'select', function() {
1094
+ // We set multiple to false so only get one image from the uploader
1095
+ attachment = file_frame.state().get('selection').first().toJSON();
1096
+
1097
+ // Do something with attachment.id and/or attachment.url here
1098
+ var image_src = attachment.url;
1099
+ var image_alt = attachment.alt;
1100
+ var attachment_id = attachment.id;
1101
+
1102
+ // Set attributes. If is a link, do the right thing
1103
+ var image = area.find('.cs-image-element.active').last();
1104
+
1105
+ if(! image.is('a')) {
1106
+ image.attr('src', image_src);
1107
+ image.attr('alt', image_alt);
1108
+ }
1109
+ else {
1110
+ image.find('> img').attr('src', image_src);
1111
+ image.find('> img').attr('alt', image_alt);
1112
+ }
1113
+
1114
+ // Set data (will be used in the ajax call)
1115
+ settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', attachment_id);
1116
+ settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
1117
+ });
1118
+
1119
+ // Finally, open the modal
1120
+ file_frame.open();
1121
+ }
1122
+
1123
+ // VIDEO ELEMENTS
1124
+
1125
+ // Add video click
1126
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-video-element', function() {
1127
+ var slide_parent = $(this).closest('.cs-slide');
1128
+ crellyslider_addVideoElement(slide_parent);
1129
+ });
1130
+
1131
+ // Adds a video container. Receives the slide as object
1132
+ function crellyslider_addVideoElement(slide_parent) {
1133
+ var area = slide_parent.find('.cs-slide-editing-area');
1134
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1135
+ var settings = '<div class="cs-element-settings cs-video-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-video-element-settings').html() + '</div>';
1136
+
1137
+ // Insert in editing area
1138
+ area.append('<div class="cs-element cs-video-element" style="z-index: 1;"></div>');
1139
+
1140
+ // Insert the options
1141
+ settings_div.before(settings);
1142
+
1143
+ // Make draggable
1144
+ crellyslider_draggableElements();
1145
+
1146
+ // Display settings
1147
+ crellyslider_selectElement(area.find('.cs-element').last());
1148
+
1149
+ // Select youtube video as default
1150
+ area.find('.cs-element').last().closest('.cs-slide').find('.cs-elements .cs-elements-list .cs-element-video_src').trigger('change');
1151
+ }
1152
+
1153
+ // Change video id
1154
+ $('.cs-admin').on('change keyup input', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_id', function() {
1155
+ var index = $(this).closest('.cs-element-settings').index();
1156
+ var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1157
+
1158
+ crellyslider_changeVideo($(this), element, $(this).parent().find('.cs-element-video_src').val(), $(this).val());
1159
+ });
1160
+ // Change video source
1161
+ $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_src', function() {
1162
+ var index = $(this).closest('.cs-element-settings').index();
1163
+ var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1164
+
1165
+ crellyslider_changeVideo($(this), element, $(this).val(), $(this).parent().find('.cs-element-video_id').val());
1166
+ });
1167
+ function crellyslider_changeVideo(input, element, source, video_id) {
1168
+ if(source == 'youtube') {
1169
+ element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-yt-iframe" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/' + video_id + '?enablejsapi=1" frameborder="0"></iframe>');
1170
+ }
1171
+ else {
1172
+ element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-vimeo-iframe" src="https://player.vimeo.com/video/' + video_id + '?api=1" width="560" height="315" frameborder="0" ></iframe>');
1173
+ }
1174
+
1175
+ // Re-apply custom CSS and custom CSS classes
1176
+ crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css'));
1177
+ crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
1178
+ }
1179
+
1180
+ /******************/
1181
+ /** LIVE PREVIEW **/
1182
+ /******************/
1183
+
1184
+ // Live preview click
1185
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-live-preview', function() {
1186
+ var btn = $(this);
1187
+ var slide_parent = btn.closest('.cs-slide');
1188
+
1189
+ if(! btn.hasClass('cs-live-preview-running')) {
1190
+ btn.addClass('cs-live-preview-running');
1191
+ btn.text(crellyslider_translations.slide_stop_preview);
1192
+ crellyslider_startLivePreview(slide_parent);
1193
+ }
1194
+ else {
1195
+ btn.removeClass('cs-live-preview-running');
1196
+ btn.text(crellyslider_translations.slide_live_preview);
1197
+ crellyslider_stopLivePreview(slide_parent);
1198
+ }
1199
+ });
1200
+
1201
+ function crellyslider_startLivePreview(slide_parent) {
1202
+ crellyslider_deselectElements();
1203
+
1204
+ var area = slide_parent.find('.cs-slide-editing-area');
1205
+
1206
+ area.clone().addClass('cs-slide-live-preview-area').insertAfter(area);
1207
+ var prev = slide_parent.find('.cs-slide-live-preview-area');
1208
+
1209
+ area.css('display', 'none');
1210
+
1211
+ // Set elements data and styles
1212
+ var elements = prev.find('.cs-element');
1213
+ var original_elements = area.closest('.cs-slide').find('.cs-elements .cs-element-settings');
1214
+ var i = 0;
1215
+ elements.each(function() {
1216
+ var element = $(this);
1217
+
1218
+ // Video elements settings only
1219
+ var html_class = false;
1220
+ if(element.find('.cs-yt-iframe').length > 0) {
1221
+ element.find('.cs-avoid-interaction').remove();
1222
+ element = element.find('.cs-yt-iframe');
1223
+ element.unwrap();
1224
+ element.attr({
1225
+ 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1226
+ 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1227
+ 'data-start-mute' : parseInt(original_elements.eq(i).find('.cs-element-video_start_mute').val()),
1228
+ 'data-pause-while-watching' : parseInt(original_elements.eq(i).find('.cs-element-video_pause_while_watching').val()),
1229
+ });
1230
+ html_class = 'cs-yt-iframe';
1231
+ }
1232
+ else if(element.find('.cs-vimeo-iframe').length > 0) {
1233
+ element.find('.cs-avoid-interaction').remove();
1234
+ element = element.find('.cs-vimeo-iframe');
1235
+ element.unwrap();
1236
+ element.attr({
1237
+ 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1238
+ 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1239
+ 'data-start-mute' : parseInt(original_elements.eq(i).find('.cs-element-video_start_mute').val()),
1240
+ 'data-pause-while-watching' : parseInt(original_elements.eq(i).find('.cs-element-video_pause_while_watching').val()),
1241
+ });
1242
+ html_class = 'cs-vimeo-iframe';
1243
+ }
1244
+
1245
+ element.removeAttr('style');
1246
+ element.attr('style', original_elements.eq(i).find('.cs-element-custom_css').val());
1247
+ element.css({
1248
+ 'z-index' : parseInt(original_elements.eq(i).find('.cs-element-z_index').val()),
1249
+ 'display' : 'none',
1250
+ });
1251
+
1252
+ element.removeAttr('class');
1253
+ element.addClass(original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1254
+ if(html_class) {
1255
+ element.addClass(html_class);
1256
+ }
1257
+
1258
+ element.attr({
1259
+ 'data-left' : parseInt(original_elements.eq(i).find('.cs-element-data_left').val()),
1260
+ 'data-top' : parseInt(original_elements.eq(i).find('.cs-element-data_top').val()),
1261
+ 'data-delay' : parseInt(original_elements.eq(i).find('.cs-element-data_delay').val()),
1262
+ 'data-time' : original_elements.eq(i).find('.cs-element-data_time').val(),
1263
+ 'data-in' : original_elements.eq(i).find('.cs-element-data_in').val(),
1264
+ 'data-out' : original_elements.eq(i).find('.cs-element-data_out').val(),
1265
+ 'data-ignore-ease-out' : original_elements.eq(i).find('.cs-element-data_out').prop('checked') ? 1 : 0,
1266
+ 'data-ease-in' : parseInt(original_elements.eq(i).find('.cs-element-data_easeIn').val()),
1267
+ 'data-ease-out' : parseInt(original_elements.eq(i).find('.cs-element-data_easeOut').val()),
1268
+ });
1269
+
1270
+ i++;
1271
+ });
1272
+
1273
+ // Prepare HTML structure
1274
+ prev.wrapInner('<li />');
1275
+ prev.wrapInner('<ul />');
1276
+
1277
+
1278
+ var slide = prev.find('ul > li');
1279
+ var original_slide = area.closest('.cs-slide');
1280
+ var content = original_slide.find('.cs-slide-settings-list');
1281
+
1282
+ // Set slide link
1283
+ if(content.find('.cs-background-link').val() != '') {
1284
+ if(! content.find('.cs-background-link_new_tab').prop('checked')) {
1285
+ slide.prepend('<a class="cs-background-link" href="' + content.find('.cs-background-link').val() + '"></a>');
1286
+ }
1287
+ else {
1288
+ slide.prepend('<a class="cs-background-link" target="_blank" href="' + content.find('.cs-background-link').val() + '"></a>');
1289
+ }
1290
+ }
1291
+
1292
+ // Set slide data and styles
1293
+ slide.attr({
1294
+ 'data-in' : content.find('.cs-slide-data_in').val(),
1295
+ 'data-out' : content.find('.cs-slide-data_out').val(),
1296
+ 'data-time' : parseInt(content.find('.cs-slide-data_time').val()),
1297
+ 'data-ease-in' : parseInt(content.find('.cs-slide-data_easeIn').val()),
1298
+ 'data-ease-out' : parseInt(content.find('.cs-slide-data_easeOut').val()),
1299
+ });
1300
+
1301
+ slide.attr('style', content.find('.cs-slide-custom_css').val());
1302
+ slide.css({
1303
+ 'background-image' : area.css('background-image') ,
1304
+ 'background-color' : area.css('background-color') + "",
1305
+ 'background-position' : content.find('.cs-slide-background_propriety_position_x').val() + ' ' + content.find('.cs-slide-background_propriety_position_y').val(),
1306
+ 'background-repeat' : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1307
+ 'background-size' : content.find('.cs-slide-background_propriety_size').val(),
1308
+ });
1309
+
1310
+ var slider = $('.cs-admin .cs-slider #cs-slider-settings');
1311
+
1312
+ // Run Crelly Slider
1313
+ prev.crellySlider({
1314
+ 'layout' : 'fixed',
1315
+ 'responsive' : false,
1316
+ 'startWidth' : parseInt(slider.find('#cs-slider-startWidth').val()),
1317
+ 'startHeight' : parseInt(slider.find('#cs-slider-startHeight').val()),
1318
+
1319
+ 'automaticSlide' : true,
1320
+ 'showControls' : false,
1321
+ 'showNavigation' : false,
1322
+ 'enableSwipe' : false,
1323
+ 'showProgressBar' : false,
1324
+ 'pauseOnHover' : false,
1325
+ });
1326
+
1327
+ // Warning: click on background links
1328
+ $('.cs-slide-live-preview-area a').click(function(event) {
1329
+ if($(this).prop('target') != '_blank') {
1330
+ var confirm = window.confirm(crellyslider_translations.exit_without_saving);
1331
+ if(! confirm) {
1332
+ event.preventDefault();
1333
+ }
1334
+ }
1335
+ });
1336
+ }
1337
+
1338
+ function crellyslider_stopLivePreview(slide_parent) {
1339
+ var area = slide_parent.find('.cs-slide-editing-area');
1340
+ var prev = slide_parent.find('.cs-slide-live-preview-area');
1341
+
1342
+ prev.remove();
1343
+ area.css('display', 'block');
1344
+ }
1345
+
1346
+ /****************/
1347
+ /** AJAX CALLS **/
1348
+ /****************/
1349
+
1350
+ // Save or update the new slider in the database
1351
+ $('.cs-admin .cs-slider .cs-save-settings').click(function() {
1352
+ $('.cs-admin #cs-slides .cs-live-preview').each(function() {
1353
+ var btn = $(this);
1354
+ var slide_parent = btn.closest('.cs-slide');
1355
+
1356
+ if(btn.hasClass('cs-live-preview-running')) {
1357
+ btn.removeClass('cs-live-preview-running');
1358
+ btn.text(crellyslider_translations.slide_live_preview);
1359
+ crellyslider_stopLivePreview(slide_parent);
1360
+ }
1361
+ });
1362
+
1363
+ crellyslider_saveSlider();
1364
+ });
1365
+
1366
+ // Delete slider
1367
+ $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-delete-slider', function() {
1368
+ var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
1369
+ if(!confirm) {
1370
+ return;
1371
+ }
1372
+
1373
+ crellyslider_deleteSlider($(this));
1374
+ });
1375
+
1376
+ // Duplicate slider
1377
+ $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-duplicate-slider', function() {
1378
+ crellyslider_duplicateSlider($(this));
1379
+ });
1380
+
1381
+ // Export slider
1382
+ $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-export-slider', function() {
1383
+ crellyslider_exportSlider($(this));
1384
+ });
1385
+
1386
+ // Import slider
1387
+ $('.cs-admin .cs-home').on('click', '.cs-import-slider', function() {
1388
+ $('#cs-import-file').trigger('click');
1389
+ });
1390
+ $('.cs-admin .cs-home').on('change', '#cs-import-file', function() {
1391
+ crellyslider_importSlider();
1392
+ });
1393
+
1394
+ // Sends an array with the new or current slider options
1395
+ function crellyslider_saveSlider() {
1396
+ crellyslider_showWait();
1397
+
1398
+ var content = $('.cs-admin .cs-slider #cs-slider-settings');
1399
+ var options = {
1400
+ id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
1401
+ name : content.find('#cs-slider-name').val(),
1402
+ alias : content.find('#cs-slider-alias').text(),
1403
+ layout : content.find('#cs-slider-layout').val(),
1404
+ responsive : parseInt(content.find('#cs-slider-responsive').val()),
1405
+ startWidth : parseInt(content.find('#cs-slider-startWidth').val()),
1406
+ startHeight : parseInt(content.find('#cs-slider-startHeight').val()),
1407
+ automaticSlide : parseInt(content.find('#cs-slider-automaticSlide').val()),
1408
+ showControls : parseInt(content.find('#cs-slider-showControls').val()),
1409
+ showNavigation : parseInt(content.find('#cs-slider-showNavigation').val()),
1410
+ enableSwipe : parseInt(content.find('#cs-slider-enableSwipe').val()),
1411
+ showProgressBar : parseInt(content.find('#cs-slider-showProgressBar').val()),
1412
+ pauseOnHover : parseInt(content.find('#cs-slider-pauseOnHover').val()),
1413
+ randomOrder : parseInt(content.find('#cs-slider-randomOrder').val()),
1414
+ startFromSlide : parseInt(content.find('#cs-slider-startFromSlide').val()),
1415
+ fromDate : content.find('#cs-slider-displayImmediately').prop('checked') || content.find('#cs-slider-fromDate').val() == '' ? '1000-01-01 00:00:00' : content.find('#cs-slider-fromDate').val(),
1416
+ toDate : content.find('#cs-slider-displayForever').prop('checked') || content.find('#cs-slider-toDate').val() == '' ? '9999-12-31 23:59:59' : content.find('#cs-slider-toDate').val(),
1417
+ callbacks : content.find('#cs-slider-callbacks').val(),
1418
+ };
1419
+
1420
+ var sliderNonce;
1421
+ if(typeof(crellyslider_currentSliderNonce) != "undefined") {
1422
+ sliderNonce = crellyslider_currentSliderNonce;
1423
+ }
1424
+ else {
1425
+ sliderNonce = crellyslider_nonces.addSlider;
1426
+ }
1427
+
1428
+ // Do the ajax call
1429
+ jQuery.ajax({
1430
+ type : 'POST',
1431
+ dataType : 'json',
1432
+ url : ajaxurl,
1433
+ data : {
1434
+ // Is it saving or updating?
1435
+ action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1436
+ security: sliderNonce,
1437
+ datas : options,
1438
+ },
1439
+ success: function(response) {
1440
+ //alert('Save slider response: ' + response);
1441
+ // If adding a new slider, response will be the generated id, else will be the number of rows modified
1442
+ if(response !== false) {
1443
+ // If is adding a slider, redirect
1444
+ if($('.cs-admin .cs-slider').hasClass('cs-add-slider')) {
1445
+ window.location.href = '?page=crellyslider&view=edit&id=' + response;
1446
+ return;
1447
+ }
1448
+
1449
+ crellyslider_saveSlides();
1450
+ }
1451
+ else {
1452
+ crellyslider_showError();
1453
+ }
1454
+ },
1455
+
1456
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1457
+ alert('Error saving slider');
1458
+ console.log(XMLHttpRequest.responseText);
1459
+ crellyslider_showError();
1460
+ }
1461
+ });
1462
+ }
1463
+
1464
+ // Sends an array with all the slides options
1465
+ function crellyslider_saveSlides() {
1466
+ var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1467
+ var i = 0;
1468
+ var final_options = {};
1469
+
1470
+ final_options['options'] = new Array();
1471
+ slides.each(function() {
1472
+ var slide = $(this);
1473
+ var content = slide.find('.cs-slide-settings-list');
1474
+
1475
+ var background_type_color;
1476
+ if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '0') {
1477
+ background_type_color = 'transparent';
1478
+ }
1479
+ else if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '1') {
1480
+ background_type_color = slide.find('.cs-slide-editing-area').css('background-color') + "";
1481
+ }
1482
+ else {
1483
+ background_type_color = content.find('.cs-slide-background_type_color-manual').val();
1484
+ }
1485
+
1486
+ var options = {
1487
+ slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1488
+ position : i,
1489
+
1490
+ draft : parseInt(content.find('.cs-slide-draft').val()),
1491
+ background_type_image : slide.find('.cs-slide-editing-area').css('background-image') == 'none' ? 'none' : slide.find('.cs-slide-editing-area').data('background-image-src') + "",
1492
+ background_type_color : background_type_color,
1493
+ background_type_color_input : content.find('input[name="cs-slide-background_type_color"]:checked').val(),
1494
+ background_propriety_position_x : content.find('.cs-slide-background_propriety_position_x').val(),
1495
+ background_propriety_position_y : content.find('.cs-slide-background_propriety_position_y').val(),
1496
+ background_repeat : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1497
+ background_propriety_size : content.find('.cs-slide-background_propriety_size').val(),
1498
+ data_in : content.find('.cs-slide-data_in').val(),
1499
+ data_out : content.find('.cs-slide-data_out').val(),
1500
+ data_time : parseInt(content.find('.cs-slide-data_time').val()),
1501
+ data_easeIn : parseInt(content.find('.cs-slide-data_easeIn').val()),
1502
+ data_easeOut : parseInt(content.find('.cs-slide-data_easeOut').val()),
1503
+ link : slide.find('.cs-background-link').val(),
1504
+ link_new_tab : slide.find('.cs-background-link_new_tab').prop('checked') ? 1 : 0,
1505
+ custom_css : content.find('.cs-slide-custom_css').val(),
1506
+ };
1507
+
1508
+ final_options['options'][i] = options;
1509
+
1510
+ i++;
1511
+ });
1512
+
1513
+ final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id')),
1514
+
1515
+ // Do the ajax call
1516
+ jQuery.ajax({
1517
+ type : 'POST',
1518
+ dataType : 'json',
1519
+ url : ajaxurl,
1520
+ data : {
1521
+ action: 'crellyslider_editSlides',
1522
+ security: crellyslider_currentSliderNonce,
1523
+ datas : final_options,
1524
+ },
1525
+ success: function(response) {
1526
+ //console.log('Save slides response: ' + response);
1527
+ if(response !== false) {
1528
+ crellyslider_saveElements();
1529
+ }
1530
+ else {
1531
+ crellyslider_showError();
1532
+ }
1533
+ },
1534
+
1535
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1536
+ alert('Error saving slides');
1537
+ console.log(XMLHttpRequest.responseText);
1538
+ crellyslider_showError();
1539
+ }
1540
+ });
1541
+ }
1542
+
1543
+ // Sends an array with all the elements options of each slide
1544
+ function crellyslider_saveElements() {
1545
+ var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1546
+ var i = 0, j = 0;
1547
+ var final_options = {};
1548
+
1549
+ final_options['options'] = new Array();
1550
+ slides.each(function() {
1551
+ var slide = $(this);
1552
+ var elements = slide.find('.cs-elements .cs-element-settings');
1553
+
1554
+ elements.each(function() {
1555
+ var element = $(this);
1556
+
1557
+ // Stop each loop when reach the void element
1558
+ if(element.hasClass('cs-void-element-settings')) {
1559
+ return;
1560
+ }
1561
+
1562
+ // Get the type of the element
1563
+ var type;
1564
+ if(element.hasClass('cs-text-element-settings')) {
1565
+ type = 'text';
1566
+ }
1567
+ else if(element.hasClass('cs-image-element-settings')) {
1568
+ type = 'image';
1569
+ }
1570
+ else if(element.hasClass('cs-video-element-settings')) {
1571
+ if(element.find('.cs-element-video_src').val() == 'youtube') {
1572
+ type = 'youtube_video';
1573
+ }
1574
+ else {
1575
+ type = 'vimeo_video';
1576
+ }
1577
+ }
1578
+ else {
1579
+ type = 'undefined';
1580
+ }
1581
+
1582
+ var options = {
1583
+ slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1584
+ slide_parent : i,
1585
+ position : element.index(),
1586
+ type : type,
1587
+
1588
+ inner_html : element.hasClass('cs-text-element-settings') ? element.find('.cs-element-inner_html').val() : '',
1589
+ image_src : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('src') : '',
1590
+ image_alt : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('alt') : '',
1591
+ data_left : parseInt(element.find('.cs-element-data_left').val()),
1592
+ data_top : parseInt(element.find('.cs-element-data_top').val()),
1593
+ z_index : parseInt(element.find('.cs-element-z_index').val()),
1594
+ data_delay : parseInt(element.find('.cs-element-data_delay').val()),
1595
+ data_time : element.find('.cs-element-data_time').val(),
1596
+ data_in : element.find('.cs-element-data_in').val(),
1597
+ data_out : element.find('.cs-element-data_out').val(),
1598
+ data_ignoreEaseOut : element.find('.cs-element-data_ignoreEaseOut').prop('checked') ? 1 : 0,
1599
+ data_easeIn : parseInt(element.find('.cs-element-data_easeIn').val()),
1600
+ data_easeOut : parseInt(element.find('.cs-element-data_easeOut').val()),
1601
+ custom_css : element.find('.cs-element-custom_css').val(),
1602
+ custom_css_classes : element.find('.cs-element-custom_css_classes').val(),
1603
+ link : element.hasClass('cs-video-element-settings') ? '' : element.find('.cs-element-link').val(),
1604
+ link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1605
+ video_id : element.hasClass('cs-video-element-settings') ? element.find('.cs-element-video_id').val() : '',
1606
+ video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1607
+ video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1608
+ video_start_mute : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_start_mute').val()) : -1,
1609
+ video_pause_while_watching : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_pause_while_watching').val()) : -1,
1610
+ };
1611
+
1612
+ final_options['options'][j] = options;
1613
+
1614
+ j++;
1615
+ });
1616
+
1617
+ i++;
1618
+ });
1619
+
1620
+ // Proceed?
1621
+ final_options['elements'] = 1;
1622
+ if(final_options['options'].length == 0) {
1623
+ final_options['elements'] = 0;
1624
+ }
1625
+
1626
+ final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1627
+
1628
+ final_options['options'] = JSON.stringify(final_options['options']);
1629
+
1630
+ // Do the ajax call
1631
+ jQuery.ajax({
1632
+ type : 'POST',
1633
+ dataType : 'json',
1634
+ url : ajaxurl,
1635
+ data : {
1636
+ action: 'crellyslider_editElements',
1637
+ security: crellyslider_currentSliderNonce,
1638
+ datas : final_options,
1639
+ },
1640
+ success: function(response) {
1641
+ //console.log(response);
1642
+ if(response !== false) {
1643
+ crellyslider_currentSliderNonce = response;
1644
+ crellyslider_showSuccess();
1645
+ }
1646
+ else {
1647
+ crellyslider_showError();
1648
+ }
1649
+ },
1650
+
1651
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1652
+ alert('Error saving elements');
1653
+ console.log(XMLHttpRequest.responseText);
1654
+ crellyslider_showError();
1655
+ }
1656
+ });
1657
+ }
1658
+
1659
+ function crellyslider_deleteSlider(content) {
1660
+ crellyslider_showWait();
1661
+
1662
+ // Get options
1663
+ var options = {
1664
+ id : parseInt(content.data('delete')),
1665
+ };
1666
+
1667
+ // Do the ajax call
1668
+ jQuery.ajax({
1669
+ type : 'POST',
1670
+ dataType : 'json',
1671
+ url : ajaxurl,
1672
+ data : {
1673
+ action: 'crellyslider_deleteSlider',
1674
+ security: crellyslider_nonces.deleteSlider,
1675
+ datas : options,
1676
+ },
1677
+ success: function(response) {
1678
+ //alert('Delete slider response: ' + response);
1679
+ if(response !== false) {
1680
+ if($('.cs-sliders-list .cs-delete-slider').length > 1) {
1681
+ content.parent().parent().remove();
1682
+ }
1683
+ else {
1684
+ location.reload();
1685
+ }
1686
+ crellyslider_showSuccess();
1687
+ }
1688
+ else {
1689
+ crellyslider_showError();
1690
+ }
1691
+ },
1692
+
1693
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1694
+ alert('Error deleting slider');
1695
+ console.log(XMLHttpRequest.responseText);
1696
+ crellyslider_showError();
1697
+ },
1698
+ });
1699
+ }
1700
+
1701
+ function crellyslider_duplicateSlider(content) {
1702
+ crellyslider_showWait();
1703
+
1704
+ // Get options
1705
+ var options = {
1706
+ id : parseInt(content.data('duplicate')),
1707
+ };
1708
+
1709
+ // Do the ajax call
1710
+ jQuery.ajax({
1711
+ type : 'POST',
1712
+ dataType : 'json',
1713
+ url : ajaxurl,
1714
+ data : {
1715
+ action: 'crellyslider_duplicateSlider',
1716
+ security: crellyslider_nonces.duplicateSlider,
1717
+ datas : options,
1718
+ },
1719
+ success: function(response) {
1720
+ //console.log(response);
1721
+ if(response['response'] !== false) {
1722
+ var cloned_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1723
+ cloned_slider.find('.cs-slider-id').html(response['cloned_slider_id']);
1724
+ cloned_slider.find('.cs-slider-name a').html(response['cloned_slider_name']);
1725
+ cloned_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1726
+ cloned_slider.find('.cs-slider-alias').html(response['cloned_slider_alias']);
1727
+ cloned_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['cloned_slider_alias'] + '"]');
1728
+ cloned_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1729
+ cloned_slider.find('.cs-duplicate-slider').data('duplicate', response['cloned_slider_id']);
1730
+ cloned_slider.find('.cs-delete-slider').data('delete', response['cloned_slider_id']);
1731
+ cloned_slider.find('.cs-export-slider').data('export', response['cloned_slider_id']);
1732
+
1733
+ crellyslider_showSuccess();
1734
+ }
1735
+ else {
1736
+ crellyslider_showError();
1737
+ }
1738
+ },
1739
+
1740
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1741
+ alert('Error duplicating slider');
1742
+ console.log(XMLHttpRequest.responseText);
1743
+ crellyslider_showError();
1744
+ },
1745
+ });
1746
+ }
1747
+
1748
+ function crellyslider_exportSlider(content) {
1749
+ crellyslider_showWait();
1750
+
1751
+ // Get options
1752
+ var options = {
1753
+ id : parseInt(content.data('export')),
1754
+ };
1755
+
1756
+ // Do the ajax call
1757
+ jQuery.ajax({
1758
+ type : 'POST',
1759
+ dataType : 'json',
1760
+ url : ajaxurl,
1761
+ data : {
1762
+ action: 'crellyslider_exportSlider',
1763
+ security: crellyslider_nonces.exportSlider,
1764
+ datas : options,
1765
+ },
1766
+ success: function(response) {
1767
+ if(response['response'] !== false) {
1768
+ window.location.href = response['url'];
1769
+ crellyslider_showSuccess();
1770
+ }
1771
+ else {
1772
+ crellyslider_showError();
1773
+ }
1774
+ },
1775
+
1776
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1777
+ alert('Error while exporting the slider');
1778
+ console.log(XMLHttpRequest.responseText);
1779
+ crellyslider_showError();
1780
+ },
1781
+ });
1782
+ }
1783
+
1784
+ function crellyslider_importSlider() {
1785
+ var file = $('#cs-import-file')[0].files[0];
1786
+
1787
+ if(! file) {
1788
+ return;
1789
+ }
1790
+
1791
+ // Reset input file. Prevents conflicts
1792
+ $('#cs-import-file').val('');
1793
+
1794
+ crellyslider_showWait();
1795
+
1796
+ // Form data (for file uploads)
1797
+ var fd = new FormData();
1798
+ fd.append('file', file);
1799
+ fd.append('action', 'crellyslider_importSlider');
1800
+ fd.append('security', crellyslider_nonces.importSlider);
1801
+
1802
+ // Do the ajax call
1803
+ jQuery.ajax({
1804
+ type : 'POST',
1805
+ url : ajaxurl,
1806
+ contentType: false,
1807
+ processData : false,
1808
+ data : fd,
1809
+ success: function(response) {
1810
+ response = JSON.parse(response);
1811
+ //console.log(response);
1812
+ if(response['response'] !== false) {
1813
+ var content = $('.cs-sliders-list .cs-duplicate-slider:eq(0)');
1814
+ if(content.length > 0) {
1815
+ var imported_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1816
+ imported_slider.find('.cs-slider-id').html(response['imported_slider_id']);
1817
+ imported_slider.find('.cs-slider-name a').html(response['imported_slider_name']);
1818
+ imported_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1819
+ imported_slider.find('.cs-slider-alias').html(response['imported_slider_alias']);
1820
+ imported_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['imported_slider_alias'] + '"]');
1821
+ imported_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1822
+ imported_slider.find('.cs-duplicate-slider').data('duplicate', response['imported_slider_id']);
1823
+ imported_slider.find('.cs-delete-slider').data('delete', response['imported_slider_id']);
1824
+ imported_slider.find('.cs-delete-slider').data('export', response['imported_slider_id']);
1825
+ }
1826
+ else {
1827
+ location.reload();
1828
+ }
1829
+
1830
+ crellyslider_showSuccess();
1831
+ }
1832
+ else {
1833
+ crellyslider_showError();
1834
+ }
1835
+ },
1836
+
1837
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1838
+ alert('Error while importing the slider');
1839
+ console.log(XMLHttpRequest.responseText);
1840
+ crellyslider_showError();
1841
+ },
1842
+ });
1843
+ }
1844
+
1845
+ });
1846
+ })(jQuery);
wordpress/slider.php CHANGED
@@ -1,366 +1,366 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
-
3
- <div id="cs-slider-settings">
4
- <?php
5
- // Contains the key, the display name and a boolean: true if is the default option
6
- $slider_select_options = array(
7
- 'layout' => array(
8
- 'full-width' => array(__('Full Width', 'crelly-slider'), true),
9
- 'fixed' => array(__('Fixed', 'crelly-slider'), false),
10
- ),
11
- 'boolean' => array(
12
- 1 => array(__('Yes', 'crelly-slider'), true),
13
- 0 => array(__('No', 'crelly-slider'), false),
14
- ),
15
- 'boolean_not' => array(
16
- 1 => array(__('Yes', 'crelly-slider'), false),
17
- 0 => array(__('No', 'crelly-slider'), true),
18
- ),
19
- );
20
- ?>
21
-
22
- <?php if($edit) { ?>
23
- <input type="text" id="cs-slider-name" placeholder="<?php _e('Slider Name', 'crelly-slider'); ?>" value="<?php echo sanitize_text_field($slider->name); ?>" />
24
- <?php
25
- }
26
- else { ?>
27
- <input type="text" id="cs-slider-name" placeholder="<?php _e('Slider Name', 'crelly-slider'); ?>" />
28
- <?php } ?>
29
-
30
- <br />
31
- <br />
32
-
33
- <strong><?php _e('Alias:', 'crelly-slider'); ?></strong>
34
- <?php if($edit) { ?>
35
- <span id="cs-slider-alias"><?php echo esc_html($slider->alias); ?></span>
36
- <?php
37
- }
38
- else { ?>
39
- <span id="cs-slider-alias"></span>
40
- <?php } ?>
41
-
42
- <br />
43
- <br />
44
-
45
- <strong><?php _e('Shortcode:', 'crelly-slider'); ?></strong>
46
- <?php if($edit) { ?>
47
- <span id="cs-slider-shortcode">[crellyslider alias="<?php echo esc_html($slider->alias); ?>"]</span>
48
- <?php
49
- }
50
- else { ?>
51
- <span id="cs-slider-shortcode"></span>
52
- <?php } ?>
53
-
54
- <br />
55
- <br />
56
-
57
- <table class="cs-slider-settings-list cs-table">
58
- <thead>
59
- <tr class="odd-row">
60
- <th colspan="3"><?php _e('Slider General Options', 'crelly-slider'); ?></th>
61
- </tr>
62
- </thead>
63
- <tbody>
64
- <tr class="cs-table-header">
65
- <td><?php _e('Option', 'crelly-slider'); ?></td>
66
- <td><?php _e('Parameter', 'crelly-slider'); ?></td>
67
- <td><?php _e('Description', 'crelly-slider'); ?></td>
68
- </tr>
69
- <tr>
70
- <td class="cs-name"><?php _e('Layout', 'crelly-slider'); ?></td>
71
- <td class="cs-content">
72
- <select id="cs-slider-layout">
73
- <?php
74
- foreach($slider_select_options['layout'] as $key => $value) {
75
- echo '<option value="' . $key . '"';
76
- if((!$edit && $value[1]) || ($edit && $slider->layout == $key)) {
77
- echo ' selected';
78
- }
79
- echo '>' . $value[0] . '</option>';
80
- }
81
- ?>
82
- </select>
83
- </td>
84
- <td class="cs-description">
85
- <?php _e('Modify the layout type of the slider.', 'crelly-slider'); ?>
86
- </td>
87
- </tr>
88
- <tr>
89
- <td class="cs-name"><?php _e('Responsive', 'crelly-slider'); ?></td>
90
- <td class="cs-content">
91
- <select id="cs-slider-responsive">
92
- <?php
93
- foreach($slider_select_options['boolean'] as $key => $value) {
94
- echo '<option value="' . $key . '"';
95
- if((!$edit && $value[1]) || ($edit && $slider->responsive == $key)) {
96
- echo ' selected';
97
- }
98
- echo '>' . $value[0] . '</option>';
99
- }
100
- ?>
101
- </select>
102
- </td>
103
- <td class="cs-description">
104
- <?php _e('The slider will be adapted to the screen size.', 'crelly-slider'); ?>
105
- </td>
106
- </tr>
107
- <tr>
108
- <td class="cs-name"><?php _e('Start Width', 'crelly-slider'); ?></td>
109
- <td class="cs-content">
110
- <?php
111
- if(!$edit) echo '<input id="cs-slider-startWidth" type="text" value="1140" />';
112
- else echo '<input id="cs-slider-startWidth" type="text" value="' . sanitize_text_field($slider->startWidth) .'" />';
113
- ?>
114
- px
115
- </td>
116
- <td class="cs-description">
117
- <?php _e('The content initial width of the slider.', 'crelly-slider'); ?>
118
- </td>
119
- </tr>
120
- <tr>
121
- <td class="cs-name"><?php _e('Start Height', 'crelly-slider'); ?></td>
122
- <td class="cs-content">
123
- <?php
124
- if(!$edit) echo '<input id="cs-slider-startHeight" type="text" value="500" />';
125
- else echo '<input id="cs-slider-startHeight" type="text" value="' . sanitize_text_field($slider->startHeight) .'" />';
126
- ?>
127
- px
128
- </td>
129
- <td class="cs-description">
130
- <?php _e('The content initial height of the slider.', 'crelly-slider'); ?>
131
- </td>
132
- </tr>
133
- <tr>
134
- <td class="cs-name"><?php _e('Automatic Slide', 'crelly-slider'); ?></td>
135
- <td class="cs-content">
136
- <select id="cs-slider-automaticSlide">
137
- <?php
138
- foreach($slider_select_options['boolean'] as $key => $value) {
139
- echo '<option value="' . $key . '"';
140
- if((!$edit && $value[1]) || ($edit && $slider->automaticSlide == $key)) {
141
- echo ' selected';
142
- }
143
- echo '>' . $value[0] . '</option>';
144
- }
145
- ?>
146
- </select>
147
- </td>
148
- <td class="cs-description">
149
- <?php _e('The slides loop is automatic.', 'crelly-slider'); ?>
150
- </td>
151
- </tr>
152
- <tr>
153
- <td class="cs-name"><?php _e('Show Controls', 'crelly-slider'); ?></td>
154
- <td class="cs-content">
155
- <select id="cs-slider-showControls">
156
- <?php
157
- foreach($slider_select_options['boolean'] as $key => $value) {
158
- echo '<option value="' . $key . '"';
159
- if((!$edit && $value[1]) || ($edit && $slider->showControls == $key)) {
160
- echo ' selected';
161
- }
162
- echo '>' . $value[0] . '</option>';
163
- }
164
- ?>
165
- </select>
166
- </td>
167
- <td class="cs-description">
168
- <?php _e('Show the previous and next arrows.', 'crelly-slider'); ?>
169
- </td>
170
- </tr>
171
- <tr>
172
- <td class="cs-name"><?php _e('Show Navigation', 'crelly-slider'); ?></td>
173
- <td class="cs-content">
174
- <select id="cs-slider-showNavigation">
175
- <?php
176
- foreach($slider_select_options['boolean'] as $key => $value) {
177
- echo '<option value="' . $key . '"';
178
- if((!$edit && $value[1]) || ($edit && $slider->showNavigation == $key)) {
179
- echo ' selected';
180
- }
181
- echo '>' . $value[0] . '</option>';
182
- }
183
- ?>
184
- </select>
185
- </td>
186
- <td class="cs-description">
187
- <?php _e('Show the links buttons to change slide.', 'crelly-slider'); ?>
188
- </td>
189
- </tr>
190
- <tr>
191
- <td class="cs-name"><?php _e('Enable swipe and drag', 'crelly-slider'); ?></td>
192
- <td class="cs-content">
193
- <select id="cs-slider-enableSwipe">
194
- <?php
195
- foreach($slider_select_options['boolean'] as $key => $value) {
196
- echo '<option value="' . $key . '"';
197
- if((!$edit && $value[1]) || ($edit && $slider->enableSwipe == $key)) {
198
- echo ' selected';
199
- }
200
- echo '>' . $value[0] . '</option>';
201
- }
202
- ?>
203
- </select>
204
- </td>
205
- <td class="cs-description">
206
- <?php _e('Enable swipe left, swipe right, drag left, drag right commands.', 'crelly-slider'); ?>
207
- </td>
208
- </tr>
209
- <tr>
210
- <td class="cs-name"><?php _e('Show Progress Bar', 'crelly-slider'); ?></td>
211
- <td class="cs-content">
212
- <select id="cs-slider-showProgressBar">
213
- <?php
214
- foreach($slider_select_options['boolean'] as $key => $value) {
215
- echo '<option value="' . $key . '"';
216
- if((!$edit && $value[1]) || ($edit && $slider->showProgressBar == $key)) {
217
- echo ' selected';
218
- }
219
- echo '>' . $value[0] . '</option>';
220
- }
221
- ?>
222
- </select>
223
- </td>
224
- <td class="cs-description">
225
- <?php _e('Draw the progress bar during the slide execution.', 'crelly-slider'); ?>
226
- </td>
227
- </tr>
228
- <tr>
229
- <td class="cs-name"><?php _e('Pause on Hover', 'crelly-slider'); ?></td>
230
- <td class="cs-content">
231
- <select id="cs-slider-pauseOnHover">
232
- <?php
233
- foreach($slider_select_options['boolean'] as $key => $value) {
234
- echo '<option value="' . $key . '"';
235
- if((!$edit && $value[1]) || ($edit && $slider->pauseOnHover == $key)) {
236
- echo ' selected';
237
- }
238
- echo '>' . $value[0] . '</option>';
239
- }
240
- ?>
241
- </select>
242
- </td>
243
- <td class="cs-description">
244
- <?php _e('Pause the current slide when hovered.', 'crelly-slider'); ?>
245
- </td>
246
- </tr>
247
- <tr>
248
- <td class="cs-name"><?php _e('Random order', 'crelly-slider'); ?></td>
249
- <td class="cs-content">
250
- <select id="cs-slider-randomOrder">
251
- <?php
252
- foreach($slider_select_options['boolean_not'] as $key => $value) {
253
- echo '<option value="' . $key . '"';
254
- if((!$edit && $value[1]) || ($edit && $slider->randomOrder == $key)) {
255
- echo ' selected';
256
- }
257
- echo '>' . $value[0] . '</option>';
258
- }
259
- ?>
260
- </select>
261
- </td>
262
- <td class="cs-description">
263
- <?php _e('The order of the slides is random (instead of being linear).', 'crelly-slider'); ?>
264
- </td>
265
- </tr>
266
- <tr>
267
- <td class="cs-name"><?php _e('Start from slide', 'crelly-slider'); ?></td>
268
- <td class="cs-content">
269
- <select id="cs-slider-startFromSlide">
270
- <?php
271
- if(! $edit) {
272
- echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
273
- echo '<option selected value="0">' . __('Slide', 'crelly-slider') . ' 1</option>';
274
- }
275
- else {
276
- if($slider->startFromSlide == -1) {
277
- echo '<option selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
278
- }
279
- else {
280
- echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
281
- for($i = 0; $i < count($slides); $i++) {
282
- echo '<option value="' . $i . '"';
283
- if($slider->startFromSlide == $i) {
284
- echo ' selected';
285
- }
286
- echo '>' . __('Slide', 'crelly-slider') . ' ' . ($i + 1) . '</option>';
287
- }
288
- }
289
- }
290
- ?>
291
- </select>
292
- </td>
293
- <td class="cs-description">
294
- <?php _e('The slide that will be displayed first.', 'crelly-slider'); ?>
295
- </td>
296
- </tr>
297
- <tr>
298
- <td class="cs-name"><?php _e('Display slider from/to', 'crelly-slider'); ?></td>
299
- <td class="cs-content">
300
- <?php
301
- $minDate = '1000-01-01 00:00:00';
302
- $maxDate = '9999-12-31 23:59:59';
303
-
304
- if(!$edit || ($edit && $slider->fromDate == $minDate)) echo '<input checked id="cs-slider-displayImmediately" type="checkbox">' . __('Display from now', 'crelly-slider');
305
- else echo '<input id="cs-slider-displayImmediately" type="checkbox">' . __('Display from now', 'crelly-slider');
306
-
307
- if(!$edit || ($edit && $slider->fromDate == $minDate)) echo '<div style="display: none;" id="cs-slider-displayFromWrapper">';
308
- else echo '<div id="cs-slider-displayFromWrapper">';
309
-
310
- echo '<br />';
311
- _e('Display from', 'crelly-slider');
312
- echo ':<br />';
313
- if(!$edit || ($edit && $slider->fromDate == $minDate)) echo '<input class="cs-slider-datepicker" id="cs-slider-fromDate" type="text" />';
314
- else echo '<input class="cs-slider-datepicker" id="cs-slider-fromDate" type="text" value="' . sanitize_text_field($slider->fromDate) .'" />';
315
-
316
- echo '</div>';
317
- ?>
318
-
319
- <br />
320
- <br />
321
-
322
- <?php
323
- if(!$edit || ($edit && $slider->toDate == $maxDate)) echo '<input checked id="cs-slider-displayForever" type="checkbox">' . __('Display forever', 'crelly-slider');
324
- else echo '<input id="cs-slider-displayForever" type="checkbox">' . __('Display forever', 'crelly-slider');
325
-
326
- if(!$edit || ($edit && $slider->toDate == $maxDate)) echo '<div style="display: none;" id="cs-slider-displayToWrapper">';
327
- else echo '<div id="cs-slider-displayToWrapper">';
328
-
329
- echo '<br />';
330
- _e('Display to', 'crelly-slider');
331
- echo ':<br />';
332
- if(!$edit || ($edit && $slider->toDate == $maxDate)) echo '<input class="cs-slider-datepicker" id="cs-slider-toDate" type="text" />';
333
- else echo '<input class="cs-slider-datepicker" id="cs-slider-toDate" type="text" value="' . sanitize_text_field($slider->toDate) .'" />';
334
-
335
- echo '</div>';
336
- ?>
337
- </td>
338
- <td class="cs-description">
339
- <?php _e('Need a slider during Black Friday days? This is the option you need!', 'crelly-slider'); ?>
340
- </td>
341
- </tr>
342
- <tr>
343
- <td class="cs-name"><?php _e('Callbacks', 'crelly-slider'); ?></td>
344
- <td class="cs-content">
345
- <?php
346
- if(!$edit || ($edit && stripslashes($slider->callbacks) == '')) {
347
- // Sorry for this ugly indentation, ajax compatibility problems...
348
- ?>
349
- <textarea id="cs-slider-callbacks">
350
- beforeStart : function() {},
351
- beforeSetResponsive : function() {},
352
- beforeSlideStart : function() {},
353
- beforePause : function() {},
354
- beforeResume : function() {},</textarea>
355
- <?php
356
- }
357
- else echo '<textarea id="cs-slider-callbacks">' . stripslashes($slider->callbacks) . '</textarea>';
358
- ?>
359
- </td>
360
- <td class="cs-description">
361
- <?php _e('Some jQuery functions that you can fire during the slider execution.', 'crelly-slider'); ?>
362
- </td>
363
- </tr>
364
- </tbody>
365
- </table>
366
- </div>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
+
3
+ <div id="cs-slider-settings">
4
+ <?php
5
+ // Contains the key, the display name and a boolean: true if is the default option
6
+ $slider_select_options = array(
7
+ 'layout' => array(
8
+ 'full-width' => array(__('Full Width', 'crelly-slider'), true),
9
+ 'fixed' => array(__('Fixed', 'crelly-slider'), false),
10
+ ),
11
+ 'boolean' => array(
12
+ 1 => array(__('Yes', 'crelly-slider'), true),
13
+ 0 => array(__('No', 'crelly-slider'), false),
14
+ ),
15
+ 'boolean_not' => array(
16
+ 1 => array(__('Yes', 'crelly-slider'), false),
17
+ 0 => array(__('No', 'crelly-slider'), true),
18
+ ),
19
+ );
20
+ ?>
21
+
22
+ <?php if($edit) { ?>
23
+ <input type="text" id="cs-slider-name" placeholder="<?php _e('Slider Name', 'crelly-slider'); ?>" value="<?php echo sanitize_text_field($slider->name); ?>" />
24
+ <?php
25
+ }
26
+ else { ?>
27
+ <input type="text" id="cs-slider-name" placeholder="<?php _e('Slider Name', 'crelly-slider'); ?>" />
28
+ <?php } ?>
29
+
30
+ <br />
31
+ <br />
32
+
33
+ <strong><?php _e('Alias:', 'crelly-slider'); ?></strong>
34
+ <?php if($edit) { ?>
35
+ <span id="cs-slider-alias"><?php echo esc_html($slider->alias); ?></span>
36
+ <?php
37
+ }
38
+ else { ?>
39
+ <span id="cs-slider-alias"></span>
40
+ <?php } ?>
41
+
42
+ <br />
43
+ <br />
44
+
45
+ <strong><?php _e('Shortcode:', 'crelly-slider'); ?></strong>
46
+ <?php if($edit) { ?>
47
+ <span id="cs-slider-shortcode">[crellyslider alias="<?php echo esc_html($slider->alias); ?>"]</span>
48
+ <?php
49
+ }
50
+ else { ?>
51
+ <span id="cs-slider-shortcode"></span>
52
+ <?php } ?>
53
+
54
+ <br />
55
+ <br />
56
+
57
+ <table class="cs-slider-settings-list cs-table">
58
+ <thead>
59
+ <tr class="odd-row">
60
+ <th colspan="3"><?php _e('Slider General Options', 'crelly-slider'); ?></th>
61
+ </tr>
62
+ </thead>
63
+ <tbody>
64
+ <tr class="cs-table-header">
65
+ <td><?php _e('Option', 'crelly-slider'); ?></td>
66
+ <td><?php _e('Parameter', 'crelly-slider'); ?></td>
67
+ <td><?php _e('Description', 'crelly-slider'); ?></td>
68
+ </tr>
69
+ <tr>
70
+ <td class="cs-name"><?php _e('Layout', 'crelly-slider'); ?></td>
71
+ <td class="cs-content">
72
+ <select id="cs-slider-layout">
73
+ <?php
74
+ foreach($slider_select_options['layout'] as $key => $value) {
75
+ echo '<option value="' . $key . '"';
76
+ if((!$edit && $value[1]) || ($edit && $slider->layout == $key)) {
77
+ echo ' selected';
78
+ }
79
+ echo '>' . $value[0] . '</option>';
80
+ }
81
+ ?>
82
+ </select>
83
+ </td>
84
+ <td class="cs-description">
85
+ <?php _e('Modify the layout type of the slider.', 'crelly-slider'); ?>
86
+ </td>
87
+ </tr>
88
+ <tr>
89
+ <td class="cs-name"><?php _e('Responsive', 'crelly-slider'); ?></td>
90
+ <td class="cs-content">
91
+ <select id="cs-slider-responsive">
92
+ <?php
93
+ foreach($slider_select_options['boolean'] as $key => $value) {
94
+ echo '<option value="' . $key . '"';
95
+ if((!$edit && $value[1]) || ($edit && $slider->responsive == $key)) {
96
+ echo ' selected';
97
+ }
98
+ echo '>' . $value[0] . '</option>';
99
+ }
100
+ ?>
101
+ </select>
102
+ </td>
103
+ <td class="cs-description">
104
+ <?php _e('The slider will be adapted to the screen size.', 'crelly-slider'); ?>
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td class="cs-name"><?php _e('Start Width', 'crelly-slider'); ?></td>
109
+ <td class="cs-content">
110
+ <?php
111
+ if(!$edit) echo '<input id="cs-slider-startWidth" type="text" value="1140" />';
112
+ else echo '<input id="cs-slider-startWidth" type="text" value="' . sanitize_text_field($slider->startWidth) .'" />';
113
+ ?>
114
+ px
115
+ </td>
116
+ <td class="cs-description">
117
+ <?php _e('The content initial width of the slider.', 'crelly-slider'); ?>
118
+ </td>
119
+ </tr>
120
+ <tr>
121
+ <td class="cs-name"><?php _e('Start Height', 'crelly-slider'); ?></td>
122
+ <td class="cs-content">
123
+ <?php
124
+ if(!$edit) echo '<input id="cs-slider-startHeight" type="text" value="500" />';
125
+ else echo '<input id="cs-slider-startHeight" type="text" value="' . sanitize_text_field($slider->startHeight) .'" />';
126
+ ?>
127
+ px
128
+ </td>
129
+ <td class="cs-description">
130
+ <?php _e('The content initial height of the slider.', 'crelly-slider'); ?>
131
+ </td>
132
+ </tr>
133
+ <tr>
134
+ <td class="cs-name"><?php _e('Automatic Slide', 'crelly-slider'); ?></td>
135
+ <td class="cs-content">
136
+ <select id="cs-slider-automaticSlide">
137
+ <?php
138
+ foreach($slider_select_options['boolean'] as $key => $value) {
139
+ echo '<option value="' . $key . '"';
140
+ if((!$edit && $value[1]) || ($edit && $slider->automaticSlide == $key)) {
141
+ echo ' selected';
142
+ }
143
+ echo '>' . $value[0] . '</option>';
144
+ }
145
+ ?>
146
+ </select>
147
+ </td>
148
+ <td class="cs-description">
149
+ <?php _e('The slides loop is automatic.', 'crelly-slider'); ?>
150
+ </td>
151
+ </tr>
152
+ <tr>
153
+ <td class="cs-name"><?php _e('Show Controls', 'crelly-slider'); ?></td>
154
+ <td class="cs-content">
155
+ <select id="cs-slider-showControls">
156
+ <?php
157
+ foreach($slider_select_options['boolean'] as $key => $value) {
158
+ echo '<option value="' . $key . '"';
159
+ if((!$edit && $value[1]) || ($edit && $slider->showControls == $key)) {
160
+ echo ' selected';
161
+ }
162
+ echo '>' . $value[0] . '</option>';
163
+ }
164
+ ?>
165
+ </select>
166
+ </td>
167
+ <td class="cs-description">
168
+ <?php _e('Show the previous and next arrows.', 'crelly-slider'); ?>
169
+ </td>
170
+ </tr>
171
+ <tr>
172
+ <td class="cs-name"><?php _e('Show Navigation', 'crelly-slider'); ?></td>
173
+ <td class="cs-content">
174
+ <select id="cs-slider-showNavigation">
175
+ <?php
176
+ foreach($slider_select_options['boolean'] as $key => $value) {
177
+ echo '<option value="' . $key . '"';
178
+ if((!$edit && $value[1]) || ($edit && $slider->showNavigation == $key)) {
179
+ echo ' selected';
180
+ }
181
+ echo '>' . $value[0] . '</option>';
182
+ }
183
+ ?>
184
+ </select>
185
+ </td>
186
+ <td class="cs-description">
187
+ <?php _e('Show the links buttons to change slide.', 'crelly-slider'); ?>
188
+ </td>
189
+ </tr>
190
+ <tr>
191
+ <td class="cs-name"><?php _e('Enable swipe and drag', 'crelly-slider'); ?></td>
192
+ <td class="cs-content">
193
+ <select id="cs-slider-enableSwipe">
194
+ <?php
195
+ foreach($slider_select_options['boolean'] as $key => $value) {
196
+ echo '<option value="' . $key . '"';
197
+ if((!$edit && $value[1]) || ($edit && $slider->enableSwipe == $key)) {
198
+ echo ' selected';
199
+ }
200
+ echo '>' . $value[0] . '</option>';
201
+ }
202
+ ?>
203
+ </select>
204
+ </td>
205
+ <td class="cs-description">
206
+ <?php _e('Enable swipe left, swipe right, drag left, drag right commands.', 'crelly-slider'); ?>
207
+ </td>
208
+ </tr>
209
+ <tr>
210
+ <td class="cs-name"><?php _e('Show Progress Bar', 'crelly-slider'); ?></td>
211
+ <td class="cs-content">
212
+ <select id="cs-slider-showProgressBar">
213
+ <?php
214
+ foreach($slider_select_options['boolean'] as $key => $value) {
215
+ echo '<option value="' . $key . '"';
216
+ if((!$edit && $value[1]) || ($edit && $slider->showProgressBar == $key)) {
217
+ echo ' selected';
218
+ }
219
+ echo '>' . $value[0] . '</option>';
220
+ }
221
+ ?>
222
+ </select>
223
+ </td>
224
+ <td class="cs-description">
225
+ <?php _e('Draw the progress bar during the slide execution.', 'crelly-slider'); ?>
226
+ </td>
227
+ </tr>
228
+ <tr>
229
+ <td class="cs-name"><?php _e('Pause on Hover', 'crelly-slider'); ?></td>
230
+ <td class="cs-content">
231
+ <select id="cs-slider-pauseOnHover">
232
+ <?php
233
+ foreach($slider_select_options['boolean'] as $key => $value) {
234
+ echo '<option value="' . $key . '"';
235
+ if((!$edit && $value[1]) || ($edit && $slider->pauseOnHover == $key)) {
236
+ echo ' selected';
237
+ }
238
+ echo '>' . $value[0] . '</option>';
239
+ }
240
+ ?>
241
+ </select>
242
+ </td>
243
+ <td class="cs-description">
244
+ <?php _e('Pause the current slide when hovered.', 'crelly-slider'); ?>
245
+ </td>
246
+ </tr>
247
+ <tr>
248
+ <td class="cs-name"><?php _e('Random order', 'crelly-slider'); ?></td>
249
+ <td class="cs-content">
250
+ <select id="cs-slider-randomOrder">
251
+ <?php
252
+ foreach($slider_select_options['boolean_not'] as $key => $value) {
253
+ echo '<option value="' . $key . '"';
254
+ if((!$edit && $value[1]) || ($edit && $slider->randomOrder == $key)) {
255
+ echo ' selected';
256
+ }
257
+ echo '>' . $value[0] . '</option>';
258
+ }
259
+ ?>
260
+ </select>
261
+ </td>
262
+ <td class="cs-description">
263
+ <?php _e('The order of the slides is random (instead of being linear).', 'crelly-slider'); ?>
264
+ </td>
265
+ </tr>
266
+ <tr>
267
+ <td class="cs-name"><?php _e('Start from slide', 'crelly-slider'); ?></td>
268
+ <td class="cs-content">
269
+ <select id="cs-slider-startFromSlide">
270
+ <?php
271
+ if(! $edit) {
272
+ echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
273
+ echo '<option selected value="0">' . __('Slide', 'crelly-slider') . ' 1</option>';
274
+ }
275
+ else {
276
+ if($slider->startFromSlide == -1) {
277
+ echo '<option selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
278
+ }
279
+ else {
280
+ echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
281
+ for($i = 0; $i < count($slides); $i++) {
282
+ echo '<option value="' . $i . '"';
283
+ if($slider->startFromSlide == $i) {
284
+ echo ' selected';
285
+ }
286
+ echo '>' . __('Slide', 'crelly-slider') . ' ' . ($i + 1) . '</option>';
287
+ }
288
+ }
289
+ }
290
+ ?>
291
+ </select>
292
+ </td>
293
+ <td class="cs-description">
294
+ <?php _e('The slide that will be displayed first.', 'crelly-slider'); ?>
295
+ </td>
296
+ </tr>
297
+ <tr>
298
+ <td class="cs-name"><?php _e('Display slider from/to', 'crelly-slider'); ?></td>
299
+ <td class="cs-content">
300
+ <?php
301
+ $minDate = '1000-01-01 00:00:00';
302
+ $maxDate = '9999-12-31 23:59:59';
303
+
304
+ if(!$edit || ($edit && $slider->fromDate == $minDate)) echo '<input checked id="cs-slider-displayImmediately" type="checkbox">' . __('Display from now', 'crelly-slider');
305
+ else echo '<input id="cs-slider-displayImmediately" type="checkbox">' . __('Display from now', 'crelly-slider');
306
+
307
+ if(!$edit || ($edit && $slider->fromDate == $minDate)) echo '<div style="display: none;" id="cs-slider-displayFromWrapper">';
308
+ else echo '<div id="cs-slider-displayFromWrapper">';
309
+
310
+ echo '<br />';
311
+ _e('Display from', 'crelly-slider');
312
+ echo ':<br />';
313
+ if(!$edit || ($edit && $slider->fromDate == $minDate)) echo '<input class="cs-slider-datepicker" id="cs-slider-fromDate" type="text" />';
314
+ else echo '<input class="cs-slider-datepicker" id="cs-slider-fromDate" type="text" value="' . sanitize_text_field($slider->fromDate) .'" />';
315
+
316
+ echo '</div>';
317
+ ?>
318
+
319
+ <br />
320
+ <br />
321
+
322
+ <?php
323
+ if(!$edit || ($edit && $slider->toDate == $maxDate)) echo '<input checked id="cs-slider-displayForever" type="checkbox">' . __('Display forever', 'crelly-slider');
324
+ else echo '<input id="cs-slider-displayForever" type="checkbox">' . __('Display forever', 'crelly-slider');
325
+
326
+ if(!$edit || ($edit && $slider->toDate == $maxDate)) echo '<div style="display: none;" id="cs-slider-displayToWrapper">';
327
+ else echo '<div id="cs-slider-displayToWrapper">';
328
+
329
+ echo '<br />';
330
+ _e('Display to', 'crelly-slider');
331
+ echo ':<br />';
332
+ if(!$edit || ($edit && $slider->toDate == $maxDate)) echo '<input class="cs-slider-datepicker" id="cs-slider-toDate" type="text" />';
333
+ else echo '<input class="cs-slider-datepicker" id="cs-slider-toDate" type="text" value="' . sanitize_text_field($slider->toDate) .'" />';
334
+
335
+ echo '</div>';
336
+ ?>
337
+ </td>
338
+ <td class="cs-description">
339
+ <?php _e('Need a slider during Black Friday days? This is the option you need!', 'crelly-slider'); ?>
340
+ </td>
341
+ </tr>
342
+ <tr>
343
+ <td class="cs-name"><?php _e('Callbacks', 'crelly-slider'); ?></td>
344
+ <td class="cs-content">
345
+ <?php
346
+ if(!$edit || ($edit && stripslashes($slider->callbacks) == '')) {
347
+ // Sorry for this ugly indentation, ajax compatibility problems...
348
+ ?>
349
+ <textarea id="cs-slider-callbacks">
350
+ beforeStart : function() {},
351
+ beforeSetResponsive : function() {},
352
+ beforeSlideStart : function() {},
353
+ beforePause : function() {},
354
+ beforeResume : function() {},</textarea>
355
+ <?php
356
+ }
357
+ else echo '<textarea id="cs-slider-callbacks">' . stripslashes($slider->callbacks) . '</textarea>';
358
+ ?>
359
+ </td>
360
+ <td class="cs-description">
361
+ <?php _e('Some jQuery functions that you can fire during the slider execution.', 'crelly-slider'); ?>
362
+ </td>
363
+ </tr>
364
+ </tbody>
365
+ </table>
366
+ </div>
wordpress/slides.php CHANGED
@@ -1,366 +1,366 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
-
3
- <div id="cs-slides">
4
- <div class="cs-slide-tabs cs-tabs cs-tabs-border">
5
- <ul class="cs-sortable">
6
- <?php
7
- if($edit) {
8
- $j = 0;
9
- $slides_num = count($slides);
10
- foreach($slides as $slide) {
11
- if($j == $slides_num - 1) {
12
- echo '<li class="ui-state-default active">';
13
- }
14
- else {
15
- echo '<li class="ui-state-default">';
16
- }
17
- echo '<a><span class="cs-slide-name-text">' . __('Slide', 'crelly-slider') . ' <span class="cs-slide-index">' . esc_html(($slide->position) + 1) . '</span></span></a>';
18
- echo '<span title="' . __('Duplicate slide', 'crelly-slider') . '" class="cs-duplicate"></span>';
19
- echo '<span title="' . __('Delete slide', 'crelly-slider') . '" class="cs-close"></span>';
20
- echo '</li>';
21
-
22
- $j++;
23
- }
24
- }
25
- ?>
26
- <li class="ui-state-default ui-state-disabled"><a class="cs-add-new"><?php _e('Add Slide', 'crelly-slider'); ?></a></li>
27
- <div style="clear: both;"></div>
28
- </ul>
29
-
30
- <div class="cs-slides-list">
31
- <?php
32
- if($edit) {
33
- foreach($slides as $slide) {
34
- echo '<div class="cs-slide">';
35
- crellyslider_printSlide($slider, $slide, $edit);
36
- echo '</div>';
37
- }
38
- }
39
- ?>
40
- </div>
41
- <div class="cs-void-slide"><?php crellyslider_printSlide($slider, false, $edit); ?></div>
42
-
43
- <div style="clear: both"></div>
44
- </div>
45
- </div>
46
-
47
- <?php
48
- // Prints a slide. If the ID is not false, prints the values from MYSQL database, else prints a slide with default values. It has to receive the $edit variable because the elements.php file has to see it
49
- function crellyslider_printSlide($slider, $slide, $edit) {
50
- $void = !$slide ? true : false;
51
-
52
- $animations = array(
53
- 'none' => array(__('None', 'crelly-slider'), false),
54
- 'fade' => array(__('Fade', 'crelly-slider'), true),
55
- 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
56
- 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
57
- 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
58
- 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
59
- 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
60
- 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
61
- );
62
- ?>
63
-
64
- <table class="cs-slide-settings-list cs-table">
65
- <thead>
66
- <tr class="odd-row">
67
- <th colspan="3"><?php _e('Slide Options', 'crelly-slider'); ?></th>
68
- </tr>
69
- </thead>
70
-
71
- <tbody>
72
- <tr class="cs-table-header">
73
- <td><?php _e('Option', 'crelly-slider'); ?></td>
74
- <td><?php _e('Parameter', 'crelly-slider'); ?></td>
75
- <td><?php _e('Description', 'crelly-slider'); ?></td>
76
- </tr>
77
- <tr>
78
- <td class="cs-name"><?php _e('Background', 'crelly-slider'); ?></td>
79
- <td class="cs-content">
80
- <?php
81
- if($void): ?>
82
- <?php _e('Background image:', 'crelly-slider'); ?> &nbsp;
83
- <form>
84
- <input type="radio" value="0" name="cs-slide-background_type_image" checked /> <?php _e('None', 'crelly-slider'); ?> &nbsp;
85
- <input type="radio" value="1" name="cs-slide-background_type_image" /> <input class="cs-slide-background_type_image-upload-button cs-button cs-is-default" type="button" value="<?php _e('Select image', 'crelly-slider'); ?>" />
86
- </form>
87
-
88
- <br />
89
- <br />
90
-
91
- <?php _e('Background color:', 'crelly-slider'); ?> &nbsp;
92
- <form>
93
- <br />
94
- <br />
95
- <input type="radio" value="0" name="cs-slide-background_type_color" checked /> <?php _e('Transparent', 'crelly-slider'); ?> &nbsp;
96
- <br />
97
- <input type="radio" value="1" name="cs-slide-background_type_color" /> <input class="cs-slide-background_type_color-picker-input cs-button cs-is-default" type="text" value="rgb(255, 255, 255)" />
98
- <br />
99
- <input type="radio" value="2" name="cs-slide-background_type_color" placeholder="<?php _e('Enter value', 'crelly-slider'); ?>" /> <input class="cs-slide-background_type_color-manual" type="text" />
100
- </form>
101
-
102
- <br />
103
- <br />
104
-
105
- <?php _e('Background position-x:', 'crelly-slider'); ?> &nbsp;
106
- <input type="text" value="center" class="cs-slide-background_propriety_position_x" />
107
- <br />
108
- <?php _e('Background position-y:', 'crelly-slider'); ?> &nbsp;
109
- <input type="text" value="center" class="cs-slide-background_propriety_position_y" />
110
-
111
- <br />
112
- <br />
113
-
114
- <?php _e('Background repeat:', 'crelly-slider'); ?> &nbsp;
115
- <form>
116
- <input type="radio" value="1" name="cs-slide-background_repeat" /> <?php _e('Repeat', 'crelly-slider'); ?> &nbsp;
117
- <input type="radio" value="0" name="cs-slide-background_repeat" checked /> <?php _e('No repeat', 'crelly-slider'); ?>
118
- </form>
119
-
120
- <br />
121
- <br />
122
-
123
- <?php _e('Background size:', 'crelly-slider'); ?> &nbsp;
124
- <input type="text" value="cover" class="cs-slide-background_propriety_size" />
125
- <?php else: ?>
126
- <?php _e('Background image:', 'crelly-slider'); ?> &nbsp;
127
- <form>
128
- <?php if($slide->background_type_image == 'none' || $slide->background_type_image == 'undefined'): ?>
129
- <input type="radio" value="0" name="cs-slide-background_type_image" checked /> <?php _e('None', 'crelly-slider'); ?> &nbsp;
130
- <input type="radio" value="1" name="cs-slide-background_type_image" /> <input class="cs-slide-background_type_image-upload-button cs-button cs-is-default" type="button" value="<?php _e('Select image', 'crelly-slider'); ?>" />
131
- <?php else: ?>
132
- <input type="radio" value="0" name="cs-slide-background_type_image" /> <?php _e('None', 'crelly-slider'); ?> &nbsp;
133
- <input type="radio" value="1" name="cs-slide-background_type_image" checked /> <input class="cs-slide-background_type_image-upload-button cs-button cs-is-default" type="button" value="<?php _e('Select image', 'crelly-slider'); ?>" />
134
- <?php endif; ?>
135
- </form>
136
-
137
- <br />
138
- <br />
139
-
140
- <?php _e('Background color:', 'crelly-slider'); ?> &nbsp;
141
- <form>
142
- <br />
143
- <br />
144
- <?php if($slide->background_type_color == 'transparent'): ?>
145
- <input type="radio" value="0" name="cs-slide-background_type_color" checked /> <?php _e('Transparent', 'crelly-slider'); ?> &nbsp;
146
- <?php else: ?>
147
- <input type="radio" value="0" name="cs-slide-background_type_color" /> <?php _e('Transparent', 'crelly-slider'); ?> &nbsp;
148
- <?php endif; ?>
149
-
150
- <br />
151
- <?php if($slide->background_type_color_input == '1' || ($slide->background_type_color_input == '-1' && $slide->background_type_color != 'transparent')): ?>
152
- <input type="radio" value="1" name="cs-slide-background_type_color" checked /> <input class="cs-slide-background_type_color-picker-input cs-button cs-is-default" type="text" value="<?php echo sanitize_text_field($slide->background_type_color); ?>" />
153
- <?php else: ?>
154
- <input type="radio" value="1" name="cs-slide-background_type_color" /> <input class="cs-slide-background_type_color-picker-input cs-button cs-is-default" type="text" value="rgb(255, 255, 255)" />
155
- <?php endif; ?>
156
-
157
- <br />
158
- <?php if($slide->background_type_color_input == '2'): ?>
159
- <input type="radio" value="2" name="cs-slide-background_type_color" checked /> <input class="cs-slide-background_type_color-manual" type="text" value="<?php echo sanitize_text_field($slide->background_type_color); ?>" />
160
- <?php else: ?>
161
- <input type="radio" value="2" name="cs-slide-background_type_color" /> <input class="cs-slide-background_type_color-manual" type="text" placeholder="<?php _e('Enter value', 'crelly-slider'); ?>" />
162
- <?php endif; ?>
163
- </form>
164
-
165
- <br />
166
- <br />
167
-
168
- <?php _e('Background position-x:', 'crelly-slider'); ?> &nbsp;
169
- <input type="text" value="<?php echo sanitize_text_field($slide->background_propriety_position_x); ?>" class="cs-slide-background_propriety_position_x" />
170
- <br />
171
- <?php _e('Background position-y:', 'crelly-slider'); ?> &nbsp;
172
- <input type="text" value="<?php echo sanitize_text_field($slide->background_propriety_position_y); ?>" class="cs-slide-background_propriety_position_y" />
173
-
174
- <br />
175
- <br />
176
-
177
- <?php _e('Background repeat:', 'crelly-slider'); ?> &nbsp;
178
- <form>
179
- <?php if($slide->background_repeat == 'repeat'): ?>
180
- <input type="radio" value="1" name="cs-slide-background_repeat" checked /> <?php _e('Repeat', 'crelly-slider'); ?> &nbsp;
181
- <input type="radio" value="0" name="cs-slide-background_repeat" /> <?php _e('No repeat', 'crelly-slider'); ?>
182
- <?php else: ?>
183
- <input type="radio" value="1" name="cs-slide-background_repeat" /> <?php _e('Repeat', 'crelly-slider'); ?> &nbsp;
184
- <input type="radio" value="0" name="cs-slide-background_repeat" checked /> <?php _e('No repeat', 'crelly-slider'); ?>
185
- <?php endif; ?>
186
- </form>
187
-
188
- <br />
189
- <br />
190
-
191
- <?php _e('Background size:', 'crelly-slider'); ?> &nbsp;
192
- <input type="text" value="<?php echo sanitize_text_field($slide->background_propriety_size); ?>" class="cs-slide-background_propriety_size" />
193
- <?php endif; ?>
194
- </td>
195
- <td class="cs-description">
196
- <?php _e('The background of the slide and its proprieties.', 'crelly-slider'); ?>
197
- <br />
198
- <br />
199
- <strong><?php _e('Presets:', 'crelly-slider'); ?></strong>
200
- <br />
201
- <ul class="cs-style-list">
202
- <li><a class="cs-slide-background-image-fullwidth-preset" href="javascript: void(0);"><?php _e('Full width responsive background image', 'crelly-slider'); ?></a></li>
203
- <li><a class="cs-slide-background-image-pattern-preset" href="javascript: void(0);"><?php _e('Pattern background image', 'crelly-slider'); ?></a></li>
204
- </ul>
205
- </td>
206
- </tr>
207
- <tr>
208
- <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
209
- <td class="cs-content">
210
- <select class="cs-slide-data_in">
211
- <?php
212
- foreach($animations as $key => $value) {
213
- echo '<option value="' . $key . '"';
214
- if(($void && $value[1]) || (!$void && $slide->data_in == $key)) {
215
- echo ' selected';
216
- }
217
- echo '>' . $value[0] . '</option>';
218
- }
219
- ?>
220
- </select>
221
- </td>
222
- <td class="cs-description">
223
- <?php _e('The in animation of the slide.', 'crelly-slider'); ?>
224
- </td>
225
- </tr>
226
- <tr>
227
- <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
228
- <td class="cs-content">
229
- <select class="cs-slide-data_out">
230
- <?php
231
- foreach($animations as $key => $value) {
232
- echo '<option value="' . $key . '"';
233
- if(($void && $value[1]) || (!$void && $slide->data_out == $key)) {
234
- echo ' selected';
235
- }
236
- echo '>' . $value[0] . '</option>';
237
- }
238
- ?>
239
- </select>
240
- </td>
241
- <td class="cs-description">
242
- <?php _e('The out animation of the slide.', 'crelly-slider'); ?>
243
- </td>
244
- </tr>
245
- <tr>
246
- <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
247
- <td class="cs-content">
248
- <?php
249
- if($void) echo '<input class="cs-slide-data_time" type="text" value="3000" />';
250
- else echo '<input class="cs-slide-data_time" type="text" value="' . sanitize_text_field($slide->data_time) .'" />';
251
- ?>
252
- ms
253
- </td>
254
- <td class="cs-description">
255
- <?php _e('The time that the slide will remain on the screen.', 'crelly-slider'); ?>
256
- </td>
257
- </tr>
258
- <tr>
259
- <td class="cs-name"><?php _e('Ease In', 'crelly-slider'); ?></td>
260
- <td class="cs-content">
261
- <?php
262
- if($void) echo '<input class="cs-slide-data_easeIn" type="text" value="300" />';
263
- else echo '<input class="cs-slide-data_easeIn" type="text" value="' . sanitize_text_field($slide->data_easeIn) .'" />';
264
- ?>
265
- ms
266
- </td>
267
- <td class="cs-description">
268
- <?php _e('The time that the slide will take to get in.', 'crelly-slider'); ?>
269
- </td>
270
- </tr>
271
- <tr>
272
- <td class="cs-name"><?php _e('Ease Out', 'crelly-slider'); ?></td>
273
- <td class="cs-content">
274
- <?php
275
- if($void) echo '<input class="cs-slide-data_easeOut" type="text" value="300" />';
276
- else echo '<input class="cs-slide-data_easeOut" type="text" value="' . sanitize_text_field($slide->data_easeOut) .'" />';
277
- ?>
278
- ms
279
- </td>
280
- <td class="cs-description">
281
- <?php _e('The time that the slide will take to get out.', 'crelly-slider'); ?>
282
- </td>
283
- </tr>
284
- <tr>
285
- <td class="cs-name"><?php _e('Link', 'crelly-slider'); ?></td>
286
- <td class="cs-content">
287
- <?php
288
- if($void) echo '<input class="cs-background-link" type="text" value="" />';
289
- else echo '<input class="cs-background-link" type="text" value="' . stripslashes($slide->link) .'" />';
290
- ?>
291
- <br />
292
- <?php
293
- if($void) echo '<input class="cs-background-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
294
- else {
295
- if($slide->link_new_tab) {
296
- echo '<input class="cs-background-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crelly-slider');
297
- }
298
- else {
299
- echo '<input class="cs-background-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
300
- }
301
- }
302
- ?>
303
- </td>
304
- <td class="cs-description">
305
- <?php _e('Open the link (e.g.: http://www.google.it) when the user clicks on the background. Leave it empty if you don\'t want it.', 'crelly-slider'); ?>
306
- </td>
307
- </tr>
308
- <tr>
309
- <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
310
- <td class="cs-content">
311
- <?php
312
- if($void) echo '<textarea class="cs-slide-custom_css"></textarea>';
313
- else echo '<textarea class="cs-slide-custom_css">' . stripslashes($slide->custom_css) . '</textarea>';
314
- ?>
315
- </td>
316
- <td class="cs-description">
317
- <?php _e('Apply CSS to the slide.', 'crelly-slider'); ?>
318
- </td>
319
- </tr>
320
- <tr>
321
- <td class="cs-name"><?php _e('Draft', 'crelly-slider'); ?></td>
322
- <td class="cs-content">
323
- <select class="cs-slide-draft">
324
- <?php
325
- if(!$void && $slide->draft) {
326
- echo '<option selected value="1">' . __('Yes', 'crelly-slider') . '</option>';
327
- echo '<option value="0">' . __('No', 'crelly-slider') . '</option>';
328
- }
329
- else {
330
- echo '<option value="1">' . __('Yes', 'crelly-slider') . '</option>';
331
- echo '<option selected value="0">' . __('No', 'crelly-slider') . '</option>';
332
- }
333
- ?>
334
- </select>
335
- </td>
336
- <td class="cs-description">
337
- <?php _e('If it is set to "Yes", the slide will not be displayed to the users.', 'crelly-slider'); ?>
338
- </td>
339
- </tr>
340
- </tbody>
341
- </table>
342
-
343
- <br />
344
- <br />
345
-
346
- <?php
347
- // If the slide is not void, select its elements
348
- if(!$void) {
349
- global $wpdb;
350
-
351
- $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
352
- if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
353
- die();
354
- }
355
-
356
- $slide_parent = esc_sql($slide->position);
357
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND slide_parent = %d', $id, $slide_parent));
358
- }
359
- else {
360
- $slide_id = NULL;
361
- $elements = NULL;
362
- }
363
-
364
- crellyslider_printElements($edit, $slider, $slide, $elements);
365
- }
366
- ?>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
+
3
+ <div id="cs-slides">
4
+ <div class="cs-slide-tabs cs-tabs cs-tabs-border">
5
+ <ul class="cs-sortable">
6
+ <?php
7
+ if($edit) {
8
+ $j = 0;
9
+ $slides_num = count($slides);
10
+ foreach($slides as $slide) {
11
+ if($j == $slides_num - 1) {
12
+ echo '<li class="ui-state-default active">';
13
+ }
14
+ else {
15
+ echo '<li class="ui-state-default">';
16
+ }
17
+ echo '<a><span class="cs-slide-name-text">' . __('Slide', 'crelly-slider') . ' <span class="cs-slide-index">' . esc_html(($slide->position) + 1) . '</span></span></a>';
18
+ echo '<span title="' . __('Duplicate slide', 'crelly-slider') . '" class="cs-duplicate"></span>';
19
+ echo '<span title="' . __('Delete slide', 'crelly-slider') . '" class="cs-close"></span>';
20
+ echo '</li>';
21
+
22
+ $j++;
23
+ }
24
+ }
25
+ ?>
26
+ <li class="ui-state-default ui-state-disabled"><a class="cs-add-new"><?php _e('Add Slide', 'crelly-slider'); ?></a></li>
27
+ <div style="clear: both;"></div>
28
+ </ul>
29
+
30
+ <div class="cs-slides-list">
31
+ <?php
32
+ if($edit) {
33
+ foreach($slides as $slide) {
34
+ echo '<div class="cs-slide">';
35
+ crellyslider_printSlide($slider, $slide, $edit);
36
+ echo '</div>';
37
+ }
38
+ }
39
+ ?>
40
+ </div>
41
+ <div class="cs-void-slide"><?php crellyslider_printSlide($slider, false, $edit); ?></div>
42
+
43
+ <div style="clear: both"></div>
44
+ </div>
45
+ </div>
46
+
47
+ <?php
48
+ // Prints a slide. If the ID is not false, prints the values from MYSQL database, else prints a slide with default values. It has to receive the $edit variable because the elements.php file has to see it
49
+ function crellyslider_printSlide($slider, $slide, $edit) {
50
+ $void = !$slide ? true : false;
51
+
52
+ $animations = array(
53
+ 'none' => array(__('None', 'crelly-slider'), false),
54
+ 'fade' => array(__('Fade', 'crelly-slider'), true),
55
+ 'fadeLeft' => array(__('Fade left', 'crelly-slider'), false),
56
+ 'fadeRight' => array(__('Fade right', 'crelly-slider'), false),
57
+ 'slideLeft' => array(__('Slide left', 'crelly-slider'), false),
58
+ 'slideRight' => array(__('Slide right', 'crelly-slider'), false),
59
+ 'slideUp' => array(__('Slide up', 'crelly-slider'), false),
60
+ 'slideDown' => array(__('Slide down', 'crelly-slider'), false),
61
+ );
62
+ ?>
63
+
64
+ <table class="cs-slide-settings-list cs-table">
65
+ <thead>
66
+ <tr class="odd-row">
67
+ <th colspan="3"><?php _e('Slide Options', 'crelly-slider'); ?></th>
68
+ </tr>
69
+ </thead>
70
+
71
+ <tbody>
72
+ <tr class="cs-table-header">
73
+ <td><?php _e('Option', 'crelly-slider'); ?></td>
74
+ <td><?php _e('Parameter', 'crelly-slider'); ?></td>
75
+ <td><?php _e('Description', 'crelly-slider'); ?></td>
76
+ </tr>
77
+ <tr>
78
+ <td class="cs-name"><?php _e('Background', 'crelly-slider'); ?></td>
79
+ <td class="cs-content">
80
+ <?php
81
+ if($void): ?>
82
+ <?php _e('Background image:', 'crelly-slider'); ?> &nbsp;
83
+ <form>
84
+ <input type="radio" value="0" name="cs-slide-background_type_image" checked /> <?php _e('None', 'crelly-slider'); ?> &nbsp;
85
+ <input type="radio" value="1" name="cs-slide-background_type_image" /> <input class="cs-slide-background_type_image-upload-button cs-button cs-is-default" type="button" value="<?php _e('Select image', 'crelly-slider'); ?>" />
86
+ </form>
87
+
88
+ <br />
89
+ <br />
90
+
91
+ <?php _e('Background color:', 'crelly-slider'); ?> &nbsp;
92
+ <form>
93
+ <br />
94
+ <br />
95
+ <input type="radio" value="0" name="cs-slide-background_type_color" checked /> <?php _e('Transparent', 'crelly-slider'); ?> &nbsp;
96
+ <br />
97
+ <input type="radio" value="1" name="cs-slide-background_type_color" /> <input class="cs-slide-background_type_color-picker-input cs-button cs-is-default" type="text" value="rgb(255, 255, 255)" />
98
+ <br />
99
+ <input type="radio" value="2" name="cs-slide-background_type_color" placeholder="<?php _e('Enter value', 'crelly-slider'); ?>" /> <input class="cs-slide-background_type_color-manual" type="text" />
100
+ </form>
101
+
102
+ <br />
103
+ <br />
104
+
105
+ <?php _e('Background position-x:', 'crelly-slider'); ?> &nbsp;
106
+ <input type="text" value="center" class="cs-slide-background_propriety_position_x" />
107
+ <br />
108
+ <?php _e('Background position-y:', 'crelly-slider'); ?> &nbsp;
109
+ <input type="text" value="center" class="cs-slide-background_propriety_position_y" />
110
+
111
+ <br />
112
+ <br />
113
+
114
+ <?php _e('Background repeat:', 'crelly-slider'); ?> &nbsp;
115
+ <form>
116
+ <input type="radio" value="1" name="cs-slide-background_repeat" /> <?php _e('Repeat', 'crelly-slider'); ?> &nbsp;
117
+ <input type="radio" value="0" name="cs-slide-background_repeat" checked /> <?php _e('No repeat', 'crelly-slider'); ?>
118
+ </form>
119
+
120
+ <br />
121
+ <br />
122
+
123
+ <?php _e('Background size:', 'crelly-slider'); ?> &nbsp;
124
+ <input type="text" value="cover" class="cs-slide-background_propriety_size" />
125
+ <?php else: ?>
126
+ <?php _e('Background image:', 'crelly-slider'); ?> &nbsp;
127
+ <form>
128
+ <?php if($slide->background_type_image == 'none' || $slide->background_type_image == 'undefined'): ?>
129
+ <input type="radio" value="0" name="cs-slide-background_type_image" checked /> <?php _e('None', 'crelly-slider'); ?> &nbsp;
130
+ <input type="radio" value="1" name="cs-slide-background_type_image" /> <input class="cs-slide-background_type_image-upload-button cs-button cs-is-default" type="button" value="<?php _e('Select image', 'crelly-slider'); ?>" />
131
+ <?php else: ?>
132
+ <input type="radio" value="0" name="cs-slide-background_type_image" /> <?php _e('None', 'crelly-slider'); ?> &nbsp;
133
+ <input type="radio" value="1" name="cs-slide-background_type_image" checked /> <input class="cs-slide-background_type_image-upload-button cs-button cs-is-default" type="button" value="<?php _e('Select image', 'crelly-slider'); ?>" />
134
+ <?php endif; ?>
135
+ </form>
136
+
137
+ <br />
138
+ <br />
139
+
140
+ <?php _e('Background color:', 'crelly-slider'); ?> &nbsp;
141
+ <form>
142
+ <br />
143
+ <br />
144
+ <?php if($slide->background_type_color == 'transparent'): ?>
145
+ <input type="radio" value="0" name="cs-slide-background_type_color" checked /> <?php _e('Transparent', 'crelly-slider'); ?> &nbsp;
146
+ <?php else: ?>
147
+ <input type="radio" value="0" name="cs-slide-background_type_color" /> <?php _e('Transparent', 'crelly-slider'); ?> &nbsp;
148
+ <?php endif; ?>
149
+
150
+ <br />
151
+ <?php if($slide->background_type_color_input == '1' || ($slide->background_type_color_input == '-1' && $slide->background_type_color != 'transparent')): ?>
152
+ <input type="radio" value="1" name="cs-slide-background_type_color" checked /> <input class="cs-slide-background_type_color-picker-input cs-button cs-is-default" type="text" value="<?php echo sanitize_text_field($slide->background_type_color); ?>" />
153
+ <?php else: ?>
154
+ <input type="radio" value="1" name="cs-slide-background_type_color" /> <input class="cs-slide-background_type_color-picker-input cs-button cs-is-default" type="text" value="rgb(255, 255, 255)" />
155
+ <?php endif; ?>
156
+
157
+ <br />
158
+ <?php if($slide->background_type_color_input == '2'): ?>
159
+ <input type="radio" value="2" name="cs-slide-background_type_color" checked /> <input class="cs-slide-background_type_color-manual" type="text" value="<?php echo sanitize_text_field($slide->background_type_color); ?>" />
160
+ <?php else: ?>
161
+ <input type="radio" value="2" name="cs-slide-background_type_color" /> <input class="cs-slide-background_type_color-manual" type="text" placeholder="<?php _e('Enter value', 'crelly-slider'); ?>" />
162
+ <?php endif; ?>
163
+ </form>
164
+
165
+ <br />
166
+ <br />
167
+
168
+ <?php _e('Background position-x:', 'crelly-slider'); ?> &nbsp;
169
+ <input type="text" value="<?php echo sanitize_text_field($slide->background_propriety_position_x); ?>" class="cs-slide-background_propriety_position_x" />
170
+ <br />
171
+ <?php _e('Background position-y:', 'crelly-slider'); ?> &nbsp;
172
+ <input type="text" value="<?php echo sanitize_text_field($slide->background_propriety_position_y); ?>" class="cs-slide-background_propriety_position_y" />
173
+
174
+ <br />
175
+ <br />
176
+
177
+ <?php _e('Background repeat:', 'crelly-slider'); ?> &nbsp;
178
+ <form>
179
+ <?php if($slide->background_repeat == 'repeat'): ?>
180
+ <input type="radio" value="1" name="cs-slide-background_repeat" checked /> <?php _e('Repeat', 'crelly-slider'); ?> &nbsp;
181
+ <input type="radio" value="0" name="cs-slide-background_repeat" /> <?php _e('No repeat', 'crelly-slider'); ?>
182
+ <?php else: ?>
183
+ <input type="radio" value="1" name="cs-slide-background_repeat" /> <?php _e('Repeat', 'crelly-slider'); ?> &nbsp;
184
+ <input type="radio" value="0" name="cs-slide-background_repeat" checked /> <?php _e('No repeat', 'crelly-slider'); ?>
185
+ <?php endif; ?>
186
+ </form>
187
+
188
+ <br />
189
+ <br />
190
+
191
+ <?php _e('Background size:', 'crelly-slider'); ?> &nbsp;
192
+ <input type="text" value="<?php echo sanitize_text_field($slide->background_propriety_size); ?>" class="cs-slide-background_propriety_size" />
193
+ <?php endif; ?>
194
+ </td>
195
+ <td class="cs-description">
196
+ <?php _e('The background of the slide and its proprieties.', 'crelly-slider'); ?>
197
+ <br />
198
+ <br />
199
+ <strong><?php _e('Presets:', 'crelly-slider'); ?></strong>
200
+ <br />
201
+ <ul class="cs-style-list">
202
+ <li><a class="cs-slide-background-image-fullwidth-preset" href="javascript: void(0);"><?php _e('Full width responsive background image', 'crelly-slider'); ?></a></li>
203
+ <li><a class="cs-slide-background-image-pattern-preset" href="javascript: void(0);"><?php _e('Pattern background image', 'crelly-slider'); ?></a></li>
204
+ </ul>
205
+ </td>
206
+ </tr>
207
+ <tr>
208
+ <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
209
+ <td class="cs-content">
210
+ <select class="cs-slide-data_in">
211
+ <?php
212
+ foreach($animations as $key => $value) {
213
+ echo '<option value="' . $key . '"';
214
+ if(($void && $value[1]) || (!$void && $slide->data_in == $key)) {
215
+ echo ' selected';
216
+ }
217
+ echo '>' . $value[0] . '</option>';
218
+ }
219
+ ?>
220
+ </select>
221
+ </td>
222
+ <td class="cs-description">
223
+ <?php _e('The in animation of the slide.', 'crelly-slider'); ?>
224
+ </td>
225
+ </tr>
226
+ <tr>
227
+ <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
228
+ <td class="cs-content">
229
+ <select class="cs-slide-data_out">
230
+ <?php
231
+ foreach($animations as $key => $value) {
232
+ echo '<option value="' . $key . '"';
233
+ if(($void && $value[1]) || (!$void && $slide->data_out == $key)) {
234
+ echo ' selected';
235
+ }
236
+ echo '>' . $value[0] . '</option>';
237
+ }
238
+ ?>
239
+ </select>
240
+ </td>
241
+ <td class="cs-description">
242
+ <?php _e('The out animation of the slide.', 'crelly-slider'); ?>
243
+ </td>
244
+ </tr>
245
+ <tr>
246
+ <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
247
+ <td class="cs-content">
248
+ <?php
249
+ if($void) echo '<input class="cs-slide-data_time" type="text" value="3000" />';
250
+ else echo '<input class="cs-slide-data_time" type="text" value="' . sanitize_text_field($slide->data_time) .'" />';
251
+ ?>
252
+ ms
253
+ </td>
254
+ <td class="cs-description">
255
+ <?php _e('The time that the slide will remain on the screen.', 'crelly-slider'); ?>
256
+ </td>
257
+ </tr>
258
+ <tr>
259
+ <td class="cs-name"><?php _e('Ease In', 'crelly-slider'); ?></td>
260
+ <td class="cs-content">
261
+ <?php
262
+ if($void) echo '<input class="cs-slide-data_easeIn" type="text" value="300" />';
263
+ else echo '<input class="cs-slide-data_easeIn" type="text" value="' . sanitize_text_field($slide->data_easeIn) .'" />';
264
+ ?>
265
+ ms
266
+ </td>
267
+ <td class="cs-description">
268
+ <?php _e('The time that the slide will take to get in.', 'crelly-slider'); ?>
269
+ </td>
270
+ </tr>
271
+ <tr>
272
+ <td class="cs-name"><?php _e('Ease Out', 'crelly-slider'); ?></td>
273
+ <td class="cs-content">
274
+ <?php
275
+ if($void) echo '<input class="cs-slide-data_easeOut" type="text" value="300" />';
276
+ else echo '<input class="cs-slide-data_easeOut" type="text" value="' . sanitize_text_field($slide->data_easeOut) .'" />';
277
+ ?>
278
+ ms
279
+ </td>
280
+ <td class="cs-description">
281
+ <?php _e('The time that the slide will take to get out.', 'crelly-slider'); ?>
282
+ </td>
283
+ </tr>
284
+ <tr>
285
+ <td class="cs-name"><?php _e('Link', 'crelly-slider'); ?></td>
286
+ <td class="cs-content">
287
+ <?php
288
+ if($void) echo '<input class="cs-background-link" type="text" value="" />';
289
+ else echo '<input class="cs-background-link" type="text" value="' . stripslashes($slide->link) .'" />';
290
+ ?>
291
+ <br />
292
+ <?php
293
+ if($void) echo '<input class="cs-background-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
294
+ else {
295
+ if($slide->link_new_tab) {
296
+ echo '<input class="cs-background-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crelly-slider');
297
+ }
298
+ else {
299
+ echo '<input class="cs-background-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crelly-slider');
300
+ }
301
+ }
302
+ ?>
303
+ </td>
304
+ <td class="cs-description">
305
+ <?php _e('Open the link (e.g.: http://www.google.it) when the user clicks on the background. Leave it empty if you don\'t want it.', 'crelly-slider'); ?>
306
+ </td>
307
+ </tr>
308
+ <tr>
309
+ <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
310
+ <td class="cs-content">
311
+ <?php
312
+ if($void) echo '<textarea class="cs-slide-custom_css"></textarea>';
313
+ else echo '<textarea class="cs-slide-custom_css">' . stripslashes($slide->custom_css) . '</textarea>';
314
+ ?>
315
+ </td>
316
+ <td class="cs-description">
317
+ <?php _e('Apply CSS to the slide.', 'crelly-slider'); ?>
318
+ </td>
319
+ </tr>
320
+ <tr>
321
+ <td class="cs-name"><?php _e('Draft', 'crelly-slider'); ?></td>
322
+ <td class="cs-content">
323
+ <select class="cs-slide-draft">
324
+ <?php
325
+ if(!$void && $slide->draft) {
326
+ echo '<option selected value="1">' . __('Yes', 'crelly-slider') . '</option>';
327
+ echo '<option value="0">' . __('No', 'crelly-slider') . '</option>';
328
+ }
329
+ else {
330
+ echo '<option value="1">' . __('Yes', 'crelly-slider') . '</option>';
331
+ echo '<option selected value="0">' . __('No', 'crelly-slider') . '</option>';
332
+ }
333
+ ?>
334
+ </select>
335
+ </td>
336
+ <td class="cs-description">
337
+ <?php _e('If it is set to "Yes", the slide will not be displayed to the users.', 'crelly-slider'); ?>
338
+ </td>
339
+ </tr>
340
+ </tbody>
341
+ </table>
342
+
343
+ <br />
344
+ <br />
345
+
346
+ <?php
347
+ // If the slide is not void, select its elements
348
+ if(!$void) {
349
+ global $wpdb;
350
+
351
+ $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
352
+ if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
353
+ die();
354
+ }
355
+
356
+ $slide_parent = esc_sql($slide->position);
357
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND slide_parent = %d', $id, $slide_parent));
358
+ }
359
+ else {
360
+ $slide_id = NULL;
361
+ $elements = NULL;
362
+ }
363
+
364
+ crellyslider_printElements($edit, $slider, $slide, $elements);
365
+ }
366
+ ?>
wordpress/tables.php CHANGED
@@ -1,162 +1,162 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- class CrellySliderTables {
5
-
6
- // Update the current Crelly Slider version in the database
7
- public static function setVersion() {
8
- update_option('cs_version', CS_VERSION);
9
- }
10
-
11
- public static function removeVersion() {
12
- delete_option('cs_version');
13
- }
14
-
15
- // Creates or updates all the tables
16
- public static function setTables() {
17
- self::setSlidersTable();
18
- self::setSlidesTable();
19
- self::setElementsTable();
20
- self::setNoncesTable();
21
- }
22
-
23
- public static function setNoncesTable() {
24
- global $wpdb;
25
- $table_name = $wpdb->prefix . 'crellyslider_nonces';
26
-
27
- $sql = "CREATE TABLE $table_name (
28
- slider_id mediumint(9) NOT NULL,
29
- nonce varchar(100) DEFAULT '' NOT NULL,
30
- UNIQUE KEY slider_id (slider_id)
31
- );";
32
-
33
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
34
- dbDelta($sql);
35
- }
36
-
37
- public static function setSlidersTable() {
38
- global $wpdb;
39
- $table_name = $wpdb->prefix . 'crellyslider_sliders';
40
-
41
- $sql = "CREATE TABLE $table_name (
42
- id mediumint(9) NOT NULL AUTO_INCREMENT,
43
- name TEXT CHARACTER SET utf8,
44
- alias TEXT CHARACTER SET utf8,
45
- layout TEXT CHARACTER SET utf8,
46
- responsive INT,
47
- startWidth INT,
48
- startHeight INT,
49
- automaticSlide INT,
50
- showControls INT,
51
- showNavigation INT,
52
- enableSwipe INT DEFAULT 1,
53
- showProgressBar INT,
54
- pauseOnHover INT,
55
- randomOrder INT DEFAULT 0,
56
- startFromSlide INT DEFAULT 0,
57
- callbacks TEXT CHARACTER SET utf8,
58
- fromDate DATETIME DEFAULT '1000-01-01 00:00:00',
59
- toDate DATETIME DEFAULT '9999-12-31 23:59:59',
60
- UNIQUE KEY id (id)
61
- );";
62
-
63
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
64
- dbDelta($sql);
65
- }
66
-
67
- // Warning: the time variable is a string because it could contain the 'all' word
68
- public static function setSlidesTable() {
69
- global $wpdb;
70
- $table_name = $wpdb->prefix . 'crellyslider_slides';
71
-
72
- $sql = "CREATE TABLE $table_name (
73
- id mediumint(9) NOT NULL AUTO_INCREMENT,
74
- slider_parent mediumint(9),
75
- position INT,
76
- draft INT DEFAULT 0,
77
- background_type_image TEXT CHARACTER SET utf8,
78
- background_type_color TEXT CHARACTER SET utf8,
79
- background_type_color_input INT DEFAULT -1,
80
- background_propriety_position_x TEXT CHARACTER SET utf8,
81
- background_propriety_position_y TEXT CHARACTER SET utf8,
82
- background_repeat TEXT CHARACTER SET utf8,
83
- background_propriety_size TEXT CHARACTER SET utf8,
84
- data_in TEXT CHARACTER SET utf8,
85
- data_out TEXT CHARACTER SET utf8,
86
- data_time INT,
87
- data_easeIn INT,
88
- data_easeOut INT,
89
- link TEXT CHARACTER SET utf8,
90
- link_new_tab INT DEFAULT 0,
91
- custom_css TEXT CHARACTER SET utf8,
92
- UNIQUE KEY id (id)
93
- );";
94
-
95
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
96
- dbDelta($sql);
97
- }
98
-
99
- public static function setElementsTable() {
100
- global $wpdb;
101
- $table_name = $wpdb->prefix . 'crellyslider_elements';
102
-
103
- $sql = "CREATE TABLE $table_name (
104
- id mediumint(9) NOT NULL AUTO_INCREMENT,
105
- slider_parent mediumint(9),
106
- slide_parent mediumint(9),
107
- position INT,
108
- type TEXT CHARACTER SET utf8,
109
- data_easeIn INT,
110
- data_easeOut INT,
111
- data_ignoreEaseOut INT DEFAULT 0,
112
- data_delay INT,
113
- data_time TEXT CHARACTER SET utf8,
114
- data_top FLOAT,
115
- data_left FLOAT,
116
- z_index INT,
117
- data_in TEXT CHARACTER SET utf8,
118
- data_out TEXT CHARACTER SET utf8,
119
- custom_css TEXT CHARACTER SET utf8,
120
- custom_css_classes TEXT CHARACTER SET utf8,
121
- inner_html TEXT CHARACTER SET utf8,
122
- image_src TEXT CHARACTER SET utf8,
123
- image_alt TEXT CHARACTER SET utf8,
124
- link TEXT CHARACTER SET utf8,
125
- link_new_tab INT DEFAULT 0,
126
- video_id TEXT CHARACTER SET utf8,
127
- video_loop INT,
128
- video_autoplay INT,
129
- video_start_mute INT DEFAULT 0,
130
- video_pause_while_watching INT DEFAULT 0,
131
- UNIQUE KEY id (id)
132
- );";
133
-
134
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
135
- dbDelta($sql);
136
- }
137
-
138
- // Drops all the slider tables
139
- public static function dropTables() {
140
- global $wpdb;
141
-
142
- self::dropTable($wpdb->prefix . 'crellyslider_sliders');
143
- self::dropTable($wpdb->prefix . 'crellyslider_slides');
144
- self::dropTable($wpdb->prefix . 'crellyslider_elements');
145
- self::dropTable($wpdb->prefix . 'crellyslider_nonces');
146
- }
147
-
148
- public static function dropTable($table_name) {
149
- global $wpdb;
150
-
151
- $sql = 'DROP TABLE ' . $table_name . ';';
152
- $wpdb->query($sql);
153
- }
154
-
155
- // Removes everything related to Crelly Slider from the database
156
- public static function clearDatabase() {
157
- self::dropTables();
158
- self::removeVersion();
159
- }
160
- }
161
-
162
- ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class CrellySliderTables {
5
+
6
+ // Update the current Crelly Slider version in the database
7
+ public static function setVersion() {
8
+ update_option('cs_version', CS_VERSION);
9
+ }
10
+
11
+ public static function removeVersion() {
12
+ delete_option('cs_version');
13
+ }
14
+
15
+ // Creates or updates all the tables
16
+ public static function setTables() {
17
+ self::setSlidersTable();
18
+ self::setSlidesTable();
19
+ self::setElementsTable();
20
+ self::setNoncesTable();
21
+ }
22
+
23
+ public static function setNoncesTable() {
24
+ global $wpdb;
25
+ $table_name = $wpdb->prefix . 'crellyslider_nonces';
26
+
27
+ $sql = "CREATE TABLE $table_name (
28
+ slider_id mediumint(9) NOT NULL,
29
+ nonce varchar(100) DEFAULT '' NOT NULL,
30
+ UNIQUE KEY slider_id (slider_id)
31
+ );";
32
+
33
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
34
+ dbDelta($sql);
35
+ }
36
+
37
+ public static function setSlidersTable() {
38
+ global $wpdb;
39
+ $table_name = $wpdb->prefix . 'crellyslider_sliders';
40
+
41
+ $sql = "CREATE TABLE $table_name (
42
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
43
+ name TEXT CHARACTER SET utf8,
44
+ alias TEXT CHARACTER SET utf8,
45
+ layout TEXT CHARACTER SET utf8,
46
+ responsive INT,
47
+ startWidth INT,
48
+ startHeight INT,
49
+ automaticSlide INT,
50
+ showControls INT,
51
+ showNavigation INT,
52
+ enableSwipe INT DEFAULT 1,
53
+ showProgressBar INT,
54
+ pauseOnHover INT,
55
+ randomOrder INT DEFAULT 0,
56
+ startFromSlide INT DEFAULT 0,
57
+ callbacks TEXT CHARACTER SET utf8,
58
+ fromDate DATETIME DEFAULT '1000-01-01 00:00:00',
59
+ toDate DATETIME DEFAULT '9999-12-31 23:59:59',
60
+ UNIQUE KEY id (id)
61
+ );";
62
+
63
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
64
+ dbDelta($sql);
65
+ }
66
+
67
+ // Warning: the time variable is a string because it could contain the 'all' word
68
+ public static function setSlidesTable() {
69
+ global $wpdb;
70
+ $table_name = $wpdb->prefix . 'crellyslider_slides';
71
+
72
+ $sql = "CREATE TABLE $table_name (
73
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
74
+ slider_parent mediumint(9),
75
+ position INT,
76
+ draft INT DEFAULT 0,
77
+ background_type_image TEXT CHARACTER SET utf8,
78
+ background_type_color TEXT CHARACTER SET utf8,
79
+ background_type_color_input INT DEFAULT -1,
80
+ background_propriety_position_x TEXT CHARACTER SET utf8,
81
+ background_propriety_position_y TEXT CHARACTER SET utf8,
82
+ background_repeat TEXT CHARACTER SET utf8,
83
+ background_propriety_size TEXT CHARACTER SET utf8,
84
+ data_in TEXT CHARACTER SET utf8,
85
+ data_out TEXT CHARACTER SET utf8,
86
+ data_time INT,
87
+ data_easeIn INT,
88
+ data_easeOut INT,
89
+ link TEXT CHARACTER SET utf8,
90
+ link_new_tab INT DEFAULT 0,
91
+ custom_css TEXT CHARACTER SET utf8,
92
+ UNIQUE KEY id (id)
93
+ );";
94
+
95
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
96
+ dbDelta($sql);
97
+ }
98
+
99
+ public static function setElementsTable() {
100
+ global $wpdb;
101
+ $table_name = $wpdb->prefix . 'crellyslider_elements';
102
+
103
+ $sql = "CREATE TABLE $table_name (
104
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
105
+ slider_parent mediumint(9),
106
+ slide_parent mediumint(9),
107
+ position INT,
108
+ type TEXT CHARACTER SET utf8,
109
+ data_easeIn INT,
110
+ data_easeOut INT,
111
+ data_ignoreEaseOut INT DEFAULT 0,
112
+ data_delay INT,
113
+ data_time TEXT CHARACTER SET utf8,
114
+ data_top FLOAT,
115
+ data_left FLOAT,
116
+ z_index INT,
117
+ data_in TEXT CHARACTER SET utf8,
118
+ data_out TEXT CHARACTER SET utf8,
119
+ custom_css TEXT CHARACTER SET utf8,
120
+ custom_css_classes TEXT CHARACTER SET utf8,
121
+ inner_html TEXT CHARACTER SET utf8,
122
+ image_src TEXT CHARACTER SET utf8,
123
+ image_alt TEXT CHARACTER SET utf8,
124
+ link TEXT CHARACTER SET utf8,
125
+ link_new_tab INT DEFAULT 0,
126
+ video_id TEXT CHARACTER SET utf8,
127
+ video_loop INT,
128
+ video_autoplay INT,
129
+ video_start_mute INT DEFAULT 0,
130
+ video_pause_while_watching INT DEFAULT 0,
131
+ UNIQUE KEY id (id)
132
+ );";
133
+
134
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
135
+ dbDelta($sql);
136
+ }
137
+
138
+ // Drops all the slider tables
139
+ public static function dropTables() {
140
+ global $wpdb;
141
+
142
+ self::dropTable($wpdb->prefix . 'crellyslider_sliders');
143
+ self::dropTable($wpdb->prefix . 'crellyslider_slides');
144
+ self::dropTable($wpdb->prefix . 'crellyslider_elements');
145
+ self::dropTable($wpdb->prefix . 'crellyslider_nonces');
146
+ }
147
+
148
+ public static function dropTable($table_name) {
149
+ global $wpdb;
150
+
151
+ $sql = 'DROP TABLE ' . $table_name . ';';
152
+ $wpdb->query($sql);
153
+ }
154
+
155
+ // Removes everything related to Crelly Slider from the database
156
+ public static function clearDatabase() {
157
+ self::dropTables();
158
+ self::removeVersion();
159
+ }
160
+ }
161
+
162
+ ?>
wordpress/temp/index.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
  <?php // Leave this file here in order to block dir listing ?>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
  <?php // Leave this file here in order to block dir listing ?>