Crelly Slider - Version 1.2.3

Version Description

  • Bug fix: align left/center/right buttons not working
Download this release

Release Info

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

Code changes from version 1.2.2 to 1.2.3

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.tk
7
-
8
- Documentation: http://crellyslider.tk/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,64 +1,64 @@
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.2.2
7
- * Author: Fabio Rinaldi
8
- * Author URI: https://github.com/fabiorino
9
- * Text Domain: crelly-slider
10
- * Domain Path: /wordpress/languages
11
- * License: MIT
12
- */
13
-
14
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
-
16
- /*************/
17
- /** GLOBALS **/
18
- /*************/
19
-
20
- define('CS_DEBUG', false);
21
-
22
- define('CS_VERSION', '1.2.2');
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
- // Languages
36
- CrellySliderCommon::loadPluginTextDomain();
37
-
38
- // This is a variable that should be included first to prevent backend issues.
39
- if(is_admin()) {
40
- require_once CS_PATH . 'wordpress/admin.php';
41
- CrellySliderAdmin::setIsAdminJs();
42
- }
43
-
44
- // CSS and Javascript
45
- CrellySliderCommon::setEnqueues();
46
-
47
- CrellySliderFrontend::addShortcode();
48
-
49
- if(is_admin()) {
50
- // Tables
51
- if(CS_DEBUG || CS_VERSION != get_option('cs_version')) {
52
- CrellySliderTables::setTables();
53
- }
54
- if(CS_VERSION != get_option('cs_version')) {
55
- CrellySliderTables::setVersion();
56
- }
57
-
58
- CrellySliderAdmin::setEnqueues();
59
- CrellySliderAdmin::showSettings();
60
-
61
- // Ajax functions
62
- require_once CS_PATH . 'wordpress/ajax.php';
63
- }
64
- ?>
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.2.3
7
+ * Author: Fabio Rinaldi
8
+ * Author URI: https://github.com/fabiorino
9
+ * Text Domain: crelly-slider
10
+ * Domain Path: /wordpress/languages
11
+ * License: MIT
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
+
16
+ /*************/
17
+ /** GLOBALS **/
18
+ /*************/
19
+
20
+ define('CS_DEBUG', false);
21
+
22
+ define('CS_VERSION', '1.2.3');
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
+ // Languages
36
+ CrellySliderCommon::loadPluginTextDomain();
37
+
38
+ // This is a variable that should be included first to prevent backend issues.
39
+ if(is_admin()) {
40
+ require_once CS_PATH . 'wordpress/admin.php';
41
+ CrellySliderAdmin::setIsAdminJs();
42
+ }
43
+
44
+ // CSS and Javascript
45
+ CrellySliderCommon::setEnqueues();
46
+
47
+ CrellySliderFrontend::addShortcode();
48
+
49
+ if(is_admin()) {
50
+ // Tables
51
+ if(CS_DEBUG || CS_VERSION != get_option('cs_version')) {
52
+ CrellySliderTables::setTables();
53
+ }
54
+ if(CS_VERSION != get_option('cs_version')) {
55
+ CrellySliderTables::setVersion();
56
+ }
57
+
58
+ CrellySliderAdmin::setEnqueues();
59
+ CrellySliderAdmin::showSettings();
60
+
61
+ // Ajax functions
62
+ require_once CS_PATH . 'wordpress/ajax.php';
63
+ }
64
+ ?>
css/crellyslider.css CHANGED
@@ -1,295 +1,295 @@
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.2.2
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
- }
205
-
206
- .crellyslider > .cs-slides > .cs-slide > a {
207
- cursor: pointer;
208
- }
209
-
210
- .crellyslider > .cs-slides > .cs-slide > img,
211
- .crellyslider > .cs-slides > .cs-slide > a > img {
212
- max-width: none !important;
213
- }
214
-
215
- .crellyslider > .cs-slides > .cs-slide a,
216
- .crellyslider > .cs-slides > .cs-slide > a > img {
217
- text-decoration: none;
218
- outline: none;
219
- border: none;
220
- }
221
-
222
- .crellyslider > .cs-controls {
223
- position: absolute;
224
- width: 100%;
225
- top: 50%;
226
- margin-top: -9px;
227
- }
228
-
229
- .crellyslider > .cs-controls > .cs-previous,
230
- .crellyslider > .cs-controls > .cs-next {
231
- display: block;
232
- width: 35px;
233
- height: 35px;
234
- position: absolute;
235
- cursor: pointer;
236
- background-color:#fff;
237
- box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
238
- background-repeat: no-repeat;
239
- background-position: center center;
240
- border: 10px;
241
- border-radius: 50%;
242
- }
243
-
244
- .crellyslider > .cs-controls > .cs-previous {
245
- background-image: url('../images/arrow-left.png');
246
- left: 30px;
247
- }
248
-
249
- .crellyslider > .cs-controls > .cs-next {
250
- background-image: url('../images/arrow-right.png');
251
- right: 30px;
252
- }
253
-
254
- .crellyslider > .cs-navigation {
255
- position: absolute;
256
- width: 100%;
257
- height: 0;
258
- bottom: 40px;
259
- text-align: center;
260
- }
261
-
262
- .crellyslider > .cs-navigation > .cs-slide-link {
263
- width: 15px;
264
- height: 15px;
265
- display: inline-block;
266
- cursor: pointer;
267
- margin: 6px;
268
- background-color:#fff;
269
- box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
270
- border: 10px;
271
- border-radius: 50%;
272
- opacity: .5;
273
- filter: alpha(opacity=50);
274
- }
275
-
276
- .crellyslider > .cs-navigation > .cs-slide-link.cs-active {
277
- opacity: 1;
278
- filter: alpha(opacity=100);
279
- }
280
-
281
- .crellyslider > .cs-progress-bar {
282
- width: 0%;
283
- height: 4px;
284
- position: absolute;
285
- top: 0;
286
- background-color: #fff;
287
- opacity: .5;
288
- filter: alpha(opacity=50);
289
- z-index: 999;
290
- }
291
-
292
- .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
293
- opacity: 0;
294
- filter: alpha(opacity=0);
295
- }
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.2.3
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
+ }
205
+
206
+ .crellyslider > .cs-slides > .cs-slide > a {
207
+ cursor: pointer;
208
+ }
209
+
210
+ .crellyslider > .cs-slides > .cs-slide > img,
211
+ .crellyslider > .cs-slides > .cs-slide > a > img {
212
+ max-width: none !important;
213
+ }
214
+
215
+ .crellyslider > .cs-slides > .cs-slide a,
216
+ .crellyslider > .cs-slides > .cs-slide > a > img {
217
+ text-decoration: none;
218
+ outline: none;
219
+ border: none;
220
+ }
221
+
222
+ .crellyslider > .cs-controls {
223
+ position: absolute;
224
+ width: 100%;
225
+ top: 50%;
226
+ margin-top: -9px;
227
+ }
228
+
229
+ .crellyslider > .cs-controls > .cs-previous,
230
+ .crellyslider > .cs-controls > .cs-next {
231
+ display: block;
232
+ width: 35px;
233
+ height: 35px;
234
+ position: absolute;
235
+ cursor: pointer;
236
+ background-color:#fff;
237
+ box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
238
+ background-repeat: no-repeat;
239
+ background-position: center center;
240
+ border: 10px;
241
+ border-radius: 50%;
242
+ }
243
+
244
+ .crellyslider > .cs-controls > .cs-previous {
245
+ background-image: url('../images/arrow-left.png');
246
+ left: 30px;
247
+ }
248
+
249
+ .crellyslider > .cs-controls > .cs-next {
250
+ background-image: url('../images/arrow-right.png');
251
+ right: 30px;
252
+ }
253
+
254
+ .crellyslider > .cs-navigation {
255
+ position: absolute;
256
+ width: 100%;
257
+ height: 0;
258
+ bottom: 40px;
259
+ text-align: center;
260
+ }
261
+
262
+ .crellyslider > .cs-navigation > .cs-slide-link {
263
+ width: 15px;
264
+ height: 15px;
265
+ display: inline-block;
266
+ cursor: pointer;
267
+ margin: 6px;
268
+ background-color:#fff;
269
+ box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
270
+ border: 10px;
271
+ border-radius: 50%;
272
+ opacity: .5;
273
+ filter: alpha(opacity=50);
274
+ }
275
+
276
+ .crellyslider > .cs-navigation > .cs-slide-link.cs-active {
277
+ opacity: 1;
278
+ filter: alpha(opacity=100);
279
+ }
280
+
281
+ .crellyslider > .cs-progress-bar {
282
+ width: 0%;
283
+ height: 4px;
284
+ position: absolute;
285
+ top: 0;
286
+ background-color: #fff;
287
+ opacity: .5;
288
+ filter: alpha(opacity=50);
289
+ z-index: 999;
290
+ }
291
+
292
+ .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
293
+ opacity: 0;
294
+ filter: alpha(opacity=0);
295
+ }
demo/demo.html CHANGED
@@ -1,638 +1,638 @@
1
- <!doctype html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width" />
7
-
8
- <title>Crelly Slider - Free jQuery Slider</title>
9
- <meta name="description" content="The first Free Wordpress Slider that supports animations" />
10
-
11
- <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
12
- <link rel="stylesheet" type="text/css" href="../css/crellyslider.css" />
13
-
14
- <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
15
- <style type="text/css">
16
- @font-face {font-family:"Bender";src:url("fonts/Bender.eot?") format("eot"),url("fonts/Bender.woff") format("woff"),url("fonts/Bender.ttf") format("truetype"),url("fonts/Bender.svg#Bender") format("svg");font-weight:normal;font-style:normal;}
17
- body {
18
- margin: 0;
19
- padding: 0;
20
- font-family: arial;
21
- font-size: 14px;
22
- line-height: 1.5em;
23
- vertical-align: baseline;
24
- }
25
-
26
- img {
27
- max-width: 100%;
28
- height: auto;
29
- }
30
- </style>
31
-
32
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
33
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
34
- <script type="text/javascript" src="../js/jquery.crellyslider.js"></script> <!-- use jquery.crellyslider.min.js for production -->
35
- </head>
36
-
37
- <body>
38
- <div style="display: none;" class="crellyslider-slider crellyslider-slider-fixed crellyslider-slider-home_slider" id="crellyslider-1">
39
- <ul>
40
- <li
41
- style="
42
- background-color: transparent;
43
- background-image: url('http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/bg21.png');
44
- background-color: red;
45
- background-position-x: 0;
46
- background-position-y: 0;
47
- background-repeat: repeat;
48
- background-size: auto;
49
-
50
- "
51
- data-in="slideLeft"
52
- data-ease-in="400"
53
- data-out="slideLeft"
54
- data-ease-out="400"
55
- data-time="5000"
56
- >
57
- <img
58
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/and1.png"
59
- alt=""
60
- style="
61
- z-index: 1;
62
-
63
- "
64
- data-delay="600"
65
- data-ease-in="300"
66
- data-ease-out="200"
67
- data-in="slideUp"
68
- data-out="fade"
69
- data-ignore-ease-out="0"
70
- data-top="62"
71
- data-left="505"
72
- data-time="all"
73
- />
74
- <div
75
- style="z-index: 1;
76
- font-size: 24px;
77
- color: #fff;
78
- font-family: 'Bender', 'Rokkitt', serif;
79
- "
80
- data-delay="600"
81
- data-ease-in="300"
82
- data-ease-out="200"
83
- data-in="slideUp"
84
- data-out="fadeSmallRight"
85
- data-ignore-ease-out="0"
86
- data-top="85"
87
- data-left="578"
88
- data-time="all"
89
- >
90
- IT'S OPEN SOURCE
91
- </div>
92
- <img
93
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/heart.png"
94
- alt=""
95
- style="
96
- z-index: 1;
97
-
98
- "
99
- data-delay="2300"
100
- data-ease-in="300"
101
- data-ease-out="200"
102
- data-in="fadeSmallLeft"
103
- data-out="fadeSmallDown"
104
- data-ignore-ease-out="0"
105
- data-top="422"
106
- data-left="920"
107
- data-time="all"
108
- />
109
- <img
110
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/arrow-right.png"
111
- alt=""
112
- style="
113
- z-index: 1;
114
-
115
- "
116
- data-delay="1700"
117
- data-ease-in="300"
118
- data-ease-out="200"
119
- data-in="fade"
120
- data-out="fadeSmallRight"
121
- data-ignore-ease-out="0"
122
- data-top="329"
123
- data-left="798"
124
- data-time="all"
125
- />
126
- <div
127
- style="z-index: 1;
128
- font-size: 24px;
129
- color: #fff;
130
- font-family: 'Bender', 'Rokkitt', serif;
131
- "
132
- data-delay="600"
133
- data-ease-in="300"
134
- data-ease-out="200"
135
- data-in="slideUp"
136
- data-out="fadeSmallLeft"
137
- data-ignore-ease-out="0"
138
- data-top="85"
139
- data-left="385"
140
- data-time="all"
141
- >
142
- IT'S FREE
143
- </div>
144
- <img
145
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/magic1.png"
146
- alt=""
147
- style="
148
- z-index: 1;
149
-
150
- "
151
- data-delay="1100"
152
- data-ease-in="300"
153
- data-ease-out="200"
154
- data-in="slideUp"
155
- data-out="fade"
156
- data-ignore-ease-out="0"
157
- data-top="309"
158
- data-left="704"
159
- data-time="all"
160
- />
161
- <img
162
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/arrow-upRight.png"
163
- alt=""
164
- style="
165
- z-index: 1;
166
-
167
- "
168
- data-delay="1400"
169
- data-ease-in="300"
170
- data-ease-out="200"
171
- data-in="fade"
172
- data-out="fadeSmallUp"
173
- data-ignore-ease-out="0"
174
- data-top="229"
175
- data-left="798"
176
- data-time="all"
177
- />
178
- <img
179
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/arrow-downRight.png"
180
- alt=""
181
- style="
182
- z-index: 1;
183
-
184
- "
185
- data-delay="2000"
186
- data-ease-in="300"
187
- data-ease-out="200"
188
- data-in="fade"
189
- data-out="fadeSmallDown"
190
- data-ignore-ease-out="0"
191
- data-top="398"
192
- data-left="798"
193
- data-time="all"
194
- />
195
- <img
196
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/code1.png"
197
- alt=""
198
- style="
199
- z-index: 1;
200
-
201
- "
202
- data-delay="800"
203
- data-ease-in="300"
204
- data-ease-out="200"
205
- data-in="slideUp"
206
- data-out="slideDown"
207
- data-ignore-ease-out="0"
208
- data-top="203"
209
- data-left="60"
210
- data-time="all"
211
- />
212
- <div
213
- style="z-index: 1;
214
- font-size: 14px;
215
- color: #fff;
216
- "
217
- data-delay="2300"
218
- data-ease-in="300"
219
- data-ease-out="200"
220
- data-in="fadeSmallLeft"
221
- data-out="fadeSmallUp"
222
- data-ignore-ease-out="0"
223
- data-top="232"
224
- data-left="959"
225
- data-time="all"
226
- >
227
- Well Documented
228
- </div>
229
- <div
230
- style="z-index: 1;
231
- font-size: 14px;
232
- color: #fff;
233
- "
234
- data-delay="2300"
235
- data-ease-in="300"
236
- data-ease-out="200"
237
- data-in="fadeSmallLeft"
238
- data-out="fadeSmallRight"
239
- data-ignore-ease-out="0"
240
- data-top="327"
241
- data-left="959"
242
- data-time="all"
243
- >
244
- Clear Code
245
- </div>
246
- <img
247
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/document.png"
248
- alt=""
249
- style="
250
- z-index: 1;
251
-
252
- "
253
- data-delay="2300"
254
- data-ease-in="300"
255
- data-ease-out="200"
256
- data-in="fadeSmallLeft"
257
- data-out="fadeSmallUp"
258
- data-ignore-ease-out="0"
259
- data-top="232"
260
- data-left="920"
261
- data-time="all"
262
- />
263
- <div
264
- style="z-index: 1;
265
- font-size: 14px;
266
- color: #fff;
267
- "
268
- data-delay="2300"
269
- data-ease-in="300"
270
- data-ease-out="200"
271
- data-in="fadeSmallLeft"
272
- data-out="fadeSmallDown"
273
- data-ignore-ease-out="0"
274
- data-top="422"
275
- data-left="959"
276
- data-time="all"
277
- >
278
- Done with Love
279
- </div>
280
- <img
281
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/tick.png"
282
- alt=""
283
- style="
284
- z-index: 1;
285
-
286
- "
287
- data-delay="2300"
288
- data-ease-in="300"
289
- data-ease-out="200"
290
- data-in="fadeSmallLeft"
291
- data-out="fadeSmallRight"
292
- data-ignore-ease-out="0"
293
- data-top="327"
294
- data-left="920"
295
- data-time="all"
296
- />
297
- </li>
298
- <li
299
- style="
300
- background-color: rgb(255, 255, 255);
301
- background-image: none;
302
- background-position-x: 0;
303
- background-position-y: 0;
304
- background-repeat: no-repeat;
305
- background-size: auto;
306
-
307
- "
308
- data-in="fade"
309
- data-ease-in="400"
310
- data-out="fade"
311
- data-ease-out="400"
312
- data-time="3000"
313
- >
314
- <img
315
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_4.png"
316
- alt=""
317
- style="
318
- z-index: 1;
319
-
320
- "
321
- data-delay="450"
322
- data-ease-in="300"
323
- data-ease-out="300"
324
- data-in="slideUp"
325
- data-out="fade"
326
- data-ignore-ease-out="0"
327
- data-top="237"
328
- data-left="349"
329
- data-time="all"
330
- />
331
- <img
332
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_1.png"
333
- alt=""
334
- style="
335
- z-index: 1;
336
-
337
- "
338
- data-delay="0"
339
- data-ease-in="300"
340
- data-ease-out="300"
341
- data-in="fadeUp"
342
- data-out="fade"
343
- data-ignore-ease-out="0"
344
- data-top="237"
345
- data-left="201"
346
- data-time="all"
347
- />
348
- <div
349
- style="z-index: 1;
350
- font-size: 24px;
351
- padding: 5px 0;
352
- "
353
- data-delay="1300"
354
- data-ease-in="300"
355
- data-ease-out="300"
356
- data-in="fadeSmallRight"
357
- data-out="fade"
358
- data-ignore-ease-out="0"
359
- data-top="59"
360
- data-left="511"
361
- data-time="all"
362
- >
363
- LET'S DISCOVER
364
- </div>
365
- <img
366
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_2.png"
367
- alt=""
368
- style="
369
- z-index: 1;
370
-
371
- "
372
- data-delay="150"
373
- data-ease-in="300"
374
- data-ease-out="300"
375
- data-in="slideUp"
376
- data-out="fade"
377
- data-ignore-ease-out="0"
378
- data-top="237"
379
- data-left="795"
380
- data-time="all"
381
- />
382
- <div
383
- style="z-index: 1;
384
- color: #fff;
385
- padding: 5px 20px;
386
- font-size: 24px;
387
- background: red;
388
- font-weight: bold;
389
- z-index: 2;
390
- "
391
- data-delay="1000"
392
- data-ease-in="300"
393
- data-ease-out="300"
394
- data-in="slideRight"
395
- data-out="fade"
396
- data-ignore-ease-out="0"
397
- data-top="59"
398
- data-left="381"
399
- data-time="all"
400
- >
401
- HELLO
402
- </div>
403
- <img
404
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_3.png"
405
- alt=""
406
- style="
407
- z-index: 1;
408
-
409
- "
410
- data-delay="900"
411
- data-ease-in="300"
412
- data-ease-out="300"
413
- data-in="slideUp"
414
- data-out="fade"
415
- data-ignore-ease-out="0"
416
- data-top="237"
417
- data-left="495"
418
- data-time="all"
419
- />
420
- <img
421
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_5.png"
422
- alt=""
423
- style="
424
- z-index: 1;
425
-
426
- "
427
- data-delay="700"
428
- data-ease-in="300"
429
- data-ease-out="300"
430
- data-in="slideUp"
431
- data-out="fade"
432
- data-ignore-ease-out="0"
433
- data-top="237"
434
- data-left="649"
435
- data-time="all"
436
- />
437
- </li>
438
- <li
439
- style="
440
- background-color: transparent;
441
- background-image: url('http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/business.jpg');
442
- background-position-x: center;
443
- background-position-y: center;
444
- background-repeat: no-repeat;
445
- background-size: cover;
446
-
447
- "
448
- data-in="fade"
449
- data-ease-in="300"
450
- data-out="fade"
451
- data-ease-out="300"
452
- data-time="5000"
453
- >
454
- <div
455
- style="z-index: 1;
456
- font-size: 48px;
457
- color: #fff;
458
- font-family: 'Lato';
459
- "
460
- data-delay="0"
461
- data-ease-in="600"
462
- data-ease-out="600"
463
- data-in="fadeDown"
464
- data-out="fadeSmallDown"
465
- data-ignore-ease-out="0"
466
- data-top="195"
467
- data-left="386"
468
- data-time="all"
469
- >
470
- CRELLY SLIDER
471
- </div>
472
- <div
473
- style="z-index: 1;
474
- font-size: 18px;
475
- color: #fff;
476
- font-family: 'Lato';
477
- "
478
- data-delay="600"
479
- data-ease-in="400"
480
- data-ease-out="400"
481
- data-in="fadeSmallDown"
482
- data-out="fadeSmallDown"
483
- data-ignore-ease-out="0"
484
- data-top="273"
485
- data-left="337"
486
- data-time="all"
487
- >
488
- the first FREE WordPress slider with elements animations
489
- </div>
490
- </li>
491
- <li
492
- style="
493
- background-color: transparent;
494
- background-image: url('http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/bg1.png');
495
- background-position-x: auto;
496
- background-position-y: auto;
497
- background-repeat: repeat;
498
- background-size: auto;
499
-
500
- "
501
- data-in="fade"
502
- data-ease-in="400"
503
- data-out="fade"
504
- data-ease-out="400"
505
- data-time="5000"
506
- >
507
- <img
508
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/hill2.png"
509
- alt=""
510
- style="
511
- z-index: 1;
512
-
513
- "
514
- data-delay="0"
515
- data-ease-in="200"
516
- data-ease-out="200"
517
- data-in="slideUp"
518
- data-out="slideDown"
519
- data-ignore-ease-out="0"
520
- data-top="254"
521
- data-left="0"
522
- data-time="all"
523
- />
524
- <img
525
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/house.png"
526
- alt=""
527
- style="
528
- z-index: 0;
529
-
530
- "
531
- data-delay="400"
532
- data-ease-in="200"
533
- data-ease-out="200"
534
- data-in="slideLeft"
535
- data-out="slideRight"
536
- data-ignore-ease-out="0"
537
- data-top="149"
538
- data-left="837"
539
- data-time="all"
540
- />
541
- <img
542
- src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/airplane.png"
543
- alt=""
544
- style="
545
- z-index: 1;
546
-
547
- "
548
- data-delay="0"
549
- data-ease-in="10800"
550
- data-ease-out="200"
551
- data-in="slideRight"
552
- data-out="fade"
553
- data-ignore-ease-out="1"
554
- data-top="44"
555
- data-left="1140"
556
- data-time="all"
557
- />
558
- <div
559
- style="z-index: 1;
560
- font-size: 22px;
561
- line-height: 26px;
562
- color: #fff;
563
- font-family: 'Rokkitt', serif;
564
- "
565
- data-delay="1100"
566
- data-ease-in="300"
567
- data-ease-out="200"
568
- data-in="slideRight"
569
- data-out="slideLeft"
570
- data-ignore-ease-out="0"
571
- data-top="245"
572
- data-left="60"
573
- data-time="all"
574
- >
575
- They are colored, animated, creative.<br/>Make your WebSite more awesome
576
- </div>
577
- <div
578
- style="z-index: 1;
579
- font-size: 48px;
580
- color: #fff;
581
- font-family: 'Rokkitt', serif;
582
- "
583
- data-delay="800"
584
- data-ease-in="300"
585
- data-ease-out="200"
586
- data-in="slideRight"
587
- data-out="slideLeft"
588
- data-ignore-ease-out="0"
589
- data-top="190"
590
- data-left="60"
591
- data-time="all"
592
- >
593
- Create Slides
594
- </div>
595
- </li>
596
- </ul>
597
- </div>
598
-
599
- <script type="text/javascript">
600
- (function($) {
601
- $(document).ready(function() {
602
- $("#crellyslider-1").crellySlider({
603
- layout : 'fixed',
604
- responsive : true,
605
- startWidth : 1140,
606
- startHeight : 487,
607
-
608
- pauseOnHover : true,
609
- automaticSlide : false,
610
- showControls : true,
611
- showNavigation : true,
612
- showProgressBar : true,
613
- enableSwipe : true,
614
-
615
- slidesTime : 3000,
616
- elementsDelay : 0,
617
- elementsTime : 'all',
618
- slidesEaseIn : 300,
619
- elementsEaseIn : 300,
620
- slidesEaseOut : 300,
621
- elementsEaseOut : 300,
622
- ignoreElementsEaseOut : false,
623
-
624
- videoAutoplay : true,
625
- videoLoop : false,
626
-
627
- beforeStart : function() {},
628
- beforeSetResponsive : function() {},
629
- beforeSlideStart : function() {},
630
- beforePause : function() {},
631
- beforeResume : function() {},
632
- });
633
- });
634
- })(jQuery);
635
- </script>
636
-
637
- </body>
638
- </html>
1
+ <!doctype html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width" />
7
+
8
+ <title>Crelly Slider - Free jQuery Slider</title>
9
+ <meta name="description" content="The first Free Wordpress Slider that supports animations" />
10
+
11
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
12
+ <link rel="stylesheet" type="text/css" href="../css/crellyslider.css" />
13
+
14
+ <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
15
+ <style type="text/css">
16
+ @font-face {font-family:"Bender";src:url("fonts/Bender.eot?") format("eot"),url("fonts/Bender.woff") format("woff"),url("fonts/Bender.ttf") format("truetype"),url("fonts/Bender.svg#Bender") format("svg");font-weight:normal;font-style:normal;}
17
+ body {
18
+ margin: 0;
19
+ padding: 0;
20
+ font-family: arial;
21
+ font-size: 14px;
22
+ line-height: 1.5em;
23
+ vertical-align: baseline;
24
+ }
25
+
26
+ img {
27
+ max-width: 100%;
28
+ height: auto;
29
+ }
30
+ </style>
31
+
32
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
33
+ <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
34
+ <script type="text/javascript" src="../js/jquery.crellyslider.js"></script> <!-- use jquery.crellyslider.min.js for production -->
35
+ </head>
36
+
37
+ <body>
38
+ <div style="display: none;" class="crellyslider-slider crellyslider-slider-fixed crellyslider-slider-home_slider" id="crellyslider-1">
39
+ <ul>
40
+ <li
41
+ style="
42
+ background-color: transparent;
43
+ background-image: url('http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/bg21.png');
44
+ background-color: red;
45
+ background-position-x: 0;
46
+ background-position-y: 0;
47
+ background-repeat: repeat;
48
+ background-size: auto;
49
+
50
+ "
51
+ data-in="slideLeft"
52
+ data-ease-in="400"
53
+ data-out="slideLeft"
54
+ data-ease-out="400"
55
+ data-time="5000"
56
+ >
57
+ <img
58
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/and1.png"
59
+ alt=""
60
+ style="
61
+ z-index: 1;
62
+
63
+ "
64
+ data-delay="600"
65
+ data-ease-in="300"
66
+ data-ease-out="200"
67
+ data-in="slideUp"
68
+ data-out="fade"
69
+ data-ignore-ease-out="0"
70
+ data-top="62"
71
+ data-left="505"
72
+ data-time="all"
73
+ />
74
+ <div
75
+ style="z-index: 1;
76
+ font-size: 24px;
77
+ color: #fff;
78
+ font-family: 'Bender', 'Rokkitt', serif;
79
+ "
80
+ data-delay="600"
81
+ data-ease-in="300"
82
+ data-ease-out="200"
83
+ data-in="slideUp"
84
+ data-out="fadeSmallRight"
85
+ data-ignore-ease-out="0"
86
+ data-top="85"
87
+ data-left="578"
88
+ data-time="all"
89
+ >
90
+ IT'S OPEN SOURCE
91
+ </div>
92
+ <img
93
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/heart.png"
94
+ alt=""
95
+ style="
96
+ z-index: 1;
97
+
98
+ "
99
+ data-delay="2300"
100
+ data-ease-in="300"
101
+ data-ease-out="200"
102
+ data-in="fadeSmallLeft"
103
+ data-out="fadeSmallDown"
104
+ data-ignore-ease-out="0"
105
+ data-top="422"
106
+ data-left="920"
107
+ data-time="all"
108
+ />
109
+ <img
110
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/arrow-right.png"
111
+ alt=""
112
+ style="
113
+ z-index: 1;
114
+
115
+ "
116
+ data-delay="1700"
117
+ data-ease-in="300"
118
+ data-ease-out="200"
119
+ data-in="fade"
120
+ data-out="fadeSmallRight"
121
+ data-ignore-ease-out="0"
122
+ data-top="329"
123
+ data-left="798"
124
+ data-time="all"
125
+ />
126
+ <div
127
+ style="z-index: 1;
128
+ font-size: 24px;
129
+ color: #fff;
130
+ font-family: 'Bender', 'Rokkitt', serif;
131
+ "
132
+ data-delay="600"
133
+ data-ease-in="300"
134
+ data-ease-out="200"
135
+ data-in="slideUp"
136
+ data-out="fadeSmallLeft"
137
+ data-ignore-ease-out="0"
138
+ data-top="85"
139
+ data-left="385"
140
+ data-time="all"
141
+ >
142
+ IT'S FREE
143
+ </div>
144
+ <img
145
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/magic1.png"
146
+ alt=""
147
+ style="
148
+ z-index: 1;
149
+
150
+ "
151
+ data-delay="1100"
152
+ data-ease-in="300"
153
+ data-ease-out="200"
154
+ data-in="slideUp"
155
+ data-out="fade"
156
+ data-ignore-ease-out="0"
157
+ data-top="309"
158
+ data-left="704"
159
+ data-time="all"
160
+ />
161
+ <img
162
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/arrow-upRight.png"
163
+ alt=""
164
+ style="
165
+ z-index: 1;
166
+
167
+ "
168
+ data-delay="1400"
169
+ data-ease-in="300"
170
+ data-ease-out="200"
171
+ data-in="fade"
172
+ data-out="fadeSmallUp"
173
+ data-ignore-ease-out="0"
174
+ data-top="229"
175
+ data-left="798"
176
+ data-time="all"
177
+ />
178
+ <img
179
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/arrow-downRight.png"
180
+ alt=""
181
+ style="
182
+ z-index: 1;
183
+
184
+ "
185
+ data-delay="2000"
186
+ data-ease-in="300"
187
+ data-ease-out="200"
188
+ data-in="fade"
189
+ data-out="fadeSmallDown"
190
+ data-ignore-ease-out="0"
191
+ data-top="398"
192
+ data-left="798"
193
+ data-time="all"
194
+ />
195
+ <img
196
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/code1.png"
197
+ alt=""
198
+ style="
199
+ z-index: 1;
200
+
201
+ "
202
+ data-delay="800"
203
+ data-ease-in="300"
204
+ data-ease-out="200"
205
+ data-in="slideUp"
206
+ data-out="slideDown"
207
+ data-ignore-ease-out="0"
208
+ data-top="203"
209
+ data-left="60"
210
+ data-time="all"
211
+ />
212
+ <div
213
+ style="z-index: 1;
214
+ font-size: 14px;
215
+ color: #fff;
216
+ "
217
+ data-delay="2300"
218
+ data-ease-in="300"
219
+ data-ease-out="200"
220
+ data-in="fadeSmallLeft"
221
+ data-out="fadeSmallUp"
222
+ data-ignore-ease-out="0"
223
+ data-top="232"
224
+ data-left="959"
225
+ data-time="all"
226
+ >
227
+ Well Documented
228
+ </div>
229
+ <div
230
+ style="z-index: 1;
231
+ font-size: 14px;
232
+ color: #fff;
233
+ "
234
+ data-delay="2300"
235
+ data-ease-in="300"
236
+ data-ease-out="200"
237
+ data-in="fadeSmallLeft"
238
+ data-out="fadeSmallRight"
239
+ data-ignore-ease-out="0"
240
+ data-top="327"
241
+ data-left="959"
242
+ data-time="all"
243
+ >
244
+ Clear Code
245
+ </div>
246
+ <img
247
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/document.png"
248
+ alt=""
249
+ style="
250
+ z-index: 1;
251
+
252
+ "
253
+ data-delay="2300"
254
+ data-ease-in="300"
255
+ data-ease-out="200"
256
+ data-in="fadeSmallLeft"
257
+ data-out="fadeSmallUp"
258
+ data-ignore-ease-out="0"
259
+ data-top="232"
260
+ data-left="920"
261
+ data-time="all"
262
+ />
263
+ <div
264
+ style="z-index: 1;
265
+ font-size: 14px;
266
+ color: #fff;
267
+ "
268
+ data-delay="2300"
269
+ data-ease-in="300"
270
+ data-ease-out="200"
271
+ data-in="fadeSmallLeft"
272
+ data-out="fadeSmallDown"
273
+ data-ignore-ease-out="0"
274
+ data-top="422"
275
+ data-left="959"
276
+ data-time="all"
277
+ >
278
+ Done with Love
279
+ </div>
280
+ <img
281
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/tick.png"
282
+ alt=""
283
+ style="
284
+ z-index: 1;
285
+
286
+ "
287
+ data-delay="2300"
288
+ data-ease-in="300"
289
+ data-ease-out="200"
290
+ data-in="fadeSmallLeft"
291
+ data-out="fadeSmallRight"
292
+ data-ignore-ease-out="0"
293
+ data-top="327"
294
+ data-left="920"
295
+ data-time="all"
296
+ />
297
+ </li>
298
+ <li
299
+ style="
300
+ background-color: rgb(255, 255, 255);
301
+ background-image: none;
302
+ background-position-x: 0;
303
+ background-position-y: 0;
304
+ background-repeat: no-repeat;
305
+ background-size: auto;
306
+
307
+ "
308
+ data-in="fade"
309
+ data-ease-in="400"
310
+ data-out="fade"
311
+ data-ease-out="400"
312
+ data-time="3000"
313
+ >
314
+ <img
315
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_4.png"
316
+ alt=""
317
+ style="
318
+ z-index: 1;
319
+
320
+ "
321
+ data-delay="450"
322
+ data-ease-in="300"
323
+ data-ease-out="300"
324
+ data-in="slideUp"
325
+ data-out="fade"
326
+ data-ignore-ease-out="0"
327
+ data-top="237"
328
+ data-left="349"
329
+ data-time="all"
330
+ />
331
+ <img
332
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_1.png"
333
+ alt=""
334
+ style="
335
+ z-index: 1;
336
+
337
+ "
338
+ data-delay="0"
339
+ data-ease-in="300"
340
+ data-ease-out="300"
341
+ data-in="fadeUp"
342
+ data-out="fade"
343
+ data-ignore-ease-out="0"
344
+ data-top="237"
345
+ data-left="201"
346
+ data-time="all"
347
+ />
348
+ <div
349
+ style="z-index: 1;
350
+ font-size: 24px;
351
+ padding: 5px 0;
352
+ "
353
+ data-delay="1300"
354
+ data-ease-in="300"
355
+ data-ease-out="300"
356
+ data-in="fadeSmallRight"
357
+ data-out="fade"
358
+ data-ignore-ease-out="0"
359
+ data-top="59"
360
+ data-left="511"
361
+ data-time="all"
362
+ >
363
+ LET'S DISCOVER
364
+ </div>
365
+ <img
366
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_2.png"
367
+ alt=""
368
+ style="
369
+ z-index: 1;
370
+
371
+ "
372
+ data-delay="150"
373
+ data-ease-in="300"
374
+ data-ease-out="300"
375
+ data-in="slideUp"
376
+ data-out="fade"
377
+ data-ignore-ease-out="0"
378
+ data-top="237"
379
+ data-left="795"
380
+ data-time="all"
381
+ />
382
+ <div
383
+ style="z-index: 1;
384
+ color: #fff;
385
+ padding: 5px 20px;
386
+ font-size: 24px;
387
+ background: red;
388
+ font-weight: bold;
389
+ z-index: 2;
390
+ "
391
+ data-delay="1000"
392
+ data-ease-in="300"
393
+ data-ease-out="300"
394
+ data-in="slideRight"
395
+ data-out="fade"
396
+ data-ignore-ease-out="0"
397
+ data-top="59"
398
+ data-left="381"
399
+ data-time="all"
400
+ >
401
+ HELLO
402
+ </div>
403
+ <img
404
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_3.png"
405
+ alt=""
406
+ style="
407
+ z-index: 1;
408
+
409
+ "
410
+ data-delay="900"
411
+ data-ease-in="300"
412
+ data-ease-out="300"
413
+ data-in="slideUp"
414
+ data-out="fade"
415
+ data-ignore-ease-out="0"
416
+ data-top="237"
417
+ data-left="495"
418
+ data-time="all"
419
+ />
420
+ <img
421
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/man_5.png"
422
+ alt=""
423
+ style="
424
+ z-index: 1;
425
+
426
+ "
427
+ data-delay="700"
428
+ data-ease-in="300"
429
+ data-ease-out="300"
430
+ data-in="slideUp"
431
+ data-out="fade"
432
+ data-ignore-ease-out="0"
433
+ data-top="237"
434
+ data-left="649"
435
+ data-time="all"
436
+ />
437
+ </li>
438
+ <li
439
+ style="
440
+ background-color: transparent;
441
+ background-image: url('http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/business.jpg');
442
+ background-position-x: center;
443
+ background-position-y: center;
444
+ background-repeat: no-repeat;
445
+ background-size: cover;
446
+
447
+ "
448
+ data-in="fade"
449
+ data-ease-in="300"
450
+ data-out="fade"
451
+ data-ease-out="300"
452
+ data-time="5000"
453
+ >
454
+ <div
455
+ style="z-index: 1;
456
+ font-size: 48px;
457
+ color: #fff;
458
+ font-family: 'Lato';
459
+ "
460
+ data-delay="0"
461
+ data-ease-in="600"
462
+ data-ease-out="600"
463
+ data-in="fadeDown"
464
+ data-out="fadeSmallDown"
465
+ data-ignore-ease-out="0"
466
+ data-top="195"
467
+ data-left="386"
468
+ data-time="all"
469
+ >
470
+ CRELLY SLIDER
471
+ </div>
472
+ <div
473
+ style="z-index: 1;
474
+ font-size: 18px;
475
+ color: #fff;
476
+ font-family: 'Lato';
477
+ "
478
+ data-delay="600"
479
+ data-ease-in="400"
480
+ data-ease-out="400"
481
+ data-in="fadeSmallDown"
482
+ data-out="fadeSmallDown"
483
+ data-ignore-ease-out="0"
484
+ data-top="273"
485
+ data-left="337"
486
+ data-time="all"
487
+ >
488
+ the first FREE WordPress slider with elements animations
489
+ </div>
490
+ </li>
491
+ <li
492
+ style="
493
+ background-color: transparent;
494
+ background-image: url('http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/bg1.png');
495
+ background-position-x: auto;
496
+ background-position-y: auto;
497
+ background-repeat: repeat;
498
+ background-size: auto;
499
+
500
+ "
501
+ data-in="fade"
502
+ data-ease-in="400"
503
+ data-out="fade"
504
+ data-ease-out="400"
505
+ data-time="5000"
506
+ >
507
+ <img
508
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/hill2.png"
509
+ alt=""
510
+ style="
511
+ z-index: 1;
512
+
513
+ "
514
+ data-delay="0"
515
+ data-ease-in="200"
516
+ data-ease-out="200"
517
+ data-in="slideUp"
518
+ data-out="slideDown"
519
+ data-ignore-ease-out="0"
520
+ data-top="254"
521
+ data-left="0"
522
+ data-time="all"
523
+ />
524
+ <img
525
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/house.png"
526
+ alt=""
527
+ style="
528
+ z-index: 0;
529
+
530
+ "
531
+ data-delay="400"
532
+ data-ease-in="200"
533
+ data-ease-out="200"
534
+ data-in="slideLeft"
535
+ data-out="slideRight"
536
+ data-ignore-ease-out="0"
537
+ data-top="149"
538
+ data-left="837"
539
+ data-time="all"
540
+ />
541
+ <img
542
+ src="http://fabiorino1.altervista.org/projects/crellyslider/wp-content/uploads/2014/08/airplane.png"
543
+ alt=""
544
+ style="
545
+ z-index: 1;
546
+
547
+ "
548
+ data-delay="0"
549
+ data-ease-in="10800"
550
+ data-ease-out="200"
551
+ data-in="slideRight"
552
+ data-out="fade"
553
+ data-ignore-ease-out="1"
554
+ data-top="44"
555
+ data-left="1140"
556
+ data-time="all"
557
+ />
558
+ <div
559
+ style="z-index: 1;
560
+ font-size: 22px;
561
+ line-height: 26px;
562
+ color: #fff;
563
+ font-family: 'Rokkitt', serif;
564
+ "
565
+ data-delay="1100"
566
+ data-ease-in="300"
567
+ data-ease-out="200"
568
+ data-in="slideRight"
569
+ data-out="slideLeft"
570
+ data-ignore-ease-out="0"
571
+ data-top="245"
572
+ data-left="60"
573
+ data-time="all"
574
+ >
575
+ They are colored, animated, creative.<br/>Make your WebSite more awesome
576
+ </div>
577
+ <div
578
+ style="z-index: 1;
579
+ font-size: 48px;
580
+ color: #fff;
581
+ font-family: 'Rokkitt', serif;
582
+ "
583
+ data-delay="800"
584
+ data-ease-in="300"
585
+ data-ease-out="200"
586
+ data-in="slideRight"
587
+ data-out="slideLeft"
588
+ data-ignore-ease-out="0"
589
+ data-top="190"
590
+ data-left="60"
591
+ data-time="all"
592
+ >
593
+ Create Slides
594
+ </div>
595
+ </li>
596
+ </ul>
597
+ </div>
598
+
599
+ <script type="text/javascript">
600
+ (function($) {
601
+ $(document).ready(function() {
602
+ $("#crellyslider-1").crellySlider({
603
+ layout : 'fixed',
604
+ responsive : true,
605
+ startWidth : 1140,
606
+ startHeight : 487,
607
+
608
+ pauseOnHover : true,
609
+ automaticSlide : false,
610
+ showControls : true,
611
+ showNavigation : true,
612
+ showProgressBar : true,
613
+ enableSwipe : true,
614
+
615
+ slidesTime : 3000,
616
+ elementsDelay : 0,
617
+ elementsTime : 'all',
618
+ slidesEaseIn : 300,
619
+ elementsEaseIn : 300,
620
+ slidesEaseOut : 300,
621
+ elementsEaseOut : 300,
622
+ ignoreElementsEaseOut : false,
623
+
624
+ videoAutoplay : true,
625
+ videoLoop : false,
626
+
627
+ beforeStart : function() {},
628
+ beforeSetResponsive : function() {},
629
+ beforeSlideStart : function() {},
630
+ beforePause : function() {},
631
+ beforeResume : function() {},
632
+ });
633
+ });
634
+ })(jQuery);
635
+ </script>
636
+
637
+ </body>
638
+ </html>
demo/timing-test.html CHANGED
@@ -1,271 +1,271 @@
1
- <!doctype html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width" />
7
-
8
- <title>Crelly Slider - Free jQuery Slider</title>
9
- <meta name="description" content="The first Free Wordpress Slider that supports animations" />
10
-
11
- <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
12
- <link rel="stylesheet" type="text/css" href="../css/crellyslider.css" />
13
-
14
- <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
15
- <style type="text/css">
16
- @font-face {font-family:"Bender";src:url("fonts/Bender.eot?") format("eot"),url("fonts/Bender.woff") format("woff"),url("fonts/Bender.ttf") format("truetype"),url("fonts/Bender.svg#Bender") format("svg");font-weight:normal;font-style:normal;}
17
- body {
18
- margin: 0;
19
- padding: 0;
20
- font-family: arial;
21
- font-size: 14px;
22
- line-height: 1.5em;
23
- vertical-align: baseline;
24
- }
25
-
26
- img {
27
- max-width: 100%;
28
- height: auto;
29
- }
30
- </style>
31
- </head>
32
-
33
- <body>
34
- <br />
35
-
36
- <div id="demo-1" style="display: none;">
37
- <ul>
38
- <li style="background: url('images/bg1.png'); background-size: cover;" data-in="slideLeft" data-ease-in="1500" data-ease-out="1500" data-out="slideLeft">
39
- <div style="opacity: 0.5; font-size: 48px; color: #fff; font-family: 'Rokkitt', serif;" data-top="190" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="3000" data-ease-out="2000" data-delay="0" data-time="all"><h1><span>Crelly Slider</span></h1></div>
40
- <div style="font-size: 22px; line-height: 26px; color: #fff; font-family: 'Rokkitt', serif;" data-top="245" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="3000" data-ease-out="2000" data-delay="0" data-time="3000">Is the first FREE Wordpress slider<br />with layers animations!</div>
41
- <div style="font-size: 22px; line-height: 26px; color: #fff; font-family: 'Rokkitt', serif;" data-top="300" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="3000" data-ease-out="2000" data-delay="0" data-time="3000">Another simple text</div>
42
- <a data-top="149" data-left="837" data-in="slideLeft" data-out="slideRight" data-ease-in="200" data-ease-out="200" data-delay="0" data-time="all" href="http://www.google.it" target="_blank">
43
- <img alt="" src="images/house.png" />
44
- </a>
45
- <img alt="" src="images/airplane.png" style="height:auto" data-top="44" data-left="1140" data-in="slideRight" data-out="slideRight" data-ease-in="10800" data-ease-out="0" data-delay="0" data-time="0" data-wait-me-out="1" />
46
- <a data-top="254" data-left="0" data-in="slideUp" data-out="slideDown" data-ease-in="1080" data-ease-out="200" data-delay="0" data-time="all" href="http://www.google.it" target="_blank">
47
- <img alt="" src="images/hill.png" />
48
- </a>
49
- </li>
50
-
51
- <li
52
- style="
53
- background-color: transparent;
54
- background-image: url('images/bg1.png');
55
- background-position-x: auto;
56
- background-position-y: auto;
57
- background-repeat: repeat;
58
- background-size: cover;
59
-
60
- "
61
- data-in="slideLeft"
62
- data-ease-in="1500"
63
- data-out="slideLeft"
64
- data-ease-out="400"
65
- data-time="10000"
66
- >
67
- <div
68
- style="z-index: 1;
69
- font-size: 48px;
70
- color: #fff;
71
- font-family: 'Rokkitt', serif;
72
- "
73
- data-delay="2500"
74
- data-ease-in="30000"
75
- data-ease-out="200"
76
- data-in="slideRight"
77
- data-out="slideLeft"
78
- data-top="190"
79
- data-left="60"
80
- data-time="all"
81
- data-ignore-ease-out="0"
82
- >
83
- <h2>Create Slides</h2>
84
- </div>
85
- <img
86
- src="images/airplane.png"
87
- alt=""
88
- style="
89
- z-index: 1;
90
-
91
- "
92
- data-delay="0"
93
- data-ease-in="0"
94
- data-ease-out="10800"
95
- data-in="none"
96
- data-out="slideRight"
97
- data-top="44"
98
- data-left="-2414"
99
- data-time="0"
100
- data-ignore-ease-out="1"
101
- />
102
- <img
103
- src="images/hill.png"
104
- alt=""
105
- style="
106
- z-index: 1;
107
-
108
- "
109
- data-delay="0"
110
- data-ease-in="200"
111
- data-ease-out="200"
112
- data-in="slideUp"
113
- data-out="slideDown"
114
- data-top="254"
115
- data-left="0"
116
- data-time="all"
117
- />
118
- <img
119
- src="images/house.png"
120
- alt=""
121
- style="
122
- z-index: 0;
123
-
124
- "
125
- data-delay="400"
126
- data-ease-in="200"
127
- data-ease-out="200"
128
- data-in="slideLeft"
129
- data-out="slideRight"
130
- data-top="149"
131
- data-left="837"
132
- data-time="all"
133
- />
134
- <div
135
- style="z-index: 1;
136
- font-size: 22px;
137
- line-height: 26px;
138
- color: #fff;
139
- font-family: 'Rokkitt', serif;
140
- "
141
- data-delay="1100"
142
- data-ease-in="300"
143
- data-ease-out="200"
144
- data-in="slideRight"
145
- data-out="slideLeft"
146
- data-top="245"
147
- data-left="60"
148
- data-time="3100"
149
- >
150
- 1 They are colored, animated, creative.<br/>Make your WebSite more awesome
151
- </div>
152
- <div
153
- style="z-index: 1;
154
- font-size: 22px;
155
- line-height: 26px;
156
- color: #fff;
157
- font-family: 'Rokkitt', serif;
158
- "
159
- data-delay="5100"
160
- data-ease-in="300"
161
- data-ease-out="200"
162
- data-in="slideRight"
163
- data-out="slideLeft"
164
- data-top="245"
165
- data-left="60"
166
- data-time="7100"
167
- >
168
- 2 They are colored, animated, creative.<br/>Make your WebSite more awesome
169
- </div>
170
- </li>
171
-
172
- <li
173
- style="
174
- background-color: #000;
175
- background-position-x: center;
176
- background-position-y: center;
177
- background-repeat: no-repeat;
178
- background-size: cover;
179
-
180
- "
181
- data-in="fade"
182
- data-ease-in="6000"
183
- data-out="fade"
184
- data-ease-out="300"
185
- data-time="2000"
186
- >
187
- <div
188
- style="z-index: 1;
189
- font-size: 48px;
190
- color: #fff;
191
- font-family: 'Lato';
192
- opacity: .5;
193
- letter-spacing: 10px;
194
- "
195
- data-delay="0"
196
- data-ease-in="600"
197
- data-ease-out="600"
198
- data-in="fadeDown"
199
- data-out="fadeSmallDown"
200
- data-top="195"
201
- data-left="386"
202
- data-time="all"
203
- data-ignore-ease-out="1"
204
- >
205
- CRELLY SLIDER
206
- </div>
207
- <div
208
- style="z-index: 1;
209
- font-size: 18px;
210
- color: #fff;
211
- font-family: 'Lato';
212
- "
213
- data-delay="600"
214
- data-ease-in="400"
215
- data-ease-out="400"
216
- data-in="fadeSmallDown"
217
- data-out="fadeSmallDown"
218
- data-top="273"
219
- data-left="337"
220
- data-time="all"
221
- data-ignore-ease-out="1"
222
- >
223
- the first FREE WordPress slider with elements animations
224
- </div>
225
- </li>
226
-
227
- <li style="background: url('images/bg2.png');" data-in="slideLeft" data-out="slideUp" data-ease-out="2500" data-time="10000">
228
- <div style="font-size: 24px; color: #fff; font-family: 'Bender', 'Rokkitt', serif;" data-top="105" data-left="385" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="300" data-delay="600" data-time="15000" data-ignore-ease-out="1">IT'S FREE</div>
229
- <img alt="" src="images/and.png" data-top="82" data-left="505" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="600" data-time="all" />
230
- <div style="font-size: 24px; color: #fff; font-family: 'Bender', 'Rokkitt', serif;" data-top="105" data-left="578" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="600" data-time="all">IT'S OPEN - SOURCE</div>
231
- <img alt="" src="images/code.png" data-top="216" data-left="60" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="800" data-time="all" />
232
- <img alt="" src="images/magic.png" data-top="323" data-left="705" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="1100" data-time="all" />
233
- <img alt="" src="images/arrow-UpRight.png" data-top="249" data-left="798" data-in="fade" data-out="slideUp" data-ease-in="300" data-ease-out="200" data-delay="1400" data-time="all" />
234
- <img alt="" src="images/arrow-right.png" data-top="349" data-left="798" data-in="fade" data-out="slideUp" data-ease-in="300" data-ease-out="200" data-delay="1700" data-time="all" />
235
- <img alt="" src="images/arrow-downRight.png" data-top="409" data-left="798" data-in="fade" data-out="slideUp" data-ease-in="300" data-ease-out="200" data-delay="2000" data-time="all" />
236
- <img alt="" src="images/document.png" data-top="259" data-left="940" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all" />
237
- <div style="font-size: 14px; color: #fff;" data-top="258" data-left="976" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all">Well Documented</div>
238
- <img alt="" src="images/tick.png" data-top="349" data-left="940" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all" />
239
- <div style="font-size: 14px; color: #fff;" data-top="348" data-left="976" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all">Clear Code</div>
240
- <img alt="" src="images/heart.png" data-top="439" data-left="940" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all" />
241
- <div style="font-size: 14px; color: #fff;" data-top="438" data-left="976" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all">Done with Love</div>
242
- </li>
243
- </ul>
244
- </div>
245
-
246
- <br />
247
- <br />
248
-
249
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
250
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
251
- <script type="text/javascript" src="../js/jquery.crellyslider.js"></script>
252
-
253
- <script type="text/javascript">
254
- jQuery(document).ready(function($) {
255
- $('#demo-1').crellySlider({
256
- layout : 'full-width',
257
- automaticSlide : false,
258
- ignoreElementsEaseOut : false,
259
- responsive : true,
260
- beforeStart : function() {console.log('before start')},
261
- beforeSetResponsive : function() {console.log('before set responsive')},
262
- beforeSlideStart : function() {console.log(new Date())},
263
- beforePause : function() {console.log('before pause')},
264
- beforeResume : function() {console.log('before resume')},
265
- });
266
- });
267
- </script>
268
-
269
- </body>
270
-
271
  </html>
1
+ <!doctype html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width" />
7
+
8
+ <title>Crelly Slider - Free jQuery Slider</title>
9
+ <meta name="description" content="The first Free Wordpress Slider that supports animations" />
10
+
11
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
12
+ <link rel="stylesheet" type="text/css" href="../css/crellyslider.css" />
13
+
14
+ <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
15
+ <style type="text/css">
16
+ @font-face {font-family:"Bender";src:url("fonts/Bender.eot?") format("eot"),url("fonts/Bender.woff") format("woff"),url("fonts/Bender.ttf") format("truetype"),url("fonts/Bender.svg#Bender") format("svg");font-weight:normal;font-style:normal;}
17
+ body {
18
+ margin: 0;
19
+ padding: 0;
20
+ font-family: arial;
21
+ font-size: 14px;
22
+ line-height: 1.5em;
23
+ vertical-align: baseline;
24
+ }
25
+
26
+ img {
27
+ max-width: 100%;
28
+ height: auto;
29
+ }
30
+ </style>
31
+ </head>
32
+
33
+ <body>
34
+ <br />
35
+
36
+ <div id="demo-1" style="display: none;">
37
+ <ul>
38
+ <li style="background: url('images/bg1.png'); background-size: cover;" data-in="slideLeft" data-ease-in="1500" data-ease-out="1500" data-out="slideLeft">
39
+ <div style="opacity: 0.5; font-size: 48px; color: #fff; font-family: 'Rokkitt', serif;" data-top="190" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="3000" data-ease-out="2000" data-delay="0" data-time="all"><h1><span>Crelly Slider</span></h1></div>
40
+ <div style="font-size: 22px; line-height: 26px; color: #fff; font-family: 'Rokkitt', serif;" data-top="245" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="3000" data-ease-out="2000" data-delay="0" data-time="3000">Is the first FREE Wordpress slider<br />with layers animations!</div>
41
+ <div style="font-size: 22px; line-height: 26px; color: #fff; font-family: 'Rokkitt', serif;" data-top="300" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="3000" data-ease-out="2000" data-delay="0" data-time="3000">Another simple text</div>
42
+ <a data-top="149" data-left="837" data-in="slideLeft" data-out="slideRight" data-ease-in="200" data-ease-out="200" data-delay="0" data-time="all" href="http://www.google.it" target="_blank">
43
+ <img alt="" src="images/house.png" />
44
+ </a>
45
+ <img alt="" src="images/airplane.png" style="height:auto" data-top="44" data-left="1140" data-in="slideRight" data-out="slideRight" data-ease-in="10800" data-ease-out="0" data-delay="0" data-time="0" data-wait-me-out="1" />
46
+ <a data-top="254" data-left="0" data-in="slideUp" data-out="slideDown" data-ease-in="1080" data-ease-out="200" data-delay="0" data-time="all" href="http://www.google.it" target="_blank">
47
+ <img alt="" src="images/hill.png" />
48
+ </a>
49
+ </li>
50
+
51
+ <li
52
+ style="
53
+ background-color: transparent;
54
+ background-image: url('images/bg1.png');
55
+ background-position-x: auto;
56
+ background-position-y: auto;
57
+ background-repeat: repeat;
58
+ background-size: cover;
59
+
60
+ "
61
+ data-in="slideLeft"
62
+ data-ease-in="1500"
63
+ data-out="slideLeft"
64
+ data-ease-out="400"
65
+ data-time="10000"
66
+ >
67
+ <div
68
+ style="z-index: 1;
69
+ font-size: 48px;
70
+ color: #fff;
71
+ font-family: 'Rokkitt', serif;
72
+ "
73
+ data-delay="2500"
74
+ data-ease-in="30000"
75
+ data-ease-out="200"
76
+ data-in="slideRight"
77
+ data-out="slideLeft"
78
+ data-top="190"
79
+ data-left="60"
80
+ data-time="all"
81
+ data-ignore-ease-out="0"
82
+ >
83
+ <h2>Create Slides</h2>
84
+ </div>
85
+ <img
86
+ src="images/airplane.png"
87
+ alt=""
88
+ style="
89
+ z-index: 1;
90
+
91
+ "
92
+ data-delay="0"
93
+ data-ease-in="0"
94
+ data-ease-out="10800"
95
+ data-in="none"
96
+ data-out="slideRight"
97
+ data-top="44"
98
+ data-left="-2414"
99
+ data-time="0"
100
+ data-ignore-ease-out="1"
101
+ />
102
+ <img
103
+ src="images/hill.png"
104
+ alt=""
105
+ style="
106
+ z-index: 1;
107
+
108
+ "
109
+ data-delay="0"
110
+ data-ease-in="200"
111
+ data-ease-out="200"
112
+ data-in="slideUp"
113
+ data-out="slideDown"
114
+ data-top="254"
115
+ data-left="0"
116
+ data-time="all"
117
+ />
118
+ <img
119
+ src="images/house.png"
120
+ alt=""
121
+ style="
122
+ z-index: 0;
123
+
124
+ "
125
+ data-delay="400"
126
+ data-ease-in="200"
127
+ data-ease-out="200"
128
+ data-in="slideLeft"
129
+ data-out="slideRight"
130
+ data-top="149"
131
+ data-left="837"
132
+ data-time="all"
133
+ />
134
+ <div
135
+ style="z-index: 1;
136
+ font-size: 22px;
137
+ line-height: 26px;
138
+ color: #fff;
139
+ font-family: 'Rokkitt', serif;
140
+ "
141
+ data-delay="1100"
142
+ data-ease-in="300"
143
+ data-ease-out="200"
144
+ data-in="slideRight"
145
+ data-out="slideLeft"
146
+ data-top="245"
147
+ data-left="60"
148
+ data-time="3100"
149
+ >
150
+ 1 They are colored, animated, creative.<br/>Make your WebSite more awesome
151
+ </div>
152
+ <div
153
+ style="z-index: 1;
154
+ font-size: 22px;
155
+ line-height: 26px;
156
+ color: #fff;
157
+ font-family: 'Rokkitt', serif;
158
+ "
159
+ data-delay="5100"
160
+ data-ease-in="300"
161
+ data-ease-out="200"
162
+ data-in="slideRight"
163
+ data-out="slideLeft"
164
+ data-top="245"
165
+ data-left="60"
166
+ data-time="7100"
167
+ >
168
+ 2 They are colored, animated, creative.<br/>Make your WebSite more awesome
169
+ </div>
170
+ </li>
171
+
172
+ <li
173
+ style="
174
+ background-color: #000;
175
+ background-position-x: center;
176
+ background-position-y: center;
177
+ background-repeat: no-repeat;
178
+ background-size: cover;
179
+
180
+ "
181
+ data-in="fade"
182
+ data-ease-in="6000"
183
+ data-out="fade"
184
+ data-ease-out="300"
185
+ data-time="2000"
186
+ >
187
+ <div
188
+ style="z-index: 1;
189
+ font-size: 48px;
190
+ color: #fff;
191
+ font-family: 'Lato';
192
+ opacity: .5;
193
+ letter-spacing: 10px;
194
+ "
195
+ data-delay="0"
196
+ data-ease-in="600"
197
+ data-ease-out="600"
198
+ data-in="fadeDown"
199
+ data-out="fadeSmallDown"
200
+ data-top="195"
201
+ data-left="386"
202
+ data-time="all"
203
+ data-ignore-ease-out="1"
204
+ >
205
+ CRELLY SLIDER
206
+ </div>
207
+ <div
208
+ style="z-index: 1;
209
+ font-size: 18px;
210
+ color: #fff;
211
+ font-family: 'Lato';
212
+ "
213
+ data-delay="600"
214
+ data-ease-in="400"
215
+ data-ease-out="400"
216
+ data-in="fadeSmallDown"
217
+ data-out="fadeSmallDown"
218
+ data-top="273"
219
+ data-left="337"
220
+ data-time="all"
221
+ data-ignore-ease-out="1"
222
+ >
223
+ the first FREE WordPress slider with elements animations
224
+ </div>
225
+ </li>
226
+
227
+ <li style="background: url('images/bg2.png');" data-in="slideLeft" data-out="slideUp" data-ease-out="2500" data-time="10000">
228
+ <div style="font-size: 24px; color: #fff; font-family: 'Bender', 'Rokkitt', serif;" data-top="105" data-left="385" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="300" data-delay="600" data-time="15000" data-ignore-ease-out="1">IT'S FREE</div>
229
+ <img alt="" src="images/and.png" data-top="82" data-left="505" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="600" data-time="all" />
230
+ <div style="font-size: 24px; color: #fff; font-family: 'Bender', 'Rokkitt', serif;" data-top="105" data-left="578" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="600" data-time="all">IT'S OPEN - SOURCE</div>
231
+ <img alt="" src="images/code.png" data-top="216" data-left="60" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="800" data-time="all" />
232
+ <img alt="" src="images/magic.png" data-top="323" data-left="705" data-in="slideUp" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="1100" data-time="all" />
233
+ <img alt="" src="images/arrow-UpRight.png" data-top="249" data-left="798" data-in="fade" data-out="slideUp" data-ease-in="300" data-ease-out="200" data-delay="1400" data-time="all" />
234
+ <img alt="" src="images/arrow-right.png" data-top="349" data-left="798" data-in="fade" data-out="slideUp" data-ease-in="300" data-ease-out="200" data-delay="1700" data-time="all" />
235
+ <img alt="" src="images/arrow-downRight.png" data-top="409" data-left="798" data-in="fade" data-out="slideUp" data-ease-in="300" data-ease-out="200" data-delay="2000" data-time="all" />
236
+ <img alt="" src="images/document.png" data-top="259" data-left="940" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all" />
237
+ <div style="font-size: 14px; color: #fff;" data-top="258" data-left="976" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all">Well Documented</div>
238
+ <img alt="" src="images/tick.png" data-top="349" data-left="940" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all" />
239
+ <div style="font-size: 14px; color: #fff;" data-top="348" data-left="976" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all">Clear Code</div>
240
+ <img alt="" src="images/heart.png" data-top="439" data-left="940" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all" />
241
+ <div style="font-size: 14px; color: #fff;" data-top="438" data-left="976" data-in="fadeSmallLeft" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="2300" data-time="all">Done with Love</div>
242
+ </li>
243
+ </ul>
244
+ </div>
245
+
246
+ <br />
247
+ <br />
248
+
249
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
250
+ <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
251
+ <script type="text/javascript" src="../js/jquery.crellyslider.js"></script>
252
+
253
+ <script type="text/javascript">
254
+ jQuery(document).ready(function($) {
255
+ $('#demo-1').crellySlider({
256
+ layout : 'full-width',
257
+ automaticSlide : false,
258
+ ignoreElementsEaseOut : false,
259
+ responsive : true,
260
+ beforeStart : function() {console.log('before start')},
261
+ beforeSetResponsive : function() {console.log('before set responsive')},
262
+ beforeSlideStart : function() {console.log(new Date())},
263
+ beforePause : function() {console.log('before pause')},
264
+ beforeResume : function() {console.log('before resume')},
265
+ });
266
+ });
267
+ </script>
268
+
269
+ </body>
270
+
271
  </html>
js/jquery.crellyslider.js CHANGED
@@ -1,212 +1,212 @@
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.2.2
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 executed_slide = false; // Will be true as soon as the current slide is executed
71
- var first_play = true;
72
-
73
- // Slide timer: only current slide. Elements timers: all the elements. This prevents conflicts during changes and pauses
74
- var current_slide_time_timer = new Timer(function() {}, 0);
75
- var elements_times_timers = new Array();
76
- var elements_delays_timers = new Array();
77
-
78
- // The arrays "link" every DOM iframe element to its player element that can interact with APIs
79
- var youtube_videos = {};
80
- var vimeo_videos = {};
81
-
82
- var scale = 1;
83
- 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
84
-
85
- /********************/
86
- /** INITIALIZATION **/
87
- /********************/
88
-
89
- // EVERYTHING BEGINS HERE
90
-
91
- // Load necessary APIs
92
- if(! crellyslider_youtube_api_ready && thereAreVideos('youtube')) {
93
- loadYoutubeAPI();
94
- }
95
- if(! crellyslider_vimeo_api_ready && thereAreVideos('vimeo')) {
96
- loadVimeoAPI();
97
- }
98
-
99
- // 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
100
- if(crellyslider_youtube_api_ready && (typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined')) {
101
- var temp = setInterval(function() {
102
- if(typeof(YT) != 'undefined' && typeof(YT.Player) != 'undefined') {
103
- clearInterval(temp);
104
- init();
105
- }
106
- }, 100);
107
- }
108
- else {
109
- init();
110
- }
111
-
112
- // Returns an array like this: {youtube = true, vimeo = false} if there are YouTube videos but not Vimeo videos
113
- // This function can be called before init()
114
- function thereAreVideos(platform) {
115
- if(platform == 'youtube') {
116
- return SLIDER.find('.cs-yt-iframe').length > 0 ? true : false;
117
- }
118
- if(platform == 'vimeo') {
119
- return SLIDER.find('.cs-vimeo-iframe').length > 0 ? true : false;
120
- }
121
-
122
- return -1;
123
- }
124
-
125
- // The slider constructor: runs automatically only the first time, sets the basic needs of the slider and the preloader then runs Crelly Slider
126
- function init() {
127
- // Add wrappers and classes
128
- SLIDER.wrapInner('<div class="crellyslider" />');
129
- SLIDER.find(CRELLY + ' > ul').addClass('cs-slides');
130
- SLIDER.find(CRELLY + ' ' + SLIDES + ' > li').addClass('cs-slide');
131
-
132
- // Set total_slides
133
- total_slides = getSlides().length;
134
-
135
- // If the slider is empty, stop
136
- if(total_slides == 0) {
137
- return false;
138
- }
139
-
140
- // If there is only a slide, clone it
141
- if(total_slides == 1) {
142
- var clone = getSlide(0);
143
- var prepend = SLIDER.find(CRELLY).find(SLIDES);
144
- clone.clone().prependTo(prepend);
145
- total_slides++;
146
- }
147
-
148
- orderSlides();
149
-
150
- // Show controls (previous and next arrows)
151
- if(settings.showControls) {
152
- SLIDER.find(CRELLY).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>');
153
- }
154
-
155
- // Show navigation
156
- if(settings.showNavigation) {
157
- var nav = '<div class="cs-navigation">';
158
- for(var i = 0; i < total_slides; i++) {
159
- nav += '<span class="cs-slide-link"></span>';
160
- }
161
- nav += '</div>';
162
- SLIDER.find(CRELLY).append(nav);
163
- }
164
-
165
- // Show progress bar
166
- if(settings.showProgressBar) {
167
- SLIDER.find(CRELLY).append('<div class="cs-progress-bar"></div>');
168
- }
169
- else {
170
- SLIDER.find(CRELLY).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>');
171
- }
172
-
173
- // Display slider
174
- SLIDER.css('display', 'block');
175
-
176
- // Set layout for the first time
177
- if(settings.responsive) {
178
- setScale();
179
- }
180
- setLayout();
181
-
182
- // Set slides links
183
- getSlides().find('.cs-background-link')
184
- .html(' ')
185
- .data({
186
- 'left' : 0,
187
- 'top' : 0,
188
- 'in' : 'none',
189
- 'out' : 'none',
190
- 'easeIn' : 0,
191
- 'easeOut' : 0,
192
- 'delay' : 0,
193
- 'time' : 'all',
194
- });
195
-
196
  setPreloader();
197
-
198
- initVideos().done(function() {
199
- // Timeout needed to prevent compatibility issues
200
- var loading = setInterval(function() {
201
- if(document.readyState == 'complete' && SLIDER.find(CRELLY).find('.cs-preloader').length > 0) { // If window.load and preloader is loaded
202
- clearInterval(loading);
203
- loadedWindow();
204
- }
205
- }, 100);
206
- });
207
- }
208
-
209
- // Orders the slides by rearranging them in the DOM
210
  function orderSlides() {
211
  // If randomOrder is disabled and the initial slide is the first, the slides are already ordered
212
  if(! settings.randomOrder && settings.startFromSlide == 0) {
@@ -256,1877 +256,1890 @@ var crellyslider_vimeo_api_ready = false;
256
  for(var i = 0; i < total_slides; i++) {
257
  SLIDER.find(CRELLY).find(SLIDES).append(ordered_slides[i]);
258
  }
259
- }
260
-
261
- // Inits Youtube and Vimeo videos
262
- function initVideos() {
263
- var def = new $.Deferred();
264
- var total_iframes = getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').length;
265
- var loaded_iframes = 0;
266
-
267
- if(total_iframes == 0) {
268
- return def.resolve().promise();
269
- }
270
-
271
- // When iframes are loaded...
272
- getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').each(function() {
273
- var iframe = $(this);
274
-
275
- iframe.one('load', function() {
276
- loaded_iframes++;
277
- if(loaded_iframes == total_iframes) {
278
- // ...init videos
279
- initYoutubeVideos().done(function() {
280
- initVimeoVideos().done(function() {
281
- def.resolve();
282
- });
283
- });
284
- }
285
- })
286
- });
287
-
288
- return def.promise();
289
- }
290
-
291
- // Generates an unique id for each youtube iframe, then links them to a new YouTube player
292
- function initYoutubeVideos() {
293
- var def = new $.Deferred();
294
- var slides = getSlides();
295
- var total_yt_videos = slides.find(ELEMENTS + '.cs-yt-iframe').length;
296
- var loaded_videos = 0;
297
- var temp;
298
-
299
- if(total_yt_videos == 0) {
300
- return def.resolve().promise();
301
- }
302
-
303
- slides.each(function() {
304
- var slide = $(this);
305
- var elements = slide.find(ELEMENTS + '.cs-yt-iframe');
306
-
307
- elements.each(function() {
308
- var element = $(this);
309
-
310
- element.uniqueId();
311
- element.attr('id', 'cs-yt-iframe-' + element.attr('id'));
312
-
313
- var player = new YT.Player(element.attr('id'), {
314
- events: {
315
- 'onReady' : function() {
316
- loaded_videos++;
317
- if(loaded_videos == total_yt_videos) {
318
- def.resolve();
319
- }
320
- },
321
-
322
- 'onStateChange' : function(e) {
323
- if(e.data === YT.PlayerState.ENDED && getItemData(element, 'loop')) {
324
- player.playVideo();
325
- }
326
- },
327
- },
328
- });
329
-
330
- temp = {
331
- player : player,
332
- played_once : false
333
- };
334
-
335
- youtube_videos[element.attr('id')] = temp;
336
- });
337
- });
338
-
339
- return def.promise();
340
- }
341
-
342
- // Generates an unique id for each Vimeo iframe, then links them to a new Vimeo player
343
- function initVimeoVideos() {
344
- var def = new $.Deferred();
345
- var slides = getSlides();
346
- var total_vimeo_videos = slides.find(ELEMENTS + '.cs-vimeo-iframe').length;
347
- var loaded_videos = 0;
348
- var temp;
349
-
350
- if(total_vimeo_videos == 0) {
351
- return def.resolve().promise();
352
- }
353
-
354
- slides.each(function() {
355
- var slide = $(this);
356
- var elements = slide.find(ELEMENTS + '.cs-vimeo-iframe');
357
-
358
- elements.each(function() {
359
- var element = $(this);
360
-
361
- element.uniqueId();
362
- element.attr('id', 'cs-vimeo-iframe-' + element.attr('id'));
363
- element.attr('src', element.attr('src') + '&player_id=' + element.attr('id'));
364
-
365
- var player = $f(element[0]);
366
-
367
- player.addEvent('ready', function() {
368
- player.addEvent('finish', function() {
369
- vimeo_videos[element.attr('id')].ended = true;
370
- });
371
-
372
- player.addEvent('play', function() {
373
- vimeo_videos[element.attr('id')].played_once = true;
374
- vimeo_videos[element.attr('id')].ended = false;
375
- });
376
-
377
- if(getItemData(element, 'loop')) {
378
- player.api('setLoop', true);
379
- }
380
-
381
- loaded_videos++;
382
- if(loaded_videos == total_vimeo_videos) {
383
- def.resolve();
384
- }
385
- });
386
-
387
- temp = {
388
- player : player,
389
- played_once : false,
390
- ended : false,
391
- };
392
-
393
- vimeo_videos[element.attr('id')] = temp;
394
- });
395
- });
396
-
397
- return def.promise();
398
- }
399
-
400
- // Does operations after window.load is complete. Need to do it as a function for back-end compatibility
401
- function loadedWindow() {
402
- // Set layout for the second time
403
- if(settings.responsive) {
404
- setScale();
405
- }
406
- setLayout();
407
-
408
- window_width_before_setResponsive = $(window).width();
409
-
410
- initProperties();
411
-
412
- addListeners();
413
-
414
- unsetPreloader();
415
-
416
- settings.beforeStart();
417
-
418
- // Positions and responsive dimensions then run
419
- if(settings.responsive) {
420
- setResponsive();
421
- }
422
- else {
423
- play();
424
- }
425
- }
426
-
427
- // Stores original slides, elements and elements contents values then hide all the slides and elements. "display: none" only if is an element, not an element content
428
- function initProperties() {
429
- getSlides().each(function() {
430
- var slide = $(this);
431
-
432
- slide.find(ELEMENTS).each(function() {
433
- var element = $(this);
434
-
435
- element.find('*').each(function() {
436
- var element_content = $(this);
437
- setElementDatas(element_content, true);
438
- });
439
-
440
- setElementDatas(element, false);
441
- });
442
-
443
- slide.css('display', 'none');
444
- slide.data('opacity', parseFloat(slide.css('opacity')));
445
- });
446
- }
447
-
448
- // Initializes the element with original values
449
- function setElementDatas(element, is_element_content) {
450
- element.data('width', parseFloat(element.width()));
451
- element.data('height', parseFloat(element.height()));
452
- element.data('letter-spacing', parseFloat(element.css('letter-spacing')));
453
- element.data('font-size', parseFloat(element.css('font-size')));
454
-
455
- if(element.css('line-height').slice(-2).toLowerCase() == 'px') {
456
- element.data('line-height', parseFloat(element.css('line-height')));
457
- }
458
- else {
459
- element.data('line-height', parseFloat(element.css('line-height')) * getItemData(element, 'font-size'));
460
- }
461
-
462
- element.data('padding-top', parseFloat(element.css('padding-top')));
463
- element.data('padding-right', parseFloat(element.css('padding-right')));
464
- element.data('padding-bottom', parseFloat(element.css('padding-bottom')));
465
- element.data('padding-left', parseFloat(element.css('padding-left')));
466
- element.data('opacity', parseFloat(element.css('opacity')));
467
-
468
- if(! is_element_content) {
469
- element.css('display', 'none');
470
- }
471
- }
472
-
473
- // Sets all listeners for the user interaction
474
- function addListeners() {
475
- // Make responsive. Run if resizing horizontally and the slider is not at the right dimension
476
- if(settings.responsive) {
477
- $(window).resize(function() {
478
- if(window_width_before_setResponsive != $(window).width() && ((settings.layout == 'full-width' && getWidth() != $(SLIDER).width()) || ($(SLIDER).width() < getWidth() || (($(SLIDER).width() > getWidth()) && getWidth() < settings.startWidth)))) {
479
- setResponsive();
480
- }
481
- });
482
- }
483
-
484
- // Previous control click
485
- SLIDER.find(CRELLY).find('.cs-controls > .cs-previous').click(function() {
486
- changeSlide(getPreviousSlide());
487
- });
488
-
489
- // Next Control click
490
- SLIDER.find(CRELLY).find('.cs-controls > .cs-next').click(function() {
491
- changeSlide(getNextSlide());
492
- });
493
-
494
- // Swipe and drag
495
- if(settings.enableSwipe) {
496
- SLIDER.find(CRELLY).on('swipeleft', function() {
497
- resume();
498
- changeSlide(getNextSlide());
499
- });
500
-
501
- SLIDER.find(CRELLY).on('swiperight', function() {
502
- resume();
503
- changeSlide(getPreviousSlide());
504
- });
505
- }
506
-
507
- // Navigation link click
508
- SLIDER.find(CRELLY).find('.cs-navigation > .cs-slide-link').click(function() {
509
- changeSlide($(this).index());
510
- });
511
-
512
- // Pause on hover
513
- if(settings.pauseOnHover) {
514
- SLIDER.find(CRELLY).find(SLIDES).hover(function() {
515
- pause();
516
- });
517
-
518
- SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
519
- resume();
520
- });
521
- }
522
- }
523
-
524
- // Hides the unnecessary divs and sets the blurred preloader and the gif spinner
525
- function setPreloader() {
526
- // Setup
527
- SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'hidden');
528
- SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'none');
529
- SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'none');
530
- SLIDER.find(CRELLY).find('.cs-controls').css('display', 'none');
531
-
532
- // Get the URL of the background image of the first slide
533
- var img_url = getSlide(0).css('background-image');
534
- img_url = img_url.replace(/^url\(["']?/, '').replace(/["']?\)$/, '');
535
-
536
- if(! img_url.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)) { // If there isn't a background image
537
- addPreloaderHTML();
538
- }
539
- else {
540
- // When the background image of the first slide is loaded
541
- $('<img>')
542
- .load(function() {
543
- addPreloaderHTML();
544
- })
545
- .attr('src', img_url)
546
- .each(function() {
547
- if(this.complete) {
548
- $(this).load();
549
- }
550
- });
551
- }
552
-
553
- function addPreloaderHTML() {
554
- // Add preloader
555
- SLIDER.find(CRELLY).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>');
556
-
557
- // Set background. Background is set to both the preloader div and the bg div to fix the CSS blur effect
558
- SLIDER.find(CRELLY).find('.cs-preloader').css({
559
- 'background-color' : getSlide(current_slide).css('background-color'),
560
- 'background-image' : getSlide(current_slide).css('background-image'),
561
- 'background-position' : getSlide(current_slide).css('background-position'),
562
- 'background-repeat' : getSlide(current_slide).css('background-repeat'),
563
- 'background-size' : getSlide(current_slide).css('background-size'),
564
- });
565
- SLIDER.find(CRELLY).find('.cs-preloader > .cs-bg').css({
566
- 'background-color' : getSlide(current_slide).css('background-color'),
567
- 'background-image' : getSlide(current_slide).css('background-image'),
568
- 'background-position' : getSlide(current_slide).css('background-position'),
569
- 'background-repeat' : getSlide(current_slide).css('background-repeat'),
570
- 'background-size' : getSlide(current_slide).css('background-size'),
571
- });
572
- }
573
- }
574
-
575
- // Shows the necessary divs and fades out the preloader
576
- function unsetPreloader() {
577
- // Setup
578
- SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'visible');
579
- SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'block');
580
- SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'block');
581
- SLIDER.find(CRELLY).find('.cs-controls').css('display', 'block');
582
-
583
- // Display the first slide to avoid the slide in animation
584
- slideIn(getSlide(0));
585
- getSlide(0).finish();
586
-
587
- // Fade out
588
- SLIDER.find(CRELLY).find('.cs-preloader').animate({
589
- 'opacity' : 0,
590
- }, 300, function() {
591
- SLIDER.find(CRELLY).find('.cs-preloader').remove();
592
- });
593
- }
594
-
595
- /*******************************/
596
- /** LAYOUT AND RESPONSIVENESS **/
597
- /*******************************/
598
-
599
- // Sets slider and slides. Width and height are scaled
600
- function setLayout() {
601
- var layout = settings.layout;
602
- var width, height;
603
-
604
- switch(layout) {
605
- case 'fixed':
606
- width = settings.startWidth;
607
- height = settings.startHeight;
608
- SLIDER.find(CRELLY).css({
609
- 'width' : getScaled(width),
610
- 'height' : getScaled(height),
611
- });
612
- getSlides().css({
613
- 'width' : getScaled(width),
614
- 'height' : getScaled(height),
615
- });
616
- break;
617
-
618
- case 'full-width':
619
- width = SLIDER.width();
620
- height = settings.startHeight;
621
- SLIDER.find(CRELLY).css({
622
- 'width' : width,
623
- 'height' : getScaled(height),
624
- });
625
- getSlides().css({
626
- 'width' : width,
627
- 'height' : getScaled(height),
628
- });
629
- break;
630
- default:
631
- return false;
632
- break;
633
- }
634
- }
635
-
636
- // Returns the element top end left gaps (when the slider is full-width is very useful)
637
- function getLayoutGaps(element) {
638
- var top_gap = (getHeight() - settings.startHeight) / 2;
639
- var left_gap = (getWidth() - settings.startWidth) / 2;
640
-
641
- var new_top = 0;
642
- var new_left = 0;
643
-
644
- if(top_gap > 0) {
645
- new_top = top_gap;
646
- }
647
- if(left_gap > 0) {
648
- new_left = left_gap;
649
- }
650
-
651
- return {
652
- top: new_top,
653
- left: new_left,
654
- };
655
- }
656
-
657
- // Scales every element to make it responsive. It automatically restarts the current slide
658
- function setResponsive() {
659
- settings.beforeSetResponsive();
660
-
661
- var slides = getSlides();
662
-
663
- stop(true);
664
-
665
- slides.each(function() {
666
- var slide = $(this);
667
- var elements = slide.find(ELEMENTS);
668
-
669
- slide.finish();
670
- slideIn(slide);
671
- slide.finish();
672
-
673
- elements.each(function() {
674
- var element = $(this);
675
-
676
- element.finish();
677
- elementIn(element);
678
- element.finish();
679
-
680
- if(isVideo(element)) {
681
- pauseVideo(element);
682
- }
683
- });
684
- });
685
-
686
- setScale();
687
-
688
- setLayout();
689
-
690
- slides.each(function() {
691
- var slide = $(this);
692
- var elements = slide.find(ELEMENTS);
693
-
694
- elements.each(function() {
695
- var element = $(this);
696
-
697
- element.find('*').each(function() {
698
- var element_content = $(this);
699
- scaleElement(element_content);
700
- });
701
-
702
- scaleElement(element);
703
-
704
- element.finish();
705
- elementOut(element);
706
- element.finish();
707
-
708
- if(isVideo(element)) {
709
- pauseVideo(element);
710
- }
711
- });
712
-
713
- slide.finish();
714
- slideOut(slide);
715
- slide.finish();
716
- });
717
-
718
- window_width_before_setResponsive = $(window).width();
719
-
720
- play();
721
- }
722
-
723
- // Scales a text or an image and their contents
724
- function scaleElement(element) {
725
- // Standard element
726
- element.css({
727
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top),
728
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left),
729
- 'padding-top' : getScaled(getItemData(element, 'padding-top')),
730
- 'padding-right' : getScaled(getItemData(element, 'padding-right')),
731
- 'padding-bottom' : getScaled(getItemData(element, 'padding-bottom')),
732
- 'padding-left' : getScaled(getItemData(element, 'padding-left')),
733
- });
734
-
735
- // Element contains text
736
- if(element.is('input') || element.is('button') || element.text().trim().length) {
737
- element.css({
738
- 'line-height' : getScaled(getItemData(element, 'line-height')) + 'px',
739
- 'letter-spacing' : getScaled(getItemData(element, 'letter-spacing')),
740
- 'font-size' : getScaled(getItemData(element, 'font-size')),
741
- });
742
- }
743
-
744
- // Element doesn't contain text (like images or iframes)
745
- else {
746
- element.css({
747
- 'width' : getScaled(getItemData(element, 'width')),
748
- 'height' : getScaled(getItemData(element, 'height')),
749
- });
750
- }
751
- }
752
-
753
- // Using the start dimensions, sets how the slider and it's elements should be scaled
754
- function setScale() {
755
- var slider_width = SLIDER.width();
756
- var start_width = settings.startWidth;
757
-
758
- if(slider_width >= start_width || ! settings.responsive) {
759
- scale = 1;
760
- }
761
- else {
762
- scale = slider_width / start_width;
763
- }
764
- }
765
-
766
- // Using the current scale variable, returns the value that receives correctly scaled. Remember to always use getScaled() to get positions & dimensions of the elements
767
- function getScaled(value) {
768
- return value * scale;
769
- }
770
-
771
- /*********************/
772
- /** SLIDER COMMANDS **/
773
- /*********************/
774
-
775
- // Runs Crelly from the current slide
776
- function play() {
777
- if(settings.automaticSlide) {
778
- loopSlides();
779
- }
780
- else {
781
- executeSlide(current_slide);
782
- }
783
-
784
- first_play = false;
785
- }
786
-
787
- // Stops all the slides and the elements and resets the progress bar
788
- function stop(finish_queues) {
789
- for(var i = 0; i < elements_times_timers.length; i++) {
790
- elements_times_timers[i].clear();
791
- }
792
-
793
- for(var i = 0; i < elements_delays_timers.length; i++) {
794
- elements_delays_timers[i].clear();
795
- }
796
-
797
- current_slide_time_timer.clear();
798
-
799
- getSlides().each(function() {
800
- var temp_slide = $(this);
801
- if(finish_queues) {
802
- temp_slide.finish();
803
- }
804
- else {
805
- temp_slide.stop(true, true);
806
- }
807
- temp_slide.find(ELEMENTS).each(function() {
808
- var temp_element = $(this);
809
- if(finish_queues) {
810
- temp_element.finish();
811
- }
812
- else {
813
- temp_element.stop(true, true);
814
- }
815
- });
816
- });
817
-
818
- resetProgressBar();
819
- }
820
-
821
- // Stops the progress bar and the slide time timer
822
- function pause() {
823
- if(! paused && can_pause) {
824
- settings.beforePause();
825
-
826
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
827
- progress_bar.stop(true);
828
- current_slide_time_timer.pause();
829
-
830
- paused = true;
831
- }
832
- }
833
-
834
- // Animates until the end the progress bar and resumes the current slide time timer
835
- function resume() {
836
- if(paused && can_pause) {
837
- settings.beforeResume();
838
-
839
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
840
- var slide_time = getItemData(getSlide(current_slide), 'time');
841
- var remained_delay = current_slide_time_timer.getRemaining();
842
-
843
- progress_bar.animate({
844
- 'width' : '100%',
845
- }, remained_delay);
846
-
847
- current_slide_time_timer.resume();
848
-
849
- paused = false;
850
- }
851
- }
852
-
853
- /****************************************/
854
- /** SLIDER OR SLIDES DATAS / UTILITIES **/
855
- /****************************************/
856
-
857
- // Returns the Crelly Slider container width
858
- function getWidth() {
859
- return SLIDER.find(CRELLY).width();
860
- }
861
-
862
- // Returns the Crelly Slider container height
863
- function getHeight() {
864
- return SLIDER.find(CRELLY).height();
865
- }
866
-
867
- // Returns the index of the next slide
868
- function getNextSlide() {
869
- if(current_slide + 1 == total_slides) {
870
- return 0;
871
- }
872
- return current_slide + 1;
873
- }
874
-
875
- // Returns the index of the previous slide
876
- function getPreviousSlide() {
877
- if(current_slide - 1 < 0) {
878
- return total_slides - 1;
879
- }
880
- return current_slide - 1;
881
- }
882
-
883
- // 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
884
- function getItemData(item, data) {
885
- var is_slide;
886
-
887
- if(item.parent('ul').hasClass('cs-slides')) {
888
- is_slide = true;
889
- }
890
- else {
891
- is_slide = false;
892
- }
893
-
894
- switch(data) {
895
- case 'ease-in' :
896
- if(is_slide) {
897
- return isNaN(parseInt(item.data(data))) ? settings.slidesEaseIn : parseInt(item.data(data));
898
- }
899
- else {
900
- return isNaN(parseInt(item.data(data))) ? settings.elementsEaseIn : parseInt(item.data(data));
901
- }
902
- break;
903
-
904
- case 'ease-out' :
905
- if(is_slide) {
906
- return isNaN(parseInt(item.data(data))) ? settings.slidesEaseOut : parseInt(item.data(data));
907
- }
908
- else {
909
- return isNaN(parseInt(item.data(data))) ? settings.elementsEaseOut : parseInt(item.data(data));
910
- }
911
- break;
912
-
913
- case 'delay' :
914
- return isNaN(parseInt(item.data(data))) ? settings.elementsDelay : parseInt(item.data(data));
915
-
916
- break;
917
-
918
- case 'time' :
919
- if(is_slide) {
920
- return isNaN(parseInt(item.data(data))) ? settings.slidesTime : parseInt(item.data(data));
921
- }
922
- else {
923
- if(item.data(data) == 'all') {
924
- return 'all';
925
- }
926
- else {
927
- return isNaN(parseInt(item.data(data))) ? settings.itemsTime : parseInt(item.data(data));
928
- }
929
- }
930
- break;
931
-
932
- case 'ignore-ease-out' :
933
- if(parseInt(item.data(data)) == 1) {
934
- return true;
935
- }
936
- else if(parseInt(item.data(data)) == 0) {
937
- return false;
938
- }
939
- return settings.ignoreElementsEaseOut;
940
- break;
941
-
942
- case 'autoplay' :
943
- if(parseInt(item.data(data)) == 1) {
944
- return true;
945
- }
946
- else if(parseInt(item.data(data)) == 0) {
947
- return false;
948
- }
949
- return settings.videoAutoplay;
950
- break;
951
-
952
- case 'loop' :
953
- if(parseInt(item.data(data)) == 1) {
954
- return true;
955
- }
956
- else if(parseInt(item.data(data)) == 0) {
957
- return false;
958
- }
959
- return settings.videoLoop;
960
- break;
961
-
962
- case 'top' :
963
- case 'left' :
964
- case 'width' :
965
- case 'height' :
966
- case 'padding-top' :
967
- case 'padding-right' :
968
- case 'padding-bottom' :
969
- case 'padding-left' :
970
- case 'line-height' :
971
- case 'letter-spacing' :
972
- case 'font-size' :
973
- return isNaN(parseFloat(item.data(data))) ? 0 : parseFloat(item.data(data));
974
- break;
975
-
976
- case 'in' :
977
- case 'out' :
978
- case 'opacity' :
979
- return item.data(data);
980
- break;
981
-
982
- default :
983
- return false;
984
- break;
985
- }
986
- }
987
-
988
- // Returns the slides DOM elements
989
- function getSlides() {
990
- return SLIDER.find(CRELLY).find(SLIDES).find(SLIDE);
991
- }
992
-
993
- // Returns the slide DOM element
994
- function getSlide(slide_index) {
995
- return getSlides().eq(slide_index);
996
- }
997
-
998
- // Timeout with useful methods
999
- function Timer(callback, delay) {
1000
- var id;
1001
- var start;
1002
- var remaining = delay;
1003
-
1004
- this.pause = function() {
1005
- clearTimeout(id);
1006
- remaining -= new Date() - start;
1007
- };
1008
-
1009
- this.resume = function() {
1010
- start = new Date();
1011
- clearTimeout(id);
1012
- id = window.setTimeout(function() {
1013
- callback();
1014
- }, remaining);
1015
- };
1016
-
1017
- this.clear = function () {
1018
- clearTimeout(id);
1019
- };
1020
-
1021
- // For now, works only after this.pause(). No need to calculate in other moments
1022
- this.getRemaining = function() {
1023
- return remaining;
1024
- };
1025
-
1026
- this.resume();
1027
- }
1028
-
1029
- // Returns true if the user is using a mobile browser
1030
- function isMobile() {
1031
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1032
- }
1033
-
1034
- /*****************/
1035
- /** SLIDER CORE **/
1036
- /*****************/
1037
-
1038
- // Loops trough the slides
1039
- function loopSlides() {
1040
- executeSlide(current_slide).done(function() {
1041
- if(! paused) {
1042
- current_slide = getNextSlide();
1043
-
1044
- loopSlides();
1045
- }
1046
- });
1047
- }
1048
-
1049
- // Resets the progress bar and draws the progress bar of the current slide
1050
- function drawProgressBar() {
1051
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1052
-
1053
- resetProgressBar();
1054
-
1055
- progress_bar.animate({
1056
- 'width' : '100%',
1057
- }, getItemData(getSlide(current_slide), 'time'));
1058
- }
1059
-
1060
- // Resets the progress bar animation and CSS
1061
- function resetProgressBar() {
1062
- var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1063
-
1064
- progress_bar.stop();
1065
- progress_bar.css('width', 0);
1066
- }
1067
-
1068
- // Sets the right HTML classes of the navigation links
1069
- function setNavigationLink() {
1070
- var nav = SLIDER.find(CRELLY).find('.cs-navigation');
1071
- var links = nav.find('> .cs-slide-link');
1072
-
1073
- links.each(function() {
1074
- var link = $(this);
1075
-
1076
- if(link.index() == current_slide) {
1077
- link.addClass('cs-active');
1078
- }
1079
- else {
1080
- link.removeClass('cs-active');
1081
- }
1082
- });
1083
- }
1084
-
1085
- // Finishes the current slide (animations out of elements and slide) and then plays the new slide
1086
- function changeSlide(slide_index) {
1087
- if(slide_index == current_slide) {
1088
- return;
1089
- }
1090
-
1091
- if(can_pause || executed_slide) {
1092
- stop(false);
1093
-
1094
- finishSlide(current_slide, false, true).done(function() {
1095
- current_slide = slide_index;
1096
- play();
1097
- });
1098
- }
1099
- }
1100
-
1101
- // Executes a slide completely. If the auto loop is disabled won't animate out the slide and the elements with time == "all"
1102
- function executeSlide(slide_index) {
1103
- settings.beforeSlideStart();
1104
-
1105
- var def = new $.Deferred();
1106
-
1107
- executed_slide = false;
1108
-
1109
- // If something is still animating, reset
1110
- for(var i = 0; i < elements_times_timers.length; i++) {
1111
- elements_times_timers[i].clear();
1112
- }
1113
- for(var i = 0; i < elements_delays_timers.length; i++) {
1114
- elements_delays_timers[i].clear();
1115
- }
1116
- current_slide_time_timer.clear();
1117
- getSlide(slide_index).finish();
1118
- slideOut(slide_index);
1119
- getSlide(slide_index).finish();
1120
- var elements = getSlide(slide_index).find(ELEMENTS);
1121
- elements.each(function() {
1122
- var element = $(this);
1123
- element.finish();
1124
- elementOut(element);
1125
- element.finish();
1126
- });
1127
-
1128
-
1129
- setNavigationLink();
1130
-
1131
- runSlide(slide_index);
1132
-
1133
- if(settings.automaticSlide) {
1134
- finishSlide(slide_index, true, true).done(function() {
1135
- executed_slide = true;
1136
- def.resolve();
1137
- });
1138
- }
1139
- else {
1140
- finishSlide(slide_index, true, false).done(function() {
1141
- executed_slide = true;
1142
- def.resolve();
1143
- });
1144
- }
1145
-
1146
- return def.promise();
1147
- }
1148
-
1149
- // Executes the in animation of the slide and it's elements
1150
- function runSlide(slide_index) {
1151
- var slide = getSlide(slide_index);
1152
- var elements = slide.find(ELEMENTS);
1153
-
1154
- var elements_in_completed = 0;
1155
- var slide_in_completed = false;
1156
-
1157
- var def = new $.Deferred();
1158
-
1159
- can_pause = false;
1160
-
1161
- // Do slide in animation
1162
- slideIn(slide_index).done(function() {
1163
- drawProgressBar();
1164
-
1165
- can_pause = true;
1166
-
1167
- slide_in_completed = true;
1168
- if(slide_in_completed && elements_in_completed == elements.length) {
1169
- def.resolve();
1170
- }
1171
- });
1172
-
1173
- // Do elements in animation
1174
- elements.each(function() {
1175
- var element = $(this);
1176
- var element_delay = getItemData(element, 'delay');
1177
-
1178
- elements_delays_timers.push(new Timer(function() {
1179
- elementIn(element).done(function() {
1180
- if(isVideo(element)) {
1181
- playVideo(element);
1182
- }
1183
-
1184
- elements_in_completed++;
1185
- if(slide_in_completed && elements_in_completed == elements.length) {
1186
- def.resolve();
1187
- }
1188
- });
1189
- }, element_delay));
1190
- });
1191
-
1192
- return def.promise();
1193
- }
1194
-
1195
- // Does all times, elements out animations and slide out animation
1196
- // 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.
1197
- // 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
1198
- function finishSlide(slide_index, execute_time, animate_all_out) {
1199
- var slide = getSlide(slide_index);
1200
- var elements = slide.find(ELEMENTS);
1201
- var data_time = execute_time ? getItemData(slide, 'time') + getItemData(slide, 'ease-in') : 0;
1202
-
1203
- var elements_out_completed = 0;
1204
- var slide_time_completed = false;
1205
-
1206
- var def = new $.Deferred();
1207
-
1208
- // Elements with time != "all"
1209
- elements.each(function() {
1210
- var element = $(this);
1211
- var time = getItemData(element, 'time');
1212
-
1213
- if(time != 'all') {
1214
- var final_element_time = execute_time ? time : 0;
1215
-
1216
- if(getItemData(element, 'ignore-ease-out')) {
1217
- elements_out_completed++;
1218
-
1219
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1220
- pauseVideos(slide_index);
1221
- slideOut(slide_index);
1222
- def.resolve();
1223
- }
1224
- }
1225
-
1226
- elements_times_timers.push(new Timer(function() {
1227
- elementOut(element).done(function() {
1228
- if(! getItemData(element, 'ignore-ease-out')) {
1229
- elements_out_completed++;
1230
-
1231
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1232
- pauseVideos(slide_index);
1233
- slideOut(slide_index);
1234
- def.resolve();
1235
- }
1236
- }
1237
- });
1238
- }, final_element_time));
1239
- }
1240
- });
1241
-
1242
- // Execute slide time
1243
- current_slide_time_timer = new Timer(function() {
1244
- can_pause = false;
1245
-
1246
- resetProgressBar();
1247
-
1248
- slide_time_completed = true;
1249
-
1250
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1251
- pauseVideos(slide_index);
1252
- slideOut(slide_index);
1253
- def.resolve();
1254
- }
1255
-
1256
- if(! animate_all_out) {
1257
- def.resolve();
1258
- }
1259
- else {
1260
- // Elements with time == "all"
1261
- elements.each(function() {
1262
- var element = $(this);
1263
- var time = getItemData(element, 'time');
1264
-
1265
- if(time == 'all') {
1266
- if(getItemData(element, 'ignore-ease-out')) {
1267
- elements_out_completed++;
1268
-
1269
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1270
- pauseVideos(slide_index);
1271
- slideOut(slide_index);
1272
- def.resolve();
1273
- }
1274
- }
1275
-
1276
- elementOut(element).done(function() {
1277
- if(! getItemData(element, 'ignore-ease-out')) {
1278
- elements_out_completed++;
1279
-
1280
- if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1281
- pauseVideos(slide_index);
1282
- slideOut(slide_index);
1283
- def.resolve();
1284
- }
1285
- }
1286
- });
1287
- }
1288
- });
1289
- }
1290
- }, data_time);
1291
-
1292
- return def.promise();
1293
- }
1294
-
1295
- // VIDEOS FUNCTIONS
1296
-
1297
- // Returns true if the element is a YouTube or a Vimeo iframe
1298
- function isVideo(element) {
1299
- return isYoutubeVideo(element) || isVimeoVideo(element);
1300
- }
1301
-
1302
- // Checks what's the source of the video, then plays it
1303
- function playVideo(element) {
1304
- if(isYoutubeVideo(element)) {
1305
- playYoutubeVideo(element);
1306
- }
1307
- else {
1308
- playVimeoVideo(element);
1309
- }
1310
- }
1311
-
1312
- // Pauses all the YouTube and Vimeo videos
1313
- function pauseVideos(slide_index) {
1314
- pauseYoutubeVideos(slide_index);
1315
- pauseVimeoVideos(slide_index);
1316
- }
1317
-
1318
- // Checks what's the source of the video, then pauses it
1319
- function pauseVideo(element) {
1320
- if(isYoutubeVideo(element)) {
1321
- pauseYoutubeVideo(element);
1322
- }
1323
- else {
1324
- pauseVimeoVideo(element);
1325
- }
1326
- }
1327
-
1328
- // Checks if the element is a YouTube video
1329
- function isYoutubeVideo(element) {
1330
- return element.hasClass('cs-yt-iframe');
1331
- }
1332
-
1333
- // Returns the player associated to the element
1334
- function getYoutubePlayer(element) {
1335
- return youtube_videos[element.attr('id')].player;
1336
- }
1337
-
1338
- /*
1339
- Returns:
1340
- -1 – unstarted
1341
- 0 ended
1342
- 1 playing
1343
- 2 – paused
1344
- 3 – buffering
1345
- 5 – video cued
1346
- */
1347
- function getYoutubePlayerState(element) {
1348
- return getYoutubePlayer(element).getPlayerState();
1349
- }
1350
-
1351
- // Checks if the video can be played and plays it
1352
- function playYoutubeVideo(element) {
1353
- // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Youtube's website)
1354
- if(getItemData(element, 'autoplay') && ! youtube_videos[element.attr('id')].played_once && ! isMobile()) {
1355
- getYoutubePlayer(element).playVideo();
1356
- }
1357
-
1358
- // If was paused
1359
- if(getYoutubePlayerState(element) == 2) {
1360
- getYoutubePlayer(element).playVideo();
1361
- }
1362
-
1363
- youtube_videos[element.attr('id')].played_once = true;
1364
- }
1365
-
1366
- // Pause all the videos in a slide
1367
- function pauseYoutubeVideos(slide_index) {
1368
- getSlide(slide_index).each(function() {
1369
- var slide = $(this);
1370
-
1371
- slide.find(ELEMENTS + '.cs-yt-iframe').each(function() {
1372
- pauseYoutubeVideo($(this));
1373
- });
1374
- });
1375
- }
1376
-
1377
- // Checks if the video can be paused and pauses it
1378
- function pauseYoutubeVideo(element) {
1379
- if(getYoutubePlayerState(element) == 1) {
1380
- getYoutubePlayer(element).pauseVideo();
1381
- }
1382
- }
1383
-
1384
- // Checks if the element is a Vimeo video
1385
- function isVimeoVideo(element) {
1386
- return element.hasClass('cs-vimeo-iframe');
1387
- }
1388
-
1389
- // Returns the player associated to the element
1390
- function getVimeoPlayer(element) {
1391
- return vimeo_videos[element.attr('id')].player;
1392
- }
1393
-
1394
- // Plays the video
1395
- function playVimeoVideo(element) {
1396
- // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Vimeo's website)
1397
- if(getItemData(element, 'autoplay') && ! vimeo_videos[element.attr('id')].played_once && ! isMobile()) {
1398
- getVimeoPlayer(element).api('play');
1399
- }
1400
-
1401
- // If was paused
1402
- if(getVimeoPlayer(element).api('paused') && ! vimeo_videos[element.attr('id')].ended && vimeo_videos[element.attr('id')].played_once) {
1403
- getVimeoPlayer(element).api('play');
1404
- }
1405
- }
1406
-
1407
- // Pause all the videos in a slide
1408
- function pauseVimeoVideos(slide_index) {
1409
- getSlide(slide_index).each(function() {
1410
- var slide = $(this);
1411
-
1412
- slide.find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1413
- pauseVimeoVideo($(this));
1414
- });
1415
- });
1416
- }
1417
-
1418
- // Pauses the video
1419
- function pauseVimeoVideo(element) {
1420
- getVimeoPlayer(element).api('pause');
1421
- }
1422
-
1423
- /****************/
1424
- /** ANIMATIONS **/
1425
- /****************/
1426
-
1427
- // WARNING: slideIn and elementIn must reset every CSS propriety to the correct value before starting
1428
-
1429
- // Does slide in animation
1430
- function slideIn(slide_index) {
1431
- var slide = getSlide(slide_index);
1432
- var data_in = getItemData(slide, 'in');
1433
- var data_ease_in = getItemData(slide, 'ease-in');
1434
-
1435
- var def = new $.Deferred();
1436
-
1437
- if(slide.css('display') == 'block') {
1438
- return def.resolve().promise();
1439
- }
1440
-
1441
- // If first play, don't execute the animation
1442
- if(first_play) {
1443
- slide.css({
1444
- 'display' : 'block',
1445
- 'top' : 0,
1446
- 'left' : 0,
1447
- 'opacity' : getItemData(slide, 'opacity'),
1448
- });
1449
- return def.resolve().promise();
1450
- }
1451
-
1452
- switch(data_in) {
1453
- case 'fade' :
1454
- slide.css({
1455
- 'display' : 'block',
1456
- 'top' : 0,
1457
- 'left' : 0,
1458
- 'opacity' : 0,
1459
- });
1460
- slide.animate({
1461
- 'opacity' : getItemData(slide, 'opacity'),
1462
- }, data_ease_in, function() { def.resolve(); });
1463
- break;
1464
-
1465
- case 'fadeLeft' :
1466
- slide.css({
1467
- 'display' : 'block',
1468
- 'top' : 0,
1469
- 'left' : getWidth(),
1470
- 'opacity' : 0,
1471
- });
1472
- slide.animate({
1473
- 'opacity' : getItemData(slide, 'opacity'),
1474
- 'left' : 0,
1475
- }, data_ease_in, function() { def.resolve(); });
1476
- break;
1477
-
1478
- case 'fadeRight' :
1479
- slide.css({
1480
- 'display' : 'block',
1481
- 'top' : 0,
1482
- 'left' : -getWidth(),
1483
- 'opacity' : 0,
1484
- });
1485
- slide.animate({
1486
- 'opacity' : getItemData(slide, 'opacity'),
1487
- 'left' : 0,
1488
- }, data_ease_in, function() { def.resolve(); });
1489
- break;
1490
-
1491
- case 'slideLeft' :
1492
- slide.css({
1493
- 'display' : 'block',
1494
- 'top' : 0,
1495
- 'left' : getWidth(),
1496
- 'opacity' : getItemData(slide, 'opacity'),
1497
- });
1498
- slide.animate({
1499
- 'left' : 0,
1500
- }, data_ease_in, function() { def.resolve(); });
1501
- break;
1502
-
1503
- case 'slideRight' :
1504
- slide.css({
1505
- 'display' : 'block',
1506
- 'top' : 0,
1507
- 'left' : -getWidth(),
1508
- 'opacity' : getItemData(slide, 'opacity'),
1509
- });
1510
- slide.animate({
1511
- 'left' : 0,
1512
- }, data_ease_in, function() { def.resolve(); });
1513
- break;
1514
-
1515
- case 'slideUp' :
1516
- slide.css({
1517
- 'display' : 'block',
1518
- 'top' : getHeight(),
1519
- 'left' : 0,
1520
- 'opacity' : getItemData(slide, 'opacity'),
1521
- });
1522
- slide.animate({
1523
- 'top' : 0,
1524
- }, data_ease_in, function() { def.resolve(); });
1525
- break;
1526
-
1527
- case 'slideDown' :
1528
- slide.css({
1529
- 'display' : 'block',
1530
- 'top' : -getHeight(),
1531
- 'left' : 0,
1532
- 'opacity' : getItemData(slide, 'opacity'),
1533
- });
1534
- slide.animate({
1535
- 'top' : 0,
1536
- }, data_ease_in, function() { def.resolve(); });
1537
- break;
1538
-
1539
- default:
1540
- slide.css({
1541
- 'display' : 'block',
1542
- 'top' : 0,
1543
- 'left' : 0,
1544
- 'opacity' : getItemData(slide, 'opacity'),
1545
- });
1546
- def.resolve();
1547
- break;
1548
- }
1549
-
1550
- return def.promise();
1551
- }
1552
-
1553
- // Does slide out animation
1554
- function slideOut(slide_index) {
1555
- var slide = getSlide(slide_index);
1556
- var data_out = getItemData(slide, 'out');
1557
- var data_ease_out = getItemData(slide, 'ease-out');
1558
-
1559
- var def = new $.Deferred();
1560
-
1561
- if(slide.css('display') == 'none') {
1562
- return def.resolve().promise();
1563
- }
1564
-
1565
- switch(data_out) {
1566
- case 'fade' :
1567
- slide.animate({
1568
- 'opacity' : 0,
1569
- }, data_ease_out,
1570
- function() {
1571
- slide.css({
1572
- 'display' : 'none',
1573
- 'opacity' : getItemData(slide, 'opacity'),
1574
- });
1575
- def.resolve();
1576
- });
1577
- break;
1578
-
1579
- case 'fadeLeft' :
1580
- slide.animate({
1581
- 'opacity' : 0,
1582
- 'left' : -getWidth(),
1583
- }, data_ease_out,
1584
- function() {
1585
- slide.css({
1586
- 'display' : 'none',
1587
- 'opacity' : getItemData(slide, 'opacity'),
1588
- 'left' : 0,
1589
- });
1590
- def.resolve();
1591
- });
1592
- break;
1593
-
1594
- case 'fadeRight' :
1595
- slide.animate({
1596
- 'opacity' : 0,
1597
- 'left' : getWidth(),
1598
- }, data_ease_out,
1599
- function() {
1600
- slide.css({
1601
- 'display' : 'none',
1602
- 'opacity' : getItemData(slide, 'opacity'),
1603
- 'left' : 0,
1604
- });
1605
- def.resolve();
1606
- });
1607
- break;
1608
-
1609
- case 'slideLeft' :
1610
- slide.animate({
1611
- 'left' : -getWidth(),
1612
- }, data_ease_out,
1613
- function() {
1614
- slide.css({
1615
- 'display' : 'none',
1616
- 'left' : 0,
1617
- });
1618
- def.resolve();
1619
- });
1620
- break;
1621
-
1622
- case 'slideRight' :
1623
- slide.animate({
1624
- 'left' : getWidth(),
1625
- }, data_ease_out,
1626
- function() {
1627
- slide.css({
1628
- 'display' : 'none',
1629
- 'left' : 0,
1630
- });
1631
- def.resolve();
1632
- });
1633
- break;
1634
-
1635
- case 'slideUp' :
1636
- slide.animate({
1637
- 'top' : -getHeight(),
1638
- }, data_ease_out,
1639
- function() {
1640
- slide.css({
1641
- 'display' : 'none',
1642
- 'top' : 0,
1643
- });
1644
- def.resolve();
1645
- });
1646
- break;
1647
-
1648
- case 'slideDown' :
1649
- slide.animate({
1650
- 'top' : getHeight(),
1651
- }, data_ease_out,
1652
- function() {
1653
- slide.css({
1654
- 'display' : 'none',
1655
- 'top' : 0,
1656
- });
1657
- def.resolve();
1658
- });
1659
- break;
1660
-
1661
- default :
1662
- slide.css({
1663
- 'display' : 'none',
1664
- });
1665
- def.resolve();
1666
- break;
1667
- }
1668
-
1669
- return def.promise();
1670
- }
1671
-
1672
- // Does element in animation
1673
- function elementIn(element) {
1674
- var element_width = element.outerWidth();
1675
- var element_height = element.outerHeight();
1676
- var data_in = getItemData(element, 'in');
1677
- var data_ease_in = getItemData(element, 'ease-in');
1678
- var data_top = getItemData(element, 'top');
1679
- var data_left = getItemData(element, 'left');
1680
-
1681
- var def = new $.Deferred();
1682
-
1683
- if(element.css('display') == 'block') {
1684
- return def.resolve().promise();
1685
- }
1686
-
1687
- switch(data_in) {
1688
- case 'slideDown' :
1689
- element.css({
1690
- 'display' : 'block',
1691
- 'top' : -element_height,
1692
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1693
- 'opacity' : getItemData(element, 'opacity'),
1694
- }).animate({
1695
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1696
- }, data_ease_in, function() { def.resolve(); });
1697
- break;
1698
-
1699
- case 'slideUp' :
1700
- element.css({
1701
- 'display' : 'block',
1702
- 'top' : getHeight(),
1703
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1704
- 'opacity' : getItemData(element, 'opacity'),
1705
- }).animate({
1706
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1707
- }, data_ease_in, function() { def.resolve(); });
1708
- break;
1709
-
1710
- case 'slideLeft' :
1711
- element.css({
1712
- 'display' : 'block',
1713
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1714
- 'left' : getWidth(),
1715
- 'opacity' : getItemData(element, 'opacity'),
1716
- }).animate({
1717
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1718
- }, data_ease_in, function() { def.resolve(); });
1719
- break;
1720
-
1721
- case 'slideRight' :
1722
- element.css({
1723
- 'display' : 'block',
1724
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1725
- 'left' : -element_width,
1726
- 'opacity' : getItemData(element, 'opacity'),
1727
- }).animate({
1728
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1729
- }, data_ease_in, function() { def.resolve(); });
1730
- break;
1731
-
1732
- case 'fade' :
1733
- element.css({
1734
- 'display' : 'block',
1735
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1736
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1737
- 'opacity' : 0,
1738
- }).animate({
1739
- 'opacity' : getItemData(element, 'opacity'),
1740
- }, data_ease_in, function() { def.resolve(); });
1741
- break;
1742
-
1743
- case 'fadeDown' :
1744
- element.css({
1745
- 'display' : 'block',
1746
- 'top' : -element_height,
1747
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1748
- 'opacity' : 0,
1749
- }).animate({
1750
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1751
- 'opacity' : getItemData(element, 'opacity'),
1752
- }, data_ease_in, function() { def.resolve(); });
1753
- break;
1754
-
1755
- case 'fadeUp' :
1756
- element.css({
1757
- 'display' : 'block',
1758
- 'top' : getHeight(),
1759
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1760
- 'opacity' : 0,
1761
- }).animate({
1762
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1763
- 'opacity' : getItemData(element, 'opacity'),
1764
- }, data_ease_in, function() { def.resolve(); });
1765
- break;
1766
-
1767
- case 'fadeLeft' :
1768
- element.css({
1769
- 'display' : 'block',
1770
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1771
- 'left' : getWidth(),
1772
- 'opacity' : 0,
1773
- }).animate({
1774
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1775
- 'opacity' : getItemData(element, 'opacity'),
1776
- }, data_ease_in, function() { def.resolve(); });
1777
- break;
1778
-
1779
- case 'fadeRight' :
1780
- element.css({
1781
- 'display' : 'block',
1782
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1783
- 'left' : -element_width,
1784
- 'opacity' : 0,
1785
- }).animate({
1786
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1787
- 'opacity' : getItemData(element, 'opacity'),
1788
- }, data_ease_in, function() { def.resolve(); });
1789
- break;
1790
-
1791
- case 'fadeSmallDown' :
1792
- element.css({
1793
- 'display' : 'block',
1794
- 'top' : getScaled(data_top + getLayoutGaps(element).top -30),
1795
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1796
- 'opacity' : 0,
1797
- }).animate({
1798
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1799
- 'opacity' : getItemData(element, 'opacity'),
1800
- }, data_ease_in, function() { def.resolve(); });
1801
- break;
1802
-
1803
- case 'fadeSmallUp' :
1804
- element.css({
1805
- 'display' : 'block',
1806
- 'top' : getScaled(data_top + getLayoutGaps(element).top + 30),
1807
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1808
- 'opacity' : 0,
1809
- }).animate({
1810
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1811
- 'opacity' : getItemData(element, 'opacity'),
1812
- }, data_ease_in, function() { def.resolve(); });
1813
- break;
1814
-
1815
- case 'fadeSmallLeft' :
1816
- element.css({
1817
- 'display' : 'block',
1818
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1819
- 'left' : getScaled(data_left + getLayoutGaps(element).left + 30),
1820
- 'opacity' : 0,
1821
- }).animate({
1822
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1823
- 'opacity' : getItemData(element, 'opacity'),
1824
- }, data_ease_in, function() { def.resolve(); });
1825
- break;
1826
-
1827
- case 'fadeSmallRight' :
1828
- element.css({
1829
- 'display' : 'block',
1830
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1831
- 'left' : getScaled(data_left + getLayoutGaps(element).left - 30),
1832
- 'opacity' : 0,
1833
- }).animate({
1834
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1835
- 'opacity' : getItemData(element, 'opacity'),
1836
- }, data_ease_in, function() { def.resolve(); });
1837
- break;
1838
-
1839
- default :
1840
- element.css({
1841
- 'display' : 'block',
1842
- 'top' : getScaled(data_top + getLayoutGaps(element).top),
1843
- 'left' : getScaled(data_left + getLayoutGaps(element).left),
1844
- 'opacity' : getItemData(element, 'opacity'),
1845
- });
1846
- def.resolve();
1847
- break;
1848
- }
1849
-
1850
- return def.promise();
1851
- }
1852
-
1853
- // Does element out animation
1854
- function elementOut(element) {
1855
- var element_width = element.outerWidth();
1856
- var element_height = element.outerHeight();
1857
- var data_out = getItemData(element, 'out');
1858
- var data_ease_out = getItemData(element, 'ease-out');
1859
-
1860
- var def = new $.Deferred();
1861
-
1862
- if(element.css('display') == 'none') {
1863
- return def.resolve().promise();
1864
- }
1865
-
1866
- switch(data_out) {
1867
- case 'slideDown' :
1868
- element.animate({
1869
- 'top' : getHeight(),
1870
- }, data_ease_out,
1871
- function() {
1872
- element.css({
1873
- 'display' : 'none',
1874
- });
1875
- def.resolve();
1876
- });
1877
- break;
1878
-
1879
- case 'slideUp' :
1880
- element.animate({
1881
- 'top' : - element_height,
1882
- }, data_ease_out,
1883
- function() {
1884
- element.css({
1885
- 'display' : 'none',
1886
- });
1887
- def.resolve();
1888
- });
1889
- break;
1890
-
1891
- case 'slideLeft' :
1892
- element.animate({
1893
- 'left' : - element_width,
1894
- }, data_ease_out,
1895
- function() {
1896
- element.css({
1897
- 'display' : 'none',
1898
- });
1899
- def.resolve();
1900
- });
1901
- break;
1902
-
1903
- case 'slideRight' :
1904
- element.animate({
1905
- 'left' : getWidth(),
1906
- }, data_ease_out,
1907
- function() {
1908
- element.css({
1909
- 'display' : 'none',
1910
- });
1911
- def.resolve();
1912
- });
1913
- break;
1914
-
1915
- case 'fade' :
1916
- element.animate({
1917
- 'opacity' : 0,
1918
- }, data_ease_out,
1919
- function() {
1920
- element.css({
1921
- 'display' : 'none',
1922
- 'opacity' : getItemData(element, 'opacity'),
1923
- });
1924
- def.resolve();
1925
- });
1926
- break;
1927
-
1928
- case 'fadeDown' :
1929
- element.animate({
1930
- 'top' : getHeight(),
1931
- 'opacity' : 0,
1932
- }, data_ease_out,
1933
- function() {
1934
- element.css({
1935
- 'display' : 'none',
1936
- 'opacity' : getItemData(element, 'opacity'),
1937
- });
1938
- def.resolve();
1939
- });
1940
- break;
1941
-
1942
- case 'fadeUp' :
1943
- element.animate({
1944
- 'top' : - element_height,
1945
- 'opacity' : 0,
1946
- }, data_ease_out,
1947
- function() {
1948
- element.css({
1949
- 'display' : 'none',
1950
- 'opacity' : getItemData(element, 'opacity'),
1951
- });
1952
- def.resolve();
1953
- });
1954
- break;
1955
-
1956
- case 'fadeLeft' :
1957
- element.animate({
1958
- 'left' : - element_width,
1959
- 'opacity' : 0,
1960
- }, data_ease_out,
1961
- function() {
1962
- element.css({
1963
- 'display' : 'none',
1964
- 'opacity' : getItemData(element, 'opacity'),
1965
- });
1966
- def.resolve();
1967
- });
1968
- break;
1969
-
1970
- case 'fadeRight' :
1971
- element.animate({
1972
- 'left' : getWidth(),
1973
- 'opacity' : 0,
1974
- }, data_ease_out,
1975
- function() {
1976
- element.css({
1977
- 'display' : 'none',
1978
- 'opacity' : getItemData(element, 'opacity'),
1979
- });
1980
- def.resolve();
1981
- });
1982
- break;
1983
-
1984
- case 'fadeSmallDown' :
1985
- element.animate({
1986
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top + 30),
1987
- 'opacity' : 0,
1988
- }, data_ease_out,
1989
- function() {
1990
- element.css({
1991
- 'display' : 'none',
1992
- 'opacity' : getItemData(element, 'opacity'),
1993
- });
1994
- def.resolve();
1995
- });
1996
- break;
1997
-
1998
- case 'fadeSmallUp' :
1999
- element.animate({
2000
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top - 30),
2001
- 'opacity' : 0,
2002
- }, data_ease_out,
2003
- function() {
2004
- element.css({
2005
- 'display' : 'none',
2006
- 'opacity' : getItemData(element, 'opacity'),
2007
- });
2008
- def.resolve();
2009
- });
2010
- break;
2011
-
2012
- case 'fadeSmallLeft' :
2013
- element.animate({
2014
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left - 30),
2015
- 'opacity' : 0,
2016
- }, data_ease_out,
2017
- function() {
2018
- element.css({
2019
- 'display' : 'none',
2020
- 'opacity' : getItemData(element, 'opacity'),
2021
- });
2022
- def.resolve();
2023
- });
2024
- break;
2025
-
2026
- case 'fadeSmallRight' :
2027
- element.animate({
2028
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left + 30),
2029
- 'opacity' : 0,
2030
- }, data_ease_out,
2031
- function() {
2032
- element.css({
2033
- 'display' : 'none',
2034
- 'opacity' : getItemData(element, 'opacity'),
2035
- });
2036
- def.resolve();
2037
- });
2038
- break;
2039
-
2040
- default :
2041
- element.css({
2042
- 'display' : 'none',
2043
- });
2044
- def.resolve();
2045
- break;
2046
- }
2047
-
2048
- return def.promise();
2049
- }
2050
-
2051
- /**********************/
2052
- /** PUBLIC FUNCTIONS **/
2053
- /**********************/
2054
-
2055
- this.resume = function() {
2056
- resume();
2057
- }
2058
-
2059
- this.pause = function() {
2060
- pause();
2061
- }
2062
-
2063
- this.nextSlide = function() {
2064
- changeSlide(getNextSlide());
2065
- }
2066
-
2067
- this.previousSlide = function() {
2068
- changeSlide(getPreviousSlide());
2069
- }
2070
-
2071
- this.changeSlide = function(slide_index) {
2072
- changeSlide(slide_index);
2073
- }
2074
-
2075
- this.getCurrentSlide = function() {
2076
- return current_slide;
2077
- }
2078
-
2079
- this.getTotalSlides = function() {
2080
- return total_slides;
2081
- }
2082
-
2083
- };
2084
-
2085
- /**************************/
2086
- /** CRELLY SLIDER PLUGIN **/
2087
- /**************************/
2088
-
2089
- $.fn.crellySlider = function(options) {
2090
- var settings = $.extend({
2091
- layout : 'fixed',
2092
- responsive : true,
2093
- startWidth : 1140,
2094
- startHeight : 500,
2095
-
2096
- pauseOnHover : true,
2097
- automaticSlide : true,
2098
- randomOrder : true,
2099
- startFromSlide : 0, // -1 means random, >= 0 means the exact index
2100
- showControls : true,
2101
- showNavigation : true,
2102
- showProgressBar : true,
2103
- enableSwipe : true,
2104
-
2105
- slidesTime : 3000,
2106
- elementsDelay : 0,
2107
- elementsTime : 'all',
2108
- slidesEaseIn : 300,
2109
- elementsEaseIn : 300,
2110
- slidesEaseOut : 300,
2111
- elementsEaseOut : 300,
2112
- ignoreElementsEaseOut : false,
2113
-
2114
- videoAutoplay : false,
2115
- videoLoop : false,
2116
-
2117
- beforeStart : function() {},
2118
- beforeSetResponsive : function() {},
2119
- beforeSlideStart : function() {},
2120
- beforePause : function() {},
2121
- beforeResume : function() {},
2122
- }, options);
2123
-
2124
- return this.each(function() {
2125
- if(undefined == $(this).data('crellySlider')) {
2126
- var plugin = new $.CrellySlider(this, settings);
2127
- $(this).data('crellySlider', plugin);
2128
- }
2129
- });
2130
- };
2131
-
2132
- })(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.2.3
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 executed_slide = false; // Will be true as soon as the current slide is executed
71
+ var first_play = true;
72
+
73
+ // Slide timer: only current slide. Elements timers: all the elements. This prevents conflicts during changes and pauses
74
+ var current_slide_time_timer = new Timer(function() {}, 0);
75
+ var elements_times_timers = new Array();
76
+ var elements_delays_timers = new Array();
77
+
78
+ // The arrays "link" every DOM iframe element to its player element that can interact with APIs
79
+ var youtube_videos = {};
80
+ var vimeo_videos = {};
81
+
82
+ var scale = 1;
83
+ 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
84
+
85
+ /********************/
86
+ /** INITIALIZATION **/
87
+ /********************/
88
+
89
+ // EVERYTHING BEGINS HERE
90
+
91
+ // Load necessary APIs
92
+ if(! crellyslider_youtube_api_ready && thereAreVideos('youtube')) {
93
+ loadYoutubeAPI();
94
+ }
95
+ if(! crellyslider_vimeo_api_ready && thereAreVideos('vimeo')) {
96
+ loadVimeoAPI();
97
+ }
98
+
99
+ // 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
100
+ if(crellyslider_youtube_api_ready && (typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined')) {
101
+ var temp = setInterval(function() {
102
+ if(typeof(YT) != 'undefined' && typeof(YT.Player) != 'undefined') {
103
+ clearInterval(temp);
104
+ init();
105
+ }
106
+ }, 100);
107
+ }
108
+ else {
109
+ init();
110
+ }
111
+
112
+ // Returns an array like this: {youtube = true, vimeo = false} if there are YouTube videos but not Vimeo videos
113
+ // This function can be called before init()
114
+ function thereAreVideos(platform) {
115
+ if(platform == 'youtube') {
116
+ return SLIDER.find('.cs-yt-iframe').length > 0 ? true : false;
117
+ }
118
+ if(platform == 'vimeo') {
119
+ return SLIDER.find('.cs-vimeo-iframe').length > 0 ? true : false;
120
+ }
121
+
122
+ return -1;
123
+ }
124
+
125
+ // The slider constructor: runs automatically only the first time, sets the basic needs of the slider and the preloader then runs Crelly Slider
126
+ function init() {
127
+ // Add wrappers and classes
128
+ SLIDER.wrapInner('<div class="crellyslider" />');
129
+ SLIDER.find(CRELLY + ' > ul').addClass('cs-slides');
130
+ SLIDER.find(CRELLY + ' ' + SLIDES + ' > li').addClass('cs-slide');
131
+
132
+ // Set total_slides
133
+ total_slides = getSlides().length;
134
+
135
+ // If the slider is empty, stop
136
+ if(total_slides == 0) {
137
+ return false;
138
+ }
139
+
140
+ // If there is only a slide, clone it
141
+ if(total_slides == 1) {
142
+ var clone = getSlide(0);
143
+ var prepend = SLIDER.find(CRELLY).find(SLIDES);
144
+ clone.clone().prependTo(prepend);
145
+ total_slides++;
146
+ }
147
+
148
+ orderSlides();
149
+
150
+ // Show controls (previous and next arrows)
151
+ if(settings.showControls) {
152
+ SLIDER.find(CRELLY).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>');
153
+ }
154
+
155
+ // Show navigation
156
+ if(settings.showNavigation) {
157
+ var nav = '<div class="cs-navigation">';
158
+ for(var i = 0; i < total_slides; i++) {
159
+ nav += '<span class="cs-slide-link"></span>';
160
+ }
161
+ nav += '</div>';
162
+ SLIDER.find(CRELLY).append(nav);
163
+ }
164
+
165
+ // Show progress bar
166
+ if(settings.showProgressBar) {
167
+ SLIDER.find(CRELLY).append('<div class="cs-progress-bar"></div>');
168
+ }
169
+ else {
170
+ SLIDER.find(CRELLY).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>');
171
+ }
172
+
173
+ // Display slider
174
+ SLIDER.css('display', 'block');
175
+
176
+ // Set layout for the first time
177
+ if(settings.responsive) {
178
+ setScale();
179
+ }
180
+ setLayout();
181
+
182
+ // Set slides links
183
+ getSlides().find('.cs-background-link')
184
+ .html(' ')
185
+ .data({
186
+ 'left' : 0,
187
+ 'top' : 0,
188
+ 'in' : 'none',
189
+ 'out' : 'none',
190
+ 'easeIn' : 0,
191
+ 'easeOut' : 0,
192
+ 'delay' : 0,
193
+ 'time' : 'all',
194
+ });
195
+
196
  setPreloader();
197
+
198
+ initVideos().done(function() {
199
+ // Timeout needed to prevent compatibility issues
200
+ var loading = setInterval(function() {
201
+ if(document.readyState == 'complete' && SLIDER.find(CRELLY).find('.cs-preloader').length > 0) { // If window.load and preloader is loaded
202
+ clearInterval(loading);
203
+ loadedWindow();
204
+ }
205
+ }, 100);
206
+ });
207
+ }
208
+
209
+ // Orders the slides by rearranging them in the DOM
210
  function orderSlides() {
211
  // If randomOrder is disabled and the initial slide is the first, the slides are already ordered
212
  if(! settings.randomOrder && settings.startFromSlide == 0) {
256
  for(var i = 0; i < total_slides; i++) {
257
  SLIDER.find(CRELLY).find(SLIDES).append(ordered_slides[i]);
258
  }
259
+ }
260
+
261
+ // Inits Youtube and Vimeo videos
262
+ function initVideos() {
263
+ var def = new $.Deferred();
264
+ var total_iframes = getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').length;
265
+ var loaded_iframes = 0;
266
+
267
+ if(total_iframes == 0) {
268
+ return def.resolve().promise();
269
+ }
270
+
271
+ // When iframes are loaded...
272
+ getSlides().find('.cs-yt-iframe, .cs-vimeo-iframe').each(function() {
273
+ var iframe = $(this);
274
+
275
+ iframe.one('load', function() {
276
+ loaded_iframes++;
277
+ if(loaded_iframes == total_iframes) {
278
+ // ...init videos
279
+ initYoutubeVideos().done(function() {
280
+ initVimeoVideos().done(function() {
281
+ def.resolve();
282
+ });
283
+ });
284
+ }
285
+ })
286
+ });
287
+
288
+ return def.promise();
289
+ }
290
+
291
+ // Generates an unique id for each youtube iframe, then links them to a new YouTube player
292
+ function initYoutubeVideos() {
293
+ var def = new $.Deferred();
294
+ var slides = getSlides();
295
+ var total_yt_videos = slides.find(ELEMENTS + '.cs-yt-iframe').length;
296
+ var loaded_videos = 0;
297
+ var temp;
298
+
299
+ if(total_yt_videos == 0) {
300
+ return def.resolve().promise();
301
+ }
302
+
303
+ slides.each(function() {
304
+ var slide = $(this);
305
+ var elements = slide.find(ELEMENTS + '.cs-yt-iframe');
306
+
307
+ elements.each(function() {
308
+ var element = $(this);
309
+
310
+ element.uniqueId();
311
+ element.attr('id', 'cs-yt-iframe-' + element.attr('id'));
312
+
313
+ var player = new YT.Player(element.attr('id'), {
314
+ events: {
315
+ 'onReady' : function() {
316
+ loaded_videos++;
317
+ if(loaded_videos == total_yt_videos) {
318
+ def.resolve();
319
+ }
320
+ },
321
+
322
+ 'onStateChange' : function(e) {
323
+ if(e.data === YT.PlayerState.ENDED && getItemData(element, 'loop')) {
324
+ player.playVideo();
325
+ }
326
+ },
327
+ },
328
+ });
329
+
330
+ temp = {
331
+ player : player,
332
+ played_once : false
333
+ };
334
+
335
+ youtube_videos[element.attr('id')] = temp;
336
+ });
337
+ });
338
+
339
+ return def.promise();
340
+ }
341
+
342
+ // Generates an unique id for each Vimeo iframe, then links them to a new Vimeo player
343
+ function initVimeoVideos() {
344
+ var def = new $.Deferred();
345
+ var slides = getSlides();
346
+ var total_vimeo_videos = slides.find(ELEMENTS + '.cs-vimeo-iframe').length;
347
+ var loaded_videos = 0;
348
+ var temp;
349
+
350
+ if(total_vimeo_videos == 0) {
351
+ return def.resolve().promise();
352
+ }
353
+
354
+ slides.each(function() {
355
+ var slide = $(this);
356
+ var elements = slide.find(ELEMENTS + '.cs-vimeo-iframe');
357
+
358
+ elements.each(function() {
359
+ var element = $(this);
360
+
361
+ element.uniqueId();
362
+ element.attr('id', 'cs-vimeo-iframe-' + element.attr('id'));
363
+ element.attr('src', element.attr('src') + '&player_id=' + element.attr('id'));
364
+
365
+ var player = $f(element[0]);
366
+
367
+ player.addEvent('ready', function() {
368
+ player.addEvent('finish', function() {
369
+ vimeo_videos[element.attr('id')].ended = true;
370
+ });
371
+
372
+ player.addEvent('play', function() {
373
+ vimeo_videos[element.attr('id')].played_once = true;
374
+ vimeo_videos[element.attr('id')].ended = false;
375
+ });
376
+
377
+ if(getItemData(element, 'loop')) {
378
+ player.api('setLoop', true);
379
+ }
380
+
381
+ loaded_videos++;
382
+ if(loaded_videos == total_vimeo_videos) {
383
+ def.resolve();
384
+ }
385
+ });
386
+
387
+ temp = {
388
+ player : player,
389
+ played_once : false,
390
+ ended : false,
391
+ };
392
+
393
+ vimeo_videos[element.attr('id')] = temp;
394
+ });
395
+ });
396
+
397
+ return def.promise();
398
+ }
399
+
400
+ // Does operations after window.load is complete. Need to do it as a function for back-end compatibility
401
+ function loadedWindow() {
402
+ // Set layout for the second time
403
+ if(settings.responsive) {
404
+ setScale();
405
+ }
406
+ setLayout();
407
+
408
+ window_width_before_setResponsive = $(window).width();
409
+
410
+ initProperties();
411
+
412
+ addListeners();
413
+
414
+ unsetPreloader();
415
+
416
+ settings.beforeStart();
417
+
418
+ // Positions and responsive dimensions then run
419
+ if(settings.responsive) {
420
+ setResponsive();
421
+ }
422
+ else {
423
+ play();
424
+ }
425
+ }
426
+
427
+ // Stores original slides, elements and elements contents values then hide all the slides and elements. "display: none" only if is an element, not an element content
428
+ function initProperties() {
429
+ getSlides().each(function() {
430
+ var slide = $(this);
431
+
432
+ slide.find(ELEMENTS).each(function() {
433
+ var element = $(this);
434
+
435
+ // Clone the element and get its real properties (avoids width and height = 0). Then replace the original element
436
+ var clone = element.clone();
437
+ clone.css('visibility', 'hidden');
438
+ $('body').append(clone);
439
+
440
+ clone.find('*').each(function() {
441
+ var element_content = $(this);
442
+ setElementData(element_content, true);
443
+ });
444
+
445
+ setElementData(clone, false);
446
+ clone.css('display', 'none');
447
+ clone.css('visibility', 'visible');
448
+
449
+ clone.insertAfter(element);
450
+ element.remove();
451
+ });
452
+
453
+ slide.css('display', 'none');
454
+ slide.data('opacity', parseFloat(slide.css('opacity')));
455
+ });
456
+ }
457
+
458
+ // Initializes the element with original values
459
+ function setElementData(element, is_element_content) {
460
+ element.data('width', parseFloat(element.width()));
461
+ element.data('height', parseFloat(element.height()));
462
+ element.data('letter-spacing', parseFloat(element.css('letter-spacing')));
463
+ element.data('font-size', parseFloat(element.css('font-size')));
464
+
465
+ if(element.css('line-height').slice(-2).toLowerCase() == 'px') {
466
+ element.data('line-height', parseFloat(element.css('line-height')));
467
+ }
468
+ else {
469
+ element.data('line-height', parseFloat(element.css('line-height')) * getItemData(element, 'font-size'));
470
+ }
471
+
472
+ element.data('padding-top', parseFloat(element.css('padding-top')));
473
+ element.data('padding-right', parseFloat(element.css('padding-right')));
474
+ element.data('padding-bottom', parseFloat(element.css('padding-bottom')));
475
+ element.data('padding-left', parseFloat(element.css('padding-left')));
476
+ element.data('opacity', parseFloat(element.css('opacity')));
477
+ }
478
+
479
+ // Sets all listeners for the user interaction
480
+ function addListeners() {
481
+ // Make responsive. Run if resizing horizontally and the slider is not at the right dimension
482
+ if(settings.responsive) {
483
+ $(window).resize(function() {
484
+ if(window_width_before_setResponsive != $(window).width() && ((settings.layout == 'full-width' && getWidth() != $(SLIDER).width()) || ($(SLIDER).width() < getWidth() || (($(SLIDER).width() > getWidth()) && getWidth() < settings.startWidth)))) {
485
+ setResponsive();
486
+ }
487
+ });
488
+ }
489
+
490
+ // Compatibility with Popup Maker (https://wordpress.org/plugins/popup-maker/)
491
+ /*$(document).on('pumAfterOpen', '.pum', function() {
492
+ if($(this).find(CRELLY).length > 0) {
493
+ setResponsive();
494
+ }
495
+ });*/
496
+
497
+ // Previous control click
498
+ SLIDER.find(CRELLY).find('.cs-controls > .cs-previous').click(function() {
499
+ changeSlide(getPreviousSlide());
500
+ });
501
+
502
+ // Next Control click
503
+ SLIDER.find(CRELLY).find('.cs-controls > .cs-next').click(function() {
504
+ changeSlide(getNextSlide());
505
+ });
506
+
507
+ // Swipe and drag
508
+ if(settings.enableSwipe) {
509
+ SLIDER.find(CRELLY).on('swipeleft', function() {
510
+ resume();
511
+ changeSlide(getNextSlide());
512
+ });
513
+
514
+ SLIDER.find(CRELLY).on('swiperight', function() {
515
+ resume();
516
+ changeSlide(getPreviousSlide());
517
+ });
518
+ }
519
+
520
+ // Navigation link click
521
+ SLIDER.find(CRELLY).find('.cs-navigation > .cs-slide-link').click(function() {
522
+ changeSlide($(this).index());
523
+ });
524
+
525
+ // Pause on hover
526
+ if(settings.pauseOnHover) {
527
+ SLIDER.find(CRELLY).find(SLIDES).hover(function() {
528
+ pause();
529
+ });
530
+
531
+ SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
532
+ resume();
533
+ });
534
+ }
535
+ }
536
+
537
+ // Hides the unnecessary divs and sets the blurred preloader and the gif spinner
538
+ function setPreloader() {
539
+ // Setup
540
+ SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'hidden');
541
+ SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'none');
542
+ SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'none');
543
+ SLIDER.find(CRELLY).find('.cs-controls').css('display', 'none');
544
+
545
+ // Get the URL of the background image of the first slide
546
+ var img_url = getSlide(0).css('background-image');
547
+ img_url = img_url.replace(/^url\(["']?/, '').replace(/["']?\)$/, '');
548
+
549
+ if(! img_url.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)) { // If there isn't a background image
550
+ addPreloaderHTML();
551
+ }
552
+ else {
553
+ // When the background image of the first slide is loaded
554
+ $('<img>')
555
+ .load(function() {
556
+ addPreloaderHTML();
557
+ })
558
+ .attr('src', img_url)
559
+ .each(function() {
560
+ if(this.complete) {
561
+ $(this).load();
562
+ }
563
+ });
564
+ }
565
+
566
+ function addPreloaderHTML() {
567
+ // Add preloader
568
+ SLIDER.find(CRELLY).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>');
569
+
570
+ // Set background. Background is set to both the preloader div and the bg div to fix the CSS blur effect
571
+ SLIDER.find(CRELLY).find('.cs-preloader').css({
572
+ 'background-color' : getSlide(current_slide).css('background-color'),
573
+ 'background-image' : getSlide(current_slide).css('background-image'),
574
+ 'background-position' : getSlide(current_slide).css('background-position'),
575
+ 'background-repeat' : getSlide(current_slide).css('background-repeat'),
576
+ 'background-size' : getSlide(current_slide).css('background-size'),
577
+ });
578
+ SLIDER.find(CRELLY).find('.cs-preloader > .cs-bg').css({
579
+ 'background-color' : getSlide(current_slide).css('background-color'),
580
+ 'background-image' : getSlide(current_slide).css('background-image'),
581
+ 'background-position' : getSlide(current_slide).css('background-position'),
582
+ 'background-repeat' : getSlide(current_slide).css('background-repeat'),
583
+ 'background-size' : getSlide(current_slide).css('background-size'),
584
+ });
585
+ }
586
+ }
587
+
588
+ // Shows the necessary divs and fades out the preloader
589
+ function unsetPreloader() {
590
+ // Setup
591
+ SLIDER.find(CRELLY).find(SLIDES).css('visibility', 'visible');
592
+ SLIDER.find(CRELLY).find('.cs-progress-bar').css('display', 'block');
593
+ SLIDER.find(CRELLY).find('.cs-navigation').css('display', 'block');
594
+ SLIDER.find(CRELLY).find('.cs-controls').css('display', 'block');
595
+
596
+ // Display the first slide to avoid the slide in animation
597
+ slideIn(getSlide(0));
598
+ getSlide(0).finish();
599
+
600
+ // Fade out
601
+ SLIDER.find(CRELLY).find('.cs-preloader').animate({
602
+ 'opacity' : 0,
603
+ }, 300, function() {
604
+ SLIDER.find(CRELLY).find('.cs-preloader').remove();
605
+ });
606
+ }
607
+
608
+ /*******************************/
609
+ /** LAYOUT AND RESPONSIVENESS **/
610
+ /*******************************/
611
+
612
+ // Sets slider and slides. Width and height are scaled
613
+ function setLayout() {
614
+ var layout = settings.layout;
615
+ var width, height;
616
+
617
+ switch(layout) {
618
+ case 'fixed':
619
+ width = settings.startWidth;
620
+ height = settings.startHeight;
621
+ SLIDER.find(CRELLY).css({
622
+ 'width' : getScaled(width),
623
+ 'height' : getScaled(height),
624
+ });
625
+ getSlides().css({
626
+ 'width' : getScaled(width),
627
+ 'height' : getScaled(height),
628
+ });
629
+ break;
630
+
631
+ case 'full-width':
632
+ width = SLIDER.width();
633
+ height = settings.startHeight;
634
+ SLIDER.find(CRELLY).css({
635
+ 'width' : width,
636
+ 'height' : getScaled(height),
637
+ });
638
+ getSlides().css({
639
+ 'width' : width,
640
+ 'height' : getScaled(height),
641
+ });
642
+ break;
643
+ default:
644
+ return false;
645
+ break;
646
+ }
647
+ }
648
+
649
+ // Returns the element top end left gaps (when the slider is full-width is very useful)
650
+ function getLayoutGaps(element) {
651
+ var top_gap = (getHeight() - settings.startHeight) / 2;
652
+ var left_gap = (getWidth() - settings.startWidth) / 2;
653
+
654
+ var new_top = 0;
655
+ var new_left = 0;
656
+
657
+ if(top_gap > 0) {
658
+ new_top = top_gap;
659
+ }
660
+ if(left_gap > 0) {
661
+ new_left = left_gap;
662
+ }
663
+
664
+ return {
665
+ top: new_top,
666
+ left: new_left,
667
+ };
668
+ }
669
+
670
+ // Scales every element to make it responsive. It automatically restarts the current slide
671
+ function setResponsive() {
672
+ settings.beforeSetResponsive();
673
+
674
+ var slides = getSlides();
675
+
676
+ stop(true);
677
+
678
+ slides.each(function() {
679
+ var slide = $(this);
680
+ var elements = slide.find(ELEMENTS);
681
+
682
+ slide.finish();
683
+ slideIn(slide);
684
+ slide.finish();
685
+
686
+ elements.each(function() {
687
+ var element = $(this);
688
+
689
+ element.finish();
690
+ elementIn(element);
691
+ element.finish();
692
+
693
+ if(isVideo(element)) {
694
+ pauseVideo(element);
695
+ }
696
+ });
697
+ });
698
+
699
+ setScale();
700
+
701
+ setLayout();
702
+
703
+ slides.each(function() {
704
+ var slide = $(this);
705
+ var elements = slide.find(ELEMENTS);
706
+
707
+ elements.each(function() {
708
+ var element = $(this);
709
+
710
+ element.find('*').each(function() {
711
+ var element_content = $(this);
712
+ scaleElement(element_content);
713
+ });
714
+
715
+ scaleElement(element);
716
+
717
+ element.finish();
718
+ elementOut(element);
719
+ element.finish();
720
+
721
+ if(isVideo(element)) {
722
+ pauseVideo(element);
723
+ }
724
+ });
725
+
726
+ slide.finish();
727
+ slideOut(slide);
728
+ slide.finish();
729
+ });
730
+
731
+ window_width_before_setResponsive = $(window).width();
732
+
733
+ play();
734
+ }
735
+
736
+ // Scales a text or an image and their contents
737
+ function scaleElement(element) {
738
+ // Standard element
739
+ element.css({
740
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top),
741
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left),
742
+ 'padding-top' : getScaled(getItemData(element, 'padding-top')),
743
+ 'padding-right' : getScaled(getItemData(element, 'padding-right')),
744
+ 'padding-bottom' : getScaled(getItemData(element, 'padding-bottom')),
745
+ 'padding-left' : getScaled(getItemData(element, 'padding-left')),
746
+ });
747
+
748
+ // Element contains text
749
+ if(element.is('input') || element.is('button') || element.text().trim().length) {
750
+ element.css({
751
+ 'line-height' : getScaled(getItemData(element, 'line-height')) + 'px',
752
+ 'letter-spacing' : getScaled(getItemData(element, 'letter-spacing')),
753
+ 'font-size' : getScaled(getItemData(element, 'font-size')),
754
+ });
755
+ }
756
+
757
+ // Element doesn't contain text (like images or iframes)
758
+ else {
759
+ element.css({
760
+ 'width' : getScaled(getItemData(element, 'width')),
761
+ 'height' : getScaled(getItemData(element, 'height')),
762
+ });
763
+ }
764
+ }
765
+
766
+ // Using the start dimensions, sets how the slider and it's elements should be scaled
767
+ function setScale() {
768
+ var slider_width = SLIDER.width();
769
+ var start_width = settings.startWidth;
770
+
771
+ if(slider_width >= start_width || ! settings.responsive) {
772
+ scale = 1;
773
+ }
774
+ else {
775
+ scale = slider_width / start_width;
776
+ }
777
+ }
778
+
779
+ // Using the current scale variable, returns the value that receives correctly scaled. Remember to always use getScaled() to get positions & dimensions of the elements
780
+ function getScaled(value) {
781
+ return value * scale;
782
+ }
783
+
784
+ /*********************/
785
+ /** SLIDER COMMANDS **/
786
+ /*********************/
787
+
788
+ // Runs Crelly from the current slide
789
+ function play() {
790
+ if(settings.automaticSlide) {
791
+ loopSlides();
792
+ }
793
+ else {
794
+ executeSlide(current_slide);
795
+ }
796
+
797
+ first_play = false;
798
+ }
799
+
800
+ // Stops all the slides and the elements and resets the progress bar
801
+ function stop(finish_queues) {
802
+ for(var i = 0; i < elements_times_timers.length; i++) {
803
+ elements_times_timers[i].clear();
804
+ }
805
+
806
+ for(var i = 0; i < elements_delays_timers.length; i++) {
807
+ elements_delays_timers[i].clear();
808
+ }
809
+
810
+ current_slide_time_timer.clear();
811
+
812
+ getSlides().each(function() {
813
+ var temp_slide = $(this);
814
+ if(finish_queues) {
815
+ temp_slide.finish();
816
+ }
817
+ else {
818
+ temp_slide.stop(true, true);
819
+ }
820
+ temp_slide.find(ELEMENTS).each(function() {
821
+ var temp_element = $(this);
822
+ if(finish_queues) {
823
+ temp_element.finish();
824
+ }
825
+ else {
826
+ temp_element.stop(true, true);
827
+ }
828
+ });
829
+ });
830
+
831
+ resetProgressBar();
832
+ }
833
+
834
+ // Stops the progress bar and the slide time timer
835
+ function pause() {
836
+ if(! paused && can_pause) {
837
+ settings.beforePause();
838
+
839
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
840
+ progress_bar.stop(true);
841
+ current_slide_time_timer.pause();
842
+
843
+ paused = true;
844
+ }
845
+ }
846
+
847
+ // Animates until the end the progress bar and resumes the current slide time timer
848
+ function resume() {
849
+ if(paused && can_pause) {
850
+ settings.beforeResume();
851
+
852
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
853
+ var slide_time = getItemData(getSlide(current_slide), 'time');
854
+ var remained_delay = current_slide_time_timer.getRemaining();
855
+
856
+ progress_bar.animate({
857
+ 'width' : '100%',
858
+ }, remained_delay);
859
+
860
+ current_slide_time_timer.resume();
861
+
862
+ paused = false;
863
+ }
864
+ }
865
+
866
+ /****************************************/
867
+ /** SLIDER OR SLIDES DATAS / UTILITIES **/
868
+ /****************************************/
869
+
870
+ // Returns the Crelly Slider container width
871
+ function getWidth() {
872
+ return SLIDER.find(CRELLY).width();
873
+ }
874
+
875
+ // Returns the Crelly Slider container height
876
+ function getHeight() {
877
+ return SLIDER.find(CRELLY).height();
878
+ }
879
+
880
+ // Returns the index of the next slide
881
+ function getNextSlide() {
882
+ if(current_slide + 1 == total_slides) {
883
+ return 0;
884
+ }
885
+ return current_slide + 1;
886
+ }
887
+
888
+ // Returns the index of the previous slide
889
+ function getPreviousSlide() {
890
+ if(current_slide - 1 < 0) {
891
+ return total_slides - 1;
892
+ }
893
+ return current_slide - 1;
894
+ }
895
+
896
+ // 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
897
+ function getItemData(item, data) {
898
+ var is_slide;
899
+
900
+ if(item.parent('ul').hasClass('cs-slides')) {
901
+ is_slide = true;
902
+ }
903
+ else {
904
+ is_slide = false;
905
+ }
906
+
907
+ switch(data) {
908
+ case 'ease-in' :
909
+ if(is_slide) {
910
+ return isNaN(parseInt(item.data(data))) ? settings.slidesEaseIn : parseInt(item.data(data));
911
+ }
912
+ else {
913
+ return isNaN(parseInt(item.data(data))) ? settings.elementsEaseIn : parseInt(item.data(data));
914
+ }
915
+ break;
916
+
917
+ case 'ease-out' :
918
+ if(is_slide) {
919
+ return isNaN(parseInt(item.data(data))) ? settings.slidesEaseOut : parseInt(item.data(data));
920
+ }
921
+ else {
922
+ return isNaN(parseInt(item.data(data))) ? settings.elementsEaseOut : parseInt(item.data(data));
923
+ }
924
+ break;
925
+
926
+ case 'delay' :
927
+ return isNaN(parseInt(item.data(data))) ? settings.elementsDelay : parseInt(item.data(data));
928
+
929
+ break;
930
+
931
+ case 'time' :
932
+ if(is_slide) {
933
+ return isNaN(parseInt(item.data(data))) ? settings.slidesTime : parseInt(item.data(data));
934
+ }
935
+ else {
936
+ if(item.data(data) == 'all') {
937
+ return 'all';
938
+ }
939
+ else {
940
+ return isNaN(parseInt(item.data(data))) ? settings.itemsTime : parseInt(item.data(data));
941
+ }
942
+ }
943
+ break;
944
+
945
+ case 'ignore-ease-out' :
946
+ if(parseInt(item.data(data)) == 1) {
947
+ return true;
948
+ }
949
+ else if(parseInt(item.data(data)) == 0) {
950
+ return false;
951
+ }
952
+ return settings.ignoreElementsEaseOut;
953
+ break;
954
+
955
+ case 'autoplay' :
956
+ if(parseInt(item.data(data)) == 1) {
957
+ return true;
958
+ }
959
+ else if(parseInt(item.data(data)) == 0) {
960
+ return false;
961
+ }
962
+ return settings.videoAutoplay;
963
+ break;
964
+
965
+ case 'loop' :
966
+ if(parseInt(item.data(data)) == 1) {
967
+ return true;
968
+ }
969
+ else if(parseInt(item.data(data)) == 0) {
970
+ return false;
971
+ }
972
+ return settings.videoLoop;
973
+ break;
974
+
975
+ case 'top' :
976
+ case 'left' :
977
+ case 'width' :
978
+ case 'height' :
979
+ case 'padding-top' :
980
+ case 'padding-right' :
981
+ case 'padding-bottom' :
982
+ case 'padding-left' :
983
+ case 'line-height' :
984
+ case 'letter-spacing' :
985
+ case 'font-size' :
986
+ return isNaN(parseFloat(item.data(data))) ? 0 : parseFloat(item.data(data));
987
+ break;
988
+
989
+ case 'in' :
990
+ case 'out' :
991
+ case 'opacity' :
992
+ return item.data(data);
993
+ break;
994
+
995
+ default :
996
+ return false;
997
+ break;
998
+ }
999
+ }
1000
+
1001
+ // Returns the slides DOM elements
1002
+ function getSlides() {
1003
+ return SLIDER.find(CRELLY).find(SLIDES).find(SLIDE);
1004
+ }
1005
+
1006
+ // Returns the slide DOM element
1007
+ function getSlide(slide_index) {
1008
+ return getSlides().eq(slide_index);
1009
+ }
1010
+
1011
+ // Timeout with useful methods
1012
+ function Timer(callback, delay) {
1013
+ var id;
1014
+ var start;
1015
+ var remaining = delay;
1016
+
1017
+ this.pause = function() {
1018
+ clearTimeout(id);
1019
+ remaining -= new Date() - start;
1020
+ };
1021
+
1022
+ this.resume = function() {
1023
+ start = new Date();
1024
+ clearTimeout(id);
1025
+ id = window.setTimeout(function() {
1026
+ callback();
1027
+ }, remaining);
1028
+ };
1029
+
1030
+ this.clear = function () {
1031
+ clearTimeout(id);
1032
+ };
1033
+
1034
+ // For now, works only after this.pause(). No need to calculate in other moments
1035
+ this.getRemaining = function() {
1036
+ return remaining;
1037
+ };
1038
+
1039
+ this.resume();
1040
+ }
1041
+
1042
+ // Returns true if the user is using a mobile browser
1043
+ function isMobile() {
1044
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1045
+ }
1046
+
1047
+ /*****************/
1048
+ /** SLIDER CORE **/
1049
+ /*****************/
1050
+
1051
+ // Loops trough the slides
1052
+ function loopSlides() {
1053
+ executeSlide(current_slide).done(function() {
1054
+ if(! paused) {
1055
+ current_slide = getNextSlide();
1056
+
1057
+ loopSlides();
1058
+ }
1059
+ });
1060
+ }
1061
+
1062
+ // Resets the progress bar and draws the progress bar of the current slide
1063
+ function drawProgressBar() {
1064
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1065
+
1066
+ resetProgressBar();
1067
+
1068
+ progress_bar.animate({
1069
+ 'width' : '100%',
1070
+ }, getItemData(getSlide(current_slide), 'time'));
1071
+ }
1072
+
1073
+ // Resets the progress bar animation and CSS
1074
+ function resetProgressBar() {
1075
+ var progress_bar = SLIDER.find(CRELLY).find('.cs-progress-bar');
1076
+
1077
+ progress_bar.stop();
1078
+ progress_bar.css('width', 0);
1079
+ }
1080
+
1081
+ // Sets the right HTML classes of the navigation links
1082
+ function setNavigationLink() {
1083
+ var nav = SLIDER.find(CRELLY).find('.cs-navigation');
1084
+ var links = nav.find('> .cs-slide-link');
1085
+
1086
+ links.each(function() {
1087
+ var link = $(this);
1088
+
1089
+ if(link.index() == current_slide) {
1090
+ link.addClass('cs-active');
1091
+ }
1092
+ else {
1093
+ link.removeClass('cs-active');
1094
+ }
1095
+ });
1096
+ }
1097
+
1098
+ // Finishes the current slide (animations out of elements and slide) and then plays the new slide
1099
+ function changeSlide(slide_index) {
1100
+ if(slide_index == current_slide) {
1101
+ return;
1102
+ }
1103
+
1104
+ if(can_pause || executed_slide) {
1105
+ stop(false);
1106
+
1107
+ finishSlide(current_slide, false, true).done(function() {
1108
+ current_slide = slide_index;
1109
+ play();
1110
+ });
1111
+ }
1112
+ }
1113
+
1114
+ // Executes a slide completely. If the auto loop is disabled won't animate out the slide and the elements with time == "all"
1115
+ function executeSlide(slide_index) {
1116
+ settings.beforeSlideStart();
1117
+
1118
+ var def = new $.Deferred();
1119
+
1120
+ executed_slide = false;
1121
+
1122
+ // If something is still animating, reset
1123
+ for(var i = 0; i < elements_times_timers.length; i++) {
1124
+ elements_times_timers[i].clear();
1125
+ }
1126
+ for(var i = 0; i < elements_delays_timers.length; i++) {
1127
+ elements_delays_timers[i].clear();
1128
+ }
1129
+ current_slide_time_timer.clear();
1130
+ getSlide(slide_index).finish();
1131
+ slideOut(slide_index);
1132
+ getSlide(slide_index).finish();
1133
+ var elements = getSlide(slide_index).find(ELEMENTS);
1134
+ elements.each(function() {
1135
+ var element = $(this);
1136
+ element.finish();
1137
+ elementOut(element);
1138
+ element.finish();
1139
+ });
1140
+
1141
+
1142
+ setNavigationLink();
1143
+
1144
+ runSlide(slide_index);
1145
+
1146
+ if(settings.automaticSlide) {
1147
+ finishSlide(slide_index, true, true).done(function() {
1148
+ executed_slide = true;
1149
+ def.resolve();
1150
+ });
1151
+ }
1152
+ else {
1153
+ finishSlide(slide_index, true, false).done(function() {
1154
+ executed_slide = true;
1155
+ def.resolve();
1156
+ });
1157
+ }
1158
+
1159
+ return def.promise();
1160
+ }
1161
+
1162
+ // Executes the in animation of the slide and it's elements
1163
+ function runSlide(slide_index) {
1164
+ var slide = getSlide(slide_index);
1165
+ var elements = slide.find(ELEMENTS);
1166
+
1167
+ var elements_in_completed = 0;
1168
+ var slide_in_completed = false;
1169
+
1170
+ var def = new $.Deferred();
1171
+
1172
+ can_pause = false;
1173
+
1174
+ // Do slide in animation
1175
+ slideIn(slide_index).done(function() {
1176
+ drawProgressBar();
1177
+
1178
+ can_pause = true;
1179
+
1180
+ slide_in_completed = true;
1181
+ if(slide_in_completed && elements_in_completed == elements.length) {
1182
+ def.resolve();
1183
+ }
1184
+ });
1185
+
1186
+ // Do elements in animation
1187
+ elements.each(function() {
1188
+ var element = $(this);
1189
+ var element_delay = getItemData(element, 'delay');
1190
+
1191
+ elements_delays_timers.push(new Timer(function() {
1192
+ elementIn(element).done(function() {
1193
+ if(isVideo(element)) {
1194
+ playVideo(element);
1195
+ }
1196
+
1197
+ elements_in_completed++;
1198
+ if(slide_in_completed && elements_in_completed == elements.length) {
1199
+ def.resolve();
1200
+ }
1201
+ });
1202
+ }, element_delay));
1203
+ });
1204
+
1205
+ return def.promise();
1206
+ }
1207
+
1208
+ // Does all times, elements out animations and slide out animation
1209
+ // 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.
1210
+ // 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
1211
+ function finishSlide(slide_index, execute_time, animate_all_out) {
1212
+ var slide = getSlide(slide_index);
1213
+ var elements = slide.find(ELEMENTS);
1214
+ var data_time = execute_time ? getItemData(slide, 'time') + getItemData(slide, 'ease-in') : 0;
1215
+
1216
+ var elements_out_completed = 0;
1217
+ var slide_time_completed = false;
1218
+
1219
+ var def = new $.Deferred();
1220
+
1221
+ // Elements with time != "all"
1222
+ elements.each(function() {
1223
+ var element = $(this);
1224
+ var time = getItemData(element, 'time');
1225
+
1226
+ if(time != 'all') {
1227
+ var final_element_time = execute_time ? time : 0;
1228
+
1229
+ if(getItemData(element, 'ignore-ease-out')) {
1230
+ elements_out_completed++;
1231
+
1232
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1233
+ pauseVideos(slide_index);
1234
+ slideOut(slide_index);
1235
+ def.resolve();
1236
+ }
1237
+ }
1238
+
1239
+ elements_times_timers.push(new Timer(function() {
1240
+ elementOut(element).done(function() {
1241
+ if(! getItemData(element, 'ignore-ease-out')) {
1242
+ elements_out_completed++;
1243
+
1244
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1245
+ pauseVideos(slide_index);
1246
+ slideOut(slide_index);
1247
+ def.resolve();
1248
+ }
1249
+ }
1250
+ });
1251
+ }, final_element_time));
1252
+ }
1253
+ });
1254
+
1255
+ // Execute slide time
1256
+ current_slide_time_timer = new Timer(function() {
1257
+ can_pause = false;
1258
+
1259
+ resetProgressBar();
1260
+
1261
+ slide_time_completed = true;
1262
+
1263
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1264
+ pauseVideos(slide_index);
1265
+ slideOut(slide_index);
1266
+ def.resolve();
1267
+ }
1268
+
1269
+ if(! animate_all_out) {
1270
+ def.resolve();
1271
+ }
1272
+ else {
1273
+ // Elements with time == "all"
1274
+ elements.each(function() {
1275
+ var element = $(this);
1276
+ var time = getItemData(element, 'time');
1277
+
1278
+ if(time == 'all') {
1279
+ if(getItemData(element, 'ignore-ease-out')) {
1280
+ elements_out_completed++;
1281
+
1282
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1283
+ pauseVideos(slide_index);
1284
+ slideOut(slide_index);
1285
+ def.resolve();
1286
+ }
1287
+ }
1288
+
1289
+ elementOut(element).done(function() {
1290
+ if(! getItemData(element, 'ignore-ease-out')) {
1291
+ elements_out_completed++;
1292
+
1293
+ if(elements.length == elements_out_completed && slide_time_completed && animate_all_out) {
1294
+ pauseVideos(slide_index);
1295
+ slideOut(slide_index);
1296
+ def.resolve();
1297
+ }
1298
+ }
1299
+ });
1300
+ }
1301
+ });
1302
+ }
1303
+ }, data_time);
1304
+
1305
+ return def.promise();
1306
+ }
1307
+
1308
+ // VIDEOS FUNCTIONS
1309
+
1310
+ // Returns true if the element is a YouTube or a Vimeo iframe
1311
+ function isVideo(element) {
1312
+ return isYoutubeVideo(element) || isVimeoVideo(element);
1313
+ }
1314
+
1315
+ // Checks what's the source of the video, then plays it
1316
+ function playVideo(element) {
1317
+ if(isYoutubeVideo(element)) {
1318
+ playYoutubeVideo(element);
1319
+ }
1320
+ else {
1321
+ playVimeoVideo(element);
1322
+ }
1323
+ }
1324
+
1325
+ // Pauses all the YouTube and Vimeo videos
1326
+ function pauseVideos(slide_index) {
1327
+ pauseYoutubeVideos(slide_index);
1328
+ pauseVimeoVideos(slide_index);
1329
+ }
1330
+
1331
+ // Checks what's the source of the video, then pauses it
1332
+ function pauseVideo(element) {
1333
+ if(isYoutubeVideo(element)) {
1334
+ pauseYoutubeVideo(element);
1335
+ }
1336
+ else {
1337
+ pauseVimeoVideo(element);
1338
+ }
1339
+ }
1340
+
1341
+ // Checks if the element is a YouTube video
1342
+ function isYoutubeVideo(element) {
1343
+ return element.hasClass('cs-yt-iframe');
1344
+ }
1345
+
1346
+ // Returns the player associated to the element
1347
+ function getYoutubePlayer(element) {
1348
+ return youtube_videos[element.attr('id')].player;
1349
+ }
1350
+
1351
+ /*
1352
+ Returns:
1353
+ -1 unstarted
1354
+ 0 ended
1355
+ 1 – playing
1356
+ 2 – paused
1357
+ 3 – buffering
1358
+ 5 video cued
1359
+ */
1360
+ function getYoutubePlayerState(element) {
1361
+ return getYoutubePlayer(element).getPlayerState();
1362
+ }
1363
+
1364
+ // Checks if the video can be played and plays it
1365
+ function playYoutubeVideo(element) {
1366
+ // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Youtube's website)
1367
+ if(getItemData(element, 'autoplay') && ! youtube_videos[element.attr('id')].played_once && ! isMobile()) {
1368
+ getYoutubePlayer(element).playVideo();
1369
+ }
1370
+
1371
+ // If was paused
1372
+ if(getYoutubePlayerState(element) == 2) {
1373
+ getYoutubePlayer(element).playVideo();
1374
+ }
1375
+
1376
+ youtube_videos[element.attr('id')].played_once = true;
1377
+ }
1378
+
1379
+ // Pause all the videos in a slide
1380
+ function pauseYoutubeVideos(slide_index) {
1381
+ getSlide(slide_index).each(function() {
1382
+ var slide = $(this);
1383
+
1384
+ slide.find(ELEMENTS + '.cs-yt-iframe').each(function() {
1385
+ pauseYoutubeVideo($(this));
1386
+ });
1387
+ });
1388
+ }
1389
+
1390
+ // Checks if the video can be paused and pauses it
1391
+ function pauseYoutubeVideo(element) {
1392
+ if(getYoutubePlayerState(element) == 1) {
1393
+ getYoutubePlayer(element).pauseVideo();
1394
+ }
1395
+ }
1396
+
1397
+ // Checks if the element is a Vimeo video
1398
+ function isVimeoVideo(element) {
1399
+ return element.hasClass('cs-vimeo-iframe');
1400
+ }
1401
+
1402
+ // Returns the player associated to the element
1403
+ function getVimeoPlayer(element) {
1404
+ return vimeo_videos[element.attr('id')].player;
1405
+ }
1406
+
1407
+ // Plays the video
1408
+ function playVimeoVideo(element) {
1409
+ // If autplay and first slide loop. Disabled on mobile for compatibility reasons (details on the Vimeo's website)
1410
+ if(getItemData(element, 'autoplay') && ! vimeo_videos[element.attr('id')].played_once && ! isMobile()) {
1411
+ getVimeoPlayer(element).api('play');
1412
+ }
1413
+
1414
+ // If was paused
1415
+ if(getVimeoPlayer(element).api('paused') && ! vimeo_videos[element.attr('id')].ended && vimeo_videos[element.attr('id')].played_once) {
1416
+ getVimeoPlayer(element).api('play');
1417
+ }
1418
+ }
1419
+
1420
+ // Pause all the videos in a slide
1421
+ function pauseVimeoVideos(slide_index) {
1422
+ getSlide(slide_index).each(function() {
1423
+ var slide = $(this);
1424
+
1425
+ slide.find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1426
+ pauseVimeoVideo($(this));
1427
+ });
1428
+ });
1429
+ }
1430
+
1431
+ // Pauses the video
1432
+ function pauseVimeoVideo(element) {
1433
+ getVimeoPlayer(element).api('pause');
1434
+ }
1435
+
1436
+ /****************/
1437
+ /** ANIMATIONS **/
1438
+ /****************/
1439
+
1440
+ // WARNING: slideIn and elementIn must reset every CSS propriety to the correct value before starting
1441
+
1442
+ // Does slide in animation
1443
+ function slideIn(slide_index) {
1444
+ var slide = getSlide(slide_index);
1445
+ var data_in = getItemData(slide, 'in');
1446
+ var data_ease_in = getItemData(slide, 'ease-in');
1447
+
1448
+ var def = new $.Deferred();
1449
+
1450
+ if(slide.css('display') == 'block') {
1451
+ return def.resolve().promise();
1452
+ }
1453
+
1454
+ // If first play, don't execute the animation
1455
+ if(first_play) {
1456
+ slide.css({
1457
+ 'display' : 'block',
1458
+ 'top' : 0,
1459
+ 'left' : 0,
1460
+ 'opacity' : getItemData(slide, 'opacity'),
1461
+ });
1462
+ return def.resolve().promise();
1463
+ }
1464
+
1465
+ switch(data_in) {
1466
+ case 'fade' :
1467
+ slide.css({
1468
+ 'display' : 'block',
1469
+ 'top' : 0,
1470
+ 'left' : 0,
1471
+ 'opacity' : 0,
1472
+ });
1473
+ slide.animate({
1474
+ 'opacity' : getItemData(slide, 'opacity'),
1475
+ }, data_ease_in, function() { def.resolve(); });
1476
+ break;
1477
+
1478
+ case 'fadeLeft' :
1479
+ slide.css({
1480
+ 'display' : 'block',
1481
+ 'top' : 0,
1482
+ 'left' : getWidth(),
1483
+ 'opacity' : 0,
1484
+ });
1485
+ slide.animate({
1486
+ 'opacity' : getItemData(slide, 'opacity'),
1487
+ 'left' : 0,
1488
+ }, data_ease_in, function() { def.resolve(); });
1489
+ break;
1490
+
1491
+ case 'fadeRight' :
1492
+ slide.css({
1493
+ 'display' : 'block',
1494
+ 'top' : 0,
1495
+ 'left' : -getWidth(),
1496
+ 'opacity' : 0,
1497
+ });
1498
+ slide.animate({
1499
+ 'opacity' : getItemData(slide, 'opacity'),
1500
+ 'left' : 0,
1501
+ }, data_ease_in, function() { def.resolve(); });
1502
+ break;
1503
+
1504
+ case 'slideLeft' :
1505
+ slide.css({
1506
+ 'display' : 'block',
1507
+ 'top' : 0,
1508
+ 'left' : getWidth(),
1509
+ 'opacity' : getItemData(slide, 'opacity'),
1510
+ });
1511
+ slide.animate({
1512
+ 'left' : 0,
1513
+ }, data_ease_in, function() { def.resolve(); });
1514
+ break;
1515
+
1516
+ case 'slideRight' :
1517
+ slide.css({
1518
+ 'display' : 'block',
1519
+ 'top' : 0,
1520
+ 'left' : -getWidth(),
1521
+ 'opacity' : getItemData(slide, 'opacity'),
1522
+ });
1523
+ slide.animate({
1524
+ 'left' : 0,
1525
+ }, data_ease_in, function() { def.resolve(); });
1526
+ break;
1527
+
1528
+ case 'slideUp' :
1529
+ slide.css({
1530
+ 'display' : 'block',
1531
+ 'top' : getHeight(),
1532
+ 'left' : 0,
1533
+ 'opacity' : getItemData(slide, 'opacity'),
1534
+ });
1535
+ slide.animate({
1536
+ 'top' : 0,
1537
+ }, data_ease_in, function() { def.resolve(); });
1538
+ break;
1539
+
1540
+ case 'slideDown' :
1541
+ slide.css({
1542
+ 'display' : 'block',
1543
+ 'top' : -getHeight(),
1544
+ 'left' : 0,
1545
+ 'opacity' : getItemData(slide, 'opacity'),
1546
+ });
1547
+ slide.animate({
1548
+ 'top' : 0,
1549
+ }, data_ease_in, function() { def.resolve(); });
1550
+ break;
1551
+
1552
+ default:
1553
+ slide.css({
1554
+ 'display' : 'block',
1555
+ 'top' : 0,
1556
+ 'left' : 0,
1557
+ 'opacity' : getItemData(slide, 'opacity'),
1558
+ });
1559
+ def.resolve();
1560
+ break;
1561
+ }
1562
+
1563
+ return def.promise();
1564
+ }
1565
+
1566
+ // Does slide out animation
1567
+ function slideOut(slide_index) {
1568
+ var slide = getSlide(slide_index);
1569
+ var data_out = getItemData(slide, 'out');
1570
+ var data_ease_out = getItemData(slide, 'ease-out');
1571
+
1572
+ var def = new $.Deferred();
1573
+
1574
+ if(slide.css('display') == 'none') {
1575
+ return def.resolve().promise();
1576
+ }
1577
+
1578
+ switch(data_out) {
1579
+ case 'fade' :
1580
+ slide.animate({
1581
+ 'opacity' : 0,
1582
+ }, data_ease_out,
1583
+ function() {
1584
+ slide.css({
1585
+ 'display' : 'none',
1586
+ 'opacity' : getItemData(slide, 'opacity'),
1587
+ });
1588
+ def.resolve();
1589
+ });
1590
+ break;
1591
+
1592
+ case 'fadeLeft' :
1593
+ slide.animate({
1594
+ 'opacity' : 0,
1595
+ 'left' : -getWidth(),
1596
+ }, data_ease_out,
1597
+ function() {
1598
+ slide.css({
1599
+ 'display' : 'none',
1600
+ 'opacity' : getItemData(slide, 'opacity'),
1601
+ 'left' : 0,
1602
+ });
1603
+ def.resolve();
1604
+ });
1605
+ break;
1606
+
1607
+ case 'fadeRight' :
1608
+ slide.animate({
1609
+ 'opacity' : 0,
1610
+ 'left' : getWidth(),
1611
+ }, data_ease_out,
1612
+ function() {
1613
+ slide.css({
1614
+ 'display' : 'none',
1615
+ 'opacity' : getItemData(slide, 'opacity'),
1616
+ 'left' : 0,
1617
+ });
1618
+ def.resolve();
1619
+ });
1620
+ break;
1621
+
1622
+ case 'slideLeft' :
1623
+ slide.animate({
1624
+ 'left' : -getWidth(),
1625
+ }, data_ease_out,
1626
+ function() {
1627
+ slide.css({
1628
+ 'display' : 'none',
1629
+ 'left' : 0,
1630
+ });
1631
+ def.resolve();
1632
+ });
1633
+ break;
1634
+
1635
+ case 'slideRight' :
1636
+ slide.animate({
1637
+ 'left' : getWidth(),
1638
+ }, data_ease_out,
1639
+ function() {
1640
+ slide.css({
1641
+ 'display' : 'none',
1642
+ 'left' : 0,
1643
+ });
1644
+ def.resolve();
1645
+ });
1646
+ break;
1647
+
1648
+ case 'slideUp' :
1649
+ slide.animate({
1650
+ 'top' : -getHeight(),
1651
+ }, data_ease_out,
1652
+ function() {
1653
+ slide.css({
1654
+ 'display' : 'none',
1655
+ 'top' : 0,
1656
+ });
1657
+ def.resolve();
1658
+ });
1659
+ break;
1660
+
1661
+ case 'slideDown' :
1662
+ slide.animate({
1663
+ 'top' : getHeight(),
1664
+ }, data_ease_out,
1665
+ function() {
1666
+ slide.css({
1667
+ 'display' : 'none',
1668
+ 'top' : 0,
1669
+ });
1670
+ def.resolve();
1671
+ });
1672
+ break;
1673
+
1674
+ default :
1675
+ slide.css({
1676
+ 'display' : 'none',
1677
+ });
1678
+ def.resolve();
1679
+ break;
1680
+ }
1681
+
1682
+ return def.promise();
1683
+ }
1684
+
1685
+ // Does element in animation
1686
+ function elementIn(element) {
1687
+ var element_width = element.outerWidth();
1688
+ var element_height = element.outerHeight();
1689
+ var data_in = getItemData(element, 'in');
1690
+ var data_ease_in = getItemData(element, 'ease-in');
1691
+ var data_top = getItemData(element, 'top');
1692
+ var data_left = getItemData(element, 'left');
1693
+
1694
+ var def = new $.Deferred();
1695
+
1696
+ if(element.css('display') == 'block') {
1697
+ return def.resolve().promise();
1698
+ }
1699
+
1700
+ switch(data_in) {
1701
+ case 'slideDown' :
1702
+ element.css({
1703
+ 'display' : 'block',
1704
+ 'top' : -element_height,
1705
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1706
+ 'opacity' : getItemData(element, 'opacity'),
1707
+ }).animate({
1708
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1709
+ }, data_ease_in, function() { def.resolve(); });
1710
+ break;
1711
+
1712
+ case 'slideUp' :
1713
+ element.css({
1714
+ 'display' : 'block',
1715
+ 'top' : getHeight(),
1716
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1717
+ 'opacity' : getItemData(element, 'opacity'),
1718
+ }).animate({
1719
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1720
+ }, data_ease_in, function() { def.resolve(); });
1721
+ break;
1722
+
1723
+ case 'slideLeft' :
1724
+ element.css({
1725
+ 'display' : 'block',
1726
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1727
+ 'left' : getWidth(),
1728
+ 'opacity' : getItemData(element, 'opacity'),
1729
+ }).animate({
1730
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1731
+ }, data_ease_in, function() { def.resolve(); });
1732
+ break;
1733
+
1734
+ case 'slideRight' :
1735
+ element.css({
1736
+ 'display' : 'block',
1737
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1738
+ 'left' : -element_width,
1739
+ 'opacity' : getItemData(element, 'opacity'),
1740
+ }).animate({
1741
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1742
+ }, data_ease_in, function() { def.resolve(); });
1743
+ break;
1744
+
1745
+ case 'fade' :
1746
+ element.css({
1747
+ 'display' : 'block',
1748
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1749
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1750
+ 'opacity' : 0,
1751
+ }).animate({
1752
+ 'opacity' : getItemData(element, 'opacity'),
1753
+ }, data_ease_in, function() { def.resolve(); });
1754
+ break;
1755
+
1756
+ case 'fadeDown' :
1757
+ element.css({
1758
+ 'display' : 'block',
1759
+ 'top' : -element_height,
1760
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1761
+ 'opacity' : 0,
1762
+ }).animate({
1763
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1764
+ 'opacity' : getItemData(element, 'opacity'),
1765
+ }, data_ease_in, function() { def.resolve(); });
1766
+ break;
1767
+
1768
+ case 'fadeUp' :
1769
+ element.css({
1770
+ 'display' : 'block',
1771
+ 'top' : getHeight(),
1772
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1773
+ 'opacity' : 0,
1774
+ }).animate({
1775
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1776
+ 'opacity' : getItemData(element, 'opacity'),
1777
+ }, data_ease_in, function() { def.resolve(); });
1778
+ break;
1779
+
1780
+ case 'fadeLeft' :
1781
+ element.css({
1782
+ 'display' : 'block',
1783
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1784
+ 'left' : getWidth(),
1785
+ 'opacity' : 0,
1786
+ }).animate({
1787
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1788
+ 'opacity' : getItemData(element, 'opacity'),
1789
+ }, data_ease_in, function() { def.resolve(); });
1790
+ break;
1791
+
1792
+ case 'fadeRight' :
1793
+ element.css({
1794
+ 'display' : 'block',
1795
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1796
+ 'left' : -element_width,
1797
+ 'opacity' : 0,
1798
+ }).animate({
1799
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1800
+ 'opacity' : getItemData(element, 'opacity'),
1801
+ }, data_ease_in, function() { def.resolve(); });
1802
+ break;
1803
+
1804
+ case 'fadeSmallDown' :
1805
+ element.css({
1806
+ 'display' : 'block',
1807
+ 'top' : getScaled(data_top + getLayoutGaps(element).top -30),
1808
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1809
+ 'opacity' : 0,
1810
+ }).animate({
1811
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1812
+ 'opacity' : getItemData(element, 'opacity'),
1813
+ }, data_ease_in, function() { def.resolve(); });
1814
+ break;
1815
+
1816
+ case 'fadeSmallUp' :
1817
+ element.css({
1818
+ 'display' : 'block',
1819
+ 'top' : getScaled(data_top + getLayoutGaps(element).top + 30),
1820
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1821
+ 'opacity' : 0,
1822
+ }).animate({
1823
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1824
+ 'opacity' : getItemData(element, 'opacity'),
1825
+ }, data_ease_in, function() { def.resolve(); });
1826
+ break;
1827
+
1828
+ case 'fadeSmallLeft' :
1829
+ element.css({
1830
+ 'display' : 'block',
1831
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1832
+ 'left' : getScaled(data_left + getLayoutGaps(element).left + 30),
1833
+ 'opacity' : 0,
1834
+ }).animate({
1835
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1836
+ 'opacity' : getItemData(element, 'opacity'),
1837
+ }, data_ease_in, function() { def.resolve(); });
1838
+ break;
1839
+
1840
+ case 'fadeSmallRight' :
1841
+ element.css({
1842
+ 'display' : 'block',
1843
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1844
+ 'left' : getScaled(data_left + getLayoutGaps(element).left - 30),
1845
+ 'opacity' : 0,
1846
+ }).animate({
1847
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1848
+ 'opacity' : getItemData(element, 'opacity'),
1849
+ }, data_ease_in, function() { def.resolve(); });
1850
+ break;
1851
+
1852
+ default :
1853
+ element.css({
1854
+ 'display' : 'block',
1855
+ 'top' : getScaled(data_top + getLayoutGaps(element).top),
1856
+ 'left' : getScaled(data_left + getLayoutGaps(element).left),
1857
+ 'opacity' : getItemData(element, 'opacity'),
1858
+ });
1859
+ def.resolve();
1860
+ break;
1861
+ }
1862
+
1863
+ return def.promise();
1864
+ }
1865
+
1866
+ // Does element out animation
1867
+ function elementOut(element) {
1868
+ var element_width = element.outerWidth();
1869
+ var element_height = element.outerHeight();
1870
+ var data_out = getItemData(element, 'out');
1871
+ var data_ease_out = getItemData(element, 'ease-out');
1872
+
1873
+ var def = new $.Deferred();
1874
+
1875
+ if(element.css('display') == 'none') {
1876
+ return def.resolve().promise();
1877
+ }
1878
+
1879
+ switch(data_out) {
1880
+ case 'slideDown' :
1881
+ element.animate({
1882
+ 'top' : getHeight(),
1883
+ }, data_ease_out,
1884
+ function() {
1885
+ element.css({
1886
+ 'display' : 'none',
1887
+ });
1888
+ def.resolve();
1889
+ });
1890
+ break;
1891
+
1892
+ case 'slideUp' :
1893
+ element.animate({
1894
+ 'top' : - element_height,
1895
+ }, data_ease_out,
1896
+ function() {
1897
+ element.css({
1898
+ 'display' : 'none',
1899
+ });
1900
+ def.resolve();
1901
+ });
1902
+ break;
1903
+
1904
+ case 'slideLeft' :
1905
+ element.animate({
1906
+ 'left' : - element_width,
1907
+ }, data_ease_out,
1908
+ function() {
1909
+ element.css({
1910
+ 'display' : 'none',
1911
+ });
1912
+ def.resolve();
1913
+ });
1914
+ break;
1915
+
1916
+ case 'slideRight' :
1917
+ element.animate({
1918
+ 'left' : getWidth(),
1919
+ }, data_ease_out,
1920
+ function() {
1921
+ element.css({
1922
+ 'display' : 'none',
1923
+ });
1924
+ def.resolve();
1925
+ });
1926
+ break;
1927
+
1928
+ case 'fade' :
1929
+ element.animate({
1930
+ 'opacity' : 0,
1931
+ }, data_ease_out,
1932
+ function() {
1933
+ element.css({
1934
+ 'display' : 'none',
1935
+ 'opacity' : getItemData(element, 'opacity'),
1936
+ });
1937
+ def.resolve();
1938
+ });
1939
+ break;
1940
+
1941
+ case 'fadeDown' :
1942
+ element.animate({
1943
+ 'top' : getHeight(),
1944
+ 'opacity' : 0,
1945
+ }, data_ease_out,
1946
+ function() {
1947
+ element.css({
1948
+ 'display' : 'none',
1949
+ 'opacity' : getItemData(element, 'opacity'),
1950
+ });
1951
+ def.resolve();
1952
+ });
1953
+ break;
1954
+
1955
+ case 'fadeUp' :
1956
+ element.animate({
1957
+ 'top' : - element_height,
1958
+ 'opacity' : 0,
1959
+ }, data_ease_out,
1960
+ function() {
1961
+ element.css({
1962
+ 'display' : 'none',
1963
+ 'opacity' : getItemData(element, 'opacity'),
1964
+ });
1965
+ def.resolve();
1966
+ });
1967
+ break;
1968
+
1969
+ case 'fadeLeft' :
1970
+ element.animate({
1971
+ 'left' : - element_width,
1972
+ 'opacity' : 0,
1973
+ }, data_ease_out,
1974
+ function() {
1975
+ element.css({
1976
+ 'display' : 'none',
1977
+ 'opacity' : getItemData(element, 'opacity'),
1978
+ });
1979
+ def.resolve();
1980
+ });
1981
+ break;
1982
+
1983
+ case 'fadeRight' :
1984
+ element.animate({
1985
+ 'left' : getWidth(),
1986
+ 'opacity' : 0,
1987
+ }, data_ease_out,
1988
+ function() {
1989
+ element.css({
1990
+ 'display' : 'none',
1991
+ 'opacity' : getItemData(element, 'opacity'),
1992
+ });
1993
+ def.resolve();
1994
+ });
1995
+ break;
1996
+
1997
+ case 'fadeSmallDown' :
1998
+ element.animate({
1999
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top + 30),
2000
+ 'opacity' : 0,
2001
+ }, data_ease_out,
2002
+ function() {
2003
+ element.css({
2004
+ 'display' : 'none',
2005
+ 'opacity' : getItemData(element, 'opacity'),
2006
+ });
2007
+ def.resolve();
2008
+ });
2009
+ break;
2010
+
2011
+ case 'fadeSmallUp' :
2012
+ element.animate({
2013
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top - 30),
2014
+ 'opacity' : 0,
2015
+ }, data_ease_out,
2016
+ function() {
2017
+ element.css({
2018
+ 'display' : 'none',
2019
+ 'opacity' : getItemData(element, 'opacity'),
2020
+ });
2021
+ def.resolve();
2022
+ });
2023
+ break;
2024
+
2025
+ case 'fadeSmallLeft' :
2026
+ element.animate({
2027
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left - 30),
2028
+ 'opacity' : 0,
2029
+ }, data_ease_out,
2030
+ function() {
2031
+ element.css({
2032
+ 'display' : 'none',
2033
+ 'opacity' : getItemData(element, 'opacity'),
2034
+ });
2035
+ def.resolve();
2036
+ });
2037
+ break;
2038
+
2039
+ case 'fadeSmallRight' :
2040
+ element.animate({
2041
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left + 30),
2042
+ 'opacity' : 0,
2043
+ }, data_ease_out,
2044
+ function() {
2045
+ element.css({
2046
+ 'display' : 'none',
2047
+ 'opacity' : getItemData(element, 'opacity'),
2048
+ });
2049
+ def.resolve();
2050
+ });
2051
+ break;
2052
+
2053
+ default :
2054
+ element.css({
2055
+ 'display' : 'none',
2056
+ });
2057
+ def.resolve();
2058
+ break;
2059
+ }
2060
+
2061
+ return def.promise();
2062
+ }
2063
+
2064
+ /**********************/
2065
+ /** PUBLIC FUNCTIONS **/
2066
+ /**********************/
2067
+
2068
+ this.resume = function() {
2069
+ resume();
2070
+ }
2071
+
2072
+ this.pause = function() {
2073
+ pause();
2074
+ }
2075
+
2076
+ this.nextSlide = function() {
2077
+ changeSlide(getNextSlide());
2078
+ }
2079
+
2080
+ this.previousSlide = function() {
2081
+ changeSlide(getPreviousSlide());
2082
+ }
2083
+
2084
+ this.changeSlide = function(slide_index) {
2085
+ changeSlide(slide_index);
2086
+ }
2087
+
2088
+ this.getCurrentSlide = function() {
2089
+ return current_slide;
2090
+ }
2091
+
2092
+ this.getTotalSlides = function() {
2093
+ return total_slides;
2094
+ }
2095
+
2096
+ };
2097
+
2098
+ /**************************/
2099
+ /** CRELLY SLIDER PLUGIN **/
2100
+ /**************************/
2101
+
2102
+ $.fn.crellySlider = function(options) {
2103
+ var settings = $.extend({
2104
+ layout : 'fixed',
2105
+ responsive : true,
2106
+ startWidth : 1140,
2107
+ startHeight : 500,
2108
+
2109
+ pauseOnHover : true,
2110
+ automaticSlide : true,
2111
+ randomOrder : true,
2112
+ startFromSlide : 0, // -1 means random, >= 0 means the exact index
2113
+ showControls : true,
2114
+ showNavigation : true,
2115
+ showProgressBar : true,
2116
+ enableSwipe : true,
2117
+
2118
+ slidesTime : 3000,
2119
+ elementsDelay : 0,
2120
+ elementsTime : 'all',
2121
+ slidesEaseIn : 300,
2122
+ elementsEaseIn : 300,
2123
+ slidesEaseOut : 300,
2124
+ elementsEaseOut : 300,
2125
+ ignoreElementsEaseOut : false,
2126
+
2127
+ videoAutoplay : false,
2128
+ videoLoop : false,
2129
+
2130
+ beforeStart : function() {},
2131
+ beforeSetResponsive : function() {},
2132
+ beforeSlideStart : function() {},
2133
+ beforePause : function() {},
2134
+ beforeResume : function() {},
2135
+ }, options);
2136
+
2137
+ return this.each(function() {
2138
+ if(undefined == $(this).data('crellySlider')) {
2139
+ var plugin = new $.CrellySlider(this, settings);
2140
+ $(this).data('crellySlider', plugin);
2141
+ }
2142
+ });
2143
+ };
2144
+
2145
+ })(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.2.2
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(a){function b(){var a=document.createElement("script");a.src="https://www.youtube.com/iframe_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),crellyslider_youtube_api_ready=!0}function c(){(function(){function a(b){return new a.fn.init(b)}function b(a,b,c){return!!c.contentWindow.postMessage&&(a=JSON.stringify({method:a,value:b}),void c.contentWindow.postMessage(a,g))}function c(a){var b,c;try{b=JSON.parse(a.data),c=b.event||b.method}catch(a){}if("ready"!=c||f||(f=!0),!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===g&&(g=a.origin),a=b.value;var d=b.data,h=""===h?null:b.player_id;return b=h?e[h][c]:e[c],c=[],!!b&&(void 0!==a&&c.push(a),d&&c.push(d),h&&c.push(h),0<c.length?b.apply(null,c):b.call())}function d(a,b,c){c?(e[c]||(e[c]={}),e[c][a]=b):e[a]=b}var e={},f=!1,g="*";return a.fn=a.prototype={element:null,init:function(a){return"string"==typeof a&&(a=document.getElementById(a)),this.element=a,this},api:function(a,c){if(!this.element||!a)return!1;var e=this.element,f=""!==e.id?e.id:null,g=c&&c.constructor&&c.call&&c.apply?null:c,h=c&&c.constructor&&c.call&&c.apply?c:null;return h&&d(a,h,f),b(a,g,e),this},addEvent:function(a,c){if(!this.element)return!1;var e=this.element,g=""!==e.id?e.id:null;return d(a,c,g),"ready"!=a?b("addEventListener",a,e):"ready"==a&&f&&c.call(null,g),this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,d=""!==c.id?c.id:null;a:{if(d&&e[d]){if(!e[d][a]){d=!1;break a}e[d][a]=null}else{if(!e[a]){d=!1;break a}e[a]=null}d=!0}"ready"!=a&&d&&b("removeEventListener",a,c)}},a.fn.init.prototype=a.fn,window.addEventListener?window.addEventListener("message",c,!1):window.attachEvent("onmessage",c),window.Froogaloop=window.$f=a})();crellyslider_vimeo_api_ready=!0}!function(a,b,c){"function"==typeof define&&define.amd?define(["jquery"],function(d){return c(d,a,b),d.mobile}):c(a.jQuery,a,b)}(this,document,function(a,b,c,d){!function(a,b,c,d){function e(a){for(;a&&"undefined"!=typeof a.originalEvent;)a=a.originalEvent;return a}function f(b,c){var g,h,i,j,k,l,m,n,o,f=b.type;if(b=a.Event(b),b.type=c,g=b.originalEvent,h=a.event.props,f.search(/^(mouse|click)/)>-1&&(h=C),g)for(m=h.length,j;m;)j=h[--m],b[j]=g[j];if(f.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1),f.search(/^touch/)!==-1&&(i=e(g),f=i.touches,k=i.changedTouches,l=f&&f.length?f[0]:k&&k.length?k[0]:d,l))for(n=0,o=A.length;n<o;n++)j=A[n],b[j]=l[j];return b}function g(b){for(var d,e,c={};b;){d=a.data(b,x);for(e in d)d[e]&&(c[e]=c.hasVirtualBinding=!0);b=b.parentNode}return c}function h(b,c){for(var d;b;){if(d=a.data(b,x),d&&(!c||d[c]))return b;b=b.parentNode}return null}function i(){K=!1}function j(){K=!0}function k(){O=0,I.length=0,J=!1,j()}function l(){i()}function m(){n(),E=setTimeout(function(){E=0,k()},a.vmouse.resetTimerDuration)}function n(){E&&(clearTimeout(E),E=0)}function o(b,c,d){var e;return(d&&d[b]||!d&&h(c.target,b))&&(e=f(c,b),a(c.target).trigger(e)),e}function p(b){var d,c=a.data(b.target,y);!J&&(!O||O!==c)&&(d=o("v"+b.type,b),d&&(d.isDefaultPrevented()&&b.preventDefault(),d.isPropagationStopped()&&b.stopPropagation(),d.isImmediatePropagationStopped()&&b.stopImmediatePropagation()))}function q(b){var d,f,h,c=e(b).touches;c&&1===c.length&&(d=b.target,f=g(d),f.hasVirtualBinding&&(O=N++,a.data(d,y,O),n(),l(),H=!1,h=e(b).touches[0],F=h.pageX,G=h.pageY,o("vmouseover",b,f),o("vmousedown",b,f)))}function r(a){K||(H||o("vmousecancel",a,g(a.target)),H=!0,m())}function s(b){if(!K){var c=e(b).touches[0],d=H,f=a.vmouse.moveDistanceThreshold,h=g(b.target);H=H||Math.abs(c.pageX-F)>f||Math.abs(c.pageY-G)>f,H&&!d&&o("vmousecancel",b,h),o("vmousemove",b,h),m()}}function t(a){if(!K){j();var c,d,b=g(a.target);o("vmouseup",a,b),H||(c=o("vclick",a,b),c&&c.isDefaultPrevented()&&(d=e(a).changedTouches[0],I.push({touchID:O,x:d.clientX,y:d.clientY}),J=!0)),o("vmouseout",a,b),H=!1,m()}}function u(b){var d,c=a.data(b,x);if(c)for(d in c)if(c[d])return!0;return!1}function v(){}function w(b){var c=b.substr(1);return{setup:function(){u(this)||a.data(this,x,{});var d=a.data(this,x);d[b]=!0,D[b]=(D[b]||0)+1,1===D[b]&&M.bind(c,p),a(this).bind(c,v),L&&(D.touchstart=(D.touchstart||0)+1,1===D.touchstart&&M.bind("touchstart",q).bind("touchend",t).bind("touchmove",s).bind("scroll",r))},teardown:function(){--D[b],D[b]||M.unbind(c,p),L&&(--D.touchstart,D.touchstart||M.unbind("touchstart",q).unbind("touchmove",s).unbind("touchend",t).unbind("scroll",r));var d=a(this),e=a.data(this,x);e&&(e[b]=!1),d.unbind(c,v),u(this)||d.removeData(x)}}}var P,Q,x="virtualMouseBindings",y="virtualTouchID",z="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),A="clientX clientY pageX pageY screenX screenY".split(" "),B=a.event.mouseHooks?a.event.mouseHooks.props:[],C=a.event.props.concat(B),D={},E=0,F=0,G=0,H=!1,I=[],J=!1,K=!1,L="addEventListener"in c,M=a(c),N=1,O=0;for(a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},Q=0;Q<z.length;Q++)a.event.special[z[Q]]=w(z[Q]);L&&c.addEventListener("click",function(b){var e,f,g,h,i,j,c=I.length,d=b.target;if(c)for(e=b.clientX,f=b.clientY,P=a.vmouse.clickDistanceThreshold,g=d;g;){for(h=0;h<c;h++)if(i=I[h],j=0,g===d&&Math.abs(i.x-e)<P&&Math.abs(i.y-f)<P||a.data(g,y)===i.touchID)return b.preventDefault(),void b.stopPropagation();g=g.parentNode}},!0)}(a,b,c),function(a){a.mobile={}}(a),function(a,b){var d={touch:"ontouchend"in c};a.mobile.support=a.mobile.support||{},a.extend(a.support,d),a.extend(a.mobile.support,d)}(a),function(a,b,d){function e(b,c,e,f){var g=e.type;e.type=c,f?a.event.trigger(e,d,b):a.event.dispatch.call(b,e),e.type=g}var f=a(c),g=a.mobile.support.touch,h="touchmove scroll",i=g?"touchstart":"mousedown",j=g?"touchend":"mouseup",k=g?"touchmove":"mousemove";a.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(b,c){a.fn[c]=function(a){return a?this.bind(c,a):this.trigger(c)},a.attrFn&&(a.attrFn[c]=!0)}),a.event.special.scrollstart={enabled:!0,setup:function(){function b(a,b){f=b,e(c,f?"scrollstart":"scrollstop",a)}var f,g,c=this,d=a(c);d.bind(h,function(c){a.event.special.scrollstart.enabled&&(f||b(c,!0),clearTimeout(g),g=setTimeout(function(){b(c,!1)},50))})},teardown:function(){a(this).unbind(h)}},a.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var b=this,c=a(b),d=!1;c.bind("vmousedown",function(g){function h(){clearTimeout(l)}function i(){h(),c.unbind("vclick",j).unbind("vmouseup",h),f.unbind("vmousecancel",i)}function j(a){i(),d||k!==a.target?d&&a.preventDefault():e(b,"tap",a)}if(d=!1,g.which&&1!==g.which)return!1;var l,k=g.target;c.bind("vmouseup",h).bind("vclick",j),f.bind("vmousecancel",i),l=setTimeout(function(){a.event.special.tap.emitTapOnTaphold||(d=!0),e(b,"taphold",a.Event("taphold",{target:k}))},a.event.special.tap.tapholdThreshold)})},teardown:function(){a(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),f.unbind("vmousecancel")}},a.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(a){var c=b.pageXOffset,d=b.pageYOffset,e=a.clientX,f=a.clientY;return 0===a.pageY&&Math.floor(f)>Math.floor(a.pageY)||0===a.pageX&&Math.floor(e)>Math.floor(a.pageX)?(e-=c,f-=d):(f<a.pageY-d||e<a.pageX-c)&&(e=a.pageX-c,f=a.pageY-d),{x:e,y:f}},start:function(b){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b,d=a.event.special.swipe.getLocation(c);return{time:(new Date).getTime(),coords:[d.x,d.y],origin:a(b.target)}},stop:function(b){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b,d=a.event.special.swipe.getLocation(c);return{time:(new Date).getTime(),coords:[d.x,d.y]}},handleSwipe:function(b,c,d,f){if(c.time-b.time<a.event.special.swipe.durationThreshold&&Math.abs(b.coords[0]-c.coords[0])>a.event.special.swipe.horizontalDistanceThreshold&&Math.abs(b.coords[1]-c.coords[1])<a.event.special.swipe.verticalDistanceThreshold){var g=b.coords[0]>c.coords[0]?"swipeleft":"swiperight";return e(d,"swipe",a.Event("swipe",{target:f,swipestart:b,swipestop:c}),!0),e(d,g,a.Event(g,{target:f,swipestart:b,swipestop:c}),!0),!0}return!1},eventInProgress:!1,setup:function(){var b,c=this,d=a(c),e={};b=a.data(this,"mobile-events"),b||(b={length:0},a.data(this,"mobile-events",b)),b.length++,b.swipe=e,e.start=function(b){if(!a.event.special.swipe.eventInProgress){a.event.special.swipe.eventInProgress=!0;var d,g=a.event.special.swipe.start(b),h=b.target,i=!1;e.move=function(b){g&&!b.isDefaultPrevented()&&(d=a.event.special.swipe.stop(b),i||(i=a.event.special.swipe.handleSwipe(g,d,c,h),i&&(a.event.special.swipe.eventInProgress=!1)),Math.abs(g.coords[0]-d.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&b.preventDefault())},e.stop=function(){i=!0,a.event.special.swipe.eventInProgress=!1,f.off(k,e.move),e.move=null},f.on(k,e.move).one(j,e.stop)}},d.on(i,e.start)},teardown:function(){var b,c;b=a.data(this,"mobile-events"),b&&(c=b.swipe,delete b.swipe,b.length--,0===b.length&&a.removeData(this,"mobile-events")),c&&(c.start&&a(this).off(i,c.start),c.move&&f.off(k,c.move),c.stop&&f.off(j,c.stop))}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)},teardown:function(){a(this).unbind(c)}}})}(a,this)}),a.CrellySlider=function(d,e){function y(a){return"youtube"==a?f.find(".cs-yt-iframe").length>0:"vimeo"==a?f.find(".cs-vimeo-iframe").length>0:-1}function z(){if(f.wrapInner('<div class="crellyslider" />'),f.find(g+" > ul").addClass("cs-slides"),f.find(g+" "+h+" > li").addClass("cs-slide"),k=Z().length,0==k)return!1;if(1==k){var a=$(0),b=f.find(g).find(h);a.clone().prependTo(b),k++}if(A(),e.showControls&&f.find(g).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),e.showNavigation){for(var c='<div class="cs-navigation">',d=0;d<k;d++)c+='<span class="cs-slide-link"></span>';c+="</div>",f.find(g).append(c)}e.showProgressBar?f.find(g).append('<div class="cs-progress-bar"></div>'):f.find(g).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),f.css("display","block"),e.responsive&&O(),K(),Z().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),I(),B().done(function(){var a=setInterval(function(){"complete"==document.readyState&&f.find(g).find(".cs-preloader").length>0&&(clearInterval(a),E())},100)})}function A(){if(e.randomOrder||0!=e.startFromSlide){var a=new Array,b=new Array;if(e.startFromSlide==-1){var c=Math.floor(Math.random()*k);a[0]=c,b[0]=$(c)}else a[0]=e.startFromSlide,b[0]=$(e.startFromSlide);for(var d=1;d<k;d++){var c;if(e.randomOrder){do c=Math.floor(Math.random()*k);while(a.indexOf(c)!=-1)}else c=d+a[0]<k?d+a[0]:d+a[0]-k;a[d]=c,b[d]=$(c)}f.find(g).find(h).empty();for(var d=0;d<k;d++)f.find(g).find(h).append(b[d])}}function B(){var b=new a.Deferred,c=Z().find(".cs-yt-iframe, .cs-vimeo-iframe").length,d=0;return 0==c?b.resolve().promise():(Z().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){var e=a(this);e.one("load",function(){d++,d==c&&C().done(function(){D().done(function(){b.resolve()})})})}),b.promise())}function C(){var f,b=new a.Deferred,c=Z(),d=c.find(j+".cs-yt-iframe").length,e=0;return 0==d?b.resolve().promise():(c.each(function(){var c=a(this),g=c.find(j+".cs-yt-iframe");g.each(function(){var c=a(this);c.uniqueId(),c.attr("id","cs-yt-iframe-"+c.attr("id"));var g=new YT.Player(c.attr("id"),{events:{onReady:function(){e++,e==d&&b.resolve()},onStateChange:function(a){a.data===YT.PlayerState.ENDED&&Y(c,"loop")&&g.playVideo()}}});f={player:g,played_once:!1},t[c.attr("id")]=f})}),b.promise())}function D(){var f,b=new a.Deferred,c=Z(),d=c.find(j+".cs-vimeo-iframe").length,e=0;return 0==d?b.resolve().promise():(c.each(function(){var c=a(this),g=c.find(j+".cs-vimeo-iframe");g.each(function(){var c=a(this);c.uniqueId(),c.attr("id","cs-vimeo-iframe-"+c.attr("id")),c.attr("src",c.attr("src")+"&player_id="+c.attr("id"));var g=$f(c[0]);g.addEvent("ready",function(){g.addEvent("finish",function(){u[c.attr("id")].ended=!0}),g.addEvent("play",function(){u[c.attr("id")].played_once=!0,u[c.attr("id")].ended=!1}),Y(c,"loop")&&g.api("setLoop",!0),e++,e==d&&b.resolve()}),f={player:g,played_once:!1,ended:!1},u[c.attr("id")]=f})}),b.promise())}function E(){e.responsive&&O(),K(),w=a(window).width(),F(),H(),J(),e.beforeStart(),e.responsive?M():Q()}function F(){Z().each(function(){var b=a(this);b.find(j).each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);G(b,!0)}),G(b,!1)}),b.css("display","none"),b.data("opacity",parseFloat(b.css("opacity")))})}function G(a,b){a.data("width",parseFloat(a.width())),a.data("height",parseFloat(a.height())),a.data("letter-spacing",parseFloat(a.css("letter-spacing"))),a.data("font-size",parseFloat(a.css("font-size"))),"px"==a.css("line-height").slice(-2).toLowerCase()?a.data("line-height",parseFloat(a.css("line-height"))):a.data("line-height",parseFloat(a.css("line-height"))*Y(a,"font-size")),a.data("padding-top",parseFloat(a.css("padding-top"))),a.data("padding-right",parseFloat(a.css("padding-right"))),a.data("padding-bottom",parseFloat(a.css("padding-bottom"))),a.data("padding-left",parseFloat(a.css("padding-left"))),a.data("opacity",parseFloat(a.css("opacity"))),b||a.css("display","none")}function H(){e.responsive&&a(window).resize(function(){w!=a(window).width()&&("full-width"==e.layout&&U()!=a(f).width()||a(f).width()<U()||a(f).width()>U()&&U()<e.startWidth)&&M()}),f.find(g).find(".cs-controls > .cs-previous").click(function(){fa(X())}),f.find(g).find(".cs-controls > .cs-next").click(function(){fa(W())}),e.enableSwipe&&(f.find(g).on("swipeleft",function(){T(),fa(W())}),f.find(g).on("swiperight",function(){T(),fa(X())})),f.find(g).find(".cs-navigation > .cs-slide-link").click(function(){fa(a(this).index())}),e.pauseOnHover&&(f.find(g).find(h).hover(function(){S()}),f.find(g).find(h).mouseleave(function(){T()}))}function I(){function c(){f.find(g).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),f.find(g).find(".cs-preloader").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")}),f.find(g).find(".cs-preloader > .cs-bg").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")})}f.find(g).find(h).css("visibility","hidden"),f.find(g).find(".cs-progress-bar").css("display","none"),f.find(g).find(".cs-navigation").css("display","none"),f.find(g).find(".cs-controls").css("display","none");var b=$(0).css("background-image");b=b.replace(/^url\(["']?/,"").replace(/["']?\)$/,""),b.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?a("<img>").load(function(){c()}).attr("src",b).each(function(){this.complete&&a(this).load()}):c()}function J(){f.find(g).find(h).css("visibility","visible"),f.find(g).find(".cs-progress-bar").css("display","block"),f.find(g).find(".cs-navigation").css("display","block"),f.find(g).find(".cs-controls").css("display","block"),ya($(0)),$(0).finish(),f.find(g).find(".cs-preloader").animate({opacity:0},300,function(){f.find(g).find(".cs-preloader").remove()})}function K(){var b,c,a=e.layout;switch(a){case"fixed":b=e.startWidth,c=e.startHeight,f.find(g).css({width:P(b),height:P(c)}),Z().css({width:P(b),height:P(c)});break;case"full-width":b=f.width(),c=e.startHeight,f.find(g).css({width:b,height:P(c)}),Z().css({width:b,height:P(c)});break;default:return!1}}function L(a){var b=(V()-e.startHeight)/2,c=(U()-e.startWidth)/2,d=0,f=0;return b>0&&(d=b),c>0&&(f=c),{top:d,left:f}}function M(){e.beforeSetResponsive();var b=Z();R(!0),b.each(function(){var b=a(this),c=b.find(j);b.finish(),ya(b),b.finish(),c.each(function(){var b=a(this);b.finish(),Aa(b),b.finish(),ja(b)&&ma(b)})}),O(),K(),b.each(function(){var b=a(this),c=b.find(j);c.each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);N(b)}),N(b),b.finish(),Ba(b),b.finish(),ja(b)&&ma(b)}),b.finish(),za(b),b.finish()}),w=a(window).width(),Q()}function N(a){a.css({top:P(Y(a,"top")+L(a).top),left:P(Y(a,"left")+L(a).left),"padding-top":P(Y(a,"padding-top")),"padding-right":P(Y(a,"padding-right")),"padding-bottom":P(Y(a,"padding-bottom")),"padding-left":P(Y(a,"padding-left"))}),a.is("input")||a.is("button")||a.text().trim().length?a.css({"line-height":P(Y(a,"line-height"))+"px","letter-spacing":P(Y(a,"letter-spacing")),"font-size":P(Y(a,"font-size"))}):a.css({width:P(Y(a,"width")),height:P(Y(a,"height"))})}function O(){var a=f.width(),b=e.startWidth;v=a>=b||!e.responsive?1:a/b}function P(a){return a*v}function Q(){e.automaticSlide?ba():ga(l),p=!1}function R(b){for(var c=0;c<r.length;c++)r[c].clear();for(var c=0;c<s.length;c++)s[c].clear();q.clear(),Z().each(function(){var c=a(this);b?c.finish():c.stop(!0,!0),c.find(j).each(function(){var c=a(this);b?c.finish():c.stop(!0,!0)})}),da()}function S(){if(!m&&n){e.beforePause();var a=f.find(g).find(".cs-progress-bar");a.stop(!0),q.pause(),m=!0}}function T(){if(m&&n){e.beforeResume();var a=f.find(g).find(".cs-progress-bar"),c=(Y($(l),"time"),q.getRemaining());a.animate({width:"100%"},c),q.resume(),m=!1}}function U(){return f.find(g).width()}function V(){return f.find(g).height()}function W(){return l+1==k?0:l+1}function X(){return l-1<0?k-1:l-1}function Y(a,b){var c;switch(c=!!a.parent("ul").hasClass("cs-slides"),b){case"ease-in":return c?isNaN(parseInt(a.data(b)))?e.slidesEaseIn:parseInt(a.data(b)):isNaN(parseInt(a.data(b)))?e.elementsEaseIn:parseInt(a.data(b));case"ease-out":return c?isNaN(parseInt(a.data(b)))?e.slidesEaseOut:parseInt(a.data(b)):isNaN(parseInt(a.data(b)))?e.elementsEaseOut:parseInt(a.data(b));case"delay":return isNaN(parseInt(a.data(b)))?e.elementsDelay:parseInt(a.data(b));case"time":return c?isNaN(parseInt(a.data(b)))?e.slidesTime:parseInt(a.data(b)):"all"==a.data(b)?"all":isNaN(parseInt(a.data(b)))?e.itemsTime:parseInt(a.data(b));case"ignore-ease-out":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.videoAutoplay;case"loop":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.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(a.data(b)))?0:parseFloat(a.data(b));case"in":case"out":case"opacity":return a.data(b);default:return!1}}function Z(){return f.find(g).find(h).find(i)}function $(a){return Z().eq(a)}function _(a,b){var c,d,e=b;this.pause=function(){clearTimeout(c),e-=new Date-d},this.resume=function(){d=new Date,clearTimeout(c),c=window.setTimeout(function(){a()},e)},this.clear=function(){clearTimeout(c)},this.getRemaining=function(){return e},this.resume()}function aa(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ba(){ga(l).done(function(){m||(l=W(),ba())})}function ca(){var a=f.find(g).find(".cs-progress-bar");da(),a.animate({width:"100%"},Y($(l),"time"))}function da(){var a=f.find(g).find(".cs-progress-bar");a.stop(),a.css("width",0)}function ea(){var b=f.find(g).find(".cs-navigation"),c=b.find("> .cs-slide-link");c.each(function(){var b=a(this);b.index()==l?b.addClass("cs-active"):b.removeClass("cs-active")})}function fa(a){a!=l&&(n||o)&&(R(!1),ia(l,!1,!0).done(function(){l=a,Q()}))}function ga(b){e.beforeSlideStart();var c=new a.Deferred;o=!1;for(var d=0;d<r.length;d++)r[d].clear();for(var d=0;d<s.length;d++)s[d].clear();q.clear(),$(b).finish(),za(b),$(b).finish();var f=$(b).find(j);return f.each(function(){var b=a(this);b.finish(),Ba(b),b.finish()}),ea(),ha(b),e.automaticSlide?ia(b,!0,!0).done(function(){o=!0,c.resolve()}):ia(b,!0,!1).done(function(){o=!0,c.resolve()}),c.promise()}function ha(b){var c=$(b),d=c.find(j),e=0,f=!1,g=new a.Deferred;return n=!1,ya(b).done(function(){ca(),n=!0,f=!0,f&&e==d.length&&g.resolve()}),d.each(function(){var b=a(this),c=Y(b,"delay");s.push(new _(function(){Aa(b).done(function(){ja(b)&&ka(b),e++,f&&e==d.length&&g.resolve()})},c))}),g.promise()}function ia(b,c,d){var e=$(b),f=e.find(j),g=c?Y(e,"time")+Y(e,"ease-in"):0,h=0,i=!1,k=new a.Deferred;return f.each(function(){var e=a(this),g=Y(e,"time");if("all"!=g){var j=c?g:0;Y(e,"ignore-ease-out")&&(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve())),r.push(new _(function(){Ba(e).done(function(){Y(e,"ignore-ease-out")||(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve()))})},j))}}),q=new _(function(){n=!1,da(),i=!0,f.length==h&&i&&d&&(la(b),za(b),k.resolve()),d?f.each(function(){var c=a(this),e=Y(c,"time");"all"==e&&(Y(c,"ignore-ease-out")&&(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve())),Ba(c).done(function(){Y(c,"ignore-ease-out")||(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve()))}))}):k.resolve()},g),k.promise()}function ja(a){return na(a)||ta(a)}function ka(a){na(a)?qa(a):va(a)}function la(a){ra(a),wa(a)}function ma(a){na(a)?sa(a):xa(a)}function na(a){return a.hasClass("cs-yt-iframe")}function oa(a){return t[a.attr("id")].player}function pa(a){return oa(a).getPlayerState()}function qa(a){!Y(a,"autoplay")||t[a.attr("id")].played_once||aa()||oa(a).playVideo(),2==pa(a)&&oa(a).playVideo(),t[a.attr("id")].played_once=!0}function ra(b){$(b).each(function(){var b=a(this);b.find(j+".cs-yt-iframe").each(function(){sa(a(this))})})}function sa(a){1==pa(a)&&oa(a).pauseVideo()}function ta(a){return a.hasClass("cs-vimeo-iframe")}function ua(a){return u[a.attr("id")].player}function va(a){!Y(a,"autoplay")||u[a.attr("id")].played_once||aa()||ua(a).api("play"),ua(a).api("paused")&&!u[a.attr("id")].ended&&u[a.attr("id")].played_once&&ua(a).api("play")}function wa(b){$(b).each(function(){var b=a(this);b.find(j+".cs-vimeo-iframe").each(function(){xa(a(this))})})}function xa(a){ua(a).api("pause")}function ya(b){var c=$(b),d=Y(c,"in"),e=Y(c,"ease-in"),f=new a.Deferred;if("block"==c.css("display"))return f.resolve().promise();if(p)return c.css({display:"block",top:0,left:0,opacity:Y(c,"opacity")}),f.resolve().promise();switch(d){case"fade":c.css({display:"block",top:0,left:0,opacity:0}),c.animate({opacity:Y(c,"opacity")},e,function(){f.resolve()});break;case"fadeLeft":c.css({display:"block",top:0,left:U(),opacity:0}),c.animate({opacity:Y(c,"opacity"),left:0},e,function(){f.resolve()});break;case"fadeRight":c.css({display:"block",top:0,left:-U(),opacity:0}),c.animate({opacity:Y(c,"opacity"),left:0},e,function(){f.resolve()});break;case"slideLeft":c.css({display:"block",top:0,left:U(),opacity:Y(c,"opacity")}),c.animate({left:0},e,function(){f.resolve()});break;case"slideRight":c.css({display:"block",top:0,left:-U(),opacity:Y(c,"opacity")}),c.animate({left:0},e,function(){f.resolve()});break;case"slideUp":c.css({display:"block",top:V(),left:0,opacity:Y(c,"opacity")}),c.animate({top:0},e,function(){f.resolve()});break;case"slideDown":c.css({display:"block",top:-V(),left:0,opacity:Y(c,"opacity")}),c.animate({top:0},e,function(){f.resolve()});break;default:c.css({display:"block",top:0,left:0,opacity:Y(c,"opacity")}),f.resolve()}return f.promise()}function za(b){var c=$(b),d=Y(c,"out"),e=Y(c,"ease-out"),f=new a.Deferred;if("none"==c.css("display"))return f.resolve().promise();switch(d){case"fade":c.animate({opacity:0},e,function(){c.css({display:"none",opacity:Y(c,"opacity")}),f.resolve()});break;case"fadeLeft":c.animate({opacity:0,left:-U()},e,function(){c.css({display:"none",opacity:Y(c,"opacity"),left:0}),f.resolve()});break;case"fadeRight":c.animate({opacity:0,left:U()},e,function(){c.css({display:"none",opacity:Y(c,"opacity"),left:0}),f.resolve()});break;case"slideLeft":c.animate({left:-U()},e,function(){c.css({display:"none",left:0}),f.resolve()});break;case"slideRight":c.animate({left:U()},e,function(){c.css({display:"none",left:0}),f.resolve()});break;case"slideUp":c.animate({top:-V()},e,function(){c.css({display:"none",top:0}),f.resolve()});break;case"slideDown":c.animate({top:V()},e,function(){c.css({display:"none",top:0}),f.resolve()});break;default:c.css({display:"none"}),f.resolve()}return f.promise()}function Aa(b){var c=b.outerWidth(),d=b.outerHeight(),e=Y(b,"in"),f=Y(b,"ease-in"),g=Y(b,"top"),h=Y(b,"left"),i=new a.Deferred;if("block"==b.css("display"))return i.resolve().promise();switch(e){case"slideDown":b.css({display:"block",top:-d,left:P(h+L(b).left),opacity:Y(b,"opacity")}).animate({top:P(g+L(b).top)},f,function(){i.resolve()});break;case"slideUp":b.css({display:"block",top:V(),left:P(h+L(b).left),opacity:Y(b,"opacity")}).animate({top:P(g+L(b).top)},f,function(){i.resolve()});break;case"slideLeft":b.css({display:"block",top:P(g+L(b).top),left:U(),opacity:Y(b,"opacity")}).animate({left:P(h+L(b).left)},f,function(){i.resolve()});break;case"slideRight":b.css({display:"block",top:P(g+L(b).top),left:-c,opacity:Y(b,"opacity")}).animate({left:P(h+L(b).left)},f,function(){i.resolve()});break;case"fade":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left),opacity:0}).animate({opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeDown":b.css({display:"block",top:-d,left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeUp":b.css({display:"block",top:V(),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeLeft":b.css({display:"block",top:P(g+L(b).top),left:U(),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeRight":b.css({display:"block",top:P(g+L(b).top),left:-c,opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallDown":b.css({display:"block",top:P(g+L(b).top-30),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallUp":b.css({display:"block",top:P(g+L(b).top+30),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallLeft":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left+30),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallRight":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left-30),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;default:b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left),opacity:Y(b,"opacity")}),i.resolve()}return i.promise()}function Ba(b){var c=b.outerWidth(),d=b.outerHeight(),e=Y(b,"out"),f=Y(b,"ease-out"),g=new a.Deferred;if("none"==b.css("display"))return g.resolve().promise();switch(e){case"slideDown":b.animate({top:V()},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideUp":b.animate({top:-d},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideLeft":b.animate({left:-c},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideRight":b.animate({left:U()},f,function(){b.css({display:"none"}),g.resolve()});break;case"fade":b.animate({opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeDown":b.animate({top:V(),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeUp":b.animate({top:-d,opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeLeft":b.animate({left:-c,opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeRight":b.animate({left:U(),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallDown":b.animate({top:P(Y(b,"top")+L(b).top+30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallUp":b.animate({top:P(Y(b,"top")+L(b).top-30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallLeft":b.animate({left:P(Y(b,"left")+L(b).left-30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallRight":b.animate({left:P(Y(b,"left")+L(b).left+30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;default:b.css({display:"none"}),g.resolve()}return g.promise()}var k,f=a(d),g="div.crellyslider",h="ul.cs-slides",i="li.cs-slide",j="> *",l=0,m=!1,n=!1,o=!1,p=!0,q=new _(function(){},0),r=new Array,s=new Array,t={},u={},v=1,w=0;if(!crellyslider_youtube_api_ready&&y("youtube")&&b(),!crellyslider_vimeo_api_ready&&y("vimeo")&&c(),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&"undefined"!=typeof YT.Player)z();else var x=setInterval(function(){"undefined"!=typeof YT&&"undefined"!=typeof YT.Player&&(clearInterval(x),z())},100);this.resume=function(){T()},this.pause=function(){S()},this.nextSlide=function(){fa(W())},this.previousSlide=function(){fa(X())},this.changeSlide=function(a){fa(a)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return k}},a.fn.crellySlider=function(b){var c=a.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(){}},b);return this.each(function(){if(void 0==a(this).data("crellySlider")){var b=new a.CrellySlider(this,c);a(this).data("crellySlider",b)}})}}(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.2.3
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(a){function b(){var a=document.createElement("script");a.src="https://www.youtube.com/iframe_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),crellyslider_youtube_api_ready=!0}function c(){(function(){function a(b){return new a.fn.init(b)}function b(a,b,c){return!!c.contentWindow.postMessage&&(a=JSON.stringify({method:a,value:b}),void c.contentWindow.postMessage(a,g))}function c(a){var b,c;try{b=JSON.parse(a.data),c=b.event||b.method}catch(a){}if("ready"!=c||f||(f=!0),!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===g&&(g=a.origin),a=b.value;var d=b.data,h=""===h?null:b.player_id;return b=h?e[h][c]:e[c],c=[],!!b&&(void 0!==a&&c.push(a),d&&c.push(d),h&&c.push(h),0<c.length?b.apply(null,c):b.call())}function d(a,b,c){c?(e[c]||(e[c]={}),e[c][a]=b):e[a]=b}var e={},f=!1,g="*";return a.fn=a.prototype={element:null,init:function(a){return"string"==typeof a&&(a=document.getElementById(a)),this.element=a,this},api:function(a,c){if(!this.element||!a)return!1;var e=this.element,f=""!==e.id?e.id:null,g=c&&c.constructor&&c.call&&c.apply?null:c,h=c&&c.constructor&&c.call&&c.apply?c:null;return h&&d(a,h,f),b(a,g,e),this},addEvent:function(a,c){if(!this.element)return!1;var e=this.element,g=""!==e.id?e.id:null;return d(a,c,g),"ready"!=a?b("addEventListener",a,e):"ready"==a&&f&&c.call(null,g),this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,d=""!==c.id?c.id:null;a:{if(d&&e[d]){if(!e[d][a]){d=!1;break a}e[d][a]=null}else{if(!e[a]){d=!1;break a}e[a]=null}d=!0}"ready"!=a&&d&&b("removeEventListener",a,c)}},a.fn.init.prototype=a.fn,window.addEventListener?window.addEventListener("message",c,!1):window.attachEvent("onmessage",c),window.Froogaloop=window.$f=a})();crellyslider_vimeo_api_ready=!0}!function(a,b,c){"function"==typeof define&&define.amd?define(["jquery"],function(d){return c(d,a,b),d.mobile}):c(a.jQuery,a,b)}(this,document,function(a,b,c,d){!function(a,b,c,d){function e(a){for(;a&&"undefined"!=typeof a.originalEvent;)a=a.originalEvent;return a}function f(b,c){var g,h,i,j,k,l,m,n,o,f=b.type;if(b=a.Event(b),b.type=c,g=b.originalEvent,h=a.event.props,f.search(/^(mouse|click)/)>-1&&(h=C),g)for(m=h.length,j;m;)j=h[--m],b[j]=g[j];if(f.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1),f.search(/^touch/)!==-1&&(i=e(g),f=i.touches,k=i.changedTouches,l=f&&f.length?f[0]:k&&k.length?k[0]:d,l))for(n=0,o=A.length;n<o;n++)j=A[n],b[j]=l[j];return b}function g(b){for(var d,e,c={};b;){d=a.data(b,x);for(e in d)d[e]&&(c[e]=c.hasVirtualBinding=!0);b=b.parentNode}return c}function h(b,c){for(var d;b;){if(d=a.data(b,x),d&&(!c||d[c]))return b;b=b.parentNode}return null}function i(){K=!1}function j(){K=!0}function k(){O=0,I.length=0,J=!1,j()}function l(){i()}function m(){n(),E=setTimeout(function(){E=0,k()},a.vmouse.resetTimerDuration)}function n(){E&&(clearTimeout(E),E=0)}function o(b,c,d){var e;return(d&&d[b]||!d&&h(c.target,b))&&(e=f(c,b),a(c.target).trigger(e)),e}function p(b){var d,c=a.data(b.target,y);!J&&(!O||O!==c)&&(d=o("v"+b.type,b),d&&(d.isDefaultPrevented()&&b.preventDefault(),d.isPropagationStopped()&&b.stopPropagation(),d.isImmediatePropagationStopped()&&b.stopImmediatePropagation()))}function q(b){var d,f,h,c=e(b).touches;c&&1===c.length&&(d=b.target,f=g(d),f.hasVirtualBinding&&(O=N++,a.data(d,y,O),n(),l(),H=!1,h=e(b).touches[0],F=h.pageX,G=h.pageY,o("vmouseover",b,f),o("vmousedown",b,f)))}function r(a){K||(H||o("vmousecancel",a,g(a.target)),H=!0,m())}function s(b){if(!K){var c=e(b).touches[0],d=H,f=a.vmouse.moveDistanceThreshold,h=g(b.target);H=H||Math.abs(c.pageX-F)>f||Math.abs(c.pageY-G)>f,H&&!d&&o("vmousecancel",b,h),o("vmousemove",b,h),m()}}function t(a){if(!K){j();var c,d,b=g(a.target);o("vmouseup",a,b),H||(c=o("vclick",a,b),c&&c.isDefaultPrevented()&&(d=e(a).changedTouches[0],I.push({touchID:O,x:d.clientX,y:d.clientY}),J=!0)),o("vmouseout",a,b),H=!1,m()}}function u(b){var d,c=a.data(b,x);if(c)for(d in c)if(c[d])return!0;return!1}function v(){}function w(b){var c=b.substr(1);return{setup:function(){u(this)||a.data(this,x,{});var d=a.data(this,x);d[b]=!0,D[b]=(D[b]||0)+1,1===D[b]&&M.bind(c,p),a(this).bind(c,v),L&&(D.touchstart=(D.touchstart||0)+1,1===D.touchstart&&M.bind("touchstart",q).bind("touchend",t).bind("touchmove",s).bind("scroll",r))},teardown:function(){--D[b],D[b]||M.unbind(c,p),L&&(--D.touchstart,D.touchstart||M.unbind("touchstart",q).unbind("touchmove",s).unbind("touchend",t).unbind("scroll",r));var d=a(this),e=a.data(this,x);e&&(e[b]=!1),d.unbind(c,v),u(this)||d.removeData(x)}}}var P,Q,x="virtualMouseBindings",y="virtualTouchID",z="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),A="clientX clientY pageX pageY screenX screenY".split(" "),B=a.event.mouseHooks?a.event.mouseHooks.props:[],C=a.event.props.concat(B),D={},E=0,F=0,G=0,H=!1,I=[],J=!1,K=!1,L="addEventListener"in c,M=a(c),N=1,O=0;for(a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},Q=0;Q<z.length;Q++)a.event.special[z[Q]]=w(z[Q]);L&&c.addEventListener("click",function(b){var e,f,g,h,i,j,c=I.length,d=b.target;if(c)for(e=b.clientX,f=b.clientY,P=a.vmouse.clickDistanceThreshold,g=d;g;){for(h=0;h<c;h++)if(i=I[h],j=0,g===d&&Math.abs(i.x-e)<P&&Math.abs(i.y-f)<P||a.data(g,y)===i.touchID)return b.preventDefault(),void b.stopPropagation();g=g.parentNode}},!0)}(a,b,c),function(a){a.mobile={}}(a),function(a,b){var d={touch:"ontouchend"in c};a.mobile.support=a.mobile.support||{},a.extend(a.support,d),a.extend(a.mobile.support,d)}(a),function(a,b,d){function e(b,c,e,f){var g=e.type;e.type=c,f?a.event.trigger(e,d,b):a.event.dispatch.call(b,e),e.type=g}var f=a(c),g=a.mobile.support.touch,h="touchmove scroll",i=g?"touchstart":"mousedown",j=g?"touchend":"mouseup",k=g?"touchmove":"mousemove";a.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(b,c){a.fn[c]=function(a){return a?this.bind(c,a):this.trigger(c)},a.attrFn&&(a.attrFn[c]=!0)}),a.event.special.scrollstart={enabled:!0,setup:function(){function b(a,b){f=b,e(c,f?"scrollstart":"scrollstop",a)}var f,g,c=this,d=a(c);d.bind(h,function(c){a.event.special.scrollstart.enabled&&(f||b(c,!0),clearTimeout(g),g=setTimeout(function(){b(c,!1)},50))})},teardown:function(){a(this).unbind(h)}},a.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var b=this,c=a(b),d=!1;c.bind("vmousedown",function(g){function h(){clearTimeout(l)}function i(){h(),c.unbind("vclick",j).unbind("vmouseup",h),f.unbind("vmousecancel",i)}function j(a){i(),d||k!==a.target?d&&a.preventDefault():e(b,"tap",a)}if(d=!1,g.which&&1!==g.which)return!1;var l,k=g.target;c.bind("vmouseup",h).bind("vclick",j),f.bind("vmousecancel",i),l=setTimeout(function(){a.event.special.tap.emitTapOnTaphold||(d=!0),e(b,"taphold",a.Event("taphold",{target:k}))},a.event.special.tap.tapholdThreshold)})},teardown:function(){a(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),f.unbind("vmousecancel")}},a.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(a){var c=b.pageXOffset,d=b.pageYOffset,e=a.clientX,f=a.clientY;return 0===a.pageY&&Math.floor(f)>Math.floor(a.pageY)||0===a.pageX&&Math.floor(e)>Math.floor(a.pageX)?(e-=c,f-=d):(f<a.pageY-d||e<a.pageX-c)&&(e=a.pageX-c,f=a.pageY-d),{x:e,y:f}},start:function(b){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b,d=a.event.special.swipe.getLocation(c);return{time:(new Date).getTime(),coords:[d.x,d.y],origin:a(b.target)}},stop:function(b){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b,d=a.event.special.swipe.getLocation(c);return{time:(new Date).getTime(),coords:[d.x,d.y]}},handleSwipe:function(b,c,d,f){if(c.time-b.time<a.event.special.swipe.durationThreshold&&Math.abs(b.coords[0]-c.coords[0])>a.event.special.swipe.horizontalDistanceThreshold&&Math.abs(b.coords[1]-c.coords[1])<a.event.special.swipe.verticalDistanceThreshold){var g=b.coords[0]>c.coords[0]?"swipeleft":"swiperight";return e(d,"swipe",a.Event("swipe",{target:f,swipestart:b,swipestop:c}),!0),e(d,g,a.Event(g,{target:f,swipestart:b,swipestop:c}),!0),!0}return!1},eventInProgress:!1,setup:function(){var b,c=this,d=a(c),e={};b=a.data(this,"mobile-events"),b||(b={length:0},a.data(this,"mobile-events",b)),b.length++,b.swipe=e,e.start=function(b){if(!a.event.special.swipe.eventInProgress){a.event.special.swipe.eventInProgress=!0;var d,g=a.event.special.swipe.start(b),h=b.target,i=!1;e.move=function(b){g&&!b.isDefaultPrevented()&&(d=a.event.special.swipe.stop(b),i||(i=a.event.special.swipe.handleSwipe(g,d,c,h),i&&(a.event.special.swipe.eventInProgress=!1)),Math.abs(g.coords[0]-d.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&b.preventDefault())},e.stop=function(){i=!0,a.event.special.swipe.eventInProgress=!1,f.off(k,e.move),e.move=null},f.on(k,e.move).one(j,e.stop)}},d.on(i,e.start)},teardown:function(){var b,c;b=a.data(this,"mobile-events"),b&&(c=b.swipe,delete b.swipe,b.length--,0===b.length&&a.removeData(this,"mobile-events")),c&&(c.start&&a(this).off(i,c.start),c.move&&f.off(k,c.move),c.stop&&f.off(j,c.stop))}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)},teardown:function(){a(this).unbind(c)}}})}(a,this)}),a.CrellySlider=function(d,e){function y(a){return"youtube"==a?f.find(".cs-yt-iframe").length>0:"vimeo"==a?f.find(".cs-vimeo-iframe").length>0:-1}function z(){if(f.wrapInner('<div class="crellyslider" />'),f.find(g+" > ul").addClass("cs-slides"),f.find(g+" "+h+" > li").addClass("cs-slide"),k=Z().length,0==k)return!1;if(1==k){var a=$(0),b=f.find(g).find(h);a.clone().prependTo(b),k++}if(A(),e.showControls&&f.find(g).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),e.showNavigation){for(var c='<div class="cs-navigation">',d=0;d<k;d++)c+='<span class="cs-slide-link"></span>';c+="</div>",f.find(g).append(c)}e.showProgressBar?f.find(g).append('<div class="cs-progress-bar"></div>'):f.find(g).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),f.css("display","block"),e.responsive&&O(),K(),Z().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),I(),B().done(function(){var a=setInterval(function(){"complete"==document.readyState&&f.find(g).find(".cs-preloader").length>0&&(clearInterval(a),E())},100)})}function A(){if(e.randomOrder||0!=e.startFromSlide){var a=new Array,b=new Array;if(e.startFromSlide==-1){var c=Math.floor(Math.random()*k);a[0]=c,b[0]=$(c)}else a[0]=e.startFromSlide,b[0]=$(e.startFromSlide);for(var d=1;d<k;d++){var c;if(e.randomOrder){do c=Math.floor(Math.random()*k);while(a.indexOf(c)!=-1)}else c=d+a[0]<k?d+a[0]:d+a[0]-k;a[d]=c,b[d]=$(c)}f.find(g).find(h).empty();for(var d=0;d<k;d++)f.find(g).find(h).append(b[d])}}function B(){var b=new a.Deferred,c=Z().find(".cs-yt-iframe, .cs-vimeo-iframe").length,d=0;return 0==c?b.resolve().promise():(Z().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){var e=a(this);e.one("load",function(){d++,d==c&&C().done(function(){D().done(function(){b.resolve()})})})}),b.promise())}function C(){var f,b=new a.Deferred,c=Z(),d=c.find(j+".cs-yt-iframe").length,e=0;return 0==d?b.resolve().promise():(c.each(function(){var c=a(this),g=c.find(j+".cs-yt-iframe");g.each(function(){var c=a(this);c.uniqueId(),c.attr("id","cs-yt-iframe-"+c.attr("id"));var g=new YT.Player(c.attr("id"),{events:{onReady:function(){e++,e==d&&b.resolve()},onStateChange:function(a){a.data===YT.PlayerState.ENDED&&Y(c,"loop")&&g.playVideo()}}});f={player:g,played_once:!1},t[c.attr("id")]=f})}),b.promise())}function D(){var f,b=new a.Deferred,c=Z(),d=c.find(j+".cs-vimeo-iframe").length,e=0;return 0==d?b.resolve().promise():(c.each(function(){var c=a(this),g=c.find(j+".cs-vimeo-iframe");g.each(function(){var c=a(this);c.uniqueId(),c.attr("id","cs-vimeo-iframe-"+c.attr("id")),c.attr("src",c.attr("src")+"&player_id="+c.attr("id"));var g=$f(c[0]);g.addEvent("ready",function(){g.addEvent("finish",function(){u[c.attr("id")].ended=!0}),g.addEvent("play",function(){u[c.attr("id")].played_once=!0,u[c.attr("id")].ended=!1}),Y(c,"loop")&&g.api("setLoop",!0),e++,e==d&&b.resolve()}),f={player:g,played_once:!1,ended:!1},u[c.attr("id")]=f})}),b.promise())}function E(){e.responsive&&O(),K(),w=a(window).width(),F(),H(),J(),e.beforeStart(),e.responsive?M():Q()}function F(){Z().each(function(){var b=a(this);b.find(j).each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);G(b,!0)}),G(b,!1)}),b.css("display","none"),b.data("opacity",parseFloat(b.css("opacity")))})}function G(a,b){a.data("width",parseFloat(a.width())),a.data("height",parseFloat(a.height())),a.data("letter-spacing",parseFloat(a.css("letter-spacing"))),a.data("font-size",parseFloat(a.css("font-size"))),"px"==a.css("line-height").slice(-2).toLowerCase()?a.data("line-height",parseFloat(a.css("line-height"))):a.data("line-height",parseFloat(a.css("line-height"))*Y(a,"font-size")),a.data("padding-top",parseFloat(a.css("padding-top"))),a.data("padding-right",parseFloat(a.css("padding-right"))),a.data("padding-bottom",parseFloat(a.css("padding-bottom"))),a.data("padding-left",parseFloat(a.css("padding-left"))),a.data("opacity",parseFloat(a.css("opacity"))),b||a.css("display","none")}function H(){e.responsive&&a(window).resize(function(){w!=a(window).width()&&("full-width"==e.layout&&U()!=a(f).width()||a(f).width()<U()||a(f).width()>U()&&U()<e.startWidth)&&M()}),f.find(g).find(".cs-controls > .cs-previous").click(function(){fa(X())}),f.find(g).find(".cs-controls > .cs-next").click(function(){fa(W())}),e.enableSwipe&&(f.find(g).on("swipeleft",function(){T(),fa(W())}),f.find(g).on("swiperight",function(){T(),fa(X())})),f.find(g).find(".cs-navigation > .cs-slide-link").click(function(){fa(a(this).index())}),e.pauseOnHover&&(f.find(g).find(h).hover(function(){S()}),f.find(g).find(h).mouseleave(function(){T()}))}function I(){function c(){f.find(g).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),f.find(g).find(".cs-preloader").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")}),f.find(g).find(".cs-preloader > .cs-bg").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")})}f.find(g).find(h).css("visibility","hidden"),f.find(g).find(".cs-progress-bar").css("display","none"),f.find(g).find(".cs-navigation").css("display","none"),f.find(g).find(".cs-controls").css("display","none");var b=$(0).css("background-image");b=b.replace(/^url\(["']?/,"").replace(/["']?\)$/,""),b.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?a("<img>").load(function(){c()}).attr("src",b).each(function(){this.complete&&a(this).load()}):c()}function J(){f.find(g).find(h).css("visibility","visible"),f.find(g).find(".cs-progress-bar").css("display","block"),f.find(g).find(".cs-navigation").css("display","block"),f.find(g).find(".cs-controls").css("display","block"),ya($(0)),$(0).finish(),f.find(g).find(".cs-preloader").animate({opacity:0},300,function(){f.find(g).find(".cs-preloader").remove()})}function K(){var b,c,a=e.layout;switch(a){case"fixed":b=e.startWidth,c=e.startHeight,f.find(g).css({width:P(b),height:P(c)}),Z().css({width:P(b),height:P(c)});break;case"full-width":b=f.width(),c=e.startHeight,f.find(g).css({width:b,height:P(c)}),Z().css({width:b,height:P(c)});break;default:return!1}}function L(a){var b=(V()-e.startHeight)/2,c=(U()-e.startWidth)/2,d=0,f=0;return b>0&&(d=b),c>0&&(f=c),{top:d,left:f}}function M(){e.beforeSetResponsive();var b=Z();R(!0),b.each(function(){var b=a(this),c=b.find(j);b.finish(),ya(b),b.finish(),c.each(function(){var b=a(this);b.finish(),Aa(b),b.finish(),ja(b)&&ma(b)})}),O(),K(),b.each(function(){var b=a(this),c=b.find(j);c.each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);N(b)}),N(b),b.finish(),Ba(b),b.finish(),ja(b)&&ma(b)}),b.finish(),za(b),b.finish()}),w=a(window).width(),Q()}function N(a){a.css({top:P(Y(a,"top")+L(a).top),left:P(Y(a,"left")+L(a).left),"padding-top":P(Y(a,"padding-top")),"padding-right":P(Y(a,"padding-right")),"padding-bottom":P(Y(a,"padding-bottom")),"padding-left":P(Y(a,"padding-left"))}),a.is("input")||a.is("button")||a.text().trim().length?a.css({"line-height":P(Y(a,"line-height"))+"px","letter-spacing":P(Y(a,"letter-spacing")),"font-size":P(Y(a,"font-size"))}):a.css({width:P(Y(a,"width")),height:P(Y(a,"height"))})}function O(){var a=f.width(),b=e.startWidth;v=a>=b||!e.responsive?1:a/b}function P(a){return a*v}function Q(){e.automaticSlide?ba():ga(l),p=!1}function R(b){for(var c=0;c<r.length;c++)r[c].clear();for(var c=0;c<s.length;c++)s[c].clear();q.clear(),Z().each(function(){var c=a(this);b?c.finish():c.stop(!0,!0),c.find(j).each(function(){var c=a(this);b?c.finish():c.stop(!0,!0)})}),da()}function S(){if(!m&&n){e.beforePause();var a=f.find(g).find(".cs-progress-bar");a.stop(!0),q.pause(),m=!0}}function T(){if(m&&n){e.beforeResume();var a=f.find(g).find(".cs-progress-bar"),c=(Y($(l),"time"),q.getRemaining());a.animate({width:"100%"},c),q.resume(),m=!1}}function U(){return f.find(g).width()}function V(){return f.find(g).height()}function W(){return l+1==k?0:l+1}function X(){return l-1<0?k-1:l-1}function Y(a,b){var c;switch(c=!!a.parent("ul").hasClass("cs-slides"),b){case"ease-in":return c?isNaN(parseInt(a.data(b)))?e.slidesEaseIn:parseInt(a.data(b)):isNaN(parseInt(a.data(b)))?e.elementsEaseIn:parseInt(a.data(b));case"ease-out":return c?isNaN(parseInt(a.data(b)))?e.slidesEaseOut:parseInt(a.data(b)):isNaN(parseInt(a.data(b)))?e.elementsEaseOut:parseInt(a.data(b));case"delay":return isNaN(parseInt(a.data(b)))?e.elementsDelay:parseInt(a.data(b));case"time":return c?isNaN(parseInt(a.data(b)))?e.slidesTime:parseInt(a.data(b)):"all"==a.data(b)?"all":isNaN(parseInt(a.data(b)))?e.itemsTime:parseInt(a.data(b));case"ignore-ease-out":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.videoAutoplay;case"loop":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.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(a.data(b)))?0:parseFloat(a.data(b));case"in":case"out":case"opacity":return a.data(b);default:return!1}}function Z(){return f.find(g).find(h).find(i)}function $(a){return Z().eq(a)}function _(a,b){var c,d,e=b;this.pause=function(){clearTimeout(c),e-=new Date-d},this.resume=function(){d=new Date,clearTimeout(c),c=window.setTimeout(function(){a()},e)},this.clear=function(){clearTimeout(c)},this.getRemaining=function(){return e},this.resume()}function aa(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ba(){ga(l).done(function(){m||(l=W(),ba())})}function ca(){var a=f.find(g).find(".cs-progress-bar");da(),a.animate({width:"100%"},Y($(l),"time"))}function da(){var a=f.find(g).find(".cs-progress-bar");a.stop(),a.css("width",0)}function ea(){var b=f.find(g).find(".cs-navigation"),c=b.find("> .cs-slide-link");c.each(function(){var b=a(this);b.index()==l?b.addClass("cs-active"):b.removeClass("cs-active")})}function fa(a){a!=l&&(n||o)&&(R(!1),ia(l,!1,!0).done(function(){l=a,Q()}))}function ga(b){e.beforeSlideStart();var c=new a.Deferred;o=!1;for(var d=0;d<r.length;d++)r[d].clear();for(var d=0;d<s.length;d++)s[d].clear();q.clear(),$(b).finish(),za(b),$(b).finish();var f=$(b).find(j);return f.each(function(){var b=a(this);b.finish(),Ba(b),b.finish()}),ea(),ha(b),e.automaticSlide?ia(b,!0,!0).done(function(){o=!0,c.resolve()}):ia(b,!0,!1).done(function(){o=!0,c.resolve()}),c.promise()}function ha(b){var c=$(b),d=c.find(j),e=0,f=!1,g=new a.Deferred;return n=!1,ya(b).done(function(){ca(),n=!0,f=!0,f&&e==d.length&&g.resolve()}),d.each(function(){var b=a(this),c=Y(b,"delay");s.push(new _(function(){Aa(b).done(function(){ja(b)&&ka(b),e++,f&&e==d.length&&g.resolve()})},c))}),g.promise()}function ia(b,c,d){var e=$(b),f=e.find(j),g=c?Y(e,"time")+Y(e,"ease-in"):0,h=0,i=!1,k=new a.Deferred;return f.each(function(){var e=a(this),g=Y(e,"time");if("all"!=g){var j=c?g:0;Y(e,"ignore-ease-out")&&(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve())),r.push(new _(function(){Ba(e).done(function(){Y(e,"ignore-ease-out")||(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve()))})},j))}}),q=new _(function(){n=!1,da(),i=!0,f.length==h&&i&&d&&(la(b),za(b),k.resolve()),d?f.each(function(){var c=a(this),e=Y(c,"time");"all"==e&&(Y(c,"ignore-ease-out")&&(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve())),Ba(c).done(function(){Y(c,"ignore-ease-out")||(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve()))}))}):k.resolve()},g),k.promise()}function ja(a){return na(a)||ta(a)}function ka(a){na(a)?qa(a):va(a)}function la(a){ra(a),wa(a)}function ma(a){na(a)?sa(a):xa(a)}function na(a){return a.hasClass("cs-yt-iframe")}function oa(a){return t[a.attr("id")].player}function pa(a){return oa(a).getPlayerState()}function qa(a){!Y(a,"autoplay")||t[a.attr("id")].played_once||aa()||oa(a).playVideo(),2==pa(a)&&oa(a).playVideo(),t[a.attr("id")].played_once=!0}function ra(b){$(b).each(function(){var b=a(this);b.find(j+".cs-yt-iframe").each(function(){sa(a(this))})})}function sa(a){1==pa(a)&&oa(a).pauseVideo()}function ta(a){return a.hasClass("cs-vimeo-iframe")}function ua(a){return u[a.attr("id")].player}function va(a){!Y(a,"autoplay")||u[a.attr("id")].played_once||aa()||ua(a).api("play"),ua(a).api("paused")&&!u[a.attr("id")].ended&&u[a.attr("id")].played_once&&ua(a).api("play")}function wa(b){$(b).each(function(){var b=a(this);b.find(j+".cs-vimeo-iframe").each(function(){xa(a(this))})})}function xa(a){ua(a).api("pause")}function ya(b){var c=$(b),d=Y(c,"in"),e=Y(c,"ease-in"),f=new a.Deferred;if("block"==c.css("display"))return f.resolve().promise();if(p)return c.css({display:"block",top:0,left:0,opacity:Y(c,"opacity")}),f.resolve().promise();switch(d){case"fade":c.css({display:"block",top:0,left:0,opacity:0}),c.animate({opacity:Y(c,"opacity")},e,function(){f.resolve()});break;case"fadeLeft":c.css({display:"block",top:0,left:U(),opacity:0}),c.animate({opacity:Y(c,"opacity"),left:0},e,function(){f.resolve()});break;case"fadeRight":c.css({display:"block",top:0,left:-U(),opacity:0}),c.animate({opacity:Y(c,"opacity"),left:0},e,function(){f.resolve()});break;case"slideLeft":c.css({display:"block",top:0,left:U(),opacity:Y(c,"opacity")}),c.animate({left:0},e,function(){f.resolve()});break;case"slideRight":c.css({display:"block",top:0,left:-U(),opacity:Y(c,"opacity")}),c.animate({left:0},e,function(){f.resolve()});break;case"slideUp":c.css({display:"block",top:V(),left:0,opacity:Y(c,"opacity")}),c.animate({top:0},e,function(){f.resolve()});break;case"slideDown":c.css({display:"block",top:-V(),left:0,opacity:Y(c,"opacity")}),c.animate({top:0},e,function(){f.resolve()});break;default:c.css({display:"block",top:0,left:0,opacity:Y(c,"opacity")}),f.resolve()}return f.promise()}function za(b){var c=$(b),d=Y(c,"out"),e=Y(c,"ease-out"),f=new a.Deferred;if("none"==c.css("display"))return f.resolve().promise();switch(d){case"fade":c.animate({opacity:0},e,function(){c.css({display:"none",opacity:Y(c,"opacity")}),f.resolve()});break;case"fadeLeft":c.animate({opacity:0,left:-U()},e,function(){c.css({display:"none",opacity:Y(c,"opacity"),left:0}),f.resolve()});break;case"fadeRight":c.animate({opacity:0,left:U()},e,function(){c.css({display:"none",opacity:Y(c,"opacity"),left:0}),f.resolve()});break;case"slideLeft":c.animate({left:-U()},e,function(){c.css({display:"none",left:0}),f.resolve()});break;case"slideRight":c.animate({left:U()},e,function(){c.css({display:"none",left:0}),f.resolve()});break;case"slideUp":c.animate({top:-V()},e,function(){c.css({display:"none",top:0}),f.resolve()});break;case"slideDown":c.animate({top:V()},e,function(){c.css({display:"none",top:0}),f.resolve()});break;default:c.css({display:"none"}),f.resolve()}return f.promise()}function Aa(b){var c=b.outerWidth(),d=b.outerHeight(),e=Y(b,"in"),f=Y(b,"ease-in"),g=Y(b,"top"),h=Y(b,"left"),i=new a.Deferred;if("block"==b.css("display"))return i.resolve().promise();switch(e){case"slideDown":b.css({display:"block",top:-d,left:P(h+L(b).left),opacity:Y(b,"opacity")}).animate({top:P(g+L(b).top)},f,function(){i.resolve()});break;case"slideUp":b.css({display:"block",top:V(),left:P(h+L(b).left),opacity:Y(b,"opacity")}).animate({top:P(g+L(b).top)},f,function(){i.resolve()});break;case"slideLeft":b.css({display:"block",top:P(g+L(b).top),left:U(),opacity:Y(b,"opacity")}).animate({left:P(h+L(b).left)},f,function(){i.resolve()});break;case"slideRight":b.css({display:"block",top:P(g+L(b).top),left:-c,opacity:Y(b,"opacity")}).animate({left:P(h+L(b).left)},f,function(){i.resolve()});break;case"fade":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left),opacity:0}).animate({opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeDown":b.css({display:"block",top:-d,left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeUp":b.css({display:"block",top:V(),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeLeft":b.css({display:"block",top:P(g+L(b).top),left:U(),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeRight":b.css({display:"block",top:P(g+L(b).top),left:-c,opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallDown":b.css({display:"block",top:P(g+L(b).top-30),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallUp":b.css({display:"block",top:P(g+L(b).top+30),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallLeft":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left+30),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallRight":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left-30),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;default:b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left),opacity:Y(b,"opacity")}),i.resolve()}return i.promise()}function Ba(b){var c=b.outerWidth(),d=b.outerHeight(),e=Y(b,"out"),f=Y(b,"ease-out"),g=new a.Deferred;if("none"==b.css("display"))return g.resolve().promise();switch(e){case"slideDown":b.animate({top:V()},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideUp":b.animate({top:-d},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideLeft":b.animate({left:-c},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideRight":b.animate({left:U()},f,function(){b.css({display:"none"}),g.resolve()});break;case"fade":b.animate({opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeDown":b.animate({top:V(),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeUp":b.animate({top:-d,opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeLeft":b.animate({left:-c,opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeRight":b.animate({left:U(),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallDown":b.animate({top:P(Y(b,"top")+L(b).top+30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallUp":b.animate({top:P(Y(b,"top")+L(b).top-30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallLeft":b.animate({left:P(Y(b,"left")+L(b).left-30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallRight":b.animate({left:P(Y(b,"left")+L(b).left+30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;default:b.css({display:"none"}),g.resolve()}return g.promise()}var k,f=a(d),g="div.crellyslider",h="ul.cs-slides",i="li.cs-slide",j="> *",l=0,m=!1,n=!1,o=!1,p=!0,q=new _(function(){},0),r=new Array,s=new Array,t={},u={},v=1,w=0;if(!crellyslider_youtube_api_ready&&y("youtube")&&b(),!crellyslider_vimeo_api_ready&&y("vimeo")&&c(),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&"undefined"!=typeof YT.Player)z();else var x=setInterval(function(){"undefined"!=typeof YT&&"undefined"!=typeof YT.Player&&(clearInterval(x),z())},100);this.resume=function(){T()},this.pause=function(){S()},this.nextSlide=function(){fa(W())},this.previousSlide=function(){fa(X())},this.changeSlide=function(a){fa(a)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return k}},a.fn.crellySlider=function(b){var c=a.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(){}},b);return this.each(function(){if(void 0==a(this).data("crellySlider")){var b=new a.CrellySlider(this,c);a(this).data("crellySlider",b)}})}}(jQuery);
readme.txt CHANGED
@@ -1,158 +1,161 @@
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: 4.8
7
- Stable tag: 1.2.2
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.2.2 =
58
- * Bug fix: fixed incompatibility with WordPress 4.8
59
-
60
- = 1.2.1 =
61
- * Bug fix: if the user setting "Disable the visual editor when writing" was enabled, there were JavaScript errors
62
- * Other minor changes and bug fixes
63
-
64
- = 1.2.0 =
65
- * New feature: texts can be edited with the default WordPress editor (TinyMCE)
66
- * New feature: the order of the slides can be set to "random"
67
- * New feature: you can select the first slide that will be displayed
68
- * New feature: slides can be marked as "draft"
69
- * New feature: Crelly Slider is now compatible with WP Offload S3
70
- * Improvement: the YouTube and the Vimeo APIs won't be loaded unless there is a video in the slider
71
- * 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
72
- * 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
73
- * Bug fix: improved compatibility for some web hosting providers that restricted the import/export functions
74
- * Bug fix: when you added a really large image element, the element options were covered by the image
75
- * Other minor changes and bug fixes
76
-
77
- = 1.1.2 =
78
- * Bug fix: security issues
79
- * Other minor changes and bug fixes
80
-
81
- = 1.1.1 =
82
- * Bug fix: sometimes, the slider got stuck at loading screen
83
-
84
- = 1.1.0 =
85
- * 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>)
86
- * New feature: Duplicate sliders and slides
87
- * New feature: Import/Export sliders
88
- * New feature: Support for YouTube and Vimeo videos
89
- * New feature: The slides can be linked (the entire background is a link)
90
- * 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
91
- * New feature: Navigation and controls are much better looking now
92
- * New feature: Added public methods to control the slider. pause(), resume(), nextSlide(), previousSlide(), changeSlide(slide_index), getCurrentSlide(), getTotalSlides()
93
- * New feature: Slides background color can now be set manually
94
- * New feature: Custom CSS classes can now be added to elements
95
- * New feature: Added "Center vertically" and "Center horizontally" buttons to align elements
96
- * New feature: The slides background image can now be quickly set as "responsive full width image" or "pattern"
97
- * Bug fix: Sometimes slides and elements weren't saved correctly
98
- * Bug fix: Text elements were displayed on two lines when an inline tag was added
99
- * Bug fix: When automatic slide was set to "no", the out animations were still performed
100
- * Bug fix: When the backend interface was loading there were some graphical glitches
101
- * Bug fix: Background position wasn't correct on Firefox
102
- * 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
103
- * Minor change: dropped support for IE < 11
104
- * Other minor changes and bug fixes
105
-
106
- = 0.8.2 =
107
- * Fixed: broken admin layout on Firefox (<a href="https://github.com/fabiorino/crelly-slider/pull/5">Thanks eduardoarandah</a>)
108
- * Crelly Slider is now translated in Spanish (<a href="https://github.com/eduardoarandah/crelly-slider/commit/3b7d49b63d9dbe60c420669edea898de34cd720f">Again, thanks eduardoarandah</a>) and in Italian!
109
- * Do you want to translate the plugin in your language? <a href="http://fabiorino1.altervista.org/projects/crellyslider/documentation/#translate">Check the documentation</a>
110
-
111
- = 0.8.1 =
112
- * Fixed: padding broken in IE8
113
- * Fixed: background images with a long name weren't stored correctly into the database
114
-
115
- = 0.8.0 =
116
- * 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
117
- * Added: support for touch, swipe and drag
118
- * Improved progress bar animation: now has a cool swing effect
119
- * The current editing slide tab is now highlighted
120
- * Fixed: before preloader, for about a second, the slider was displayed as an unordered list
121
- * Fixed: now if you specify the opacity in custom CSS, that value won't be overwritten
122
- * Changed: by default, line-height is now 1.5. Please, if you want to change it, specify a pure number to avoid compatibility issues
123
- * Fixed: blue border around linked images in IE
124
- * The text / HTML of a text element is now wrapped in a textarea (no more in an input)
125
- * Fixed: apostrophes in text elements are now displayed correctly
126
- * Removed useless file from the package.
127
- * Removed afterSlideEnd(), afterSetResponsive(), afterPause(). They were useless
128
- * Other minor bug fixes and changes
129
-
130
- = 0.7.0 =
131
- * Fixed "Error saving elements" if there are no elements
132
-
133
- = 0.6.9 =
134
- * Added the possibility to insert links in images and texts
135
- * Added slider preloader (with a gif image)
136
- * Added icon in the style of WordPress to the lateral sidebar in the admin panel
137
- * Added confirm alert when you delete a slider
138
- * Fixed: now HTML codes inserted in text elements are working properly
139
- * Fixed: when you selected an element into the editing area weren't shown the correct element options
140
- * Fixed invisible progress bar in Internet Explorer 8
141
- * Fixed invisible slider navigation in Internet Explorer 8
142
- * Changed: text output is now wrapped by a "div" and not a "p" for a better compatibility and a cleaner code
143
- * Changed name to the "add image" button in the element options
144
- * Other minor bug fixes and changes
145
-
146
- = 0.6.8 =
147
- * Added callback functions: beforeStart, beforeSetResponsive, afterSetResponsive, beforeSlideStart, afterSlideEnd, beforePause, afterPause, beforeResume
148
- * Fixed responsive methods that restarted the slide in particular moments uselessly
149
-
150
- = 0.6.7 =
151
- * Fixed "Add image" not working on Firefox and Internet Explorer
152
- * Fixed "Duplicate element" on animations
153
-
154
- = 0.6.6 =
155
- * Fixed directory error
156
-
157
- = 0.6.5 =
158
- * 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: 4.9
7
+ Stable tag: 1.2.3
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.2.3 =
58
+ * Bug fix: align left/center/right buttons not working
59
+
60
+ = 1.2.2 =
61
+ * Bug fix: fixed incompatibility with WordPress 4.8
62
+
63
+ = 1.2.1 =
64
+ * Bug fix: if the user setting "Disable the visual editor when writing" was enabled, there were JavaScript errors
65
+ * Other minor changes and bug fixes
66
+
67
+ = 1.2.0 =
68
+ * New feature: texts can be edited with the default WordPress editor (TinyMCE)
69
+ * New feature: the order of the slides can be set to "random"
70
+ * New feature: you can select the first slide that will be displayed
71
+ * New feature: slides can be marked as "draft"
72
+ * New feature: Crelly Slider is now compatible with WP Offload S3
73
+ * Improvement: the YouTube and the Vimeo APIs won't be loaded unless there is a video in the slider
74
+ * 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
75
+ * 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
76
+ * Bug fix: improved compatibility for some web hosting providers that restricted the import/export functions
77
+ * Bug fix: when you added a really large image element, the element options were covered by the image
78
+ * Other minor changes and bug fixes
79
+
80
+ = 1.1.2 =
81
+ * Bug fix: security issues
82
+ * Other minor changes and bug fixes
83
+
84
+ = 1.1.1 =
85
+ * Bug fix: sometimes, the slider got stuck at loading screen
86
+
87
+ = 1.1.0 =
88
+ * 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>)
89
+ * New feature: Duplicate sliders and slides
90
+ * New feature: Import/Export sliders
91
+ * New feature: Support for YouTube and Vimeo videos
92
+ * New feature: The slides can be linked (the entire background is a link)
93
+ * 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
94
+ * New feature: Navigation and controls are much better looking now
95
+ * New feature: Added public methods to control the slider. pause(), resume(), nextSlide(), previousSlide(), changeSlide(slide_index), getCurrentSlide(), getTotalSlides()
96
+ * New feature: Slides background color can now be set manually
97
+ * New feature: Custom CSS classes can now be added to elements
98
+ * New feature: Added "Center vertically" and "Center horizontally" buttons to align elements
99
+ * New feature: The slides background image can now be quickly set as "responsive full width image" or "pattern"
100
+ * Bug fix: Sometimes slides and elements weren't saved correctly
101
+ * Bug fix: Text elements were displayed on two lines when an inline tag was added
102
+ * Bug fix: When automatic slide was set to "no", the out animations were still performed
103
+ * Bug fix: When the backend interface was loading there were some graphical glitches
104
+ * Bug fix: Background position wasn't correct on Firefox
105
+ * 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
106
+ * Minor change: dropped support for IE < 11
107
+ * Other minor changes and bug fixes
108
+
109
+ = 0.8.2 =
110
+ * Fixed: broken admin layout on Firefox (<a href="https://github.com/fabiorino/crelly-slider/pull/5">Thanks eduardoarandah</a>)
111
+ * Crelly Slider is now translated in Spanish (<a href="https://github.com/eduardoarandah/crelly-slider/commit/3b7d49b63d9dbe60c420669edea898de34cd720f">Again, thanks eduardoarandah</a>) and in Italian!
112
+ * Do you want to translate the plugin in your language? <a href="http://fabiorino1.altervista.org/projects/crellyslider/documentation/#translate">Check the documentation</a>
113
+
114
+ = 0.8.1 =
115
+ * Fixed: padding broken in IE8
116
+ * Fixed: background images with a long name weren't stored correctly into the database
117
+
118
+ = 0.8.0 =
119
+ * 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
120
+ * Added: support for touch, swipe and drag
121
+ * Improved progress bar animation: now has a cool swing effect
122
+ * The current editing slide tab is now highlighted
123
+ * Fixed: before preloader, for about a second, the slider was displayed as an unordered list
124
+ * Fixed: now if you specify the opacity in custom CSS, that value won't be overwritten
125
+ * Changed: by default, line-height is now 1.5. Please, if you want to change it, specify a pure number to avoid compatibility issues
126
+ * Fixed: blue border around linked images in IE
127
+ * The text / HTML of a text element is now wrapped in a textarea (no more in an input)
128
+ * Fixed: apostrophes in text elements are now displayed correctly
129
+ * Removed useless file from the package.
130
+ * Removed afterSlideEnd(), afterSetResponsive(), afterPause(). They were useless
131
+ * Other minor bug fixes and changes
132
+
133
+ = 0.7.0 =
134
+ * Fixed "Error saving elements" if there are no elements
135
+
136
+ = 0.6.9 =
137
+ * Added the possibility to insert links in images and texts
138
+ * Added slider preloader (with a gif image)
139
+ * Added icon in the style of WordPress to the lateral sidebar in the admin panel
140
+ * Added confirm alert when you delete a slider
141
+ * Fixed: now HTML codes inserted in text elements are working properly
142
+ * Fixed: when you selected an element into the editing area weren't shown the correct element options
143
+ * Fixed invisible progress bar in Internet Explorer 8
144
+ * Fixed invisible slider navigation in Internet Explorer 8
145
+ * Changed: text output is now wrapped by a "div" and not a "p" for a better compatibility and a cleaner code
146
+ * Changed name to the "add image" button in the element options
147
+ * Other minor bug fixes and changes
148
+
149
+ = 0.6.8 =
150
+ * Added callback functions: beforeStart, beforeSetResponsive, afterSetResponsive, beforeSlideStart, afterSlideEnd, beforePause, afterPause, beforeResume
151
+ * Fixed responsive methods that restarted the slide in particular moments uselessly
152
+
153
+ = 0.6.7 =
154
+ * Fixed "Add image" not working on Firefox and Internet Explorer
155
+ * Fixed "Duplicate element" on animations
156
+
157
+ = 0.6.6 =
158
+ * Fixed directory error
159
+
160
+ = 0.6.5 =
161
+ * Initial release
wordpress/admin.php CHANGED
@@ -1,282 +1,282 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- class CrellySliderAdmin {
5
-
6
- // Creates the menu and the admin panel
7
- public static function showSettings() {
8
- add_action('admin_menu', 'CrellySliderAdmin::pluginMenus');
9
- }
10
-
11
- public static function pluginMenus() {
12
- add_menu_page('Crelly Slider', 'Crelly Slider', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
13
- }
14
-
15
- // Go to the correct page
16
- public static function displayPage() {
17
- if(!isset($_GET['view'])) {
18
- $index = 'home';
19
- }
20
- else {
21
- $index = esc_sql($_GET['view']);
22
- if($index != 'add' && $index != 'edit') {
23
- die();
24
- }
25
- }
26
-
27
- global $wpdb;
28
-
29
- // Check what the user is doing: is it adding or modifying a slider?
30
- $edit = true;
31
- $id = NULL;
32
- if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
33
- $edit = false;
34
- $id = NULL;
35
- }
36
- else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
37
- $edit = true;
38
- $id = isset($_GET['id']) ? esc_sql($_GET['id']) : NULL;
39
- if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
40
- die();
41
- }
42
-
43
- $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
44
- }
45
-
46
- ?>
47
- <div
48
- class="wrap cs-admin"
49
- <?php if($edit && isset($slider)): ?>
50
- style="width: <?php echo esc_attr($slider->startWidth); ?>px;"
51
- <?php else: ?>
52
- style="width: 1140px;"
53
- <?php endif; ?>
54
- >
55
-
56
- <noscript class="cs-no-js">
57
- <div class="cs-message cs-message-error" style="display: block;"><?php _e('JavaScript must be enabled to view this page correctly.', 'crelly-slider'); ?></div>
58
- </noscript>
59
-
60
- <div class="cs-message cs-message-ok" style="display: none;"><?php _e('Operation completed successfully.', 'crelly-slider'); ?></div>
61
- <div class="cs-message cs-message-error" style="display: none;"><?php _e('Something went wrong.', 'crelly-slider'); ?></div>
62
- <?php if(! $edit): ?>
63
- <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>
64
- <?php endif; ?>
65
-
66
- <h2 class="cs-logo" title="Crelly Slider">
67
- <a href="?page=crellyslider">
68
- <img src="<?php echo CS_PLUGIN_URL . '/wordpress/images/logo2.png' ?>" alt="Crelly Slider" />
69
- </a>
70
- </h2>
71
-
72
- <br />
73
- <br />
74
-
75
- <?php
76
-
77
- switch($index) {
78
- case 'home':
79
- self::displayHome();
80
- break;
81
-
82
- case 'add':
83
- case 'edit':
84
- self::displaySlider();
85
- break;
86
- }
87
-
88
- ?>
89
-
90
- </div>
91
- <?php
92
- }
93
-
94
- // Displays the main plugin page
95
- public static function displayHome() {
96
- ?>
97
- <div class="cs-home">
98
- <?php require_once CS_PATH . 'wordpress/home.php'; ?>
99
- </div>
100
- <?php
101
- }
102
-
103
- // Displays the slider page in wich you can add or modify sliders, slides and elements
104
- public static function displaySlider() {
105
- global $wpdb;
106
-
107
- $edit = true;
108
- $id = NULL;
109
- if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
110
- $edit = false;
111
- $id = NULL;
112
- }
113
- else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
114
- $edit = true;
115
- $id = isset($_GET['id']) ? esc_sql($_GET['id']) : NULL;
116
- if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
117
- die();
118
- }
119
-
120
- $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
121
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $id));
122
- // The elements variable are updated in the foreach() loop directly in the "slides.php" file
123
- }
124
- ?>
125
-
126
- <div class="cs-useless-wp_editor" style="display: none;">
127
- <?php
128
- // I need to call wp_editor just to include TinyMCE's javascript
129
- wp_editor('', 'cs-element-editor-useless');
130
- ?>
131
- </div>
132
-
133
- <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
134
- <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
135
- <?php if($edit): ?>
136
- <ul>
137
-
138
- <li>
139
- <span class="cs-icon icon-settings"></span>
140
- <a id="cs-show-slider-settings"><?php _e('Slider Settings', 'crelly-slider'); ?></a>
141
- </li>
142
- <li>
143
- <span class="cs-icon icon-edit"></span>
144
- <a id="cs-show-slides"><?php _e('Edit Slides', 'crelly-slider'); ?></a>
145
- </li>
146
- </ul>
147
-
148
- <br />
149
- <br />
150
- <br />
151
- <?php endif; ?>
152
-
153
- <?php require_once CS_PATH . 'wordpress/slider.php'; ?>
154
- <?php
155
- if($edit) {
156
- require_once CS_PATH . 'wordpress/elements.php';
157
- require_once CS_PATH . 'wordpress/slides.php';
158
- }
159
- ?>
160
- </div>
161
-
162
- <br />
163
-
164
- <a class="cs-button cs-is-primary cs-save-settings" data-id="<?php echo $id; ?>" href="#"><?php _e('Save Settings', 'crelly-slider'); ?></a>
165
-
166
- </div>
167
-
168
- <?php
169
- }
170
-
171
- // Avoid incompatibility issues
172
- public static function isAdminJs() {
173
- ?>
174
- <script type="text/javascript">
175
- var crellyslider_is_wordpress_admin = true;
176
- var crellyslider_locale = '<?php echo get_locale(); ?>';
177
- </script>
178
- <?php
179
- }
180
-
181
- public static function setIsAdminJs() {
182
- add_action('admin_enqueue_scripts', 'CrellySliderAdmin::isAdminJs');
183
- }
184
-
185
- // Include CSS and JavaScript
186
- public static function enqueues() {
187
- wp_enqueue_script('jquery-ui-draggable');
188
- wp_enqueue_script('jquery-ui-tabs');
189
- wp_enqueue_script('jquery-ui-sortable');
190
- wp_enqueue_script('jquery-ui-dialog');
191
- wp_enqueue_style('wp-color-picker');
192
- wp_enqueue_media();
193
-
194
- wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker'), CS_VERSION, true);
195
-
196
- self::localization();
197
-
198
- wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
199
- wp_enqueue_script('crellyslider-admin');
200
-
201
- $wp_version = get_bloginfo('version');
202
- $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
203
- if($wp_version < 3.8) {
204
- ?>
205
- <style type="text/css">
206
- #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
207
- background-image: url('<?php echo $menu_icon_url; ?>');
208
- background-repeat: no-repeat;
209
- background-position: -20px center;
210
- }
211
-
212
- #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
213
- background-position: -20px center;
214
- }
215
-
216
- #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
217
- background-position: 8px center;
218
- }
219
-
220
- #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
221
- background-position: 8px center;
222
- }
223
- </style>
224
- <?php
225
- }
226
- else {
227
- ?>
228
- <style type="text/css">
229
- #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
230
- background-image: url('<?php echo $menu_icon_url; ?>');
231
- background-repeat: no-repeat;
232
- background-position: 8px center;
233
- opacity: .6;
234
- filter: alpha(opacity=60);
235
- }
236
-
237
- #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
238
- background-position: -20px center;
239
- opacity: 1;
240
- filter: alpha(opacity=100);
241
- }
242
-
243
- #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
244
- opacity: 1;
245
- filter: alpha(opacity=100);
246
- }
247
-
248
- #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
249
- background-position: 8px center;
250
- opacity: 1;
251
- filter: alpha(opacity=100);
252
- }
253
- </style>
254
- <?php
255
- }
256
- }
257
-
258
- public static function setEnqueues() {
259
- add_action('admin_enqueue_scripts', 'CrellySliderAdmin::enqueues');
260
- }
261
-
262
- public static function localization() {
263
- // Here the translations for the admin.js file
264
- $crellyslider_translations = array(
265
- 'slide' => __('Slide', 'crelly-slider'),
266
- 'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crelly-slider'),
267
- 'slide_delete_just_one' => __('You can\'t delete this. You must have at least one slide.', 'crelly-slider'),
268
- 'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crelly-slider'),
269
- 'text_element_default_html' => __('Text element', 'crelly-slider'),
270
- 'slide_live_preview' => __('Live preview', 'crelly-slider'),
271
- 'slide_stop_preview' => __('Stop preview', 'crelly-slider'),
272
- 'duplicate_slide' => __('Duplicate slide', 'crelly-slider'),
273
- 'remove_slide' => __('Delete slide', 'crelly-slider'),
274
- 'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
275
- 'switch_editor' => __('Switch editor', 'crelly-slider'),
276
- );
277
- wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
278
- }
279
-
280
- }
281
-
282
- ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class CrellySliderAdmin {
5
+
6
+ // Creates the menu and the admin panel
7
+ public static function showSettings() {
8
+ add_action('admin_menu', 'CrellySliderAdmin::pluginMenus');
9
+ }
10
+
11
+ public static function pluginMenus() {
12
+ add_menu_page('Crelly Slider', 'Crelly Slider', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
13
+ }
14
+
15
+ // Go to the correct page
16
+ public static function displayPage() {
17
+ if(!isset($_GET['view'])) {
18
+ $index = 'home';
19
+ }
20
+ else {
21
+ $index = esc_sql($_GET['view']);
22
+ if($index != 'add' && $index != 'edit') {
23
+ die();
24
+ }
25
+ }
26
+
27
+ global $wpdb;
28
+
29
+ // Check what the user is doing: is it adding or modifying a slider?
30
+ $edit = true;
31
+ $id = NULL;
32
+ if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
33
+ $edit = false;
34
+ $id = NULL;
35
+ }
36
+ else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
37
+ $edit = true;
38
+ $id = isset($_GET['id']) ? esc_sql($_GET['id']) : NULL;
39
+ if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
40
+ die();
41
+ }
42
+
43
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
44
+ }
45
+
46
+ ?>
47
+ <div
48
+ class="wrap cs-admin"
49
+ <?php if($edit && isset($slider)): ?>
50
+ style="width: <?php echo esc_attr($slider->startWidth); ?>px;"
51
+ <?php else: ?>
52
+ style="width: 1140px;"
53
+ <?php endif; ?>
54
+ >
55
+
56
+ <noscript class="cs-no-js">
57
+ <div class="cs-message cs-message-error" style="display: block;"><?php _e('JavaScript must be enabled to view this page correctly.', 'crelly-slider'); ?></div>
58
+ </noscript>
59
+
60
+ <div class="cs-message cs-message-ok" style="display: none;"><?php _e('Operation completed successfully.', 'crelly-slider'); ?></div>
61
+ <div class="cs-message cs-message-error" style="display: none;"><?php _e('Something went wrong.', 'crelly-slider'); ?></div>
62
+ <?php if(! $edit): ?>
63
+ <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>
64
+ <?php endif; ?>
65
+
66
+ <h2 class="cs-logo" title="Crelly Slider">
67
+ <a href="?page=crellyslider">
68
+ <img src="<?php echo CS_PLUGIN_URL . '/wordpress/images/logo2.png' ?>" alt="Crelly Slider" />
69
+ </a>
70
+ </h2>
71
+
72
+ <br />
73
+ <br />
74
+
75
+ <?php
76
+
77
+ switch($index) {
78
+ case 'home':
79
+ self::displayHome();
80
+ break;
81
+
82
+ case 'add':
83
+ case 'edit':
84
+ self::displaySlider();
85
+ break;
86
+ }
87
+
88
+ ?>
89
+
90
+ </div>
91
+ <?php
92
+ }
93
+
94
+ // Displays the main plugin page
95
+ public static function displayHome() {
96
+ ?>
97
+ <div class="cs-home">
98
+ <?php require_once CS_PATH . 'wordpress/home.php'; ?>
99
+ </div>
100
+ <?php
101
+ }
102
+
103
+ // Displays the slider page in wich you can add or modify sliders, slides and elements
104
+ public static function displaySlider() {
105
+ global $wpdb;
106
+
107
+ $edit = true;
108
+ $id = NULL;
109
+ if(isset($_GET['view']) && esc_sql($_GET['view']) == 'add') {
110
+ $edit = false;
111
+ $id = NULL;
112
+ }
113
+ else if(isset($_GET['view']) && esc_sql($_GET['view']) == 'edit') {
114
+ $edit = true;
115
+ $id = isset($_GET['id']) ? (int)$_GET['id'] : NULL;
116
+ if($id == NULL || ($id != NULL && !CrellySliderCommon::sliderExists($id))) {
117
+ die();
118
+ }
119
+
120
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $id));
121
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $id));
122
+ // The elements variable are updated in the foreach() loop directly in the "slides.php" file
123
+ }
124
+ ?>
125
+
126
+ <div class="cs-useless-wp_editor" style="display: none;">
127
+ <?php
128
+ // I need to call wp_editor just to include TinyMCE's javascript
129
+ wp_editor('', 'cs-element-editor-useless');
130
+ ?>
131
+ </div>
132
+
133
+ <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
134
+ <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
135
+ <?php if($edit): ?>
136
+ <ul>
137
+
138
+ <li>
139
+ <span class="cs-icon icon-settings"></span>
140
+ <a id="cs-show-slider-settings"><?php _e('Slider Settings', 'crelly-slider'); ?></a>
141
+ </li>
142
+ <li>
143
+ <span class="cs-icon icon-edit"></span>
144
+ <a id="cs-show-slides"><?php _e('Edit Slides', 'crelly-slider'); ?></a>
145
+ </li>
146
+ </ul>
147
+
148
+ <br />
149
+ <br />
150
+ <br />
151
+ <?php endif; ?>
152
+
153
+ <?php require_once CS_PATH . 'wordpress/slider.php'; ?>
154
+ <?php
155
+ if($edit) {
156
+ require_once CS_PATH . 'wordpress/elements.php';
157
+ require_once CS_PATH . 'wordpress/slides.php';
158
+ }
159
+ ?>
160
+ </div>
161
+
162
+ <br />
163
+
164
+ <a class="cs-button cs-is-primary cs-save-settings" data-id="<?php echo $id; ?>" href="#"><?php _e('Save Settings', 'crelly-slider'); ?></a>
165
+
166
+ </div>
167
+
168
+ <?php
169
+ }
170
+
171
+ // Avoid incompatibility issues
172
+ public static function isAdminJs() {
173
+ ?>
174
+ <script type="text/javascript">
175
+ var crellyslider_is_wordpress_admin = true;
176
+ var crellyslider_locale = '<?php echo get_locale(); ?>';
177
+ </script>
178
+ <?php
179
+ }
180
+
181
+ public static function setIsAdminJs() {
182
+ add_action('admin_enqueue_scripts', 'CrellySliderAdmin::isAdminJs');
183
+ }
184
+
185
+ // Include CSS and JavaScript
186
+ public static function enqueues() {
187
+ wp_enqueue_script('jquery-ui-draggable');
188
+ wp_enqueue_script('jquery-ui-tabs');
189
+ wp_enqueue_script('jquery-ui-sortable');
190
+ wp_enqueue_script('jquery-ui-dialog');
191
+ wp_enqueue_style('wp-color-picker');
192
+ wp_enqueue_media();
193
+
194
+ wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker'), CS_VERSION, true);
195
+
196
+ self::localization();
197
+
198
+ wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
199
+ wp_enqueue_script('crellyslider-admin');
200
+
201
+ $wp_version = get_bloginfo('version');
202
+ $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
203
+ if($wp_version < 3.8) {
204
+ ?>
205
+ <style type="text/css">
206
+ #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
207
+ background-image: url('<?php echo $menu_icon_url; ?>');
208
+ background-repeat: no-repeat;
209
+ background-position: -20px center;
210
+ }
211
+
212
+ #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
213
+ background-position: -20px center;
214
+ }
215
+
216
+ #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
217
+ background-position: 8px center;
218
+ }
219
+
220
+ #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
221
+ background-position: 8px center;
222
+ }
223
+ </style>
224
+ <?php
225
+ }
226
+ else {
227
+ ?>
228
+ <style type="text/css">
229
+ #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
230
+ background-image: url('<?php echo $menu_icon_url; ?>');
231
+ background-repeat: no-repeat;
232
+ background-position: 8px center;
233
+ opacity: .6;
234
+ filter: alpha(opacity=60);
235
+ }
236
+
237
+ #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
238
+ background-position: -20px center;
239
+ opacity: 1;
240
+ filter: alpha(opacity=100);
241
+ }
242
+
243
+ #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
244
+ opacity: 1;
245
+ filter: alpha(opacity=100);
246
+ }
247
+
248
+ #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
249
+ background-position: 8px center;
250
+ opacity: 1;
251
+ filter: alpha(opacity=100);
252
+ }
253
+ </style>
254
+ <?php
255
+ }
256
+ }
257
+
258
+ public static function setEnqueues() {
259
+ add_action('admin_enqueue_scripts', 'CrellySliderAdmin::enqueues');
260
+ }
261
+
262
+ public static function localization() {
263
+ // Here the translations for the admin.js file
264
+ $crellyslider_translations = array(
265
+ 'slide' => __('Slide', 'crelly-slider'),
266
+ 'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crelly-slider'),
267
+ 'slide_delete_just_one' => __('You can\'t delete this. You must have at least one slide.', 'crelly-slider'),
268
+ 'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crelly-slider'),
269
+ 'text_element_default_html' => __('Text element', 'crelly-slider'),
270
+ 'slide_live_preview' => __('Live preview', 'crelly-slider'),
271
+ 'slide_stop_preview' => __('Stop preview', 'crelly-slider'),
272
+ 'duplicate_slide' => __('Duplicate slide', 'crelly-slider'),
273
+ 'remove_slide' => __('Delete slide', 'crelly-slider'),
274
+ 'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
275
+ 'switch_editor' => __('Switch editor', 'crelly-slider'),
276
+ );
277
+ wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
278
+ }
279
+
280
+ }
281
+
282
+ ?>
wordpress/ajax.php CHANGED
@@ -1,653 +1,653 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- /************************/
5
- /** EXTERNAL RESOURCES **/
6
- /************************/
7
-
8
- // Alternative to file_get_contents. If CURL is not installed, file_get_contents is called
9
- // http://stackoverflow.com/questions/3979802/alternative-to-file-get-contents
10
- function crellyslider_url_get_contents ($Url) {
11
- if (!function_exists('curl_init')){
12
- return file_get_contents($Url);
13
- }
14
- $ch = curl_init();
15
- curl_setopt($ch, CURLOPT_URL, $Url);
16
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
17
- $output = curl_exec($ch);
18
- curl_close($ch);
19
- return $output;
20
- }
21
-
22
- /********************/
23
- /** AJAX CALLBACKS **/
24
- /********************/
25
-
26
- // Inserts an array into the database
27
- // https://github.com/mirzazeyrek/wp-multiple-insert
28
- function crellyslider_wp_insert_rows($row_arrays = array(), $wp_table_name) {
29
- global $wpdb;
30
- $wp_table_name = esc_sql($wp_table_name);
31
- // Setup arrays for Actual Values, and Placeholders
32
- $values = array();
33
- $place_holders = array();
34
- $query = "";
35
- $query_columns = "";
36
-
37
- $query .= "INSERT INTO {$wp_table_name} (";
38
-
39
- foreach($row_arrays as $count => $row_array)
40
- {
41
-
42
- foreach($row_array as $key => $value) {
43
-
44
- if($count == 0) {
45
- if($query_columns) {
46
- $query_columns .= ",".$key."";
47
- } else {
48
- $query_columns .= "".$key."";
49
- }
50
- }
51
-
52
- $values[] = $value;
53
-
54
- if(is_numeric($value)) {
55
- if(isset($place_holders[$count])) {
56
- $place_holders[$count] .= ", '%d'";
57
- } else {
58
- $place_holders[$count] = "( '%d'";
59
- }
60
- } else {
61
- if(isset($place_holders[$count])) {
62
- $place_holders[$count] .= ", '%s'";
63
- } else {
64
- $place_holders[$count] = "( '%s'";
65
- }
66
- }
67
- }
68
- // mind closing the GAP
69
- $place_holders[$count] .= ")";
70
- }
71
-
72
- $query .= " $query_columns ) VALUES ";
73
-
74
- $query .= implode(', ', $place_holders);
75
-
76
- if($wpdb->query($wpdb->prepare($query, $values))){
77
- return true;
78
- } else {
79
- return false;
80
- }
81
-
82
- }
83
-
84
- // Add slider
85
- add_action('wp_ajax_crellyslider_addSlider', 'crellyslider_addSlider_callback');
86
- function crellyslider_addSlider_callback() {
87
- global $wpdb;
88
- $options = $_POST['datas'];
89
-
90
- $output = crellyslider_insertSliderSQL($options);
91
-
92
- // Returning
93
- $output = json_encode(esc_sql($wpdb->insert_id));
94
- if(is_array($output)) print_r($output);
95
- else echo $output;
96
-
97
- die();
98
- }
99
-
100
- function crellyslider_insertSliderSQL($options) {
101
- global $wpdb;
102
-
103
- return $wpdb->insert(
104
- $wpdb->prefix . 'crellyslider_sliders',
105
- array(
106
- 'name' => $options['name'],
107
- 'alias' => $options['alias'],
108
- 'layout' => $options['layout'],
109
- 'responsive' => $options['responsive'],
110
- 'startWidth' => $options['startWidth'],
111
- 'startHeight' => $options['startHeight'],
112
- 'automaticSlide' => $options['automaticSlide'],
113
- 'showControls' => $options['showControls'],
114
- 'showNavigation' => $options['showNavigation'],
115
- 'showProgressBar' => $options['showProgressBar'],
116
- 'pauseOnHover' => $options['pauseOnHover'],
117
- 'callbacks' => $options['callbacks'],
118
- 'randomOrder' => $options['randomOrder'],
119
- 'startFromSlide' => $options['startFromSlide'],
120
- 'enableSwipe' => $options['enableSwipe'],
121
- ),
122
- array(
123
- '%s',
124
- '%s',
125
- '%s',
126
- '%d',
127
- '%d',
128
- '%d',
129
- '%d',
130
- '%d',
131
- '%d',
132
- '%d',
133
- '%d',
134
- '%s',
135
- '%d',
136
- '%d',
137
- '%d',
138
- )
139
- );
140
- }
141
-
142
- // Edit slider
143
- add_action('wp_ajax_crellyslider_editSlider', 'crellyslider_editSlider_callback');
144
- function crellyslider_editSlider_callback() {
145
- global $wpdb;
146
- $options = $_POST['datas'];
147
- $table_name = $wpdb->prefix . 'crellyslider_sliders';
148
-
149
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
150
- echo json_encode(false);
151
- return;
152
- }
153
-
154
- $output = $wpdb->update(
155
- $table_name,
156
- array(
157
- 'name' => $options['name'],
158
- 'alias' => $options['alias'],
159
- 'layout' => $options['layout'],
160
- 'responsive' => $options['responsive'],
161
- 'startWidth' => $options['startWidth'],
162
- 'startHeight' => $options['startHeight'],
163
- 'automaticSlide' => $options['automaticSlide'],
164
- 'showControls' => $options['showControls'],
165
- 'showNavigation' => $options['showNavigation'],
166
- 'showProgressBar' => $options['showProgressBar'],
167
- 'pauseOnHover' => $options['pauseOnHover'],
168
- 'callbacks' => $options['callbacks'],
169
- 'randomOrder' => $options['randomOrder'],
170
- 'startFromSlide' => $options['startFromSlide'],
171
- 'enableSwipe' => $options['enableSwipe'],
172
- ),
173
- array('id' => esc_sql($options['id'])),
174
- array(
175
- '%s',
176
- '%s',
177
- '%s',
178
- '%d',
179
- '%d',
180
- '%d',
181
- '%d',
182
- '%d',
183
- '%d',
184
- '%d',
185
- '%d',
186
- '%s',
187
- '%d',
188
- '%d',
189
- '%d',
190
- ),
191
- array('%d')
192
- );
193
-
194
- // Returning
195
- $output = json_encode($output);
196
- if(is_array($output)) print_r($output);
197
- else echo $output;
198
-
199
- die();
200
- }
201
-
202
- // Edit slides. Receives an array with all the slides options. Delete al the old slides then recreate them
203
- add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
204
- function crellyslider_editSlides_callback() {
205
- global $wpdb;
206
- $options = $_POST['datas'];
207
-
208
- if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
209
- echo json_encode(false);
210
- return;
211
- }
212
-
213
- $output = true;
214
-
215
- // Remove all the old slides
216
- $output = $wpdb->delete($wpdb->prefix . 'crellyslider_slides', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
217
- if($output === false) {
218
- echo json_encode(false);
219
- }
220
- else {
221
- // It's impossible to have 0 slides (jQuery checks it)
222
- if(count($options['options']) == 0) {
223
- echo json_encode(false);
224
- return;
225
- }
226
-
227
- $output = crellyslider_wp_insert_rows($options['options'], $wpdb->prefix . 'crellyslider_slides');
228
-
229
- // Returning
230
- $output = json_encode($output);
231
- if(is_array($output)) print_r($output);
232
- else echo $output;
233
- }
234
-
235
- die();
236
- }
237
-
238
- // Edit elements. Receives an array with all the elements options. Delete al the old elements then recreate them
239
- add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
240
- function crellyslider_editElements_callback() {
241
- global $wpdb;
242
- $options = $_POST['datas'];
243
-
244
- if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
245
- echo json_encode(false);
246
- return;
247
- }
248
-
249
- $output = true;
250
-
251
- // Remove all the old elements
252
- $output = $wpdb->delete($wpdb->prefix . 'crellyslider_elements', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
253
- if($output === false) {
254
- echo json_encode(false);
255
- }
256
- else {
257
- // No elements
258
- $quick_temp = json_decode(stripslashes($options['options']));
259
- if(empty($quick_temp)) {
260
- echo json_encode(true);
261
- }
262
- else {
263
- $options_array = json_decode(stripslashes($options['options']));
264
-
265
- $output = crellyslider_wp_insert_rows($options_array, $wpdb->prefix . 'crellyslider_elements');
266
-
267
- // Returning
268
- $output = json_encode($output);
269
- if(is_array($output)) print_r($output);
270
- else echo $output;
271
- }
272
- }
273
-
274
- die();
275
- }
276
-
277
- // Delete slider and its content
278
- add_action('wp_ajax_crellyslider_deleteSlider', 'crellyslider_deleteSlider_callback');
279
- function crellyslider_deleteSlider_callback() {
280
- global $wpdb;
281
- $options = $_POST['datas'];
282
-
283
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
284
- echo json_encode(false);
285
- return;
286
- }
287
-
288
- $real_output = true;
289
-
290
- // Delete slider
291
- $table_name = $wpdb->prefix . 'crellyslider_sliders';
292
- $output = $wpdb->delete($table_name, array('id' => esc_sql($options['id'])), array('%d'));
293
- if($output === false) {
294
- $real_output = false;
295
- }
296
-
297
- // Delete slides
298
- $table_name = $wpdb->prefix . 'crellyslider_slides';
299
- $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
300
- if($output === false) {
301
- $real_output = false;
302
- }
303
-
304
- // Delete elements
305
- $table_name = $wpdb->prefix . 'crellyslider_elements';
306
- $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
307
- if($output === false) {
308
- $real_output = false;
309
- }
310
-
311
- // Returning
312
- $real_output = json_encode($real_output);
313
- if(is_array($real_output)) print_r($real_output);
314
- else echo $real_output;
315
-
316
- die();
317
- }
318
-
319
- // Duplicate slider and its content
320
- add_action('wp_ajax_crellyslider_duplicateSlider', 'crellyslider_duplicateSlider_callback');
321
- function crellyslider_duplicateSlider_callback() {
322
- global $wpdb;
323
- $options = $_POST['datas'];
324
-
325
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
326
- echo json_encode(false);
327
- return;
328
- }
329
-
330
- $output = true;
331
- $real_output = true;
332
-
333
- $slider_id = esc_sql($options['id']);
334
-
335
- $cloned_slider_name = '';
336
- $cloned_slider_alias = '';
337
-
338
- $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $slider_id), ARRAY_A);
339
- foreach($sliders as $slider) {
340
- $cloned_slider_name = $slider['name'] = $slider['name'] . '_' . __('Copy', 'crelly-slider');
341
- $cloned_slider_alias = $slider['alias'] = $slider['alias'] . '_' . __('copy', 'crelly-slider');
342
- $output = crellyslider_insertSliderSQL($slider);
343
- }
344
-
345
- if($output === false) {
346
- $real_output = false;
347
- }
348
- else {
349
- $cloned_slider_id = $wpdb->insert_id;
350
-
351
- // Clone slides
352
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $slider_id), ARRAY_A);
353
- if(empty($slides)) {
354
- $output = true;
355
- }
356
- else {
357
- foreach($slides as $key => $slide) {
358
- unset($slides[$key]['id']);
359
- $slides[$key]['slider_parent'] = $cloned_slider_id;
360
- }
361
- $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
362
- if($temp === false) {
363
- $output = false;
364
- }
365
- }
366
-
367
- // Clone elements
368
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', $slider_id), ARRAY_A);
369
- if(empty($elements)) {
370
- $output = true;
371
- }
372
- else {
373
- foreach($elements as $key => $element) {
374
- unset($elements[$key]['id']);
375
- $elements[$key]['slider_parent'] = $cloned_slider_id;
376
- }
377
- $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
378
- if($temp === false) {
379
- $output = false;
380
- }
381
-
382
- if($output === false) {
383
- $real_output = false;
384
- }
385
- }
386
- }
387
-
388
- if($real_output === true) {
389
- $real_output = array(
390
- 'response' => true,
391
- 'cloned_slider_id' => $cloned_slider_id,
392
- 'cloned_slider_name' => $cloned_slider_name,
393
- 'cloned_slider_alias' => $cloned_slider_alias,
394
- );
395
- }
396
- else {
397
- $real_output = array(
398
- 'response' => false,
399
- 'cloned_slider_id' => false,
400
- 'cloned_slider_name' => false,
401
- 'cloned_slider_alias' => false,
402
- );
403
- }
404
-
405
- // Returning
406
- $real_output = json_encode($real_output);
407
- if(is_array($real_output)) print_r($real_output);
408
- else echo $real_output;
409
-
410
- die();
411
- }
412
-
413
- // Exports the slider in .zip
414
- add_action('wp_ajax_crellyslider_exportSlider', 'crellyslider_exportSlider_callback');
415
- function crellyslider_exportSlider_callback() {
416
- global $wpdb;
417
-
418
- // Clear the temp folder
419
- array_map('unlink', glob(CS_PATH . '/wordpress/temp/*'));
420
-
421
- $options = $_POST['datas'];
422
-
423
- if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
424
- echo json_encode(false);
425
- return;
426
- }
427
-
428
- $real_output = true;
429
-
430
- $result = array();
431
-
432
- // Get the slider
433
- $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($options['id'])), ARRAY_A);
434
- if(empty($sliders)) {
435
- $real_output = false;
436
- }
437
- else {
438
- foreach($sliders as $key => $temp) {
439
- unset($sliders[$key]['id']);
440
- }
441
- $result['sliders'] = $sliders;
442
- }
443
-
444
- $zip = new ZipArchive();
445
- $filename = 'crellyslider-' . $sliders[0]['alias'] . '.zip';
446
- if($zip->open(CS_PATH . '/wordpress/temp/' . $filename, ZipArchive::CREATE) !== TRUE) {
447
- echo false;
448
- die();
449
- }
450
-
451
- // Get the slides
452
- $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);
453
- if(! empty($slides)) {
454
- foreach($slides as $key => $temp) {
455
- unset($slides[$key]['id']);
456
- unset($slides[$key]['slider_parent']);
457
-
458
- // Add images to zip and remove media directory URLs
459
- if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
460
- $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
461
- $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
462
- $slides[$key]['background_type_image'] = basename($img);
463
- }
464
- }
465
- $result['slides'] = $slides;
466
- }
467
-
468
- // Get the elements
469
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', esc_sql($options['id'])), ARRAY_A);
470
- if(! empty($elements)) {
471
- foreach($elements as $key => $temp) {
472
- unset($elements[$key]['id']);
473
- unset($elements[$key]['slider_parent']);
474
-
475
- // Add images to zip and remove media directory URLs
476
- if($elements[$key]['type'] == 'image') {
477
- $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
478
- $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
479
- $elements[$key]['image_src'] = basename($img);
480
- }
481
- }
482
- $result['elements'] = $elements;
483
- }
484
-
485
- $json = json_encode($result);
486
- $zip->addFromString("slider.json", $json);
487
-
488
- $zip->close();
489
-
490
- if($real_output === true) {
491
- $real_output = array(
492
- 'response' => true,
493
- 'url' => CS_PLUGIN_URL . '/wordpress/temp/' . $filename,
494
- );
495
- }
496
- else {
497
- $real_output = array(
498
- 'response' => false,
499
- 'url' => false,
500
- );
501
- }
502
-
503
- // Returning
504
- $real_output = json_encode($real_output);
505
- if(is_array($real_output)) print_r($real_output);
506
- else echo $real_output;
507
-
508
- die();
509
- }
510
-
511
- // Inport the slider from a json string
512
- add_action('wp_ajax_crellyslider_importSlider', 'crellyslider_importSlider_callback');
513
- function crellyslider_importSlider_callback() {
514
- global $wpdb;
515
-
516
- // Clear the temp folder
517
- array_map('unlink', glob(CS_PATH . '/wordpress/temp/*'));
518
-
519
- foreach($_FILES as $file) {
520
- $output = true;
521
- $real_output = true;
522
-
523
- $zip = new ZipArchive();
524
- if($zip->open($file['tmp_name']) !== TRUE) {
525
- echo false;
526
- die();
527
- }
528
-
529
- $zip->extractTo(CS_PATH . '/wordpress/temp/');
530
-
531
- $imported_array = json_decode(file_get_contents(CS_PATH . '/wordpress/temp/slider.json'));
532
-
533
- $sliders = $imported_array->sliders;
534
- foreach($sliders as $slider) {
535
- // Prevent compatiblity issues with old .zip exported sliders (< 1.2.0)
536
- if(! isset($slider->randomOrder)) {
537
- $slider->randomOrder = 0;
538
- }
539
- if(! isset($slider->startFromSlide)) {
540
- $slider->startFromSlide = 0;
541
- }
542
-
543
- $output = crellyslider_insertSliderSQL((array) $slider);
544
- }
545
-
546
- if($output === false) {
547
- $real_output = false;
548
- }
549
- else {
550
- $imported_slider_id = $wpdb->insert_id;
551
-
552
- // Import slides
553
- $slides = $imported_array->slides;
554
- if(empty($slides)) {
555
- $output = true;
556
- }
557
- else {
558
- foreach($slides as $key => $slide) {
559
- $slides[$key]->slider_parent = $imported_slider_id;
560
-
561
- // Set background images
562
- if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
563
- $url = CS_PATH . '/wordpress/temp/' . $slides[$key]->background_type_image;
564
- $id = crellyslider_importImage($url);
565
- $slides[$key]->background_type_image = $id;
566
- }
567
- }
568
- $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
569
- if($temp === false) {
570
- $output = false;
571
- }
572
- }
573
-
574
- // Import elements
575
- $elements = (array) $imported_array->elements;
576
- if(empty($elements)) {
577
- $output = true;
578
- }
579
- else {
580
- foreach($elements as $key => $element) {
581
- $elements[$key]->slider_parent = $imported_slider_id;
582
-
583
- // Set images
584
- if($elements[$key]->type == 'image') {
585
- $url = CS_PATH . '/wordpress/temp/' . $elements[$key]->image_src;
586
- $id = crellyslider_importImage($url);
587
- $elements[$key]->image_src = $id;
588
- }
589
- }
590
- $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
591
- if($temp === false) {
592
- $output = false;
593
- }
594
-
595
- if($output === false) {
596
- $real_output = false;
597
- }
598
- }
599
- }
600
-
601
- if($real_output === true) {
602
- $real_output = array(
603
- 'response' => true,
604
- 'imported_slider_id' => $imported_slider_id,
605
- 'imported_slider_name' => $imported_array->sliders[0]->name,
606
- 'imported_slider_alias' => $imported_array->sliders[0]->alias,
607
- );
608
- }
609
- else {
610
- $real_output = array(
611
- 'response' => false,
612
- 'imported_slider_id' => false,
613
- 'imported_slider_name' => false,
614
- 'imported_slider_alias' => false,
615
- );
616
- }
617
-
618
- // Returning
619
- $real_output = json_encode($real_output);
620
- if(is_array($real_output)) print_r($real_output);
621
- else echo $real_output;
622
-
623
- die();
624
- }
625
- }
626
-
627
- // Imports an image to the WordPress media library. Returns the attachment ID
628
- // Original script: https://gist.github.com/hissy/7352933
629
- function crellyslider_importImage($local_url) {
630
- $file = $local_url;
631
- $filename = basename($file);
632
-
633
- $upload_file = wp_upload_bits($filename, null, file_get_contents($file));
634
- if (!$upload_file['error']) {
635
- $wp_filetype = wp_check_filetype($filename, null );
636
- $attachment = array(
637
- 'post_mime_type' => $wp_filetype['type'],
638
- 'post_parent' => 0,
639
- 'post_title' => preg_replace('/\.[^.]+$/', '', $filename),
640
- 'post_content' => '',
641
- 'post_status' => 'inherit'
642
- );
643
- $attachment_id = wp_insert_attachment( $attachment, $upload_file['file'], $parent_post_id );
644
- if (!is_wp_error($attachment_id)) {
645
- require_once(ABSPATH . "wp-admin" . '/includes/image.php');
646
- $attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload_file['file'] );
647
- wp_update_attachment_metadata( $attachment_id, $attachment_data );
648
- }
649
- }
650
-
651
- return $attachment_id;
652
- }
653
  ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ /************************/
5
+ /** EXTERNAL RESOURCES **/
6
+ /************************/
7
+
8
+ // Alternative to file_get_contents. If CURL is not installed, file_get_contents is called
9
+ // http://stackoverflow.com/questions/3979802/alternative-to-file-get-contents
10
+ function crellyslider_url_get_contents ($Url) {
11
+ if (!function_exists('curl_init')){
12
+ return file_get_contents($Url);
13
+ }
14
+ $ch = curl_init();
15
+ curl_setopt($ch, CURLOPT_URL, $Url);
16
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
17
+ $output = curl_exec($ch);
18
+ curl_close($ch);
19
+ return $output;
20
+ }
21
+
22
+ /********************/
23
+ /** AJAX CALLBACKS **/
24
+ /********************/
25
+
26
+ // Inserts an array into the database
27
+ // https://github.com/mirzazeyrek/wp-multiple-insert
28
+ function crellyslider_wp_insert_rows($row_arrays = array(), $wp_table_name) {
29
+ global $wpdb;
30
+ $wp_table_name = esc_sql($wp_table_name);
31
+ // Setup arrays for Actual Values, and Placeholders
32
+ $values = array();
33
+ $place_holders = array();
34
+ $query = "";
35
+ $query_columns = "";
36
+
37
+ $query .= "INSERT INTO {$wp_table_name} (";
38
+
39
+ foreach($row_arrays as $count => $row_array)
40
+ {
41
+
42
+ foreach($row_array as $key => $value) {
43
+
44
+ if($count == 0) {
45
+ if($query_columns) {
46
+ $query_columns .= ",".$key."";
47
+ } else {
48
+ $query_columns .= "".$key."";
49
+ }
50
+ }
51
+
52
+ $values[] = $value;
53
+
54
+ if(is_numeric($value)) {
55
+ if(isset($place_holders[$count])) {
56
+ $place_holders[$count] .= ", '%d'";
57
+ } else {
58
+ $place_holders[$count] = "( '%d'";
59
+ }
60
+ } else {
61
+ if(isset($place_holders[$count])) {
62
+ $place_holders[$count] .= ", '%s'";
63
+ } else {
64
+ $place_holders[$count] = "( '%s'";
65
+ }
66
+ }
67
+ }
68
+ // mind closing the GAP
69
+ $place_holders[$count] .= ")";
70
+ }
71
+
72
+ $query .= " $query_columns ) VALUES ";
73
+
74
+ $query .= implode(', ', $place_holders);
75
+
76
+ if($wpdb->query($wpdb->prepare($query, $values))){
77
+ return true;
78
+ } else {
79
+ return false;
80
+ }
81
+
82
+ }
83
+
84
+ // Add slider
85
+ add_action('wp_ajax_crellyslider_addSlider', 'crellyslider_addSlider_callback');
86
+ function crellyslider_addSlider_callback() {
87
+ global $wpdb;
88
+ $options = $_POST['datas'];
89
+
90
+ $output = crellyslider_insertSliderSQL($options);
91
+
92
+ // Returning
93
+ $output = json_encode(esc_sql($wpdb->insert_id));
94
+ if(is_array($output)) print_r($output);
95
+ else echo $output;
96
+
97
+ die();
98
+ }
99
+
100
+ function crellyslider_insertSliderSQL($options) {
101
+ global $wpdb;
102
+
103
+ return $wpdb->insert(
104
+ $wpdb->prefix . 'crellyslider_sliders',
105
+ array(
106
+ 'name' => $options['name'],
107
+ 'alias' => $options['alias'],
108
+ 'layout' => $options['layout'],
109
+ 'responsive' => $options['responsive'],
110
+ 'startWidth' => $options['startWidth'],
111
+ 'startHeight' => $options['startHeight'],
112
+ 'automaticSlide' => $options['automaticSlide'],
113
+ 'showControls' => $options['showControls'],
114
+ 'showNavigation' => $options['showNavigation'],
115
+ 'showProgressBar' => $options['showProgressBar'],
116
+ 'pauseOnHover' => $options['pauseOnHover'],
117
+ 'callbacks' => $options['callbacks'],
118
+ 'randomOrder' => $options['randomOrder'],
119
+ 'startFromSlide' => $options['startFromSlide'],
120
+ 'enableSwipe' => $options['enableSwipe'],
121
+ ),
122
+ array(
123
+ '%s',
124
+ '%s',
125
+ '%s',
126
+ '%d',
127
+ '%d',
128
+ '%d',
129
+ '%d',
130
+ '%d',
131
+ '%d',
132
+ '%d',
133
+ '%d',
134
+ '%s',
135
+ '%d',
136
+ '%d',
137
+ '%d',
138
+ )
139
+ );
140
+ }
141
+
142
+ // Edit slider
143
+ add_action('wp_ajax_crellyslider_editSlider', 'crellyslider_editSlider_callback');
144
+ function crellyslider_editSlider_callback() {
145
+ global $wpdb;
146
+ $options = $_POST['datas'];
147
+ $table_name = $wpdb->prefix . 'crellyslider_sliders';
148
+
149
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
150
+ echo json_encode(false);
151
+ return;
152
+ }
153
+
154
+ $output = $wpdb->update(
155
+ $table_name,
156
+ array(
157
+ 'name' => $options['name'],
158
+ 'alias' => $options['alias'],
159
+ 'layout' => $options['layout'],
160
+ 'responsive' => $options['responsive'],
161
+ 'startWidth' => $options['startWidth'],
162
+ 'startHeight' => $options['startHeight'],
163
+ 'automaticSlide' => $options['automaticSlide'],
164
+ 'showControls' => $options['showControls'],
165
+ 'showNavigation' => $options['showNavigation'],
166
+ 'showProgressBar' => $options['showProgressBar'],
167
+ 'pauseOnHover' => $options['pauseOnHover'],
168
+ 'callbacks' => $options['callbacks'],
169
+ 'randomOrder' => $options['randomOrder'],
170
+ 'startFromSlide' => $options['startFromSlide'],
171
+ 'enableSwipe' => $options['enableSwipe'],
172
+ ),
173
+ array('id' => esc_sql($options['id'])),
174
+ array(
175
+ '%s',
176
+ '%s',
177
+ '%s',
178
+ '%d',
179
+ '%d',
180
+ '%d',
181
+ '%d',
182
+ '%d',
183
+ '%d',
184
+ '%d',
185
+ '%d',
186
+ '%s',
187
+ '%d',
188
+ '%d',
189
+ '%d',
190
+ ),
191
+ array('%d')
192
+ );
193
+
194
+ // Returning
195
+ $output = json_encode($output);
196
+ if(is_array($output)) print_r($output);
197
+ else echo $output;
198
+
199
+ die();
200
+ }
201
+
202
+ // Edit slides. Receives an array with all the slides options. Delete al the old slides then recreate them
203
+ add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
204
+ function crellyslider_editSlides_callback() {
205
+ global $wpdb;
206
+ $options = $_POST['datas'];
207
+
208
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
209
+ echo json_encode(false);
210
+ return;
211
+ }
212
+
213
+ $output = true;
214
+
215
+ // Remove all the old slides
216
+ $output = $wpdb->delete($wpdb->prefix . 'crellyslider_slides', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
217
+ if($output === false) {
218
+ echo json_encode(false);
219
+ }
220
+ else {
221
+ // It's impossible to have 0 slides (jQuery checks it)
222
+ if(count($options['options']) == 0) {
223
+ echo json_encode(false);
224
+ return;
225
+ }
226
+
227
+ $output = crellyslider_wp_insert_rows($options['options'], $wpdb->prefix . 'crellyslider_slides');
228
+
229
+ // Returning
230
+ $output = json_encode($output);
231
+ if(is_array($output)) print_r($output);
232
+ else echo $output;
233
+ }
234
+
235
+ die();
236
+ }
237
+
238
+ // Edit elements. Receives an array with all the elements options. Delete al the old elements then recreate them
239
+ add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
240
+ function crellyslider_editElements_callback() {
241
+ global $wpdb;
242
+ $options = $_POST['datas'];
243
+
244
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['slider_parent'])))) {
245
+ echo json_encode(false);
246
+ return;
247
+ }
248
+
249
+ $output = true;
250
+
251
+ // Remove all the old elements
252
+ $output = $wpdb->delete($wpdb->prefix . 'crellyslider_elements', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
253
+ if($output === false) {
254
+ echo json_encode(false);
255
+ }
256
+ else {
257
+ // No elements
258
+ $quick_temp = json_decode(stripslashes($options['options']));
259
+ if(empty($quick_temp)) {
260
+ echo json_encode(true);
261
+ }
262
+ else {
263
+ $options_array = json_decode(stripslashes($options['options']));
264
+
265
+ $output = crellyslider_wp_insert_rows($options_array, $wpdb->prefix . 'crellyslider_elements');
266
+
267
+ // Returning
268
+ $output = json_encode($output);
269
+ if(is_array($output)) print_r($output);
270
+ else echo $output;
271
+ }
272
+ }
273
+
274
+ die();
275
+ }
276
+
277
+ // Delete slider and its content
278
+ add_action('wp_ajax_crellyslider_deleteSlider', 'crellyslider_deleteSlider_callback');
279
+ function crellyslider_deleteSlider_callback() {
280
+ global $wpdb;
281
+ $options = $_POST['datas'];
282
+
283
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
284
+ echo json_encode(false);
285
+ return;
286
+ }
287
+
288
+ $real_output = true;
289
+
290
+ // Delete slider
291
+ $table_name = $wpdb->prefix . 'crellyslider_sliders';
292
+ $output = $wpdb->delete($table_name, array('id' => esc_sql($options['id'])), array('%d'));
293
+ if($output === false) {
294
+ $real_output = false;
295
+ }
296
+
297
+ // Delete slides
298
+ $table_name = $wpdb->prefix . 'crellyslider_slides';
299
+ $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
300
+ if($output === false) {
301
+ $real_output = false;
302
+ }
303
+
304
+ // Delete elements
305
+ $table_name = $wpdb->prefix . 'crellyslider_elements';
306
+ $output = $wpdb->delete($table_name, array('slider_parent' => esc_sql($options['id'])), array('%d'));
307
+ if($output === false) {
308
+ $real_output = false;
309
+ }
310
+
311
+ // Returning
312
+ $real_output = json_encode($real_output);
313
+ if(is_array($real_output)) print_r($real_output);
314
+ else echo $real_output;
315
+
316
+ die();
317
+ }
318
+
319
+ // Duplicate slider and its content
320
+ add_action('wp_ajax_crellyslider_duplicateSlider', 'crellyslider_duplicateSlider_callback');
321
+ function crellyslider_duplicateSlider_callback() {
322
+ global $wpdb;
323
+ $options = $_POST['datas'];
324
+
325
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
326
+ echo json_encode(false);
327
+ return;
328
+ }
329
+
330
+ $output = true;
331
+ $real_output = true;
332
+
333
+ $slider_id = esc_sql($options['id']);
334
+
335
+ $cloned_slider_name = '';
336
+ $cloned_slider_alias = '';
337
+
338
+ $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', $slider_id), ARRAY_A);
339
+ foreach($sliders as $slider) {
340
+ $cloned_slider_name = $slider['name'] = $slider['name'] . '_' . __('Copy', 'crelly-slider');
341
+ $cloned_slider_alias = $slider['alias'] = $slider['alias'] . '_' . __('copy', 'crelly-slider');
342
+ $output = crellyslider_insertSliderSQL($slider);
343
+ }
344
+
345
+ if($output === false) {
346
+ $real_output = false;
347
+ }
348
+ else {
349
+ $cloned_slider_id = $wpdb->insert_id;
350
+
351
+ // Clone slides
352
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $slider_id), ARRAY_A);
353
+ if(empty($slides)) {
354
+ $output = true;
355
+ }
356
+ else {
357
+ foreach($slides as $key => $slide) {
358
+ unset($slides[$key]['id']);
359
+ $slides[$key]['slider_parent'] = $cloned_slider_id;
360
+ }
361
+ $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
362
+ if($temp === false) {
363
+ $output = false;
364
+ }
365
+ }
366
+
367
+ // Clone elements
368
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', $slider_id), ARRAY_A);
369
+ if(empty($elements)) {
370
+ $output = true;
371
+ }
372
+ else {
373
+ foreach($elements as $key => $element) {
374
+ unset($elements[$key]['id']);
375
+ $elements[$key]['slider_parent'] = $cloned_slider_id;
376
+ }
377
+ $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
378
+ if($temp === false) {
379
+ $output = false;
380
+ }
381
+
382
+ if($output === false) {
383
+ $real_output = false;
384
+ }
385
+ }
386
+ }
387
+
388
+ if($real_output === true) {
389
+ $real_output = array(
390
+ 'response' => true,
391
+ 'cloned_slider_id' => $cloned_slider_id,
392
+ 'cloned_slider_name' => $cloned_slider_name,
393
+ 'cloned_slider_alias' => $cloned_slider_alias,
394
+ );
395
+ }
396
+ else {
397
+ $real_output = array(
398
+ 'response' => false,
399
+ 'cloned_slider_id' => false,
400
+ 'cloned_slider_name' => false,
401
+ 'cloned_slider_alias' => false,
402
+ );
403
+ }
404
+
405
+ // Returning
406
+ $real_output = json_encode($real_output);
407
+ if(is_array($real_output)) print_r($real_output);
408
+ else echo $real_output;
409
+
410
+ die();
411
+ }
412
+
413
+ // Exports the slider in .zip
414
+ add_action('wp_ajax_crellyslider_exportSlider', 'crellyslider_exportSlider_callback');
415
+ function crellyslider_exportSlider_callback() {
416
+ global $wpdb;
417
+
418
+ // Clear the temp folder
419
+ array_map('unlink', glob(CS_PATH . '/wordpress/temp/*'));
420
+
421
+ $options = $_POST['datas'];
422
+
423
+ if(!CrellySliderCommon::sliderExists((esc_sql($options['id'])))) {
424
+ echo json_encode(false);
425
+ return;
426
+ }
427
+
428
+ $real_output = true;
429
+
430
+ $result = array();
431
+
432
+ // Get the slider
433
+ $sliders = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($options['id'])), ARRAY_A);
434
+ if(empty($sliders)) {
435
+ $real_output = false;
436
+ }
437
+ else {
438
+ foreach($sliders as $key => $temp) {
439
+ unset($sliders[$key]['id']);
440
+ }
441
+ $result['sliders'] = $sliders;
442
+ }
443
+
444
+ $zip = new ZipArchive();
445
+ $filename = 'crellyslider-' . $sliders[0]['alias'] . '.zip';
446
+ if($zip->open(CS_PATH . '/wordpress/temp/' . $filename, ZipArchive::CREATE) !== TRUE) {
447
+ echo false;
448
+ die();
449
+ }
450
+
451
+ // Get the slides
452
+ $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);
453
+ if(! empty($slides)) {
454
+ foreach($slides as $key => $temp) {
455
+ unset($slides[$key]['id']);
456
+ unset($slides[$key]['slider_parent']);
457
+
458
+ // Add images to zip and remove media directory URLs
459
+ if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
460
+ $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
461
+ $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
462
+ $slides[$key]['background_type_image'] = basename($img);
463
+ }
464
+ }
465
+ $result['slides'] = $slides;
466
+ }
467
+
468
+ // Get the elements
469
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d', esc_sql($options['id'])), ARRAY_A);
470
+ if(! empty($elements)) {
471
+ foreach($elements as $key => $temp) {
472
+ unset($elements[$key]['id']);
473
+ unset($elements[$key]['slider_parent']);
474
+
475
+ // Add images to zip and remove media directory URLs
476
+ if($elements[$key]['type'] == 'image') {
477
+ $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
478
+ $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
479
+ $elements[$key]['image_src'] = basename($img);
480
+ }
481
+ }
482
+ $result['elements'] = $elements;
483
+ }
484
+
485
+ $json = json_encode($result);
486
+ $zip->addFromString("slider.json", $json);
487
+
488
+ $zip->close();
489
+
490
+ if($real_output === true) {
491
+ $real_output = array(
492
+ 'response' => true,
493
+ 'url' => CS_PLUGIN_URL . '/wordpress/temp/' . $filename,
494
+ );
495
+ }
496
+ else {
497
+ $real_output = array(
498
+ 'response' => false,
499
+ 'url' => false,
500
+ );
501
+ }
502
+
503
+ // Returning
504
+ $real_output = json_encode($real_output);
505
+ if(is_array($real_output)) print_r($real_output);
506
+ else echo $real_output;
507
+
508
+ die();
509
+ }
510
+
511
+ // Inport the slider from a json string
512
+ add_action('wp_ajax_crellyslider_importSlider', 'crellyslider_importSlider_callback');
513
+ function crellyslider_importSlider_callback() {
514
+ global $wpdb;
515
+
516
+ // Clear the temp folder
517
+ array_map('unlink', glob(CS_PATH . '/wordpress/temp/*'));
518
+
519
+ foreach($_FILES as $file) {
520
+ $output = true;
521
+ $real_output = true;
522
+
523
+ $zip = new ZipArchive();
524
+ if($zip->open($file['tmp_name']) !== TRUE) {
525
+ echo false;
526
+ die();
527
+ }
528
+
529
+ $zip->extractTo(CS_PATH . '/wordpress/temp/');
530
+
531
+ $imported_array = json_decode(file_get_contents(CS_PATH . '/wordpress/temp/slider.json'));
532
+
533
+ $sliders = $imported_array->sliders;
534
+ foreach($sliders as $slider) {
535
+ // Prevent compatiblity issues with old .zip exported sliders (< 1.2.0)
536
+ if(! isset($slider->randomOrder)) {
537
+ $slider->randomOrder = 0;
538
+ }
539
+ if(! isset($slider->startFromSlide)) {
540
+ $slider->startFromSlide = 0;
541
+ }
542
+
543
+ $output = crellyslider_insertSliderSQL((array) $slider);
544
+ }
545
+
546
+ if($output === false) {
547
+ $real_output = false;
548
+ }
549
+ else {
550
+ $imported_slider_id = $wpdb->insert_id;
551
+
552
+ // Import slides
553
+ $slides = $imported_array->slides;
554
+ if(empty($slides)) {
555
+ $output = true;
556
+ }
557
+ else {
558
+ foreach($slides as $key => $slide) {
559
+ $slides[$key]->slider_parent = $imported_slider_id;
560
+
561
+ // Set background images
562
+ if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
563
+ $url = CS_PATH . '/wordpress/temp/' . $slides[$key]->background_type_image;
564
+ $id = crellyslider_importImage($url);
565
+ $slides[$key]->background_type_image = $id;
566
+ }
567
+ }
568
+ $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
569
+ if($temp === false) {
570
+ $output = false;
571
+ }
572
+ }
573
+
574
+ // Import elements
575
+ $elements = (array) $imported_array->elements;
576
+ if(empty($elements)) {
577
+ $output = true;
578
+ }
579
+ else {
580
+ foreach($elements as $key => $element) {
581
+ $elements[$key]->slider_parent = $imported_slider_id;
582
+
583
+ // Set images
584
+ if($elements[$key]->type == 'image') {
585
+ $url = CS_PATH . '/wordpress/temp/' . $elements[$key]->image_src;
586
+ $id = crellyslider_importImage($url);
587
+ $elements[$key]->image_src = $id;
588
+ }
589
+ }
590
+ $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
591
+ if($temp === false) {
592
+ $output = false;
593
+ }
594
+
595
+ if($output === false) {
596
+ $real_output = false;
597
+ }
598
+ }
599
+ }
600
+
601
+ if($real_output === true) {
602
+ $real_output = array(
603
+ 'response' => true,
604
+ 'imported_slider_id' => $imported_slider_id,
605
+ 'imported_slider_name' => $imported_array->sliders[0]->name,
606
+ 'imported_slider_alias' => $imported_array->sliders[0]->alias,
607
+ );
608
+ }
609
+ else {
610
+ $real_output = array(
611
+ 'response' => false,
612
+ 'imported_slider_id' => false,
613
+ 'imported_slider_name' => false,
614
+ 'imported_slider_alias' => false,
615
+ );
616
+ }
617
+
618
+ // Returning
619
+ $real_output = json_encode($real_output);
620
+ if(is_array($real_output)) print_r($real_output);
621
+ else echo $real_output;
622
+
623
+ die();
624
+ }
625
+ }
626
+
627
+ // Imports an image to the WordPress media library. Returns the attachment ID
628
+ // Original script: https://gist.github.com/hissy/7352933
629
+ function crellyslider_importImage($local_url) {
630
+ $file = $local_url;
631
+ $filename = basename($file);
632
+
633
+ $upload_file = wp_upload_bits($filename, null, file_get_contents($file));
634
+ if (!$upload_file['error']) {
635
+ $wp_filetype = wp_check_filetype($filename, null );
636
+ $attachment = array(
637
+ 'post_mime_type' => $wp_filetype['type'],
638
+ 'post_parent' => 0,
639
+ 'post_title' => preg_replace('/\.[^.]+$/', '', $filename),
640
+ 'post_content' => '',
641
+ 'post_status' => 'inherit'
642
+ );
643
+ $attachment_id = wp_insert_attachment( $attachment, $upload_file['file'], $parent_post_id );
644
+ if (!is_wp_error($attachment_id)) {
645
+ require_once(ABSPATH . "wp-admin" . '/includes/image.php');
646
+ $attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload_file['file'] );
647
+ wp_update_attachment_metadata( $attachment_id, $attachment_data );
648
+ }
649
+ }
650
+
651
+ return $attachment_id;
652
+ }
653
  ?>
wordpress/common.php CHANGED
@@ -1,73 +1,73 @@
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
- wp_enqueue_style('crellyslider', CS_PLUGIN_URL . '/css/crellyslider.css', array(), CS_VERSION);
10
- if(CS_DEBUG) {
11
- wp_enqueue_script('jquery.crellyslider', CS_PLUGIN_URL . '/js/jquery.crellyslider.js', array(), CS_VERSION, false);
12
- }
13
- else {
14
- wp_enqueue_script('jquery.crellyslider.min', CS_PLUGIN_URL . '/js/jquery.crellyslider.min.js', array(), CS_VERSION, false);
15
- }
16
- }
17
-
18
- public static function setEnqueues() {
19
- add_action('wp_enqueue_scripts', 'CrellySliderCommon::enqueues');
20
- add_action('admin_enqueue_scripts', 'CrellySliderCommon::enqueues');
21
- }
22
-
23
- // Loads language file
24
- public static function textDomain() {
25
- $locale = apply_filters('plugin_locale', get_locale(), 'crelly-slider');
26
- load_textdomain('crelly-slider', WP_LANG_DIR . '/crelly-slider/crelly-slider-' . $locale . '.mo');
27
- load_plugin_textdomain('crelly-slider', false, dirname(plugin_basename(__FILE__)) . '/languages');
28
- }
29
-
30
- public static function loadPluginTextDomain() {
31
- add_action('plugins_loaded', 'CrellySliderCommon::textDomain');
32
- }
33
-
34
- // Returns true if a slider exists into the database. False if it doesn't
35
- public static function sliderExists($id) {
36
- global $wpdb;
37
- $slider = $wpdb->get_row($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($id)));
38
- if($slider != NULL) {
39
- return true;
40
- }
41
- return false;
42
- }
43
-
44
- // Returns the correct URL of an attachment
45
- public static function getURL($attachment_url) {
46
- // If the attachment ID is provided, get the URL
47
- if(is_numeric($attachment_url)) {
48
- return wp_get_attachment_url(intval($attachment_url));
49
- }
50
-
51
- // If a URL is provided, return the filtered URL
52
- if($attachment_url != 'none' && $attachment_url != 'undefined' && $attachment_url != '') {
53
- global $wpdb;
54
- $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s'", $attachment_url));
55
-
56
- if($attachment_id == NULL) {
57
- return $attachment_url;
58
- }
59
-
60
- $ret = wp_get_attachment_url($attachment_id);
61
-
62
- if($ret == false) {
63
- return $attachment_url;
64
- }
65
-
66
- return $ret;
67
- }
68
-
69
- // If something else is provided, do not touch it
70
- return $attachment_url;
71
- }
72
- }
73
- ?>
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
+ wp_enqueue_style('crellyslider', CS_PLUGIN_URL . '/css/crellyslider.css', array(), CS_VERSION);
10
+ if(CS_DEBUG) {
11
+ wp_enqueue_script('jquery.crellyslider', CS_PLUGIN_URL . '/js/jquery.crellyslider.js', array(), CS_VERSION, false);
12
+ }
13
+ else {
14
+ wp_enqueue_script('jquery.crellyslider.min', CS_PLUGIN_URL . '/js/jquery.crellyslider.min.js', array(), CS_VERSION, false);
15
+ }
16
+ }
17
+
18
+ public static function setEnqueues() {
19
+ add_action('wp_enqueue_scripts', 'CrellySliderCommon::enqueues');
20
+ add_action('admin_enqueue_scripts', 'CrellySliderCommon::enqueues');
21
+ }
22
+
23
+ // Loads language file
24
+ public static function textDomain() {
25
+ $locale = apply_filters('plugin_locale', get_locale(), 'crelly-slider');
26
+ load_textdomain('crelly-slider', WP_LANG_DIR . '/crelly-slider/crelly-slider-' . $locale . '.mo');
27
+ load_plugin_textdomain('crelly-slider', false, dirname(plugin_basename(__FILE__)) . '/languages');
28
+ }
29
+
30
+ public static function loadPluginTextDomain() {
31
+ add_action('plugins_loaded', 'CrellySliderCommon::textDomain');
32
+ }
33
+
34
+ // Returns true if a slider exists into the database. False if it doesn't
35
+ public static function sliderExists($id) {
36
+ global $wpdb;
37
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE id = %d', esc_sql($id)));
38
+ if($slider != NULL) {
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+
44
+ // Returns the correct URL of an attachment
45
+ public static function getURL($attachment_url) {
46
+ // If the attachment ID is provided, get the URL
47
+ if(is_numeric($attachment_url)) {
48
+ return wp_get_attachment_url(intval($attachment_url));
49
+ }
50
+
51
+ // If a URL is provided, return the filtered URL
52
+ if($attachment_url != 'none' && $attachment_url != 'undefined' && $attachment_url != '') {
53
+ global $wpdb;
54
+ $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s'", $attachment_url));
55
+
56
+ if($attachment_id == NULL) {
57
+ return $attachment_url;
58
+ }
59
+
60
+ $ret = wp_get_attachment_url($attachment_id);
61
+
62
+ if($ret == false) {
63
+ return $attachment_url;
64
+ }
65
+
66
+ return $ret;
67
+ }
68
+
69
+ // If something else is provided, do not touch it
70
+ return $attachment_url;
71
+ }
72
+ }
73
+ ?>
wordpress/css/admin.css CHANGED
@@ -1,566 +1,566 @@
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 .cs-style-list {
15
- list-style-type: disc;
16
- padding-left: 20px;
17
- }
18
-
19
- .cs-admin .cs-close,
20
- .cs-admin .cs-duplicate {
21
- display: inline-block;
22
- width: 13px;
23
- height: 13px;
24
- cursor: pointer;
25
- margin-top: -3px;
26
- vertical-align: middle;
27
- }
28
-
29
- .cs-admin .cs-close {
30
- background-image: url('../images/close.png');
31
- margin-left: 5px;
32
- }
33
-
34
- .cs-admin .cs-duplicate {
35
- background-image: url('../images/plus.png');
36
- margin-left: 10px;
37
- }
38
-
39
- .cs-admin .cs-button {
40
- position: relative;
41
- display: inline-block;
42
- -webkit-box-sizing: border-box;
43
- -moz-box-sizing: border-box;
44
- box-sizing: border-box;
45
- margin: 0;
46
- padding: 5px 14px;
47
- border: 1px solid transparent;
48
- border-radius: 2px;
49
- background-color: transparent;
50
- color: inherit;
51
- vertical-align: middle;
52
- text-align: center;
53
- text-decoration: none;
54
- text-transform: none;
55
- white-space: normal;
56
- font-weight: 400;
57
- font-style: normal;
58
- font-size: 13px;
59
- line-height: 20px;
60
- cursor: pointer;
61
- -webkit-transition: all .15s ease;
62
- transition: all .15s ease;
63
- -webkit-user-select: none;
64
- -moz-user-select: none;
65
- -ms-user-select: none;
66
- user-select: none;
67
- -webkit-appearance: none;
68
- -webkit-font-smoothing: antialiased;
69
- text-rendering: optimizeLegibility;
70
- }
71
-
72
- .cs-admin .cs-button:hover,.cs-button:focus {
73
- outline: 0;
74
- text-decoration: none;
75
- }
76
-
77
- .cs-admin .cs-button:active,.cs-button.cs-is-active {
78
- -webkit-box-shadow: none;
79
- box-shadow: none;
80
- text-decoration: none;
81
- }
82
-
83
- .cs-admin .cs-button[disabled],
84
- .cs-admin .cs-button.cs-is-disabled {
85
- opacity: 0.7;
86
- filter: alpha(opacity=70);
87
- cursor: not-allowed;
88
- pointer-events: none;
89
- }
90
-
91
- .cs-admin .cs-button.cs-is-default {
92
- border-color: #656d78;
93
- background-color: #f5f7fa;
94
- color: #434a54;
95
- }
96
-
97
- .cs-admin .cs-button.cs-is-default:hover,.cs-button.cs-is-default:focus {
98
- border-color: #737c89;
99
- background-color: #FFF;
100
- }
101
-
102
- .cs-admin .cs-button.cs-is-default:active,
103
- .cs-admin .cs-button.cs-is-default.cs-is-active {
104
- border-color: #575e67;
105
- background-color: #e1e7f0;
106
- }
107
-
108
- .cs-admin .cs-button.cs-is-primary {
109
- border-color: #2494be;
110
- background-color: #3bafda;
111
- color: #FFF;
112
- }
113
-
114
- .cs-admin .cs-button.cs-is-primary:hover,
115
- .cs-admin .cs-button.cs-is-primary:focus {
116
- border-color: #2aa8d7;
117
- background-color: #55badf;
118
- }
119
-
120
- .cs-admin .cs-button.cs-is-primary:active,
121
- .cs-admin .cs-button.cs-is-primary.cs-is-active {
122
- border-color: #1f80a4;
123
- background-color: #27a2cf;
124
- }
125
-
126
- .cs-admin .cs-button.cs-is-secondary {
127
- border-color: #7652d1;
128
- background-color: #967adc;
129
- color: #FFF;
130
- }
131
-
132
- .cs-admin .cs-button.cs-is-secondary:hover,
133
- .cs-admin .cs-button.cs-is-secondary:focus {
134
- border-color: #896ad7;
135
- background-color: #a992e2;
136
- }
137
-
138
- .cs-admin .cs-button.cs-is-secondary:active,
139
- .cs-admin .cs-button.cs-is-secondary.cs-is-active {
140
- border-color: #633acb;
141
- background-color: #8362d6;
142
- }
143
-
144
- .cs-admin .cs-button.cs-is-success {
145
- border-color: #72a53b;
146
- background-color: #8cc152;
147
- color: #FFF;
148
- }
149
-
150
- .cs-admin .cs-button.cs-is-success:hover,
151
- .cs-admin .cs-button.cs-is-success:focus {
152
- border-color: #82bc43;
153
- background-color: #9bc969;
154
- }
155
-
156
- .cs-admin .cs-button.cs-is-success:active,
157
- .cs-admin .cs-button.cs-is-success.cs-is-active {
158
- border-color: #628e33;
159
- background-color: #7db440;
160
- }
161
-
162
- .cs-admin .cs-button.cs-is-warning {
163
- border-color: #f4a911;
164
- background-color: #f6bb42;
165
- color: #FFF;
166
- }
167
-
168
- .cs-admin .cs-button.cs-is-warning:hover,
169
- .cs-admin .cs-button.cs-is-warning:focus {
170
- border-color: #f5b42e;
171
- background-color: #f7c65f;
172
- }
173
-
174
- .cs-admin .cs-button.cs-is-warning:active,
175
- .cs-admin .cs-button.cs-is-warning.cs-is-active {
176
- border-color: #dc970a;
177
- background-color: #f5b025;
178
- }
179
-
180
- .cs-admin .cs-button.cs-is-danger {
181
- border-color: #c42737;
182
- background-color: #da4453;
183
- color: #FFF;
184
- }
185
-
186
- .cs-admin .cs-button.cs-is-danger:hover,
187
- .cs-admin .cs-button.cs-is-danger:focus {
188
- border-color: #d63344;
189
- background-color: #df5e6a;
190
- }
191
-
192
- .cs-admin .cs-button.cs-is-danger:active,
193
- .cs-admin .cs-button.cs-is-danger.cs-is-active {
194
- border-color: #aa2230;
195
- background-color: #d52a3c;
196
- }
197
-
198
- .cs-admin .cs-button.cs-is-inverse {
199
- border-color: #434a54;
200
- background-color: #656d78;
201
- color: #FFF;
202
- }
203
-
204
- .cs-admin .cs-button.cs-is-inverse:hover,
205
- .cs-admin .cs-button.cs-is-inverse:focus {
206
- border-color: #515965;
207
- background-color: #737c89;
208
- }
209
-
210
- .cs-admin .cs-button.cs-is-inverse:active,
211
- .cs-admin .cs-button.cs-is-inverse.cs-is-active {
212
- border-color: #353b43;
213
- background-color: #575e67;
214
- }
215
-
216
- .cs-admin .cs-table {
217
- overflow:hidden;
218
- border:1px solid #d3d3d3;
219
- background:#fefefe;
220
- -moz-border-radius:5px;
221
- -webkit-border-radius:5px;
222
- border-radius:5px;
223
- width: 100%;
224
- border-spacing: 0px;
225
- border-collapse: separate;
226
- clear: left;
227
- position: relative;
228
- z-index: 999;
229
- }
230
-
231
- .cs-admin .cs-table th,
232
- .cs-admin .cs-table td {
233
- padding:15px 28px;
234
- }
235
-
236
- .cs-admin .cs-table th {
237
- padding-top: 15px;
238
- text-shadow: 1px 1px 1px #fff;
239
- background: #e8eaeb;
240
- }
241
-
242
- .cs-admin .cs-table td {
243
- border-top: 1px solid #e0e0e0;
244
- border-right: 1px solid #e0e0e0;
245
- }
246
-
247
- .cs-admin .cs-table td:last-child {
248
- border-right: none;
249
- }
250
-
251
- .cs-admin .cs-table tr.odd-row td {
252
- background: #f6f6f6;
253
- }
254
-
255
- .cs-admin .cs-table td.first,
256
- .cs-admin .cs-table th.first {
257
- text-align: left;
258
- }
259
-
260
- .cs-admin .cs-table td.last {
261
- border-right: none;
262
- }
263
-
264
- .cs-admin .cs-table tr.odd-row td {
265
- background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
266
- background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
267
- }
268
-
269
- .cs-admin .cs-table th {
270
- background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
271
- background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
272
- }
273
-
274
- .cs-admin .cs-table tr:first-child th.first {
275
- -moz-border-radius-topleft: 5px;
276
- -webkit-border-top-left-radius: 5px;
277
- }
278
-
279
- .cs-admin .cs-table tr:first-child th.last {
280
- -moz-border-radius-topright: 5px;
281
- -webkit-border-top-right-radius: 5px;
282
- }
283
-
284
- .cs-admin .cs-table tr:last-child td.first {
285
- -moz-border-radius-bottomleft: 5px;
286
- -webkit-border-bottom-left-radius: 5px;
287
- }
288
-
289
- .cs-admin .cs-table tr:last-child td.last {
290
- -moz-border-radius-bottomright: 5px;
291
- -webkit-border-bottom-right-radius: 5px;
292
- }
293
-
294
- .cs-admin .cs-table .cs-table-header {
295
- text-align: center;
296
- font-weight: bold;
297
- }
298
-
299
- .cs-admin .cs-table .cs-name,
300
- .cs-admin .cs-table .cs-description {
301
- width: 25%;
302
- }
303
-
304
- .cs-admin .cs-table .cs-content {
305
- width: 50%;
306
- }
307
-
308
- .cs-admin textarea {
309
- width: 100%;
310
- height: 200px;
311
- }
312
-
313
- .cs-admin #cs-slider-name {
314
- width: 100%;
315
- padding: 10px;
316
- }
317
-
318
- .cs-admin .cs-message {
319
- padding: 15px;
320
- border-radius: 4px;
321
- border: solid 1px;
322
- margin-top: 15px;
323
- margin-bottom: 25px;
324
- }
325
-
326
- .cs-admin .cs-message.cs-message-ok {
327
- background-color: #dff0d8;
328
- border-color: #72a53b;
329
- color: #3c763d;
330
- }
331
-
332
- .cs-admin .cs-message.cs-message-error {
333
- background-color: #f2dede;
334
- border-color: #c42737;
335
- color: #a94442;
336
- }
337
-
338
- .cs-admin .cs-message.cs-message-warning {
339
- color: #8a6d3b;
340
- background-color: #fcf8e3;
341
- border-color: #f4a911;
342
- }
343
-
344
- #cs-slides {
345
- display: none;
346
- }
347
-
348
- .cs-admin .cs-slides .cs-slide-build {
349
- border: solid 1px #ddd;
350
- }
351
-
352
- .cs-admin .cs-tabs > ul {
353
- width: auto;
354
- }
355
-
356
- .cs-admin .cs-tabs > ul {
357
- margin: 0;
358
- }
359
-
360
- .cs-admin .cs-tabs > ul > li {
361
- float: left;
362
- margin-bottom: 0;
363
- padding-right: 20px;
364
- margin-right: 20px;
365
- border-right: solid 1px #ddd;
366
- text-transform: uppercase;
367
- font-weight: bold;
368
- outline: none;
369
- display: block;
370
- white-space: nowrap;
371
- }
372
-
373
- .cs-admin .cs-tabs.cs-tabs-border > ul > li {
374
- border-top: solid 1px #ddd;
375
- margin-right: 0;
376
- padding-top: 20px;
377
- padding-bottom: 20px;
378
- padding-left: 30px;
379
- padding-right: 30px;
380
- }
381
-
382
- .cs-admin .cs-tabs.cs-tabs-border > ul > li:hover,
383
- .cs-admin .cs-tabs.cs-tabs-border > ul > li.active {
384
- background-color: #e9e9e9;
385
- }
386
-
387
- .cs-admin .cs-tabs > ul > li > a {
388
- margin-left: 5px;
389
- }
390
-
391
- .cs-admin .cs-tabs.cs-tabs-border > ul > li:first-child {
392
- border-left: solid 1px #ddd;
393
- }
394
-
395
- .cs-admin .cs-tabs.cs-tabs-border > ul > li:last-child {
396
- border-right: solid 1px #ddd;
397
- }
398
-
399
- .cs-admin .cs-tabs > ul > li:last-child {
400
- border-right: none;
401
- }
402
-
403
- .cs-admin .cs-slide-tabs > ul > li,
404
- .cs-admin .cs-slide-tabs > ul > li > a {
405
- cursor: move;
406
- }
407
-
408
- .cs-admin .cs-slide-tabs > ul > li > a > .cs-slide-name-text {
409
- cursor: pointer;
410
- }
411
-
412
- .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled,
413
- .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled a {
414
- cursor: pointer;
415
- }
416
-
417
- .cs-admin .cs-icon {
418
- display: inline-block;
419
- width: 13px;
420
- height: 13px;
421
- }
422
-
423
- .cs-admin .cs-icon.icon-settings {
424
- background-image: url('../images/settings.png');
425
- }
426
- .cs-admin .cs-icon.icon-edit {
427
- background-image: url('../images/edit.png');
428
- }
429
-
430
- .cs-admin .cs-slide-build {
431
- margin: 0 auto;
432
- }
433
-
434
- .cs-admin .cs-slides-list > .cs-slide,
435
- .cs-admin .cs-void-slide {
436
- display: none;
437
- }
438
-
439
- .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list form {
440
- display: inline;
441
- }
442
-
443
- .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input {
444
- display: none !important;
445
- }
446
-
447
- .cs-admin .wp-picker-holder {
448
- position: absolute;
449
- }
450
-
451
- .cs-admin .cs-slide .cs-slide-editing-area {
452
- position: relative;
453
- background-color: #fff;
454
- -moz-border-radius: 4px;
455
- border-radius: 4px;
456
- margin: 0 auto;
457
- line-height: 1.5;
458
- white-space: nowrap;
459
-
460
- line-height: 1.5;
461
- font-size: 14px;
462
- color: #000;
463
- font-family: 'Verdana', sans-serif;
464
-
465
- /* Default slide background settings: */
466
- background-repeat: no-repeat;
467
- background-size: cover;
468
- background-position: center center;
469
- }
470
-
471
- .cs-admin .cs-slide .cs-slide-editing-area a {
472
- color: #0073aa;
473
- }
474
-
475
- .cs-admin .cs-slide .cs-slide-editing-area a:hover {
476
- color: #0073aa;
477
- }
478
-
479
- .cs-admin .cs-slide .cs-slide-editing-area:before,
480
- .cs-admin .cs-slide .cs-slide-editing-area:after{
481
- z-index: -1;
482
- position: absolute;
483
- content: "";
484
- bottom: 15px;
485
- left: 10px;
486
- width: 50%;
487
- top: 80%;
488
- max-width:300px;
489
- background: rgba(0, 0, 0, 0.7);
490
- -webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.4);
491
- -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
492
- box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
493
- -webkit-transform: rotate(-3deg);
494
- -moz-transform: rotate(-3deg);
495
- -o-transform: rotate(-3deg);
496
- -ms-transform: rotate(-3deg);
497
- transform: rotate(-3deg);
498
- }
499
-
500
- .cs-admin .cs-slide .cs-slide-editing-area:after{
501
- -webkit-transform: rotate(3deg);
502
- -moz-transform: rotate(3deg);
503
- -o-transform: rotate(3deg);
504
- -ms-transform: rotate(3deg);
505
- transform: rotate(3deg);
506
- right: 10px;
507
- left: auto;
508
- }
509
-
510
- .cs-admin .cs-slide .cs-elements .cs-elements-actions {
511
- text-align: center;
512
- z-index: 999;
513
- position: relative;
514
- }
515
-
516
- .cs-admin .cs-slide .cs-elements .cs-void-element-settings {
517
- display: none;
518
- }
519
-
520
- .cs-admin .cs-slide .cs-slide-editing-area .cs-element {
521
- position: absolute;
522
- margin: 0;
523
- padding: 0;
524
- left: 0;
525
- top: 0;
526
- cursor: move;
527
- }
528
-
529
- .crellyslider ul li * {
530
- cursor: auto !important;
531
- }
532
-
533
- .cs-admin .cs-slide .cs-slide-live-preview-area > ul,
534
- .cs-admin .cs-slide .cs-slide-live-preview-area > ul > li {
535
- margin: 0;
536
- padding: 0;
537
- }
538
-
539
- .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element {
540
- min-width: 560px;
541
- min-height: 315px;
542
- background-color: #000;
543
- }
544
-
545
- .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element .cs-avoid-interaction {
546
- width: 100%;
547
- height: 100%;
548
- position: absolute;
549
- top: 0;
550
- left: 0;
551
- }
552
-
553
- .cs-admin .cs-slide .cs-slide-editing-area .cs-element.active {
554
- -webkit-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
555
- -moz-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
556
- box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
557
- }
558
-
559
- .cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-switch-editor {
560
- margin-bottom: 15px;
561
- text-align: right;
562
- }
563
-
564
- .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
565
- display: block !important;
566
- }
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 .cs-style-list {
15
+ list-style-type: disc;
16
+ padding-left: 20px;
17
+ }
18
+
19
+ .cs-admin .cs-close,
20
+ .cs-admin .cs-duplicate {
21
+ display: inline-block;
22
+ width: 13px;
23
+ height: 13px;
24
+ cursor: pointer;
25
+ margin-top: -3px;
26
+ vertical-align: middle;
27
+ }
28
+
29
+ .cs-admin .cs-close {
30
+ background-image: url('../images/close.png');
31
+ margin-left: 5px;
32
+ }
33
+
34
+ .cs-admin .cs-duplicate {
35
+ background-image: url('../images/plus.png');
36
+ margin-left: 10px;
37
+ }
38
+
39
+ .cs-admin .cs-button {
40
+ position: relative;
41
+ display: inline-block;
42
+ -webkit-box-sizing: border-box;
43
+ -moz-box-sizing: border-box;
44
+ box-sizing: border-box;
45
+ margin: 0;
46
+ padding: 5px 14px;
47
+ border: 1px solid transparent;
48
+ border-radius: 2px;
49
+ background-color: transparent;
50
+ color: inherit;
51
+ vertical-align: middle;
52
+ text-align: center;
53
+ text-decoration: none;
54
+ text-transform: none;
55
+ white-space: normal;
56
+ font-weight: 400;
57
+ font-style: normal;
58
+ font-size: 13px;
59
+ line-height: 20px;
60
+ cursor: pointer;
61
+ -webkit-transition: all .15s ease;
62
+ transition: all .15s ease;
63
+ -webkit-user-select: none;
64
+ -moz-user-select: none;
65
+ -ms-user-select: none;
66
+ user-select: none;
67
+ -webkit-appearance: none;
68
+ -webkit-font-smoothing: antialiased;
69
+ text-rendering: optimizeLegibility;
70
+ }
71
+
72
+ .cs-admin .cs-button:hover,.cs-button:focus {
73
+ outline: 0;
74
+ text-decoration: none;
75
+ }
76
+
77
+ .cs-admin .cs-button:active,.cs-button.cs-is-active {
78
+ -webkit-box-shadow: none;
79
+ box-shadow: none;
80
+ text-decoration: none;
81
+ }
82
+
83
+ .cs-admin .cs-button[disabled],
84
+ .cs-admin .cs-button.cs-is-disabled {
85
+ opacity: 0.7;
86
+ filter: alpha(opacity=70);
87
+ cursor: not-allowed;
88
+ pointer-events: none;
89
+ }
90
+
91
+ .cs-admin .cs-button.cs-is-default {
92
+ border-color: #656d78;
93
+ background-color: #f5f7fa;
94
+ color: #434a54;
95
+ }
96
+
97
+ .cs-admin .cs-button.cs-is-default:hover,.cs-button.cs-is-default:focus {
98
+ border-color: #737c89;
99
+ background-color: #FFF;
100
+ }
101
+
102
+ .cs-admin .cs-button.cs-is-default:active,
103
+ .cs-admin .cs-button.cs-is-default.cs-is-active {
104
+ border-color: #575e67;
105
+ background-color: #e1e7f0;
106
+ }
107
+
108
+ .cs-admin .cs-button.cs-is-primary {
109
+ border-color: #2494be;
110
+ background-color: #3bafda;
111
+ color: #FFF;
112
+ }
113
+
114
+ .cs-admin .cs-button.cs-is-primary:hover,
115
+ .cs-admin .cs-button.cs-is-primary:focus {
116
+ border-color: #2aa8d7;
117
+ background-color: #55badf;
118
+ }
119
+
120
+ .cs-admin .cs-button.cs-is-primary:active,
121
+ .cs-admin .cs-button.cs-is-primary.cs-is-active {
122
+ border-color: #1f80a4;
123
+ background-color: #27a2cf;
124
+ }
125
+
126
+ .cs-admin .cs-button.cs-is-secondary {
127
+ border-color: #7652d1;
128
+ background-color: #967adc;
129
+ color: #FFF;
130
+ }
131
+
132
+ .cs-admin .cs-button.cs-is-secondary:hover,
133
+ .cs-admin .cs-button.cs-is-secondary:focus {
134
+ border-color: #896ad7;
135
+ background-color: #a992e2;
136
+ }
137
+
138
+ .cs-admin .cs-button.cs-is-secondary:active,
139
+ .cs-admin .cs-button.cs-is-secondary.cs-is-active {
140
+ border-color: #633acb;
141
+ background-color: #8362d6;
142
+ }
143
+
144
+ .cs-admin .cs-button.cs-is-success {
145
+ border-color: #72a53b;
146
+ background-color: #8cc152;
147
+ color: #FFF;
148
+ }
149
+
150
+ .cs-admin .cs-button.cs-is-success:hover,
151
+ .cs-admin .cs-button.cs-is-success:focus {
152
+ border-color: #82bc43;
153
+ background-color: #9bc969;
154
+ }
155
+
156
+ .cs-admin .cs-button.cs-is-success:active,
157
+ .cs-admin .cs-button.cs-is-success.cs-is-active {
158
+ border-color: #628e33;
159
+ background-color: #7db440;
160
+ }
161
+
162
+ .cs-admin .cs-button.cs-is-warning {
163
+ border-color: #f4a911;
164
+ background-color: #f6bb42;
165
+ color: #FFF;
166
+ }
167
+
168
+ .cs-admin .cs-button.cs-is-warning:hover,
169
+ .cs-admin .cs-button.cs-is-warning:focus {
170
+ border-color: #f5b42e;
171
+ background-color: #f7c65f;
172
+ }
173
+
174
+ .cs-admin .cs-button.cs-is-warning:active,
175
+ .cs-admin .cs-button.cs-is-warning.cs-is-active {
176
+ border-color: #dc970a;
177
+ background-color: #f5b025;
178
+ }
179
+
180
+ .cs-admin .cs-button.cs-is-danger {
181
+ border-color: #c42737;
182
+ background-color: #da4453;
183
+ color: #FFF;
184
+ }
185
+
186
+ .cs-admin .cs-button.cs-is-danger:hover,
187
+ .cs-admin .cs-button.cs-is-danger:focus {
188
+ border-color: #d63344;
189
+ background-color: #df5e6a;
190
+ }
191
+
192
+ .cs-admin .cs-button.cs-is-danger:active,
193
+ .cs-admin .cs-button.cs-is-danger.cs-is-active {
194
+ border-color: #aa2230;
195
+ background-color: #d52a3c;
196
+ }
197
+
198
+ .cs-admin .cs-button.cs-is-inverse {
199
+ border-color: #434a54;
200
+ background-color: #656d78;
201
+ color: #FFF;
202
+ }
203
+
204
+ .cs-admin .cs-button.cs-is-inverse:hover,
205
+ .cs-admin .cs-button.cs-is-inverse:focus {
206
+ border-color: #515965;
207
+ background-color: #737c89;
208
+ }
209
+
210
+ .cs-admin .cs-button.cs-is-inverse:active,
211
+ .cs-admin .cs-button.cs-is-inverse.cs-is-active {
212
+ border-color: #353b43;
213
+ background-color: #575e67;
214
+ }
215
+
216
+ .cs-admin .cs-table {
217
+ overflow:hidden;
218
+ border:1px solid #d3d3d3;
219
+ background:#fefefe;
220
+ -moz-border-radius:5px;
221
+ -webkit-border-radius:5px;
222
+ border-radius:5px;
223
+ width: 100%;
224
+ border-spacing: 0px;
225
+ border-collapse: separate;
226
+ clear: left;
227
+ position: relative;
228
+ z-index: 999;
229
+ }
230
+
231
+ .cs-admin .cs-table th,
232
+ .cs-admin .cs-table td {
233
+ padding:15px 28px;
234
+ }
235
+
236
+ .cs-admin .cs-table th {
237
+ padding-top: 15px;
238
+ text-shadow: 1px 1px 1px #fff;
239
+ background: #e8eaeb;
240
+ }
241
+
242
+ .cs-admin .cs-table td {
243
+ border-top: 1px solid #e0e0e0;
244
+ border-right: 1px solid #e0e0e0;
245
+ }
246
+
247
+ .cs-admin .cs-table td:last-child {
248
+ border-right: none;
249
+ }
250
+
251
+ .cs-admin .cs-table tr.odd-row td {
252
+ background: #f6f6f6;
253
+ }
254
+
255
+ .cs-admin .cs-table td.first,
256
+ .cs-admin .cs-table th.first {
257
+ text-align: left;
258
+ }
259
+
260
+ .cs-admin .cs-table td.last {
261
+ border-right: none;
262
+ }
263
+
264
+ .cs-admin .cs-table tr.odd-row td {
265
+ background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
266
+ background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
267
+ }
268
+
269
+ .cs-admin .cs-table th {
270
+ background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
271
+ background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
272
+ }
273
+
274
+ .cs-admin .cs-table tr:first-child th.first {
275
+ -moz-border-radius-topleft: 5px;
276
+ -webkit-border-top-left-radius: 5px;
277
+ }
278
+
279
+ .cs-admin .cs-table tr:first-child th.last {
280
+ -moz-border-radius-topright: 5px;
281
+ -webkit-border-top-right-radius: 5px;
282
+ }
283
+
284
+ .cs-admin .cs-table tr:last-child td.first {
285
+ -moz-border-radius-bottomleft: 5px;
286
+ -webkit-border-bottom-left-radius: 5px;
287
+ }
288
+
289
+ .cs-admin .cs-table tr:last-child td.last {
290
+ -moz-border-radius-bottomright: 5px;
291
+ -webkit-border-bottom-right-radius: 5px;
292
+ }
293
+
294
+ .cs-admin .cs-table .cs-table-header {
295
+ text-align: center;
296
+ font-weight: bold;
297
+ }
298
+
299
+ .cs-admin .cs-table .cs-name,
300
+ .cs-admin .cs-table .cs-description {
301
+ width: 25%;
302
+ }
303
+
304
+ .cs-admin .cs-table .cs-content {
305
+ width: 50%;
306
+ }
307
+
308
+ .cs-admin textarea {
309
+ width: 100%;
310
+ height: 200px;
311
+ }
312
+
313
+ .cs-admin #cs-slider-name {
314
+ width: 100%;
315
+ padding: 10px;
316
+ }
317
+
318
+ .cs-admin .cs-message {
319
+ padding: 15px;
320
+ border-radius: 4px;
321
+ border: solid 1px;
322
+ margin-top: 15px;
323
+ margin-bottom: 25px;
324
+ }
325
+
326
+ .cs-admin .cs-message.cs-message-ok {
327
+ background-color: #dff0d8;
328
+ border-color: #72a53b;
329
+ color: #3c763d;
330
+ }
331
+
332
+ .cs-admin .cs-message.cs-message-error {
333
+ background-color: #f2dede;
334
+ border-color: #c42737;
335
+ color: #a94442;
336
+ }
337
+
338
+ .cs-admin .cs-message.cs-message-warning {
339
+ color: #8a6d3b;
340
+ background-color: #fcf8e3;
341
+ border-color: #f4a911;
342
+ }
343
+
344
+ #cs-slides {
345
+ display: none;
346
+ }
347
+
348
+ .cs-admin .cs-slides .cs-slide-build {
349
+ border: solid 1px #ddd;
350
+ }
351
+
352
+ .cs-admin .cs-tabs > ul {
353
+ width: auto;
354
+ }
355
+
356
+ .cs-admin .cs-tabs > ul {
357
+ margin: 0;
358
+ }
359
+
360
+ .cs-admin .cs-tabs > ul > li {
361
+ float: left;
362
+ margin-bottom: 0;
363
+ padding-right: 20px;
364
+ margin-right: 20px;
365
+ border-right: solid 1px #ddd;
366
+ text-transform: uppercase;
367
+ font-weight: bold;
368
+ outline: none;
369
+ display: block;
370
+ white-space: nowrap;
371
+ }
372
+
373
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li {
374
+ border-top: solid 1px #ddd;
375
+ margin-right: 0;
376
+ padding-top: 20px;
377
+ padding-bottom: 20px;
378
+ padding-left: 30px;
379
+ padding-right: 30px;
380
+ }
381
+
382
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li:hover,
383
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li.active {
384
+ background-color: #e9e9e9;
385
+ }
386
+
387
+ .cs-admin .cs-tabs > ul > li > a {
388
+ margin-left: 5px;
389
+ }
390
+
391
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li:first-child {
392
+ border-left: solid 1px #ddd;
393
+ }
394
+
395
+ .cs-admin .cs-tabs.cs-tabs-border > ul > li:last-child {
396
+ border-right: solid 1px #ddd;
397
+ }
398
+
399
+ .cs-admin .cs-tabs > ul > li:last-child {
400
+ border-right: none;
401
+ }
402
+
403
+ .cs-admin .cs-slide-tabs > ul > li,
404
+ .cs-admin .cs-slide-tabs > ul > li > a {
405
+ cursor: move;
406
+ }
407
+
408
+ .cs-admin .cs-slide-tabs > ul > li > a > .cs-slide-name-text {
409
+ cursor: pointer;
410
+ }
411
+
412
+ .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled,
413
+ .cs-admin .cs-slide-tabs > ul > li.ui-state-disabled a {
414
+ cursor: pointer;
415
+ }
416
+
417
+ .cs-admin .cs-icon {
418
+ display: inline-block;
419
+ width: 13px;
420
+ height: 13px;
421
+ }
422
+
423
+ .cs-admin .cs-icon.icon-settings {
424
+ background-image: url('../images/settings.png');
425
+ }
426
+ .cs-admin .cs-icon.icon-edit {
427
+ background-image: url('../images/edit.png');
428
+ }
429
+
430
+ .cs-admin .cs-slide-build {
431
+ margin: 0 auto;
432
+ }
433
+
434
+ .cs-admin .cs-slides-list > .cs-slide,
435
+ .cs-admin .cs-void-slide {
436
+ display: none;
437
+ }
438
+
439
+ .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list form {
440
+ display: inline;
441
+ }
442
+
443
+ .cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input {
444
+ display: none !important;
445
+ }
446
+
447
+ .cs-admin .wp-picker-holder {
448
+ position: absolute;
449
+ }
450
+
451
+ .cs-admin .cs-slide .cs-slide-editing-area {
452
+ position: relative;
453
+ background-color: #fff;
454
+ -moz-border-radius: 4px;
455
+ border-radius: 4px;
456
+ margin: 0 auto;
457
+ line-height: 1.5;
458
+ white-space: nowrap;
459
+
460
+ line-height: 1.5;
461
+ font-size: 14px;
462
+ color: #000;
463
+ font-family: 'Verdana', sans-serif;
464
+
465
+ /* Default slide background settings: */
466
+ background-repeat: no-repeat;
467
+ background-size: cover;
468
+ background-position: center center;
469
+ }
470
+
471
+ .cs-admin .cs-slide .cs-slide-editing-area a {
472
+ color: #0073aa;
473
+ }
474
+
475
+ .cs-admin .cs-slide .cs-slide-editing-area a:hover {
476
+ color: #0073aa;
477
+ }
478
+
479
+ .cs-admin .cs-slide .cs-slide-editing-area:before,
480
+ .cs-admin .cs-slide .cs-slide-editing-area:after{
481
+ z-index: -1;
482
+ position: absolute;
483
+ content: "";
484
+ bottom: 15px;
485
+ left: 10px;
486
+ width: 50%;
487
+ top: 80%;
488
+ max-width:300px;
489
+ background: rgba(0, 0, 0, 0.7);
490
+ -webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.4);
491
+ -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
492
+ box-shadow: 0 15px 10px rgba(0, 0, 0, 0.4);
493
+ -webkit-transform: rotate(-3deg);
494
+ -moz-transform: rotate(-3deg);
495
+ -o-transform: rotate(-3deg);
496
+ -ms-transform: rotate(-3deg);
497
+ transform: rotate(-3deg);
498
+ }
499
+
500
+ .cs-admin .cs-slide .cs-slide-editing-area:after{
501
+ -webkit-transform: rotate(3deg);
502
+ -moz-transform: rotate(3deg);
503
+ -o-transform: rotate(3deg);
504
+ -ms-transform: rotate(3deg);
505
+ transform: rotate(3deg);
506
+ right: 10px;
507
+ left: auto;
508
+ }
509
+
510
+ .cs-admin .cs-slide .cs-elements .cs-elements-actions {
511
+ text-align: center;
512
+ z-index: 999;
513
+ position: relative;
514
+ }
515
+
516
+ .cs-admin .cs-slide .cs-elements .cs-void-element-settings {
517
+ display: none;
518
+ }
519
+
520
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-element {
521
+ position: absolute;
522
+ margin: 0;
523
+ padding: 0;
524
+ left: 0;
525
+ top: 0;
526
+ cursor: move;
527
+ }
528
+
529
+ .crellyslider ul li * {
530
+ cursor: auto !important;
531
+ }
532
+
533
+ .cs-admin .cs-slide .cs-slide-live-preview-area > ul,
534
+ .cs-admin .cs-slide .cs-slide-live-preview-area > ul > li {
535
+ margin: 0;
536
+ padding: 0;
537
+ }
538
+
539
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element {
540
+ min-width: 560px;
541
+ min-height: 315px;
542
+ background-color: #000;
543
+ }
544
+
545
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-video-element .cs-avoid-interaction {
546
+ width: 100%;
547
+ height: 100%;
548
+ position: absolute;
549
+ top: 0;
550
+ left: 0;
551
+ }
552
+
553
+ .cs-admin .cs-slide .cs-slide-editing-area .cs-element.active {
554
+ -webkit-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
555
+ -moz-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
556
+ box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
557
+ }
558
+
559
+ .cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-switch-editor {
560
+ margin-bottom: 15px;
561
+ text-align: right;
562
+ }
563
+
564
+ .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
565
+ display: block !important;
566
+ }
wordpress/elements.php CHANGED
@@ -1,991 +1,991 @@
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 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 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('Loop video', 'crelly-slider'); ?></td>
777
- <td class="cs-content">
778
- <?php
779
- 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>';
780
- else {
781
- if($element->video_loop == 0) {
782
- echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
783
- }
784
- else {
785
- echo '<select class="cs-element-video_loop"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
786
- }
787
- }
788
- ?>
789
- </td>
790
- <td class="cs-description">
791
- <?php _e('The video will automatically restart from the beginning when it reaches the end.', 'crelly-slider'); ?>
792
- </td>
793
- </tr>
794
- <tr>
795
- <td class="cs-name"><?php _e('Autoplay', 'crelly-slider'); ?></td>
796
- <td class="cs-content">
797
- <?php
798
- 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>';
799
- else {
800
- if($element->video_autoplay == 0) {
801
- echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
802
- }
803
- else {
804
- echo '<select class="cs-element-video_autoplay"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
805
- }
806
- }
807
- ?>
808
- </td>
809
- <td class="cs-description">
810
- <?php _e('The video will automatically be played after the in animation.', 'crelly-slider'); ?>
811
- </td>
812
- </tr>
813
- <tr>
814
- <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
815
- <td class="cs-content">
816
- <?php
817
- if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
818
- else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
819
- ?>
820
- px
821
- <br />
822
- <br />
823
- <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
824
- </td>
825
- <td class="cs-description">
826
- <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
827
- </td>
828
- </tr>
829
- <tr>
830
- <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
831
- <td class="cs-content">
832
- <?php
833
- if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
834
- else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
835
- ?>
836
- px
837
- <br />
838
- <br />
839
- <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
840
- </td>
841
- <td class="cs-description">
842
- <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
843
- </td>
844
- </tr>
845
- <tr>
846
- <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
847
- <td class="cs-content">
848
- <?php
849
- if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
850
- else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
851
- ?>
852
- </td>
853
- <td class="cs-description">
854
- <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
855
- </td>
856
- </tr>
857
- <tr>
858
- <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
859
- <td class="cs-content">
860
- <?php
861
- if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
862
- else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
863
- ?>
864
- ms
865
- </td>
866
- <td class="cs-description">
867
- <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
868
- </td>
869
- </tr>
870
- <tr>
871
- <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
872
- <td class="cs-content">
873
- <?php
874
- if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
875
- else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
876
- ?>
877
- ms
878
- </td>
879
- <td class="cs-description">
880
- <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
881
- <br />
882
- <br />
883
- <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
884
- <br />
885
- <br />
886
- <?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'); ?>
887
- </td>
888
- </tr>
889
- <tr>
890
- <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
891
- <td class="cs-content">
892
- <select class="cs-element-data_in">
893
- <?php
894
- foreach($animations as $key => $value) {
895
- echo '<option value="' . $key . '"';
896
- if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
897
- echo ' selected';
898
- }
899
- echo '>' . $value[0] . '</option>';
900
- }
901
- ?>
902
- </select>
903
- </td>
904
- <td class="cs-description">
905
- <?php _e('The in animation of the element.', 'crelly-slider'); ?>
906
- </td>
907
- </tr>
908
- <tr>
909
- <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
910
- <td class="cs-content">
911
- <select class="cs-element-data_out">
912
- <?php
913
- foreach($animations as $key => $value) {
914
- echo '<option value="' . $key . '"';
915
- if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
916
- echo ' selected';
917
- }
918
- echo '>' . $value[0] . '</option>';
919
- }
920
- ?>
921
- </select>
922
- <br />
923
- <?php
924
- if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
925
- else {
926
- if($element->data_ignoreEaseOut) {
927
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
928
- }
929
- else {
930
- echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
931
- }
932
- }
933
- ?>
934
- </td>
935
- <td class="cs-description">
936
- <?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'); ?>
937
- </td>
938
- </tr>
939
- <tr>
940
- <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
941
- <td class="cs-content">
942
- <?php
943
- if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
944
- else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
945
- ?>
946
- ms
947
- </td>
948
- <td class="cs-description">
949
- <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
950
- </td>
951
- </tr>
952
- <tr>
953
- <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
954
- <td class="cs-content">
955
- <?php
956
- if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
957
- else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
958
- ?>
959
- ms
960
- </td>
961
- <td class="cs-description">
962
- <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
963
- </td>
964
- </tr>
965
- <tr>
966
- <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
967
- <td class="cs-content">
968
- <?php
969
- if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
970
- else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
971
- ?>
972
- </td>
973
- <td class="cs-description">
974
- <?php _e('Style the element.', 'crelly-slider'); ?>
975
- </td>
976
- </tr>
977
- <tr>
978
- <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
979
- <td class="cs-content">
980
- <?php
981
- if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
982
- else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
983
- ?>
984
- </td>
985
- <td class="cs-description">
986
- <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
987
- </td>
988
- </tr>
989
- </tbody>
990
- </table>
991
- <?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 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 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('Loop video', 'crelly-slider'); ?></td>
777
+ <td class="cs-content">
778
+ <?php
779
+ 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>';
780
+ else {
781
+ if($element->video_loop == 0) {
782
+ echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
783
+ }
784
+ else {
785
+ echo '<select class="cs-element-video_loop"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
786
+ }
787
+ }
788
+ ?>
789
+ </td>
790
+ <td class="cs-description">
791
+ <?php _e('The video will automatically restart from the beginning when it reaches the end.', 'crelly-slider'); ?>
792
+ </td>
793
+ </tr>
794
+ <tr>
795
+ <td class="cs-name"><?php _e('Autoplay', 'crelly-slider'); ?></td>
796
+ <td class="cs-content">
797
+ <?php
798
+ 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>';
799
+ else {
800
+ if($element->video_autoplay == 0) {
801
+ echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
802
+ }
803
+ else {
804
+ echo '<select class="cs-element-video_autoplay"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
805
+ }
806
+ }
807
+ ?>
808
+ </td>
809
+ <td class="cs-description">
810
+ <?php _e('The video will automatically be played after the in animation.', 'crelly-slider'); ?>
811
+ </td>
812
+ </tr>
813
+ <tr>
814
+ <td class="cs-name"><?php _e('Left', 'crelly-slider'); ?></td>
815
+ <td class="cs-content">
816
+ <?php
817
+ if($void) echo '<input class="cs-element-data_left" type="text" value="0" />';
818
+ else echo '<input class="cs-element-data_left" type="text" value="' . sanitize_text_field($element->data_left) .'" />';
819
+ ?>
820
+ px
821
+ <br />
822
+ <br />
823
+ <input type="button" class="cs-element-center-x cs-button cs-is-default" value="<?php _e('Center horizontally', 'crelly-slider'); ?>" />
824
+ </td>
825
+ <td class="cs-description">
826
+ <?php _e('Left distance in px from the start width.', 'crelly-slider'); ?>
827
+ </td>
828
+ </tr>
829
+ <tr>
830
+ <td class="cs-name"><?php _e('Top', 'crelly-slider'); ?></td>
831
+ <td class="cs-content">
832
+ <?php
833
+ if($void) echo '<input class="cs-element-data_top" type="text" value="0" />';
834
+ else echo '<input class="cs-element-data_top" type="text" value="' . sanitize_text_field($element->data_top) .'" />';
835
+ ?>
836
+ px
837
+ <br />
838
+ <br />
839
+ <input type="button" class="cs-element-center-y cs-button cs-is-default" value="<?php _e('Center vertically', 'crelly-slider'); ?>" />
840
+ </td>
841
+ <td class="cs-description">
842
+ <?php _e('Top distance in px from the start height.', 'crelly-slider'); ?>
843
+ </td>
844
+ </tr>
845
+ <tr>
846
+ <td class="cs-name"><?php _e('Z - index', 'crelly-slider'); ?></td>
847
+ <td class="cs-content">
848
+ <?php
849
+ if($void) echo '<input class="cs-element-z_index" type="text" value="1" />';
850
+ else echo '<input class="cs-element-z_index" type="text" value="' . sanitize_text_field($element->z_index) .'" />';
851
+ ?>
852
+ </td>
853
+ <td class="cs-description">
854
+ <?php _e('An element with an high z-index will cover an element with a lower z-index if they overlap.', 'crelly-slider'); ?>
855
+ </td>
856
+ </tr>
857
+ <tr>
858
+ <td class="cs-name"><?php _e('Delay', 'crelly-slider'); ?></td>
859
+ <td class="cs-content">
860
+ <?php
861
+ if($void) echo '<input class="cs-element-data_delay" type="text" value="0" />';
862
+ else echo '<input class="cs-element-data_delay" type="text" value="' . sanitize_text_field($element->data_delay) .'" />';
863
+ ?>
864
+ ms
865
+ </td>
866
+ <td class="cs-description">
867
+ <?php _e('How long will the element wait before the entrance.', 'crelly-slider'); ?>
868
+ </td>
869
+ </tr>
870
+ <tr>
871
+ <td class="cs-name"><?php _e('Time', 'crelly-slider'); ?></td>
872
+ <td class="cs-content">
873
+ <?php
874
+ if($void) echo '<input class="cs-element-data_time" type="text" value="all" />';
875
+ else echo '<input class="cs-element-data_time" type="text" value="' . sanitize_text_field($element->data_time) .'" />';
876
+ ?>
877
+ ms
878
+ </td>
879
+ <td class="cs-description">
880
+ <?php _e('How long will the element be displayed during the slide execution.', 'crelly-slider'); ?>
881
+ <br />
882
+ <br />
883
+ <?php _e('Write "all" to set the entire time.', 'crelly-slider'); ?>
884
+ <br />
885
+ <br />
886
+ <?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'); ?>
887
+ </td>
888
+ </tr>
889
+ <tr>
890
+ <td class="cs-name"><?php _e('In animation', 'crelly-slider'); ?></td>
891
+ <td class="cs-content">
892
+ <select class="cs-element-data_in">
893
+ <?php
894
+ foreach($animations as $key => $value) {
895
+ echo '<option value="' . $key . '"';
896
+ if(($void && $value[1]) || (!$void && $element->data_in == $key)) {
897
+ echo ' selected';
898
+ }
899
+ echo '>' . $value[0] . '</option>';
900
+ }
901
+ ?>
902
+ </select>
903
+ </td>
904
+ <td class="cs-description">
905
+ <?php _e('The in animation of the element.', 'crelly-slider'); ?>
906
+ </td>
907
+ </tr>
908
+ <tr>
909
+ <td class="cs-name"><?php _e('Out animation', 'crelly-slider'); ?></td>
910
+ <td class="cs-content">
911
+ <select class="cs-element-data_out">
912
+ <?php
913
+ foreach($animations as $key => $value) {
914
+ echo '<option value="' . $key . '"';
915
+ if(($void && $value[1]) || (!$void && $element->data_out == $key)) {
916
+ echo ' selected';
917
+ }
918
+ echo '>' . $value[0] . '</option>';
919
+ }
920
+ ?>
921
+ </select>
922
+ <br />
923
+ <?php
924
+ if($void) echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
925
+ else {
926
+ if($element->data_ignoreEaseOut) {
927
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" checked />' . __('Disable synchronization with slide out animation', 'crelly-slider');
928
+ }
929
+ else {
930
+ echo '<input class="cs-element-data_ignoreEaseOut" type="checkbox" />' . __('Disable synchronization with slide out animation', 'crelly-slider');
931
+ }
932
+ }
933
+ ?>
934
+ </td>
935
+ <td class="cs-description">
936
+ <?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'); ?>
937
+ </td>
938
+ </tr>
939
+ <tr>
940
+ <td class="cs-name"><?php _e('Ease in', 'crelly-slider'); ?></td>
941
+ <td class="cs-content">
942
+ <?php
943
+ if($void) echo '<input class="cs-element-data_easeIn" type="text" value="300" />';
944
+ else echo '<input class="cs-element-data_easeIn" type="text" value="' . sanitize_text_field($element->data_easeIn) .'" />';
945
+ ?>
946
+ ms
947
+ </td>
948
+ <td class="cs-description">
949
+ <?php _e('How long will the in animation take.', 'crelly-slider'); ?>
950
+ </td>
951
+ </tr>
952
+ <tr>
953
+ <td class="cs-name"><?php _e('Ease out', 'crelly-slider'); ?></td>
954
+ <td class="cs-content">
955
+ <?php
956
+ if($void) echo '<input class="cs-element-data_easeOut" type="text" value="300" />';
957
+ else echo '<input class="cs-element-data_easeOut" type="text" value="' . sanitize_text_field($element->data_easeOut) .'" />';
958
+ ?>
959
+ ms
960
+ </td>
961
+ <td class="cs-description">
962
+ <?php _e('How long will the out animation take.', 'crelly-slider'); ?>
963
+ </td>
964
+ </tr>
965
+ <tr>
966
+ <td class="cs-name"><?php _e('Custom CSS', 'crelly-slider'); ?></td>
967
+ <td class="cs-content">
968
+ <?php
969
+ if($void) echo '<textarea class="cs-element-custom_css"></textarea>';
970
+ else echo '<textarea class="cs-element-custom_css">' . stripslashes($element->custom_css) . '</textarea>';
971
+ ?>
972
+ </td>
973
+ <td class="cs-description">
974
+ <?php _e('Style the element.', 'crelly-slider'); ?>
975
+ </td>
976
+ </tr>
977
+ <tr>
978
+ <td class="cs-name"><?php _e('Custom classes', 'crelly-slider'); ?></td>
979
+ <td class="cs-content">
980
+ <?php
981
+ if($void) echo '<input class="cs-element-custom_css_classes" type="text" />';
982
+ else echo '<input class="cs-element-custom_css_classes" type="text" value="' . sanitize_text_field($element->custom_css_classes) . '" />';
983
+ ?>
984
+ </td>
985
+ <td class="cs-description">
986
+ <?php _e('Apply custom CSS classes to the element. The style of the classes may not work when working on backend.', 'crelly-slider'); ?>
987
+ </td>
988
+ </tr>
989
+ </tbody>
990
+ </table>
991
+ <?php } ?>
wordpress/frontend.php CHANGED
@@ -1,251 +1,240 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- // Code output
5
- function crellySlider($alias) {
6
- CrellySliderFrontend::output($alias, true);
7
- }
8
-
9
- function getCrellySlider($alias) {
10
- CrellySliderFrontend::output($alias, false);
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'], false);
30
- }
31
- }
32
-
33
- public static function addShortcode() {
34
- add_shortcode('crellyslider', array( __CLASS__, 'shortcode'));
35
- }
36
-
37
- public static function output($alias, $echo) {
38
- global $wpdb;
39
-
40
- $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE alias = %s', esc_sql($alias)));
41
-
42
- if(! $slider) {
43
- if($echo) {
44
- _e('The slider hasn\'t been found', 'crelly-slider');
45
- return;
46
- }
47
- else {
48
- return __('The slider hasn\'t been found', 'crelly-slider');
49
- }
50
- }
51
-
52
- $slider_id = esc_sql($slider->id);
53
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE draft = 0 AND slider_parent = %d ORDER BY position', $slider_id));
54
-
55
- $output = '';
56
-
57
- $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . '" id="crellyslider-' . esc_attr($slider_id) . '">' . "\n";
58
- $output .= '<ul>' . "\n";
59
- foreach($slides as $slide) {
60
- $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . CrellySliderCommon::getURL($slide->background_type_image) . '\');';
61
- $output .= '<li' . "\n" .
62
- 'style="' . "\n" .
63
- 'background-color: ' . esc_attr($slide->background_type_color) . ';' . "\n" .
64
- 'background-image: ' . $background_type_image . "\n" .
65
- 'background-position: ' . esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y) . ';' . "\n" .
66
- 'background-repeat: ' . esc_attr($slide->background_repeat) . ';' . "\n" .
67
- 'background-size: ' . esc_attr($slide->background_propriety_size) . ';' . "\n" .
68
- stripslashes($slide->custom_css) . "\n" .
69
- '"' . "\n" .
70
-
71
- 'data-in="' . esc_attr($slide->data_in) . '"' . "\n" .
72
- 'data-ease-in="' . esc_attr($slide->data_easeIn) . '"' . "\n" .
73
- 'data-out="' . esc_attr($slide->data_out) . '"' . "\n" .
74
- 'data-ease-out="' . esc_attr($slide->data_easeOut) . '"' . "\n" .
75
- 'data-time="' . esc_attr($slide->data_time) . '"' . "\n" .
76
- '>' . "\n";
77
-
78
- if($slide->link != '') {
79
- if($slide->link_new_tab) {
80
- $output .= '<a class="cs-background-link" target="_blank" href="' . stripslashes($slide->link) . '"></a>';
81
- }
82
- else {
83
- $output .= '<a class="cs-background-link" href="' . stripslashes($slide->link) . '"></a>';
84
- }
85
- }
86
-
87
- $slide_parent = esc_sql($slide->position);
88
- $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND slide_parent = %d', $slider_id, $slide_parent));
89
-
90
- foreach($elements as $element) {
91
- if($element->link != '') {
92
- $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
93
-
94
- $output .= '<a' . "\n" .
95
- 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
96
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
97
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
98
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
99
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
100
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
101
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
102
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
103
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
104
- 'href="' . stripslashes($element->link) . '"' . "\n" .
105
- $target . "\n" .
106
- 'style="' .
107
- 'z-index: ' . $element->z_index . ';' . "\n" .
108
- '">' . "\n";
109
- }
110
-
111
- switch($element->type) {
112
- case 'text':
113
- $output .= '<div' . "\n" .
114
- 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
115
- 'style="';
116
- if($element->link == '') {
117
- $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
118
- }
119
- $output .= stripslashes($element->custom_css) . "\n" .
120
- '"' . "\n";
121
- if($element->link == '') {
122
- $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
123
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
124
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
125
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
126
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
127
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
128
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
129
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
130
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
131
- }
132
- $output .= '>' . "\n" .
133
- stripslashes($element->inner_html) . "\n" .
134
- '</div>' . "\n";
135
- break;
136
-
137
- case 'image':
138
- $output .= '<img' . "\n" .
139
- 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
140
- 'src="' . CrellySliderCommon::getURL($element->image_src) . '"' . "\n" .
141
- 'alt="' . esc_attr($element->image_alt) . '"' . "\n" .
142
- 'style="' . "\n";
143
- if($element->link == '') {
144
- $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
145
- }
146
- $output .= stripslashes($element->custom_css) . "\n" .
147
- '"' . "\n";
148
- if($element->link == '') {
149
- $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
150
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
151
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
152
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
153
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
154
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
155
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
156
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
157
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
158
- }
159
- $output .= '/>' . "\n";
160
- break;
161
-
162
- case 'youtube_video':
163
- $output .= '<iframe frameborder="0" type="text/html" width="560" height="315"' . "\n" .
164
- 'class="cs-yt-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
165
- 'src="' . esc_url('https://www.youtube.com/embed/' . $element->video_id . '?enablejsapi=1') . '"' . "\n" .
166
- 'data-autoplay="' . $element->video_autoplay . '"' . "\n" .
167
- 'data-loop="' . $element->video_loop . '"' . "\n" .
168
- 'style="' . "\n" .
169
- 'z-index: ' . $element->z_index . ';' . "\n" .
170
- stripslashes($element->custom_css) . "\n" .
171
- '"' . "\n" .
172
- 'data-delay="' . $element->data_delay . '"' . "\n" .
173
- 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
174
- 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
175
- 'data-in="' . $element->data_in . '"' . "\n" .
176
- 'data-out="' . $element->data_out . '"' . "\n" .
177
- 'data-ignore-ease-out="' . $element->data_ignoreEaseOut . '"' . "\n" .
178
- 'data-top="' . $element->data_top . '"' . "\n" .
179
- 'data-left="' . $element->data_left . '"' . "\n" .
180
- 'data-time="' . $element->data_time . '"' . "\n" .
181
- '></iframe>' . "\n";
182
- break;
183
-
184
- case 'vimeo_video':
185
- $output .= '<iframe frameborder="0" width="560" height="315"' . "\n" .
186
- 'class="cs-vimeo-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
187
- 'src="' . esc_url('https://player.vimeo.com/video/' . $element->video_id . '?api=1') . '"' . "\n" .
188
- 'data-autoplay="' . esc_attr($element->video_autoplay) . '"' . "\n" .
189
- 'data-loop="' . esc_attr($element->video_loop) . '"' . "\n" .
190
- 'style="' . "\n" .
191
- 'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
192
- stripslashes($element->custom_css) . "\n" .
193
- '"' . "\n" .
194
- 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
195
- 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
196
- 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
197
- 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
198
- 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
199
- 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
200
- 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
201
- 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
202
- 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
203
- '></iframe>' . "\n";
204
- break;
205
- }
206
-
207
- if($element->link != '') {
208
- $output .= '</a>' . "\n";
209
- }
210
- }
211
-
212
- $output .= '</li>' . "\n";
213
- }
214
- $output .= '</ul>' . "\n";
215
- $output .= '</div>' . "\n";
216
-
217
- $output .= '<script type="text/javascript">' . "\n";
218
- $output .= '(function($) {' . "\n";
219
- $output .= '$(document).ready(function() {' . "\n";
220
- $output .= '$("#crellyslider-' . $slider_id . '").crellySlider({' . "\n";
221
- $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
222
- $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
223
- $output .= 'startWidth: ' . $slider->startWidth . ',' . "\n";
224
- $output .= 'startHeight: ' . $slider->startHeight . ',' . "\n";
225
- $output .= 'automaticSlide: ' . $slider->automaticSlide . ',' . "\n";
226
- $output .= 'showControls: ' . $slider->showControls . ',' . "\n";
227
- $output .= 'showNavigation: ' . $slider->showNavigation . ',' . "\n";
228
- $output .= 'enableSwipe: ' . $slider->enableSwipe . ',' . "\n";
229
- $output .= 'showProgressBar: ' . $slider->showProgressBar . ',' . "\n";
230
- $output .= 'pauseOnHover: ' . $slider->pauseOnHover . ',' . "\n";
231
- if($slider->randomOrder != NULL) {
232
- $output .= 'randomOrder: ' . $slider->randomOrder . ',' . "\n";
233
- }
234
- if($slider->startFromSlide != NULL) {
235
- $output .= 'startFromSlide: ' . $slider->startFromSlide . ',' . "\n";
236
- }
237
- $output .= stripslashes($slider->callbacks) . "\n";
238
- $output .= '});' . "\n";
239
- $output .= '});' . "\n";
240
- $output .= '})(jQuery);' . "\n";
241
- $output .= '</script>' . "\n";
242
-
243
- if($echo) {
244
- echo $output;
245
- }
246
- else {
247
- return $output;
248
- }
249
- }
250
-
251
- }
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
+ $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE alias = %s', esc_sql($alias)));
41
+
42
+ if(! $slider) {
43
+ return __('The slider hasn\'t been found', 'crelly-slider');
44
+ }
45
+
46
+ $slider_id = esc_sql($slider->id);
47
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE draft = 0 AND slider_parent = %d ORDER BY position', $slider_id));
48
+
49
+ $output = '';
50
+
51
+ $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . '" id="crellyslider-' . esc_attr($slider_id) . '">' . "\n";
52
+ $output .= '<ul>' . "\n";
53
+ foreach($slides as $slide) {
54
+ $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . CrellySliderCommon::getURL($slide->background_type_image) . '\');';
55
+ $output .= '<li' . "\n" .
56
+ 'style="' . "\n" .
57
+ 'background-color: ' . esc_attr($slide->background_type_color) . ';' . "\n" .
58
+ 'background-image: ' . $background_type_image . "\n" .
59
+ 'background-position: ' . esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y) . ';' . "\n" .
60
+ 'background-repeat: ' . esc_attr($slide->background_repeat) . ';' . "\n" .
61
+ 'background-size: ' . esc_attr($slide->background_propriety_size) . ';' . "\n" .
62
+ stripslashes($slide->custom_css) . "\n" .
63
+ '"' . "\n" .
64
+
65
+ 'data-in="' . esc_attr($slide->data_in) . '"' . "\n" .
66
+ 'data-ease-in="' . esc_attr($slide->data_easeIn) . '"' . "\n" .
67
+ 'data-out="' . esc_attr($slide->data_out) . '"' . "\n" .
68
+ 'data-ease-out="' . esc_attr($slide->data_easeOut) . '"' . "\n" .
69
+ 'data-time="' . esc_attr($slide->data_time) . '"' . "\n" .
70
+ '>' . "\n";
71
+
72
+ if($slide->link != '') {
73
+ if($slide->link_new_tab) {
74
+ $output .= '<a class="cs-background-link" target="_blank" href="' . stripslashes($slide->link) . '"></a>';
75
+ }
76
+ else {
77
+ $output .= '<a class="cs-background-link" href="' . stripslashes($slide->link) . '"></a>';
78
+ }
79
+ }
80
+
81
+ $slide_parent = esc_sql($slide->position);
82
+ $elements = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND slide_parent = %d', $slider_id, $slide_parent));
83
+
84
+ foreach($elements as $element) {
85
+ if($element->link != '') {
86
+ $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
87
+
88
+ $output .= '<a' . "\n" .
89
+ 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
90
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
91
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
92
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
93
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
94
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
95
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
96
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
97
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
98
+ 'href="' . stripslashes($element->link) . '"' . "\n" .
99
+ $target . "\n" .
100
+ 'style="' .
101
+ 'z-index: ' . $element->z_index . ';' . "\n" .
102
+ '">' . "\n";
103
+ }
104
+
105
+ switch($element->type) {
106
+ case 'text':
107
+ $output .= '<div' . "\n" .
108
+ 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
109
+ 'style="';
110
+ if($element->link == '') {
111
+ $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
112
+ }
113
+ $output .= stripslashes($element->custom_css) . "\n" .
114
+ '"' . "\n";
115
+ if($element->link == '') {
116
+ $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
117
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
118
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
119
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
120
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
121
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
122
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
123
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
124
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
125
+ }
126
+ $output .= '>' . "\n" .
127
+ stripslashes($element->inner_html) . "\n" .
128
+ '</div>' . "\n";
129
+ break;
130
+
131
+ case 'image':
132
+ $output .= '<img' . "\n" .
133
+ 'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
134
+ 'src="' . CrellySliderCommon::getURL($element->image_src) . '"' . "\n" .
135
+ 'alt="' . esc_attr($element->image_alt) . '"' . "\n" .
136
+ 'style="' . "\n";
137
+ if($element->link == '') {
138
+ $output .= 'z-index: ' . esc_attr($element->z_index) . ';' . "\n";
139
+ }
140
+ $output .= stripslashes($element->custom_css) . "\n" .
141
+ '"' . "\n";
142
+ if($element->link == '') {
143
+ $output .= 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
144
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
145
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
146
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
147
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
148
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
149
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
150
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
151
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n";
152
+ }
153
+ $output .= '/>' . "\n";
154
+ break;
155
+
156
+ case 'youtube_video':
157
+ $output .= '<iframe frameborder="0" type="text/html" width="560" height="315"' . "\n" .
158
+ 'class="cs-yt-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
159
+ 'src="' . esc_url('https://www.youtube.com/embed/' . $element->video_id . '?enablejsapi=1') . '"' . "\n" .
160
+ 'data-autoplay="' . $element->video_autoplay . '"' . "\n" .
161
+ 'data-loop="' . $element->video_loop . '"' . "\n" .
162
+ 'style="' . "\n" .
163
+ 'z-index: ' . $element->z_index . ';' . "\n" .
164
+ stripslashes($element->custom_css) . "\n" .
165
+ '"' . "\n" .
166
+ 'data-delay="' . $element->data_delay . '"' . "\n" .
167
+ 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
168
+ 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
169
+ 'data-in="' . $element->data_in . '"' . "\n" .
170
+ 'data-out="' . $element->data_out . '"' . "\n" .
171
+ 'data-ignore-ease-out="' . $element->data_ignoreEaseOut . '"' . "\n" .
172
+ 'data-top="' . $element->data_top . '"' . "\n" .
173
+ 'data-left="' . $element->data_left . '"' . "\n" .
174
+ 'data-time="' . $element->data_time . '"' . "\n" .
175
+ '></iframe>' . "\n";
176
+ break;
177
+
178
+ case 'vimeo_video':
179
+ $output .= '<iframe frameborder="0" width="560" height="315"' . "\n" .
180
+ 'class="cs-vimeo-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
181
+ 'src="' . esc_url('https://player.vimeo.com/video/' . $element->video_id . '?api=1') . '"' . "\n" .
182
+ 'data-autoplay="' . esc_attr($element->video_autoplay) . '"' . "\n" .
183
+ 'data-loop="' . esc_attr($element->video_loop) . '"' . "\n" .
184
+ 'style="' . "\n" .
185
+ 'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
186
+ stripslashes($element->custom_css) . "\n" .
187
+ '"' . "\n" .
188
+ 'data-delay="' . esc_attr($element->data_delay) . '"' . "\n" .
189
+ 'data-ease-in="' . esc_attr($element->data_easeIn) . '"' . "\n" .
190
+ 'data-ease-out="' . esc_attr($element->data_easeOut) . '"' . "\n" .
191
+ 'data-in="' . esc_attr($element->data_in) . '"' . "\n" .
192
+ 'data-out="' . esc_attr($element->data_out) . '"' . "\n" .
193
+ 'data-ignore-ease-out="' . esc_attr($element->data_ignoreEaseOut) . '"' . "\n" .
194
+ 'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
195
+ 'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
196
+ 'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
197
+ '></iframe>' . "\n";
198
+ break;
199
+ }
200
+
201
+ if($element->link != '') {
202
+ $output .= '</a>' . "\n";
203
+ }
204
+ }
205
+
206
+ $output .= '</li>' . "\n";
207
+ }
208
+ $output .= '</ul>' . "\n";
209
+ $output .= '</div>' . "\n";
210
+
211
+ $output .= '<script type="text/javascript">' . "\n";
212
+ $output .= '(function($) {' . "\n";
213
+ $output .= '$(document).ready(function() {' . "\n";
214
+ $output .= '$("#crellyslider-' . $slider_id . '").crellySlider({' . "\n";
215
+ $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
216
+ $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
217
+ $output .= 'startWidth: ' . $slider->startWidth . ',' . "\n";
218
+ $output .= 'startHeight: ' . $slider->startHeight . ',' . "\n";
219
+ $output .= 'automaticSlide: ' . $slider->automaticSlide . ',' . "\n";
220
+ $output .= 'showControls: ' . $slider->showControls . ',' . "\n";
221
+ $output .= 'showNavigation: ' . $slider->showNavigation . ',' . "\n";
222
+ $output .= 'enableSwipe: ' . $slider->enableSwipe . ',' . "\n";
223
+ $output .= 'showProgressBar: ' . $slider->showProgressBar . ',' . "\n";
224
+ $output .= 'pauseOnHover: ' . $slider->pauseOnHover . ',' . "\n";
225
+ if($slider->randomOrder != NULL) {
226
+ $output .= 'randomOrder: ' . $slider->randomOrder . ',' . "\n";
227
+ }
228
+ if($slider->startFromSlide != NULL) {
229
+ $output .= 'startFromSlide: ' . $slider->startFromSlide . ',' . "\n";
230
+ }
231
+ $output .= stripslashes($slider->callbacks) . "\n";
232
+ $output .= '});' . "\n";
233
+ $output .= '});' . "\n";
234
+ $output .= '})(jQuery);' . "\n";
235
+ $output .= '</script>' . "\n";
236
+
237
+ return $output;
238
+ }
239
+
240
+ }
 
 
 
 
 
 
 
 
 
 
 
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,1774 +1,1774 @@
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 .cs-message-working').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 .cs-message-working').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
- /*************/
91
- /** SLIDERS **/
92
- /*************/
93
-
94
- // Set Alias
95
- $('.cs-slider').find('#cs-slider-name').keyup(function() {
96
- var alias = crellyslider_getAlias();
97
- $('.cs-slider').find('#cs-slider-alias').text(alias);
98
- });
99
-
100
- // Set shortcode
101
- $('.cs-slider').find('#cs-slider-name').keyup(function() {
102
- var alias = crellyslider_getAlias();
103
- var shortcode = '';
104
- shortcode += '[crellyslider alias="';
105
- shortcode += alias;
106
- shortcode += '"]';
107
- if(alias != '') {
108
- $('.cs-slider').find('#cs-slider-shortcode').text(shortcode);
109
- }
110
- else {
111
- $('.cs-slider').find('#cs-slider-shortcode').text('');
112
- }
113
- });
114
-
115
- // Set the new sizes of the editing area and of the slider if changing values
116
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').keyup(function() {
117
- crellyslider_setSlidesEditingAreaSizes();
118
- });
119
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').keyup(function() {
120
- crellyslider_setSlidesEditingAreaSizes();
121
- });
122
-
123
- // Get the alias starting form the name
124
- function crellyslider_getAlias() {
125
- var slider_name = $('.cs-slider').find('#cs-slider-name').val();
126
- var slider_alias = slider_name.toLowerCase();
127
- slider_alias = slider_alias.replace(/ /g, '_');
128
- return slider_alias;
129
- }
130
-
131
- /************/
132
- /** SLIDES **/
133
- /************/
134
-
135
- var slides_number = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length - 1;
136
-
137
- // Run sortable
138
- var slide_before; // Contains the index before the sorting
139
- var slide_after; // Contains the index after the sorting
140
- $('.cs-slide-tabs .cs-sortable').sortable({
141
- items: 'li:not(.ui-state-disabled)',
142
- cancel: '.ui-state-disabled',
143
- connectWith: '.cs-slide-tabs .cs-sortable',
144
- containment: 'parent',
145
- placeholder: 'sortable-placeholder',
146
-
147
- start: function(event, ui) {
148
- // Store the current index
149
- slide_before = $(ui.item).index();
150
-
151
- ui.placeholder.height(ui.helper.height() - 1);
152
- ui.placeholder.width(ui.helper.width() - 1);
153
- },
154
-
155
- // Change the .cs-slide order based on the new index and rename the tabs
156
- update: function(event, ui) {
157
- // Store the new index
158
- slide_after = $(ui.item).index();
159
-
160
- // Change the slide position
161
- var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_before + ')');
162
- var after = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_after + ')');
163
- if(slide_before < slide_after) {
164
- slide.insertAfter(after);
165
- }
166
- else {
167
- slide.insertBefore(after);
168
- }
169
-
170
- // Rename all the tabs
171
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').each(function() {
172
- var temp = $(this);
173
- if(!temp.find('a').hasClass('cs-add-new')) {
174
- temp.find('a').html('<span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (temp.index() + 1) + '</span></span>');
175
- }
176
- });
177
- }
178
- });
179
- $('.cs-slide-tabs .cs-sortable li').disableSelection();
180
-
181
- // Show the slide when clicking on the link
182
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li > a').live('click', function() {
183
- crellyslider_deselectElements();
184
-
185
- // Do only if is not click add new
186
- if($(this).parent().index() != slides_number) {
187
- // Stop previews
188
- $('.cs-admin #cs-slides .cs-slide .cs-elements .cs-elements-actions .cs-live-preview').each(function() {
189
- var btn = $(this);
190
- var slide_parent = btn.closest('.cs-slide');
191
-
192
- if(btn.hasClass('cs-live-preview-running')) {
193
- btn.removeClass('cs-live-preview-running');
194
- btn.text(crellyslider_translations.slide_live_preview);
195
- crellyslider_stopLivePreview(slide_parent);
196
- }
197
- });
198
-
199
- // Hide all tabs
200
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
201
- var tab = $(this).parent().index();
202
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + tab + ')').css('display', 'block');
203
-
204
- // Active class
205
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
206
- $(this).parent().addClass('active');
207
- }
208
- });
209
-
210
- // Add new
211
- function crellyslider_addSlide() {
212
- var add_btn = $('.cs-admin #cs-slides .cs-add-new');
213
-
214
- var void_slide = $('.cs-admin #cs-slides .cs-void-slide').html();
215
- // Insert the link at the end of the list
216
- 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>');
217
- // jQuery UI tabs are not working here. For now, just use a manual created tab
218
- $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
219
- // Create the slide
220
- $('.cs-admin #cs-slides .cs-slides-list').append('<div class="cs-slide">' + void_slide + '</div>');
221
- slides_number++;
222
-
223
- // Open the tab just created
224
- var tab_index = add_btn.parent().index() - 1;
225
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).find('a').click();
226
-
227
- // Active class
228
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
229
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).addClass('active');
230
-
231
- // Set editing area sizes
232
- crellyslider_setSlidesEditingAreaSizes();
233
-
234
- crellyslider_slidesColorPicker();
235
-
236
- // Update "start from slide" in the slider settings
237
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
238
- }
239
-
240
- // Add new on click
241
- $('.cs-admin #cs-slides .cs-add-new').click(function() {
242
- crellyslider_addSlide();
243
- });
244
- // Also add a new slide if slides_number == 0
245
- if(slides_number == 0) {
246
- crellyslider_addSlide();
247
- }
248
- else {
249
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
250
- }
251
-
252
- // Delete
253
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-close').live('click', function() {
254
- if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length <= 2) {
255
- alert(crellyslider_translations.slide_delete_just_one);
256
- return;
257
- }
258
-
259
- var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
260
- if(!confirm) {
261
- return;
262
- }
263
-
264
- slides_number--;
265
-
266
- var slide_index = $(this).parent().index();
267
-
268
- // If is deleting the current viewing slide, set the first as active
269
- if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(slide_index).hasClass('active') && slides_number != 0) {
270
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).addClass('active');
271
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
272
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(0).css('display', 'block');
273
- }
274
-
275
- // Remove the anchor
276
- $(this).parent().remove();
277
- // Remove the slide itself
278
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index).remove();
279
-
280
- // Scale back all the slides text
281
- for(var i = slide_index; i < slides_number; i++) {
282
- var slide = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(i);
283
- var indx = parseInt(slide.find('.cs-slide-index').text());
284
- slide.find('.cs-slide-index').text(indx - 1);
285
- }
286
-
287
- // Update "start from slide" in the slider settings
288
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
289
- if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').length == 0) {
290
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().first().val('0');
291
- }
292
- });
293
-
294
- // Duplicate
295
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-duplicate').live('click', function() {
296
- var slide_index = $(this).parent().index();
297
- var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index);
298
-
299
- // Clone the slide settings table
300
- slide.crellyslider_betterClone(true, false).appendTo(slide.parent()).css('display', 'none');
301
-
302
- // Fix TinyMCE
303
- slide.parent().last().find('.cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').each(function() {
304
- var cloned_options = $(this);
305
-
306
- cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
307
- cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
308
- crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
309
- });
310
-
311
- // Add a new color picker, then remove the old one
312
- crellyslider_slidesColorPicker();
313
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slides_number).find('.wp-picker-container > .wp-color-result').eq(0).remove();
314
-
315
- // Insert the link at the end of the list
316
- $(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>');
317
- $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
318
-
319
- crellyslider_draggableElements();
320
-
321
- slides_number++;
322
-
323
- // Update "start from slide" in the slider settings
324
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
325
- });
326
-
327
- // Set correct size for the editing area
328
- function crellyslider_setSlidesEditingAreaSizes() {
329
- var width = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val());
330
- var height = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val());
331
-
332
- $('.cs-admin #cs-slides .cs-slide .cs-slide-editing-area').css({
333
- 'width' : width,
334
- 'height' : height,
335
- });
336
-
337
- $('.cs-admin').css({
338
- 'width' : width,
339
- });
340
- }
341
-
342
- crellyslider_slidesColorPicker();
343
-
344
- // Run background color picker
345
- function crellyslider_slidesColorPicker() {
346
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input').wpColorPicker({
347
- // a callback to fire whenever the color changes to a valid color
348
- change: function(event, ui){
349
- var btn = $(this);
350
- if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"]:checked').val() != '1') {
351
- btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"][value="1"]:radio').prop('checked', true);
352
- }
353
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
354
- area.css('background-color', ui.color.toString());
355
- },
356
- // a callback to fire when the input is emptied or an invalid color
357
- clear: function() {},
358
- // hide the color picker controls on load
359
- hide: true,
360
- // show a group of common colors beneath the square
361
- // or, supply an array of colors to customize further
362
- palettes: true
363
- });
364
- }
365
-
366
- // 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
367
- $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_color"]:radio', function() {
368
- var btn = $(this);
369
- var btn_val = btn.val();
370
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
371
-
372
- if(btn_val == '0') {
373
- area.css('background-color', '#fff');
374
- }
375
- else if(btn_val == '1') {
376
- var color_picker_value = btn.closest('.cs-content').find('.wp-color-result').css('background-color');
377
- area.css('background-color', color_picker_value);
378
- }
379
- else {
380
- area.css('background-color', btn.closest('.cs-content').find('.cs-slide-background_type_color-manual').val());
381
- }
382
- });
383
-
384
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-manual', function() {
385
- var text = $(this);
386
- var val = text.val();
387
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
388
-
389
- text.closest('.cs-slide').find('input[name="cs-slide-background_type_color"][value="2"]:radio').prop('checked', true);
390
- area.css('background-color', val);
391
- });
392
-
393
- // Set background image (none or image)
394
- $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_image"]:radio', function() {
395
- var btn = $(this);
396
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
397
-
398
- if(btn.val() == '0') {
399
- area.css('background-image', 'none');
400
- }
401
- else {
402
- var slide_parent = $(this).closest('.cs-slide');
403
- crellyslider_addSlideImageBackground(slide_parent);
404
- }
405
- });
406
-
407
- // Set Background image (the upload function)
408
- $('.cs-admin #cs-slides').on('click', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_image-upload-button', function() {
409
- var btn = $(this);
410
- if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]:checked').val() == '1') {
411
- var slide_parent = $(this).closest('.cs-slide');
412
- crellyslider_addSlideImageBackground(slide_parent);
413
- }
414
- else {
415
- btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]').prop('checked', true);
416
- var slide_parent = $(this).closest('.cs-slide');
417
- crellyslider_addSlideImageBackground(slide_parent);
418
- }
419
- });
420
- function crellyslider_addSlideImageBackground(slide_parent) {
421
- var area = slide_parent.find('.cs-slide-editing-area');
422
-
423
- // Upload
424
- var file_frame;
425
-
426
- // If the media frame already exists, reopen it.
427
- if ( file_frame ) {
428
- file_frame.open();
429
- return;
430
- }
431
-
432
- // Create the media frame.
433
- file_frame = wp.media.frames.file_frame = wp.media({
434
- title: jQuery( this ).data( 'uploader_title' ),
435
- button: {
436
- text: jQuery( this ).data( 'uploader_button_text' ),
437
- },
438
- multiple: false // Set to true to allow multiple files to be selected
439
- });
440
-
441
- // When an image is selected, run a callback.
442
- file_frame.on( 'select', function() {
443
- // We set multiple to false so only get one image from the uploader
444
- attachment = file_frame.state().get('selection').first().toJSON();
445
-
446
- // Do something with attachment.id and/or attachment.url here
447
- var image_src = attachment.url;
448
- var image_alt = attachment.alt;
449
- var image_id = attachment.id;
450
-
451
- // Set background
452
- area.css('background-image', 'url("' + image_src + '")');
453
-
454
- // Data that we'll store into the database
455
- area.data('background-image-src', image_id);
456
- });
457
-
458
- // Finally, open the modal
459
- file_frame.open();
460
- }
461
-
462
- // Background propriety: repeat or no-repeat
463
- $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_repeat"]:radio', function() {
464
- var btn = $(this);
465
- var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
466
-
467
- if(btn.val() == '0') {
468
- area.css('background-repeat', 'no-repeat');
469
- }
470
- else {
471
- area.css('background-repeat', 'repeat');
472
- }
473
- });
474
-
475
- // Background propriety: positions x and y
476
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_x', function() {
477
- var text = $(this);
478
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
479
-
480
- var x = text.val();
481
- var y = text.parent().find('.cs-slide-background_propriety_position_y').val();
482
-
483
- area.css('background-position', x + ' ' + y);
484
- });
485
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_y', function() {
486
- var text = $(this);
487
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
488
-
489
- var x = text.parent().find('.cs-slide-background_propriety_position_x').val();
490
- var y = text.val();
491
-
492
- area.css('background-position', x + ' ' + y);
493
- });
494
-
495
- // Background propriety: size
496
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_size', function() {
497
- var text = $(this);
498
- var val = text.val();
499
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
500
-
501
- area.css('background-size', val);
502
- });
503
-
504
- // Background presets
505
- $('.cs-slide-background-image-fullwidth-preset').click(function() {
506
- var text = $(this);
507
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
508
- var settings = text.closest('.cs-slide');
509
-
510
- settings.find('.cs-slide-background_propriety_position_x').val('center');
511
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
512
-
513
- settings.find('.cs-slide-background_propriety_position_y').val('center');
514
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
515
-
516
- settings.find('input[name="cs-slide-background_repeat"][value="0"]').prop('checked', true);
517
- area.css('background-repeat', 'no-repeat');
518
-
519
- settings.find('.cs-slide-background_propriety_size').val('cover');
520
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
521
- });
522
-
523
- $('.cs-slide-background-image-pattern-preset').click(function() {
524
- var text = $(this);
525
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
526
- var settings = text.closest('.cs-slide');
527
-
528
- settings.find('.cs-slide-background_propriety_position_x').val(0);
529
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
530
-
531
- settings.find('.cs-slide-background_propriety_position_y').val(0);
532
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
533
-
534
- settings.find('input[name="cs-slide-background_repeat"][value="1"]').prop('checked', true);
535
- area.css('background-repeat', 'repeat');
536
-
537
- settings.find('.cs-slide-background_propriety_size').val('auto');
538
- crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
539
- });
540
-
541
- // Apply custom CSS
542
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-custom_css', function() {
543
- var text = $(this);
544
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
545
- var css = text.val();
546
-
547
- // Save current styles
548
- var width = area.css('width');
549
- var height = area.css('height');
550
- var background_image = area.css('background-image');
551
- var background_color = area.css('background-color');
552
- var background_position = area.css('background-position');
553
- var background_repeat = area.css('background-repeat');
554
- var background_size = area.css('background-size');
555
-
556
- // Apply CSS
557
- area.attr('style', css);
558
- area.css({
559
- 'width' : width,
560
- 'height' : height,
561
- 'background-image' : background_image,
562
- 'background-color' : background_color,
563
- 'background-position' : background_position,
564
- 'background-repeat' : background_repeat,
565
- 'background-size' : background_size
566
- });
567
- });
568
-
569
- /**************/
570
- /** ELEMENTS **/
571
- /**************/
572
-
573
- // GENERAL
574
-
575
- // Make draggable
576
- function crellyslider_draggableElements() {
577
- $('.cs-admin .cs-elements .cs-element').draggable({
578
- 'containment' : 'parent',
579
-
580
- start: function() {
581
- // Select when dragging
582
- crellyslider_selectElement($(this));
583
- },
584
-
585
- drag: function(){
586
- // Set left and top positions on drag to the textbox
587
- var position = $(this).position();
588
- var left = position.left;
589
- var top = position.top;
590
- var index = $(this).index();
591
-
592
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
593
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
594
- },
595
- });
596
- }
597
-
598
- // Selects an element, shows its options and makes the delete element button available
599
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-slide-editing-area .cs-element', function(e) {
600
- // Do not click the editing-area
601
- e.stopPropagation();
602
-
603
- // Do not open links
604
- e.preventDefault();
605
-
606
- crellyslider_selectElement($(this));
607
- });
608
- function crellyslider_selectElement(element) {
609
- var index = element.index();
610
- var slide = element.closest('.cs-slide');
611
- var options = slide.find('.cs-elements .cs-elements-list');
612
-
613
- // Hide all options - .active class
614
- options.find('.cs-element-settings').css('display', 'none');
615
- options.find('.cs-element-settings').removeClass('active');
616
-
617
- // Show the correct options + .active class
618
- options.find('.cs-element-settings:eq(' + index + ')').css('display', 'block');
619
- options.find('.cs-element-settings:eq(' + index + ')').addClass('active');
620
-
621
- // Add .active class to the element in the editing area
622
- element.parent().children().removeClass('active');
623
- element.addClass('active');
624
-
625
- // Make the delete and the duplicate buttons working
626
- slide.find('.cs-elements-actions .cs-delete-element').removeClass('cs-is-disabled');
627
- slide.find('.cs-elements-actions .cs-duplicate-element').removeClass('cs-is-disabled');
628
- }
629
-
630
- // Deselect elements
631
- $('.cs-admin').on('click', '.cs-slide .cs-elements .cs-slide-editing-area', function() {
632
- crellyslider_deselectElements();
633
- });
634
- function crellyslider_deselectElements() {
635
- $('.cs-admin .cs-slide .cs-elements .cs-slide-editing-area .cs-element').removeClass('active');
636
- $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').removeClass('active');
637
- $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').css('display', 'none');
638
-
639
- // Hide delete and duplicate element btns
640
- $('.cs-admin .cs-slide .cs-elements-actions .cs-delete-element').addClass('cs-is-disabled');
641
- $('.cs-admin .cs-slide .cs-elements-actions .cs-duplicate-element').addClass('cs-is-disabled');
642
- }
643
-
644
- // Delete element. Remember that the button should be enabled / disabled somewhere else
645
- function crellyslider_deleteElement(element) {
646
- var index = element.index();
647
- var slide_parent = element.closest('.cs-slide');
648
-
649
- element.remove();
650
- var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
651
- element_options.remove();
652
- crellyslider_deselectElements();
653
- }
654
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-delete-element', function() {
655
- // Click only if an element is selected
656
- if($(this).hasClass('.cs-is-disabled')) {
657
- return;
658
- }
659
-
660
- var slide_parent = $(this).closest('.cs-slide');
661
- var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
662
- crellyslider_deleteElement(element);
663
- });
664
-
665
- function crellyslider_duplicateElement(element) {
666
- var index = element.index();
667
- var slide_parent = element.closest('.cs-slide');
668
-
669
- element.clone().appendTo(element.parent()).css({
670
- 'left' : '+=10',
671
- 'top' : '+=10',
672
- });
673
- var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
674
- element_options.crellyslider_betterClone(true).insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
675
-
676
- crellyslider_deselectElements();
677
- crellyslider_selectElement(element.parent().find('.cs-element').last());
678
-
679
- var cloned_options = element.parent().find('.cs-element').last().closest('.cs-slide').find('.cs-elements-list .cs-element-settings.active');
680
-
681
- // Move the element 10 pixels away
682
- cloned_options.find('.cs-element-data_left').val(parseInt(element_options.find('.cs-element-data_left').val()) + 10);
683
- cloned_options.find('.cs-element-data_top').val(parseInt(element_options.find('.cs-element-data_top').val()) + 10);
684
-
685
- // If it's a text, fix TinyMCE
686
- if(cloned_options.hasClass('cs-text-element-settings')) {
687
- cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
688
- cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
689
- crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
690
- }
691
-
692
- // Make draggable
693
- crellyslider_draggableElements();
694
- }
695
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-duplicate-element', function() {
696
- // Click only if an element is selected
697
- if($(this).hasClass('.cs-is-disabled')) {
698
- return;
699
- }
700
-
701
- var slide_parent = $(this).closest('.cs-slide');
702
- var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
703
- crellyslider_duplicateElement(element);
704
- });
705
-
706
- // Modify left position
707
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_left', function() {
708
- var index = $(this).closest('.cs-element-settings').index();
709
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', parseFloat($(this).val()));
710
- });
711
-
712
- // Center horizontally
713
- $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-x', function() {
714
- var index = $(this).closest('.cs-element-settings').index();
715
- 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));
716
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
717
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
718
- });
719
-
720
- // Modify top position
721
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_top', function() {
722
- var index = $(this).closest('.cs-element-settings').index();
723
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', parseFloat($(this).val()));
724
- });
725
-
726
- // Center vertically
727
- $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-y', function() {
728
- var index = $(this).closest('.cs-element-settings').index();
729
- 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));
730
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
731
- $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
732
- });
733
-
734
- // Modify z-index
735
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-z_index', function() {
736
- var index = $(this).closest('.cs-element-settings').index();
737
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
738
- });
739
-
740
- // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
741
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
742
- crellyslider_editElementsLink($(this));
743
- });
744
- $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link_new_tab', function() {
745
- var textbox = $(this).parent().find('.cs-element-link');
746
- crellyslider_editElementsLink(textbox);
747
- });
748
-
749
- // Wrap - unwrap elements with an <a href="" target="">
750
- function crellyslider_editElementsLink(textbox_link) {
751
- var index = textbox_link.closest('.cs-element-settings').index();
752
- var copy_attributes = false;
753
- var reapply_css = false;
754
-
755
- if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
756
- // Remove custom css classes
757
- 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());
758
- 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());
759
-
760
- var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
761
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
762
- copy_attributes = true;
763
- reapply_css = true;
764
- }
765
- else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
766
- var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
767
-
768
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
769
-
770
- if(link_new_tab) {
771
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
772
- }
773
- else {
774
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
775
- }
776
-
777
- copy_attributes = false;
778
- }
779
- else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
780
- 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');
781
-
782
- // Reapply CSS and custom CSS
783
- applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
784
- 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'));
785
- 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'));
786
- 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'));
787
-
788
- // Reapply custom css classes
789
- crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
790
-
791
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
792
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
793
- copy_attributes = false;
794
- }
795
-
796
- if(copy_attributes) {
797
- 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'));
798
- 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');
799
-
800
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
801
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
802
- textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
803
- }
804
-
805
- crellyslider_draggableElements();
806
-
807
- if(reapply_css) {
808
- applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
809
- crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
810
- }
811
- }
812
-
813
- // Apply custom CSS
814
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
815
- applyCustomCss($(this));
816
- });
817
-
818
- function applyCustomCss(textarea) {
819
- var index = textarea.closest('.cs-element-settings').index();
820
- // Save current positions
821
- var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
822
- var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
823
- var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
824
-
825
- // Apply CSS
826
- 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')) {
827
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
828
- }
829
- else {
830
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('style', textarea.val());
831
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction').removeAttr('style');
832
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeAttr('style');
833
- }
834
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
835
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
836
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
837
- }
838
-
839
- // Add custom CSS classes
840
- $('.cs-admin').on('keydown', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
841
- var textarea = $(this);
842
- var index = textarea.closest('.cs-element-settings').index();
843
-
844
- 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')) {
845
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textarea.val());
846
- }
847
- else {
848
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textarea.val());
849
- var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
850
- avoid_interaction.removeAttr('class');
851
- avoid_interaction.addClass('cs-avoid-interaction');
852
- }
853
- });
854
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
855
- crellyslider_applyCustomCssClasses($(this));
856
- });
857
- function crellyslider_applyCustomCssClasses(textarea) {
858
- var index = textarea.closest('.cs-element-settings').index();
859
-
860
- 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')) {
861
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').addClass(textarea.val());
862
- }
863
- else {
864
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').addClass(textarea.val());
865
- var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
866
- avoid_interaction.removeAttr('class');
867
- avoid_interaction.addClass('cs-avoid-interaction');
868
- }
869
- }
870
-
871
- // TEXT ELEMENTS
872
-
873
- // Convert textareas to WP editors
874
- $('.cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-element-inner_html').each(function() {
875
- var textarea = $(this);
876
-
877
- if(textarea.closest('.cs-text-element-settings').hasClass('cs-void-text-element-settings')) {
878
- return; // It means "continue;"
879
- }
880
-
881
- crellyslider_convertToWPEditor(textarea);
882
- });
883
-
884
- // Converts a textarea to something similar to wp_editor()
885
- function crellyslider_convertToWPEditor(textarea) {
886
- // Static counter: generates a new ID for each editor
887
- if(crellyslider_convertToWPEditor.static_counter == undefined) {
888
- crellyslider_convertToWPEditor.static_counter = 0;
889
- }
890
- else {
891
- crellyslider_convertToWPEditor.static_counter++;
892
- }
893
-
894
- textarea.attr('id', 'cs-element-editor-' + crellyslider_convertToWPEditor.static_counter);
895
-
896
- var lan = crellyslider_locale.split('_');
897
- lan = lan[0];
898
-
899
- settings = {
900
- selector : '#cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter),
901
- body_class : ('cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter) + ' locale-' + crellyslider_locale).toLowerCase(),
902
-
903
- toolbar1 : "bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor ",
904
- toolbar2 : "fontselect,fontsizeselect ",
905
- toolbar3 : "",
906
- toolbar4 : "",
907
- height : 200,
908
- forced_root_block : false,
909
- wpautop : false,
910
- fontsize_formats : "1px 2px 3px 4px 5px 6px 7px 8px 9px 10px 11px 12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px 30px 31px 32px 33px 34px 35px 36px 37px 38px 39px 40px 41px 42px 43px 44px 45px 46px 47px 48px 49px 50px 51px 52px 53px 54px 55px 56px 57px 58px 59px 60px 61px 62px 63px 64px 65px 66px 67px 68px 69px 70px 71px 72px 73px 74px 75px 76px 77px 78px 79px 80px 81px 82px 83px 84px 85px 86px 87px 88px 89px 90px 91px 92px 93px 94px 95px 96px 97px 98px 99px 100px 101px 102px 103px 104px 105px 106px 107px 108px 109px 110px 111px 112px 113px 114px 115px 116px 117px 118px 119px 120px 121px 122px 123px 124px 125px 126px 127px 128px 129px 130px 131px 132px 133px 134px 135px 136px 137px 138px 139px 140px 141px 142px 143px 144px 145px 146px 147px 148px 149px 150px 151px 152px 153px 154px 155px 156px 157px 158px 159px 160px 161px 162px 163px 164px 165px 166px 167px 168px 169px 170px 171px 172px 173px 174px 175px 176px 177px 178px 179px 180px 181px 182px 183px 184px 185px 186px 187px 188px 189px 190px 191px 192px 193px 194px 195px 196px 197px 198px 199px 200px",
911
-
912
  wp_lang_attr : crellyslider_locale,
913
- content_css : "",
914
- cache_suffix : "",
915
- language : lan,
916
- theme:"modern",skin:"lightgray",formats:{alignleft: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left"}},{selector: "img,table,dl.wp-caption", classes: "alignleft"}],aligncenter: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center"}},{selector: "img,table,dl.wp-caption", classes: "aligncenter"}],alignright: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right"}},{selector: "img,table,dl.wp-caption", classes: "alignright"}],strikethrough: {inline: "del"}},relative_urls:false,remove_script_host:false,convert_urls:false,browser_spellcheck:true,fix_list_elements:true,entities:"38,amp,60,lt,62,gt",entity_encoding:"raw",keep_styles:false,preview_styles:"font-family font-size font-weight font-style text-decoration text-transform",end_container_on_empty_block:true,wpeditimage_disable_captions:false,wpeditimage_html5_captions:true,plugins:"charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview,image",resize:"vertical",menubar:false,indent:true,tabfocus_elements:":prev,:next",
917
-
918
- setup : function(editor) {
919
- editor.on("KeyUp ExecCommand ContextMenu Change", function (e) {
920
- editor.save();
921
- crellyslider_triggerTinyMCE(editor.id);
922
- });
923
-
924
- editor.on("init", function() {
925
- // Set default CSS
926
- this.getDoc().body.style.fontSize = "14px";
927
- this.getDoc().body.style.fontFamily = "Verdana";
928
-
929
- // Insert switch button
930
- 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>');
931
- });
932
- }
933
- };
934
-
935
- if(typeof tinyMCE != 'undefined') {
936
- tinyMCE.init(settings);
937
- }
938
- }
939
-
940
- // When the user modifies the text in the TinyMCE editor, apply the changes to the preview area
941
- function crellyslider_triggerTinyMCE(editor_id) {
942
- crellyslider_changeText(jQuery('#' + editor_id));
943
- }
944
-
945
- // Add text click
946
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-text-element', function() {
947
- var slide_parent = $(this).closest('.cs-slide');
948
- crellyslider_addTextElement(slide_parent);
949
- });
950
-
951
- // Add text. Receives the slide as object
952
- function crellyslider_addTextElement(slide_parent) {
953
- var area = slide_parent.find('.cs-slide-editing-area');
954
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
955
- var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
956
-
957
- // Insert in editing area
958
- area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
959
-
960
- // Insert the options
961
- settings_div.before(settings);
962
-
963
- // Make draggable
964
- crellyslider_draggableElements();
965
-
966
- // Convert textarea to WP editor
967
- 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'));
968
-
969
- // Display settings
970
- crellyslider_selectElement(area.find('.cs-element').last());
971
- }
972
-
973
- // Modify text
974
- $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
975
- crellyslider_changeText($(this));
976
- });
977
- crellyslider_changeText = function crellyslider_changeText(element) {
978
- var index = element.closest('.cs-element-settings').index();
979
- var text_element = element.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
980
-
981
- if(! text_element.is('a')) {
982
- text_element.html(element.val());
983
-
984
- text_element.css('width', '');
985
- text_element.css('height', '');
986
- }
987
- else {
988
- text_element.find('> div').html(element.val());
989
-
990
- text_element.find('> div').css('width', '');
991
- text_element.find('> div').css('height', '');
992
- }
993
- }
994
-
995
- // IMAGE ELEMENTS
996
-
997
- // Add images click
998
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-image-element', function() {
999
- var slide_parent = $(this).closest('.cs-slide');
1000
- crellyslider_addImageElement(slide_parent);
1001
- });
1002
-
1003
- // Upload click
1004
- $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-image-element-settings .cs-image-element-upload-button', function() {
1005
- var slide_parent = $(this).closest('.cs-slide');
1006
- crellySliderUploadImageElement(slide_parent);
1007
- });
1008
-
1009
- // Add image. Receives the slide as object
1010
- function crellyslider_addImageElement(slide_parent) {
1011
- var area = slide_parent.find('.cs-slide-editing-area');
1012
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1013
- var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1014
-
1015
- // Temporarily insert an element with no src and alt
1016
- // Add the image into the editing area.
1017
- area.append('<img class="cs-element cs-image-element" src="nothing_now.jpg" style="z-index: 1;" />');
1018
-
1019
- // Insert the options
1020
- settings_div.before(settings);
1021
-
1022
- // Make draggable
1023
- crellyslider_draggableElements();
1024
-
1025
- // Display settings
1026
- crellyslider_selectElement(area.find('.cs-element').last());
1027
-
1028
- // Upload
1029
- crellySliderUploadImageElement(slide_parent);
1030
- }
1031
-
1032
- function crellySliderUploadImageElement(slide_parent) {
1033
- var area = slide_parent.find('.cs-slide-editing-area');
1034
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1035
- var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1036
-
1037
- var file_frame;
1038
-
1039
- // If the media frame already exists, reopen it.
1040
- if ( file_frame ) {
1041
- file_frame.open();
1042
- return;
1043
- }
1044
-
1045
- // Create the media frame.
1046
- file_frame = wp.media.frames.file_frame = wp.media({
1047
- title: jQuery( this ).data( 'uploader_title' ),
1048
- button: {
1049
- text: jQuery( this ).data( 'uploader_button_text' ),
1050
- },
1051
- multiple: false // Set to true to allow multiple files to be selected
1052
- });
1053
-
1054
- // When an image is selected, run a callback.
1055
- file_frame.on( 'select', function() {
1056
- // We set multiple to false so only get one image from the uploader
1057
- attachment = file_frame.state().get('selection').first().toJSON();
1058
-
1059
- // Do something with attachment.id and/or attachment.url here
1060
- var image_src = attachment.url;
1061
- var image_alt = attachment.alt;
1062
- var attachment_id = attachment.id;
1063
-
1064
- // Set attributes. If is a link, do the right thing
1065
- var image = area.find('.cs-image-element.active').last();
1066
-
1067
- if(! image.is('a')) {
1068
- image.attr('src', image_src);
1069
- image.attr('alt', image_alt);
1070
- }
1071
- else {
1072
- image.find('> img').attr('src', image_src);
1073
- image.find('> img').attr('alt', image_alt);
1074
- }
1075
-
1076
- // Set data (will be used in the ajax call)
1077
- settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', attachment_id);
1078
- settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
1079
- });
1080
-
1081
- // Finally, open the modal
1082
- file_frame.open();
1083
- }
1084
-
1085
- // VIDEO ELEMENTS
1086
-
1087
- // Add video click
1088
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-video-element', function() {
1089
- var slide_parent = $(this).closest('.cs-slide');
1090
- crellyslider_addVideoElement(slide_parent);
1091
- });
1092
-
1093
- // Adds a video container. Receives the slide as object
1094
- function crellyslider_addVideoElement(slide_parent) {
1095
- var area = slide_parent.find('.cs-slide-editing-area');
1096
- var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1097
- var settings = '<div class="cs-element-settings cs-video-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-video-element-settings').html() + '</div>';
1098
-
1099
- // Insert in editing area
1100
- area.append('<div class="cs-element cs-video-element" style="z-index: 1;"></div>');
1101
-
1102
- // Insert the options
1103
- settings_div.before(settings);
1104
-
1105
- // Make draggable
1106
- crellyslider_draggableElements();
1107
-
1108
- // Display settings
1109
- crellyslider_selectElement(area.find('.cs-element').last());
1110
-
1111
- // Select youtube video as default
1112
- area.find('.cs-element').last().closest('.cs-slide').find('.cs-elements .cs-elements-list .cs-element-video_src').trigger('change');
1113
- }
1114
-
1115
- // Change video id
1116
- $('.cs-admin').on('change keyup input', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_id', function() {
1117
- var index = $(this).closest('.cs-element-settings').index();
1118
- var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1119
-
1120
- crellyslider_changeVideo($(this), element, $(this).parent().find('.cs-element-video_src').val(), $(this).val());
1121
- });
1122
- // Change video source
1123
- $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_src', function() {
1124
- var index = $(this).closest('.cs-element-settings').index();
1125
- var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1126
-
1127
- crellyslider_changeVideo($(this), element, $(this).val(), $(this).parent().find('.cs-element-video_id').val());
1128
- });
1129
- function crellyslider_changeVideo(input, element, source, video_id) {
1130
- if(source == 'youtube') {
1131
- 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>');
1132
- }
1133
- else {
1134
- 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>');
1135
- }
1136
-
1137
- // Re-apply custom CSS and custom CSS classes
1138
- crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css'));
1139
- crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
1140
- }
1141
-
1142
- /******************/
1143
- /** LIVE PREVIEW **/
1144
- /******************/
1145
-
1146
- // Live preview click
1147
- $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-live-preview', function() {
1148
- var btn = $(this);
1149
- var slide_parent = btn.closest('.cs-slide');
1150
-
1151
- if(! btn.hasClass('cs-live-preview-running')) {
1152
- btn.addClass('cs-live-preview-running');
1153
- btn.text(crellyslider_translations.slide_stop_preview);
1154
- crellyslider_startLivePreview(slide_parent);
1155
- }
1156
- else {
1157
- btn.removeClass('cs-live-preview-running');
1158
- btn.text(crellyslider_translations.slide_live_preview);
1159
- crellyslider_stopLivePreview(slide_parent);
1160
- }
1161
- });
1162
-
1163
- function crellyslider_startLivePreview(slide_parent) {
1164
- crellyslider_deselectElements();
1165
-
1166
- var area = slide_parent.find('.cs-slide-editing-area');
1167
-
1168
- area.clone().addClass('cs-slide-live-preview-area').insertAfter(area);
1169
- var prev = slide_parent.find('.cs-slide-live-preview-area');
1170
-
1171
- area.css('display', 'none');
1172
-
1173
- // Set elements data and styles
1174
- var elements = prev.find('.cs-element');
1175
- var original_elements = area.closest('.cs-slide').find('.cs-elements .cs-element-settings');
1176
- var i = 0;
1177
- elements.each(function() {
1178
- var element = $(this);
1179
-
1180
- // Video elements settings only
1181
- var html_class = false;
1182
- if(element.find('.cs-yt-iframe').length > 0) {
1183
- element.find('.cs-avoid-interaction').remove();
1184
- element = element.find('.cs-yt-iframe');
1185
- element.unwrap();
1186
- element.attr({
1187
- 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1188
- 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1189
- });
1190
- html_class = 'cs-yt-iframe';
1191
- }
1192
- else if(element.find('.cs-vimeo-iframe').length > 0) {
1193
- element.find('.cs-avoid-interaction').remove();
1194
- element = element.find('.cs-vimeo-iframe');
1195
- element.unwrap();
1196
- element.attr({
1197
- 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1198
- 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1199
- });
1200
- html_class = 'cs-vimeo-iframe';
1201
- }
1202
-
1203
- element.removeAttr('style');
1204
- element.attr('style', original_elements.eq(i).find('.cs-element-custom_css').val());
1205
- element.css({
1206
- 'z-index' : parseInt(original_elements.eq(i).find('.cs-element-z_index').val()),
1207
- 'display' : 'none',
1208
- });
1209
-
1210
- element.removeAttr('class');
1211
- element.addClass(original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1212
- if(html_class) {
1213
- element.addClass(html_class);
1214
- }
1215
-
1216
- element.attr({
1217
- 'data-left' : parseInt(original_elements.eq(i).find('.cs-element-data_left').val()),
1218
- 'data-top' : parseInt(original_elements.eq(i).find('.cs-element-data_top').val()),
1219
- 'data-delay' : parseInt(original_elements.eq(i).find('.cs-element-data_delay').val()),
1220
- 'data-time' : original_elements.eq(i).find('.cs-element-data_time').val(),
1221
- 'data-in' : original_elements.eq(i).find('.cs-element-data_in').val(),
1222
- 'data-out' : original_elements.eq(i).find('.cs-element-data_out').val(),
1223
- 'data-ignore-ease-out' : original_elements.eq(i).find('.cs-element-data_out').prop('checked') ? 1 : 0,
1224
- 'data-ease-in' : parseInt(original_elements.eq(i).find('.cs-element-data_easeIn').val()),
1225
- 'data-ease-out' : parseInt(original_elements.eq(i).find('.cs-element-data_easeOut').val()),
1226
- });
1227
-
1228
- i++;
1229
- });
1230
-
1231
- // Prepare HTML structure
1232
- prev.wrapInner('<li />');
1233
- prev.wrapInner('<ul />');
1234
-
1235
-
1236
- var slide = prev.find('ul > li');
1237
- var original_slide = area.closest('.cs-slide');
1238
- var content = original_slide.find('.cs-slide-settings-list');
1239
-
1240
- // Set slide link
1241
- if(content.find('.cs-background-link').val() != '') {
1242
- if(! content.find('.cs-background-link_new_tab').prop('checked')) {
1243
- slide.prepend('<a class="cs-background-link" href="' + content.find('.cs-background-link').val() + '"></a>');
1244
- }
1245
- else {
1246
- slide.prepend('<a class="cs-background-link" target="_blank" href="' + content.find('.cs-background-link').val() + '"></a>');
1247
- }
1248
- }
1249
-
1250
- // Set slide data and styles
1251
- slide.attr({
1252
- 'data-in' : content.find('.cs-slide-data_in').val(),
1253
- 'data-out' : content.find('.cs-slide-data_out').val(),
1254
- 'data-time' : parseInt(content.find('.cs-slide-data_time').val()),
1255
- 'data-ease-in' : parseInt(content.find('.cs-slide-data_easeIn').val()),
1256
- 'data-ease-out' : parseInt(content.find('.cs-slide-data_easeOut').val()),
1257
- });
1258
-
1259
- slide.attr('style', content.find('.cs-slide-custom_css').val());
1260
- slide.css({
1261
- 'background-image' : area.css('background-image') ,
1262
- 'background-color' : area.css('background-color') + "",
1263
- 'background-position' : content.find('.cs-slide-background_propriety_position_x').val() + ' ' + content.find('.cs-slide-background_propriety_position_y').val(),
1264
- 'background-repeat' : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1265
- 'background-size' : content.find('.cs-slide-background_propriety_size').val(),
1266
- });
1267
-
1268
- var slider = $('.cs-admin .cs-slider #cs-slider-settings');
1269
-
1270
- // Run Crelly Slider
1271
- prev.crellySlider({
1272
- 'layout' : 'fixed',
1273
- 'responsive' : false,
1274
- 'startWidth' : parseInt(slider.find('#cs-slider-startWidth').val()),
1275
- 'startHeight' : parseInt(slider.find('#cs-slider-startHeight').val()),
1276
-
1277
- 'automaticSlide' : true,
1278
- 'showControls' : false,
1279
- 'showNavigation' : false,
1280
- 'enableSwipe' : false,
1281
- 'showProgressBar' : false,
1282
- 'pauseOnHover' : false,
1283
- });
1284
-
1285
- // Warning: click on background links
1286
- $('.cs-slide-live-preview-area a').click(function(event) {
1287
- if($(this).prop('target') != '_blank') {
1288
- var confirm = window.confirm(crellyslider_translations.exit_without_saving);
1289
- if(! confirm) {
1290
- event.preventDefault();
1291
- }
1292
- }
1293
- });
1294
- }
1295
-
1296
- function crellyslider_stopLivePreview(slide_parent) {
1297
- var area = slide_parent.find('.cs-slide-editing-area');
1298
- var prev = slide_parent.find('.cs-slide-live-preview-area');
1299
-
1300
- prev.remove();
1301
- area.css('display', 'block');
1302
- }
1303
-
1304
- /****************/
1305
- /** AJAX CALLS **/
1306
- /****************/
1307
-
1308
- // Save or update the new slider in the database
1309
- $('.cs-admin .cs-slider .cs-save-settings').click(function() {
1310
- $('.cs-admin #cs-slides .cs-live-preview').each(function() {
1311
- var btn = $(this);
1312
- var slide_parent = btn.closest('.cs-slide');
1313
-
1314
- if(btn.hasClass('cs-live-preview-running')) {
1315
- btn.removeClass('cs-live-preview-running');
1316
- btn.text(crellyslider_translations.slide_live_preview);
1317
- crellyslider_stopLivePreview(slide_parent);
1318
- }
1319
- });
1320
-
1321
- crellyslider_saveSlider();
1322
- });
1323
-
1324
- // Delete slider
1325
- $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-delete-slider', function() {
1326
- var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
1327
- if(!confirm) {
1328
- return;
1329
- }
1330
-
1331
- crellyslider_deleteSlider($(this));
1332
- });
1333
-
1334
- // Duplicate slider
1335
- $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-duplicate-slider', function() {
1336
- crellyslider_duplicateSlider($(this));
1337
- });
1338
-
1339
- // Export slider
1340
- $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-export-slider', function() {
1341
- crellyslider_exportSlider($(this));
1342
- });
1343
-
1344
- // Import slider
1345
- $('.cs-admin .cs-home').on('click', '.cs-import-slider', function() {
1346
- $('#cs-import-file').trigger('click');
1347
- });
1348
- $('.cs-admin .cs-home').on('change', '#cs-import-file', function() {
1349
- crellyslider_importSlider();
1350
- });
1351
-
1352
- // Sends an array with the new or current slider options
1353
- function crellyslider_saveSlider() {
1354
- var content = $('.cs-admin .cs-slider #cs-slider-settings');
1355
- var options = {
1356
- id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
1357
- name : content.find('#cs-slider-name').val(),
1358
- alias : content.find('#cs-slider-alias').text(),
1359
- layout : content.find('#cs-slider-layout').val(),
1360
- responsive : parseInt(content.find('#cs-slider-responsive').val()),
1361
- startWidth : parseInt(content.find('#cs-slider-startWidth').val()),
1362
- startHeight : parseInt(content.find('#cs-slider-startHeight').val()),
1363
- automaticSlide : parseInt(content.find('#cs-slider-automaticSlide').val()),
1364
- showControls : parseInt(content.find('#cs-slider-showControls').val()),
1365
- showNavigation : parseInt(content.find('#cs-slider-showNavigation').val()),
1366
- enableSwipe : parseInt(content.find('#cs-slider-enableSwipe').val()),
1367
- showProgressBar : parseInt(content.find('#cs-slider-showProgressBar').val()),
1368
- pauseOnHover : parseInt(content.find('#cs-slider-pauseOnHover').val()),
1369
- randomOrder : parseInt(content.find('#cs-slider-randomOrder').val()),
1370
- startFromSlide : parseInt(content.find('#cs-slider-startFromSlide').val()),
1371
- callbacks : content.find('#cs-slider-callbacks').val(),
1372
- };
1373
-
1374
- // Do the ajax call
1375
- jQuery.ajax({
1376
- type : 'POST',
1377
- dataType : 'json',
1378
- url : ajaxurl,
1379
- data : {
1380
- // Is it saving or updating?
1381
- action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1382
- datas : options,
1383
- },
1384
- success: function(response) {
1385
- //alert('Save slider response: ' + response);
1386
- // If adding a new slider, response will be the generated id, else will be the number of rows modified
1387
- if(response !== false) {
1388
- // If is adding a slider, redirect
1389
- if($('.cs-admin .cs-slider').hasClass('cs-add-slider')) {
1390
- window.location.href = '?page=crellyslider&view=edit&id=' + response;
1391
- return;
1392
- }
1393
-
1394
- crellyslider_saveSlides();
1395
- }
1396
- else {
1397
- crellyslider_showError();
1398
- }
1399
- },
1400
-
1401
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1402
- alert('Error saving slider');
1403
- console.log(XMLHttpRequest.responseText);
1404
- crellyslider_showError();
1405
- }
1406
- });
1407
- }
1408
-
1409
- // Sends an array with all the slides options
1410
- function crellyslider_saveSlides() {
1411
- var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1412
- var i = 0;
1413
- var final_options = {};
1414
-
1415
- final_options['options'] = new Array();
1416
- slides.each(function() {
1417
- var slide = $(this);
1418
- var content = slide.find('.cs-slide-settings-list');
1419
-
1420
- var background_type_color;
1421
- if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '0') {
1422
- background_type_color = 'transparent';
1423
- }
1424
- else if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '1') {
1425
- background_type_color = slide.find('.cs-slide-editing-area').css('background-color') + "";
1426
- }
1427
- else {
1428
- background_type_color = content.find('.cs-slide-background_type_color-manual').val();
1429
- }
1430
-
1431
- var options = {
1432
- slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1433
- position : i,
1434
-
1435
- draft : parseInt(content.find('.cs-slide-draft').val()),
1436
- background_type_image : slide.find('.cs-slide-editing-area').css('background-image') == 'none' ? 'none' : slide.find('.cs-slide-editing-area').data('background-image-src') + "",
1437
- background_type_color : background_type_color,
1438
- background_type_color_input : content.find('input[name="cs-slide-background_type_color"]:checked').val(),
1439
- background_propriety_position_x : content.find('.cs-slide-background_propriety_position_x').val(),
1440
- background_propriety_position_y : content.find('.cs-slide-background_propriety_position_y').val(),
1441
- background_repeat : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1442
- background_propriety_size : content.find('.cs-slide-background_propriety_size').val(),
1443
- data_in : content.find('.cs-slide-data_in').val(),
1444
- data_out : content.find('.cs-slide-data_out').val(),
1445
- data_time : parseInt(content.find('.cs-slide-data_time').val()),
1446
- data_easeIn : parseInt(content.find('.cs-slide-data_easeIn').val()),
1447
- data_easeOut : parseInt(content.find('.cs-slide-data_easeOut').val()),
1448
- link : slide.find('.cs-background-link').val(),
1449
- link_new_tab : slide.find('.cs-background-link_new_tab').prop('checked') ? 1 : 0,
1450
- custom_css : content.find('.cs-slide-custom_css').val(),
1451
- };
1452
-
1453
- final_options['options'][i] = options;
1454
-
1455
- i++;
1456
- });
1457
-
1458
- final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id')),
1459
-
1460
- // Do the ajax call
1461
- jQuery.ajax({
1462
- type : 'POST',
1463
- dataType : 'json',
1464
- url : ajaxurl,
1465
- data : {
1466
- action: 'crellyslider_editSlides',
1467
- datas : final_options,
1468
- },
1469
- success: function(response) {
1470
- //console.log('Save slides response: ' + response);
1471
- if(response !== false) {
1472
- crellyslider_saveElements();
1473
- }
1474
- else {
1475
- crellyslider_showError();
1476
- }
1477
- },
1478
-
1479
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1480
- alert('Error saving slides');
1481
- console.log(XMLHttpRequest.responseText);
1482
- crellyslider_showError();
1483
- }
1484
- });
1485
- }
1486
-
1487
- // Sends an array with all the elements options of each slide
1488
- function crellyslider_saveElements() {
1489
- var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1490
- var i = 0, j = 0;
1491
- var final_options = {};
1492
-
1493
- final_options['options'] = new Array();
1494
- slides.each(function() {
1495
- var slide = $(this);
1496
- var elements = slide.find('.cs-elements .cs-element-settings');
1497
-
1498
- elements.each(function() {
1499
- var element = $(this);
1500
-
1501
- // Stop each loop when reach the void element
1502
- if(element.hasClass('cs-void-element-settings')) {
1503
- return;
1504
- }
1505
-
1506
- // Get the type of the element
1507
- var type;
1508
- if(element.hasClass('cs-text-element-settings')) {
1509
- type = 'text';
1510
- }
1511
- else if(element.hasClass('cs-image-element-settings')) {
1512
- type = 'image';
1513
- }
1514
- else if(element.hasClass('cs-video-element-settings')) {
1515
- if(element.find('.cs-element-video_src').val() == 'youtube') {
1516
- type = 'youtube_video';
1517
- }
1518
- else {
1519
- type = 'vimeo_video';
1520
- }
1521
- }
1522
- else {
1523
- type = 'undefined';
1524
- }
1525
-
1526
- var options = {
1527
- slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1528
- slide_parent : i,
1529
- position : element.index(),
1530
- type : type,
1531
-
1532
- inner_html : element.hasClass('cs-text-element-settings') ? element.find('.cs-element-inner_html').val() : '',
1533
- image_src : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('src') : '',
1534
- image_alt : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('alt') : '',
1535
- data_left : parseInt(element.find('.cs-element-data_left').val()),
1536
- data_top : parseInt(element.find('.cs-element-data_top').val()),
1537
- z_index : parseInt(element.find('.cs-element-z_index').val()),
1538
- data_delay : parseInt(element.find('.cs-element-data_delay').val()),
1539
- data_time : element.find('.cs-element-data_time').val(),
1540
- data_in : element.find('.cs-element-data_in').val(),
1541
- data_out : element.find('.cs-element-data_out').val(),
1542
- data_ignoreEaseOut : element.find('.cs-element-data_ignoreEaseOut').prop('checked') ? 1 : 0,
1543
- data_easeIn : parseInt(element.find('.cs-element-data_easeIn').val()),
1544
- data_easeOut : parseInt(element.find('.cs-element-data_easeOut').val()),
1545
- custom_css : element.find('.cs-element-custom_css').val(),
1546
- custom_css_classes : element.find('.cs-element-custom_css_classes').val(),
1547
- link : element.hasClass('cs-video-element-settings') ? '' : element.find('.cs-element-link').val(),
1548
- link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1549
- video_id : element.hasClass('cs-video-element-settings') ? element.find('.cs-element-video_id').val() : '',
1550
- video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1551
- video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1552
- };
1553
-
1554
- final_options['options'][j] = options;
1555
-
1556
- j++;
1557
- });
1558
-
1559
- i++;
1560
- });
1561
-
1562
- // Proceed?
1563
- final_options['elements'] = 1;
1564
- if(final_options['options'].length == 0) {
1565
- final_options['elements'] = 0;
1566
- }
1567
-
1568
- final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1569
-
1570
- final_options['options'] = JSON.stringify(final_options['options']);
1571
-
1572
- // Do the ajax call
1573
- jQuery.ajax({
1574
- type : 'POST',
1575
- dataType : 'json',
1576
- url : ajaxurl,
1577
- data : {
1578
- action: 'crellyslider_editElements',
1579
- datas : final_options,
1580
- },
1581
- success: function(response) {
1582
- //console.log(response);
1583
- if(response !== false) {
1584
- crellyslider_showSuccess();
1585
- }
1586
- else {
1587
- crellyslider_showError();
1588
- }
1589
- },
1590
-
1591
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1592
- alert('Error saving elements');
1593
- console.log(XMLHttpRequest.responseText);
1594
- crellyslider_showError();
1595
- }
1596
- });
1597
- }
1598
-
1599
- function crellyslider_deleteSlider(content) {
1600
- // Get options
1601
- var options = {
1602
- id : parseInt(content.data('delete')),
1603
- };
1604
-
1605
- // Do the ajax call
1606
- jQuery.ajax({
1607
- type : 'POST',
1608
- dataType : 'json',
1609
- url : ajaxurl,
1610
- data : {
1611
- action: 'crellyslider_deleteSlider',
1612
- datas : options,
1613
- },
1614
- success: function(response) {
1615
- //alert('Delete slider response: ' + response);
1616
- if(response !== false) {
1617
- if($('.cs-sliders-list .cs-delete-slider').length > 1) {
1618
- content.parent().parent().remove();
1619
- }
1620
- else {
1621
- location.reload();
1622
- }
1623
- crellyslider_showSuccess();
1624
- }
1625
- else {
1626
- crellyslider_showError();
1627
- }
1628
- },
1629
-
1630
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1631
- alert('Error deleting slider');
1632
- console.log(XMLHttpRequest.responseText);
1633
- crellyslider_showError();
1634
- },
1635
- });
1636
- }
1637
-
1638
- function crellyslider_duplicateSlider(content) {
1639
- // Get options
1640
- var options = {
1641
- id : parseInt(content.data('duplicate')),
1642
- };
1643
-
1644
- // Do the ajax call
1645
- jQuery.ajax({
1646
- type : 'POST',
1647
- dataType : 'json',
1648
- url : ajaxurl,
1649
- data : {
1650
- action: 'crellyslider_duplicateSlider',
1651
- datas : options,
1652
- },
1653
- success: function(response) {
1654
- //console.log(response);
1655
- if(response['response'] !== false) {
1656
- var cloned_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1657
- cloned_slider.find('.cs-slider-id').html(response['cloned_slider_id']);
1658
- cloned_slider.find('.cs-slider-name a').html(response['cloned_slider_name']);
1659
- cloned_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1660
- cloned_slider.find('.cs-slider-alias').html(response['cloned_slider_alias']);
1661
- cloned_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['cloned_slider_alias'] + '"]');
1662
- cloned_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1663
- cloned_slider.find('.cs-duplicate-slider').data('duplicate', response['cloned_slider_id']);
1664
- cloned_slider.find('.cs-delete-slider').data('delete', response['cloned_slider_id']);
1665
- cloned_slider.find('.cs-export-slider').data('export', response['cloned_slider_id']);
1666
-
1667
- crellyslider_showSuccess();
1668
- }
1669
- else {
1670
- crellyslider_showError();
1671
- }
1672
- },
1673
-
1674
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1675
- alert('Error duplicating slider');
1676
- console.log(XMLHttpRequest.responseText);
1677
- crellyslider_showError();
1678
- },
1679
- });
1680
- }
1681
-
1682
- function crellyslider_exportSlider(content) {
1683
- // Get options
1684
- var options = {
1685
- id : parseInt(content.data('export')),
1686
- };
1687
-
1688
- // Do the ajax call
1689
- jQuery.ajax({
1690
- type : 'POST',
1691
- dataType : 'json',
1692
- url : ajaxurl,
1693
- data : {
1694
- action: 'crellyslider_exportSlider',
1695
- datas : options,
1696
- },
1697
- success: function(response) {
1698
- if(response['response'] !== false) {
1699
- window.location.href = response['url'];
1700
- crellyslider_showSuccess();
1701
- }
1702
- else {
1703
- crellyslider_showError();
1704
- }
1705
- },
1706
-
1707
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1708
- alert('Error while exporting the slider');
1709
- console.log(XMLHttpRequest.responseText);
1710
- crellyslider_showError();
1711
- },
1712
- });
1713
- }
1714
-
1715
- function crellyslider_importSlider() {
1716
- var file = $('#cs-import-file')[0].files[0];
1717
-
1718
- if(! file) {
1719
- return;
1720
- }
1721
-
1722
- // Reset input file. Prevents conflicts
1723
- $('#cs-import-file').val('');
1724
-
1725
- // Form data (for file uploads)
1726
- var fd = new FormData();
1727
- fd.append('file', file);
1728
- fd.append('action', 'crellyslider_importSlider');
1729
-
1730
- // Do the ajax call
1731
- jQuery.ajax({
1732
- type : 'POST',
1733
- url : ajaxurl,
1734
- contentType: false,
1735
- processData : false,
1736
- data : fd,
1737
- success: function(response) {
1738
- response = JSON.parse(response);
1739
- //console.log(response);
1740
- if(response['response'] !== false) {
1741
- var content = $('.cs-sliders-list .cs-duplicate-slider:eq(0)');
1742
- if(content.length > 0) {
1743
- var imported_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1744
- imported_slider.find('.cs-slider-id').html(response['imported_slider_id']);
1745
- imported_slider.find('.cs-slider-name a').html(response['imported_slider_name']);
1746
- imported_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1747
- imported_slider.find('.cs-slider-alias').html(response['imported_slider_alias']);
1748
- imported_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['imported_slider_alias'] + '"]');
1749
- imported_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1750
- imported_slider.find('.cs-duplicate-slider').data('duplicate', response['imported_slider_id']);
1751
- imported_slider.find('.cs-delete-slider').data('delete', response['imported_slider_id']);
1752
- imported_slider.find('.cs-delete-slider').data('export', response['imported_slider_id']);
1753
- }
1754
- else {
1755
- location.reload();
1756
- }
1757
-
1758
- crellyslider_showSuccess();
1759
- }
1760
- else {
1761
- crellyslider_showError();
1762
- }
1763
- },
1764
-
1765
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1766
- alert('Error while importing the slider');
1767
- console.log(XMLHttpRequest.responseText);
1768
- crellyslider_showError();
1769
- },
1770
- });
1771
- }
1772
-
1773
- });
1774
- })(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 .cs-message-working').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 .cs-message-working').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
+ /*************/
91
+ /** SLIDERS **/
92
+ /*************/
93
+
94
+ // Set Alias
95
+ $('.cs-slider').find('#cs-slider-name').keyup(function() {
96
+ var alias = crellyslider_getAlias();
97
+ $('.cs-slider').find('#cs-slider-alias').text(alias);
98
+ });
99
+
100
+ // Set shortcode
101
+ $('.cs-slider').find('#cs-slider-name').keyup(function() {
102
+ var alias = crellyslider_getAlias();
103
+ var shortcode = '';
104
+ shortcode += '[crellyslider alias="';
105
+ shortcode += alias;
106
+ shortcode += '"]';
107
+ if(alias != '') {
108
+ $('.cs-slider').find('#cs-slider-shortcode').text(shortcode);
109
+ }
110
+ else {
111
+ $('.cs-slider').find('#cs-slider-shortcode').text('');
112
+ }
113
+ });
114
+
115
+ // Set the new sizes of the editing area and of the slider if changing values
116
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').keyup(function() {
117
+ crellyslider_setSlidesEditingAreaSizes();
118
+ });
119
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').keyup(function() {
120
+ crellyslider_setSlidesEditingAreaSizes();
121
+ });
122
+
123
+ // Get the alias starting form the name
124
+ function crellyslider_getAlias() {
125
+ var slider_name = $('.cs-slider').find('#cs-slider-name').val();
126
+ var slider_alias = slider_name.toLowerCase();
127
+ slider_alias = slider_alias.replace(/ /g, '_');
128
+ return slider_alias;
129
+ }
130
+
131
+ /************/
132
+ /** SLIDES **/
133
+ /************/
134
+
135
+ var slides_number = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length - 1;
136
+
137
+ // Run sortable
138
+ var slide_before; // Contains the index before the sorting
139
+ var slide_after; // Contains the index after the sorting
140
+ $('.cs-slide-tabs .cs-sortable').sortable({
141
+ items: 'li:not(.ui-state-disabled)',
142
+ cancel: '.ui-state-disabled',
143
+ connectWith: '.cs-slide-tabs .cs-sortable',
144
+ containment: 'parent',
145
+ placeholder: 'sortable-placeholder',
146
+
147
+ start: function(event, ui) {
148
+ // Store the current index
149
+ slide_before = $(ui.item).index();
150
+
151
+ ui.placeholder.height(ui.helper.height() - 1);
152
+ ui.placeholder.width(ui.helper.width() - 1);
153
+ },
154
+
155
+ // Change the .cs-slide order based on the new index and rename the tabs
156
+ update: function(event, ui) {
157
+ // Store the new index
158
+ slide_after = $(ui.item).index();
159
+
160
+ // Change the slide position
161
+ var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_before + ')');
162
+ var after = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_after + ')');
163
+ if(slide_before < slide_after) {
164
+ slide.insertAfter(after);
165
+ }
166
+ else {
167
+ slide.insertBefore(after);
168
+ }
169
+
170
+ // Rename all the tabs
171
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').each(function() {
172
+ var temp = $(this);
173
+ if(!temp.find('a').hasClass('cs-add-new')) {
174
+ temp.find('a').html('<span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (temp.index() + 1) + '</span></span>');
175
+ }
176
+ });
177
+ }
178
+ });
179
+ $('.cs-slide-tabs .cs-sortable li').disableSelection();
180
+
181
+ // Show the slide when clicking on the link
182
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li > a').live('click', function() {
183
+ crellyslider_deselectElements();
184
+
185
+ // Do only if is not click add new
186
+ if($(this).parent().index() != slides_number) {
187
+ // Stop previews
188
+ $('.cs-admin #cs-slides .cs-slide .cs-elements .cs-elements-actions .cs-live-preview').each(function() {
189
+ var btn = $(this);
190
+ var slide_parent = btn.closest('.cs-slide');
191
+
192
+ if(btn.hasClass('cs-live-preview-running')) {
193
+ btn.removeClass('cs-live-preview-running');
194
+ btn.text(crellyslider_translations.slide_live_preview);
195
+ crellyslider_stopLivePreview(slide_parent);
196
+ }
197
+ });
198
+
199
+ // Hide all tabs
200
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
201
+ var tab = $(this).parent().index();
202
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + tab + ')').css('display', 'block');
203
+
204
+ // Active class
205
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
206
+ $(this).parent().addClass('active');
207
+ }
208
+ });
209
+
210
+ // Add new
211
+ function crellyslider_addSlide() {
212
+ var add_btn = $('.cs-admin #cs-slides .cs-add-new');
213
+
214
+ var void_slide = $('.cs-admin #cs-slides .cs-void-slide').html();
215
+ // Insert the link at the end of the list
216
+ 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>');
217
+ // jQuery UI tabs are not working here. For now, just use a manual created tab
218
+ $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
219
+ // Create the slide
220
+ $('.cs-admin #cs-slides .cs-slides-list').append('<div class="cs-slide">' + void_slide + '</div>');
221
+ slides_number++;
222
+
223
+ // Open the tab just created
224
+ var tab_index = add_btn.parent().index() - 1;
225
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).find('a').click();
226
+
227
+ // Active class
228
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
229
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).addClass('active');
230
+
231
+ // Set editing area sizes
232
+ crellyslider_setSlidesEditingAreaSizes();
233
+
234
+ crellyslider_slidesColorPicker();
235
+
236
+ // Update "start from slide" in the slider settings
237
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
238
+ }
239
+
240
+ // Add new on click
241
+ $('.cs-admin #cs-slides .cs-add-new').click(function() {
242
+ crellyslider_addSlide();
243
+ });
244
+ // Also add a new slide if slides_number == 0
245
+ if(slides_number == 0) {
246
+ crellyslider_addSlide();
247
+ }
248
+ else {
249
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
250
+ }
251
+
252
+ // Delete
253
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-close').live('click', function() {
254
+ if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length <= 2) {
255
+ alert(crellyslider_translations.slide_delete_just_one);
256
+ return;
257
+ }
258
+
259
+ var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
260
+ if(!confirm) {
261
+ return;
262
+ }
263
+
264
+ slides_number--;
265
+
266
+ var slide_index = $(this).parent().index();
267
+
268
+ // If is deleting the current viewing slide, set the first as active
269
+ if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(slide_index).hasClass('active') && slides_number != 0) {
270
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).addClass('active');
271
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
272
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(0).css('display', 'block');
273
+ }
274
+
275
+ // Remove the anchor
276
+ $(this).parent().remove();
277
+ // Remove the slide itself
278
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index).remove();
279
+
280
+ // Scale back all the slides text
281
+ for(var i = slide_index; i < slides_number; i++) {
282
+ var slide = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(i);
283
+ var indx = parseInt(slide.find('.cs-slide-index').text());
284
+ slide.find('.cs-slide-index').text(indx - 1);
285
+ }
286
+
287
+ // Update "start from slide" in the slider settings
288
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
289
+ if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').length == 0) {
290
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().first().val('0');
291
+ }
292
+ });
293
+
294
+ // Duplicate
295
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-duplicate').live('click', function() {
296
+ var slide_index = $(this).parent().index();
297
+ var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index);
298
+
299
+ // Clone the slide settings table
300
+ slide.crellyslider_betterClone(true, false).appendTo(slide.parent()).css('display', 'none');
301
+
302
+ // Fix TinyMCE
303
+ slide.parent().last().find('.cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').each(function() {
304
+ var cloned_options = $(this);
305
+
306
+ cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
307
+ cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
308
+ crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
309
+ });
310
+
311
+ // Add a new color picker, then remove the old one
312
+ crellyslider_slidesColorPicker();
313
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slides_number).find('.wp-picker-container > .wp-color-result').eq(0).remove();
314
+
315
+ // Insert the link at the end of the list
316
+ $(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>');
317
+ $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
318
+
319
+ crellyslider_draggableElements();
320
+
321
+ slides_number++;
322
+
323
+ // Update "start from slide" in the slider settings
324
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
325
+ });
326
+
327
+ // Set correct size for the editing area
328
+ function crellyslider_setSlidesEditingAreaSizes() {
329
+ var width = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val());
330
+ var height = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val());
331
+
332
+ $('.cs-admin #cs-slides .cs-slide .cs-slide-editing-area').css({
333
+ 'width' : width,
334
+ 'height' : height,
335
+ });
336
+
337
+ $('.cs-admin').css({
338
+ 'width' : width,
339
+ });
340
+ }
341
+
342
+ crellyslider_slidesColorPicker();
343
+
344
+ // Run background color picker
345
+ function crellyslider_slidesColorPicker() {
346
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input').wpColorPicker({
347
+ // a callback to fire whenever the color changes to a valid color
348
+ change: function(event, ui){
349
+ var btn = $(this);
350
+ if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"]:checked').val() != '1') {
351
+ btn.closest('.cs-content').find('input[name="cs-slide-background_type_color"][value="1"]:radio').prop('checked', true);
352
+ }
353
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
354
+ area.css('background-color', ui.color.toString());
355
+ },
356
+ // a callback to fire when the input is emptied or an invalid color
357
+ clear: function() {},
358
+ // hide the color picker controls on load
359
+ hide: true,
360
+ // show a group of common colors beneath the square
361
+ // or, supply an array of colors to customize further
362
+ palettes: true
363
+ });
364
+ }
365
+
366
+ // 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
367
+ $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_color"]:radio', function() {
368
+ var btn = $(this);
369
+ var btn_val = btn.val();
370
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
371
+
372
+ if(btn_val == '0') {
373
+ area.css('background-color', '#fff');
374
+ }
375
+ else if(btn_val == '1') {
376
+ var color_picker_value = btn.closest('.cs-content').find('.wp-color-result').css('background-color');
377
+ area.css('background-color', color_picker_value);
378
+ }
379
+ else {
380
+ area.css('background-color', btn.closest('.cs-content').find('.cs-slide-background_type_color-manual').val());
381
+ }
382
+ });
383
+
384
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-manual', function() {
385
+ var text = $(this);
386
+ var val = text.val();
387
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
388
+
389
+ text.closest('.cs-slide').find('input[name="cs-slide-background_type_color"][value="2"]:radio').prop('checked', true);
390
+ area.css('background-color', val);
391
+ });
392
+
393
+ // Set background image (none or image)
394
+ $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_image"]:radio', function() {
395
+ var btn = $(this);
396
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
397
+
398
+ if(btn.val() == '0') {
399
+ area.css('background-image', 'none');
400
+ }
401
+ else {
402
+ var slide_parent = $(this).closest('.cs-slide');
403
+ crellyslider_addSlideImageBackground(slide_parent);
404
+ }
405
+ });
406
+
407
+ // Set Background image (the upload function)
408
+ $('.cs-admin #cs-slides').on('click', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_image-upload-button', function() {
409
+ var btn = $(this);
410
+ if(btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]:checked').val() == '1') {
411
+ var slide_parent = $(this).closest('.cs-slide');
412
+ crellyslider_addSlideImageBackground(slide_parent);
413
+ }
414
+ else {
415
+ btn.closest('.cs-content').find('input[name="cs-slide-background_type_image"]').prop('checked', true);
416
+ var slide_parent = $(this).closest('.cs-slide');
417
+ crellyslider_addSlideImageBackground(slide_parent);
418
+ }
419
+ });
420
+ function crellyslider_addSlideImageBackground(slide_parent) {
421
+ var area = slide_parent.find('.cs-slide-editing-area');
422
+
423
+ // Upload
424
+ var file_frame;
425
+
426
+ // If the media frame already exists, reopen it.
427
+ if ( file_frame ) {
428
+ file_frame.open();
429
+ return;
430
+ }
431
+
432
+ // Create the media frame.
433
+ file_frame = wp.media.frames.file_frame = wp.media({
434
+ title: jQuery( this ).data( 'uploader_title' ),
435
+ button: {
436
+ text: jQuery( this ).data( 'uploader_button_text' ),
437
+ },
438
+ multiple: false // Set to true to allow multiple files to be selected
439
+ });
440
+
441
+ // When an image is selected, run a callback.
442
+ file_frame.on( 'select', function() {
443
+ // We set multiple to false so only get one image from the uploader
444
+ attachment = file_frame.state().get('selection').first().toJSON();
445
+
446
+ // Do something with attachment.id and/or attachment.url here
447
+ var image_src = attachment.url;
448
+ var image_alt = attachment.alt;
449
+ var image_id = attachment.id;
450
+
451
+ // Set background
452
+ area.css('background-image', 'url("' + image_src + '")');
453
+
454
+ // Data that we'll store into the database
455
+ area.data('background-image-src', image_id);
456
+ });
457
+
458
+ // Finally, open the modal
459
+ file_frame.open();
460
+ }
461
+
462
+ // Background propriety: repeat or no-repeat
463
+ $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_repeat"]:radio', function() {
464
+ var btn = $(this);
465
+ var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
466
+
467
+ if(btn.val() == '0') {
468
+ area.css('background-repeat', 'no-repeat');
469
+ }
470
+ else {
471
+ area.css('background-repeat', 'repeat');
472
+ }
473
+ });
474
+
475
+ // Background propriety: positions x and y
476
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_x', function() {
477
+ var text = $(this);
478
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
479
+
480
+ var x = text.val();
481
+ var y = text.parent().find('.cs-slide-background_propriety_position_y').val();
482
+
483
+ area.css('background-position', x + ' ' + y);
484
+ });
485
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_y', function() {
486
+ var text = $(this);
487
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
488
+
489
+ var x = text.parent().find('.cs-slide-background_propriety_position_x').val();
490
+ var y = text.val();
491
+
492
+ area.css('background-position', x + ' ' + y);
493
+ });
494
+
495
+ // Background propriety: size
496
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_size', function() {
497
+ var text = $(this);
498
+ var val = text.val();
499
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
500
+
501
+ area.css('background-size', val);
502
+ });
503
+
504
+ // Background presets
505
+ $('.cs-slide-background-image-fullwidth-preset').click(function() {
506
+ var text = $(this);
507
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
508
+ var settings = text.closest('.cs-slide');
509
+
510
+ settings.find('.cs-slide-background_propriety_position_x').val('center');
511
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
512
+
513
+ settings.find('.cs-slide-background_propriety_position_y').val('center');
514
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
515
+
516
+ settings.find('input[name="cs-slide-background_repeat"][value="0"]').prop('checked', true);
517
+ area.css('background-repeat', 'no-repeat');
518
+
519
+ settings.find('.cs-slide-background_propriety_size').val('cover');
520
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
521
+ });
522
+
523
+ $('.cs-slide-background-image-pattern-preset').click(function() {
524
+ var text = $(this);
525
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
526
+ var settings = text.closest('.cs-slide');
527
+
528
+ settings.find('.cs-slide-background_propriety_position_x').val(0);
529
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
530
+
531
+ settings.find('.cs-slide-background_propriety_position_y').val(0);
532
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
533
+
534
+ settings.find('input[name="cs-slide-background_repeat"][value="1"]').prop('checked', true);
535
+ area.css('background-repeat', 'repeat');
536
+
537
+ settings.find('.cs-slide-background_propriety_size').val('auto');
538
+ crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
539
+ });
540
+
541
+ // Apply custom CSS
542
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-custom_css', function() {
543
+ var text = $(this);
544
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
545
+ var css = text.val();
546
+
547
+ // Save current styles
548
+ var width = area.css('width');
549
+ var height = area.css('height');
550
+ var background_image = area.css('background-image');
551
+ var background_color = area.css('background-color');
552
+ var background_position = area.css('background-position');
553
+ var background_repeat = area.css('background-repeat');
554
+ var background_size = area.css('background-size');
555
+
556
+ // Apply CSS
557
+ area.attr('style', css);
558
+ area.css({
559
+ 'width' : width,
560
+ 'height' : height,
561
+ 'background-image' : background_image,
562
+ 'background-color' : background_color,
563
+ 'background-position' : background_position,
564
+ 'background-repeat' : background_repeat,
565
+ 'background-size' : background_size
566
+ });
567
+ });
568
+
569
+ /**************/
570
+ /** ELEMENTS **/
571
+ /**************/
572
+
573
+ // GENERAL
574
+
575
+ // Make draggable
576
+ function crellyslider_draggableElements() {
577
+ $('.cs-admin .cs-elements .cs-element').draggable({
578
+ 'containment' : 'parent',
579
+
580
+ start: function() {
581
+ // Select when dragging
582
+ crellyslider_selectElement($(this));
583
+ },
584
+
585
+ drag: function(){
586
+ // Set left and top positions on drag to the textbox
587
+ var position = $(this).position();
588
+ var left = position.left;
589
+ var top = position.top;
590
+ var index = $(this).index();
591
+
592
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
593
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
594
+ },
595
+ });
596
+ }
597
+
598
+ // Selects an element, shows its options and makes the delete element button available
599
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-slide-editing-area .cs-element', function(e) {
600
+ // Do not click the editing-area
601
+ e.stopPropagation();
602
+
603
+ // Do not open links
604
+ e.preventDefault();
605
+
606
+ crellyslider_selectElement($(this));
607
+ });
608
+ function crellyslider_selectElement(element) {
609
+ var index = element.index();
610
+ var slide = element.closest('.cs-slide');
611
+ var options = slide.find('.cs-elements .cs-elements-list');
612
+
613
+ // Hide all options - .active class
614
+ options.find('.cs-element-settings').css('display', 'none');
615
+ options.find('.cs-element-settings').removeClass('active');
616
+
617
+ // Show the correct options + .active class
618
+ options.find('.cs-element-settings:eq(' + index + ')').css('display', 'block');
619
+ options.find('.cs-element-settings:eq(' + index + ')').addClass('active');
620
+
621
+ // Add .active class to the element in the editing area
622
+ element.parent().children().removeClass('active');
623
+ element.addClass('active');
624
+
625
+ // Make the delete and the duplicate buttons working
626
+ slide.find('.cs-elements-actions .cs-delete-element').removeClass('cs-is-disabled');
627
+ slide.find('.cs-elements-actions .cs-duplicate-element').removeClass('cs-is-disabled');
628
+ }
629
+
630
+ // Deselect elements
631
+ $('.cs-admin').on('click', '.cs-slide .cs-elements .cs-slide-editing-area', function() {
632
+ crellyslider_deselectElements();
633
+ });
634
+ function crellyslider_deselectElements() {
635
+ $('.cs-admin .cs-slide .cs-elements .cs-slide-editing-area .cs-element').removeClass('active');
636
+ $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').removeClass('active');
637
+ $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').css('display', 'none');
638
+
639
+ // Hide delete and duplicate element btns
640
+ $('.cs-admin .cs-slide .cs-elements-actions .cs-delete-element').addClass('cs-is-disabled');
641
+ $('.cs-admin .cs-slide .cs-elements-actions .cs-duplicate-element').addClass('cs-is-disabled');
642
+ }
643
+
644
+ // Delete element. Remember that the button should be enabled / disabled somewhere else
645
+ function crellyslider_deleteElement(element) {
646
+ var index = element.index();
647
+ var slide_parent = element.closest('.cs-slide');
648
+
649
+ element.remove();
650
+ var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
651
+ element_options.remove();
652
+ crellyslider_deselectElements();
653
+ }
654
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-delete-element', function() {
655
+ // Click only if an element is selected
656
+ if($(this).hasClass('.cs-is-disabled')) {
657
+ return;
658
+ }
659
+
660
+ var slide_parent = $(this).closest('.cs-slide');
661
+ var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
662
+ crellyslider_deleteElement(element);
663
+ });
664
+
665
+ function crellyslider_duplicateElement(element) {
666
+ var index = element.index();
667
+ var slide_parent = element.closest('.cs-slide');
668
+
669
+ element.clone().appendTo(element.parent()).css({
670
+ 'left' : '+=10',
671
+ 'top' : '+=10',
672
+ });
673
+ var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
674
+ element_options.crellyslider_betterClone(true).insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
675
+
676
+ crellyslider_deselectElements();
677
+ crellyslider_selectElement(element.parent().find('.cs-element').last());
678
+
679
+ var cloned_options = element.parent().find('.cs-element').last().closest('.cs-slide').find('.cs-elements-list .cs-element-settings.active');
680
+
681
+ // Move the element 10 pixels away
682
+ cloned_options.find('.cs-element-data_left').val(parseInt(element_options.find('.cs-element-data_left').val()) + 10);
683
+ cloned_options.find('.cs-element-data_top').val(parseInt(element_options.find('.cs-element-data_top').val()) + 10);
684
+
685
+ // If it's a text, fix TinyMCE
686
+ if(cloned_options.hasClass('cs-text-element-settings')) {
687
+ cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
688
+ cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
689
+ crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
690
+ }
691
+
692
+ // Make draggable
693
+ crellyslider_draggableElements();
694
+ }
695
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-duplicate-element', function() {
696
+ // Click only if an element is selected
697
+ if($(this).hasClass('.cs-is-disabled')) {
698
+ return;
699
+ }
700
+
701
+ var slide_parent = $(this).closest('.cs-slide');
702
+ var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
703
+ crellyslider_duplicateElement(element);
704
+ });
705
+
706
+ // Modify left position
707
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_left', function() {
708
+ var index = $(this).closest('.cs-element-settings').index();
709
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', parseFloat($(this).val()));
710
+ });
711
+
712
+ // Center horizontally
713
+ $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-x', function() {
714
+ var index = $(this).closest('.cs-element-settings').index();
715
+ 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));
716
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
717
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
718
+ });
719
+
720
+ // Modify top position
721
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_top', function() {
722
+ var index = $(this).closest('.cs-element-settings').index();
723
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', parseFloat($(this).val()));
724
+ });
725
+
726
+ // Center vertically
727
+ $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-y', function() {
728
+ var index = $(this).closest('.cs-element-settings').index();
729
+ 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));
730
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
731
+ $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
732
+ });
733
+
734
+ // Modify z-index
735
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-z_index', function() {
736
+ var index = $(this).closest('.cs-element-settings').index();
737
+ $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
738
+ });
739
+
740
+ // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
741
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
742
+ crellyslider_editElementsLink($(this));
743
+ });
744
+ $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link_new_tab', function() {
745
+ var textbox = $(this).parent().find('.cs-element-link');
746
+ crellyslider_editElementsLink(textbox);
747
+ });
748
+
749
+ // Wrap - unwrap elements with an <a href="" target="">
750
+ function crellyslider_editElementsLink(textbox_link) {
751
+ var index = textbox_link.closest('.cs-element-settings').index();
752
+ var copy_attributes = false;
753
+ var reapply_css = false;
754
+
755
+ if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
756
+ // Remove custom css classes
757
+ 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());
758
+ 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());
759
+
760
+ var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
761
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
762
+ copy_attributes = true;
763
+ reapply_css = true;
764
+ }
765
+ else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
766
+ var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
767
+
768
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
769
+
770
+ if(link_new_tab) {
771
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
772
+ }
773
+ else {
774
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
775
+ }
776
+
777
+ copy_attributes = false;
778
+ }
779
+ else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
780
+ 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');
781
+
782
+ // Reapply CSS and custom CSS
783
+ applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
784
+ 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'));
785
+ 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'));
786
+ 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'));
787
+
788
+ // Reapply custom css classes
789
+ crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
790
+
791
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
792
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
793
+ copy_attributes = false;
794
+ }
795
+
796
+ if(copy_attributes) {
797
+ 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'));
798
+ 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');
799
+
800
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
801
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
802
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
803
+ }
804
+
805
+ crellyslider_draggableElements();
806
+
807
+ if(reapply_css) {
808
+ applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
809
+ crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
810
+ }
811
+ }
812
+
813
+ // Apply custom CSS
814
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
815
+ applyCustomCss($(this));
816
+ });
817
+
818
+ function applyCustomCss(textarea) {
819
+ var index = textarea.closest('.cs-element-settings').index();
820
+ // Save current positions
821
+ var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
822
+ var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
823
+ var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
824
+
825
+ // Apply CSS
826
+ 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')) {
827
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
828
+ }
829
+ else {
830
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('style', textarea.val());
831
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction').removeAttr('style');
832
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeAttr('style');
833
+ }
834
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
835
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
836
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
837
+ }
838
+
839
+ // Add custom CSS classes
840
+ $('.cs-admin').on('keydown', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
841
+ var textarea = $(this);
842
+ var index = textarea.closest('.cs-element-settings').index();
843
+
844
+ 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')) {
845
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textarea.val());
846
+ }
847
+ else {
848
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textarea.val());
849
+ var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
850
+ avoid_interaction.removeAttr('class');
851
+ avoid_interaction.addClass('cs-avoid-interaction');
852
+ }
853
+ });
854
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
855
+ crellyslider_applyCustomCssClasses($(this));
856
+ });
857
+ function crellyslider_applyCustomCssClasses(textarea) {
858
+ var index = textarea.closest('.cs-element-settings').index();
859
+
860
+ 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')) {
861
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').addClass(textarea.val());
862
+ }
863
+ else {
864
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').addClass(textarea.val());
865
+ var avoid_interaction = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > .cs-avoid-interaction');
866
+ avoid_interaction.removeAttr('class');
867
+ avoid_interaction.addClass('cs-avoid-interaction');
868
+ }
869
+ }
870
+
871
+ // TEXT ELEMENTS
872
+
873
+ // Convert textareas to WP editors
874
+ $('.cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-element-inner_html').each(function() {
875
+ var textarea = $(this);
876
+
877
+ if(textarea.closest('.cs-text-element-settings').hasClass('cs-void-text-element-settings')) {
878
+ return; // It means "continue;"
879
+ }
880
+
881
+ crellyslider_convertToWPEditor(textarea);
882
+ });
883
+
884
+ // Converts a textarea to something similar to wp_editor()
885
+ function crellyslider_convertToWPEditor(textarea) {
886
+ // Static counter: generates a new ID for each editor
887
+ if(crellyslider_convertToWPEditor.static_counter == undefined) {
888
+ crellyslider_convertToWPEditor.static_counter = 0;
889
+ }
890
+ else {
891
+ crellyslider_convertToWPEditor.static_counter++;
892
+ }
893
+
894
+ textarea.attr('id', 'cs-element-editor-' + crellyslider_convertToWPEditor.static_counter);
895
+
896
+ var lan = crellyslider_locale.split('_');
897
+ lan = lan[0];
898
+
899
+ settings = {
900
+ selector : '#cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter),
901
+ body_class : ('cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter) + ' locale-' + crellyslider_locale).toLowerCase(),
902
+
903
+ toolbar1 : "bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor ",
904
+ toolbar2 : "fontselect,fontsizeselect ",
905
+ toolbar3 : "",
906
+ toolbar4 : "",
907
+ height : 200,
908
+ forced_root_block : false,
909
+ wpautop : false,
910
+ fontsize_formats : "1px 2px 3px 4px 5px 6px 7px 8px 9px 10px 11px 12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px 30px 31px 32px 33px 34px 35px 36px 37px 38px 39px 40px 41px 42px 43px 44px 45px 46px 47px 48px 49px 50px 51px 52px 53px 54px 55px 56px 57px 58px 59px 60px 61px 62px 63px 64px 65px 66px 67px 68px 69px 70px 71px 72px 73px 74px 75px 76px 77px 78px 79px 80px 81px 82px 83px 84px 85px 86px 87px 88px 89px 90px 91px 92px 93px 94px 95px 96px 97px 98px 99px 100px 101px 102px 103px 104px 105px 106px 107px 108px 109px 110px 111px 112px 113px 114px 115px 116px 117px 118px 119px 120px 121px 122px 123px 124px 125px 126px 127px 128px 129px 130px 131px 132px 133px 134px 135px 136px 137px 138px 139px 140px 141px 142px 143px 144px 145px 146px 147px 148px 149px 150px 151px 152px 153px 154px 155px 156px 157px 158px 159px 160px 161px 162px 163px 164px 165px 166px 167px 168px 169px 170px 171px 172px 173px 174px 175px 176px 177px 178px 179px 180px 181px 182px 183px 184px 185px 186px 187px 188px 189px 190px 191px 192px 193px 194px 195px 196px 197px 198px 199px 200px",
911
+
912
  wp_lang_attr : crellyslider_locale,
913
+ content_css : "",
914
+ cache_suffix : "",
915
+ language : lan,
916
+ theme:"modern",skin:"lightgray",formats:{alignleft: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left", lineHeight:"inherit"}, inline: "div"},{selector: "img,table,dl.wp-caption", classes: "alignleft"}],aligncenter: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center", lineHeight:"inherit"}, inline: "div"},{selector: "img,table,dl.wp-caption", classes: "aligncenter"}],alignright: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right", lineHeight:"inherit"}, inline: "div"},{selector: "img,table,dl.wp-caption", classes: "alignright"}],strikethrough: {inline: "del"}},relative_urls:false,remove_script_host:false,convert_urls:false,browser_spellcheck:true,fix_list_elements:true,entities:"38,amp,60,lt,62,gt",entity_encoding:"raw",keep_styles:false,preview_styles:"font-family font-size font-weight font-style text-decoration text-transform",end_container_on_empty_block:true,wpeditimage_disable_captions:false,wpeditimage_html5_captions:true,plugins:"charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview,image",resize:"vertical",menubar:false,indent:true,tabfocus_elements:":prev,:next",
917
+
918
+ setup : function(editor) {
919
+ editor.on("KeyUp ExecCommand ContextMenu Change", function (e) {
920
+ editor.save();
921
+ crellyslider_triggerTinyMCE(editor.id);
922
+ });
923
+
924
+ editor.on("init", function() {
925
+ // Set default CSS
926
+ this.getDoc().body.style.fontSize = "14px";
927
+ this.getDoc().body.style.fontFamily = "Verdana";
928
+
929
+ // Insert switch button
930
+ 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>');
931
+ });
932
+ }
933
+ };
934
+
935
+ if(typeof tinyMCE != 'undefined') {
936
+ tinyMCE.init(settings);
937
+ }
938
+ }
939
+
940
+ // When the user modifies the text in the TinyMCE editor, apply the changes to the preview area
941
+ function crellyslider_triggerTinyMCE(editor_id) {
942
+ crellyslider_changeText(jQuery('#' + editor_id));
943
+ }
944
+
945
+ // Add text click
946
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-text-element', function() {
947
+ var slide_parent = $(this).closest('.cs-slide');
948
+ crellyslider_addTextElement(slide_parent);
949
+ });
950
+
951
+ // Add text. Receives the slide as object
952
+ function crellyslider_addTextElement(slide_parent) {
953
+ var area = slide_parent.find('.cs-slide-editing-area');
954
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
955
+ var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
956
+
957
+ // Insert in editing area
958
+ area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
959
+
960
+ // Insert the options
961
+ settings_div.before(settings);
962
+
963
+ // Make draggable
964
+ crellyslider_draggableElements();
965
+
966
+ // Convert textarea to WP editor
967
+ 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'));
968
+
969
+ // Display settings
970
+ crellyslider_selectElement(area.find('.cs-element').last());
971
+ }
972
+
973
+ // Modify text
974
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
975
+ crellyslider_changeText($(this));
976
+ });
977
+ crellyslider_changeText = function crellyslider_changeText(element) {
978
+ var index = element.closest('.cs-element-settings').index();
979
+ var text_element = element.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
980
+
981
+ if(! text_element.is('a')) {
982
+ text_element.html(element.val());
983
+
984
+ text_element.css('width', '');
985
+ text_element.css('height', '');
986
+ }
987
+ else {
988
+ text_element.find('> div').html(element.val());
989
+
990
+ text_element.find('> div').css('width', '');
991
+ text_element.find('> div').css('height', '');
992
+ }
993
+ }
994
+
995
+ // IMAGE ELEMENTS
996
+
997
+ // Add images click
998
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-image-element', function() {
999
+ var slide_parent = $(this).closest('.cs-slide');
1000
+ crellyslider_addImageElement(slide_parent);
1001
+ });
1002
+
1003
+ // Upload click
1004
+ $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-image-element-settings .cs-image-element-upload-button', function() {
1005
+ var slide_parent = $(this).closest('.cs-slide');
1006
+ crellySliderUploadImageElement(slide_parent);
1007
+ });
1008
+
1009
+ // Add image. Receives the slide as object
1010
+ function crellyslider_addImageElement(slide_parent) {
1011
+ var area = slide_parent.find('.cs-slide-editing-area');
1012
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1013
+ var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1014
+
1015
+ // Temporarily insert an element with no src and alt
1016
+ // Add the image into the editing area.
1017
+ area.append('<img class="cs-element cs-image-element" src="nothing_now.jpg" style="z-index: 1;" />');
1018
+
1019
+ // Insert the options
1020
+ settings_div.before(settings);
1021
+
1022
+ // Make draggable
1023
+ crellyslider_draggableElements();
1024
+
1025
+ // Display settings
1026
+ crellyslider_selectElement(area.find('.cs-element').last());
1027
+
1028
+ // Upload
1029
+ crellySliderUploadImageElement(slide_parent);
1030
+ }
1031
+
1032
+ function crellySliderUploadImageElement(slide_parent) {
1033
+ var area = slide_parent.find('.cs-slide-editing-area');
1034
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1035
+ var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1036
+
1037
+ var file_frame;
1038
+
1039
+ // If the media frame already exists, reopen it.
1040
+ if ( file_frame ) {
1041
+ file_frame.open();
1042
+ return;
1043
+ }
1044
+
1045
+ // Create the media frame.
1046
+ file_frame = wp.media.frames.file_frame = wp.media({
1047
+ title: jQuery( this ).data( 'uploader_title' ),
1048
+ button: {
1049
+ text: jQuery( this ).data( 'uploader_button_text' ),
1050
+ },
1051
+ multiple: false // Set to true to allow multiple files to be selected
1052
+ });
1053
+
1054
+ // When an image is selected, run a callback.
1055
+ file_frame.on( 'select', function() {
1056
+ // We set multiple to false so only get one image from the uploader
1057
+ attachment = file_frame.state().get('selection').first().toJSON();
1058
+
1059
+ // Do something with attachment.id and/or attachment.url here
1060
+ var image_src = attachment.url;
1061
+ var image_alt = attachment.alt;
1062
+ var attachment_id = attachment.id;
1063
+
1064
+ // Set attributes. If is a link, do the right thing
1065
+ var image = area.find('.cs-image-element.active').last();
1066
+
1067
+ if(! image.is('a')) {
1068
+ image.attr('src', image_src);
1069
+ image.attr('alt', image_alt);
1070
+ }
1071
+ else {
1072
+ image.find('> img').attr('src', image_src);
1073
+ image.find('> img').attr('alt', image_alt);
1074
+ }
1075
+
1076
+ // Set data (will be used in the ajax call)
1077
+ settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', attachment_id);
1078
+ settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
1079
+ });
1080
+
1081
+ // Finally, open the modal
1082
+ file_frame.open();
1083
+ }
1084
+
1085
+ // VIDEO ELEMENTS
1086
+
1087
+ // Add video click
1088
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-video-element', function() {
1089
+ var slide_parent = $(this).closest('.cs-slide');
1090
+ crellyslider_addVideoElement(slide_parent);
1091
+ });
1092
+
1093
+ // Adds a video container. Receives the slide as object
1094
+ function crellyslider_addVideoElement(slide_parent) {
1095
+ var area = slide_parent.find('.cs-slide-editing-area');
1096
+ var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1097
+ var settings = '<div class="cs-element-settings cs-video-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-video-element-settings').html() + '</div>';
1098
+
1099
+ // Insert in editing area
1100
+ area.append('<div class="cs-element cs-video-element" style="z-index: 1;"></div>');
1101
+
1102
+ // Insert the options
1103
+ settings_div.before(settings);
1104
+
1105
+ // Make draggable
1106
+ crellyslider_draggableElements();
1107
+
1108
+ // Display settings
1109
+ crellyslider_selectElement(area.find('.cs-element').last());
1110
+
1111
+ // Select youtube video as default
1112
+ area.find('.cs-element').last().closest('.cs-slide').find('.cs-elements .cs-elements-list .cs-element-video_src').trigger('change');
1113
+ }
1114
+
1115
+ // Change video id
1116
+ $('.cs-admin').on('change keyup input', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_id', function() {
1117
+ var index = $(this).closest('.cs-element-settings').index();
1118
+ var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1119
+
1120
+ crellyslider_changeVideo($(this), element, $(this).parent().find('.cs-element-video_src').val(), $(this).val());
1121
+ });
1122
+ // Change video source
1123
+ $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_src', function() {
1124
+ var index = $(this).closest('.cs-element-settings').index();
1125
+ var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1126
+
1127
+ crellyslider_changeVideo($(this), element, $(this).val(), $(this).parent().find('.cs-element-video_id').val());
1128
+ });
1129
+ function crellyslider_changeVideo(input, element, source, video_id) {
1130
+ if(source == 'youtube') {
1131
+ 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>');
1132
+ }
1133
+ else {
1134
+ 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>');
1135
+ }
1136
+
1137
+ // Re-apply custom CSS and custom CSS classes
1138
+ crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css'));
1139
+ crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
1140
+ }
1141
+
1142
+ /******************/
1143
+ /** LIVE PREVIEW **/
1144
+ /******************/
1145
+
1146
+ // Live preview click
1147
+ $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-live-preview', function() {
1148
+ var btn = $(this);
1149
+ var slide_parent = btn.closest('.cs-slide');
1150
+
1151
+ if(! btn.hasClass('cs-live-preview-running')) {
1152
+ btn.addClass('cs-live-preview-running');
1153
+ btn.text(crellyslider_translations.slide_stop_preview);
1154
+ crellyslider_startLivePreview(slide_parent);
1155
+ }
1156
+ else {
1157
+ btn.removeClass('cs-live-preview-running');
1158
+ btn.text(crellyslider_translations.slide_live_preview);
1159
+ crellyslider_stopLivePreview(slide_parent);
1160
+ }
1161
+ });
1162
+
1163
+ function crellyslider_startLivePreview(slide_parent) {
1164
+ crellyslider_deselectElements();
1165
+
1166
+ var area = slide_parent.find('.cs-slide-editing-area');
1167
+
1168
+ area.clone().addClass('cs-slide-live-preview-area').insertAfter(area);
1169
+ var prev = slide_parent.find('.cs-slide-live-preview-area');
1170
+
1171
+ area.css('display', 'none');
1172
+
1173
+ // Set elements data and styles
1174
+ var elements = prev.find('.cs-element');
1175
+ var original_elements = area.closest('.cs-slide').find('.cs-elements .cs-element-settings');
1176
+ var i = 0;
1177
+ elements.each(function() {
1178
+ var element = $(this);
1179
+
1180
+ // Video elements settings only
1181
+ var html_class = false;
1182
+ if(element.find('.cs-yt-iframe').length > 0) {
1183
+ element.find('.cs-avoid-interaction').remove();
1184
+ element = element.find('.cs-yt-iframe');
1185
+ element.unwrap();
1186
+ element.attr({
1187
+ 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1188
+ 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1189
+ });
1190
+ html_class = 'cs-yt-iframe';
1191
+ }
1192
+ else if(element.find('.cs-vimeo-iframe').length > 0) {
1193
+ element.find('.cs-avoid-interaction').remove();
1194
+ element = element.find('.cs-vimeo-iframe');
1195
+ element.unwrap();
1196
+ element.attr({
1197
+ 'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1198
+ 'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1199
+ });
1200
+ html_class = 'cs-vimeo-iframe';
1201
+ }
1202
+
1203
+ element.removeAttr('style');
1204
+ element.attr('style', original_elements.eq(i).find('.cs-element-custom_css').val());
1205
+ element.css({
1206
+ 'z-index' : parseInt(original_elements.eq(i).find('.cs-element-z_index').val()),
1207
+ 'display' : 'none',
1208
+ });
1209
+
1210
+ element.removeAttr('class');
1211
+ element.addClass(original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1212
+ if(html_class) {
1213
+ element.addClass(html_class);
1214
+ }
1215
+
1216
+ element.attr({
1217
+ 'data-left' : parseInt(original_elements.eq(i).find('.cs-element-data_left').val()),
1218
+ 'data-top' : parseInt(original_elements.eq(i).find('.cs-element-data_top').val()),
1219
+ 'data-delay' : parseInt(original_elements.eq(i).find('.cs-element-data_delay').val()),
1220
+ 'data-time' : original_elements.eq(i).find('.cs-element-data_time').val(),
1221
+ 'data-in' : original_elements.eq(i).find('.cs-element-data_in').val(),
1222
+ 'data-out' : original_elements.eq(i).find('.cs-element-data_out').val(),
1223
+ 'data-ignore-ease-out' : original_elements.eq(i).find('.cs-element-data_out').prop('checked') ? 1 : 0,
1224
+ 'data-ease-in' : parseInt(original_elements.eq(i).find('.cs-element-data_easeIn').val()),
1225
+ 'data-ease-out' : parseInt(original_elements.eq(i).find('.cs-element-data_easeOut').val()),
1226
+ });
1227
+
1228
+ i++;
1229
+ });
1230
+
1231
+ // Prepare HTML structure
1232
+ prev.wrapInner('<li />');
1233
+ prev.wrapInner('<ul />');
1234
+
1235
+
1236
+ var slide = prev.find('ul > li');
1237
+ var original_slide = area.closest('.cs-slide');
1238
+ var content = original_slide.find('.cs-slide-settings-list');
1239
+
1240
+ // Set slide link
1241
+ if(content.find('.cs-background-link').val() != '') {
1242
+ if(! content.find('.cs-background-link_new_tab').prop('checked')) {
1243
+ slide.prepend('<a class="cs-background-link" href="' + content.find('.cs-background-link').val() + '"></a>');
1244
+ }
1245
+ else {
1246
+ slide.prepend('<a class="cs-background-link" target="_blank" href="' + content.find('.cs-background-link').val() + '"></a>');
1247
+ }
1248
+ }
1249
+
1250
+ // Set slide data and styles
1251
+ slide.attr({
1252
+ 'data-in' : content.find('.cs-slide-data_in').val(),
1253
+ 'data-out' : content.find('.cs-slide-data_out').val(),
1254
+ 'data-time' : parseInt(content.find('.cs-slide-data_time').val()),
1255
+ 'data-ease-in' : parseInt(content.find('.cs-slide-data_easeIn').val()),
1256
+ 'data-ease-out' : parseInt(content.find('.cs-slide-data_easeOut').val()),
1257
+ });
1258
+
1259
+ slide.attr('style', content.find('.cs-slide-custom_css').val());
1260
+ slide.css({
1261
+ 'background-image' : area.css('background-image') ,
1262
+ 'background-color' : area.css('background-color') + "",
1263
+ 'background-position' : content.find('.cs-slide-background_propriety_position_x').val() + ' ' + content.find('.cs-slide-background_propriety_position_y').val(),
1264
+ 'background-repeat' : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1265
+ 'background-size' : content.find('.cs-slide-background_propriety_size').val(),
1266
+ });
1267
+
1268
+ var slider = $('.cs-admin .cs-slider #cs-slider-settings');
1269
+
1270
+ // Run Crelly Slider
1271
+ prev.crellySlider({
1272
+ 'layout' : 'fixed',
1273
+ 'responsive' : false,
1274
+ 'startWidth' : parseInt(slider.find('#cs-slider-startWidth').val()),
1275
+ 'startHeight' : parseInt(slider.find('#cs-slider-startHeight').val()),
1276
+
1277
+ 'automaticSlide' : true,
1278
+ 'showControls' : false,
1279
+ 'showNavigation' : false,
1280
+ 'enableSwipe' : false,
1281
+ 'showProgressBar' : false,
1282
+ 'pauseOnHover' : false,
1283
+ });
1284
+
1285
+ // Warning: click on background links
1286
+ $('.cs-slide-live-preview-area a').click(function(event) {
1287
+ if($(this).prop('target') != '_blank') {
1288
+ var confirm = window.confirm(crellyslider_translations.exit_without_saving);
1289
+ if(! confirm) {
1290
+ event.preventDefault();
1291
+ }
1292
+ }
1293
+ });
1294
+ }
1295
+
1296
+ function crellyslider_stopLivePreview(slide_parent) {
1297
+ var area = slide_parent.find('.cs-slide-editing-area');
1298
+ var prev = slide_parent.find('.cs-slide-live-preview-area');
1299
+
1300
+ prev.remove();
1301
+ area.css('display', 'block');
1302
+ }
1303
+
1304
+ /****************/
1305
+ /** AJAX CALLS **/
1306
+ /****************/
1307
+
1308
+ // Save or update the new slider in the database
1309
+ $('.cs-admin .cs-slider .cs-save-settings').click(function() {
1310
+ $('.cs-admin #cs-slides .cs-live-preview').each(function() {
1311
+ var btn = $(this);
1312
+ var slide_parent = btn.closest('.cs-slide');
1313
+
1314
+ if(btn.hasClass('cs-live-preview-running')) {
1315
+ btn.removeClass('cs-live-preview-running');
1316
+ btn.text(crellyslider_translations.slide_live_preview);
1317
+ crellyslider_stopLivePreview(slide_parent);
1318
+ }
1319
+ });
1320
+
1321
+ crellyslider_saveSlider();
1322
+ });
1323
+
1324
+ // Delete slider
1325
+ $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-delete-slider', function() {
1326
+ var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
1327
+ if(!confirm) {
1328
+ return;
1329
+ }
1330
+
1331
+ crellyslider_deleteSlider($(this));
1332
+ });
1333
+
1334
+ // Duplicate slider
1335
+ $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-duplicate-slider', function() {
1336
+ crellyslider_duplicateSlider($(this));
1337
+ });
1338
+
1339
+ // Export slider
1340
+ $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-export-slider', function() {
1341
+ crellyslider_exportSlider($(this));
1342
+ });
1343
+
1344
+ // Import slider
1345
+ $('.cs-admin .cs-home').on('click', '.cs-import-slider', function() {
1346
+ $('#cs-import-file').trigger('click');
1347
+ });
1348
+ $('.cs-admin .cs-home').on('change', '#cs-import-file', function() {
1349
+ crellyslider_importSlider();
1350
+ });
1351
+
1352
+ // Sends an array with the new or current slider options
1353
+ function crellyslider_saveSlider() {
1354
+ var content = $('.cs-admin .cs-slider #cs-slider-settings');
1355
+ var options = {
1356
+ id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
1357
+ name : content.find('#cs-slider-name').val(),
1358
+ alias : content.find('#cs-slider-alias').text(),
1359
+ layout : content.find('#cs-slider-layout').val(),
1360
+ responsive : parseInt(content.find('#cs-slider-responsive').val()),
1361
+ startWidth : parseInt(content.find('#cs-slider-startWidth').val()),
1362
+ startHeight : parseInt(content.find('#cs-slider-startHeight').val()),
1363
+ automaticSlide : parseInt(content.find('#cs-slider-automaticSlide').val()),
1364
+ showControls : parseInt(content.find('#cs-slider-showControls').val()),
1365
+ showNavigation : parseInt(content.find('#cs-slider-showNavigation').val()),
1366
+ enableSwipe : parseInt(content.find('#cs-slider-enableSwipe').val()),
1367
+ showProgressBar : parseInt(content.find('#cs-slider-showProgressBar').val()),
1368
+ pauseOnHover : parseInt(content.find('#cs-slider-pauseOnHover').val()),
1369
+ randomOrder : parseInt(content.find('#cs-slider-randomOrder').val()),
1370
+ startFromSlide : parseInt(content.find('#cs-slider-startFromSlide').val()),
1371
+ callbacks : content.find('#cs-slider-callbacks').val(),
1372
+ };
1373
+
1374
+ // Do the ajax call
1375
+ jQuery.ajax({
1376
+ type : 'POST',
1377
+ dataType : 'json',
1378
+ url : ajaxurl,
1379
+ data : {
1380
+ // Is it saving or updating?
1381
+ action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1382
+ datas : options,
1383
+ },
1384
+ success: function(response) {
1385
+ //alert('Save slider response: ' + response);
1386
+ // If adding a new slider, response will be the generated id, else will be the number of rows modified
1387
+ if(response !== false) {
1388
+ // If is adding a slider, redirect
1389
+ if($('.cs-admin .cs-slider').hasClass('cs-add-slider')) {
1390
+ window.location.href = '?page=crellyslider&view=edit&id=' + response;
1391
+ return;
1392
+ }
1393
+
1394
+ crellyslider_saveSlides();
1395
+ }
1396
+ else {
1397
+ crellyslider_showError();
1398
+ }
1399
+ },
1400
+
1401
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1402
+ alert('Error saving slider');
1403
+ console.log(XMLHttpRequest.responseText);
1404
+ crellyslider_showError();
1405
+ }
1406
+ });
1407
+ }
1408
+
1409
+ // Sends an array with all the slides options
1410
+ function crellyslider_saveSlides() {
1411
+ var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1412
+ var i = 0;
1413
+ var final_options = {};
1414
+
1415
+ final_options['options'] = new Array();
1416
+ slides.each(function() {
1417
+ var slide = $(this);
1418
+ var content = slide.find('.cs-slide-settings-list');
1419
+
1420
+ var background_type_color;
1421
+ if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '0') {
1422
+ background_type_color = 'transparent';
1423
+ }
1424
+ else if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '1') {
1425
+ background_type_color = slide.find('.cs-slide-editing-area').css('background-color') + "";
1426
+ }
1427
+ else {
1428
+ background_type_color = content.find('.cs-slide-background_type_color-manual').val();
1429
+ }
1430
+
1431
+ var options = {
1432
+ slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1433
+ position : i,
1434
+
1435
+ draft : parseInt(content.find('.cs-slide-draft').val()),
1436
+ background_type_image : slide.find('.cs-slide-editing-area').css('background-image') == 'none' ? 'none' : slide.find('.cs-slide-editing-area').data('background-image-src') + "",
1437
+ background_type_color : background_type_color,
1438
+ background_type_color_input : content.find('input[name="cs-slide-background_type_color"]:checked').val(),
1439
+ background_propriety_position_x : content.find('.cs-slide-background_propriety_position_x').val(),
1440
+ background_propriety_position_y : content.find('.cs-slide-background_propriety_position_y').val(),
1441
+ background_repeat : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1442
+ background_propriety_size : content.find('.cs-slide-background_propriety_size').val(),
1443
+ data_in : content.find('.cs-slide-data_in').val(),
1444
+ data_out : content.find('.cs-slide-data_out').val(),
1445
+ data_time : parseInt(content.find('.cs-slide-data_time').val()),
1446
+ data_easeIn : parseInt(content.find('.cs-slide-data_easeIn').val()),
1447
+ data_easeOut : parseInt(content.find('.cs-slide-data_easeOut').val()),
1448
+ link : slide.find('.cs-background-link').val(),
1449
+ link_new_tab : slide.find('.cs-background-link_new_tab').prop('checked') ? 1 : 0,
1450
+ custom_css : content.find('.cs-slide-custom_css').val(),
1451
+ };
1452
+
1453
+ final_options['options'][i] = options;
1454
+
1455
+ i++;
1456
+ });
1457
+
1458
+ final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id')),
1459
+
1460
+ // Do the ajax call
1461
+ jQuery.ajax({
1462
+ type : 'POST',
1463
+ dataType : 'json',
1464
+ url : ajaxurl,
1465
+ data : {
1466
+ action: 'crellyslider_editSlides',
1467
+ datas : final_options,
1468
+ },
1469
+ success: function(response) {
1470
+ //console.log('Save slides response: ' + response);
1471
+ if(response !== false) {
1472
+ crellyslider_saveElements();
1473
+ }
1474
+ else {
1475
+ crellyslider_showError();
1476
+ }
1477
+ },
1478
+
1479
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1480
+ alert('Error saving slides');
1481
+ console.log(XMLHttpRequest.responseText);
1482
+ crellyslider_showError();
1483
+ }
1484
+ });
1485
+ }
1486
+
1487
+ // Sends an array with all the elements options of each slide
1488
+ function crellyslider_saveElements() {
1489
+ var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1490
+ var i = 0, j = 0;
1491
+ var final_options = {};
1492
+
1493
+ final_options['options'] = new Array();
1494
+ slides.each(function() {
1495
+ var slide = $(this);
1496
+ var elements = slide.find('.cs-elements .cs-element-settings');
1497
+
1498
+ elements.each(function() {
1499
+ var element = $(this);
1500
+
1501
+ // Stop each loop when reach the void element
1502
+ if(element.hasClass('cs-void-element-settings')) {
1503
+ return;
1504
+ }
1505
+
1506
+ // Get the type of the element
1507
+ var type;
1508
+ if(element.hasClass('cs-text-element-settings')) {
1509
+ type = 'text';
1510
+ }
1511
+ else if(element.hasClass('cs-image-element-settings')) {
1512
+ type = 'image';
1513
+ }
1514
+ else if(element.hasClass('cs-video-element-settings')) {
1515
+ if(element.find('.cs-element-video_src').val() == 'youtube') {
1516
+ type = 'youtube_video';
1517
+ }
1518
+ else {
1519
+ type = 'vimeo_video';
1520
+ }
1521
+ }
1522
+ else {
1523
+ type = 'undefined';
1524
+ }
1525
+
1526
+ var options = {
1527
+ slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1528
+ slide_parent : i,
1529
+ position : element.index(),
1530
+ type : type,
1531
+
1532
+ inner_html : element.hasClass('cs-text-element-settings') ? element.find('.cs-element-inner_html').val() : '',
1533
+ image_src : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('src') : '',
1534
+ image_alt : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('alt') : '',
1535
+ data_left : parseInt(element.find('.cs-element-data_left').val()),
1536
+ data_top : parseInt(element.find('.cs-element-data_top').val()),
1537
+ z_index : parseInt(element.find('.cs-element-z_index').val()),
1538
+ data_delay : parseInt(element.find('.cs-element-data_delay').val()),
1539
+ data_time : element.find('.cs-element-data_time').val(),
1540
+ data_in : element.find('.cs-element-data_in').val(),
1541
+ data_out : element.find('.cs-element-data_out').val(),
1542
+ data_ignoreEaseOut : element.find('.cs-element-data_ignoreEaseOut').prop('checked') ? 1 : 0,
1543
+ data_easeIn : parseInt(element.find('.cs-element-data_easeIn').val()),
1544
+ data_easeOut : parseInt(element.find('.cs-element-data_easeOut').val()),
1545
+ custom_css : element.find('.cs-element-custom_css').val(),
1546
+ custom_css_classes : element.find('.cs-element-custom_css_classes').val(),
1547
+ link : element.hasClass('cs-video-element-settings') ? '' : element.find('.cs-element-link').val(),
1548
+ link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1549
+ video_id : element.hasClass('cs-video-element-settings') ? element.find('.cs-element-video_id').val() : '',
1550
+ video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1551
+ video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1552
+ };
1553
+
1554
+ final_options['options'][j] = options;
1555
+
1556
+ j++;
1557
+ });
1558
+
1559
+ i++;
1560
+ });
1561
+
1562
+ // Proceed?
1563
+ final_options['elements'] = 1;
1564
+ if(final_options['options'].length == 0) {
1565
+ final_options['elements'] = 0;
1566
+ }
1567
+
1568
+ final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1569
+
1570
+ final_options['options'] = JSON.stringify(final_options['options']);
1571
+
1572
+ // Do the ajax call
1573
+ jQuery.ajax({
1574
+ type : 'POST',
1575
+ dataType : 'json',
1576
+ url : ajaxurl,
1577
+ data : {
1578
+ action: 'crellyslider_editElements',
1579
+ datas : final_options,
1580
+ },
1581
+ success: function(response) {
1582
+ //console.log(response);
1583
+ if(response !== false) {
1584
+ crellyslider_showSuccess();
1585
+ }
1586
+ else {
1587
+ crellyslider_showError();
1588
+ }
1589
+ },
1590
+
1591
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1592
+ alert('Error saving elements');
1593
+ console.log(XMLHttpRequest.responseText);
1594
+ crellyslider_showError();
1595
+ }
1596
+ });
1597
+ }
1598
+
1599
+ function crellyslider_deleteSlider(content) {
1600
+ // Get options
1601
+ var options = {
1602
+ id : parseInt(content.data('delete')),
1603
+ };
1604
+
1605
+ // Do the ajax call
1606
+ jQuery.ajax({
1607
+ type : 'POST',
1608
+ dataType : 'json',
1609
+ url : ajaxurl,
1610
+ data : {
1611
+ action: 'crellyslider_deleteSlider',
1612
+ datas : options,
1613
+ },
1614
+ success: function(response) {
1615
+ //alert('Delete slider response: ' + response);
1616
+ if(response !== false) {
1617
+ if($('.cs-sliders-list .cs-delete-slider').length > 1) {
1618
+ content.parent().parent().remove();
1619
+ }
1620
+ else {
1621
+ location.reload();
1622
+ }
1623
+ crellyslider_showSuccess();
1624
+ }
1625
+ else {
1626
+ crellyslider_showError();
1627
+ }
1628
+ },
1629
+
1630
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1631
+ alert('Error deleting slider');
1632
+ console.log(XMLHttpRequest.responseText);
1633
+ crellyslider_showError();
1634
+ },
1635
+ });
1636
+ }
1637
+
1638
+ function crellyslider_duplicateSlider(content) {
1639
+ // Get options
1640
+ var options = {
1641
+ id : parseInt(content.data('duplicate')),
1642
+ };
1643
+
1644
+ // Do the ajax call
1645
+ jQuery.ajax({
1646
+ type : 'POST',
1647
+ dataType : 'json',
1648
+ url : ajaxurl,
1649
+ data : {
1650
+ action: 'crellyslider_duplicateSlider',
1651
+ datas : options,
1652
+ },
1653
+ success: function(response) {
1654
+ //console.log(response);
1655
+ if(response['response'] !== false) {
1656
+ var cloned_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1657
+ cloned_slider.find('.cs-slider-id').html(response['cloned_slider_id']);
1658
+ cloned_slider.find('.cs-slider-name a').html(response['cloned_slider_name']);
1659
+ cloned_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1660
+ cloned_slider.find('.cs-slider-alias').html(response['cloned_slider_alias']);
1661
+ cloned_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['cloned_slider_alias'] + '"]');
1662
+ cloned_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['cloned_slider_id']);
1663
+ cloned_slider.find('.cs-duplicate-slider').data('duplicate', response['cloned_slider_id']);
1664
+ cloned_slider.find('.cs-delete-slider').data('delete', response['cloned_slider_id']);
1665
+ cloned_slider.find('.cs-export-slider').data('export', response['cloned_slider_id']);
1666
+
1667
+ crellyslider_showSuccess();
1668
+ }
1669
+ else {
1670
+ crellyslider_showError();
1671
+ }
1672
+ },
1673
+
1674
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1675
+ alert('Error duplicating slider');
1676
+ console.log(XMLHttpRequest.responseText);
1677
+ crellyslider_showError();
1678
+ },
1679
+ });
1680
+ }
1681
+
1682
+ function crellyslider_exportSlider(content) {
1683
+ // Get options
1684
+ var options = {
1685
+ id : parseInt(content.data('export')),
1686
+ };
1687
+
1688
+ // Do the ajax call
1689
+ jQuery.ajax({
1690
+ type : 'POST',
1691
+ dataType : 'json',
1692
+ url : ajaxurl,
1693
+ data : {
1694
+ action: 'crellyslider_exportSlider',
1695
+ datas : options,
1696
+ },
1697
+ success: function(response) {
1698
+ if(response['response'] !== false) {
1699
+ window.location.href = response['url'];
1700
+ crellyslider_showSuccess();
1701
+ }
1702
+ else {
1703
+ crellyslider_showError();
1704
+ }
1705
+ },
1706
+
1707
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1708
+ alert('Error while exporting the slider');
1709
+ console.log(XMLHttpRequest.responseText);
1710
+ crellyslider_showError();
1711
+ },
1712
+ });
1713
+ }
1714
+
1715
+ function crellyslider_importSlider() {
1716
+ var file = $('#cs-import-file')[0].files[0];
1717
+
1718
+ if(! file) {
1719
+ return;
1720
+ }
1721
+
1722
+ // Reset input file. Prevents conflicts
1723
+ $('#cs-import-file').val('');
1724
+
1725
+ // Form data (for file uploads)
1726
+ var fd = new FormData();
1727
+ fd.append('file', file);
1728
+ fd.append('action', 'crellyslider_importSlider');
1729
+
1730
+ // Do the ajax call
1731
+ jQuery.ajax({
1732
+ type : 'POST',
1733
+ url : ajaxurl,
1734
+ contentType: false,
1735
+ processData : false,
1736
+ data : fd,
1737
+ success: function(response) {
1738
+ response = JSON.parse(response);
1739
+ //console.log(response);
1740
+ if(response['response'] !== false) {
1741
+ var content = $('.cs-sliders-list .cs-duplicate-slider:eq(0)');
1742
+ if(content.length > 0) {
1743
+ var imported_slider = content.parent().parent().clone().appendTo(content.parent().parent().parent());
1744
+ imported_slider.find('.cs-slider-id').html(response['imported_slider_id']);
1745
+ imported_slider.find('.cs-slider-name a').html(response['imported_slider_name']);
1746
+ imported_slider.find('.cs-slider-name a').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1747
+ imported_slider.find('.cs-slider-alias').html(response['imported_slider_alias']);
1748
+ imported_slider.find('.cs-slider-shortcode').html('[crellyslider alias="' + response['imported_slider_alias'] + '"]');
1749
+ imported_slider.find('.cs-edit-slider').attr('href', '?page=crellyslider&view=edit&id=' + response['imported_slider_id']);
1750
+ imported_slider.find('.cs-duplicate-slider').data('duplicate', response['imported_slider_id']);
1751
+ imported_slider.find('.cs-delete-slider').data('delete', response['imported_slider_id']);
1752
+ imported_slider.find('.cs-delete-slider').data('export', response['imported_slider_id']);
1753
+ }
1754
+ else {
1755
+ location.reload();
1756
+ }
1757
+
1758
+ crellyslider_showSuccess();
1759
+ }
1760
+ else {
1761
+ crellyslider_showError();
1762
+ }
1763
+ },
1764
+
1765
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1766
+ alert('Error while importing the slider');
1767
+ console.log(XMLHttpRequest.responseText);
1768
+ crellyslider_showError();
1769
+ },
1770
+ });
1771
+ }
1772
+
1773
+ });
1774
+ })(jQuery);
wordpress/slider.php CHANGED
@@ -1,321 +1,321 @@
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 selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
273
- echo '<option selected value="0">' . __('Slide', 'crelly-slider') . ' 1</option>';
274
- }
275
- else {
276
- if($edit && $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
- }
282
- for($i = 0; $i < count($slides); $i++) {
283
- echo '<option value="' . $i . '"';
284
- if((!$edit && $i == 0) || ($edit && $slider->startFromSlide == $i)) {
285
- echo ' selected';
286
- }
287
- echo '>' . __('Slide', 'crelly-slider') . ' ' . ($i + 1) . '</option>';
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('Callbacks', 'crelly-slider'); ?></td>
299
- <td class="cs-content">
300
- <?php
301
- if(!$edit || ($edit && stripslashes($slider->callbacks) == '')) {
302
- // Sorry for this ugly indentation, ajax compatibility problems...
303
- ?>
304
- <textarea id="cs-slider-callbacks">
305
- beforeStart : function() {},
306
- beforeSetResponsive : function() {},
307
- beforeSlideStart : function() {},
308
- beforePause : function() {},
309
- beforeResume : function() {},</textarea>
310
- <?php
311
- }
312
- else echo '<textarea id="cs-slider-callbacks">' . stripslashes($slider->callbacks) . '</textarea>';
313
- ?>
314
- </td>
315
- <td class="cs-description">
316
- <?php _e('Some jQuery functions that you can fire during the slider execution.', 'crelly-slider'); ?>
317
- </td>
318
- </tr>
319
- </tbody>
320
- </table>
321
- </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 selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
273
+ echo '<option selected value="0">' . __('Slide', 'crelly-slider') . ' 1</option>';
274
+ }
275
+ else {
276
+ if($edit && $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
+ }
282
+ for($i = 0; $i < count($slides); $i++) {
283
+ echo '<option value="' . $i . '"';
284
+ if((!$edit && $i == 0) || ($edit && $slider->startFromSlide == $i)) {
285
+ echo ' selected';
286
+ }
287
+ echo '>' . __('Slide', 'crelly-slider') . ' ' . ($i + 1) . '</option>';
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('Callbacks', 'crelly-slider'); ?></td>
299
+ <td class="cs-content">
300
+ <?php
301
+ if(!$edit || ($edit && stripslashes($slider->callbacks) == '')) {
302
+ // Sorry for this ugly indentation, ajax compatibility problems...
303
+ ?>
304
+ <textarea id="cs-slider-callbacks">
305
+ beforeStart : function() {},
306
+ beforeSetResponsive : function() {},
307
+ beforeSlideStart : function() {},
308
+ beforePause : function() {},
309
+ beforeResume : function() {},</textarea>
310
+ <?php
311
+ }
312
+ else echo '<textarea id="cs-slider-callbacks">' . stripslashes($slider->callbacks) . '</textarea>';
313
+ ?>
314
+ </td>
315
+ <td class="cs-description">
316
+ <?php _e('Some jQuery functions that you can fire during the slider execution.', 'crelly-slider'); ?>
317
+ </td>
318
+ </tr>
319
+ </tbody>
320
+ </table>
321
+ </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']) ? esc_sql($_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']) ? esc_sql($_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,142 +1,142 @@
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
- }
21
-
22
- public static function setSlidersTable() {
23
- global $wpdb;
24
- $table_name = $wpdb->prefix . 'crellyslider_sliders';
25
-
26
- $sql = "CREATE TABLE $table_name (
27
- id mediumint(9) NOT NULL AUTO_INCREMENT,
28
- name TEXT CHARACTER SET utf8,
29
- alias TEXT CHARACTER SET utf8,
30
- layout TEXT CHARACTER SET utf8,
31
- responsive INT,
32
- startWidth INT,
33
- startHeight INT,
34
- automaticSlide INT,
35
- showControls INT,
36
- showNavigation INT,
37
- enableSwipe INT DEFAULT 1,
38
- showProgressBar INT,
39
- pauseOnHover INT,
40
- randomOrder INT DEFAULT 0,
41
- startFromSlide INT DEFAULT 0,
42
- callbacks TEXT CHARACTER SET utf8,
43
- UNIQUE KEY id (id)
44
- );";
45
-
46
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
47
- dbDelta($sql);
48
- }
49
-
50
- // Warning: the time variable is a string because it could contain the 'all' word
51
- public static function setSlidesTable() {
52
- global $wpdb;
53
- $table_name = $wpdb->prefix . 'crellyslider_slides';
54
-
55
- $sql = "CREATE TABLE $table_name (
56
- id mediumint(9) NOT NULL AUTO_INCREMENT,
57
- slider_parent mediumint(9),
58
- position INT,
59
- draft INT DEFAULT 0,
60
- background_type_image TEXT CHARACTER SET utf8,
61
- background_type_color TEXT CHARACTER SET utf8,
62
- background_type_color_input INT DEFAULT -1,
63
- background_propriety_position_x TEXT CHARACTER SET utf8,
64
- background_propriety_position_y TEXT CHARACTER SET utf8,
65
- background_repeat TEXT CHARACTER SET utf8,
66
- background_propriety_size TEXT CHARACTER SET utf8,
67
- data_in TEXT CHARACTER SET utf8,
68
- data_out TEXT CHARACTER SET utf8,
69
- data_time INT,
70
- data_easeIn INT,
71
- data_easeOut INT,
72
- link TEXT CHARACTER SET utf8,
73
- link_new_tab INT DEFAULT 0,
74
- custom_css TEXT CHARACTER SET utf8,
75
- UNIQUE KEY id (id)
76
- );";
77
-
78
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
79
- dbDelta($sql);
80
- }
81
-
82
- public static function setElementsTable() {
83
- global $wpdb;
84
- $table_name = $wpdb->prefix . 'crellyslider_elements';
85
-
86
- $sql = "CREATE TABLE $table_name (
87
- id mediumint(9) NOT NULL AUTO_INCREMENT,
88
- slider_parent mediumint(9),
89
- slide_parent mediumint(9),
90
- position INT,
91
- type TEXT CHARACTER SET utf8,
92
- data_easeIn INT,
93
- data_easeOut INT,
94
- data_ignoreEaseOut INT DEFAULT 0,
95
- data_delay INT,
96
- data_time TEXT CHARACTER SET utf8,
97
- data_top FLOAT,
98
- data_left FLOAT,
99
- z_index INT,
100
- data_in TEXT CHARACTER SET utf8,
101
- data_out TEXT CHARACTER SET utf8,
102
- custom_css TEXT CHARACTER SET utf8,
103
- custom_css_classes TEXT CHARACTER SET utf8,
104
- inner_html TEXT CHARACTER SET utf8,
105
- image_src TEXT CHARACTER SET utf8,
106
- image_alt TEXT CHARACTER SET utf8,
107
- link TEXT CHARACTER SET utf8,
108
- link_new_tab INT DEFAULT 0,
109
- video_id TEXT CHARACTER SET utf8,
110
- video_loop INT,
111
- video_autoplay INT,
112
- UNIQUE KEY id (id)
113
- );";
114
-
115
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
116
- dbDelta($sql);
117
- }
118
-
119
- // Drops all the slider tables
120
- public static function dropTables() {
121
- global $wpdb;
122
-
123
- self::dropTable($wpdb->prefix . 'crellyslider_sliders');
124
- self::dropTable($wpdb->prefix . 'crellyslider_slides');
125
- self::dropTable($wpdb->prefix . 'crellyslider_elements');
126
- }
127
-
128
- public static function dropTable($table_name) {
129
- global $wpdb;
130
-
131
- $sql = 'DROP TABLE ' . $table_name . ';';
132
- $wpdb->query($sql);
133
- }
134
-
135
- // Removes everything related to Crelly Slider from the database
136
- public static function clearDatabase() {
137
- self::dropTables();
138
- self::removeVersion();
139
- }
140
- }
141
-
142
- ?>
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
+ }
21
+
22
+ public static function setSlidersTable() {
23
+ global $wpdb;
24
+ $table_name = $wpdb->prefix . 'crellyslider_sliders';
25
+
26
+ $sql = "CREATE TABLE $table_name (
27
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
28
+ name TEXT CHARACTER SET utf8,
29
+ alias TEXT CHARACTER SET utf8,
30
+ layout TEXT CHARACTER SET utf8,
31
+ responsive INT,
32
+ startWidth INT,
33
+ startHeight INT,
34
+ automaticSlide INT,
35
+ showControls INT,
36
+ showNavigation INT,
37
+ enableSwipe INT DEFAULT 1,
38
+ showProgressBar INT,
39
+ pauseOnHover INT,
40
+ randomOrder INT DEFAULT 0,
41
+ startFromSlide INT DEFAULT 0,
42
+ callbacks TEXT CHARACTER SET utf8,
43
+ UNIQUE KEY id (id)
44
+ );";
45
+
46
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
47
+ dbDelta($sql);
48
+ }
49
+
50
+ // Warning: the time variable is a string because it could contain the 'all' word
51
+ public static function setSlidesTable() {
52
+ global $wpdb;
53
+ $table_name = $wpdb->prefix . 'crellyslider_slides';
54
+
55
+ $sql = "CREATE TABLE $table_name (
56
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
57
+ slider_parent mediumint(9),
58
+ position INT,
59
+ draft INT DEFAULT 0,
60
+ background_type_image TEXT CHARACTER SET utf8,
61
+ background_type_color TEXT CHARACTER SET utf8,
62
+ background_type_color_input INT DEFAULT -1,
63
+ background_propriety_position_x TEXT CHARACTER SET utf8,
64
+ background_propriety_position_y TEXT CHARACTER SET utf8,
65
+ background_repeat TEXT CHARACTER SET utf8,
66
+ background_propriety_size TEXT CHARACTER SET utf8,
67
+ data_in TEXT CHARACTER SET utf8,
68
+ data_out TEXT CHARACTER SET utf8,
69
+ data_time INT,
70
+ data_easeIn INT,
71
+ data_easeOut INT,
72
+ link TEXT CHARACTER SET utf8,
73
+ link_new_tab INT DEFAULT 0,
74
+ custom_css TEXT CHARACTER SET utf8,
75
+ UNIQUE KEY id (id)
76
+ );";
77
+
78
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
79
+ dbDelta($sql);
80
+ }
81
+
82
+ public static function setElementsTable() {
83
+ global $wpdb;
84
+ $table_name = $wpdb->prefix . 'crellyslider_elements';
85
+
86
+ $sql = "CREATE TABLE $table_name (
87
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
88
+ slider_parent mediumint(9),
89
+ slide_parent mediumint(9),
90
+ position INT,
91
+ type TEXT CHARACTER SET utf8,
92
+ data_easeIn INT,
93
+ data_easeOut INT,
94
+ data_ignoreEaseOut INT DEFAULT 0,
95
+ data_delay INT,
96
+ data_time TEXT CHARACTER SET utf8,
97
+ data_top FLOAT,
98
+ data_left FLOAT,
99
+ z_index INT,
100
+ data_in TEXT CHARACTER SET utf8,
101
+ data_out TEXT CHARACTER SET utf8,
102
+ custom_css TEXT CHARACTER SET utf8,
103
+ custom_css_classes TEXT CHARACTER SET utf8,
104
+ inner_html TEXT CHARACTER SET utf8,
105
+ image_src TEXT CHARACTER SET utf8,
106
+ image_alt TEXT CHARACTER SET utf8,
107
+ link TEXT CHARACTER SET utf8,
108
+ link_new_tab INT DEFAULT 0,
109
+ video_id TEXT CHARACTER SET utf8,
110
+ video_loop INT,
111
+ video_autoplay INT,
112
+ UNIQUE KEY id (id)
113
+ );";
114
+
115
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
116
+ dbDelta($sql);
117
+ }
118
+
119
+ // Drops all the slider tables
120
+ public static function dropTables() {
121
+ global $wpdb;
122
+
123
+ self::dropTable($wpdb->prefix . 'crellyslider_sliders');
124
+ self::dropTable($wpdb->prefix . 'crellyslider_slides');
125
+ self::dropTable($wpdb->prefix . 'crellyslider_elements');
126
+ }
127
+
128
+ public static function dropTable($table_name) {
129
+ global $wpdb;
130
+
131
+ $sql = 'DROP TABLE ' . $table_name . ';';
132
+ $wpdb->query($sql);
133
+ }
134
+
135
+ // Removes everything related to Crelly Slider from the database
136
+ public static function clearDatabase() {
137
+ self::dropTables();
138
+ self::removeVersion();
139
+ }
140
+ }
141
+
142
+ ?>
wordpress/temp/silence.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
  <?php // If you can read this, you probably have never used the Import/Export function ?>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
  <?php // If you can read this, you probably have never used the Import/Export function ?>