Crelly Slider - Version 0.6.9

Version Description

  • Added the possibility to insert links in images and texts
  • Added slider preloader (with a gif image)
  • Added icon in the style of WordPress to the lateral sidebar in the admin panel
  • Added confirm alert when you delete a slider
  • Fixed: now HTML codes inserted in text elements are working properly
  • Fixed: when you selected an element into the editing area weren't shown the correct element options
  • Fixed invisible progress bar in Internet Explorer 8
  • Fixed invisible slider navigation in Internet Explorer 8
  • Changed: text output is now wrapped by a "div" and not a "p" for a better compatibility and a cleaner code
  • Changed name to the "add image" button in the element options
  • Other minor bug fixes and changes
Download this release

Release Info

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

Code changes from version 0.6.8 to 0.6.9

crellyslider.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Crelly Slider
5
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
6
  * Description: The first free WordPress slider with elements animations.
7
- * Version: 0.6.8
8
  * Author: fabiorino
9
  * Author URI: http://fabiorino1.altervista.org
10
  * License: GPL2
@@ -14,7 +14,7 @@
14
  /** GLOBALS **/
15
  /*************/
16
 
17
- define('CS_VERSION', '0.6.8');
18
  define('CS_PATH', plugin_dir_path(__FILE__));
19
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
20
 
@@ -31,6 +31,15 @@ register_uninstall_hook(__FILE__, array('CrellySliderTables', 'dropTables'));
31
  // Languages
32
  load_plugin_textdomain('crellyslider', false, basename(dirname(__FILE__)) . 'wordpress/languages');
33
 
 
 
 
 
 
 
 
 
 
34
  /****************/
35
  /** COMMON CODE**/
36
  /****************/
@@ -44,9 +53,7 @@ CrellySliderFrontend::addShortcode();
44
  /* BACKEND CODE */
45
  /****************/
46
 
47
- if(is_admin()) {
48
- require_once CS_PATH . 'wordpress/admin.php';
49
-
50
  // Tables
51
  if(CS_VERSION != get_option('cs_version')) {
52
  CrellySliderTables::setVersion();
4
  * Plugin Name: Crelly Slider
5
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
6
  * Description: The first free WordPress slider with elements animations.
7
+ * Version: 0.6.9
8
  * Author: fabiorino
9
  * Author URI: http://fabiorino1.altervista.org
10
  * License: GPL2
14
  /** GLOBALS **/
15
  /*************/
16
 
17
+ define('CS_VERSION', '0.6.9');
18
  define('CS_PATH', plugin_dir_path(__FILE__));
19
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
20
 
31
  // Languages
32
  load_plugin_textdomain('crellyslider', false, basename(dirname(__FILE__)) . 'wordpress/languages');
33
 
34
+ // This is a variable that should be included first to prevent backend issues.
35
+ if(is_admin()) {
36
+ require_once CS_PATH . 'wordpress/admin.php';
37
+ CrellySliderAdmin::setIsAdminJs();
38
+ }
39
+ else {
40
+ CrellySliderFrontend::setNotAdminJs();
41
+ }
42
+
43
  /****************/
44
  /** COMMON CODE**/
45
  /****************/
53
  /* BACKEND CODE */
54
  /****************/
55
 
56
+ if(is_admin()) {
 
 
57
  // Tables
58
  if(CS_VERSION != get_option('cs_version')) {
59
  CrellySliderTables::setVersion();
css/crellyslider.css CHANGED
@@ -1,7 +1,6 @@
1
  .crellyslider {
2
  margin: 0 auto;
3
  position: relative;
4
- background-color: #f8f8f8;
5
  white-space: nowrap;
6
  overflow: hidden;
7
  }
@@ -10,17 +9,18 @@
10
  width: 100%;
11
  height: 100%;
12
  z-index: 999;
 
13
  }
14
 
15
  .crellyslider > .cs-preloader > .cs-loader {
16
- width: 20px;
17
- height: 20px;
18
  position: absolute;
19
  top: 50%;
20
  left: 50%;
21
- margin-top: -10px;
22
- margin-left: -10px;
23
- border: solid 2px #fff;
24
  }
25
 
26
  .crellyslider > .cs-controls,
@@ -28,11 +28,13 @@
28
  z-index: 999;
29
  -webkit-transition: all 0.2s;
30
  opacity: 0;
 
31
  }
32
 
33
  .crellyslider:hover > .cs-controls,
34
  .crellyslider:hover > .cs-navigation {
35
  opacity: 1;
 
36
  }
37
 
38
  .crellyslider > .cs-slides {
@@ -48,17 +50,29 @@
48
  overflow: hidden;
49
  }
50
 
51
- .crellyslider > .cs-slides > .cs-slide > * {
 
52
  margin: 0;
53
  padding: 0;
 
 
 
54
  position: absolute;
55
- display: block;
56
  }
57
 
58
  .crellyslider > .cs-slides > .cs-slide > img {
59
  max-width: none !important;
60
  }
61
 
 
 
 
 
 
 
 
 
 
62
  .crellyslider > .cs-controls {
63
  position: absolute;
64
  width: 100%;
@@ -100,13 +114,12 @@
100
  height: 7px;
101
  margin: 5px;
102
  cursor: pointer;
103
- border: solid 1px rgba(20, 20, 20, .5);
104
- background-color: rgba(20, 20, 20, .5);
105
  }
106
 
107
  .crellyslider > .cs-navigation > .cs-slide-link.cs-active {
108
- border: solid 1px #fff;
109
- background-color: rgba(255, 255, 255, .5);
110
  }
111
 
112
  .crellyslider > .cs-progress-bar {
@@ -114,19 +127,13 @@
114
  height: 4px;
115
  position: absolute;
116
  top: 0;
117
- background-color: rgba(255, 255, 255, .5);
 
 
118
  z-index: 999;
119
  }
120
 
121
  .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
122
  opacity: 0;
123
  filter: alpha(opacity=0);
124
- }
125
-
126
- .cs-caption {
127
- background-color: #333;
128
- color: white;
129
- font-weight: bold;
130
- padding: 10px 20px;
131
- border-radius: 3px;
132
  }
1
  .crellyslider {
2
  margin: 0 auto;
3
  position: relative;
 
4
  white-space: nowrap;
5
  overflow: hidden;
6
  }
9
  width: 100%;
10
  height: 100%;
11
  z-index: 999;
12
+ background-color: #ddd;
13
  }
14
 
15
  .crellyslider > .cs-preloader > .cs-loader {
16
+ width: 25px;
17
+ height: 25px;
18
  position: absolute;
19
  top: 50%;
20
  left: 50%;
21
+ margin-top: -12.5px;
22
+ margin-left: -12.5px;
23
+ background-image: url('../images/preloader.gif');
24
  }
25
 
26
  .crellyslider > .cs-controls,
28
  z-index: 999;
29
  -webkit-transition: all 0.2s;
30
  opacity: 0;
31
+ filter: alpha(opacity=0);
32
  }
33
 
34
  .crellyslider:hover > .cs-controls,
35
  .crellyslider:hover > .cs-navigation {
36
  opacity: 1;
37
+ filter: alpha(opacity=100);
38
  }
39
 
40
  .crellyslider > .cs-slides {
50
  overflow: hidden;
51
  }
52
 
53
+ .crellyslider > .cs-slides > .cs-slide * {
54
+ display: block;
55
  margin: 0;
56
  padding: 0;
57
+ }
58
+
59
+ .crellyslider > .cs-slides > .cs-slide > * {
60
  position: absolute;
 
61
  }
62
 
63
  .crellyslider > .cs-slides > .cs-slide > img {
64
  max-width: none !important;
65
  }
66
 
67
+ .crellyslider > .cs-slides > .cs-slide a {
68
+ text-decoration: none;
69
+ }
70
+
71
+ .crellyslider > .cs-slides > .cs-slide > a img {
72
+ max-width: 100% !important;
73
+ height: auto;
74
+ }
75
+
76
  .crellyslider > .cs-controls {
77
  position: absolute;
78
  width: 100%;
114
  height: 7px;
115
  margin: 5px;
116
  cursor: pointer;
117
+ background-image: url('../images/navigation-links.png');
118
+ background-position: 0 0;
119
  }
120
 
121
  .crellyslider > .cs-navigation > .cs-slide-link.cs-active {
122
+ background-position: -7px 0;
 
123
  }
124
 
125
  .crellyslider > .cs-progress-bar {
127
  height: 4px;
128
  position: absolute;
129
  top: 0;
130
+ background-color: #fff;
131
+ opacity: .5;
132
+ filter: alpha(opacity=50);
133
  z-index: 999;
134
  }
135
 
136
  .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
137
  opacity: 0;
138
  filter: alpha(opacity=0);
 
 
 
 
 
 
 
 
139
  }
demo/demo.html CHANGED
@@ -46,8 +46,12 @@
46
  <li style="background: url('images/bg1.png'); background-size: cover;" data-in="fade" data-out="slideLeft">
47
  <p style="font-size: 48px; color: #fff; font-family: 'Rokkitt', serif;" data-top="190" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="800" data-time="all">Crelly Slider</p>
48
  <p 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="300" data-ease-out="200" data-delay="1100" data-time="all">Is the first FREE Wordpress slider<br />with layers animations!</p>
49
- <img alt="" src="images/house.png" data-top="149" data-left="837" data-in="slideLeft" data-out="slideRight" data-ease-in="200" data-ease-out="200" data-delay="400" data-time="all" />
50
- <img alt="" src="images/hill.png" data-top="254" data-left="0" data-in="slideUp" data-out="slideDown" data-ease-in="200" data-ease-out="200" data-delay="0" data-time="all" />
 
 
 
 
51
  <img alt="" src="images/airplane.png" data-top="44" data-left="1170" data-in="slideRight" data-out="slideUp" data-ease-in="10800" data-ease-out="200" data-delay="0" data-time="all" />
52
  </li>
53
  <li style="background: url('images/bg2.png');" data-in="slideLeft" data-out="slideLeft" data-time="5000">
46
  <li style="background: url('images/bg1.png'); background-size: cover;" data-in="fade" data-out="slideLeft">
47
  <p style="font-size: 48px; color: #fff; font-family: 'Rokkitt', serif;" data-top="190" data-left="60" data-in="slideRight" data-out="slideLeft" data-ease-in="300" data-ease-out="200" data-delay="800" data-time="all">Crelly Slider</p>
48
  <p 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="300" data-ease-out="200" data-delay="1100" data-time="all">Is the first FREE Wordpress slider<br />with layers animations!</p>
49
+ <a data-top="149" data-left="837" data-in="slideLeft" data-out="slideRight" data-ease-in="200" data-ease-out="200" data-delay="400" data-time="all" href="http://www.google.it" target="_blank">
50
+ <img alt="" src="images/house.png" />
51
+ </a>
52
+ <a data-top="254" data-left="0" data-in="slideUp" data-out="slideDown" data-ease-in="200" data-ease-out="200" data-delay="0" data-time="all" href="http://www.google.it" target="_blank">
53
+ <img alt="" src="images/hill.png" />
54
+ </a>
55
  <img alt="" src="images/airplane.png" data-top="44" data-left="1170" data-in="slideRight" data-out="slideUp" data-ease-in="10800" data-ease-out="200" data-delay="0" data-time="all" />
56
  </li>
57
  <li style="background: url('images/bg2.png');" data-in="slideLeft" data-out="slideLeft" data-time="5000">
images/navigation-links.png ADDED
Binary file
images/preloader.gif ADDED
Binary file
js/jquery.crellyslider.js CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
- * Version: 0.6.8
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
@@ -35,7 +35,7 @@
35
  var slide_progress = 0;
36
 
37
  var scale = 1;
38
- var window_width_before_setResponsive = 0; // This variable is useful ONLY to prevent that window.resize fires on vertical resizing
39
 
40
  /********************/
41
  /** INITIALIZATION **/
@@ -89,89 +89,61 @@
89
  SLIDER.find(CRELLY).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>');
90
  }
91
 
92
- // Previous control click
93
- SLIDER.find(CRELLY).find('.cs-controls > .cs-previous').click(function() {
94
- paused = false;
95
- changeSlide(getPreviousSlide());
96
- });
97
-
98
- // Next Control click
99
- SLIDER.find(CRELLY).find('.cs-controls > .cs-next').click(function() {
100
- paused = false;
101
- changeSlide(getNextSlide());
102
- });
103
-
104
- // Navigation link click
105
- SLIDER.find(CRELLY).find('.cs-navigation > .cs-slide-link').click(function() {
106
- if($(this).index() != current_slide) {
107
- paused = false;
108
- changeSlide($(this).index());
109
- }
110
- });
111
-
112
- // Pause on hover
113
- if(settings.pauseOnHover) {
114
- SLIDER.find(CRELLY).find(SLIDES).hover(function() {
115
- pause();
116
- });
117
-
118
- SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
119
- resume();
120
- });
121
- }
122
-
123
- // Make responsive. Run if resizing horizontally and the slider is not at the right dimension
124
- if(settings.responsive) {
125
- $(window).resize(function() {
126
- if(window_width_before_setResponsive != $(window).width() && ((settings.layout == 'full-width' && getWidth() != $(SLIDER).width()) || ($(SLIDER).width() < getWidth() || (($(SLIDER).width() > getWidth()) && getWidth() < settings.startWidth)))) {
127
- setResponsive();
128
- }
129
- });
130
- }
131
-
132
- // Set layout
133
  setLayout();
134
 
135
- // Set preloader
136
  setPreloader();
137
 
138
- if(document.readyState != 'complete') {
139
- $(window).load(function() {
140
- loadedWindow();
141
- });
142
  }
143
  else {
144
  loadedWindow();
145
  }
146
  }
147
 
 
 
 
 
 
 
 
148
  // Do operations after window.load is complete. Need to do it as a function for back-end compatibility
149
  function loadedWindow() {
150
- // Hide preloader
151
  unsetPreloader();
152
 
 
 
 
 
 
 
153
  window_width_before_setResponsive = $(window).width();
154
 
155
- // Store original elements values then hide all the slides and elements
156
  SLIDER.find(CRELLY).find(SLIDES).find(SLIDE).each(function(){
157
  $(this).find(ELEMENTS).each(function() {
158
  var element = $(this);
159
- element.data('width', parseFloat(element.width()));
160
- element.data('height', parseFloat(element.height()));
161
- element.data('line-height', parseFloat(element.css('line-height')));
162
- element.data('letter-spacing', parseFloat(element.css('letter-spacing')));
163
- element.data('font-size', parseFloat(element.css('font-size')));
164
- element.data('padding-top', parseFloat(element.css('padding-top')));
165
- element.data('padding-right', parseFloat(element.css('padding-right')));
166
- element.data('padding-bottom', parseFloat(element.css('padding-bottom')));
167
- element.data('padding-left', parseFloat(element.css('padding-left')));
168
- element.css('display', 'none');
169
  });
170
  $(this).css({
171
  'display' : 'none',
172
  });
173
  });
174
 
 
 
175
  settings.beforeStart();
176
 
177
  // Positions and responsive dimensions then run.
@@ -183,6 +155,65 @@
183
  }
184
  }
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  // Preloader functions
187
  function setPreloader() {
188
  SLIDER.find(CRELLY).find(SLIDES).css('display', 'none');
@@ -276,34 +307,12 @@
276
  elements.each(function() {
277
  var element = $(this);
278
 
279
- // Standard element
280
- element.css({
281
- 'width' : getScaled(getItemData(element, 'width')),
282
- 'height' : getScaled(getItemData(element, 'height')),
283
- 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top),
284
- 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left),
285
- 'padding-top' : getScaled(getItemData(element, 'padding-top')),
286
- 'padding-right' : getScaled(getItemData(element, 'padding-right')),
287
- 'padding-bottom' : getScaled(getItemData(element, 'padding-bottom')),
288
- 'padding-left' : getScaled(getItemData(element, 'padding-left')),
289
  });
290
 
291
- // Element contains text
292
- if(element.text() != '') {
293
- element.css({
294
- 'width' : 'auto',
295
- 'height' : 'auto',
296
- 'line-height' : getScaled(getItemData(element, 'line-height')) + 'px',
297
- 'letter-spacing' : getScaled(getItemData(element, 'letter-spacing')),
298
- 'font-size' : getScaled(getItemData(element, 'font-size')),
299
- });
300
- if(element.width() > 0) {
301
- element.css('width', element.width());
302
- }
303
- if(element.height() > 0) {
304
- element.css('height', element.height());
305
- }
306
- }
307
  });
308
  });
309
 
@@ -314,12 +323,54 @@
314
  play();
315
  }
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  // Using the start dimensions, sets how the slider and it's elements should be scaled
318
  function setScale() {
319
  var slider_width = SLIDER.width();
320
  var start_width = settings.startWidth;
321
 
322
- if(slider_width >= start_width) {
323
  scale = 1;
324
  }
325
  else {
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
+ * Version: 0.6.9
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
35
  var slide_progress = 0;
36
 
37
  var scale = 1;
38
+ 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
39
 
40
  /********************/
41
  /** INITIALIZATION **/
89
  SLIDER.find(CRELLY).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>');
90
  }
91
 
92
+ // Set layout for the first time
93
+ if(settings.responsive) {
94
+ setScale();
95
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  setLayout();
97
 
 
98
  setPreloader();
99
 
100
+ // In WP window.load does not fire. Need to add that variable
101
+ if(! crellyslider_is_wordpress_admin || typeof crellyslider_is_wordpress_admin == 'undefined') {
102
+ loadWindow();
 
103
  }
104
  else {
105
  loadedWindow();
106
  }
107
  }
108
 
109
+ // Wait until the window loads
110
+ function loadWindow() {
111
+ $(window).load(function() {
112
+ loadedWindow();
113
+ });
114
+ }
115
+
116
  // Do operations after window.load is complete. Need to do it as a function for back-end compatibility
117
  function loadedWindow() {
 
118
  unsetPreloader();
119
 
120
+ // Set layout for the second time
121
+ if(settings.responsive) {
122
+ setScale();
123
+ }
124
+ setLayout();
125
+
126
  window_width_before_setResponsive = $(window).width();
127
 
128
+ // Store original elements and elements contents values then hide all the slides and elements. Display none only if is an element, not an element content
129
  SLIDER.find(CRELLY).find(SLIDES).find(SLIDE).each(function(){
130
  $(this).find(ELEMENTS).each(function() {
131
  var element = $(this);
132
+
133
+ element.find('*').each(function() {
134
+ var element_content = $(this);
135
+ setElementDatas(element_content, true);
136
+ });
137
+
138
+ setElementDatas(element, false);
 
 
 
139
  });
140
  $(this).css({
141
  'display' : 'none',
142
  });
143
  });
144
 
145
+ addListeners();
146
+
147
  settings.beforeStart();
148
 
149
  // Positions and responsive dimensions then run.
155
  }
156
  }
157
 
158
+ // Init the element with original values
159
+ function setElementDatas(element, is_element_content) {
160
+ element.data('width', parseFloat(element.width()));
161
+ element.data('height', parseFloat(element.height()));
162
+ element.data('line-height', parseFloat(element.css('line-height')));
163
+ element.data('letter-spacing', parseFloat(element.css('letter-spacing')));
164
+ element.data('font-size', parseFloat(element.css('font-size')));
165
+ element.data('padding-top', parseFloat(element.css('padding-top')));
166
+ element.data('padding-right', parseFloat(element.css('padding-right')));
167
+ element.data('padding-bottom', parseFloat(element.css('padding-bottom')));
168
+ element.data('padding-left', parseFloat(element.css('padding-left')));
169
+ if(! is_element_content) {
170
+ element.css('display', 'none');
171
+ }
172
+ }
173
+
174
+ // Sets all listeners for user interaction
175
+ function addListeners() {
176
+ // Make responsive. Run if resizing horizontally and the slider is not at the right dimension
177
+ if(settings.responsive) {
178
+ $(window).resize(function() {
179
+ if(window_width_before_setResponsive != $(window).width() && ((settings.layout == 'full-width' && getWidth() != $(SLIDER).width()) || ($(SLIDER).width() < getWidth() || (($(SLIDER).width() > getWidth()) && getWidth() < settings.startWidth)))) {
180
+ setResponsive();
181
+ }
182
+ });
183
+ }
184
+
185
+ // Previous control click
186
+ SLIDER.find(CRELLY).find('.cs-controls > .cs-previous').click(function() {
187
+ paused = false;
188
+ changeSlide(getPreviousSlide());
189
+ });
190
+
191
+ // Next Control click
192
+ SLIDER.find(CRELLY).find('.cs-controls > .cs-next').click(function() {
193
+ paused = false;
194
+ changeSlide(getNextSlide());
195
+ });
196
+
197
+ // Navigation link click
198
+ SLIDER.find(CRELLY).find('.cs-navigation > .cs-slide-link').click(function() {
199
+ if($(this).index() != current_slide) {
200
+ paused = false;
201
+ changeSlide($(this).index());
202
+ }
203
+ });
204
+
205
+ // Pause on hover
206
+ if(settings.pauseOnHover) {
207
+ SLIDER.find(CRELLY).find(SLIDES).hover(function() {
208
+ pause();
209
+ });
210
+
211
+ SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
212
+ resume();
213
+ });
214
+ }
215
+ }
216
+
217
  // Preloader functions
218
  function setPreloader() {
219
  SLIDER.find(CRELLY).find(SLIDES).css('display', 'none');
307
  elements.each(function() {
308
  var element = $(this);
309
 
310
+ element.find('*').each(function() {
311
+ var element_content = $(this);
312
+ scaleElement(element_content);
 
 
 
 
 
 
 
313
  });
314
 
315
+ scaleElement(element);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  });
317
  });
318
 
323
  play();
324
  }
325
 
326
+ // Scales a text or an image
327
+ function scaleElement(element) {
328
+ // Standard element
329
+ element.css({
330
+ 'width' : getScaled(getItemData(element, 'width')),
331
+ 'height' : getScaled(getItemData(element, 'height')),
332
+ 'top' : getScaled(getItemData(element, 'top') + getLayoutGaps(element).top),
333
+ 'left' : getScaled(getItemData(element, 'left') + getLayoutGaps(element).left),
334
+ 'padding-top' : getScaled(getItemData(element, 'padding-top')),
335
+ 'padding-right' : getScaled(getItemData(element, 'padding-right')),
336
+ 'padding-bottom' : getScaled(getItemData(element, 'padding-bottom')),
337
+ 'padding-left' : getScaled(getItemData(element, 'padding-left')),
338
+ });
339
+
340
+ // Element contains text
341
+ if(element.text() != '') {
342
+ element.css({
343
+ 'width' : 'auto',
344
+ 'height' : 'auto',
345
+ 'line-height' : getScaled(getItemData(element, 'line-height')) + 'px',
346
+ 'letter-spacing' : getScaled(getItemData(element, 'letter-spacing')),
347
+ 'font-size' : getScaled(getItemData(element, 'font-size')),
348
+ });
349
+
350
+ /*
351
+ Warning: these lines were here because, in text elements, the width and the height depends on font-size, line height etc..
352
+ Because of that, the we didn't really have to set the width and the height manually because the browser calculated them based on font-size, line-height etc.
353
+ But, because I hate to see "width: auto", I wanted to set them.
354
+ The problem appears when we have other HTML inside the text layer. It is scaled correctly but the width and the height aren't.
355
+ This is not a big problem because, without specifying the dimensions, the slider works with "auto" parameter (wich is correct).
356
+ If, in a future, I will have to specify a width and a height, I will have to try to fix the width() jQuery function that returns 0 when the element is in "display: none"
357
+
358
+ if(element.width() > 0) {
359
+ element.css('width', element.width());
360
+ }
361
+ if(element.height() > 0) {
362
+ element.css('height', element.height());
363
+ }
364
+ */
365
+ }
366
+ }
367
+
368
  // Using the start dimensions, sets how the slider and it's elements should be scaled
369
  function setScale() {
370
  var slider_width = SLIDER.width();
371
  var start_width = settings.startWidth;
372
 
373
+ if(slider_width >= start_width || ! settings.responsive) {
374
  scale = 1;
375
  }
376
  else {
js/jquery.crellyslider.min.js CHANGED
@@ -2,10 +2,10 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
- * Version: 0.6.8
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
9
  */
10
 
11
- (function(e){var t=function(t,n){function m(){r.wrapInner('<div class="crellyslider" />');r.find(i+" > ul").addClass("cs-slides");r.find(i+" "+s+" > li").addClass("cs-slide");a=e(r).find(i).find(s).find(o).length;if(a==0){return false}if(a==1){var t=r.find(i).find(s).find(o+":eq(0)");var u=r.find(i).find(s);t.clone().prependTo(u);a++}if(n.showControls){r.find(i).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>')}if(n.showNavigation){var c='<div class="cs-navigation">';for(var h=0;h<a;h++){c+='<span class="cs-slide-link"></span>'}c+="</div>";r.find(i).append(c)}if(n.showProgressBar){r.find(i).append('<div class="cs-progress-bar"></div>')}else{r.find(i).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>')}r.find(i).find(".cs-controls > .cs-previous").click(function(){l=false;q(_())});r.find(i).find(".cs-controls > .cs-next").click(function(){l=false;q(M())});r.find(i).find(".cs-navigation > .cs-slide-link").click(function(){if(e(this).index()!=f){l=false;q(e(this).index())}});if(n.pauseOnHover){r.find(i).find(s).hover(function(){k()});r.find(i).find(s).mouseleave(function(){L()})}if(n.responsive){e(window).resize(function(){if(v!=e(window).width()&&(n.layout=="full-width"&&A()!=e(r).width()||e(r).width()<A()||e(r).width()>A()&&A()<n.startWidth)){S()}})}w();y();if(document.readyState!="complete"){e(window).load(function(){g()})}else{g()}}function g(){b();v=e(window).width();r.find(i).find(s).find(o).each(function(){e(this).find(u).each(function(){var t=e(this);t.data("width",parseFloat(t.width()));t.data("height",parseFloat(t.height()));t.data("line-height",parseFloat(t.css("line-height")));t.data("letter-spacing",parseFloat(t.css("letter-spacing")));t.data("font-size",parseFloat(t.css("font-size")));t.data("padding-top",parseFloat(t.css("padding-top")));t.data("padding-right",parseFloat(t.css("padding-right")));t.data("padding-bottom",parseFloat(t.css("padding-bottom")));t.data("padding-left",parseFloat(t.css("padding-left")));t.css("display","none")});e(this).css({display:"none"})});n.beforeStart();if(n.responsive){S()}else{N()}}function y(){r.find(i).find(s).css("display","none");r.find(i).find(".cs-progress-bar").css("display","none");r.find(i).find(".cs-navigation").css("display","none");r.find(i).find(".cs-controls").css("display","none");r.find(i).append('<div class="cs-preloader"><div class="cs-loader"></div></div>')}function b(){r.find(i).find(s).css("display","block");r.find(i).find(".cs-progress-bar").css("display","block");r.find(i).find(".cs-navigation").css("display","block");r.find(i).find(".cs-controls").css("display","block");r.find(i).find(".cs-preloader").remove()}function w(){var e=n.layout;var t,u;switch(e){case"fixed":t=n.startWidth;u=n.startHeight;r.find(i).css({width:T(t),height:T(u)});r.find(i).find(s).find(o).css({width:T(t),height:T(u)});break;case"full-width":t=r.width();u=n.startHeight;r.find(i).css({width:t,height:T(u)});r.find(i).find(s).find(o).css({width:t,height:T(u)});break;default:return false;break}}function E(e){var t=(O()-n.startHeight)/2;var r=(A()-n.startWidth)/2;var i=0;var s=0;if(t>0){i=t}if(r>0){s=r}return{top:i,left:s}}function S(){n.beforeSetResponsive();var t=r.find(i).find(s).find(o);C();x();w();t.each(function(){var t=e(this).find(u);t.each(function(){var t=e(this);t.css({width:T(D(t,"width")),height:T(D(t,"height")),top:T(D(t,"top")+E(t).top),left:T(D(t,"left")+E(t).left),"padding-top":T(D(t,"padding-top")),"padding-right":T(D(t,"padding-right")),"padding-bottom":T(D(t,"padding-bottom")),"padding-left":T(D(t,"padding-left"))});if(t.text()!=""){t.css({width:"auto",height:"auto","line-height":T(D(t,"line-height"))+"px","letter-spacing":T(D(t,"letter-spacing")),"font-size":T(D(t,"font-size"))});if(t.width()>0){t.css("width",t.width())}if(t.height()>0){t.css("height",t.height())}}})});v=e(window).width();n.afterSetResponsive();N()}function x(){var e=r.width();var t=n.startWidth;if(e>=t){d=1}else{d=e/t}}function T(e){return e*d}function N(){if(n.automaticSlide){B()}else{U(f)}}function C(){var t=r.find(i).find(s).find(o+":eq("+f+")");var n=t.find(u);r.find(i).find(s).find(o).each(function(){var t=e(this);t.finish();t.find(u).each(function(){var t=e(this);t.finish()})});F();h=false}function k(){var e=r.find(i).find(".cs-progress-bar");e.stop(true);c=true;if(!l){n.beforePause();var t=r.find(i).find(s).find(o+":eq("+f+")");var u=t.children();t.finish();l=true;n.afterPause()}else{var a=setInterval(function(){if(c&&!l){clearInterval(a);c=false;k();return}if(!c){clearInterval(a);return}})}}function L(){n.beforeResume();c=false;var e=r.find(i).find(s).find(o+":eq("+f+")");var t=r.find(i).find(".cs-progress-bar");var u=P(e);var a=u-H(u,p);t.animate({width:"100%"},{duration:a,step:function(e){p=e},complete:function(){q(M())},easing:"linear"});l=false}function A(){return r.find(i).width()}function O(){return r.find(i).height()}function M(){if(f+1==a){return 0}return f+1}function _(){if(f-1<0){return a-1}return f-1}function D(e,t){var r;if(e.parent("ul").hasClass("cs-slides")){r=true}else{r=false}switch(t){case"ease-in":if(r){return isNaN(parseInt(e.data(t)))?n.slidesEaseIn:parseInt(e.data(t))}else{return isNaN(parseInt(e.data(t)))?n.elementsEaseIn:parseInt(e.data(t))}break;case"ease-out":if(r){return isNaN(parseInt(e.data(t)))?n.slidesEaseOut:parseInt(e.data(t))}else{return isNaN(parseInt(e.data(t)))?n.elementsEaseOut:parseInt(e.data(t))}break;case"delay":return isNaN(parseInt(e.data(t)))?n.elementsDelay:parseInt(e.data(t));break;case"time":if(r){return isNaN(parseInt(e.data(t)))?n.slidesTime:parseInt(e.data(t))}else{if(e.data(t)=="all"){return"all"}else{return isNaN(parseInt(e.data(t)))?n.itemsTime:parseInt(e.data(t))}}break;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));break;case"in":case"out":return e.data(t);break;default:return false;break}}function P(e){return D(e,"time")+D(e,"ease-in")}function H(e,t){return t/100*e}function B(){R(f).done(function(){if(!l){f=M();C();B()}})}function j(e){var t=P(e);var n=r.find(i).find(".cs-progress-bar");F();n.animate({width:"100%"},{duration:t,step:function(e){p=e},easing:"linear"})}function F(){var e=r.find(i).find(".cs-progress-bar");p=0;e.stop();e.css({width:"0%"})}function I(){var t=r.find(i).find(".cs-navigation");var n=t.find("> .cs-slide-link");n.each(function(){var t=e(this);if(t.index()==f){t.addClass("cs-active")}else{t.removeClass("cs-active")}})}function q(e){var t=r.find(i).find(s).find(o+":eq("+f+")");var n=t.children();C();z(f,false);f=e;N()}function R(t){n.beforeSlideStart();var u=r.find(i).find(s).find(o+":eq("+t+")");var a=new e.Deferred;j(u);I();U(t).done(function(){h=true});z(t,true).done(function(){n.afterSlideEnd();a.resolve()});return a.promise()}function U(t){var n=r.find(i).find(s).find(o+":eq("+t+")");var u=n.children();var a=0;var f=new e.Deferred;in_dealy=false;W(n).done(function(){a++;if(a==2){f.resolve()}});u.each(function(){var t=e(this);V(t)}).promise().done(function(){a++;if(a==2){f.resolve()}});return f.promise()}function z(t,n){var u=r.find(i).find(s).find(o+":eq("+t+")");var a=u.children();var f=D(u,"time");var l=new e.Deferred;if(n){a.each(function(){var t=e(this);var n=D(t,"time");if(n!="all"){t.delay(n).queue(function(){e(this).dequeue();J(t)})}});u.delay(f).queue(function(){e(this).dequeue();h=false;l.resolve();X(u).done(function(){});a.each(function(){var t=e(this);var n=D(t,"time");if(n=="all"){t.delay(n).queue(function(){e(this).dequeue();J(t)})}})})}else{l.resolve();a.each(function(){var t=e(this);J(t)});X(u).done(function(){})}return l.promise()}function W(t){var n=D(t,"in");var r=D(t,"ease-in");var i=new e.Deferred;switch(n){case"fade":t.css({display:"block",top:0,left:0,opacity:0});t.animate({opacity:1},r,function(){i.resolve()});break;case"fadeLeft":t.css({display:"block",top:0,left:A(),opacity:0});t.animate({opacity:1,left:0},r,function(){i.resolve()});break;case"fadeRight":t.css({display:"block",top:0,left:-A(),opacity:0});t.animate({opacity:1,left:0},r,function(){i.resolve()});break;case"slideLeft":t.css({display:"block",top:0,left:A()});t.animate({left:0},r,function(){i.resolve()});break;case"slideRight":t.css({display:"block",top:0,left:-A()});t.animate({left:0},r,function(){i.resolve()});break;case"slideUp":t.css({display:"block",top:O(),left:0});t.animate({top:0},r,function(){i.resolve()});break;case"slideDown":t.css({display:"block",top:-O(),left:0});t.animate({top:0},r,function(){i.resolve()});break;default:t.css({display:"block",top:0,left:0});i.resolve();break}return i.promise()}function X(t){var n=D(t,"out");var r=D(t,"ease-out");var i=new e.Deferred;switch(n){case"fade":t.animate({opacity:0},r,function(){t.css({display:"none",opacity:1});i.resolve()});break;case"fadeLeft":t.animate({opacity:0,left:-A()},r,function(){t.css({display:"none",opacity:1,left:0});i.resolve()});break;case"fadeRight":t.animate({opacity:0,left:A()},r,function(){t.css({display:"none",opacity:1,left:0});i.resolve()});break;case"slideLeft":t.animate({left:-A()},r,function(){t.css({display:"none",left:0});i.resolve()});break;case"slideRight":t.animate({left:A()},r,function(){t.css({display:"none",left:0});i.resolve()});break;case"slideUp":t.animate({top:-O()},r,function(){t.css({display:"none",top:0});i.resolve()});break;case"slideDown":t.animate({top:O()},r,function(){t.css({display:"none",top:0});i.resolve()});break;default:t.css({display:"none"});i.resolve();break}return i.promise()}function V(e){var t=e.outerWidth();var n=e.outerHeight();var r=D(e,"in");var i=D(e,"ease-in");var s=D(e,"delay");var o=D(e,"top");var u=D(e,"left");switch(r){case"slideDown":e.delay(s).css({display:"block",top:-n,left:T(u+E(e).left)}).animate({top:T(o+E(e).top)},i);break;case"slideUp":e.delay(s).css({display:"block",top:O(),left:T(u+E(e).left)}).animate({top:T(o+E(e).top)},i);break;case"slideLeft":e.delay(s).css({display:"block",top:T(o+E(e).top),left:A()}).animate({left:T(u+E(e).left)},i);break;case"slideRight":e.delay(s).css({display:"block",top:T(o+E(e).top),left:-t}).animate({left:T(u+E(e).left)},i);break;case"fade":e.delay(s).css({display:"block",top:T(o+E(e).top),left:T(u+E(e).left),opacity:0}).animate({opacity:1},i);break;case"fadeDown":e.delay(s).css({display:"block",top:-n,left:T(u+E(e).left),opacity:0}).animate({top:T(o+E(e).top),opacity:1},i);break;case"fadeUp":e.delay(s).css({display:"block",top:O(),left:T(u+E(e).left),opacity:0}).animate({top:T(o+E(e).top),opacity:1},i);break;case"fadeLeft":e.delay(s).css({display:"block",top:T(o+E(e).top),left:A(),opacity:0}).animate({left:T(u+E(e).left),opacity:1},i);break;case"fadeRight":e.delay(s).css({display:"block",top:T(o+E(e).top),left:-t,opacity:0}).animate({left:T(u+E(e).left),opacity:1},i);break;case"fadeSmallDown":e.delay(s).css({display:"block",top:T(o+E(e).top-30),left:T(u+E(e).left),opacity:0}).animate({top:T(o+E(e).top),opacity:1},i);break;case"fadeSmallUp":e.delay(s).css({display:"block",top:T(o+E(e).top+30),left:T(u+E(e).left),opacity:0}).animate({top:T(o+E(e).top),opacity:1},i);break;case"fadeSmallLeft":e.delay(s).css({display:"block",top:T(o+E(e).top),left:T(u+E(e).left+30),opacity:0}).animate({left:T(u+E(e).left),opacity:1},i);break;case"fadeSmallRight":e.delay(s).css({display:"block",top:T(o+E(e).top),left:T(u+E(e).left-30),opacity:0}).animate({left:T(u+E(e).left),opacity:1},i);break}}function J(e){var t=e.outerWidth();var n=e.outerHeight();var r=D(e,"top");var i=D(e,"left");var s=D(e,"out");var o=D(e,"ease-out");switch(s){case"slideDown":e.animate({top:O()},o,function(){e.css({display:"none"})});break;case"slideUp":e.animate({top:-n},o,function(){e.css({display:"none"})});break;case"slideLeft":e.animate({left:-t},o,function(){e.css({display:"none"})});break;case"slideRight":e.animate({left:A()},o,function(){e.css({display:"none"})});break;case"fade":e.animate({opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeDown":e.animate({top:O(),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeUp":e.animate({top:-n,opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeLeft":e.animate({left:-t,opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeRight":e.animate({left:A(),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallDown":e.animate({top:T(D(e,"top")+E(e).top+30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallUp":e.animate({top:T(D(e,"top")+E(e).top-30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallLeft":e.animate({left:T(D(e,"left")+E(e).left-30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallRight":e.animate({left:T(D(e,"left")+E(e).left+30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break}}var r=e(t);var i="div.crellyslider";var s="ul.cs-slides";var o="li.cs-slide";var u="> *";var a;var f=0;var l=false,c=false;var h=false;var p=0;var d=1;var v=0;m()};e.fn.crellySlider=function(n){var r=e.extend({layout:"fixed",responsive:true,startWidth:1170,startHeight:500,pauseOnHover:true,automaticSlide:true,showControls:true,showNavigation:true,showProgressBar:true,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,beforeStart:function(){},beforeSetResponsive:function(){},afterSetResponsive:function(){},beforeSlideStart:function(){},afterSlideEnd:function(){},beforePause:function(){},afterPause:function(){},beforeResume:function(){}},n);return this.each(function(){new t(this,r)})}})(jQuery)
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
+ * Version: 0.6.9
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
9
  */
10
 
11
+ (function(e){var t=function(t,n){function m(){r.wrapInner('<div class="crellyslider" />');r.find(i+" > ul").addClass("cs-slides");r.find(i+" "+s+" > li").addClass("cs-slide");a=e(r).find(i).find(s).find(o).length;if(a==0){return false}if(a==1){var t=r.find(i).find(s).find(o+":eq(0)");var u=r.find(i).find(s);t.clone().prependTo(u);a++}if(n.showControls){r.find(i).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>')}if(n.showNavigation){var f='<div class="cs-navigation">';for(var l=0;l<a;l++){f+='<span class="cs-slide-link"></span>'}f+="</div>";r.find(i).append(f)}if(n.showProgressBar){r.find(i).append('<div class="cs-progress-bar"></div>')}else{r.find(i).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>')}if(n.responsive){k()}x();E();if(!crellyslider_is_wordpress_admin||typeof crellyslider_is_wordpress_admin=="undefined"){g()}else{y()}}function g(){e(window).load(function(){y()})}function y(){S();if(n.responsive){k()}x();v=e(window).width();r.find(i).find(s).find(o).each(function(){e(this).find(u).each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);b(t,true)});b(t,false)});e(this).css({display:"none"})});w();n.beforeStart();if(n.responsive){N()}else{A()}}function b(e,t){e.data("width",parseFloat(e.width()));e.data("height",parseFloat(e.height()));e.data("line-height",parseFloat(e.css("line-height")));e.data("letter-spacing",parseFloat(e.css("letter-spacing")));e.data("font-size",parseFloat(e.css("font-size")));e.data("padding-top",parseFloat(e.css("padding-top")));e.data("padding-right",parseFloat(e.css("padding-right")));e.data("padding-bottom",parseFloat(e.css("padding-bottom")));e.data("padding-left",parseFloat(e.css("padding-left")));if(!t){e.css("display","none")}}function w(){if(n.responsive){e(window).resize(function(){if(v!=e(window).width()&&(n.layout=="full-width"&&D()!=e(r).width()||e(r).width()<D()||e(r).width()>D()&&D()<n.startWidth)){N()}})}r.find(i).find(".cs-controls > .cs-previous").click(function(){l=false;W(B())});r.find(i).find(".cs-controls > .cs-next").click(function(){l=false;W(H())});r.find(i).find(".cs-navigation > .cs-slide-link").click(function(){if(e(this).index()!=f){l=false;W(e(this).index())}});if(n.pauseOnHover){r.find(i).find(s).hover(function(){M()});r.find(i).find(s).mouseleave(function(){_()})}}function E(){r.find(i).find(s).css("display","none");r.find(i).find(".cs-progress-bar").css("display","none");r.find(i).find(".cs-navigation").css("display","none");r.find(i).find(".cs-controls").css("display","none");r.find(i).append('<div class="cs-preloader"><div class="cs-loader"></div></div>')}function S(){r.find(i).find(s).css("display","block");r.find(i).find(".cs-progress-bar").css("display","block");r.find(i).find(".cs-navigation").css("display","block");r.find(i).find(".cs-controls").css("display","block");r.find(i).find(".cs-preloader").remove()}function x(){var e=n.layout;var t,u;switch(e){case"fixed":t=n.startWidth;u=n.startHeight;r.find(i).css({width:L(t),height:L(u)});r.find(i).find(s).find(o).css({width:L(t),height:L(u)});break;case"full-width":t=r.width();u=n.startHeight;r.find(i).css({width:t,height:L(u)});r.find(i).find(s).find(o).css({width:t,height:L(u)});break;default:return false;break}}function T(e){var t=(P()-n.startHeight)/2;var r=(D()-n.startWidth)/2;var i=0;var s=0;if(t>0){i=t}if(r>0){s=r}return{top:i,left:s}}function N(){n.beforeSetResponsive();var t=r.find(i).find(s).find(o);O();k();x();t.each(function(){var t=e(this).find(u);t.each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);C(t)});C(t)})});v=e(window).width();n.afterSetResponsive();A()}function C(e){e.css({width:L(j(e,"width")),height:L(j(e,"height")),top:L(j(e,"top")+T(e).top),left:L(j(e,"left")+T(e).left),"padding-top":L(j(e,"padding-top")),"padding-right":L(j(e,"padding-right")),"padding-bottom":L(j(e,"padding-bottom")),"padding-left":L(j(e,"padding-left"))});if(e.text()!=""){e.css({width:"auto",height:"auto","line-height":L(j(e,"line-height"))+"px","letter-spacing":L(j(e,"letter-spacing")),"font-size":L(j(e,"font-size"))})}}function k(){var e=r.width();var t=n.startWidth;if(e>=t||!n.responsive){d=1}else{d=e/t}}function L(e){return e*d}function A(){if(n.automaticSlide){q()}else{V(f)}}function O(){var t=r.find(i).find(s).find(o+":eq("+f+")");var n=t.find(u);r.find(i).find(s).find(o).each(function(){var t=e(this);t.finish();t.find(u).each(function(){var t=e(this);t.finish()})});U();h=false}function M(){var e=r.find(i).find(".cs-progress-bar");e.stop(true);c=true;if(!l){n.beforePause();var t=r.find(i).find(s).find(o+":eq("+f+")");var u=t.children();t.finish();l=true;n.afterPause()}else{var a=setInterval(function(){if(c&&!l){clearInterval(a);c=false;M();return}if(!c){clearInterval(a);return}})}}function _(){n.beforeResume();c=false;var e=r.find(i).find(s).find(o+":eq("+f+")");var t=r.find(i).find(".cs-progress-bar");var u=F(e);var a=u-I(u,p);t.animate({width:"100%"},{duration:a,step:function(e){p=e},complete:function(){W(H())},easing:"linear"});l=false}function D(){return r.find(i).width()}function P(){return r.find(i).height()}function H(){if(f+1==a){return 0}return f+1}function B(){if(f-1<0){return a-1}return f-1}function j(e,t){var r;if(e.parent("ul").hasClass("cs-slides")){r=true}else{r=false}switch(t){case"ease-in":if(r){return isNaN(parseInt(e.data(t)))?n.slidesEaseIn:parseInt(e.data(t))}else{return isNaN(parseInt(e.data(t)))?n.elementsEaseIn:parseInt(e.data(t))}break;case"ease-out":if(r){return isNaN(parseInt(e.data(t)))?n.slidesEaseOut:parseInt(e.data(t))}else{return isNaN(parseInt(e.data(t)))?n.elementsEaseOut:parseInt(e.data(t))}break;case"delay":return isNaN(parseInt(e.data(t)))?n.elementsDelay:parseInt(e.data(t));break;case"time":if(r){return isNaN(parseInt(e.data(t)))?n.slidesTime:parseInt(e.data(t))}else{if(e.data(t)=="all"){return"all"}else{return isNaN(parseInt(e.data(t)))?n.itemsTime:parseInt(e.data(t))}}break;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));break;case"in":case"out":return e.data(t);break;default:return false;break}}function F(e){return j(e,"time")+j(e,"ease-in")}function I(e,t){return t/100*e}function q(){X(f).done(function(){if(!l){f=H();O();q()}})}function R(e){var t=F(e);var n=r.find(i).find(".cs-progress-bar");U();n.animate({width:"100%"},{duration:t,step:function(e){p=e},easing:"linear"})}function U(){var e=r.find(i).find(".cs-progress-bar");p=0;e.stop();e.css({width:"0%"})}function z(){var t=r.find(i).find(".cs-navigation");var n=t.find("> .cs-slide-link");n.each(function(){var t=e(this);if(t.index()==f){t.addClass("cs-active")}else{t.removeClass("cs-active")}})}function W(e){var t=r.find(i).find(s).find(o+":eq("+f+")");var n=t.children();O();J(f,false);f=e;A()}function X(t){n.beforeSlideStart();var u=r.find(i).find(s).find(o+":eq("+t+")");var a=new e.Deferred;R(u);z();V(t).done(function(){h=true});J(t,true).done(function(){n.afterSlideEnd();a.resolve()});return a.promise()}function V(t){var n=r.find(i).find(s).find(o+":eq("+t+")");var u=n.children();var a=0;var f=new e.Deferred;in_dealy=false;K(n).done(function(){a++;if(a==2){f.resolve()}});u.each(function(){var t=e(this);G(t)}).promise().done(function(){a++;if(a==2){f.resolve()}});return f.promise()}function J(t,n){var u=r.find(i).find(s).find(o+":eq("+t+")");var a=u.children();var f=j(u,"time");var l=new e.Deferred;if(n){a.each(function(){var t=e(this);var n=j(t,"time");if(n!="all"){t.delay(n).queue(function(){e(this).dequeue();Y(t)})}});u.delay(f).queue(function(){e(this).dequeue();h=false;l.resolve();Q(u).done(function(){});a.each(function(){var t=e(this);var n=j(t,"time");if(n=="all"){t.delay(n).queue(function(){e(this).dequeue();Y(t)})}})})}else{l.resolve();a.each(function(){var t=e(this);Y(t)});Q(u).done(function(){})}return l.promise()}function K(t){var n=j(t,"in");var r=j(t,"ease-in");var i=new e.Deferred;switch(n){case"fade":t.css({display:"block",top:0,left:0,opacity:0});t.animate({opacity:1},r,function(){i.resolve()});break;case"fadeLeft":t.css({display:"block",top:0,left:D(),opacity:0});t.animate({opacity:1,left:0},r,function(){i.resolve()});break;case"fadeRight":t.css({display:"block",top:0,left:-D(),opacity:0});t.animate({opacity:1,left:0},r,function(){i.resolve()});break;case"slideLeft":t.css({display:"block",top:0,left:D()});t.animate({left:0},r,function(){i.resolve()});break;case"slideRight":t.css({display:"block",top:0,left:-D()});t.animate({left:0},r,function(){i.resolve()});break;case"slideUp":t.css({display:"block",top:P(),left:0});t.animate({top:0},r,function(){i.resolve()});break;case"slideDown":t.css({display:"block",top:-P(),left:0});t.animate({top:0},r,function(){i.resolve()});break;default:t.css({display:"block",top:0,left:0});i.resolve();break}return i.promise()}function Q(t){var n=j(t,"out");var r=j(t,"ease-out");var i=new e.Deferred;switch(n){case"fade":t.animate({opacity:0},r,function(){t.css({display:"none",opacity:1});i.resolve()});break;case"fadeLeft":t.animate({opacity:0,left:-D()},r,function(){t.css({display:"none",opacity:1,left:0});i.resolve()});break;case"fadeRight":t.animate({opacity:0,left:D()},r,function(){t.css({display:"none",opacity:1,left:0});i.resolve()});break;case"slideLeft":t.animate({left:-D()},r,function(){t.css({display:"none",left:0});i.resolve()});break;case"slideRight":t.animate({left:D()},r,function(){t.css({display:"none",left:0});i.resolve()});break;case"slideUp":t.animate({top:-P()},r,function(){t.css({display:"none",top:0});i.resolve()});break;case"slideDown":t.animate({top:P()},r,function(){t.css({display:"none",top:0});i.resolve()});break;default:t.css({display:"none"});i.resolve();break}return i.promise()}function G(e){var t=e.outerWidth();var n=e.outerHeight();var r=j(e,"in");var i=j(e,"ease-in");var s=j(e,"delay");var o=j(e,"top");var u=j(e,"left");switch(r){case"slideDown":e.delay(s).css({display:"block",top:-n,left:L(u+T(e).left)}).animate({top:L(o+T(e).top)},i);break;case"slideUp":e.delay(s).css({display:"block",top:P(),left:L(u+T(e).left)}).animate({top:L(o+T(e).top)},i);break;case"slideLeft":e.delay(s).css({display:"block",top:L(o+T(e).top),left:D()}).animate({left:L(u+T(e).left)},i);break;case"slideRight":e.delay(s).css({display:"block",top:L(o+T(e).top),left:-t}).animate({left:L(u+T(e).left)},i);break;case"fade":e.delay(s).css({display:"block",top:L(o+T(e).top),left:L(u+T(e).left),opacity:0}).animate({opacity:1},i);break;case"fadeDown":e.delay(s).css({display:"block",top:-n,left:L(u+T(e).left),opacity:0}).animate({top:L(o+T(e).top),opacity:1},i);break;case"fadeUp":e.delay(s).css({display:"block",top:P(),left:L(u+T(e).left),opacity:0}).animate({top:L(o+T(e).top),opacity:1},i);break;case"fadeLeft":e.delay(s).css({display:"block",top:L(o+T(e).top),left:D(),opacity:0}).animate({left:L(u+T(e).left),opacity:1},i);break;case"fadeRight":e.delay(s).css({display:"block",top:L(o+T(e).top),left:-t,opacity:0}).animate({left:L(u+T(e).left),opacity:1},i);break;case"fadeSmallDown":e.delay(s).css({display:"block",top:L(o+T(e).top-30),left:L(u+T(e).left),opacity:0}).animate({top:L(o+T(e).top),opacity:1},i);break;case"fadeSmallUp":e.delay(s).css({display:"block",top:L(o+T(e).top+30),left:L(u+T(e).left),opacity:0}).animate({top:L(o+T(e).top),opacity:1},i);break;case"fadeSmallLeft":e.delay(s).css({display:"block",top:L(o+T(e).top),left:L(u+T(e).left+30),opacity:0}).animate({left:L(u+T(e).left),opacity:1},i);break;case"fadeSmallRight":e.delay(s).css({display:"block",top:L(o+T(e).top),left:L(u+T(e).left-30),opacity:0}).animate({left:L(u+T(e).left),opacity:1},i);break}}function Y(e){var t=e.outerWidth();var n=e.outerHeight();var r=j(e,"top");var i=j(e,"left");var s=j(e,"out");var o=j(e,"ease-out");switch(s){case"slideDown":e.animate({top:P()},o,function(){e.css({display:"none"})});break;case"slideUp":e.animate({top:-n},o,function(){e.css({display:"none"})});break;case"slideLeft":e.animate({left:-t},o,function(){e.css({display:"none"})});break;case"slideRight":e.animate({left:D()},o,function(){e.css({display:"none"})});break;case"fade":e.animate({opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeDown":e.animate({top:P(),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeUp":e.animate({top:-n,opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeLeft":e.animate({left:-t,opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeRight":e.animate({left:D(),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallDown":e.animate({top:L(j(e,"top")+T(e).top+30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallUp":e.animate({top:L(j(e,"top")+T(e).top-30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallLeft":e.animate({left:L(j(e,"left")+T(e).left-30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break;case"fadeSmallRight":e.animate({left:L(j(e,"left")+T(e).left+30),opacity:0},o,function(){e.css({display:"none",opacity:1})});break}}var r=e(t);var i="div.crellyslider";var s="ul.cs-slides";var o="li.cs-slide";var u="> *";var a;var f=0;var l=false,c=false;var h=false;var p=0;var d=1;var v=0;m()};e.fn.crellySlider=function(n){var r=e.extend({layout:"fixed",responsive:true,startWidth:1170,startHeight:500,pauseOnHover:true,automaticSlide:true,showControls:true,showNavigation:true,showProgressBar:true,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,beforeStart:function(){},beforeSetResponsive:function(){},afterSetResponsive:function(){},beforeSlideStart:function(){},afterSlideEnd:function(){},beforePause:function(){},afterPause:function(){},beforeResume:function(){}},n);return this.each(function(){new t(this,r)})}})(jQuery)
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: fabiorino
3
  Donate link: http://fabiorino1.altervista.org/projects/crellyslider/contribute-and-support/
4
  Tags: slider, slides, animations, drag & drop, drag and drop, layers, elements
5
- Requires at least: 3.5.0
6
- Tested up to: 3.9.1
7
- Stable tag: 0.6.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -54,6 +54,19 @@ You can find the documentation <a href="http://fabiorino1.altervista.org/project
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  = 0.6.8 =
58
  * Added callback functions: beforeStart, beforeSetResponsive, afterSetResponsive, beforeSlideStart, afterSlideEnd, beforePause, afterPause, beforeResume
59
  * Fixed responsive methods that restarted the slide in particular moments uselessly
2
  Contributors: fabiorino
3
  Donate link: http://fabiorino1.altervista.org/projects/crellyslider/contribute-and-support/
4
  Tags: slider, slides, animations, drag & drop, drag and drop, layers, elements
5
+ Requires at least: 3.6.0
6
+ Tested up to: 4.0
7
+ Stable tag: 0.6.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 0.6.9 =
58
+ * Added the possibility to insert links in images and texts
59
+ * Added slider preloader (with a gif image)
60
+ * Added icon in the style of WordPress to the lateral sidebar in the admin panel
61
+ * Added confirm alert when you delete a slider
62
+ * Fixed: now HTML codes inserted in text elements are working properly
63
+ * Fixed: when you selected an element into the editing area weren't shown the correct element options
64
+ * Fixed invisible progress bar in Internet Explorer 8
65
+ * Fixed invisible slider navigation in Internet Explorer 8
66
+ * Changed: text output is now wrapped by a "div" and not a "p" for a better compatibility and a cleaner code
67
+ * Changed name to the "add image" button in the element options
68
+ * Other minor bug fixes and changes
69
+
70
  = 0.6.8 =
71
  * Added callback functions: beforeStart, beforeSetResponsive, afterSetResponsive, beforeSlideStart, afterSlideEnd, beforePause, afterPause, beforeResume
72
  * Fixed responsive methods that restarted the slide in particular moments uselessly
wordpress/admin.php CHANGED
@@ -8,7 +8,7 @@ class CrellySliderAdmin {
8
  }
9
 
10
  public static function pluginMenus() {
11
- add_menu_page('Crelly Slider', 'Crelly Slider', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayPage');
12
  //add_submenu_page('crellyslider', 'View Sliders', 'View Sliders', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayHome');
13
  //add_submenu_page('crellyslider', 'Add Slider', 'Add Slider', 'manage_options', 'cs_slider', 'CrellySliderAdmin::displaySlider');
14
  }
@@ -146,6 +146,19 @@ class CrellySliderAdmin {
146
  <?php
147
  }
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  // Include CSS and JavaScript
150
  public static function enqueues() {
151
  wp_enqueue_script('jquery-ui-draggable');
@@ -160,6 +173,62 @@ class CrellySliderAdmin {
160
 
161
  wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
162
  wp_enqueue_script('crellyslider-admin');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
 
165
  public static function setEnqueues() {
@@ -171,6 +240,7 @@ class CrellySliderAdmin {
171
  $crellyslider_translations = array(
172
  'slide' => __('Slide', 'crellyslider'),
173
  'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crellyslider'),
 
174
  'text_element_default_html' => __('Text element', 'crellyslider'),
175
  'slide_live_preview' => __('Live preview', 'crellyslider'),
176
  'slide_stop_preview' => __('Stop preview', 'crellyslider'),
8
  }
9
 
10
  public static function pluginMenus() {
11
+ add_menu_page('Crelly Slider', 'Crelly Slider', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayPage', 'div');
12
  //add_submenu_page('crellyslider', 'View Sliders', 'View Sliders', 'manage_options', 'crellyslider', 'CrellySliderAdmin::displayHome');
13
  //add_submenu_page('crellyslider', 'Add Slider', 'Add Slider', 'manage_options', 'cs_slider', 'CrellySliderAdmin::displaySlider');
14
  }
146
  <?php
147
  }
148
 
149
+ // Avoid incompatibility issues
150
+ public static function isAdminJs() {
151
+ ?>
152
+ <script type="text/javascript">
153
+ var crellyslider_is_wordpress_admin = true;
154
+ </script>
155
+ <?php
156
+ }
157
+
158
+ public static function setIsAdminJs() {
159
+ add_action('admin_enqueue_scripts', 'CrellySliderAdmin::isAdminJs');
160
+ }
161
+
162
  // Include CSS and JavaScript
163
  public static function enqueues() {
164
  wp_enqueue_script('jquery-ui-draggable');
173
 
174
  wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
175
  wp_enqueue_script('crellyslider-admin');
176
+
177
+ $wp_version = get_bloginfo('version');
178
+ $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
179
+ if($wp_version < 3.8) {
180
+ ?>
181
+ <style type="text/css">
182
+ #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
183
+ background-image: url('<?php echo $menu_icon_url; ?>');
184
+ background-repeat: no-repeat;
185
+ background-position: -20px center;
186
+ }
187
+
188
+ #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
189
+ background-position: -20px center;
190
+ }
191
+
192
+ #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
193
+ background-position: 8px center;
194
+ }
195
+
196
+ #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
197
+ background-position: 8px center;
198
+ }
199
+ </style>
200
+ <?php
201
+ }
202
+ else {
203
+ ?>
204
+ <style type="text/css">
205
+ #adminmenu .toplevel_page_crellyslider div.wp-menu-image {
206
+ background-image: url('<?php echo $menu_icon_url; ?>');
207
+ background-repeat: no-repeat;
208
+ background-position: 8px center;
209
+ opacity: .6;
210
+ filter: alpha(opacity=60);
211
+ }
212
+
213
+ #adminmenu .toplevel_page_crellyslider:hover div.wp-menu-image {
214
+ background-position: -20px center;
215
+ opacity: 1;
216
+ filter: alpha(opacity=100);
217
+ }
218
+
219
+ #adminmenu .toplevel_page_crellyslider.current div.wp-menu-image {
220
+ opacity: 1;
221
+ filter: alpha(opacity=100);
222
+ }
223
+
224
+ #adminmenu .current.toplevel_page_crellyslider:hover div.wp-menu-image {
225
+ background-position: 8px center;
226
+ opacity: 1;
227
+ filter: alpha(opacity=100);
228
+ }
229
+ </style>
230
+ <?php
231
+ }
232
  }
233
 
234
  public static function setEnqueues() {
240
  $crellyslider_translations = array(
241
  'slide' => __('Slide', 'crellyslider'),
242
  'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crellyslider'),
243
+ 'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crellyslider'),
244
  'text_element_default_html' => __('Text element', 'crellyslider'),
245
  'slide_live_preview' => __('Live preview', 'crellyslider'),
246
  'slide_stop_preview' => __('Stop preview', 'crellyslider'),
wordpress/ajax.php CHANGED
@@ -195,6 +195,8 @@ function crellyslider_editElements_callback() {
195
  'data_easeIn' => $option['data_easeIn'],
196
  'data_easeOut' => $option['data_easeOut'],
197
  'custom_css' => $option['custom_css'],
 
 
198
  ),
199
  array(
200
  '%d',
@@ -214,6 +216,8 @@ function crellyslider_editElements_callback() {
214
  '%d',
215
  '%d',
216
  '%s',
 
 
217
  )
218
  );
219
 
195
  'data_easeIn' => $option['data_easeIn'],
196
  'data_easeOut' => $option['data_easeOut'],
197
  'custom_css' => $option['custom_css'],
198
+ 'link' => $option['link'],
199
+ 'link_new_tab' => $option['link_new_tab'],
200
  ),
201
  array(
202
  '%d',
216
  '%d',
217
  '%d',
218
  '%s',
219
+ '%s',
220
+ '%d',
221
  )
222
  );
223
 
wordpress/css/admin.css CHANGED
@@ -357,6 +357,16 @@
357
  border-right: none;
358
  }
359
 
 
 
 
 
 
 
 
 
 
 
360
  .cs-admin .cs-icon {
361
  display: inline-block;
362
  width: 13px;
357
  border-right: none;
358
  }
359
 
360
+ .cs-admin .cs-slide-tabs .ui-tabs-nav li,
361
+ .cs-admin .cs-slide-tabs .ui-tabs-nav li a {
362
+ cursor: move;
363
+ }
364
+
365
+ .cs-admin .cs-slide-tabs .ui-tabs-nav li.ui-state-disabled,
366
+ .cs-admin .cs-slide-tabs .ui-tabs-nav li.ui-state-disabled a {
367
+ cursor: pointer;
368
+ }
369
+
370
  .cs-admin .cs-icon {
371
  display: inline-block;
372
  width: 13px;
wordpress/elements.php CHANGED
@@ -27,57 +27,74 @@ function crellyslider_printElements($edit, $slider, $slide, $elements) {
27
  <?php
28
  if($edit && $elements != NULL) {
29
  foreach($elements as $element) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  switch($element->type) {
31
  case 'text':
32
  ?>
33
- <p
34
- class="cs-element cs-text-element"
35
  style="
36
  <?php
37
- echo 'z-index: ' . $element->z_index . ';';
38
- echo 'left: ' . $element->data_left . 'px;';
39
- echo 'top: ' . $element->data_top . 'px;';
 
 
40
  echo stripslashes($element->custom_css);
41
  ?>
42
  "
43
- data-delay="<?php echo $element->data_delay; ?>"
44
- data-easeIn="<?php echo $element->data_easeIn; ?>"
45
- data-easeOut="<?php echo $element->data_easeOut; ?>"
46
- data-in="<?php echo $element->data_in; ?>"
47
- data-out="<?php echo $element->data_out; ?>"
48
- data-top="<?php echo $element->data_top; ?>"
49
- data-left="<?php echo $element->data_left; ?>"
50
- data-time="<?php echo $element->data_time; ?>"
51
  >
52
  <?php echo stripslashes($element->inner_html); ?>
53
- </p>
54
  <?php
55
  break;
56
  case 'image':
57
  ?>
58
  <img
59
- class="cs-element cs-image-element"
60
  src="<?php echo $element->image_src; ?>"
 
61
  style="
62
  <?php
63
- echo 'z-index: ' . $element->z_index . ';';
64
- echo 'left: ' . $element->data_left . 'px;';
65
- echo 'top: ' . $element->data_top . 'px;';
 
 
66
  echo stripslashes($element->custom_css);
67
  ?>
68
  "
69
- data-delay="<?php echo $element->data_delay; ?>"
70
- data-easeIn="<?php echo $element->data_easeIn; ?>"
71
- data-easeOut="<?php echo $element->data_easeOut; ?>"
72
- data-in="<?php echo $element->data_in; ?>"
73
- data-out="<?php echo $element->data_out; ?>"
74
- data-top="<?php echo $element->data_top; ?>"
75
- data-left="<?php echo $element->data_left; ?>"
76
- data-time="<?php echo $element->data_time; ?>"
77
  />
78
  <?php
79
  break;
80
  }
 
 
 
 
81
  }
82
  }
83
  ?>
@@ -170,8 +187,9 @@ function crellyslider_printTextElement($element) {
170
  <td class="cs-name"><?php _e('Text', 'crellyslider'); ?></td>
171
  <td class="cs-content">
172
  <?php
173
- if($void) echo '<input class="cs-element-inner_html" type="text" value="' . __('Text element', 'crellyslider') . '" />';
174
- else echo '<input class="cs-element-inner_html" type="text" value="' . stripslashes($element->inner_html) .'" />';
 
175
  ?>
176
  </td>
177
  <td class="cs-description">
@@ -306,6 +324,30 @@ function crellyslider_printTextElement($element) {
306
  <?php _e('How long will the out animation take.', 'crellyslider'); ?>
307
  </td>
308
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  <tr>
310
  <td class="cs-name"><?php _e('Custom CSS', 'crellyslider'); ?></td>
311
  <td class="cs-content">
@@ -356,15 +398,15 @@ function crellyslider_printImageElement($element) {
356
  <td><?php _e('Description', 'crellyslider'); ?></td>
357
  </tr>
358
  <tr>
359
- <td class="cs-name"><?php _e('Upload image', 'crellyslider'); ?></td>
360
  <td class="cs-content">
361
  <?php
362
- if($void) echo '<input class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Select image', 'crellyslider') . '" />';
363
- else echo '<input data-src="' . $element->image_src . '" data-alt="' . $element->image_alt . '" class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Select image', 'crellyslider') . '" />';
364
  ?>
365
  </td>
366
  <td class="cs-description">
367
- <?php _e('Upload the image you want to insert.', 'crellyslider'); ?>
368
  </td>
369
  </tr>
370
  <tr>
@@ -495,6 +537,30 @@ function crellyslider_printImageElement($element) {
495
  <?php _e('How long will the out animation take.', 'crellyslider'); ?>
496
  </td>
497
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  <tr>
499
  <td class="cs-name"><?php _e('Custom CSS', 'crellyslider'); ?></td>
500
  <td class="cs-content">
27
  <?php
28
  if($edit && $elements != NULL) {
29
  foreach($elements as $element) {
30
+ if($element->link != '') {
31
+ $target = $element->link_new_tab == 1 ? 'target="_blank"' : '';
32
+
33
+ $link_output = '<a' . "\n" .
34
+ 'class="cs-element cs-' . $element->type . '-element"' . "\n" .
35
+ 'href="' . stripslashes($element->link) . '"' . "\n" .
36
+ $target . "\n" .
37
+ 'style="' .
38
+ 'z-index: ' . $element->z_index . ';' . "\n" .
39
+ 'top: ' . $element->data_top . 'px;' . "\n" .
40
+ 'left: ' . $element->data_left . 'px;' . "\n" .
41
+ '">' . "\n";
42
+
43
+ echo $link_output;
44
+ }
45
+
46
  switch($element->type) {
47
  case 'text':
48
  ?>
49
+ <div
 
50
  style="
51
  <?php
52
+ if($element->link == '') {
53
+ echo 'z-index: ' . $element->z_index . ';';
54
+ echo 'left: ' . $element->data_left . 'px;';
55
+ echo 'top: ' . $element->data_top . 'px;';
56
+ }
57
  echo stripslashes($element->custom_css);
58
  ?>
59
  "
60
+ <?php
61
+ if($element->link == '') {
62
+ echo 'class="cs-element cs-text-element"';
63
+ }
64
+ ?>
 
 
 
65
  >
66
  <?php echo stripslashes($element->inner_html); ?>
67
+ </div>
68
  <?php
69
  break;
70
  case 'image':
71
  ?>
72
  <img
 
73
  src="<?php echo $element->image_src; ?>"
74
+ alt="<?php echo $element->image_alt; ?>"
75
  style="
76
  <?php
77
+ if($element->link == '') {
78
+ echo 'z-index: ' . $element->z_index . ';';
79
+ echo 'left: ' . $element->data_left . 'px;';
80
+ echo 'top: ' . $element->data_top . 'px;';
81
+ }
82
  echo stripslashes($element->custom_css);
83
  ?>
84
  "
85
+ <?php
86
+ if($element->link == '') {
87
+ echo 'class="cs-element cs-image-element"';
88
+ }
89
+ ?>
 
 
 
90
  />
91
  <?php
92
  break;
93
  }
94
+
95
+ if($element->link != '') {
96
+ echo '</a>' . "\n";
97
+ }
98
  }
99
  }
100
  ?>
187
  <td class="cs-name"><?php _e('Text', 'crellyslider'); ?></td>
188
  <td class="cs-content">
189
  <?php
190
+ // Here I use ' ' to delimit the value attribute. Should reduce conflict possibilities.
191
+ if($void) echo '<input class="cs-element-inner_html" type="text" value=\'' . __('Text element', 'crellyslider') . '\' />';
192
+ else echo '<input class="cs-element-inner_html" type="text" value=\'' . stripslashes($element->inner_html) .'\' />';
193
  ?>
194
  </td>
195
  <td class="cs-description">
324
  <?php _e('How long will the out animation take.', 'crellyslider'); ?>
325
  </td>
326
  </tr>
327
+ <tr>
328
+ <td class="cs-name"><?php _e('Link', 'crellyslider'); ?></td>
329
+ <td class="cs-content">
330
+ <?php
331
+ if($void) echo '<input class="cs-element-link" type="text" value="" />';
332
+ else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
333
+ ?>
334
+ <br />
335
+ <?php
336
+ if($void) echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crellyslider');
337
+ else {
338
+ if($element->link_new_tab) {
339
+ echo '<input class="cs-element-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crellyslider');
340
+ }
341
+ else {
342
+ echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crellyslider');
343
+ }
344
+ }
345
+ ?>
346
+ </td>
347
+ <td class="cs-description">
348
+ <?php _e('Open the link (e.g.: http://www.google.it) on click. Leave it empty if you don\'t want it.', 'crellyslider'); ?>
349
+ </td>
350
+ </tr>
351
  <tr>
352
  <td class="cs-name"><?php _e('Custom CSS', 'crellyslider'); ?></td>
353
  <td class="cs-content">
398
  <td><?php _e('Description', 'crellyslider'); ?></td>
399
  </tr>
400
  <tr>
401
+ <td class="cs-name"><?php _e('Modify image', 'crellyslider'); ?></td>
402
  <td class="cs-content">
403
  <?php
404
+ if($void) echo '<input class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crellyslider') . '" />';
405
+ else echo '<input data-src="' . $element->image_src . '" data-alt="' . $element->image_alt . '" class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crellyslider') . '" />';
406
  ?>
407
  </td>
408
  <td class="cs-description">
409
+ <?php _e('Change the image source or the alt text.', 'crellyslider'); ?>
410
  </td>
411
  </tr>
412
  <tr>
537
  <?php _e('How long will the out animation take.', 'crellyslider'); ?>
538
  </td>
539
  </tr>
540
+ <tr>
541
+ <td class="cs-name"><?php _e('Link', 'crellyslider'); ?></td>
542
+ <td class="cs-content">
543
+ <?php
544
+ if($void) echo '<input class="cs-element-link" type="text" value="" />';
545
+ else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
546
+ ?>
547
+ <br />
548
+ <?php
549
+ if($void) echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crellyslider');
550
+ else {
551
+ if($element->link_new_tab) {
552
+ echo '<input class="cs-element-link_new_tab" type="checkbox" checked />' . __('Open link in a new tab', 'crellyslider');
553
+ }
554
+ else {
555
+ echo '<input class="cs-element-link_new_tab" type="checkbox" />' . __('Open link in a new tab', 'crellyslider');
556
+ }
557
+ }
558
+ ?>
559
+ </td>
560
+ <td class="cs-description">
561
+ <?php _e('Open the link (e.g.: http://www.google.it) on click. Leave it empty if you don\'t want it.', 'crellyslider'); ?>
562
+ </td>
563
+ </tr>
564
  <tr>
565
  <td class="cs-name"><?php _e('Custom CSS', 'crellyslider'); ?></td>
566
  <td class="cs-content">
wordpress/frontend.php CHANGED
@@ -10,7 +10,20 @@ function getCrellySlider($alias) {
10
  }
11
 
12
  class CrellySliderFrontend {
13
-
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  // Shortcode
15
  public static function shortcode($atts) {
16
  $a = shortcode_atts( array(
@@ -75,44 +88,75 @@ class CrellySliderFrontend {
75
  $elements = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = ' . $slider_id . ' AND slide_parent = ' . $slide_parent);
76
 
77
  foreach($elements as $element) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  switch($element->type) {
79
  case 'text':
80
- $output .= '<p' . "\n" .
81
- 'style="' .
82
- 'z-index: ' . $element->z_index . ';' . "\n" .
83
- stripslashes($element->custom_css) . "\n" .
84
- '"' . "\n" .
85
- 'data-delay="' . $element->data_delay . '"' . "\n" .
86
- 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
87
- 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
88
- 'data-in="' . $element->data_in . '"' . "\n" .
89
- 'data-out="' . $element->data_out . '"' . "\n" .
90
- 'data-top="' . $element->data_top . '"' . "\n" .
91
- 'data-left="' . $element->data_left . '"' . "\n" .
92
- 'data-time="' . $element->data_time . '"' . "\n" .
93
- '>' . "\n" .
 
 
 
 
94
  stripslashes($element->inner_html) . "\n" .
95
- '</p>' . "\n";
96
  break;
97
  case 'image':
98
  $output .= '<img' . "\n" .
99
  'src="' . $element->image_src . '"' . "\n" .
100
  'alt="' . $element->image_alt . '"' . "\n" .
101
- 'style="' . "\n" .
102
- 'z-index: ' . $element->z_index . ';' . "\n" .
103
- stripslashes($element->custom_css) . "\n" .
104
- '"' . "\n" .
105
- 'data-delay="' . $element->data_delay . '"' . "\n" .
106
- 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
107
- 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
108
- 'data-in="' . $element->data_in . '"' . "\n" .
109
- 'data-out="' . $element->data_out . '"' . "\n" .
110
- 'data-top="' . $element->data_top . '"' . "\n" .
111
- 'data-left="' . $element->data_left . '"' . "\n" .
112
- 'data-time="' . $element->data_time . '"' . "\n" .
113
- '/>' . "\n";
 
 
 
 
114
  break;
115
  }
 
 
 
 
116
  }
117
 
118
  $output .= '</li>' . "\n";
@@ -121,7 +165,8 @@ class CrellySliderFrontend {
121
  $output .= '</div>' . "\n";
122
 
123
  $output .= '<script type="text/javascript">' . "\n";
124
- $output .= 'jQuery(document).ready(function($) {' . "\n";
 
125
  $output .= '$("#crellyslider-' . $slider_id . '").crellySlider({' . "\n";
126
  $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
127
  $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
@@ -135,6 +180,7 @@ class CrellySliderFrontend {
135
  $output .= $slider->callbacks . "\n";
136
  $output .= '});' . "\n";
137
  $output .= '});' . "\n";
 
138
  $output .= '</script>' . "\n";
139
 
140
  if($echo) {
10
  }
11
 
12
  class CrellySliderFrontend {
13
+
14
+ // Avoid incompatibility issues
15
+ public static function notAdminJs() {
16
+ ?>
17
+ <script type="text/javascript">
18
+ var crellyslider_is_wordpress_admin = false;
19
+ </script>
20
+ <?php
21
+ }
22
+
23
+ public static function setNotAdminJs() {
24
+ add_action('wp_enqueue_scripts', 'CrellySliderFrontend::notAdminJs');
25
+ }
26
+
27
  // Shortcode
28
  public static function shortcode($atts) {
29
  $a = shortcode_atts( array(
88
  $elements = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = ' . $slider_id . ' AND slide_parent = ' . $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="' . $element->data_delay . '"' . "\n" .
96
+ 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
97
+ 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
98
+ 'data-in="' . $element->data_in . '"' . "\n" .
99
+ 'data-out="' . $element->data_out . '"' . "\n" .
100
+ 'data-top="' . $element->data_top . '"' . "\n" .
101
+ 'data-left="' . $element->data_left . '"' . "\n" .
102
+ 'data-time="' . $element->data_time . '"' . "\n" .
103
+ 'href="' . stripslashes($element->link) . '"' . "\n" .
104
+ $target . "\n" .
105
+ 'style="' .
106
+ 'z-index: ' . $element->z_index . ';' . "\n" .
107
+ '">' . "\n";
108
+ }
109
+
110
  switch($element->type) {
111
  case 'text':
112
+ $output .= '<div' . "\n" .
113
+ 'style="';
114
+ if($element->link == '') {
115
+ $output .= 'z-index: ' . $element->z_index . ';' . "\n";
116
+ }
117
+ $output .= stripslashes($element->custom_css) . "\n" .
118
+ '"' . "\n";
119
+ if($element->link == '') {
120
+ $output .= 'data-delay="' . $element->data_delay . '"' . "\n" .
121
+ 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
122
+ 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
123
+ 'data-in="' . $element->data_in . '"' . "\n" .
124
+ 'data-out="' . $element->data_out . '"' . "\n" .
125
+ 'data-top="' . $element->data_top . '"' . "\n" .
126
+ 'data-left="' . $element->data_left . '"' . "\n" .
127
+ 'data-time="' . $element->data_time . '"' . "\n";
128
+ }
129
+ $output .= '>' . "\n" .
130
  stripslashes($element->inner_html) . "\n" .
131
+ '</div>' . "\n";
132
  break;
133
  case 'image':
134
  $output .= '<img' . "\n" .
135
  'src="' . $element->image_src . '"' . "\n" .
136
  'alt="' . $element->image_alt . '"' . "\n" .
137
+ 'style="' . "\n";
138
+ if($element->link == '') {
139
+ $output .= 'z-index: ' . $element->z_index . ';' . "\n";
140
+ }
141
+ $output .= stripslashes($element->custom_css) . "\n" .
142
+ '"' . "\n";
143
+ if($element->link == '') {
144
+ $output .= 'data-delay="' . $element->data_delay . '"' . "\n" .
145
+ 'data-ease-in="' . $element->data_easeIn . '"' . "\n" .
146
+ 'data-ease-out="' . $element->data_easeOut . '"' . "\n" .
147
+ 'data-in="' . $element->data_in . '"' . "\n" .
148
+ 'data-out="' . $element->data_out . '"' . "\n" .
149
+ 'data-top="' . $element->data_top . '"' . "\n" .
150
+ 'data-left="' . $element->data_left . '"' . "\n" .
151
+ 'data-time="' . $element->data_time . '"' . "\n";
152
+ }
153
+ $output .= '/>' . "\n";
154
  break;
155
  }
156
+
157
+ if($element->link != '') {
158
+ $output .= '</a>' . "\n";
159
+ }
160
  }
161
 
162
  $output .= '</li>' . "\n";
165
  $output .= '</div>' . "\n";
166
 
167
  $output .= '<script type="text/javascript">' . "\n";
168
+ $output .= '(function($) {' . "\n";
169
+ $output .= '$(document).ready(function() {' . "\n";
170
  $output .= '$("#crellyslider-' . $slider_id . '").crellySlider({' . "\n";
171
  $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
172
  $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
180
  $output .= $slider->callbacks . "\n";
181
  $output .= '});' . "\n";
182
  $output .= '});' . "\n";
183
+ $output .= '})(jQuery);' . "\n";
184
  $output .= '</script>' . "\n";
185
 
186
  if($echo) {
wordpress/images/menu-icon.png ADDED
Binary file
wordpress/js/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function($) {
2
  $(window).load(function() {
3
 
4
  // Run tabs
@@ -442,6 +442,9 @@ jQuery(document).ready(function($) {
442
  // Do not click the editing-area
443
  e.stopPropagation();
444
 
 
 
 
445
  crellyslider_selectElement($(this));
446
  });
447
  function crellyslider_selectElement(element) {
@@ -482,7 +485,7 @@ jQuery(document).ready(function($) {
482
 
483
  // Delete element. Remember that the button should be enabled / disabled somewhere else
484
  function crellyslider_deleteElement(element) {
485
- var index = element.index('.cs-element');
486
  var slide_parent = element.closest('.cs-slide');
487
 
488
  element.remove();
@@ -502,11 +505,11 @@ jQuery(document).ready(function($) {
502
  });
503
 
504
  function crellyslider_duplicateElement(element) {
505
- var index = element.index('.cs-element');
506
  var slide_parent = element.closest('.cs-slide');
507
 
508
  element.clone().appendTo(element.parent());
509
- var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
510
  element_options.clone().insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
511
 
512
  crellyslider_deselectElements();
@@ -517,7 +520,11 @@ jQuery(document).ready(function($) {
517
 
518
  cloned_options.find('.cs-element-data_in').val(element_options.find('.cs-element-data_in').val());
519
  cloned_options.find('.cs-element-data_out').val(element_options.find('.cs-element-data_out').val());
520
- cloned_options.find('.cs-element-custom_css').val(element_options.find('.cs-element-custom_css').val());
 
 
 
 
521
 
522
  // Make draggable
523
  crellyslider_draggableElements();
@@ -551,20 +558,95 @@ jQuery(document).ready(function($) {
551
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
552
  });
553
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  // Apply custom CSS
555
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
556
- var index = $(this).closest('.cs-element-settings').index();
 
 
 
 
557
  // Save current positions
558
- var left = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
559
- var top = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
560
- var z_index = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
561
 
562
  // Apply CSS
563
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', $(this).val());
564
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
565
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
566
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
567
- });
 
 
 
 
 
 
568
 
569
  // TEXT ELEMENTS
570
 
@@ -581,7 +663,7 @@ jQuery(document).ready(function($) {
581
  var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
582
 
583
  // Insert in editing area
584
- area.append('<p class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</p>');
585
 
586
  // Insert the options
587
  settings_div.before(settings);
@@ -596,7 +678,14 @@ jQuery(document).ready(function($) {
596
  // Modify text
597
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
598
  var index = $(this).closest('.cs-element-settings').index();
599
- $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').html($(this).val());
 
 
 
 
 
 
 
600
  });
601
 
602
  // IMAGE ELEMENTS
@@ -667,12 +756,19 @@ jQuery(document).ready(function($) {
667
  var image_src = attachment.url;
668
  var image_alt = attachment.alt;
669
 
670
- // Set attributes
671
  var image = area.find('.cs-image-element.active').last();
672
- image.attr('src', image_src);
673
- image.attr('alt', image_alt);
674
 
675
- // Set data (will be used in tha ajax call)
 
 
 
 
 
 
 
 
 
676
  settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', image_src);
677
  settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
678
  });
@@ -803,6 +899,11 @@ jQuery(document).ready(function($) {
803
 
804
  // Delete slider
805
  $('.cs-admin .cs-home .cs-sliders-list .cs-delete-slider').click(function() {
 
 
 
 
 
806
  crellyslider_deleteSlider($(this));
807
  });
808
 
@@ -853,7 +954,9 @@ jQuery(document).ready(function($) {
853
  },
854
 
855
  error: function(XMLHttpRequest, textStatus, errorThrown) {
856
- alert("Status: " + textStatus); alert("Error: " + errorThrown);
 
 
857
  crellyslider_showError();
858
  }
859
  });
@@ -912,7 +1015,9 @@ jQuery(document).ready(function($) {
912
  },
913
 
914
  error: function(XMLHttpRequest, textStatus, errorThrown) {
915
- alert("Status: " + textStatus); alert("Error: " + errorThrown);
 
 
916
  crellyslider_showError();
917
  }
918
  });
@@ -955,6 +1060,8 @@ jQuery(document).ready(function($) {
955
  data_easeIn : parseInt(element.find('.cs-element-data_easeIn').val()),
956
  data_easeOut : parseInt(element.find('.cs-element-data_easeOut').val()),
957
  custom_css : element.find('.cs-element-custom_css').val(),
 
 
958
  };
959
 
960
  final_options[j] = options;
@@ -987,7 +1094,9 @@ jQuery(document).ready(function($) {
987
  },
988
 
989
  error: function(XMLHttpRequest, textStatus, errorThrown) {
990
- alert("Status: " + textStatus); alert("Error: " + errorThrown);
 
 
991
  crellyslider_showError();
992
  }
993
  });
@@ -1020,11 +1129,13 @@ jQuery(document).ready(function($) {
1020
  },
1021
 
1022
  error: function(XMLHttpRequest, textStatus, errorThrown) {
1023
- alert("Status: " + textStatus); alert("Error: " + errorThrown);
 
 
1024
  crellyslider_showError();
1025
  },
1026
  });
1027
  }
1028
 
1029
  });
1030
- });
1
+ (function($) {
2
  $(window).load(function() {
3
 
4
  // Run tabs
442
  // Do not click the editing-area
443
  e.stopPropagation();
444
 
445
+ // Do not open links
446
+ e.preventDefault();
447
+
448
  crellyslider_selectElement($(this));
449
  });
450
  function crellyslider_selectElement(element) {
485
 
486
  // Delete element. Remember that the button should be enabled / disabled somewhere else
487
  function crellyslider_deleteElement(element) {
488
+ var index = element.index();
489
  var slide_parent = element.closest('.cs-slide');
490
 
491
  element.remove();
505
  });
506
 
507
  function crellyslider_duplicateElement(element) {
508
+ var index = element.index();
509
  var slide_parent = element.closest('.cs-slide');
510
 
511
  element.clone().appendTo(element.parent());
512
+ var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
513
  element_options.clone().insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
514
 
515
  crellyslider_deselectElements();
520
 
521
  cloned_options.find('.cs-element-data_in').val(element_options.find('.cs-element-data_in').val());
522
  cloned_options.find('.cs-element-data_out').val(element_options.find('.cs-element-data_out').val());
523
+ cloned_options.find('.cs-element-custom_css').val(element_options.find('.cs-element-custom_css').val());
524
+ if(element_options.hasClass('cs-image-element-settings')) {
525
+ cloned_options.find('.cs-image-element-upload-button').data('src', element_options.find('.cs-image-element-upload-button').data('src'));
526
+ cloned_options.find('.cs-image-element-upload-button').data('alt', element_options.find('.cs-image-element-upload-button').data('alt'));
527
+ }
528
 
529
  // Make draggable
530
  crellyslider_draggableElements();
558
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
559
  });
560
 
561
+ // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
562
+ $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
563
+ crellyslider_editElementsLink($(this));
564
+ });
565
+ $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link_new_tab', function() {
566
+ var textbox = $(this).parent().find('.cs-element-link');
567
+ crellyslider_editElementsLink(textbox);
568
+ });
569
+
570
+ // Wrap - unwrap elements with an <a href="" target="">
571
+ function crellyslider_editElementsLink(textbox_link) {
572
+ var index = textbox_link.closest('.cs-element-settings').index();
573
+ var copy_attributes = false;
574
+ var reapply_css = false;
575
+
576
+ if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
577
+ var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
578
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
579
+ copy_attributes = true;
580
+ reapply_css = true;
581
+ }
582
+ else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
583
+ var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
584
+
585
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
586
+
587
+ if(link_new_tab) {
588
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
589
+ }
590
+ else {
591
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
592
+ }
593
+
594
+ copy_attributes = false;
595
+ }
596
+ else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
597
+ 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');
598
+
599
+ // Reapply CSS and custom CSS
600
+ applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
601
+ 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'));
602
+ 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'));
603
+ 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'));
604
+
605
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
606
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
607
+ copy_attributes = false;
608
+ }
609
+
610
+ if(copy_attributes) {
611
+ 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'));
612
+ 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');
613
+
614
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
615
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
616
+ textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
617
+ }
618
+
619
+ crellyslider_draggableElements();
620
+
621
+ if(reapply_css) {
622
+ applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
623
+ }
624
+ }
625
+
626
  // Apply custom CSS
627
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
628
+ applyCustomCss($(this));
629
+ });
630
+
631
+ function applyCustomCss(textarea) {
632
+ var index = textarea.closest('.cs-element-settings').index();
633
  // Save current positions
634
+ var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
635
+ var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
636
+ var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
637
 
638
  // Apply CSS
639
+ if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a')) {
640
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
641
+ }
642
+ else {
643
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('style', textarea.val());
644
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeAttr('style');
645
+ }
646
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
647
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
648
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
649
+ }
650
 
651
  // TEXT ELEMENTS
652
 
663
  var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
664
 
665
  // Insert in editing area
666
+ area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
667
 
668
  // Insert the options
669
  settings_div.before(settings);
678
  // Modify text
679
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
680
  var index = $(this).closest('.cs-element-settings').index();
681
+ var text_element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
682
+
683
+ if(! text_element.is('a')) {
684
+ text_element.html($(this).val());
685
+ }
686
+ else {
687
+ text_element.find('> div').html($(this).val());
688
+ }
689
  });
690
 
691
  // IMAGE ELEMENTS
756
  var image_src = attachment.url;
757
  var image_alt = attachment.alt;
758
 
759
+ // Set attributes. If is a link, do the right thing
760
  var image = area.find('.cs-image-element.active').last();
 
 
761
 
762
+ if(! image.is('a')) {
763
+ image.attr('src', image_src);
764
+ image.attr('alt', image_alt);
765
+ }
766
+ else {
767
+ image.find('> img').attr('src', image_src);
768
+ image.find('> img').attr('alt', image_alt);
769
+ }
770
+
771
+ // Set data (will be used in the ajax call)
772
  settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', image_src);
773
  settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
774
  });
899
 
900
  // Delete slider
901
  $('.cs-admin .cs-home .cs-sliders-list .cs-delete-slider').click(function() {
902
+ var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
903
+ if(!confirm) {
904
+ return;
905
+ }
906
+
907
  crellyslider_deleteSlider($(this));
908
  });
909
 
954
  },
955
 
956
  error: function(XMLHttpRequest, textStatus, errorThrown) {
957
+ alert('Error saving slider');
958
+ alert("Status: " + textStatus);
959
+ alert("Error: " + errorThrown);
960
  crellyslider_showError();
961
  }
962
  });
1015
  },
1016
 
1017
  error: function(XMLHttpRequest, textStatus, errorThrown) {
1018
+ alert('Error saving slides');
1019
+ alert("Status: " + textStatus);
1020
+ alert("Error: " + errorThrown);
1021
  crellyslider_showError();
1022
  }
1023
  });
1060
  data_easeIn : parseInt(element.find('.cs-element-data_easeIn').val()),
1061
  data_easeOut : parseInt(element.find('.cs-element-data_easeOut').val()),
1062
  custom_css : element.find('.cs-element-custom_css').val(),
1063
+ link : element.find('.cs-element-link').val(),
1064
+ link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1065
  };
1066
 
1067
  final_options[j] = options;
1094
  },
1095
 
1096
  error: function(XMLHttpRequest, textStatus, errorThrown) {
1097
+ alert('Error saving elements');
1098
+ alert("Status: " + textStatus);
1099
+ alert("Error: " + errorThrown);
1100
  crellyslider_showError();
1101
  }
1102
  });
1129
  },
1130
 
1131
  error: function(XMLHttpRequest, textStatus, errorThrown) {
1132
+ alert('Error deleting slider');
1133
+ alert("Status: " + textStatus);
1134
+ alert("Error: " + errorThrown);
1135
  crellyslider_showError();
1136
  },
1137
  });
1138
  }
1139
 
1140
  });
1141
+ })(jQuery);
wordpress/slides.php CHANGED
@@ -63,7 +63,7 @@ function crellyslider_printSlide($slider, $slide, $edit) {
63
  <table class="cs-slide-settings-list cs-table">
64
  <thead>
65
  <tr class="odd-row">
66
- <th colspan="3"><?php _e('Slides General Options', 'crellyslider'); ?></th>
67
  </tr>
68
  </thead>
69
 
63
  <table class="cs-slide-settings-list cs-table">
64
  <thead>
65
  <tr class="odd-row">
66
+ <th colspan="3"><?php _e('Slide Options', 'crellyslider'); ?></th>
67
  </tr>
68
  </thead>
69
 
wordpress/tables.php CHANGED
@@ -94,6 +94,8 @@ class CrellySliderTables {
94
  inner_html TEXT CHARACTER SET utf8,
95
  image_src TEXT CHARACTER SET utf8,
96
  image_alt TEXT CHARACTER SET utf8,
 
 
97
  UNIQUE KEY id (id)
98
  );";
99
 
94
  inner_html TEXT CHARACTER SET utf8,
95
  image_src TEXT CHARACTER SET utf8,
96
  image_alt TEXT CHARACTER SET utf8,
97
+ link VARCHAR(100) CHARACTER SET utf8 DEFAULT '',
98
+ link_new_tab INT DEFAULT 0,
99
  UNIQUE KEY id (id)
100
  );";
101