Crelly Slider - Version 1.2.0

Version Description

  • New feature: texts can be edited with the default WordPress editor (TinyMCE)
  • New feature: the order of the slides can be set to "random"
  • New feature: you can select the first slide that will be displayed
  • New feature: slides can be marked as "draft"
  • New feature: Crelly Slider is now compatible with WP Offload S3
  • Improvement: the YouTube and the Vimeo APIs won't be loaded unless there is a video in the slider
  • Bug fix: when a text element was selected and then modified, the black box around it wasn't correctly adapted to fit the new dimensions
  • Bug fix: when a slide was cloned, it was impossible to change its background color and to move its elements, unless by refreshing the page
  • Bug fix: improved compatibility for some web hosting providers that restricted the import/export functions
  • Bug fix: when you added a really large image element, the element options were covered by the image
  • Other minor changes and bug fixes
Download this release

Release Info

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

Code changes from version 1.1.2 to 1.2.0

crellyslider.php CHANGED
@@ -1,17 +1,17 @@
1
  <?php
2
  /**
3
  * Plugin Name: Crelly Slider
4
- * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
5
- * Description: A free responsive slider that supports layers. Add texts, images and videos using a Drop & Builder.
6
- * Version: 1.1.2
7
- * Author: fabiorino
8
- * Author URI: http://fabiorino1.altervista.org
9
  * Text Domain: crelly-slider
10
  * Domain Path: /wordpress/languages
11
  * License: MIT
12
  */
13
 
14
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
 
16
  /*************/
17
  /** GLOBALS **/
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
 
20
  define('CS_DEBUG', false);
21
 
22
- define('CS_VERSION', '1.1.2');
23
  define('CS_PATH', plugin_dir_path(__FILE__));
24
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
25
 
@@ -30,8 +30,7 @@ require_once CS_PATH . 'wordpress/frontend.php';
30
  // Create (or remove) 3 tables: the sliders settings, the slides settings and the elements proprieties. We will also store the current version of the plugin
31
  register_activation_hook(__FILE__, array('CrellySliderTables', 'setVersion'));
32
  register_activation_hook(__FILE__, array('CrellySliderTables', 'setTables'));
33
- register_uninstall_hook(__FILE__, array('CrellySliderTables', 'removeVersion'));
34
- register_uninstall_hook(__FILE__, array('CrellySliderTables', 'dropTables'));
35
 
36
  // Languages
37
  CrellySliderCommon::loadPluginTextDomain();
@@ -62,5 +61,4 @@ if(is_admin()) {
62
  // Ajax functions
63
  require_once CS_PATH . 'wordpress/ajax.php';
64
  }
65
-
66
  ?>
1
  <?php
2
  /**
3
  * Plugin Name: Crelly Slider
4
+ * Plugin URI: http://crellyslider.tk/
5
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
+ * Version: 1.2.0
7
+ * Author: Fabio Rinaldi
8
+ * Author URI: https://github.com/fabiorino
9
  * Text Domain: crelly-slider
10
  * Domain Path: /wordpress/languages
11
  * License: MIT
12
  */
13
 
14
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
 
16
  /*************/
17
  /** GLOBALS **/
19
 
20
  define('CS_DEBUG', false);
21
 
22
+ define('CS_VERSION', '1.2.0');
23
  define('CS_PATH', plugin_dir_path(__FILE__));
24
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
25
 
30
  // Create (or remove) 3 tables: the sliders settings, the slides settings and the elements proprieties. We will also store the current version of the plugin
31
  register_activation_hook(__FILE__, array('CrellySliderTables', 'setVersion'));
32
  register_activation_hook(__FILE__, array('CrellySliderTables', 'setTables'));
33
+ register_uninstall_hook(__FILE__, array('CrellySliderTables', 'clearDatabase'));
 
34
 
35
  // Languages
36
  CrellySliderCommon::loadPluginTextDomain();
61
  // Ajax functions
62
  require_once CS_PATH . 'wordpress/ajax.php';
63
  }
 
64
  ?>
css/crellyslider.css CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  .crellyslider {
2
  margin: 0 auto;
3
  position: relative;
@@ -48,8 +58,8 @@
48
  top: 50%;
49
  left: 50%;
50
  margin-top: -25px;
51
- margin-left: -25px;
52
- z-index: 12;
53
  background-color:#fff;
54
  box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
55
  background-repeat: no-repeat;
@@ -168,7 +178,7 @@
168
  margin: 0;
169
  padding: 0;
170
  position: absolute;
171
- overflow: hidden;
172
  -webkit-touch-callout: none;
173
  -webkit-user-select: none;
174
  -khtml-user-select: none;
@@ -249,12 +259,12 @@
249
  text-align: center;
250
  }
251
 
252
- .crellyslider > .cs-navigation > .cs-slide-link {
253
  width: 15px;
254
  height: 15px;
255
  display: inline-block;
256
  cursor: pointer;
257
- margin: 6px;
258
  background-color:#fff;
259
  box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
260
  border: 10px;
@@ -282,4 +292,4 @@
282
  .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
283
  opacity: 0;
284
  filter: alpha(opacity=0);
285
- }
1
+ /**
2
+ * Plugin Name: Crelly Slider
3
+ * Plugin URI: http://crellyslider.tk/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.2.0
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
+ * License: MIT
9
+ */
10
+
11
  .crellyslider {
12
  margin: 0 auto;
13
  position: relative;
58
  top: 50%;
59
  left: 50%;
60
  margin-top: -25px;
61
+ margin-left: -25px;
62
+ z-index: 12;
63
  background-color:#fff;
64
  box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
65
  background-repeat: no-repeat;
178
  margin: 0;
179
  padding: 0;
180
  position: absolute;
181
+ overflow: hidden;
182
  -webkit-touch-callout: none;
183
  -webkit-user-select: none;
184
  -khtml-user-select: none;
259
  text-align: center;
260
  }
261
 
262
+ .crellyslider > .cs-navigation > .cs-slide-link {
263
  width: 15px;
264
  height: 15px;
265
  display: inline-block;
266
  cursor: pointer;
267
+ margin: 6px;
268
  background-color:#fff;
269
  box-shadow:0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23);
270
  border: 10px;
292
  .crellyslider > .cs-progress-bar.cs-progress-bar-hidden {
293
  opacity: 0;
294
  filter: alpha(opacity=0);
295
+ }
demo/demo.html CHANGED
@@ -2,15 +2,15 @@
2
  <html>
3
 
4
  <head>
5
- <meta charset="utf-8" />
6
  <meta name="viewport" content="width=device-width" />
7
-
8
  <title>Crelly Slider - Free jQuery Slider</title>
9
  <meta name="description" content="The first Free Wordpress Slider that supports animations" />
10
-
11
  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
12
  <link rel="stylesheet" type="text/css" href="../css/crellyslider.css" />
13
-
14
  <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
15
  <style type="text/css">
16
  @font-face {font-family:"Bender";src:url("fonts/Bender.eot?") format("eot"),url("fonts/Bender.woff") format("woff"),url("fonts/Bender.ttf") format("truetype"),url("fonts/Bender.svg#Bender") format("svg");font-weight:normal;font-style:normal;}
@@ -22,18 +22,18 @@
22
  line-height: 1.5em;
23
  vertical-align: baseline;
24
  }
25
-
26
  img {
27
  max-width: 100%;
28
  height: auto;
29
  }
30
  </style>
31
-
32
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
33
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
34
  <script type="text/javascript" src="../js/jquery.crellyslider.js"></script> <!-- use jquery.crellyslider.min.js for production -->
35
  </head>
36
-
37
  <body>
38
  <div style="display: none;" class="crellyslider-slider crellyslider-slider-fixed crellyslider-slider-home_slider" id="crellyslider-1">
39
  <ul>
@@ -595,7 +595,7 @@
595
  </li>
596
  </ul>
597
  </div>
598
-
599
  <script type="text/javascript">
600
  (function($) {
601
  $(document).ready(function() {
@@ -604,14 +604,14 @@
604
  responsive : true,
605
  startWidth : 1140,
606
  startHeight : 487,
607
-
608
- pauseOnHover : true,
609
  automaticSlide : false,
610
  showControls : true,
611
  showNavigation : true,
612
  showProgressBar : true,
613
  enableSwipe : true,
614
-
615
  slidesTime : 3000,
616
  elementsDelay : 0,
617
  elementsTime : 'all',
@@ -620,10 +620,10 @@
620
  slidesEaseOut : 300,
621
  elementsEaseOut : 300,
622
  ignoreElementsEaseOut : false,
623
-
624
  videoAutoplay : true,
625
  videoLoop : false,
626
-
627
  beforeStart : function() {},
628
  beforeSetResponsive : function() {},
629
  beforeSlideStart : function() {},
@@ -635,4 +635,4 @@
635
  </script>
636
 
637
  </body>
638
- </html>
2
  <html>
3
 
4
  <head>
5
+ <meta charset="utf-8" />
6
  <meta name="viewport" content="width=device-width" />
7
+
8
  <title>Crelly Slider - Free jQuery Slider</title>
9
  <meta name="description" content="The first Free Wordpress Slider that supports animations" />
10
+
11
  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
12
  <link rel="stylesheet" type="text/css" href="../css/crellyslider.css" />
13
+
14
  <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
15
  <style type="text/css">
16
  @font-face {font-family:"Bender";src:url("fonts/Bender.eot?") format("eot"),url("fonts/Bender.woff") format("woff"),url("fonts/Bender.ttf") format("truetype"),url("fonts/Bender.svg#Bender") format("svg");font-weight:normal;font-style:normal;}
22
  line-height: 1.5em;
23
  vertical-align: baseline;
24
  }
25
+
26
  img {
27
  max-width: 100%;
28
  height: auto;
29
  }
30
  </style>
31
+
32
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
33
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
34
  <script type="text/javascript" src="../js/jquery.crellyslider.js"></script> <!-- use jquery.crellyslider.min.js for production -->
35
  </head>
36
+
37
  <body>
38
  <div style="display: none;" class="crellyslider-slider crellyslider-slider-fixed crellyslider-slider-home_slider" id="crellyslider-1">
39
  <ul>
595
  </li>
596
  </ul>
597
  </div>
598
+
599
  <script type="text/javascript">
600
  (function($) {
601
  $(document).ready(function() {
604
  responsive : true,
605
  startWidth : 1140,
606
  startHeight : 487,
607
+
608
+ pauseOnHover : true,
609
  automaticSlide : false,
610
  showControls : true,
611
  showNavigation : true,
612
  showProgressBar : true,
613
  enableSwipe : true,
614
+
615
  slidesTime : 3000,
616
  elementsDelay : 0,
617
  elementsTime : 'all',
620
  slidesEaseOut : 300,
621
  elementsEaseOut : 300,
622
  ignoreElementsEaseOut : false,
623
+
624
  videoAutoplay : true,
625
  videoLoop : false,
626
+
627
  beforeStart : function() {},
628
  beforeSetResponsive : function() {},
629
  beforeSlideStart : function() {},
635
  </script>
636
 
637
  </body>
638
+ </html>
js/jquery.crellyslider.js CHANGED
@@ -1,13 +1,21 @@
1
  /**
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: 1.1.2
6
- * Author: fabiorino
7
- * Author URI: http://fabiorino1.altervista.org
8
  * License: MIT
9
  */
10
 
 
 
 
 
 
 
 
 
11
  (function($) {
12
 
13
  /************************/
@@ -18,16 +26,24 @@
18
  (function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout(function(){c=0,O()},e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}function j(e){if(g)return;d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),!r&&o===e.target?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
19
 
20
  // YouTube API:
21
- var tag = document.createElement('script');
22
- tag.src = "https://www.youtube.com/iframe_api";
23
- var firstScriptTag = document.getElementsByTagName('script')[0];
24
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
 
 
 
 
25
 
26
  // Vimeo API
27
- var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
28
- return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1;
29
- var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=
30
- window.$f=e}();
 
 
 
 
31
 
32
  /*******************/
33
  /** CRELLY SLIDER **/
@@ -71,8 +87,17 @@
71
  /********************/
72
 
73
  // EVERYTHING BEGINS HERE
 
 
 
 
 
 
 
 
 
74
  // Before initializing Crelly Slider, we have to wait for the YouTube API. I use the setInterval method to prevent compatibility issues with other plugins and to be sure that, if there is more than a slider loaded on the page, everything works
75
- if((typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined')) {
76
  var temp = setInterval(function() {
77
  if(typeof(YT) != 'undefined' && typeof(YT.Player) != 'undefined') {
78
  clearInterval(temp);
@@ -82,6 +107,19 @@
82
  }
83
  else {
84
  init();
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
  // The slider constructor: runs automatically only the first time, sets the basic needs of the slider and the preloader then runs Crelly Slider
@@ -107,6 +145,8 @@
107
  total_slides++;
108
  }
109
 
 
 
110
  // Show controls (previous and next arrows)
111
  if(settings.showControls) {
112
  SLIDER.find(CRELLY).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>');
@@ -153,7 +193,7 @@
153
  'time' : 'all',
154
  });
155
 
156
- setPreloader();
157
 
158
  initVideos().done(function() {
159
  // Timeout needed to prevent compatibility issues
@@ -166,6 +206,58 @@
166
  });
167
  }
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  // Inits Youtube and Vimeo videos
170
  function initVideos() {
171
  var def = new $.Deferred();
@@ -464,18 +556,18 @@
464
 
465
  // Set background. Background is set to both the preloader div and the bg div to fix the CSS blur effect
466
  SLIDER.find(CRELLY).find('.cs-preloader').css({
467
- 'background-color' : getSlide(0).css('background-color'),
468
- 'background-image' : getSlide(0).css('background-image'),
469
- 'background-position' : getSlide(0).css('background-position'),
470
- 'background-repeat' : getSlide(0).css('background-repeat'),
471
- 'background-size' : getSlide(0).css('background-size'),
472
  });
473
  SLIDER.find(CRELLY).find('.cs-preloader > .cs-bg').css({
474
- 'background-color' : getSlide(0).css('background-color'),
475
- 'background-image' : getSlide(0).css('background-image'),
476
- 'background-position' : getSlide(0).css('background-position'),
477
- 'background-repeat' : getSlide(0).css('background-repeat'),
478
- 'background-size' : getSlide(0).css('background-size'),
479
  });
480
  }
481
  }
@@ -948,6 +1040,7 @@
948
  executeSlide(current_slide).done(function() {
949
  if(! paused) {
950
  current_slide = getNextSlide();
 
951
  loopSlides();
952
  }
953
  });
@@ -1994,44 +2087,46 @@
1994
  /**************************/
1995
 
1996
  $.fn.crellySlider = function(options) {
1997
- var settings = $.extend({
1998
- layout : 'fixed',
1999
- responsive : true,
2000
- startWidth : 1140,
2001
- startHeight : 500,
2002
-
2003
- pauseOnHover : true,
2004
- automaticSlide : true,
2005
- showControls : true,
2006
- showNavigation : true,
2007
- showProgressBar : true,
2008
- enableSwipe : true,
2009
-
2010
- slidesTime : 3000,
2011
- elementsDelay : 0,
2012
- elementsTime : 'all',
2013
- slidesEaseIn : 300,
2014
- elementsEaseIn : 300,
2015
- slidesEaseOut : 300,
2016
- elementsEaseOut : 300,
2017
- ignoreElementsEaseOut : false,
2018
-
2019
- videoAutoplay : false,
2020
- videoLoop : false,
2021
-
2022
- beforeStart : function() {},
2023
- beforeSetResponsive : function() {},
2024
- beforeSlideStart : function() {},
2025
- beforePause : function() {},
2026
- beforeResume : function() {},
2027
- }, options);
2028
-
2029
- return this.each(function() {
2030
- if(undefined == $(this).data('crellySlider')) {
2031
- var plugin = new $.CrellySlider(this, settings);
2032
- $(this).data('crellySlider', plugin);
2033
- }
2034
- });
 
 
2035
  };
2036
 
2037
  })(jQuery);
1
  /**
2
  * Plugin Name: Crelly Slider
3
+ * Plugin URI: http://crellyslider.tk/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.2.0
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
  * License: MIT
9
  */
10
 
11
+ /*************/
12
+ /** GLOBALS **/
13
+ /*************/
14
+
15
+ // Using these two variables we can check if we still need to load the APIs for YouTube and Vimeo
16
+ var crellyslider_youtube_api_ready = false;
17
+ var crellyslider_vimeo_api_ready = false;
18
+
19
  (function($) {
20
 
21
  /************************/
26
  (function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout(function(){c=0,O()},e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}function j(e){if(g)return;d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),!r&&o===e.target?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
27
 
28
  // YouTube API:
29
+ function loadYoutubeAPI() {
30
+ var tag = document.createElement('script');
31
+ tag.src = "https://www.youtube.com/iframe_api";
32
+ var firstScriptTag = document.getElementsByTagName('script')[0];
33
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
34
+
35
+ crellyslider_youtube_api_ready = true;
36
+ }
37
 
38
  // Vimeo API
39
+ function loadVimeoAPI() {
40
+ var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
41
+ return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1;
42
+ var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=
43
+ window.$f=e}();
44
+
45
+ crellyslider_vimeo_api_ready = true;
46
+ }
47
 
48
  /*******************/
49
  /** CRELLY SLIDER **/
87
  /********************/
88
 
89
  // EVERYTHING BEGINS HERE
90
+
91
+ // Load necessary APIs
92
+ if(! crellyslider_youtube_api_ready && thereAreVideos('youtube')) {
93
+ loadYoutubeAPI();
94
+ }
95
+ if(! crellyslider_vimeo_api_ready && thereAreVideos('vimeo')) {
96
+ loadVimeoAPI();
97
+ }
98
+
99
  // Before initializing Crelly Slider, we have to wait for the YouTube API. I use the setInterval method to prevent compatibility issues with other plugins and to be sure that, if there is more than a slider loaded on the page, everything works
100
+ if(crellyslider_youtube_api_ready && (typeof(YT) == 'undefined' || typeof(YT.Player) == 'undefined')) {
101
  var temp = setInterval(function() {
102
  if(typeof(YT) != 'undefined' && typeof(YT.Player) != 'undefined') {
103
  clearInterval(temp);
107
  }
108
  else {
109
  init();
110
+ }
111
+
112
+ // Returns an array like this: {youtube = true, vimeo = false} if there are YouTube videos but not Vimeo videos
113
+ // This function can be called before init()
114
+ function thereAreVideos(platform) {
115
+ if(platform == 'youtube') {
116
+ return SLIDER.find('.cs-yt-iframe').length > 0 ? true : false;
117
+ }
118
+ if(platform == 'vimeo') {
119
+ return SLIDER.find('.cs-vimeo-iframe').length > 0 ? true : false;
120
+ }
121
+
122
+ return -1;
123
  }
124
 
125
  // The slider constructor: runs automatically only the first time, sets the basic needs of the slider and the preloader then runs Crelly Slider
145
  total_slides++;
146
  }
147
 
148
+ orderSlides();
149
+
150
  // Show controls (previous and next arrows)
151
  if(settings.showControls) {
152
  SLIDER.find(CRELLY).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>');
193
  'time' : 'all',
194
  });
195
 
196
+ setPreloader();
197
 
198
  initVideos().done(function() {
199
  // Timeout needed to prevent compatibility issues
206
  });
207
  }
208
 
209
+ // Orders the slides by rearranging them in the DOM
210
+ function orderSlides() {
211
+ // If randomOrder is disabled and the initial slide is the first, the slides are already ordered
212
+ if(! settings.randomOrder && settings.startFromSlide == 0) {
213
+ return;
214
+ }
215
+
216
+ var slides_order = new Array();
217
+ var ordered_slides = new Array();
218
+
219
+ // Set the first slide according to the settings
220
+ if(settings.startFromSlide == -1) {
221
+ var index = Math.floor((Math.random() * total_slides));
222
+ slides_order[0] = index;
223
+ ordered_slides[0] = getSlide(index);
224
+ }
225
+ else {
226
+ slides_order[0] = settings.startFromSlide;
227
+ ordered_slides[0] = getSlide(settings.startFromSlide);
228
+ }
229
+
230
+ // Set all the other slides
231
+ for(var i = 1; i < total_slides; i++) {
232
+ var index;
233
+
234
+ if(settings.randomOrder) { // Get a random slide index that was never generated before
235
+ do {
236
+ index = Math.floor((Math.random() * total_slides));
237
+ } while(slides_order.indexOf(index) != -1);
238
+ }
239
+ else { // Get the next index
240
+ if(i + slides_order[0] < total_slides) {
241
+ index = i + slides_order[0];
242
+ }
243
+ else {
244
+ index = i + slides_order[0] - total_slides;
245
+ }
246
+ }
247
+
248
+ slides_order[i] = index;
249
+ ordered_slides[i] = getSlide(index);
250
+ }
251
+
252
+ // Delete all the slides
253
+ SLIDER.find(CRELLY).find(SLIDES).empty();
254
+
255
+ // Put the slides that are now ordered
256
+ for(var i = 0; i < total_slides; i++) {
257
+ SLIDER.find(CRELLY).find(SLIDES).append(ordered_slides[i]);
258
+ }
259
+ }
260
+
261
  // Inits Youtube and Vimeo videos
262
  function initVideos() {
263
  var def = new $.Deferred();
556
 
557
  // Set background. Background is set to both the preloader div and the bg div to fix the CSS blur effect
558
  SLIDER.find(CRELLY).find('.cs-preloader').css({
559
+ 'background-color' : getSlide(current_slide).css('background-color'),
560
+ 'background-image' : getSlide(current_slide).css('background-image'),
561
+ 'background-position' : getSlide(current_slide).css('background-position'),
562
+ 'background-repeat' : getSlide(current_slide).css('background-repeat'),
563
+ 'background-size' : getSlide(current_slide).css('background-size'),
564
  });
565
  SLIDER.find(CRELLY).find('.cs-preloader > .cs-bg').css({
566
+ 'background-color' : getSlide(current_slide).css('background-color'),
567
+ 'background-image' : getSlide(current_slide).css('background-image'),
568
+ 'background-position' : getSlide(current_slide).css('background-position'),
569
+ 'background-repeat' : getSlide(current_slide).css('background-repeat'),
570
+ 'background-size' : getSlide(current_slide).css('background-size'),
571
  });
572
  }
573
  }
1040
  executeSlide(current_slide).done(function() {
1041
  if(! paused) {
1042
  current_slide = getNextSlide();
1043
+
1044
  loopSlides();
1045
  }
1046
  });
2087
  /**************************/
2088
 
2089
  $.fn.crellySlider = function(options) {
2090
+ var settings = $.extend({
2091
+ layout : 'fixed',
2092
+ responsive : true,
2093
+ startWidth : 1140,
2094
+ startHeight : 500,
2095
+
2096
+ pauseOnHover : true,
2097
+ automaticSlide : true,
2098
+ randomOrder : true,
2099
+ startFromSlide : 0, // -1 means random, >= 0 means the exact index
2100
+ showControls : true,
2101
+ showNavigation : true,
2102
+ showProgressBar : true,
2103
+ enableSwipe : true,
2104
+
2105
+ slidesTime : 3000,
2106
+ elementsDelay : 0,
2107
+ elementsTime : 'all',
2108
+ slidesEaseIn : 300,
2109
+ elementsEaseIn : 300,
2110
+ slidesEaseOut : 300,
2111
+ elementsEaseOut : 300,
2112
+ ignoreElementsEaseOut : false,
2113
+
2114
+ videoAutoplay : false,
2115
+ videoLoop : false,
2116
+
2117
+ beforeStart : function() {},
2118
+ beforeSetResponsive : function() {},
2119
+ beforeSlideStart : function() {},
2120
+ beforePause : function() {},
2121
+ beforeResume : function() {},
2122
+ }, options);
2123
+
2124
+ return this.each(function() {
2125
+ if(undefined == $(this).data('crellySlider')) {
2126
+ var plugin = new $.CrellySlider(this, settings);
2127
+ $(this).data('crellySlider', plugin);
2128
+ }
2129
+ });
2130
  };
2131
 
2132
  })(jQuery);
js/jquery.crellyslider.min.js CHANGED
@@ -1,11 +1,11 @@
1
  /**
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: 1.1.2
6
- * Author: fabiorino
7
- * Author URI: http://fabiorino1.altervista.org
8
  * License: MIT
9
  */
10
 
11
- !function(e){!function(e,t,n){"function"==typeof define&&define.amd?define(["jquery"],function(i){return n(i,e,t),i.mobile}):n(e.jQuery,e,t)}(this,document,function(e,t,n,i){!function(e,t,n,i){function a(e){for(;e&&"undefined"!=typeof e.originalEvent;)e=e.originalEvent;return e}function o(t,n){var o,s,r,c,l,d,p,f,u,h=t.type;if(t=e.Event(t),t.type=n,o=t.originalEvent,s=e.event.props,h.search(/^(mouse|click)/)>-1&&(s=Y),o)for(p=s.length,c;p;)c=s[--p],t[c]=o[c];if(h.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==h.search(/^touch/)&&(r=a(o),h=r.touches,l=r.changedTouches,d=h&&h.length?h[0]:l&&l.length?l[0]:i,d))for(f=0,u=P.length;u>f;f++)c=P[f],t[c]=d[c];return t}function s(t){for(var n,i,a={};t;){n=e.data(t,S);for(i in n)n[i]&&(a[i]=a.hasVirtualBinding=!0);t=t.parentNode}return a}function r(t,n){for(var i;t;){if(i=e.data(t,S),i&&(!n||i[n]))return t;t=t.parentNode}return null}function c(){X=!1}function l(){X=!0}function d(){W=0,C.length=0,z=!1,l()}function p(){c()}function f(){u(),F=setTimeout(function(){F=0,d()},e.vmouse.resetTimerDuration)}function u(){F&&(clearTimeout(F),F=0)}function h(t,n,i){var a;return(i&&i[t]||!i&&r(n.target,t))&&(a=o(n,t),e(n.target).trigger(a)),a}function v(t){var n,i=e.data(t.target,E);!z&&(!W||W!==i)&&(n=h("v"+t.type,t),n&&(n.isDefaultPrevented()&&t.preventDefault(),n.isPropagationStopped()&&t.stopPropagation(),n.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function m(t){var n,i,o,r=a(t).touches;r&&1===r.length&&(n=t.target,i=s(n),i.hasVirtualBinding&&(W=_++,e.data(n,E,W),u(),p(),M=!1,o=a(t).touches[0],O=o.pageX,R=o.pageY,h("vmouseover",t,i),h("vmousedown",t,i)))}function y(e){X||(M||h("vmousecancel",e,s(e.target)),M=!0,f())}function g(t){if(!X){var n=a(t).touches[0],i=M,o=e.vmouse.moveDistanceThreshold,r=s(t.target);M=M||Math.abs(n.pageX-O)>o||Math.abs(n.pageY-R)>o,M&&!i&&h("vmousecancel",t,r),h("vmousemove",t,r),f()}}function b(e){if(!X){l();var t,n,i=s(e.target);h("vmouseup",e,i),M||(t=h("vclick",e,i),t&&t.isDefaultPrevented()&&(n=a(e).changedTouches[0],C.push({touchID:W,x:n.clientX,y:n.clientY}),z=!0)),h("vmouseout",e,i),M=!1,f()}}function w(t){var n,i=e.data(t,S);if(i)for(n in i)if(i[n])return!0;return!1}function k(){}function D(t){var n=t.substr(1);return{setup:function(){w(this)||e.data(this,S,{});var i=e.data(this,S);i[t]=!0,x[t]=(x[t]||0)+1,1===x[t]&&H.bind(n,v),e(this).bind(n,k),B&&(x.touchstart=(x.touchstart||0)+1,1===x.touchstart&&H.bind("touchstart",m).bind("touchend",b).bind("touchmove",g).bind("scroll",y))},teardown:function(){--x[t],x[t]||H.unbind(n,v),B&&(--x.touchstart,x.touchstart||H.unbind("touchstart",m).unbind("touchmove",g).unbind("touchend",b).unbind("scroll",y));var i=e(this),a=e.data(this,S);a&&(a[t]=!1),i.unbind(n,k),w(this)||i.removeData(S)}}}var T,I,S="virtualMouseBindings",E="virtualTouchID",N="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),P="clientX clientY pageX pageY screenX screenY".split(" "),L=e.event.mouseHooks?e.event.mouseHooks.props:[],Y=e.event.props.concat(L),x={},F=0,O=0,R=0,M=!1,C=[],z=!1,X=!1,B="addEventListener"in n,H=e(n),_=1,W=0;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},I=0;I<N.length;I++)e.event.special[N[I]]=D(N[I]);B&&n.addEventListener("click",function(t){var n,i,a,o,s,r,c=C.length,l=t.target;if(c)for(n=t.clientX,i=t.clientY,T=e.vmouse.clickDistanceThreshold,a=l;a;){for(o=0;c>o;o++)if(s=C[o],r=0,a===l&&Math.abs(s.x-n)<T&&Math.abs(s.y-i)<T||e.data(a,E)===s.touchID)return t.preventDefault(),void t.stopPropagation();a=a.parentNode}},!0)}(e,t,n),function(e){e.mobile={}}(e),function(e,t){var i={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,i),e.extend(e.mobile.support,i)}(e),function(e,t,i){function a(t,n,a,o){var s=a.type;a.type=n,o?e.event.trigger(a,i,t):e.event.dispatch.call(t,a),a.type=s}var o=e(n),s=e.mobile.support.touch,r="touchmove scroll",c=s?"touchstart":"mousedown",l=s?"touchend":"mouseup",d=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){n=t,a(o,n?"scrollstart":"scrollstop",e)}var n,i,o=this,s=e(o);s.bind(r,function(a){e.event.special.scrollstart.enabled&&(n||t(a,!0),clearTimeout(i),i=setTimeout(function(){t(a,!1)},50))})},teardown:function(){e(this).unbind(r)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),i=!1;n.bind("vmousedown",function(s){function r(){clearTimeout(d)}function c(){r(),n.unbind("vclick",l).unbind("vmouseup",r),o.unbind("vmousecancel",c)}function l(e){c(),i||p!==e.target?i&&e.preventDefault():a(t,"tap",e)}if(i=!1,s.which&&1!==s.which)return!1;var d,p=s.target;n.bind("vmouseup",r).bind("vclick",l),o.bind("vmousecancel",c),d=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(i=!0),a(t,"taphold",e.Event("taphold",{target:p}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),o.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,i=t.pageYOffset,a=e.clientX,o=e.clientY;return 0===e.pageY&&Math.floor(o)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(a)>Math.floor(e.pageX)?(a-=n,o-=i):(o<e.pageY-i||a<e.pageX-n)&&(a=e.pageX-n,o=e.pageY-i),{x:a,y:o}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,i=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[i.x,i.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,i=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[i.x,i.y]}},handleSwipe:function(t,n,i,o){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return a(i,"swipe",e.Event("swipe",{target:o,swipestart:t,swipestop:n}),!0),a(i,s,e.Event(s,{target:o,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,i=e(n),a={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=a,a.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var i,s=e.event.special.swipe.start(t),r=t.target,c=!1;a.move=function(t){s&&!t.isDefaultPrevented()&&(i=e.event.special.swipe.stop(t),c||(c=e.event.special.swipe.handleSwipe(s,i,n,r),c&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(s.coords[0]-i.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault())},a.stop=function(){c=!0,e.event.special.swipe.eventInProgress=!1,o.off(d,a.move),a.move=null},o.on(d,a.move).one(l,a.stop)}},i.on(c,a.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(c,n.start),n.move&&o.off(d,n.move),n.stop&&o.off(l,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});var t=document.createElement("script");t.src="https://www.youtube.com/iframe_api";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);(function(){function e(t){return new e.fn.init(t)}function t(e,t,n){return n.contentWindow.postMessage?(e=JSON.stringify({method:e,value:t}),void n.contentWindow.postMessage(e,s)):!1}function n(e){var t,n;try{t=JSON.parse(e.data),n=t.event||t.method}catch(i){}if("ready"!=n||o||(o=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===s&&(s=e.origin),e=t.value;var r=t.data,c=""===c?null:t.player_id;return t=c?a[c][n]:a[n],n=[],t?(void 0!==e&&n.push(e),r&&n.push(r),c&&n.push(c),0<n.length?t.apply(null,n):t.call()):!1}function i(e,t,n){n?(a[n]||(a[n]={}),a[n][e]=t):a[e]=t}var a={},o=!1,s="*";return e.fn=e.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,n){if(!this.element||!e)return!1;var a=this.element,o=""!==a.id?a.id:null,s=n&&n.constructor&&n.call&&n.apply?null:n,r=n&&n.constructor&&n.call&&n.apply?n:null;return r&&i(e,r,o),t(e,s,a),this},addEvent:function(e,n){if(!this.element)return!1;var a=this.element,s=""!==a.id?a.id:null;return i(e,n,s),"ready"!=e?t("addEventListener",e,a):"ready"==e&&o&&n.call(null,s),this},removeEvent:function(e){if(!this.element)return!1;var n=this.element,i=""!==n.id?n.id:null;e:{if(i&&a[i]){if(!a[i][e]){i=!1;break e}a[i][e]=null}else{if(!a[e]){i=!1;break e}a[e]=null}i=!0}"ready"!=e&&i&&t("removeEventListener",e,n)}},e.fn.init.prototype=e.fn,window.addEventListener?window.addEventListener("message",n,!1):window.attachEvent("onmessage",n),window.Froogaloop=window.$f=e})();e.CrellySlider=function(t,n){function i(){if(se.wrapInner('<div class="crellyslider" />'),se.find(re+" > ul").addClass("cs-slides"),se.find(re+" "+ce+" > li").addClass("cs-slide"),oe=P().length,0==oe)return!1;if(1==oe){var e=L(0),t=se.find(re).find(ce);e.clone().prependTo(t),oe++}if(n.showControls&&se.find(re).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),n.showNavigation){for(var i='<div class="cs-navigation">',o=0;oe>o;o++)i+='<span class="cs-slide-link"></span>';i+="</div>",se.find(re).append(i)}n.showProgressBar?se.find(re).append('<div class="cs-progress-bar"></div>'):se.find(re).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),se.css("display","block"),n.responsive&&y(),u(),P().find(".cs-background-link").html(" ").data({left:0,top:0,"in":"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),p(),a().done(function(){var e=setInterval(function(){"complete"==document.readyState&&se.find(re).find(".cs-preloader").length>0&&(clearInterval(e),r())},100)})}function a(){var t=new e.Deferred,n=P().find(".cs-yt-iframe, .cs-vimeo-iframe").length,i=0;return 0==n?t.resolve().promise():(P().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){var a=e(this);a.one("load",function(){i++,i==n&&o().done(function(){s().done(function(){t.resolve()})})})}),t.promise())}function o(){var t,n=new e.Deferred,i=P(),a=i.find(de+".cs-yt-iframe").length,o=0;return 0==a?n.resolve().promise():(i.each(function(){var i=e(this),s=i.find(de+".cs-yt-iframe");s.each(function(){var i=e(this);i.uniqueId(),i.attr("id","cs-yt-iframe-"+i.attr("id"));var s=new YT.Player(i.attr("id"),{events:{onReady:function(){o++,o==a&&n.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&N(i,"loop")&&s.playVideo()}}});t={player:s,played_once:!1},be[i.attr("id")]=t})}),n.promise())}function s(){var t,n=new e.Deferred,i=P(),a=i.find(de+".cs-vimeo-iframe").length,o=0;return 0==a?n.resolve().promise():(i.each(function(){var i=e(this),s=i.find(de+".cs-vimeo-iframe");s.each(function(){var i=e(this);i.uniqueId(),i.attr("id","cs-vimeo-iframe-"+i.attr("id")),i.attr("src",i.attr("src")+"&player_id="+i.attr("id"));var s=$f(i[0]);s.addEvent("ready",function(){s.addEvent("finish",function(){we[i.attr("id")].ended=!0}),s.addEvent("play",function(){we[i.attr("id")].played_once=!0,we[i.attr("id")].ended=!1}),N(i,"loop")&&s.api("setLoop",!0),o++,o==a&&n.resolve()}),t={player:s,played_once:!1,ended:!1},we[i.attr("id")]=t})}),n.promise())}function r(){n.responsive&&y(),u(),De=e(window).width(),c(),d(),f(),n.beforeStart(),n.responsive?v():b()}function c(){P().each(function(){var t=e(this);t.find(de).each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);l(t,!0)}),l(t,!1)}),t.css("display","none"),t.data("opacity",parseFloat(t.css("opacity")))})}function l(e,t){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):e.data("line-height",parseFloat(e.css("line-height"))*N(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity"))),t||e.css("display","none")}function d(){n.responsive&&e(window).resize(function(){De!=e(window).width()&&("full-width"==n.layout&&T()!=e(se).width()||e(se).width()<T()||e(se).width()>T()&&T()<n.startWidth)&&v()}),se.find(re).find(".cs-controls > .cs-previous").click(function(){C(E())}),se.find(re).find(".cs-controls > .cs-next").click(function(){C(S())}),n.enableSwipe&&(se.find(re).on("swipeleft",function(){D(),C(S())}),se.find(re).on("swiperight",function(){D(),C(E())})),se.find(re).find(".cs-navigation > .cs-slide-link").click(function(){C(e(this).index())}),n.pauseOnHover&&(se.find(re).find(ce).hover(function(){k()}),se.find(re).find(ce).mouseleave(function(){D()}))}function p(){function t(){se.find(re).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),se.find(re).find(".cs-preloader").css({"background-color":L(0).css("background-color"),"background-image":L(0).css("background-image"),"background-position":L(0).css("background-position"),"background-repeat":L(0).css("background-repeat"),"background-size":L(0).css("background-size")}),se.find(re).find(".cs-preloader > .cs-bg").css({"background-color":L(0).css("background-color"),"background-image":L(0).css("background-image"),"background-position":L(0).css("background-position"),"background-repeat":L(0).css("background-repeat"),"background-size":L(0).css("background-size")})}se.find(re).find(ce).css("visibility","hidden"),se.find(re).find(".cs-progress-bar").css("display","none"),se.find(re).find(".cs-navigation").css("display","none"),se.find(re).find(".cs-controls").css("display","none");var n=L(0).css("background-image");n=n.replace(/^url\(["']?/,"").replace(/["']?\)$/,""),n.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?e("<img>").load(function(){t()}).attr("src",n).each(function(){this.complete&&e(this).load()}):t()}function f(){se.find(re).find(ce).css("visibility","visible"),se.find(re).find(".cs-progress-bar").css("display","block"),se.find(re).find(".cs-navigation").css("display","block"),se.find(re).find(".cs-controls").css("display","block"),te(L(0)),L(0).finish(),se.find(re).find(".cs-preloader").animate({opacity:0},300,function(){se.find(re).find(".cs-preloader").remove()})}function u(){var e,t,i=n.layout;switch(i){case"fixed":e=n.startWidth,t=n.startHeight,se.find(re).css({width:g(e),height:g(t)}),P().css({width:g(e),height:g(t)});break;case"full-width":e=se.width(),t=n.startHeight,se.find(re).css({width:e,height:g(t)}),P().css({width:e,height:g(t)});break;default:return!1}}function h(e){var t=(I()-n.startHeight)/2,i=(T()-n.startWidth)/2,a=0,o=0;return t>0&&(a=t),i>0&&(o=i),{top:a,left:o}}function v(){n.beforeSetResponsive();var t=P();w(!0),t.each(function(){var t=e(this),n=t.find(de);t.finish(),te(t),t.finish(),n.each(function(){var t=e(this);t.finish(),ie(t),t.finish(),H(t)&&U(t)})}),y(),u(),t.each(function(){var t=e(this),n=t.find(de);n.each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);m(t)}),m(t),t.finish(),ae(t),t.finish(),H(t)&&U(t)}),t.finish(),ne(t),t.finish()}),De=e(window).width(),b()}function m(e){e.css({top:g(N(e,"top")+h(e).top),left:g(N(e,"left")+h(e).left),"padding-top":g(N(e,"padding-top")),"padding-right":g(N(e,"padding-right")),"padding-bottom":g(N(e,"padding-bottom")),"padding-left":g(N(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":g(N(e,"line-height"))+"px","letter-spacing":g(N(e,"letter-spacing")),"font-size":g(N(e,"font-size"))}):e.css({width:g(N(e,"width")),height:g(N(e,"height"))})}function y(){var e=se.width(),t=n.startWidth;ke=e>=t||!n.responsive?1:e/t}function g(e){return e*ke}function b(){n.automaticSlide?F():z(pe),ve=!1}function w(t){for(var n=0;n<ye.length;n++)ye[n].clear();for(var n=0;n<ge.length;n++)ge[n].clear();me.clear(),P().each(function(){var n=e(this);t?n.finish():n.stop(!0,!0),n.find(de).each(function(){var n=e(this);t?n.finish():n.stop(!0,!0)})}),R()}function k(){if(!fe&&ue){n.beforePause();var e=se.find(re).find(".cs-progress-bar");e.stop(!0),me.pause(),fe=!0}}function D(){if(fe&&ue){n.beforeResume();var e=se.find(re).find(".cs-progress-bar"),t=(N(L(pe),"time"),me.getRemaining());e.animate({width:"100%"},t),me.resume(),fe=!1}}function T(){return se.find(re).width()}function I(){return se.find(re).height()}function S(){return pe+1==oe?0:pe+1}function E(){return 0>pe-1?oe-1:pe-1}function N(e,t){var i;switch(i=e.parent("ul").hasClass("cs-slides")?!0:!1,t){case"ease-in":return i?isNaN(parseInt(e.data(t)))?n.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?n.elementsEaseIn:parseInt(e.data(t));case"ease-out":return i?isNaN(parseInt(e.data(t)))?n.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?n.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?n.elementsDelay:parseInt(e.data(t));case"time":return i?isNaN(parseInt(e.data(t)))?n.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?n.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))?!0:0==parseInt(e.data(t))?!1:n.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))?!0:0==parseInt(e.data(t))?!1:n.videoAutoplay;case"loop":return 1==parseInt(e.data(t))?!0:0==parseInt(e.data(t))?!1:n.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));case"in":case"out":case"opacity":return e.data(t);default:return!1}}function P(){return se.find(re).find(ce).find(le)}function L(e){return P().eq(e)}function Y(e,t){var n,i,a=t;this.pause=function(){clearTimeout(n),a-=new Date-i},this.resume=function(){i=new Date,clearTimeout(n),n=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(n)},this.getRemaining=function(){return a},this.resume()}function x(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function F(){z(pe).done(function(){fe||(pe=S(),F())})}function O(){var e=se.find(re).find(".cs-progress-bar");R(),e.animate({width:"100%"},N(L(pe),"time"))}function R(){var e=se.find(re).find(".cs-progress-bar");e.stop(),e.css("width",0)}function M(){var t=se.find(re).find(".cs-navigation"),n=t.find("> .cs-slide-link");n.each(function(){var t=e(this);t.index()==pe?t.addClass("cs-active"):t.removeClass("cs-active")})}function C(e){e!=pe&&(ue||he)&&(w(!1),B(pe,!1,!0).done(function(){pe=e,b()}))}function z(t){n.beforeSlideStart();var i=new e.Deferred;he=!1;for(var a=0;a<ye.length;a++)ye[a].clear();for(var a=0;a<ge.length;a++)ge[a].clear();me.clear(),L(t).finish(),ne(t),L(t).finish();var o=L(t).find(de);return o.each(function(){var t=e(this);t.finish(),ae(t),t.finish()}),M(),X(t),n.automaticSlide?B(t,!0,!0).done(function(){he=!0,i.resolve()}):B(t,!0,!1).done(function(){he=!0,i.resolve()}),i.promise()}function X(t){var n=L(t),i=n.find(de),a=0,o=!1,s=new e.Deferred;return ue=!1,te(t).done(function(){O(),ue=!0,o=!0,o&&a==i.length&&s.resolve()}),i.each(function(){var t=e(this),n=N(t,"delay");ge.push(new Y(function(){ie(t).done(function(){H(t)&&_(t),a++,o&&a==i.length&&s.resolve()})},n))}),s.promise()}function B(t,n,i){var a=L(t),o=a.find(de),s=n?N(a,"time")+N(a,"ease-in"):0,r=0,c=!1,l=new e.Deferred;return o.each(function(){var a=e(this),s=N(a,"time");if("all"!=s){var d=n?s:0;N(a,"ignore-ease-out")&&(r++,o.length==r&&c&&i&&(W(t),ne(t),l.resolve())),ye.push(new Y(function(){ae(a).done(function(){N(a,"ignore-ease-out")||(r++,o.length==r&&c&&i&&(W(t),ne(t),l.resolve()))})},d))}}),me=new Y(function(){ue=!1,R(),c=!0,o.length==r&&c&&i&&(W(t),ne(t),l.resolve()),i?o.each(function(){var n=e(this),a=N(n,"time");"all"==a&&(N(n,"ignore-ease-out")&&(r++,o.length==r&&c&&i&&(W(t),ne(t),l.resolve())),ae(n).done(function(){N(n,"ignore-ease-out")||(r++,o.length==r&&c&&i&&(W(t),ne(t),l.resolve()))}))}):l.resolve()},s),l.promise()}function H(e){return A(e)||Q(e)}function _(e){A(e)?q(e):K(e)}function W(e){$(e),Z(e)}function U(e){A(e)?J(e):ee(e)}function A(e){return e.hasClass("cs-yt-iframe")}function V(e){return be[e.attr("id")].player}function j(e){return V(e).getPlayerState()}function q(e){!N(e,"autoplay")||be[e.attr("id")].played_once||x()||V(e).playVideo(),2==j(e)&&V(e).playVideo(),be[e.attr("id")].played_once=!0}function $(t){L(t).each(function(){var t=e(this);t.find(de+".cs-yt-iframe").each(function(){J(e(this))})})}function J(e){1==j(e)&&V(e).pauseVideo()}function Q(e){return e.hasClass("cs-vimeo-iframe")}function G(e){return we[e.attr("id")].player}function K(e){!N(e,"autoplay")||we[e.attr("id")].played_once||x()||G(e).api("play"),G(e).api("paused")&&!we[e.attr("id")].ended&&we[e.attr("id")].played_once&&G(e).api("play")}function Z(t){L(t).each(function(){var t=e(this);t.find(de+".cs-vimeo-iframe").each(function(){ee(e(this))})})}function ee(e){G(e).api("pause")}function te(t){var n=L(t),i=N(n,"in"),a=N(n,"ease-in"),o=new e.Deferred;if("block"==n.css("display"))return o.resolve().promise();if(ve)return n.css({display:"block",top:0,left:0,opacity:N(n,"opacity")}),o.resolve().promise();switch(i){case"fade":n.css({display:"block",top:0,left:0,opacity:0}),n.animate({opacity:N(n,"opacity")},a,function(){o.resolve()});break;case"fadeLeft":n.css({display:"block",top:0,left:T(),opacity:0}),n.animate({opacity:N(n,"opacity"),left:0},a,function(){o.resolve()});break;case"fadeRight":n.css({display:"block",top:0,left:-T(),opacity:0}),n.animate({opacity:N(n,"opacity"),left:0},a,function(){o.resolve()});break;case"slideLeft":n.css({display:"block",top:0,left:T(),opacity:N(n,"opacity")}),n.animate({left:0},a,function(){o.resolve()});break;case"slideRight":n.css({display:"block",top:0,left:-T(),opacity:N(n,"opacity")}),n.animate({left:0},a,function(){o.resolve()});break;case"slideUp":n.css({display:"block",top:I(),left:0,opacity:N(n,"opacity")}),n.animate({top:0},a,function(){o.resolve()});break;case"slideDown":n.css({display:"block",top:-I(),left:0,opacity:N(n,"opacity")}),n.animate({top:0},a,function(){o.resolve()});break;default:n.css({display:"block",top:0,left:0,opacity:N(n,"opacity")}),o.resolve()}return o.promise()}function ne(t){var n=L(t),i=N(n,"out"),a=N(n,"ease-out"),o=new e.Deferred;if("none"==n.css("display"))return o.resolve().promise();switch(i){case"fade":n.animate({opacity:0},a,function(){n.css({display:"none",opacity:N(n,"opacity")}),o.resolve()});break;case"fadeLeft":n.animate({opacity:0,left:-T()},a,function(){n.css({display:"none",opacity:N(n,"opacity"),left:0}),o.resolve()});break;case"fadeRight":n.animate({opacity:0,left:T()},a,function(){n.css({display:"none",opacity:N(n,"opacity"),left:0}),o.resolve()});break;case"slideLeft":n.animate({left:-T()},a,function(){n.css({display:"none",left:0}),o.resolve()});break;case"slideRight":n.animate({left:T()},a,function(){n.css({display:"none",left:0}),o.resolve()});break;case"slideUp":n.animate({top:-I()},a,function(){n.css({display:"none",top:0}),o.resolve()});break;case"slideDown":n.animate({top:I()},a,function(){n.css({display:"none",top:0}),o.resolve()});break;default:n.css({display:"none"}),o.resolve()}return o.promise()}function ie(t){var n=t.outerWidth(),i=t.outerHeight(),a=N(t,"in"),o=N(t,"ease-in"),s=N(t,"top"),r=N(t,"left"),c=new e.Deferred;if("block"==t.css("display"))return c.resolve().promise();switch(a){case"slideDown":t.css({display:"block",top:-i,left:g(r+h(t).left),opacity:N(t,"opacity")}).animate({top:g(s+h(t).top)},o,function(){c.resolve()});break;case"slideUp":t.css({display:"block",top:I(),left:g(r+h(t).left),opacity:N(t,"opacity")}).animate({top:g(s+h(t).top)},o,function(){c.resolve()});break;case"slideLeft":t.css({display:"block",top:g(s+h(t).top),left:T(),opacity:N(t,"opacity")}).animate({left:g(r+h(t).left)},o,function(){c.resolve()});break;case"slideRight":t.css({display:"block",top:g(s+h(t).top),left:-n,opacity:N(t,"opacity")}).animate({left:g(r+h(t).left)},o,function(){c.resolve()});break;case"fade":t.css({display:"block",top:g(s+h(t).top),left:g(r+h(t).left),opacity:0}).animate({opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeDown":t.css({display:"block",top:-i,left:g(r+h(t).left),opacity:0}).animate({top:g(s+h(t).top),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeUp":t.css({display:"block",top:I(),left:g(r+h(t).left),opacity:0}).animate({top:g(s+h(t).top),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeLeft":t.css({display:"block",top:g(s+h(t).top),left:T(),opacity:0}).animate({left:g(r+h(t).left),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeRight":t.css({display:"block",top:g(s+h(t).top),left:-n,opacity:0}).animate({left:g(r+h(t).left),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallDown":t.css({display:"block",top:g(s+h(t).top-30),left:g(r+h(t).left),opacity:0}).animate({top:g(s+h(t).top),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallUp":t.css({display:"block",top:g(s+h(t).top+30),left:g(r+h(t).left),opacity:0}).animate({top:g(s+h(t).top),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallLeft":t.css({display:"block",top:g(s+h(t).top),left:g(r+h(t).left+30),opacity:0}).animate({left:g(r+h(t).left),opacity:N(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallRight":t.css({display:"block",top:g(s+h(t).top),left:g(r+h(t).left-30),opacity:0}).animate({left:g(r+h(t).left),opacity:N(t,"opacity")},o,function(){c.resolve()});break;default:t.css({display:"block",top:g(s+h(t).top),left:g(r+h(t).left),opacity:N(t,"opacity")}),c.resolve()}return c.promise()}function ae(t){var n=t.outerWidth(),i=t.outerHeight(),a=N(t,"out"),o=N(t,"ease-out"),s=new e.Deferred;if("none"==t.css("display"))return s.resolve().promise();switch(a){case"slideDown":t.animate({top:I()},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideUp":t.animate({top:-i},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideLeft":t.animate({left:-n},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideRight":t.animate({left:T()},o,function(){t.css({display:"none"}),s.resolve()});break;case"fade":t.animate({opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeDown":t.animate({top:I(),opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeUp":t.animate({top:-i,opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeLeft":t.animate({left:-n,opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeRight":t.animate({left:T(),opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeSmallDown":t.animate({top:g(N(t,"top")+h(t).top+30),opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeSmallUp":t.animate({top:g(N(t,"top")+h(t).top-30),opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeSmallLeft":t.animate({left:g(N(t,"left")+h(t).left-30),opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;case"fadeSmallRight":t.animate({left:g(N(t,"left")+h(t).left+30),opacity:0},o,function(){t.css({display:"none",opacity:N(t,"opacity")}),s.resolve()});break;default:t.css({display:"none"}),s.resolve()}return s.promise()}var oe,se=e(t),re="div.crellyslider",ce="ul.cs-slides",le="li.cs-slide",de="> *",pe=0,fe=!1,ue=!1,he=!1,ve=!0,me=new Y(function(){},0),ye=new Array,ge=new Array,be={},we={},ke=1,De=0;if("undefined"==typeof YT||"undefined"==typeof YT.Player)var Te=setInterval(function(){"undefined"!=typeof YT&&"undefined"!=typeof YT.Player&&(clearInterval(Te),i())},100);else i();this.resume=function(){D()},this.pause=function(){k()},this.nextSlide=function(){C(S())},this.previousSlide=function(){C(E())},this.changeSlide=function(e){C(e)},this.getCurrentSlide=function(){return pe},this.getTotalSlides=function(){return oe}},e.fn.crellySlider=function(t){var n=e.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},t);return this.each(function(){if(void 0==e(this).data("crellySlider")){var t=new e.CrellySlider(this,n);e(this).data("crellySlider",t)}})}}(jQuery);
1
  /**
2
  * Plugin Name: Crelly Slider
3
+ * Plugin URI: http://crellyslider.tk/
4
+ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.2.0
6
+ * Author: Fabio Rinaldi
7
+ * Author URI: https://github.com/fabiorino
8
  * License: MIT
9
  */
10
 
11
+ var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(a){function b(){var a=document.createElement("script");a.src="https://www.youtube.com/iframe_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),crellyslider_youtube_api_ready=!0}function c(){(function(){function a(b){return new a.fn.init(b)}function b(a,b,c){return!!c.contentWindow.postMessage&&(a=JSON.stringify({method:a,value:b}),void c.contentWindow.postMessage(a,g))}function c(a){var b,c;try{b=JSON.parse(a.data),c=b.event||b.method}catch(a){}if("ready"!=c||f||(f=!0),!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===g&&(g=a.origin),a=b.value;var d=b.data,h=""===h?null:b.player_id;return b=h?e[h][c]:e[c],c=[],!!b&&(void 0!==a&&c.push(a),d&&c.push(d),h&&c.push(h),0<c.length?b.apply(null,c):b.call())}function d(a,b,c){c?(e[c]||(e[c]={}),e[c][a]=b):e[a]=b}var e={},f=!1,g="*";return a.fn=a.prototype={element:null,init:function(a){return"string"==typeof a&&(a=document.getElementById(a)),this.element=a,this},api:function(a,c){if(!this.element||!a)return!1;var e=this.element,f=""!==e.id?e.id:null,g=c&&c.constructor&&c.call&&c.apply?null:c,h=c&&c.constructor&&c.call&&c.apply?c:null;return h&&d(a,h,f),b(a,g,e),this},addEvent:function(a,c){if(!this.element)return!1;var e=this.element,g=""!==e.id?e.id:null;return d(a,c,g),"ready"!=a?b("addEventListener",a,e):"ready"==a&&f&&c.call(null,g),this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,d=""!==c.id?c.id:null;a:{if(d&&e[d]){if(!e[d][a]){d=!1;break a}e[d][a]=null}else{if(!e[a]){d=!1;break a}e[a]=null}d=!0}"ready"!=a&&d&&b("removeEventListener",a,c)}},a.fn.init.prototype=a.fn,window.addEventListener?window.addEventListener("message",c,!1):window.attachEvent("onmessage",c),window.Froogaloop=window.$f=a})();crellyslider_vimeo_api_ready=!0}!function(a,b,c){"function"==typeof define&&define.amd?define(["jquery"],function(d){return c(d,a,b),d.mobile}):c(a.jQuery,a,b)}(this,document,function(a,b,c,d){!function(a,b,c,d){function e(a){for(;a&&"undefined"!=typeof a.originalEvent;)a=a.originalEvent;return a}function f(b,c){var g,h,i,j,k,l,m,n,o,f=b.type;if(b=a.Event(b),b.type=c,g=b.originalEvent,h=a.event.props,f.search(/^(mouse|click)/)>-1&&(h=C),g)for(m=h.length,j;m;)j=h[--m],b[j]=g[j];if(f.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1),f.search(/^touch/)!==-1&&(i=e(g),f=i.touches,k=i.changedTouches,l=f&&f.length?f[0]:k&&k.length?k[0]:d,l))for(n=0,o=A.length;n<o;n++)j=A[n],b[j]=l[j];return b}function g(b){for(var d,e,c={};b;){d=a.data(b,x);for(e in d)d[e]&&(c[e]=c.hasVirtualBinding=!0);b=b.parentNode}return c}function h(b,c){for(var d;b;){if(d=a.data(b,x),d&&(!c||d[c]))return b;b=b.parentNode}return null}function i(){K=!1}function j(){K=!0}function k(){O=0,I.length=0,J=!1,j()}function l(){i()}function m(){n(),E=setTimeout(function(){E=0,k()},a.vmouse.resetTimerDuration)}function n(){E&&(clearTimeout(E),E=0)}function o(b,c,d){var e;return(d&&d[b]||!d&&h(c.target,b))&&(e=f(c,b),a(c.target).trigger(e)),e}function p(b){var d,c=a.data(b.target,y);!J&&(!O||O!==c)&&(d=o("v"+b.type,b),d&&(d.isDefaultPrevented()&&b.preventDefault(),d.isPropagationStopped()&&b.stopPropagation(),d.isImmediatePropagationStopped()&&b.stopImmediatePropagation()))}function q(b){var d,f,h,c=e(b).touches;c&&1===c.length&&(d=b.target,f=g(d),f.hasVirtualBinding&&(O=N++,a.data(d,y,O),n(),l(),H=!1,h=e(b).touches[0],F=h.pageX,G=h.pageY,o("vmouseover",b,f),o("vmousedown",b,f)))}function r(a){K||(H||o("vmousecancel",a,g(a.target)),H=!0,m())}function s(b){if(!K){var c=e(b).touches[0],d=H,f=a.vmouse.moveDistanceThreshold,h=g(b.target);H=H||Math.abs(c.pageX-F)>f||Math.abs(c.pageY-G)>f,H&&!d&&o("vmousecancel",b,h),o("vmousemove",b,h),m()}}function t(a){if(!K){j();var c,d,b=g(a.target);o("vmouseup",a,b),H||(c=o("vclick",a,b),c&&c.isDefaultPrevented()&&(d=e(a).changedTouches[0],I.push({touchID:O,x:d.clientX,y:d.clientY}),J=!0)),o("vmouseout",a,b),H=!1,m()}}function u(b){var d,c=a.data(b,x);if(c)for(d in c)if(c[d])return!0;return!1}function v(){}function w(b){var c=b.substr(1);return{setup:function(){u(this)||a.data(this,x,{});var d=a.data(this,x);d[b]=!0,D[b]=(D[b]||0)+1,1===D[b]&&M.bind(c,p),a(this).bind(c,v),L&&(D.touchstart=(D.touchstart||0)+1,1===D.touchstart&&M.bind("touchstart",q).bind("touchend",t).bind("touchmove",s).bind("scroll",r))},teardown:function(){--D[b],D[b]||M.unbind(c,p),L&&(--D.touchstart,D.touchstart||M.unbind("touchstart",q).unbind("touchmove",s).unbind("touchend",t).unbind("scroll",r));var d=a(this),e=a.data(this,x);e&&(e[b]=!1),d.unbind(c,v),u(this)||d.removeData(x)}}}var P,Q,x="virtualMouseBindings",y="virtualTouchID",z="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),A="clientX clientY pageX pageY screenX screenY".split(" "),B=a.event.mouseHooks?a.event.mouseHooks.props:[],C=a.event.props.concat(B),D={},E=0,F=0,G=0,H=!1,I=[],J=!1,K=!1,L="addEventListener"in c,M=a(c),N=1,O=0;for(a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},Q=0;Q<z.length;Q++)a.event.special[z[Q]]=w(z[Q]);L&&c.addEventListener("click",function(b){var e,f,g,h,i,j,c=I.length,d=b.target;if(c)for(e=b.clientX,f=b.clientY,P=a.vmouse.clickDistanceThreshold,g=d;g;){for(h=0;h<c;h++)if(i=I[h],j=0,g===d&&Math.abs(i.x-e)<P&&Math.abs(i.y-f)<P||a.data(g,y)===i.touchID)return b.preventDefault(),void b.stopPropagation();g=g.parentNode}},!0)}(a,b,c),function(a){a.mobile={}}(a),function(a,b){var d={touch:"ontouchend"in c};a.mobile.support=a.mobile.support||{},a.extend(a.support,d),a.extend(a.mobile.support,d)}(a),function(a,b,d){function e(b,c,e,f){var g=e.type;e.type=c,f?a.event.trigger(e,d,b):a.event.dispatch.call(b,e),e.type=g}var f=a(c),g=a.mobile.support.touch,h="touchmove scroll",i=g?"touchstart":"mousedown",j=g?"touchend":"mouseup",k=g?"touchmove":"mousemove";a.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(b,c){a.fn[c]=function(a){return a?this.bind(c,a):this.trigger(c)},a.attrFn&&(a.attrFn[c]=!0)}),a.event.special.scrollstart={enabled:!0,setup:function(){function b(a,b){f=b,e(c,f?"scrollstart":"scrollstop",a)}var f,g,c=this,d=a(c);d.bind(h,function(c){a.event.special.scrollstart.enabled&&(f||b(c,!0),clearTimeout(g),g=setTimeout(function(){b(c,!1)},50))})},teardown:function(){a(this).unbind(h)}},a.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var b=this,c=a(b),d=!1;c.bind("vmousedown",function(g){function h(){clearTimeout(l)}function i(){h(),c.unbind("vclick",j).unbind("vmouseup",h),f.unbind("vmousecancel",i)}function j(a){i(),d||k!==a.target?d&&a.preventDefault():e(b,"tap",a)}if(d=!1,g.which&&1!==g.which)return!1;var l,k=g.target;c.bind("vmouseup",h).bind("vclick",j),f.bind("vmousecancel",i),l=setTimeout(function(){a.event.special.tap.emitTapOnTaphold||(d=!0),e(b,"taphold",a.Event("taphold",{target:k}))},a.event.special.tap.tapholdThreshold)})},teardown:function(){a(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),f.unbind("vmousecancel")}},a.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(a){var c=b.pageXOffset,d=b.pageYOffset,e=a.clientX,f=a.clientY;return 0===a.pageY&&Math.floor(f)>Math.floor(a.pageY)||0===a.pageX&&Math.floor(e)>Math.floor(a.pageX)?(e-=c,f-=d):(f<a.pageY-d||e<a.pageX-c)&&(e=a.pageX-c,f=a.pageY-d),{x:e,y:f}},start:function(b){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b,d=a.event.special.swipe.getLocation(c);return{time:(new Date).getTime(),coords:[d.x,d.y],origin:a(b.target)}},stop:function(b){var c=b.originalEvent.touches?b.originalEvent.touches[0]:b,d=a.event.special.swipe.getLocation(c);return{time:(new Date).getTime(),coords:[d.x,d.y]}},handleSwipe:function(b,c,d,f){if(c.time-b.time<a.event.special.swipe.durationThreshold&&Math.abs(b.coords[0]-c.coords[0])>a.event.special.swipe.horizontalDistanceThreshold&&Math.abs(b.coords[1]-c.coords[1])<a.event.special.swipe.verticalDistanceThreshold){var g=b.coords[0]>c.coords[0]?"swipeleft":"swiperight";return e(d,"swipe",a.Event("swipe",{target:f,swipestart:b,swipestop:c}),!0),e(d,g,a.Event(g,{target:f,swipestart:b,swipestop:c}),!0),!0}return!1},eventInProgress:!1,setup:function(){var b,c=this,d=a(c),e={};b=a.data(this,"mobile-events"),b||(b={length:0},a.data(this,"mobile-events",b)),b.length++,b.swipe=e,e.start=function(b){if(!a.event.special.swipe.eventInProgress){a.event.special.swipe.eventInProgress=!0;var d,g=a.event.special.swipe.start(b),h=b.target,i=!1;e.move=function(b){g&&!b.isDefaultPrevented()&&(d=a.event.special.swipe.stop(b),i||(i=a.event.special.swipe.handleSwipe(g,d,c,h),i&&(a.event.special.swipe.eventInProgress=!1)),Math.abs(g.coords[0]-d.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&b.preventDefault())},e.stop=function(){i=!0,a.event.special.swipe.eventInProgress=!1,f.off(k,e.move),e.move=null},f.on(k,e.move).one(j,e.stop)}},d.on(i,e.start)},teardown:function(){var b,c;b=a.data(this,"mobile-events"),b&&(c=b.swipe,delete b.swipe,b.length--,0===b.length&&a.removeData(this,"mobile-events")),c&&(c.start&&a(this).off(i,c.start),c.move&&f.off(k,c.move),c.stop&&f.off(j,c.stop))}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)},teardown:function(){a(this).unbind(c)}}})}(a,this)}),a.CrellySlider=function(d,e){function y(a){return"youtube"==a?f.find(".cs-yt-iframe").length>0:"vimeo"==a?f.find(".cs-vimeo-iframe").length>0:-1}function z(){if(f.wrapInner('<div class="crellyslider" />'),f.find(g+" > ul").addClass("cs-slides"),f.find(g+" "+h+" > li").addClass("cs-slide"),k=Z().length,0==k)return!1;if(1==k){var a=$(0),b=f.find(g).find(h);a.clone().prependTo(b),k++}if(A(),e.showControls&&f.find(g).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),e.showNavigation){for(var c='<div class="cs-navigation">',d=0;d<k;d++)c+='<span class="cs-slide-link"></span>';c+="</div>",f.find(g).append(c)}e.showProgressBar?f.find(g).append('<div class="cs-progress-bar"></div>'):f.find(g).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),f.css("display","block"),e.responsive&&O(),K(),Z().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),I(),B().done(function(){var a=setInterval(function(){"complete"==document.readyState&&f.find(g).find(".cs-preloader").length>0&&(clearInterval(a),E())},100)})}function A(){if(e.randomOrder||0!=e.startFromSlide){var a=new Array,b=new Array;if(e.startFromSlide==-1){var c=Math.floor(Math.random()*k);a[0]=c,b[0]=$(c)}else a[0]=e.startFromSlide,b[0]=$(e.startFromSlide);for(var d=1;d<k;d++){var c;if(e.randomOrder){do c=Math.floor(Math.random()*k);while(a.indexOf(c)!=-1)}else c=d+a[0]<k?d+a[0]:d+a[0]-k;a[d]=c,b[d]=$(c)}f.find(g).find(h).empty();for(var d=0;d<k;d++)f.find(g).find(h).append(b[d])}}function B(){var b=new a.Deferred,c=Z().find(".cs-yt-iframe, .cs-vimeo-iframe").length,d=0;return 0==c?b.resolve().promise():(Z().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){var e=a(this);e.one("load",function(){d++,d==c&&C().done(function(){D().done(function(){b.resolve()})})})}),b.promise())}function C(){var f,b=new a.Deferred,c=Z(),d=c.find(j+".cs-yt-iframe").length,e=0;return 0==d?b.resolve().promise():(c.each(function(){var c=a(this),g=c.find(j+".cs-yt-iframe");g.each(function(){var c=a(this);c.uniqueId(),c.attr("id","cs-yt-iframe-"+c.attr("id"));var g=new YT.Player(c.attr("id"),{events:{onReady:function(){e++,e==d&&b.resolve()},onStateChange:function(a){a.data===YT.PlayerState.ENDED&&Y(c,"loop")&&g.playVideo()}}});f={player:g,played_once:!1},t[c.attr("id")]=f})}),b.promise())}function D(){var f,b=new a.Deferred,c=Z(),d=c.find(j+".cs-vimeo-iframe").length,e=0;return 0==d?b.resolve().promise():(c.each(function(){var c=a(this),g=c.find(j+".cs-vimeo-iframe");g.each(function(){var c=a(this);c.uniqueId(),c.attr("id","cs-vimeo-iframe-"+c.attr("id")),c.attr("src",c.attr("src")+"&player_id="+c.attr("id"));var g=$f(c[0]);g.addEvent("ready",function(){g.addEvent("finish",function(){u[c.attr("id")].ended=!0}),g.addEvent("play",function(){u[c.attr("id")].played_once=!0,u[c.attr("id")].ended=!1}),Y(c,"loop")&&g.api("setLoop",!0),e++,e==d&&b.resolve()}),f={player:g,played_once:!1,ended:!1},u[c.attr("id")]=f})}),b.promise())}function E(){e.responsive&&O(),K(),w=a(window).width(),F(),H(),J(),e.beforeStart(),e.responsive?M():Q()}function F(){Z().each(function(){var b=a(this);b.find(j).each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);G(b,!0)}),G(b,!1)}),b.css("display","none"),b.data("opacity",parseFloat(b.css("opacity")))})}function G(a,b){a.data("width",parseFloat(a.width())),a.data("height",parseFloat(a.height())),a.data("letter-spacing",parseFloat(a.css("letter-spacing"))),a.data("font-size",parseFloat(a.css("font-size"))),"px"==a.css("line-height").slice(-2).toLowerCase()?a.data("line-height",parseFloat(a.css("line-height"))):a.data("line-height",parseFloat(a.css("line-height"))*Y(a,"font-size")),a.data("padding-top",parseFloat(a.css("padding-top"))),a.data("padding-right",parseFloat(a.css("padding-right"))),a.data("padding-bottom",parseFloat(a.css("padding-bottom"))),a.data("padding-left",parseFloat(a.css("padding-left"))),a.data("opacity",parseFloat(a.css("opacity"))),b||a.css("display","none")}function H(){e.responsive&&a(window).resize(function(){w!=a(window).width()&&("full-width"==e.layout&&U()!=a(f).width()||a(f).width()<U()||a(f).width()>U()&&U()<e.startWidth)&&M()}),f.find(g).find(".cs-controls > .cs-previous").click(function(){fa(X())}),f.find(g).find(".cs-controls > .cs-next").click(function(){fa(W())}),e.enableSwipe&&(f.find(g).on("swipeleft",function(){T(),fa(W())}),f.find(g).on("swiperight",function(){T(),fa(X())})),f.find(g).find(".cs-navigation > .cs-slide-link").click(function(){fa(a(this).index())}),e.pauseOnHover&&(f.find(g).find(h).hover(function(){S()}),f.find(g).find(h).mouseleave(function(){T()}))}function I(){function c(){f.find(g).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),f.find(g).find(".cs-preloader").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")}),f.find(g).find(".cs-preloader > .cs-bg").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")})}f.find(g).find(h).css("visibility","hidden"),f.find(g).find(".cs-progress-bar").css("display","none"),f.find(g).find(".cs-navigation").css("display","none"),f.find(g).find(".cs-controls").css("display","none");var b=$(0).css("background-image");b=b.replace(/^url\(["']?/,"").replace(/["']?\)$/,""),b.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?a("<img>").load(function(){c()}).attr("src",b).each(function(){this.complete&&a(this).load()}):c()}function J(){f.find(g).find(h).css("visibility","visible"),f.find(g).find(".cs-progress-bar").css("display","block"),f.find(g).find(".cs-navigation").css("display","block"),f.find(g).find(".cs-controls").css("display","block"),ya($(0)),$(0).finish(),f.find(g).find(".cs-preloader").animate({opacity:0},300,function(){f.find(g).find(".cs-preloader").remove()})}function K(){var b,c,a=e.layout;switch(a){case"fixed":b=e.startWidth,c=e.startHeight,f.find(g).css({width:P(b),height:P(c)}),Z().css({width:P(b),height:P(c)});break;case"full-width":b=f.width(),c=e.startHeight,f.find(g).css({width:b,height:P(c)}),Z().css({width:b,height:P(c)});break;default:return!1}}function L(a){var b=(V()-e.startHeight)/2,c=(U()-e.startWidth)/2,d=0,f=0;return b>0&&(d=b),c>0&&(f=c),{top:d,left:f}}function M(){e.beforeSetResponsive();var b=Z();R(!0),b.each(function(){var b=a(this),c=b.find(j);b.finish(),ya(b),b.finish(),c.each(function(){var b=a(this);b.finish(),Aa(b),b.finish(),ja(b)&&ma(b)})}),O(),K(),b.each(function(){var b=a(this),c=b.find(j);c.each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);N(b)}),N(b),b.finish(),Ba(b),b.finish(),ja(b)&&ma(b)}),b.finish(),za(b),b.finish()}),w=a(window).width(),Q()}function N(a){a.css({top:P(Y(a,"top")+L(a).top),left:P(Y(a,"left")+L(a).left),"padding-top":P(Y(a,"padding-top")),"padding-right":P(Y(a,"padding-right")),"padding-bottom":P(Y(a,"padding-bottom")),"padding-left":P(Y(a,"padding-left"))}),a.is("input")||a.is("button")||a.text().trim().length?a.css({"line-height":P(Y(a,"line-height"))+"px","letter-spacing":P(Y(a,"letter-spacing")),"font-size":P(Y(a,"font-size"))}):a.css({width:P(Y(a,"width")),height:P(Y(a,"height"))})}function O(){var a=f.width(),b=e.startWidth;v=a>=b||!e.responsive?1:a/b}function P(a){return a*v}function Q(){e.automaticSlide?ba():ga(l),p=!1}function R(b){for(var c=0;c<r.length;c++)r[c].clear();for(var c=0;c<s.length;c++)s[c].clear();q.clear(),Z().each(function(){var c=a(this);b?c.finish():c.stop(!0,!0),c.find(j).each(function(){var c=a(this);b?c.finish():c.stop(!0,!0)})}),da()}function S(){if(!m&&n){e.beforePause();var a=f.find(g).find(".cs-progress-bar");a.stop(!0),q.pause(),m=!0}}function T(){if(m&&n){e.beforeResume();var a=f.find(g).find(".cs-progress-bar"),c=(Y($(l),"time"),q.getRemaining());a.animate({width:"100%"},c),q.resume(),m=!1}}function U(){return f.find(g).width()}function V(){return f.find(g).height()}function W(){return l+1==k?0:l+1}function X(){return l-1<0?k-1:l-1}function Y(a,b){var c;switch(c=!!a.parent("ul").hasClass("cs-slides"),b){case"ease-in":return c?isNaN(parseInt(a.data(b)))?e.slidesEaseIn:parseInt(a.data(b)):isNaN(parseInt(a.data(b)))?e.elementsEaseIn:parseInt(a.data(b));case"ease-out":return c?isNaN(parseInt(a.data(b)))?e.slidesEaseOut:parseInt(a.data(b)):isNaN(parseInt(a.data(b)))?e.elementsEaseOut:parseInt(a.data(b));case"delay":return isNaN(parseInt(a.data(b)))?e.elementsDelay:parseInt(a.data(b));case"time":return c?isNaN(parseInt(a.data(b)))?e.slidesTime:parseInt(a.data(b)):"all"==a.data(b)?"all":isNaN(parseInt(a.data(b)))?e.itemsTime:parseInt(a.data(b));case"ignore-ease-out":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.videoAutoplay;case"loop":return 1==parseInt(a.data(b))||0!=parseInt(a.data(b))&&e.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(a.data(b)))?0:parseFloat(a.data(b));case"in":case"out":case"opacity":return a.data(b);default:return!1}}function Z(){return f.find(g).find(h).find(i)}function $(a){return Z().eq(a)}function _(a,b){var c,d,e=b;this.pause=function(){clearTimeout(c),e-=new Date-d},this.resume=function(){d=new Date,clearTimeout(c),c=window.setTimeout(function(){a()},e)},this.clear=function(){clearTimeout(c)},this.getRemaining=function(){return e},this.resume()}function aa(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ba(){ga(l).done(function(){m||(l=W(),ba())})}function ca(){var a=f.find(g).find(".cs-progress-bar");da(),a.animate({width:"100%"},Y($(l),"time"))}function da(){var a=f.find(g).find(".cs-progress-bar");a.stop(),a.css("width",0)}function ea(){var b=f.find(g).find(".cs-navigation"),c=b.find("> .cs-slide-link");c.each(function(){var b=a(this);b.index()==l?b.addClass("cs-active"):b.removeClass("cs-active")})}function fa(a){a!=l&&(n||o)&&(R(!1),ia(l,!1,!0).done(function(){l=a,Q()}))}function ga(b){e.beforeSlideStart();var c=new a.Deferred;o=!1;for(var d=0;d<r.length;d++)r[d].clear();for(var d=0;d<s.length;d++)s[d].clear();q.clear(),$(b).finish(),za(b),$(b).finish();var f=$(b).find(j);return f.each(function(){var b=a(this);b.finish(),Ba(b),b.finish()}),ea(),ha(b),e.automaticSlide?ia(b,!0,!0).done(function(){o=!0,c.resolve()}):ia(b,!0,!1).done(function(){o=!0,c.resolve()}),c.promise()}function ha(b){var c=$(b),d=c.find(j),e=0,f=!1,g=new a.Deferred;return n=!1,ya(b).done(function(){ca(),n=!0,f=!0,f&&e==d.length&&g.resolve()}),d.each(function(){var b=a(this),c=Y(b,"delay");s.push(new _(function(){Aa(b).done(function(){ja(b)&&ka(b),e++,f&&e==d.length&&g.resolve()})},c))}),g.promise()}function ia(b,c,d){var e=$(b),f=e.find(j),g=c?Y(e,"time")+Y(e,"ease-in"):0,h=0,i=!1,k=new a.Deferred;return f.each(function(){var e=a(this),g=Y(e,"time");if("all"!=g){var j=c?g:0;Y(e,"ignore-ease-out")&&(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve())),r.push(new _(function(){Ba(e).done(function(){Y(e,"ignore-ease-out")||(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve()))})},j))}}),q=new _(function(){n=!1,da(),i=!0,f.length==h&&i&&d&&(la(b),za(b),k.resolve()),d?f.each(function(){var c=a(this),e=Y(c,"time");"all"==e&&(Y(c,"ignore-ease-out")&&(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve())),Ba(c).done(function(){Y(c,"ignore-ease-out")||(h++,f.length==h&&i&&d&&(la(b),za(b),k.resolve()))}))}):k.resolve()},g),k.promise()}function ja(a){return na(a)||ta(a)}function ka(a){na(a)?qa(a):va(a)}function la(a){ra(a),wa(a)}function ma(a){na(a)?sa(a):xa(a)}function na(a){return a.hasClass("cs-yt-iframe")}function oa(a){return t[a.attr("id")].player}function pa(a){return oa(a).getPlayerState()}function qa(a){!Y(a,"autoplay")||t[a.attr("id")].played_once||aa()||oa(a).playVideo(),2==pa(a)&&oa(a).playVideo(),t[a.attr("id")].played_once=!0}function ra(b){$(b).each(function(){var b=a(this);b.find(j+".cs-yt-iframe").each(function(){sa(a(this))})})}function sa(a){1==pa(a)&&oa(a).pauseVideo()}function ta(a){return a.hasClass("cs-vimeo-iframe")}function ua(a){return u[a.attr("id")].player}function va(a){!Y(a,"autoplay")||u[a.attr("id")].played_once||aa()||ua(a).api("play"),ua(a).api("paused")&&!u[a.attr("id")].ended&&u[a.attr("id")].played_once&&ua(a).api("play")}function wa(b){$(b).each(function(){var b=a(this);b.find(j+".cs-vimeo-iframe").each(function(){xa(a(this))})})}function xa(a){ua(a).api("pause")}function ya(b){var c=$(b),d=Y(c,"in"),e=Y(c,"ease-in"),f=new a.Deferred;if("block"==c.css("display"))return f.resolve().promise();if(p)return c.css({display:"block",top:0,left:0,opacity:Y(c,"opacity")}),f.resolve().promise();switch(d){case"fade":c.css({display:"block",top:0,left:0,opacity:0}),c.animate({opacity:Y(c,"opacity")},e,function(){f.resolve()});break;case"fadeLeft":c.css({display:"block",top:0,left:U(),opacity:0}),c.animate({opacity:Y(c,"opacity"),left:0},e,function(){f.resolve()});break;case"fadeRight":c.css({display:"block",top:0,left:-U(),opacity:0}),c.animate({opacity:Y(c,"opacity"),left:0},e,function(){f.resolve()});break;case"slideLeft":c.css({display:"block",top:0,left:U(),opacity:Y(c,"opacity")}),c.animate({left:0},e,function(){f.resolve()});break;case"slideRight":c.css({display:"block",top:0,left:-U(),opacity:Y(c,"opacity")}),c.animate({left:0},e,function(){f.resolve()});break;case"slideUp":c.css({display:"block",top:V(),left:0,opacity:Y(c,"opacity")}),c.animate({top:0},e,function(){f.resolve()});break;case"slideDown":c.css({display:"block",top:-V(),left:0,opacity:Y(c,"opacity")}),c.animate({top:0},e,function(){f.resolve()});break;default:c.css({display:"block",top:0,left:0,opacity:Y(c,"opacity")}),f.resolve()}return f.promise()}function za(b){var c=$(b),d=Y(c,"out"),e=Y(c,"ease-out"),f=new a.Deferred;if("none"==c.css("display"))return f.resolve().promise();switch(d){case"fade":c.animate({opacity:0},e,function(){c.css({display:"none",opacity:Y(c,"opacity")}),f.resolve()});break;case"fadeLeft":c.animate({opacity:0,left:-U()},e,function(){c.css({display:"none",opacity:Y(c,"opacity"),left:0}),f.resolve()});break;case"fadeRight":c.animate({opacity:0,left:U()},e,function(){c.css({display:"none",opacity:Y(c,"opacity"),left:0}),f.resolve()});break;case"slideLeft":c.animate({left:-U()},e,function(){c.css({display:"none",left:0}),f.resolve()});break;case"slideRight":c.animate({left:U()},e,function(){c.css({display:"none",left:0}),f.resolve()});break;case"slideUp":c.animate({top:-V()},e,function(){c.css({display:"none",top:0}),f.resolve()});break;case"slideDown":c.animate({top:V()},e,function(){c.css({display:"none",top:0}),f.resolve()});break;default:c.css({display:"none"}),f.resolve()}return f.promise()}function Aa(b){var c=b.outerWidth(),d=b.outerHeight(),e=Y(b,"in"),f=Y(b,"ease-in"),g=Y(b,"top"),h=Y(b,"left"),i=new a.Deferred;if("block"==b.css("display"))return i.resolve().promise();switch(e){case"slideDown":b.css({display:"block",top:-d,left:P(h+L(b).left),opacity:Y(b,"opacity")}).animate({top:P(g+L(b).top)},f,function(){i.resolve()});break;case"slideUp":b.css({display:"block",top:V(),left:P(h+L(b).left),opacity:Y(b,"opacity")}).animate({top:P(g+L(b).top)},f,function(){i.resolve()});break;case"slideLeft":b.css({display:"block",top:P(g+L(b).top),left:U(),opacity:Y(b,"opacity")}).animate({left:P(h+L(b).left)},f,function(){i.resolve()});break;case"slideRight":b.css({display:"block",top:P(g+L(b).top),left:-c,opacity:Y(b,"opacity")}).animate({left:P(h+L(b).left)},f,function(){i.resolve()});break;case"fade":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left),opacity:0}).animate({opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeDown":b.css({display:"block",top:-d,left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeUp":b.css({display:"block",top:V(),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeLeft":b.css({display:"block",top:P(g+L(b).top),left:U(),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeRight":b.css({display:"block",top:P(g+L(b).top),left:-c,opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallDown":b.css({display:"block",top:P(g+L(b).top-30),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallUp":b.css({display:"block",top:P(g+L(b).top+30),left:P(h+L(b).left),opacity:0}).animate({top:P(g+L(b).top),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallLeft":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left+30),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;case"fadeSmallRight":b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left-30),opacity:0}).animate({left:P(h+L(b).left),opacity:Y(b,"opacity")},f,function(){i.resolve()});break;default:b.css({display:"block",top:P(g+L(b).top),left:P(h+L(b).left),opacity:Y(b,"opacity")}),i.resolve()}return i.promise()}function Ba(b){var c=b.outerWidth(),d=b.outerHeight(),e=Y(b,"out"),f=Y(b,"ease-out"),g=new a.Deferred;if("none"==b.css("display"))return g.resolve().promise();switch(e){case"slideDown":b.animate({top:V()},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideUp":b.animate({top:-d},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideLeft":b.animate({left:-c},f,function(){b.css({display:"none"}),g.resolve()});break;case"slideRight":b.animate({left:U()},f,function(){b.css({display:"none"}),g.resolve()});break;case"fade":b.animate({opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeDown":b.animate({top:V(),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeUp":b.animate({top:-d,opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeLeft":b.animate({left:-c,opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeRight":b.animate({left:U(),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallDown":b.animate({top:P(Y(b,"top")+L(b).top+30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallUp":b.animate({top:P(Y(b,"top")+L(b).top-30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallLeft":b.animate({left:P(Y(b,"left")+L(b).left-30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;case"fadeSmallRight":b.animate({left:P(Y(b,"left")+L(b).left+30),opacity:0},f,function(){b.css({display:"none",opacity:Y(b,"opacity")}),g.resolve()});break;default:b.css({display:"none"}),g.resolve()}return g.promise()}var k,f=a(d),g="div.crellyslider",h="ul.cs-slides",i="li.cs-slide",j="> *",l=0,m=!1,n=!1,o=!1,p=!0,q=new _(function(){},0),r=new Array,s=new Array,t={},u={},v=1,w=0;if(!crellyslider_youtube_api_ready&&y("youtube")&&b(),!crellyslider_vimeo_api_ready&&y("vimeo")&&c(),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&"undefined"!=typeof YT.Player)z();else var x=setInterval(function(){"undefined"!=typeof YT&&"undefined"!=typeof YT.Player&&(clearInterval(x),z())},100);this.resume=function(){T()},this.pause=function(){S()},this.nextSlide=function(){fa(W())},this.previousSlide=function(){fa(X())},this.changeSlide=function(a){fa(a)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return k}},a.fn.crellySlider=function(b){var c=a.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},b);return this.each(function(){if(void 0==a(this).data("crellySlider")){var b=new a.CrellySlider(this,c);a(this).data("crellySlider",b)}})}}(jQuery);
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Crelly Slider ===
2
- Contributors: fabiorino
3
  Donate link: http://crellyslider.tk/contribute-and-support/
4
  Tags: animations, layers, texts, images, videos
5
- Requires at least: 3.6.0
6
  Tested up to: 4.7
7
- Stable tag: 1.1.2
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -15,7 +15,7 @@ A free responsive slider that supports layers. Add texts, images, videos and bea
15
  Crelly Slider is a Free / Open Source responsive WordPress slider that supports layers. You can add Texts, Images, YouTube/Vimeo videos using a powerful Drag & Drop Builder and animate each of them. It is perfect to display your creative content in posts and pages.
16
  <br />
17
  <br />
18
- <a href="http://crellyslider.tk/">Official WebSite (with live demo)</a>
19
  <br />
20
  = User Friendly Admin Panel =
21
  Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
@@ -54,6 +54,19 @@ You can find the documentation <a href="http://crellyslider.tk/documentation/">h
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  = 1.1.2 =
58
  * Bug fix: security issues
59
  * Other minor changes and bug fixes
@@ -135,4 +148,4 @@ You can find the documentation <a href="http://crellyslider.tk/documentation/">h
135
  * Fixed directory error
136
 
137
  = 0.6.5 =
138
- * Initial release
1
  === Crelly Slider ===
2
+ Contributors: fabiorino
3
  Donate link: http://crellyslider.tk/contribute-and-support/
4
  Tags: animations, layers, texts, images, videos
5
+ Requires at least: 3.9
6
  Tested up to: 4.7
7
+ Stable tag: 1.2.0
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
15
  Crelly Slider is a Free / Open Source responsive WordPress slider that supports layers. You can add Texts, Images, YouTube/Vimeo videos using a powerful Drag & Drop Builder and animate each of them. It is perfect to display your creative content in posts and pages.
16
  <br />
17
  <br />
18
+ <a href="http://crellyslider.tk/">Official WebSite (with live demo)</a> [currently not working, I'm sorry: I'm having some issues with my hosting provider. It will be online in a couple of days]
19
  <br />
20
  = User Friendly Admin Panel =
21
  Crelly Slider does not require any Coding Knowledge. With the simple admin panel you will be able to create the sliders in the easiest way. Upload images with the default WordPress interface or choose colors using the picker.
54
 
55
  == Changelog ==
56
 
57
+ = 1.2.0 =
58
+ * New feature: texts can be edited with the default WordPress editor (TinyMCE)
59
+ * New feature: the order of the slides can be set to "random"
60
+ * New feature: you can select the first slide that will be displayed
61
+ * New feature: slides can be marked as "draft"
62
+ * New feature: Crelly Slider is now compatible with WP Offload S3
63
+ * Improvement: the YouTube and the Vimeo APIs won't be loaded unless there is a video in the slider
64
+ * Bug fix: when a text element was selected and then modified, the black box around it wasn't correctly adapted to fit the new dimensions
65
+ * Bug fix: when a slide was cloned, it was impossible to change its background color and to move its elements, unless by refreshing the page
66
+ * Bug fix: improved compatibility for some web hosting providers that restricted the import/export functions
67
+ * Bug fix: when you added a really large image element, the element options were covered by the image
68
+ * Other minor changes and bug fixes
69
+
70
  = 1.1.2 =
71
  * Bug fix: security issues
72
  * Other minor changes and bug fixes
148
  * Fixed directory error
149
 
150
  = 0.6.5 =
151
+ * Initial release
wordpress/admin.php CHANGED
@@ -123,6 +123,13 @@ class CrellySliderAdmin {
123
  }
124
  ?>
125
 
 
 
 
 
 
 
 
126
  <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
127
  <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
128
  <?php if($edit): ?>
@@ -166,6 +173,7 @@ class CrellySliderAdmin {
166
  ?>
167
  <script type="text/javascript">
168
  var crellyslider_is_wordpress_admin = true;
 
169
  </script>
170
  <?php
171
  }
@@ -264,6 +272,7 @@ class CrellySliderAdmin {
264
  'duplicate_slide' => __('Duplicate slide', 'crelly-slider'),
265
  'remove_slide' => __('Delete slide', 'crelly-slider'),
266
  'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
 
267
  );
268
  wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
269
  }
123
  }
124
  ?>
125
 
126
+ <div class="cs-useless-wp_editor" style="display: none;">
127
+ <?php
128
+ // I need to call wp_editor just to include TinyMCE's javascript
129
+ wp_editor('', 'cs-element-editor-useless');
130
+ ?>
131
+ </div>
132
+
133
  <div class="cs-slider <?php echo $edit ? 'cs-edit-slider' : 'cs-add-slider' ?>">
134
  <div class="cs-tabs cs-tabs-fade cs-tabs-switch-interface">
135
  <?php if($edit): ?>
173
  ?>
174
  <script type="text/javascript">
175
  var crellyslider_is_wordpress_admin = true;
176
+ var crellyslider_locale = '<?php echo get_locale(); ?>';
177
  </script>
178
  <?php
179
  }
272
  'duplicate_slide' => __('Duplicate slide', 'crelly-slider'),
273
  'remove_slide' => __('Delete slide', 'crelly-slider'),
274
  'exit_without_saving' => __('All unsaved changes will be lost. Are you sure you want to leave this page?', 'crelly-slider'),
275
+ 'switch_editor' => __('Switch editor', 'crelly-slider'),
276
  );
277
  wp_localize_script('crellyslider-admin', 'crellyslider_translations', $crellyslider_translations);
278
  }
wordpress/ajax.php CHANGED
@@ -1,6 +1,24 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  /********************/
5
  /** AJAX CALLBACKS **/
6
  /********************/
@@ -97,6 +115,8 @@ function crellyslider_insertSliderSQL($options) {
97
  'showProgressBar' => $options['showProgressBar'],
98
  'pauseOnHover' => $options['pauseOnHover'],
99
  'callbacks' => $options['callbacks'],
 
 
100
  'enableSwipe' => $options['enableSwipe'],
101
  ),
102
  array(
@@ -113,6 +133,8 @@ function crellyslider_insertSliderSQL($options) {
113
  '%d',
114
  '%s',
115
  '%d',
 
 
116
  )
117
  );
118
  }
@@ -144,6 +166,8 @@ function crellyslider_editSlider_callback() {
144
  'showProgressBar' => $options['showProgressBar'],
145
  'pauseOnHover' => $options['pauseOnHover'],
146
  'callbacks' => $options['callbacks'],
 
 
147
  'enableSwipe' => $options['enableSwipe'],
148
  ),
149
  array('id' => esc_sql($options['id'])),
@@ -161,6 +185,8 @@ function crellyslider_editSlider_callback() {
161
  '%d',
162
  '%s',
163
  '%d',
 
 
164
  ),
165
  array('%d')
166
  );
@@ -197,6 +223,7 @@ function crellyslider_editSlides_callback() {
197
  echo json_encode(false);
198
  return;
199
  }
 
200
  $output = crellyslider_wp_insert_rows($options['options'], $wpdb->prefix . 'crellyslider_slides');
201
 
202
  // Returning
@@ -430,9 +457,9 @@ function crellyslider_exportSlider_callback() {
430
 
431
  // Add images to zip and remove media directory URLs
432
  if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
433
- $img = $slides[$key]['background_type_image'];
434
- $zip->addFromString(basename($img), file_get_contents($img));
435
- $slides[$key]['background_type_image'] = basename($img);
436
  }
437
  }
438
  $result['slides'] = $slides;
@@ -447,8 +474,8 @@ function crellyslider_exportSlider_callback() {
447
 
448
  // Add images to zip and remove media directory URLs
449
  if($elements[$key]['type'] == 'image') {
450
- $img = $elements[$key]['image_src'];
451
- $zip->addFromString(basename($img), file_get_contents($img));
452
  $elements[$key]['image_src'] = basename($img);
453
  }
454
  }
@@ -505,7 +532,15 @@ function crellyslider_importSlider_callback() {
505
 
506
  $sliders = $imported_array->sliders;
507
  foreach($sliders as $slider) {
508
- $output = crellyslider_insertSliderSQL((array) $slider);
 
 
 
 
 
 
 
 
509
  }
510
 
511
  if($output === false) {
@@ -525,12 +560,9 @@ function crellyslider_importSlider_callback() {
525
 
526
  // Set background images
527
  if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
528
- $upload = media_sideload_image(CS_PLUGIN_URL . '/wordpress/temp/' . $slides[$key]->background_type_image, 0, null, 'src');
529
- if(is_wp_error($upload)) {
530
- echo json_encode(false);
531
- return;
532
- }
533
- $slides[$key]->background_type_image = $upload;
534
  }
535
  }
536
  $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
@@ -550,12 +582,9 @@ function crellyslider_importSlider_callback() {
550
 
551
  // Set images
552
  if($elements[$key]->type == 'image') {
553
- $upload = media_sideload_image(CS_PLUGIN_URL . '/wordpress/temp/' . $elements[$key]->image_src, 0, null, 'src');
554
- if(is_wp_error($upload)) {
555
- echo json_encode(false);
556
- return;
557
- }
558
- $elements[$key]->image_src = $upload;
559
  }
560
  }
561
  $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
@@ -594,4 +623,29 @@ function crellyslider_importSlider_callback() {
594
  die();
595
  }
596
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  ?>
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ /************************/
5
+ /** EXTERNAL RESOURCES **/
6
+ /************************/
7
+
8
+ // Alternative to file_get_contents. If CURL is not installed, file_get_contents is called
9
+ // http://stackoverflow.com/questions/3979802/alternative-to-file-get-contents
10
+ function crellyslider_url_get_contents ($Url) {
11
+ if (!function_exists('curl_init')){
12
+ return file_get_contents($Url);
13
+ }
14
+ $ch = curl_init();
15
+ curl_setopt($ch, CURLOPT_URL, $Url);
16
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
17
+ $output = curl_exec($ch);
18
+ curl_close($ch);
19
+ return $output;
20
+ }
21
+
22
  /********************/
23
  /** AJAX CALLBACKS **/
24
  /********************/
115
  'showProgressBar' => $options['showProgressBar'],
116
  'pauseOnHover' => $options['pauseOnHover'],
117
  'callbacks' => $options['callbacks'],
118
+ 'randomOrder' => $options['randomOrder'],
119
+ 'startFromSlide' => $options['startFromSlide'],
120
  'enableSwipe' => $options['enableSwipe'],
121
  ),
122
  array(
133
  '%d',
134
  '%s',
135
  '%d',
136
+ '%d',
137
+ '%d',
138
  )
139
  );
140
  }
166
  'showProgressBar' => $options['showProgressBar'],
167
  'pauseOnHover' => $options['pauseOnHover'],
168
  'callbacks' => $options['callbacks'],
169
+ 'randomOrder' => $options['randomOrder'],
170
+ 'startFromSlide' => $options['startFromSlide'],
171
  'enableSwipe' => $options['enableSwipe'],
172
  ),
173
  array('id' => esc_sql($options['id'])),
185
  '%d',
186
  '%s',
187
  '%d',
188
+ '%d',
189
+ '%d',
190
  ),
191
  array('%d')
192
  );
223
  echo json_encode(false);
224
  return;
225
  }
226
+
227
  $output = crellyslider_wp_insert_rows($options['options'], $wpdb->prefix . 'crellyslider_slides');
228
 
229
  // Returning
457
 
458
  // Add images to zip and remove media directory URLs
459
  if($slides[$key]['background_type_image'] != 'none' && $slides[$key]['background_type_image'] != 'undefined') {
460
+ $img = CrellySliderCommon::getURL($slides[$key]['background_type_image']);
461
+ $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
462
+ $slides[$key]['background_type_image'] = basename($img);
463
  }
464
  }
465
  $result['slides'] = $slides;
474
 
475
  // Add images to zip and remove media directory URLs
476
  if($elements[$key]['type'] == 'image') {
477
+ $img = CrellySliderCommon::getURL($elements[$key]['image_src']);
478
+ $zip->addFromString(basename($img), crellyslider_url_get_contents($img));
479
  $elements[$key]['image_src'] = basename($img);
480
  }
481
  }
532
 
533
  $sliders = $imported_array->sliders;
534
  foreach($sliders as $slider) {
535
+ // Prevent compatiblity issues with old .zip exported sliders (< 1.2.0)
536
+ if(! isset($slider->randomOrder)) {
537
+ $slider->randomOrder = 0;
538
+ }
539
+ if(! isset($slider->startFromSlide)) {
540
+ $slider->startFromSlide = 0;
541
+ }
542
+
543
+ $output = crellyslider_insertSliderSQL((array) $slider);
544
  }
545
 
546
  if($output === false) {
560
 
561
  // Set background images
562
  if($slides[$key]->background_type_image != 'undefined' && $slides[$key]->background_type_image != 'none') {
563
+ $url = CS_PLUGIN_URL . '/wordpress/temp/' . $slides[$key]->background_type_image;
564
+ $id = crellyslider_importImage($url);
565
+ $slides[$key]->background_type_image = $id;
 
 
 
566
  }
567
  }
568
  $temp = crellyslider_wp_insert_rows($slides, $wpdb->prefix . 'crellyslider_slides');
582
 
583
  // Set images
584
  if($elements[$key]->type == 'image') {
585
+ $url = CS_PLUGIN_URL . '/wordpress/temp/' . $elements[$key]->image_src;
586
+ $id = crellyslider_importImage($url);
587
+ $elements[$key]->image_src = $id;
 
 
 
588
  }
589
  }
590
  $temp = crellyslider_wp_insert_rows($elements, $wpdb->prefix . 'crellyslider_elements');
623
  die();
624
  }
625
  }
626
+
627
+ // Imports an image to the WordPress media library. Returns the attachment ID
628
+ function crellyslider_importImage($local_url) {
629
+ $url = $local_url;
630
+ $tmp = download_url($url);
631
+ if( is_wp_error( $tmp ) ){
632
+ echo json_encode(false);
633
+ die();
634
+ }
635
+ $file_array = array();
636
+ preg_match('/[^\?]+\.(jpg|jpe|jpeg|gif|png)/i', $url, $matches);
637
+ $file_array['name'] = basename($matches[0]);
638
+ $file_array['tmp_name'] = $tmp;
639
+ if (is_wp_error($tmp)) {
640
+ @unlink($file_array['tmp_name']);
641
+ $file_array['tmp_name'] = '';
642
+ }
643
+ $id = media_handle_sideload($file_array, 0);
644
+ if ( is_wp_error($id) ) {
645
+ @unlink($file_array['tmp_name']);
646
+ return false;
647
+ }
648
+
649
+ return $id;
650
+ }
651
  ?>
wordpress/common.php CHANGED
@@ -40,5 +40,34 @@ class CrellySliderCommon {
40
  }
41
  return false;
42
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
  ?>
40
  }
41
  return false;
42
  }
43
+
44
+ // Returns the correct URL of an attachment
45
+ public static function getURL($attachment_url) {
46
+ // If the attachment ID is provided, get the URL
47
+ if(is_numeric($attachment_url)) {
48
+ return wp_get_attachment_url(intval($attachment_url));
49
+ }
50
+
51
+ // If a URL is provided, return the filtered URL
52
+ if($attachment_url != 'none' && $attachment_url != 'undefined' && $attachment_url != '') {
53
+ global $wpdb;
54
+ $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s'", $attachment_url));
55
+
56
+ if($attachment_id == NULL) {
57
+ return $attachment_url;
58
+ }
59
+
60
+ $ret = wp_get_attachment_url($attachment_id);
61
+
62
+ if($ret == false) {
63
+ return $attachment_url;
64
+ }
65
+
66
+ return $ret;
67
+ }
68
+
69
+ // If something else is provided, do not touch it
70
+ return $attachment_url;
71
+ }
72
  }
73
  ?>
wordpress/css/admin.css CHANGED
@@ -224,6 +224,8 @@
224
  border-spacing: 0px;
225
  border-collapse: separate;
226
  clear: left;
 
 
227
  }
228
 
229
  .cs-admin .cs-table th,
@@ -361,7 +363,7 @@
361
  padding-right: 20px;
362
  margin-right: 20px;
363
  border-right: solid 1px #ddd;
364
- text-transform: uppercase;
365
  font-weight: bold;
366
  outline: none;
367
  display: block;
@@ -454,12 +456,12 @@
454
  margin: 0 auto;
455
  line-height: 1.5;
456
  white-space: nowrap;
457
-
458
  line-height: 1.5;
459
  font-size: 14px;
460
  color: #000;
461
  font-family: 'Verdana', sans-serif;
462
-
463
  /* Default slide background settings: */
464
  background-repeat: no-repeat;
465
  background-size: cover;
@@ -507,6 +509,8 @@
507
 
508
  .cs-admin .cs-slide .cs-elements .cs-elements-actions {
509
  text-align: center;
 
 
510
  }
511
 
512
  .cs-admin .cs-slide .cs-elements .cs-void-element-settings {
@@ -550,4 +554,13 @@
550
  -webkit-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
551
  -moz-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
552
  box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
553
- }
 
 
 
 
 
 
 
 
 
224
  border-spacing: 0px;
225
  border-collapse: separate;
226
  clear: left;
227
+ position: relative;
228
+ z-index: 999;
229
  }
230
 
231
  .cs-admin .cs-table th,
363
  padding-right: 20px;
364
  margin-right: 20px;
365
  border-right: solid 1px #ddd;
366
+ text-transform: uppercase;
367
  font-weight: bold;
368
  outline: none;
369
  display: block;
456
  margin: 0 auto;
457
  line-height: 1.5;
458
  white-space: nowrap;
459
+
460
  line-height: 1.5;
461
  font-size: 14px;
462
  color: #000;
463
  font-family: 'Verdana', sans-serif;
464
+
465
  /* Default slide background settings: */
466
  background-repeat: no-repeat;
467
  background-size: cover;
509
 
510
  .cs-admin .cs-slide .cs-elements .cs-elements-actions {
511
  text-align: center;
512
+ z-index: 999;
513
+ position: relative;
514
  }
515
 
516
  .cs-admin .cs-slide .cs-elements .cs-void-element-settings {
554
  -webkit-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
555
  -moz-box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
556
  box-shadow: 0px 0px 0px 2px rgba(50, 50, 50, 0.75);
557
+ }
558
+
559
+ .cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-switch-editor {
560
+ margin-bottom: 15px;
561
+ text-align: right;
562
+ }
563
+
564
+ .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
565
+ display: block !important;
566
+ }
wordpress/elements.php CHANGED
@@ -12,11 +12,14 @@ function crellyslider_printElements($edit, $slider, $slide, $elements) {
12
  if($slide->background_type_image != 'none') {
13
  echo 'data-background-image-src="' . stripslashes($slide->background_type_image) . '"';
14
  }
 
 
 
15
  ?>
16
  style="
17
  width: <?php echo esc_attr($slider->startWidth); ?>px;
18
  height: <?php echo esc_attr($slider->startHeight); ?>px;
19
- background-image: url('<?php echo stripslashes($slide->background_type_image); ?>');
20
  background-color: <?php echo esc_attr($slide->background_type_color) == 'transparent' ? 'rgb(255, 255, 255)' : esc_attr($slide->background_type_color); ?>;
21
  background-position: <?php echo esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y); ?>;
22
  background-repeat: <?php echo esc_attr($slide->background_repeat); ?>;
@@ -75,7 +78,7 @@ function crellyslider_printElements($edit, $slider, $slide, $elements) {
75
  case 'image':
76
  ?>
77
  <img
78
- src="<?php echo esc_url($element->image_src); ?>"
79
  alt="<?php echo esc_attr($element->image_alt); ?>"
80
  style="
81
  <?php
@@ -249,7 +252,7 @@ function crellyslider_printTextElement($element) {
249
  <td class="cs-content">
250
  <?php
251
  if($void) echo '<textarea class="cs-element-inner_html">' . __('Text element', 'crelly-slider') . '</textarea>';
252
- else echo '<textarea class="cs-element-inner_html">' . esc_textarea($element->inner_html) . '</textarea>';
253
  ?>
254
  </td>
255
  <td class="cs-description">
@@ -499,7 +502,7 @@ function crellyslider_printImageElement($element) {
499
  <td class="cs-content">
500
  <?php
501
  if($void) echo '<input class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
502
- else echo '<input data-src="' . esc_url($element->image_src) . '" data-alt="' . esc_attr($element->image_alt) . '" class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
503
  ?>
504
  </td>
505
  <td class="cs-description">
12
  if($slide->background_type_image != 'none') {
13
  echo 'data-background-image-src="' . stripslashes($slide->background_type_image) . '"';
14
  }
15
+
16
+ $background_url = CrellySliderCommon::getURL(stripslashes($slide->background_type_image));
17
+
18
  ?>
19
  style="
20
  width: <?php echo esc_attr($slider->startWidth); ?>px;
21
  height: <?php echo esc_attr($slider->startHeight); ?>px;
22
+ background-image: url('<?php echo $background_url; ?>');
23
  background-color: <?php echo esc_attr($slide->background_type_color) == 'transparent' ? 'rgb(255, 255, 255)' : esc_attr($slide->background_type_color); ?>;
24
  background-position: <?php echo esc_attr($slide->background_propriety_position_x) . ' ' . esc_attr($slide->background_propriety_position_y); ?>;
25
  background-repeat: <?php echo esc_attr($slide->background_repeat); ?>;
78
  case 'image':
79
  ?>
80
  <img
81
+ src="<?php echo CrellySliderCommon::getURL(stripslashes($element->image_src)); ?>"
82
  alt="<?php echo esc_attr($element->image_alt); ?>"
83
  style="
84
  <?php
252
  <td class="cs-content">
253
  <?php
254
  if($void) echo '<textarea class="cs-element-inner_html">' . __('Text element', 'crelly-slider') . '</textarea>';
255
+ else echo '<textarea class="cs-element-inner_html">' . esc_textarea(stripslashes($element->inner_html)) . '</textarea>';
256
  ?>
257
  </td>
258
  <td class="cs-description">
502
  <td class="cs-content">
503
  <?php
504
  if($void) echo '<input class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
505
+ else echo '<input data-src="' . stripslashes($element->image_src) . '" data-alt="' . esc_attr($element->image_alt) . '" class="cs-image-element-upload-button cs-button cs-is-default" type="button" value="' . __('Open gallery', 'crelly-slider') . '" />';
506
  ?>
507
  </td>
508
  <td class="cs-description">
wordpress/frontend.php CHANGED
@@ -50,14 +50,14 @@ class CrellySliderFrontend {
50
  }
51
 
52
  $slider_id = esc_sql($slider->id);
53
- $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY position', $slider_id));
54
 
55
  $output = '';
56
 
57
  $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . '" id="crellyslider-' . esc_attr($slider_id) . '">' . "\n";
58
  $output .= '<ul>' . "\n";
59
  foreach($slides as $slide) {
60
- $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . stripslashes($slide->background_type_image) . '\');';
61
  $output .= '<li' . "\n" .
62
  'style="' . "\n" .
63
  'background-color: ' . esc_attr($slide->background_type_color) . ';' . "\n" .
@@ -137,7 +137,7 @@ class CrellySliderFrontend {
137
  case 'image':
138
  $output .= '<img' . "\n" .
139
  'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
140
- 'src="' . esc_url($element->image_src) . '"' . "\n" .
141
  'alt="' . esc_attr($element->image_alt) . '"' . "\n" .
142
  'style="' . "\n";
143
  if($element->link == '') {
@@ -228,6 +228,12 @@ class CrellySliderFrontend {
228
  $output .= 'enableSwipe: ' . $slider->enableSwipe . ',' . "\n";
229
  $output .= 'showProgressBar: ' . $slider->showProgressBar . ',' . "\n";
230
  $output .= 'pauseOnHover: ' . $slider->pauseOnHover . ',' . "\n";
 
 
 
 
 
 
231
  $output .= stripslashes($slider->callbacks) . "\n";
232
  $output .= '});' . "\n";
233
  $output .= '});' . "\n";
50
  }
51
 
52
  $slider_id = esc_sql($slider->id);
53
+ $slides = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE draft = 0 AND slider_parent = %d ORDER BY position', $slider_id));
54
 
55
  $output = '';
56
 
57
  $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . '" id="crellyslider-' . esc_attr($slider_id) . '">' . "\n";
58
  $output .= '<ul>' . "\n";
59
  foreach($slides as $slide) {
60
+ $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . CrellySliderCommon::getURL($slide->background_type_image) . '\');';
61
  $output .= '<li' . "\n" .
62
  'style="' . "\n" .
63
  'background-color: ' . esc_attr($slide->background_type_color) . ';' . "\n" .
137
  case 'image':
138
  $output .= '<img' . "\n" .
139
  'class="' . esc_attr($element->custom_css_classes) . '"' . "\n" .
140
+ 'src="' . CrellySliderCommon::getURL($element->image_src) . '"' . "\n" .
141
  'alt="' . esc_attr($element->image_alt) . '"' . "\n" .
142
  'style="' . "\n";
143
  if($element->link == '') {
228
  $output .= 'enableSwipe: ' . $slider->enableSwipe . ',' . "\n";
229
  $output .= 'showProgressBar: ' . $slider->showProgressBar . ',' . "\n";
230
  $output .= 'pauseOnHover: ' . $slider->pauseOnHover . ',' . "\n";
231
+ if($slider->randomOrder != NULL) {
232
+ $output .= 'randomOrder: ' . $slider->randomOrder . ',' . "\n";
233
+ }
234
+ if($slider->startFromSlide != NULL) {
235
+ $output .= 'startFromSlide: ' . $slider->startFromSlide . ',' . "\n";
236
+ }
237
  $output .= stripslashes($slider->callbacks) . "\n";
238
  $output .= '});' . "\n";
239
  $output .= '});' . "\n";
wordpress/js/admin.js CHANGED
@@ -30,28 +30,28 @@
30
 
31
  (function($) {
32
  $(window).load(function() {
33
-
34
  // Simulate keyup. Useful when textboxes change value
35
  function crellyslider_keyup(element) {
36
  $(element).trigger('keyup');
37
  }
38
-
39
  // Slider settings and slide tabs
40
  $('#cs-show-slider-settings').click(function() {
41
  $('#cs-slider-settings').fadeIn();
42
  $('#cs-slides').hide();
43
- });
44
  $('#cs-show-slides').click(function() {
45
  $('#cs-slides').fadeIn();
46
  $('#cs-slider-settings').hide();
47
  });
48
-
49
  // Run draggables
50
  crellyslider_draggableElements();
51
-
52
  function crellyslider_showSuccess() {
53
  $('.cs-admin .cs-message .cs-message-working').css('display', 'none');
54
-
55
  var target = $('.cs-admin .cs-message.cs-message-ok');
56
  target.css({
57
  'display' : 'block',
@@ -67,10 +67,10 @@
67
  target.css('display', 'none');
68
  });
69
  }
70
-
71
  function crellyslider_showError() {
72
  $('.cs-admin .cs-message .cs-message-working').css('display', 'none');
73
-
74
  var target = $('.cs-admin .cs-message.cs-message-error');
75
  target.css({
76
  'display' : 'block',
@@ -86,17 +86,17 @@
86
  target.css('display', 'none');
87
  });
88
  }
89
-
90
  /*************/
91
  /** SLIDERS **/
92
  /*************/
93
-
94
- // Set Alias
95
  $('.cs-slider').find('#cs-slider-name').keyup(function() {
96
  var alias = crellyslider_getAlias();
97
  $('.cs-slider').find('#cs-slider-alias').text(alias);
98
  });
99
-
100
  // Set shortcode
101
  $('.cs-slider').find('#cs-slider-name').keyup(function() {
102
  var alias = crellyslider_getAlias();
@@ -111,7 +111,7 @@
111
  $('.cs-slider').find('#cs-slider-shortcode').text('');
112
  }
113
  });
114
-
115
  // Set the new sizes of the editing area and of the slider if changing values
116
  $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').keyup(function() {
117
  crellyslider_setSlidesEditingAreaSizes();
@@ -119,7 +119,7 @@
119
  $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').keyup(function() {
120
  crellyslider_setSlidesEditingAreaSizes();
121
  });
122
-
123
  // Get the alias starting form the name
124
  function crellyslider_getAlias() {
125
  var slider_name = $('.cs-slider').find('#cs-slider-name').val();
@@ -127,13 +127,13 @@
127
  slider_alias = slider_alias.replace(/ /g, '_');
128
  return slider_alias;
129
  }
130
-
131
  /************/
132
  /** SLIDES **/
133
  /************/
134
-
135
  var slides_number = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length - 1;
136
-
137
  // Run sortable
138
  var slide_before; // Contains the index before the sorting
139
  var slide_after; // Contains the index after the sorting
@@ -143,72 +143,74 @@
143
  connectWith: '.cs-slide-tabs .cs-sortable',
144
  containment: 'parent',
145
  placeholder: 'sortable-placeholder',
146
-
147
  start: function(event, ui) {
148
  // Store the current index
149
  slide_before = $(ui.item).index();
150
-
151
  ui.placeholder.height(ui.helper.height() - 1);
152
  ui.placeholder.width(ui.helper.width() - 1);
153
  },
154
-
155
  // Change the .cs-slide order based on the new index and rename the tabs
156
- update: function(event, ui) {
157
  // Store the new index
158
  slide_after = $(ui.item).index();
159
-
160
  // Change the slide position
161
- var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_before + ')');
162
- var after = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_after + ')');
163
  if(slide_before < slide_after) {
164
  slide.insertAfter(after);
165
  }
166
  else {
167
  slide.insertBefore(after);
168
  }
169
-
170
  // Rename all the tabs
171
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').each(function() {
172
  var temp = $(this);
173
- if(!temp.find('a').hasClass('cs-add-new')) {
174
  temp.find('a').html('<span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (temp.index() + 1) + '</span></span>');
175
  }
176
  });
177
  }
178
  });
179
  $('.cs-slide-tabs .cs-sortable li').disableSelection();
180
-
181
  // Show the slide when clicking on the link
182
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li > a').live('click', function() {
183
- // Do only if is not click add new
 
 
184
  if($(this).parent().index() != slides_number) {
185
  // Stop previews
186
  $('.cs-admin #cs-slides .cs-slide .cs-elements .cs-elements-actions .cs-live-preview').each(function() {
187
  var btn = $(this);
188
  var slide_parent = btn.closest('.cs-slide');
189
-
190
  if(btn.hasClass('cs-live-preview-running')) {
191
  btn.removeClass('cs-live-preview-running');
192
  btn.text(crellyslider_translations.slide_live_preview);
193
  crellyslider_stopLivePreview(slide_parent);
194
  }
195
  });
196
-
197
  // Hide all tabs
198
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
199
  var tab = $(this).parent().index();
200
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + tab + ')').css('display', 'block');
201
-
202
  // Active class
203
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
204
  $(this).parent().addClass('active');
205
  }
206
  });
207
-
208
  // Add new
209
  function crellyslider_addSlide() {
210
  var add_btn = $('.cs-admin #cs-slides .cs-add-new');
211
-
212
  var void_slide = $('.cs-admin #cs-slides .cs-void-slide').html();
213
  // Insert the link at the end of the list
214
  add_btn.parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
@@ -217,25 +219,28 @@
217
  // Create the slide
218
  $('.cs-admin #cs-slides .cs-slides-list').append('<div class="cs-slide">' + void_slide + '</div>');
219
  slides_number++;
220
-
221
  // Open the tab just created
222
  var tab_index = add_btn.parent().index() - 1;
223
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).find('a').click();
224
-
225
  // Active class
226
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
227
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).addClass('active');
228
-
229
  // Set editing area sizes
230
  crellyslider_setSlidesEditingAreaSizes();
231
-
232
  crellyslider_slidesColorPicker();
 
 
 
233
  }
234
-
235
  // Add new on click
236
  $('.cs-admin #cs-slides .cs-add-new').click(function() {
237
  crellyslider_addSlide();
238
- });
239
  // Also add a new slide if slides_number == 0
240
  if(slides_number == 0) {
241
  crellyslider_addSlide();
@@ -243,77 +248,99 @@
243
  else {
244
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
245
  }
246
-
247
  // Delete
248
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-close').live('click', function() {
249
  if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length <= 2) {
250
  alert(crellyslider_translations.slide_delete_just_one);
251
  return;
252
  }
253
-
254
  var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
255
  if(!confirm) {
256
  return;
257
  }
258
-
259
  slides_number--;
260
-
261
  var slide_index = $(this).parent().index();
262
-
263
  // If is deleting the current viewing slide, set the first as active
264
  if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(slide_index).hasClass('active') && slides_number != 0) {
265
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).addClass('active');
266
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
267
- $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(0).css('display', 'block');
268
  }
269
-
270
  // Remove the anchor
271
  $(this).parent().remove();
272
  // Remove the slide itself
273
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index).remove();
274
-
275
  // Scale back all the slides text
276
  for(var i = slide_index; i < slides_number; i++) {
277
  var slide = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(i);
278
  var indx = parseInt(slide.find('.cs-slide-index').text());
279
  slide.find('.cs-slide-index').text(indx - 1);
280
  }
 
 
 
 
 
 
281
  });
282
-
283
- // Duplicate
284
- $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-duplicate').live('click', function() {
285
- var slide_index = $(this).parent().index();
286
- var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index);
287
-
288
- // Clone the slide settings table
289
- slide.crellyslider_betterClone(true).appendTo(slide.parent()).css('display', 'none');
290
-
291
- // Insert the link at the end of the list
292
- $(this).parent().parent().find('.cs-add-new').parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
293
- $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
294
-
295
- crellyslider_draggableElements();
296
-
297
- slides_number++;
298
- });
299
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  // Set correct size for the editing area
301
  function crellyslider_setSlidesEditingAreaSizes() {
302
  var width = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val());
303
  var height = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val());
304
-
305
  $('.cs-admin #cs-slides .cs-slide .cs-slide-editing-area').css({
306
  'width' : width,
307
  'height' : height,
308
  });
309
-
310
  $('.cs-admin').css({
311
  'width' : width,
312
  });
313
  }
314
-
315
  crellyslider_slidesColorPicker();
316
-
317
  // Run background color picker
318
  function crellyslider_slidesColorPicker() {
319
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input').wpColorPicker({
@@ -335,13 +362,13 @@
335
  palettes: true
336
  });
337
  }
338
-
339
  // Set background color (transparent == 0, color-picker == 1 or manual == 2). For backward compatiblity, a "-1" is used to indicate that there were no way to set the bg color manually
340
  $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_color"]:radio', function() {
341
  var btn = $(this);
342
  var btn_val = btn.val();
343
  var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
344
-
345
  if(btn_val == '0') {
346
  area.css('background-color', '#fff');
347
  }
@@ -353,21 +380,21 @@
353
  area.css('background-color', btn.closest('.cs-content').find('.cs-slide-background_type_color-manual').val());
354
  }
355
  });
356
-
357
- $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-manual', function() {
358
  var text = $(this);
359
  var val = text.val();
360
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
361
 
362
  text.closest('.cs-slide').find('input[name="cs-slide-background_type_color"][value="2"]:radio').prop('checked', true);
363
- area.css('background-color', val);
364
  });
365
-
366
  // Set background image (none or image)
367
  $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_image"]:radio', function() {
368
  var btn = $(this);
369
  var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
370
-
371
  if(btn.val() == '0') {
372
  area.css('background-image', 'none');
373
  }
@@ -376,7 +403,7 @@
376
  crellyslider_addSlideImageBackground(slide_parent);
377
  }
378
  });
379
-
380
  // Set Background image (the upload function)
381
  $('.cs-admin #cs-slides').on('click', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_image-upload-button', function() {
382
  var btn = $(this);
@@ -392,7 +419,7 @@
392
  });
393
  function crellyslider_addSlideImageBackground(slide_parent) {
394
  var area = slide_parent.find('.cs-slide-editing-area');
395
-
396
  // Upload
397
  var file_frame;
398
 
@@ -419,22 +446,24 @@
419
  // Do something with attachment.id and/or attachment.url here
420
  var image_src = attachment.url;
421
  var image_alt = attachment.alt;
422
-
 
423
  // Set background
424
  area.css('background-image', 'url("' + image_src + '")');
425
- // I add a data with the src because, is not like images (when there is only the src link), the background contains the url('') string that is very annoying when we will get the content
426
- area.data('background-image-src', image_src);
 
427
  });
428
 
429
  // Finally, open the modal
430
- file_frame.open();
431
  }
432
-
433
  // Background propriety: repeat or no-repeat
434
  $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_repeat"]:radio', function() {
435
  var btn = $(this);
436
  var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
437
-
438
  if(btn.val() == '0') {
439
  area.css('background-repeat', 'no-repeat');
440
  }
@@ -442,79 +471,79 @@
442
  area.css('background-repeat', 'repeat');
443
  }
444
  });
445
-
446
  // Background propriety: positions x and y
447
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_x', function() {
448
  var text = $(this);
449
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
450
-
451
  var x = text.val();
452
  var y = text.parent().find('.cs-slide-background_propriety_position_y').val();
453
-
454
  area.css('background-position', x + ' ' + y);
455
  });
456
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_y', function() {
457
  var text = $(this);
458
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
459
-
460
  var x = text.parent().find('.cs-slide-background_propriety_position_x').val();
461
  var y = text.val();
462
-
463
  area.css('background-position', x + ' ' + y);
464
  });
465
-
466
  // Background propriety: size
467
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_size', function() {
468
  var text = $(this);
469
  var val = text.val();
470
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
471
 
472
- area.css('background-size', val);
473
  });
474
-
475
  // Background presets
476
  $('.cs-slide-background-image-fullwidth-preset').click(function() {
477
- var text = $(this);
478
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
479
  var settings = text.closest('.cs-slide');
480
-
481
  settings.find('.cs-slide-background_propriety_position_x').val('center');
482
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
483
-
484
  settings.find('.cs-slide-background_propriety_position_y').val('center');
485
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
486
-
487
  settings.find('input[name="cs-slide-background_repeat"][value="0"]').prop('checked', true);
488
  area.css('background-repeat', 'no-repeat');
489
-
490
  settings.find('.cs-slide-background_propriety_size').val('cover');
491
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
492
  });
493
-
494
  $('.cs-slide-background-image-pattern-preset').click(function() {
495
- var text = $(this);
496
- var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
497
  var settings = text.closest('.cs-slide');
498
-
499
  settings.find('.cs-slide-background_propriety_position_x').val(0);
500
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
501
-
502
  settings.find('.cs-slide-background_propriety_position_y').val(0);
503
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
504
-
505
  settings.find('input[name="cs-slide-background_repeat"][value="1"]').prop('checked', true);
506
  area.css('background-repeat', 'repeat');
507
-
508
  settings.find('.cs-slide-background_propriety_size').val('auto');
509
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
510
  });
511
-
512
  // Apply custom CSS
513
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-custom_css', function() {
514
  var text = $(this);
515
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
516
  var css = text.val();
517
-
518
  // Save current styles
519
  var width = area.css('width');
520
  var height = area.css('height');
@@ -523,7 +552,7 @@
523
  var background_position = area.css('background-position');
524
  var background_repeat = area.css('background-repeat');
525
  var background_size = area.css('background-size');
526
-
527
  // Apply CSS
528
  area.attr('style', css);
529
  area.css({
@@ -535,88 +564,88 @@
535
  'background-repeat' : background_repeat,
536
  'background-size' : background_size
537
  });
538
- });
539
-
540
  /**************/
541
  /** ELEMENTS **/
542
  /**************/
543
-
544
  // GENERAL
545
-
546
  // Make draggable
547
  function crellyslider_draggableElements() {
548
- $('.cs-admin .cs-elements .cs-element').draggable({
549
  'containment' : 'parent',
550
-
551
  start: function() {
552
  // Select when dragging
553
- crellyslider_selectElement($(this));
554
  },
555
-
556
  drag: function(){
557
  // Set left and top positions on drag to the textbox
558
  var position = $(this).position();
559
  var left = position.left;
560
  var top = position.top;
561
  var index = $(this).index();
562
-
563
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
564
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
565
  },
566
  });
567
  }
568
-
569
  // Selects an element, shows its options and makes the delete element button available
570
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-slide-editing-area .cs-element', function(e) {
571
  // Do not click the editing-area
572
  e.stopPropagation();
573
-
574
  // Do not open links
575
  e.preventDefault();
576
-
577
  crellyslider_selectElement($(this));
578
  });
579
  function crellyslider_selectElement(element) {
580
  var index = element.index();
581
- var slide = element.closest('.cs-slide');
582
  var options = slide.find('.cs-elements .cs-elements-list');
583
-
584
  // Hide all options - .active class
585
  options.find('.cs-element-settings').css('display', 'none');
586
  options.find('.cs-element-settings').removeClass('active');
587
-
588
  // Show the correct options + .active class
589
  options.find('.cs-element-settings:eq(' + index + ')').css('display', 'block');
590
  options.find('.cs-element-settings:eq(' + index + ')').addClass('active');
591
-
592
  // Add .active class to the element in the editing area
593
  element.parent().children().removeClass('active');
594
  element.addClass('active');
595
-
596
  // Make the delete and the duplicate buttons working
597
  slide.find('.cs-elements-actions .cs-delete-element').removeClass('cs-is-disabled');
598
  slide.find('.cs-elements-actions .cs-duplicate-element').removeClass('cs-is-disabled');
599
  }
600
-
601
  // Deselect elements
602
  $('.cs-admin').on('click', '.cs-slide .cs-elements .cs-slide-editing-area', function() {
603
  crellyslider_deselectElements();
604
  });
605
  function crellyslider_deselectElements() {
606
  $('.cs-admin .cs-slide .cs-elements .cs-slide-editing-area .cs-element').removeClass('active');
607
- $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').removeClass('active');
608
- $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').css('display', 'none');
609
-
610
  // Hide delete and duplicate element btns
611
  $('.cs-admin .cs-slide .cs-elements-actions .cs-delete-element').addClass('cs-is-disabled');
612
  $('.cs-admin .cs-slide .cs-elements-actions .cs-duplicate-element').addClass('cs-is-disabled');
613
  }
614
-
615
  // Delete element. Remember that the button should be enabled / disabled somewhere else
616
  function crellyslider_deleteElement(element) {
617
  var index = element.index();
618
  var slide_parent = element.closest('.cs-slide');
619
-
620
  element.remove();
621
  var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
622
  element_options.remove();
@@ -627,32 +656,39 @@
627
  if($(this).hasClass('.cs-is-disabled')) {
628
  return;
629
  }
630
-
631
  var slide_parent = $(this).closest('.cs-slide');
632
  var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
633
  crellyslider_deleteElement(element);
634
  });
635
-
636
  function crellyslider_duplicateElement(element) {
637
  var index = element.index();
638
  var slide_parent = element.closest('.cs-slide');
639
-
640
  element.clone().appendTo(element.parent()).css({
641
  'left' : '+=10',
642
  'top' : '+=10',
643
  });
644
  var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
645
  element_options.crellyslider_betterClone(true).insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
646
-
647
  crellyslider_deselectElements();
648
  crellyslider_selectElement(element.parent().find('.cs-element').last());
649
-
650
  var cloned_options = element.parent().find('.cs-element').last().closest('.cs-slide').find('.cs-elements-list .cs-element-settings.active');
651
-
652
  // Move the element 10 pixels away
653
  cloned_options.find('.cs-element-data_left').val(parseInt(element_options.find('.cs-element-data_left').val()) + 10);
654
  cloned_options.find('.cs-element-data_top').val(parseInt(element_options.find('.cs-element-data_top').val()) + 10);
655
-
 
 
 
 
 
 
 
656
  // Make draggable
657
  crellyslider_draggableElements();
658
  }
@@ -661,18 +697,18 @@
661
  if($(this).hasClass('.cs-is-disabled')) {
662
  return;
663
  }
664
-
665
  var slide_parent = $(this).closest('.cs-slide');
666
  var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
667
  crellyslider_duplicateElement(element);
668
  });
669
-
670
  // Modify left position
671
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_left', function() {
672
  var index = $(this).closest('.cs-element-settings').index();
673
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', parseFloat($(this).val()));
674
  });
675
-
676
  // Center horizontally
677
  $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-x', function() {
678
  var index = $(this).closest('.cs-element-settings').index();
@@ -680,13 +716,13 @@
680
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
681
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
682
  });
683
-
684
  // Modify top position
685
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_top', function() {
686
  var index = $(this).closest('.cs-element-settings').index();
687
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', parseFloat($(this).val()));
688
  });
689
-
690
  // Center vertically
691
  $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-y', function() {
692
  var index = $(this).closest('.cs-element-settings').index();
@@ -694,13 +730,13 @@
694
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
695
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
696
  });
697
-
698
  // Modify z-index
699
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-z_index', function() {
700
  var index = $(this).closest('.cs-element-settings').index();
701
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
702
  });
703
-
704
  // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
705
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
706
  crellyslider_editElementsLink($(this));
@@ -709,18 +745,18 @@
709
  var textbox = $(this).parent().find('.cs-element-link');
710
  crellyslider_editElementsLink(textbox);
711
  });
712
-
713
  // Wrap - unwrap elements with an <a href="" target="">
714
  function crellyslider_editElementsLink(textbox_link) {
715
  var index = textbox_link.closest('.cs-element-settings').index();
716
  var copy_attributes = false;
717
  var reapply_css = false;
718
-
719
  if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
720
  // Remove custom css classes
721
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
722
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
723
-
724
  var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
725
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
726
  copy_attributes = true;
@@ -728,64 +764,64 @@
728
  }
729
  else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
730
  var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
731
-
732
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
733
-
734
  if(link_new_tab) {
735
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
736
  }
737
  else {
738
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
739
  }
740
-
741
  copy_attributes = false;
742
  }
743
  else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
744
  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');
745
-
746
  // Reapply CSS and custom CSS
747
  applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
748
  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'));
749
  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'));
750
  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'));
751
-
752
  // Reapply custom css classes
753
  crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
754
-
755
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
756
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
757
  copy_attributes = false;
758
  }
759
-
760
  if(copy_attributes) {
761
  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'));
762
  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');
763
-
764
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
765
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
766
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
767
  }
768
-
769
  crellyslider_draggableElements();
770
-
771
  if(reapply_css) {
772
  applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
773
  crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
774
  }
775
  }
776
-
777
  // Apply custom CSS
778
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
779
  applyCustomCss($(this));
780
  });
781
-
782
  function applyCustomCss(textarea) {
783
  var index = textarea.closest('.cs-element-settings').index();
784
  // Save current positions
785
  var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
786
  var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
787
  var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
788
-
789
  // Apply CSS
790
  if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
791
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
@@ -797,14 +833,14 @@
797
  }
798
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
799
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
800
- textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
801
  }
802
-
803
  // Add custom CSS classes
804
  $('.cs-admin').on('keydown', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
805
  var textarea = $(this);
806
  var index = textarea.closest('.cs-element-settings').index();
807
-
808
  if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
809
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textarea.val());
810
  }
@@ -820,7 +856,7 @@
820
  });
821
  function crellyslider_applyCustomCssClasses(textarea) {
822
  var index = textarea.closest('.cs-element-settings').index();
823
-
824
  if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
825
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').addClass(textarea.val());
826
  }
@@ -831,89 +867,171 @@
831
  avoid_interaction.addClass('cs-avoid-interaction');
832
  }
833
  }
834
-
835
  // TEXT ELEMENTS
836
-
837
- // Add text click
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
838
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-text-element', function() {
839
  var slide_parent = $(this).closest('.cs-slide');
840
  crellyslider_addTextElement(slide_parent);
841
  });
842
-
843
  // Add text. Receives the slide as object
844
  function crellyslider_addTextElement(slide_parent) {
845
  var area = slide_parent.find('.cs-slide-editing-area');
846
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
847
  var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
848
-
849
  // Insert in editing area
850
  area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
851
-
852
  // Insert the options
853
  settings_div.before(settings);
854
-
855
  // Make draggable
856
  crellyslider_draggableElements();
857
-
 
 
 
858
  // Display settings
859
  crellyslider_selectElement(area.find('.cs-element').last());
860
  }
861
-
862
- // Modify text
863
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
864
- var index = $(this).closest('.cs-element-settings').index();
865
- var text_element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
866
-
 
 
 
867
  if(! text_element.is('a')) {
868
- text_element.html($(this).val());
 
 
 
869
  }
870
  else {
871
- text_element.find('> div').html($(this).val());
 
 
 
872
  }
873
- });
874
-
875
  // IMAGE ELEMENTS
876
-
877
  // Add images click
878
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-image-element', function() {
879
  var slide_parent = $(this).closest('.cs-slide');
880
  crellyslider_addImageElement(slide_parent);
881
  });
882
-
883
  // Upload click
884
  $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-image-element-settings .cs-image-element-upload-button', function() {
885
  var slide_parent = $(this).closest('.cs-slide');
886
  crellySliderUploadImageElement(slide_parent);
887
  });
888
-
889
  // Add image. Receives the slide as object
890
  function crellyslider_addImageElement(slide_parent) {
891
  var area = slide_parent.find('.cs-slide-editing-area');
892
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
893
  var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
894
-
895
  // Temporarily insert an element with no src and alt
896
  // Add the image into the editing area.
897
  area.append('<img class="cs-element cs-image-element" src="nothing_now.jpg" style="z-index: 1;" />');
898
-
899
  // Insert the options
900
  settings_div.before(settings);
901
-
902
  // Make draggable
903
  crellyslider_draggableElements();
904
-
905
  // Display settings
906
  crellyslider_selectElement(area.find('.cs-element').last());
907
-
908
  // Upload
909
- crellySliderUploadImageElement(slide_parent);
910
  }
911
-
912
  function crellySliderUploadImageElement(slide_parent) {
913
  var area = slide_parent.find('.cs-slide-editing-area');
914
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
915
  var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
916
-
917
  var file_frame;
918
 
919
  // If the media frame already exists, reopen it.
@@ -939,72 +1057,73 @@
939
  // Do something with attachment.id and/or attachment.url here
940
  var image_src = attachment.url;
941
  var image_alt = attachment.alt;
942
-
 
943
  // Set attributes. If is a link, do the right thing
944
  var image = area.find('.cs-image-element.active').last();
945
-
946
  if(! image.is('a')) {
947
  image.attr('src', image_src);
948
  image.attr('alt', image_alt);
949
  }
950
  else {
951
- image.find('> img').attr('src', image_src);
952
- image.find('> img').attr('alt', image_alt);
953
  }
954
-
955
  // Set data (will be used in the ajax call)
956
- settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', image_src);
957
  settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
958
  });
959
 
960
  // Finally, open the modal
961
  file_frame.open();
962
  }
963
-
964
  // VIDEO ELEMENTS
965
-
966
  // Add video click
967
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-video-element', function() {
968
  var slide_parent = $(this).closest('.cs-slide');
969
  crellyslider_addVideoElement(slide_parent);
970
  });
971
-
972
  // Adds a video container. Receives the slide as object
973
  function crellyslider_addVideoElement(slide_parent) {
974
  var area = slide_parent.find('.cs-slide-editing-area');
975
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
976
  var settings = '<div class="cs-element-settings cs-video-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-video-element-settings').html() + '</div>';
977
-
978
  // Insert in editing area
979
  area.append('<div class="cs-element cs-video-element" style="z-index: 1;"></div>');
980
-
981
  // Insert the options
982
  settings_div.before(settings);
983
-
984
  // Make draggable
985
  crellyslider_draggableElements();
986
-
987
  // Display settings
988
  crellyslider_selectElement(area.find('.cs-element').last());
989
-
990
  // Select youtube video as default
991
  area.find('.cs-element').last().closest('.cs-slide').find('.cs-elements .cs-elements-list .cs-element-video_src').trigger('change');
992
  }
993
-
994
  // Change video id
995
  $('.cs-admin').on('change keyup input', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_id', function() {
996
  var index = $(this).closest('.cs-element-settings').index();
997
  var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
998
-
999
  crellyslider_changeVideo($(this), element, $(this).parent().find('.cs-element-video_src').val(), $(this).val());
1000
  });
1001
  // Change video source
1002
  $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_src', function() {
1003
  var index = $(this).closest('.cs-element-settings').index();
1004
  var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1005
-
1006
  crellyslider_changeVideo($(this), element, $(this).val(), $(this).parent().find('.cs-element-video_id').val());
1007
- });
1008
  function crellyslider_changeVideo(input, element, source, video_id) {
1009
  if(source == 'youtube') {
1010
  element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-yt-iframe" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/' + video_id + '?enablejsapi=1" frameborder="0"></iframe>');
@@ -1012,21 +1131,21 @@
1012
  else {
1013
  element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-vimeo-iframe" src="https://player.vimeo.com/video/' + video_id + '?api=1" width="560" height="315" frameborder="0" ></iframe>');
1014
  }
1015
-
1016
  // Re-apply custom CSS and custom CSS classes
1017
  crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css'));
1018
  crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
1019
  }
1020
-
1021
  /******************/
1022
  /** LIVE PREVIEW **/
1023
  /******************/
1024
-
1025
  // Live preview click
1026
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-live-preview', function() {
1027
  var btn = $(this);
1028
  var slide_parent = btn.closest('.cs-slide');
1029
-
1030
  if(! btn.hasClass('cs-live-preview-running')) {
1031
  btn.addClass('cs-live-preview-running');
1032
  btn.text(crellyslider_translations.slide_stop_preview);
@@ -1038,35 +1157,26 @@
1038
  crellyslider_stopLivePreview(slide_parent);
1039
  }
1040
  });
1041
-
1042
  function crellyslider_startLivePreview(slide_parent) {
1043
  crellyslider_deselectElements();
1044
-
1045
  var area = slide_parent.find('.cs-slide-editing-area');
1046
-
1047
  area.clone().addClass('cs-slide-live-preview-area').insertAfter(area);
1048
  var prev = slide_parent.find('.cs-slide-live-preview-area');
1049
-
1050
  area.css('display', 'none');
1051
-
1052
  // Set elements data and styles
1053
  var elements = prev.find('.cs-element');
1054
  var original_elements = area.closest('.cs-slide').find('.cs-elements .cs-element-settings');
1055
  var i = 0;
1056
  elements.each(function() {
1057
  var element = $(this);
1058
-
1059
- element.removeAttr('style');
1060
- element.attr('style', original_elements.eq(i).find('.cs-element-custom_css').val());
1061
- element.css({
1062
- 'z-index' : parseInt(original_elements.eq(i).find('.cs-element-z_index').val()),
1063
- 'display' : 'none',
1064
- });
1065
-
1066
- element.removeAttr('class');
1067
- element.addClass(original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1068
-
1069
- // Video elements settings only
1070
  if(element.find('.cs-yt-iframe').length > 0) {
1071
  element.find('.cs-avoid-interaction').remove();
1072
  element = element.find('.cs-yt-iframe');
@@ -1075,7 +1185,7 @@
1075
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1076
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1077
  });
1078
- element.addClass('cs-yt-iframe ' + original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1079
  }
1080
  else if(element.find('.cs-vimeo-iframe').length > 0) {
1081
  element.find('.cs-avoid-interaction').remove();
@@ -1085,9 +1195,22 @@
1085
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1086
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1087
  });
1088
- element.addClass('cs-vimeo-iframe ' + original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1089
  }
1090
-
 
 
 
 
 
 
 
 
 
 
 
 
 
1091
  element.attr({
1092
  'data-left' : parseInt(original_elements.eq(i).find('.cs-element-data_left').val()),
1093
  'data-top' : parseInt(original_elements.eq(i).find('.cs-element-data_top').val()),
@@ -1099,19 +1222,19 @@
1099
  'data-ease-in' : parseInt(original_elements.eq(i).find('.cs-element-data_easeIn').val()),
1100
  'data-ease-out' : parseInt(original_elements.eq(i).find('.cs-element-data_easeOut').val()),
1101
  });
1102
-
1103
  i++;
1104
  });
1105
-
1106
  // Prepare HTML structure
1107
  prev.wrapInner('<li />');
1108
  prev.wrapInner('<ul />');
1109
-
1110
-
1111
  var slide = prev.find('ul > li');
1112
  var original_slide = area.closest('.cs-slide');
1113
  var content = original_slide.find('.cs-slide-settings-list');
1114
-
1115
  // Set slide link
1116
  if(content.find('.cs-background-link').val() != '') {
1117
  if(! content.find('.cs-background-link_new_tab').prop('checked')) {
@@ -1121,7 +1244,7 @@
1121
  slide.prepend('<a class="cs-background-link" target="_blank" href="' + content.find('.cs-background-link').val() + '"></a>');
1122
  }
1123
  }
1124
-
1125
  // Set slide data and styles
1126
  slide.attr({
1127
  'data-in' : content.find('.cs-slide-data_in').val(),
@@ -1130,7 +1253,7 @@
1130
  'data-ease-in' : parseInt(content.find('.cs-slide-data_easeIn').val()),
1131
  'data-ease-out' : parseInt(content.find('.cs-slide-data_easeOut').val()),
1132
  });
1133
-
1134
  slide.attr('style', content.find('.cs-slide-custom_css').val());
1135
  slide.css({
1136
  'background-image' : area.css('background-image') ,
@@ -1139,16 +1262,16 @@
1139
  'background-repeat' : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1140
  'background-size' : content.find('.cs-slide-background_propriety_size').val(),
1141
  });
1142
-
1143
  var slider = $('.cs-admin .cs-slider #cs-slider-settings');
1144
-
1145
  // Run Crelly Slider
1146
  prev.crellySlider({
1147
  'layout' : 'fixed',
1148
  'responsive' : false,
1149
  'startWidth' : parseInt(slider.find('#cs-slider-startWidth').val()),
1150
  'startHeight' : parseInt(slider.find('#cs-slider-startHeight').val()),
1151
-
1152
  'automaticSlide' : true,
1153
  'showControls' : false,
1154
  'showNavigation' : false,
@@ -1156,7 +1279,7 @@
1156
  'showProgressBar' : false,
1157
  'pauseOnHover' : false,
1158
  });
1159
-
1160
  // Warning: click on background links
1161
  $('.cs-slide-live-preview-area a').click(function(event) {
1162
  if($(this).prop('target') != '_blank') {
@@ -1167,55 +1290,55 @@
1167
  }
1168
  });
1169
  }
1170
-
1171
  function crellyslider_stopLivePreview(slide_parent) {
1172
  var area = slide_parent.find('.cs-slide-editing-area');
1173
  var prev = slide_parent.find('.cs-slide-live-preview-area');
1174
-
1175
  prev.remove();
1176
  area.css('display', 'block');
1177
  }
1178
-
1179
  /****************/
1180
  /** AJAX CALLS **/
1181
  /****************/
1182
-
1183
  // Save or update the new slider in the database
1184
  $('.cs-admin .cs-slider .cs-save-settings').click(function() {
1185
  $('.cs-admin #cs-slides .cs-live-preview').each(function() {
1186
  var btn = $(this);
1187
  var slide_parent = btn.closest('.cs-slide');
1188
-
1189
  if(btn.hasClass('cs-live-preview-running')) {
1190
  btn.removeClass('cs-live-preview-running');
1191
  btn.text(crellyslider_translations.slide_live_preview);
1192
  crellyslider_stopLivePreview(slide_parent);
1193
  }
1194
  });
1195
-
1196
  crellyslider_saveSlider();
1197
  });
1198
-
1199
  // Delete slider
1200
  $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-delete-slider', function() {
1201
  var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
1202
  if(!confirm) {
1203
  return;
1204
  }
1205
-
1206
  crellyslider_deleteSlider($(this));
1207
  });
1208
-
1209
  // Duplicate slider
1210
  $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-duplicate-slider', function() {
1211
  crellyslider_duplicateSlider($(this));
1212
  });
1213
-
1214
  // Export slider
1215
  $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-export-slider', function() {
1216
  crellyslider_exportSlider($(this));
1217
  });
1218
-
1219
  // Import slider
1220
  $('.cs-admin .cs-home').on('click', '.cs-import-slider', function() {
1221
  $('#cs-import-file').trigger('click');
@@ -1223,9 +1346,9 @@
1223
  $('.cs-admin .cs-home').on('change', '#cs-import-file', function() {
1224
  crellyslider_importSlider();
1225
  });
1226
-
1227
  // Sends an array with the new or current slider options
1228
- function crellyslider_saveSlider() {
1229
  var content = $('.cs-admin .cs-slider #cs-slider-settings');
1230
  var options = {
1231
  id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
@@ -1241,9 +1364,11 @@
1241
  enableSwipe : parseInt(content.find('#cs-slider-enableSwipe').val()),
1242
  showProgressBar : parseInt(content.find('#cs-slider-showProgressBar').val()),
1243
  pauseOnHover : parseInt(content.find('#cs-slider-pauseOnHover').val()),
 
 
1244
  callbacks : content.find('#cs-slider-callbacks').val(),
1245
  };
1246
-
1247
  // Do the ajax call
1248
  jQuery.ajax({
1249
  type : 'POST',
@@ -1263,33 +1388,33 @@
1263
  window.location.href = '?page=crellyslider&view=edit&id=' + response;
1264
  return;
1265
  }
1266
-
1267
  crellyslider_saveSlides();
1268
  }
1269
  else {
1270
  crellyslider_showError();
1271
  }
1272
  },
1273
-
1274
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1275
  alert('Error saving slider');
1276
  console.log(XMLHttpRequest.responseText);
1277
  crellyslider_showError();
1278
  }
1279
  });
1280
  }
1281
-
1282
  // Sends an array with all the slides options
1283
  function crellyslider_saveSlides() {
1284
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1285
  var i = 0;
1286
  var final_options = {};
1287
-
1288
- final_options['options'] = new Array();
1289
  slides.each(function() {
1290
  var slide = $(this);
1291
  var content = slide.find('.cs-slide-settings-list');
1292
-
1293
  var background_type_color;
1294
  if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '0') {
1295
  background_type_color = 'transparent';
@@ -1300,12 +1425,13 @@
1300
  else {
1301
  background_type_color = content.find('.cs-slide-background_type_color-manual').val();
1302
  }
1303
-
1304
- var options = {
1305
  slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1306
  position : i,
1307
-
1308
- background_type_image : slide.find('.cs-slide-editing-area').css('background-image') == 'none' ? 'none' : slide.find('.cs-slide-editing-area').data('background-image-src') + "",
 
1309
  background_type_color : background_type_color,
1310
  background_type_color_input : content.find('input[name="cs-slide-background_type_color"]:checked').val(),
1311
  background_propriety_position_x : content.find('.cs-slide-background_propriety_position_x').val(),
@@ -1321,14 +1447,14 @@
1321
  link_new_tab : slide.find('.cs-background-link_new_tab').prop('checked') ? 1 : 0,
1322
  custom_css : content.find('.cs-slide-custom_css').val(),
1323
  };
1324
-
1325
  final_options['options'][i] = options;
1326
-
1327
  i++;
1328
  });
1329
-
1330
  final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id')),
1331
-
1332
  // Do the ajax call
1333
  jQuery.ajax({
1334
  type : 'POST',
@@ -1347,34 +1473,34 @@
1347
  crellyslider_showError();
1348
  }
1349
  },
1350
-
1351
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1352
  alert('Error saving slides');
1353
  console.log(XMLHttpRequest.responseText);
1354
  crellyslider_showError();
1355
  }
1356
  });
1357
  }
1358
-
1359
  // Sends an array with all the elements options of each slide
1360
  function crellyslider_saveElements() {
1361
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1362
  var i = 0, j = 0;
1363
  var final_options = {};
1364
-
1365
  final_options['options'] = new Array();
1366
  slides.each(function() {
1367
  var slide = $(this);
1368
  var elements = slide.find('.cs-elements .cs-element-settings');
1369
-
1370
  elements.each(function() {
1371
  var element = $(this);
1372
-
1373
  // Stop each loop when reach the void element
1374
  if(element.hasClass('cs-void-element-settings')) {
1375
  return;
1376
  }
1377
-
1378
  // Get the type of the element
1379
  var type;
1380
  if(element.hasClass('cs-text-element-settings')) {
@@ -1394,13 +1520,13 @@
1394
  else {
1395
  type = 'undefined';
1396
  }
1397
-
1398
  var options = {
1399
- slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1400
- slide_parent : i,
1401
  position : element.index(),
1402
  type : type,
1403
-
1404
  inner_html : element.hasClass('cs-text-element-settings') ? element.find('.cs-element-inner_html').val() : '',
1405
  image_src : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('src') : '',
1406
  image_alt : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('alt') : '',
@@ -1422,25 +1548,25 @@
1422
  video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1423
  video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1424
  };
1425
-
1426
  final_options['options'][j] = options;
1427
-
1428
  j++;
1429
  });
1430
-
1431
  i++;
1432
  });
1433
-
1434
  // Proceed?
1435
  final_options['elements'] = 1;
1436
  if(final_options['options'].length == 0) {
1437
  final_options['elements'] = 0;
1438
  }
1439
-
1440
  final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1441
-
1442
  final_options['options'] = JSON.stringify(final_options['options']);
1443
-
1444
  // Do the ajax call
1445
  jQuery.ajax({
1446
  type : 'POST',
@@ -1459,21 +1585,21 @@
1459
  crellyslider_showError();
1460
  }
1461
  },
1462
-
1463
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1464
  alert('Error saving elements');
1465
  console.log(XMLHttpRequest.responseText);
1466
  crellyslider_showError();
1467
  }
1468
  });
1469
  }
1470
-
1471
  function crellyslider_deleteSlider(content) {
1472
  // Get options
1473
  var options = {
1474
  id : parseInt(content.data('delete')),
1475
  };
1476
-
1477
  // Do the ajax call
1478
  jQuery.ajax({
1479
  type : 'POST',
@@ -1498,21 +1624,21 @@
1498
  crellyslider_showError();
1499
  }
1500
  },
1501
-
1502
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1503
  alert('Error deleting slider');
1504
  console.log(XMLHttpRequest.responseText);
1505
  crellyslider_showError();
1506
  },
1507
  });
1508
  }
1509
-
1510
  function crellyslider_duplicateSlider(content) {
1511
  // Get options
1512
  var options = {
1513
  id : parseInt(content.data('duplicate')),
1514
  };
1515
-
1516
  // Do the ajax call
1517
  jQuery.ajax({
1518
  type : 'POST',
@@ -1535,28 +1661,28 @@
1535
  cloned_slider.find('.cs-duplicate-slider').data('duplicate', response['cloned_slider_id']);
1536
  cloned_slider.find('.cs-delete-slider').data('delete', response['cloned_slider_id']);
1537
  cloned_slider.find('.cs-export-slider').data('export', response['cloned_slider_id']);
1538
-
1539
  crellyslider_showSuccess();
1540
  }
1541
  else {
1542
  crellyslider_showError();
1543
  }
1544
  },
1545
-
1546
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1547
  alert('Error duplicating slider');
1548
  console.log(XMLHttpRequest.responseText);
1549
  crellyslider_showError();
1550
  },
1551
  });
1552
  }
1553
-
1554
  function crellyslider_exportSlider(content) {
1555
  // Get options
1556
  var options = {
1557
  id : parseInt(content.data('export')),
1558
  };
1559
-
1560
  // Do the ajax call
1561
  jQuery.ajax({
1562
  type : 'POST',
@@ -1567,7 +1693,7 @@
1567
  datas : options,
1568
  },
1569
  success: function(response) {
1570
- if(response['response'] !== false) {
1571
  window.location.href = response['url'];
1572
  crellyslider_showSuccess();
1573
  }
@@ -1575,30 +1701,30 @@
1575
  crellyslider_showError();
1576
  }
1577
  },
1578
-
1579
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1580
  alert('Error while exporting the slider');
1581
  console.log(XMLHttpRequest.responseText);
1582
  crellyslider_showError();
1583
  },
1584
  });
1585
  }
1586
-
1587
  function crellyslider_importSlider() {
1588
  var file = $('#cs-import-file')[0].files[0];
1589
-
1590
  if(! file) {
1591
  return;
1592
  }
1593
-
1594
  // Reset input file. Prevents conflicts
1595
  $('#cs-import-file').val('');
1596
-
1597
  // Form data (for file uploads)
1598
  var fd = new FormData();
1599
  fd.append('file', file);
1600
- fd.append('action', 'crellyslider_importSlider');
1601
-
1602
  // Do the ajax call
1603
  jQuery.ajax({
1604
  type : 'POST',
@@ -1607,8 +1733,8 @@
1607
  processData : false,
1608
  data : fd,
1609
  success: function(response) {
1610
- response = JSON.parse(response);
1611
- //console.log(response);
1612
  if(response['response'] !== false) {
1613
  var content = $('.cs-sliders-list .cs-duplicate-slider:eq(0)');
1614
  if(content.length > 0) {
@@ -1626,15 +1752,15 @@
1626
  else {
1627
  location.reload();
1628
  }
1629
-
1630
  crellyslider_showSuccess();
1631
  }
1632
  else {
1633
  crellyslider_showError();
1634
  }
1635
  },
1636
-
1637
- error: function(XMLHttpRequest, textStatus, errorThrown) {
1638
  alert('Error while importing the slider');
1639
  console.log(XMLHttpRequest.responseText);
1640
  crellyslider_showError();
@@ -1643,4 +1769,4 @@
1643
  }
1644
 
1645
  });
1646
- })(jQuery);
30
 
31
  (function($) {
32
  $(window).load(function() {
33
+
34
  // Simulate keyup. Useful when textboxes change value
35
  function crellyslider_keyup(element) {
36
  $(element).trigger('keyup');
37
  }
38
+
39
  // Slider settings and slide tabs
40
  $('#cs-show-slider-settings').click(function() {
41
  $('#cs-slider-settings').fadeIn();
42
  $('#cs-slides').hide();
43
+ });
44
  $('#cs-show-slides').click(function() {
45
  $('#cs-slides').fadeIn();
46
  $('#cs-slider-settings').hide();
47
  });
48
+
49
  // Run draggables
50
  crellyslider_draggableElements();
51
+
52
  function crellyslider_showSuccess() {
53
  $('.cs-admin .cs-message .cs-message-working').css('display', 'none');
54
+
55
  var target = $('.cs-admin .cs-message.cs-message-ok');
56
  target.css({
57
  'display' : 'block',
67
  target.css('display', 'none');
68
  });
69
  }
70
+
71
  function crellyslider_showError() {
72
  $('.cs-admin .cs-message .cs-message-working').css('display', 'none');
73
+
74
  var target = $('.cs-admin .cs-message.cs-message-error');
75
  target.css({
76
  'display' : 'block',
86
  target.css('display', 'none');
87
  });
88
  }
89
+
90
  /*************/
91
  /** SLIDERS **/
92
  /*************/
93
+
94
+ // Set Alias
95
  $('.cs-slider').find('#cs-slider-name').keyup(function() {
96
  var alias = crellyslider_getAlias();
97
  $('.cs-slider').find('#cs-slider-alias').text(alias);
98
  });
99
+
100
  // Set shortcode
101
  $('.cs-slider').find('#cs-slider-name').keyup(function() {
102
  var alias = crellyslider_getAlias();
111
  $('.cs-slider').find('#cs-slider-shortcode').text('');
112
  }
113
  });
114
+
115
  // Set the new sizes of the editing area and of the slider if changing values
116
  $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').keyup(function() {
117
  crellyslider_setSlidesEditingAreaSizes();
119
  $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').keyup(function() {
120
  crellyslider_setSlidesEditingAreaSizes();
121
  });
122
+
123
  // Get the alias starting form the name
124
  function crellyslider_getAlias() {
125
  var slider_name = $('.cs-slider').find('#cs-slider-name').val();
127
  slider_alias = slider_alias.replace(/ /g, '_');
128
  return slider_alias;
129
  }
130
+
131
  /************/
132
  /** SLIDES **/
133
  /************/
134
+
135
  var slides_number = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length - 1;
136
+
137
  // Run sortable
138
  var slide_before; // Contains the index before the sorting
139
  var slide_after; // Contains the index after the sorting
143
  connectWith: '.cs-slide-tabs .cs-sortable',
144
  containment: 'parent',
145
  placeholder: 'sortable-placeholder',
146
+
147
  start: function(event, ui) {
148
  // Store the current index
149
  slide_before = $(ui.item).index();
150
+
151
  ui.placeholder.height(ui.helper.height() - 1);
152
  ui.placeholder.width(ui.helper.width() - 1);
153
  },
154
+
155
  // Change the .cs-slide order based on the new index and rename the tabs
156
+ update: function(event, ui) {
157
  // Store the new index
158
  slide_after = $(ui.item).index();
159
+
160
  // Change the slide position
161
+ var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_before + ')');
162
+ var after = $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + slide_after + ')');
163
  if(slide_before < slide_after) {
164
  slide.insertAfter(after);
165
  }
166
  else {
167
  slide.insertBefore(after);
168
  }
169
+
170
  // Rename all the tabs
171
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').each(function() {
172
  var temp = $(this);
173
+ if(!temp.find('a').hasClass('cs-add-new')) {
174
  temp.find('a').html('<span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (temp.index() + 1) + '</span></span>');
175
  }
176
  });
177
  }
178
  });
179
  $('.cs-slide-tabs .cs-sortable li').disableSelection();
180
+
181
  // Show the slide when clicking on the link
182
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li > a').live('click', function() {
183
+ crellyslider_deselectElements();
184
+
185
+ // Do only if is not click add new
186
  if($(this).parent().index() != slides_number) {
187
  // Stop previews
188
  $('.cs-admin #cs-slides .cs-slide .cs-elements .cs-elements-actions .cs-live-preview').each(function() {
189
  var btn = $(this);
190
  var slide_parent = btn.closest('.cs-slide');
191
+
192
  if(btn.hasClass('cs-live-preview-running')) {
193
  btn.removeClass('cs-live-preview-running');
194
  btn.text(crellyslider_translations.slide_live_preview);
195
  crellyslider_stopLivePreview(slide_parent);
196
  }
197
  });
198
+
199
  // Hide all tabs
200
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
201
  var tab = $(this).parent().index();
202
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide:eq(' + tab + ')').css('display', 'block');
203
+
204
  // Active class
205
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
206
  $(this).parent().addClass('active');
207
  }
208
  });
209
+
210
  // Add new
211
  function crellyslider_addSlide() {
212
  var add_btn = $('.cs-admin #cs-slides .cs-add-new');
213
+
214
  var void_slide = $('.cs-admin #cs-slides .cs-void-slide').html();
215
  // Insert the link at the end of the list
216
  add_btn.parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
219
  // Create the slide
220
  $('.cs-admin #cs-slides .cs-slides-list').append('<div class="cs-slide">' + void_slide + '</div>');
221
  slides_number++;
222
+
223
  // Open the tab just created
224
  var tab_index = add_btn.parent().index() - 1;
225
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).find('a').click();
226
+
227
  // Active class
228
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').removeClass('active');
229
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(tab_index).addClass('active');
230
+
231
  // Set editing area sizes
232
  crellyslider_setSlidesEditingAreaSizes();
233
+
234
  crellyslider_slidesColorPicker();
235
+
236
+ // Update "start from slide" in the slider settings
237
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
238
  }
239
+
240
  // Add new on click
241
  $('.cs-admin #cs-slides .cs-add-new').click(function() {
242
  crellyslider_addSlide();
243
+ });
244
  // Also add a new slide if slides_number == 0
245
  if(slides_number == 0) {
246
  crellyslider_addSlide();
248
  else {
249
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
250
  }
251
+
252
  // Delete
253
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-close').live('click', function() {
254
  if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').length <= 2) {
255
  alert(crellyslider_translations.slide_delete_just_one);
256
  return;
257
  }
258
+
259
  var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
260
  if(!confirm) {
261
  return;
262
  }
263
+
264
  slides_number--;
265
+
266
  var slide_index = $(this).parent().index();
267
+
268
  // If is deleting the current viewing slide, set the first as active
269
  if($('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(slide_index).hasClass('active') && slides_number != 0) {
270
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).addClass('active');
271
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide').css('display', 'none');
272
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(0).css('display', 'block');
273
  }
274
+
275
  // Remove the anchor
276
  $(this).parent().remove();
277
  // Remove the slide itself
278
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index).remove();
279
+
280
  // Scale back all the slides text
281
  for(var i = slide_index; i < slides_number; i++) {
282
  var slide = $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(i);
283
  var indx = parseInt(slide.find('.cs-slide-index').text());
284
  slide.find('.cs-slide-index').text(indx - 1);
285
  }
286
+
287
+ // Update "start from slide" in the slider settings
288
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
289
+ if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').length == 0) {
290
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().first().val('0');
291
+ }
292
  });
293
+
294
+ // Duplicate
295
+ $('.cs-admin #cs-slides .cs-slide-tabs > ul > li .cs-duplicate').live('click', function() {
296
+ var slide_index = $(this).parent().index();
297
+ var slide = $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slide_index);
298
+
299
+ // Clone the slide settings table
300
+ slide.crellyslider_betterClone(true, false).appendTo(slide.parent()).css('display', 'none');
301
+
302
+ // Fix TinyMCE
303
+ slide.parent().last().find('.cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').each(function() {
304
+ var cloned_options = $(this);
305
+
306
+ cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
307
+ cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
308
+ crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
309
+ });
310
+
311
+ // Add a new color picker, then remove the old one
312
+ crellyslider_slidesColorPicker();
313
+ $('.cs-admin #cs-slides .cs-slides-list .cs-slide').eq(slides_number).find('.wp-picker-container > .wp-color-result').eq(0).remove();
314
+
315
+ // Insert the link at the end of the list
316
+ $(this).parent().parent().find('.cs-add-new').parent().before('<li class="ui-state-default"><a><span class="cs-slide-name-text">' + crellyslider_translations.slide + ' <span class="cs-slide-index">' + (slides_number + 1) + '</span></span></a><span title="' + crellyslider_translations.duplicate_slide + '" class="cs-duplicate"></span><span title="' + crellyslider_translations.remove_slide + '" class="cs-close"></span></li>');
317
+ $('.cs-admin #cs-slides .cs-slide-tab').tabs('refresh');
318
+
319
+ crellyslider_draggableElements();
320
+
321
+ slides_number++;
322
+
323
+ // Update "start from slide" in the slider settings
324
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
325
+ });
326
+
327
  // Set correct size for the editing area
328
  function crellyslider_setSlidesEditingAreaSizes() {
329
  var width = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startWidth').val());
330
  var height = parseInt($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startHeight').val());
331
+
332
  $('.cs-admin #cs-slides .cs-slide .cs-slide-editing-area').css({
333
  'width' : width,
334
  'height' : height,
335
  });
336
+
337
  $('.cs-admin').css({
338
  'width' : width,
339
  });
340
  }
341
+
342
  crellyslider_slidesColorPicker();
343
+
344
  // Run background color picker
345
  function crellyslider_slidesColorPicker() {
346
  $('.cs-admin #cs-slides .cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-picker-input').wpColorPicker({
362
  palettes: true
363
  });
364
  }
365
+
366
  // Set background color (transparent == 0, color-picker == 1 or manual == 2). For backward compatiblity, a "-1" is used to indicate that there were no way to set the bg color manually
367
  $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_color"]:radio', function() {
368
  var btn = $(this);
369
  var btn_val = btn.val();
370
  var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
371
+
372
  if(btn_val == '0') {
373
  area.css('background-color', '#fff');
374
  }
380
  area.css('background-color', btn.closest('.cs-content').find('.cs-slide-background_type_color-manual').val());
381
  }
382
  });
383
+
384
+ $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_color-manual', function() {
385
  var text = $(this);
386
  var val = text.val();
387
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
388
 
389
  text.closest('.cs-slide').find('input[name="cs-slide-background_type_color"][value="2"]:radio').prop('checked', true);
390
+ area.css('background-color', val);
391
  });
392
+
393
  // Set background image (none or image)
394
  $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_type_image"]:radio', function() {
395
  var btn = $(this);
396
  var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
397
+
398
  if(btn.val() == '0') {
399
  area.css('background-image', 'none');
400
  }
403
  crellyslider_addSlideImageBackground(slide_parent);
404
  }
405
  });
406
+
407
  // Set Background image (the upload function)
408
  $('.cs-admin #cs-slides').on('click', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_type_image-upload-button', function() {
409
  var btn = $(this);
419
  });
420
  function crellyslider_addSlideImageBackground(slide_parent) {
421
  var area = slide_parent.find('.cs-slide-editing-area');
422
+
423
  // Upload
424
  var file_frame;
425
 
446
  // Do something with attachment.id and/or attachment.url here
447
  var image_src = attachment.url;
448
  var image_alt = attachment.alt;
449
+ var image_id = attachment.id;
450
+
451
  // Set background
452
  area.css('background-image', 'url("' + image_src + '")');
453
+
454
+ // Data that we'll store into the database
455
+ area.data('background-image-src', image_id);
456
  });
457
 
458
  // Finally, open the modal
459
+ file_frame.open();
460
  }
461
+
462
  // Background propriety: repeat or no-repeat
463
  $('.cs-admin #cs-slides').on('change', '.cs-slides-list .cs-slide-settings-list input[name="cs-slide-background_repeat"]:radio', function() {
464
  var btn = $(this);
465
  var area = btn.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
466
+
467
  if(btn.val() == '0') {
468
  area.css('background-repeat', 'no-repeat');
469
  }
471
  area.css('background-repeat', 'repeat');
472
  }
473
  });
474
+
475
  // Background propriety: positions x and y
476
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_x', function() {
477
  var text = $(this);
478
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
479
+
480
  var x = text.val();
481
  var y = text.parent().find('.cs-slide-background_propriety_position_y').val();
482
+
483
  area.css('background-position', x + ' ' + y);
484
  });
485
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_position_y', function() {
486
  var text = $(this);
487
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
488
+
489
  var x = text.parent().find('.cs-slide-background_propriety_position_x').val();
490
  var y = text.val();
491
+
492
  area.css('background-position', x + ' ' + y);
493
  });
494
+
495
  // Background propriety: size
496
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-background_propriety_size', function() {
497
  var text = $(this);
498
  var val = text.val();
499
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
500
 
501
+ area.css('background-size', val);
502
  });
503
+
504
  // Background presets
505
  $('.cs-slide-background-image-fullwidth-preset').click(function() {
506
+ var text = $(this);
507
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
508
  var settings = text.closest('.cs-slide');
509
+
510
  settings.find('.cs-slide-background_propriety_position_x').val('center');
511
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
512
+
513
  settings.find('.cs-slide-background_propriety_position_y').val('center');
514
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
515
+
516
  settings.find('input[name="cs-slide-background_repeat"][value="0"]').prop('checked', true);
517
  area.css('background-repeat', 'no-repeat');
518
+
519
  settings.find('.cs-slide-background_propriety_size').val('cover');
520
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
521
  });
522
+
523
  $('.cs-slide-background-image-pattern-preset').click(function() {
524
+ var text = $(this);
525
+ var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
526
  var settings = text.closest('.cs-slide');
527
+
528
  settings.find('.cs-slide-background_propriety_position_x').val(0);
529
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_x'));
530
+
531
  settings.find('.cs-slide-background_propriety_position_y').val(0);
532
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_position_y'));
533
+
534
  settings.find('input[name="cs-slide-background_repeat"][value="1"]').prop('checked', true);
535
  area.css('background-repeat', 'repeat');
536
+
537
  settings.find('.cs-slide-background_propriety_size').val('auto');
538
  crellyslider_keyup(settings.find('.cs-slide-background_propriety_size'));
539
  });
540
+
541
  // Apply custom CSS
542
  $('.cs-admin #cs-slides').on('keyup', '.cs-slides-list .cs-slide-settings-list .cs-slide-custom_css', function() {
543
  var text = $(this);
544
  var area = text.closest('.cs-slide').find('.cs-elements .cs-slide-editing-area');
545
  var css = text.val();
546
+
547
  // Save current styles
548
  var width = area.css('width');
549
  var height = area.css('height');
552
  var background_position = area.css('background-position');
553
  var background_repeat = area.css('background-repeat');
554
  var background_size = area.css('background-size');
555
+
556
  // Apply CSS
557
  area.attr('style', css);
558
  area.css({
564
  'background-repeat' : background_repeat,
565
  'background-size' : background_size
566
  });
567
+ });
568
+
569
  /**************/
570
  /** ELEMENTS **/
571
  /**************/
572
+
573
  // GENERAL
574
+
575
  // Make draggable
576
  function crellyslider_draggableElements() {
577
+ $('.cs-admin .cs-elements .cs-element').draggable({
578
  'containment' : 'parent',
579
+
580
  start: function() {
581
  // Select when dragging
582
+ crellyslider_selectElement($(this));
583
  },
584
+
585
  drag: function(){
586
  // Set left and top positions on drag to the textbox
587
  var position = $(this).position();
588
  var left = position.left;
589
  var top = position.top;
590
  var index = $(this).index();
591
+
592
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
593
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
594
  },
595
  });
596
  }
597
+
598
  // Selects an element, shows its options and makes the delete element button available
599
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-slide-editing-area .cs-element', function(e) {
600
  // Do not click the editing-area
601
  e.stopPropagation();
602
+
603
  // Do not open links
604
  e.preventDefault();
605
+
606
  crellyslider_selectElement($(this));
607
  });
608
  function crellyslider_selectElement(element) {
609
  var index = element.index();
610
+ var slide = element.closest('.cs-slide');
611
  var options = slide.find('.cs-elements .cs-elements-list');
612
+
613
  // Hide all options - .active class
614
  options.find('.cs-element-settings').css('display', 'none');
615
  options.find('.cs-element-settings').removeClass('active');
616
+
617
  // Show the correct options + .active class
618
  options.find('.cs-element-settings:eq(' + index + ')').css('display', 'block');
619
  options.find('.cs-element-settings:eq(' + index + ')').addClass('active');
620
+
621
  // Add .active class to the element in the editing area
622
  element.parent().children().removeClass('active');
623
  element.addClass('active');
624
+
625
  // Make the delete and the duplicate buttons working
626
  slide.find('.cs-elements-actions .cs-delete-element').removeClass('cs-is-disabled');
627
  slide.find('.cs-elements-actions .cs-duplicate-element').removeClass('cs-is-disabled');
628
  }
629
+
630
  // Deselect elements
631
  $('.cs-admin').on('click', '.cs-slide .cs-elements .cs-slide-editing-area', function() {
632
  crellyslider_deselectElements();
633
  });
634
  function crellyslider_deselectElements() {
635
  $('.cs-admin .cs-slide .cs-elements .cs-slide-editing-area .cs-element').removeClass('active');
636
+ $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').removeClass('active');
637
+ $('.cs-admin .cs-slide .cs-elements .cs-elements-list .cs-element-settings').css('display', 'none');
638
+
639
  // Hide delete and duplicate element btns
640
  $('.cs-admin .cs-slide .cs-elements-actions .cs-delete-element').addClass('cs-is-disabled');
641
  $('.cs-admin .cs-slide .cs-elements-actions .cs-duplicate-element').addClass('cs-is-disabled');
642
  }
643
+
644
  // Delete element. Remember that the button should be enabled / disabled somewhere else
645
  function crellyslider_deleteElement(element) {
646
  var index = element.index();
647
  var slide_parent = element.closest('.cs-slide');
648
+
649
  element.remove();
650
  var element_options = slide_parent.find('.cs-elements-list .cs-element-settings:eq(' + index + ')');
651
  element_options.remove();
656
  if($(this).hasClass('.cs-is-disabled')) {
657
  return;
658
  }
659
+
660
  var slide_parent = $(this).closest('.cs-slide');
661
  var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
662
  crellyslider_deleteElement(element);
663
  });
664
+
665
  function crellyslider_duplicateElement(element) {
666
  var index = element.index();
667
  var slide_parent = element.closest('.cs-slide');
668
+
669
  element.clone().appendTo(element.parent()).css({
670
  'left' : '+=10',
671
  'top' : '+=10',
672
  });
673
  var element_options = slide_parent.find('.cs-elements-list .cs-element-settings').eq(index);
674
  element_options.crellyslider_betterClone(true).insertBefore(element_options.parent().find('.cs-void-text-element-settings'));
675
+
676
  crellyslider_deselectElements();
677
  crellyslider_selectElement(element.parent().find('.cs-element').last());
678
+
679
  var cloned_options = element.parent().find('.cs-element').last().closest('.cs-slide').find('.cs-elements-list .cs-element-settings.active');
680
+
681
  // Move the element 10 pixels away
682
  cloned_options.find('.cs-element-data_left').val(parseInt(element_options.find('.cs-element-data_left').val()) + 10);
683
  cloned_options.find('.cs-element-data_top').val(parseInt(element_options.find('.cs-element-data_top').val()) + 10);
684
+
685
+ // If it's a text, fix TinyMCE
686
+ if(cloned_options.hasClass('cs-text-element-settings')) {
687
+ cloned_options.find('.cs-switch-editor, .mce-tinymce').remove();
688
+ cloned_options.find('.cs-element-inner_html').removeAttr('id').removeAttr('aria-hidden').removeAttr('style');
689
+ crellyslider_convertToWPEditor(cloned_options.find('.cs-element-inner_html'));
690
+ }
691
+
692
  // Make draggable
693
  crellyslider_draggableElements();
694
  }
697
  if($(this).hasClass('.cs-is-disabled')) {
698
  return;
699
  }
700
+
701
  var slide_parent = $(this).closest('.cs-slide');
702
  var element = slide_parent.find('.cs-elements .cs-slide-editing-area .cs-element.active');
703
  crellyslider_duplicateElement(element);
704
  });
705
+
706
  // Modify left position
707
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_left', function() {
708
  var index = $(this).closest('.cs-element-settings').index();
709
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', parseFloat($(this).val()));
710
  });
711
+
712
  // Center horizontally
713
  $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-x', function() {
714
  var index = $(this).closest('.cs-element-settings').index();
716
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
717
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_left').val(left);
718
  });
719
+
720
  // Modify top position
721
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-data_top', function() {
722
  var index = $(this).closest('.cs-element-settings').index();
723
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', parseFloat($(this).val()));
724
  });
725
+
726
  // Center vertically
727
  $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-center-y', function() {
728
  var index = $(this).closest('.cs-element-settings').index();
730
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
731
  $(this).closest('.cs-elements').find('.cs-elements-list .cs-element-settings:eq(' + index + ') .cs-element-data_top').val(top);
732
  });
733
+
734
  // Modify z-index
735
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-z_index', function() {
736
  var index = $(this).closest('.cs-element-settings').index();
737
  $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', parseFloat($(this).val()));
738
  });
739
+
740
  // Add / remove link wrapper (fire on textbox edit or on checkbox _target:"blank" edit)
741
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-link', function() {
742
  crellyslider_editElementsLink($(this));
745
  var textbox = $(this).parent().find('.cs-element-link');
746
  crellyslider_editElementsLink(textbox);
747
  });
748
+
749
  // Wrap - unwrap elements with an <a href="" target="">
750
  function crellyslider_editElementsLink(textbox_link) {
751
  var index = textbox_link.closest('.cs-element-settings').index();
752
  var copy_attributes = false;
753
  var reapply_css = false;
754
+
755
  if(textbox_link.val() != '' && !textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
756
  // Remove custom css classes
757
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
758
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes').val());
759
+
760
  var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? 'target="_blank"' : '';
761
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').wrap('<a href="' + textbox_link.val() + '"' + link_new_tab + ' />');
762
  copy_attributes = true;
764
  }
765
  else if(textbox_link.val() != '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
766
  var link_new_tab = textbox_link.parent().find('.cs-element-link_new_tab').prop('checked') ? true : false;
767
+
768
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('href', textbox_link.val());
769
+
770
  if(link_new_tab) {
771
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('target', '_blank');
772
  }
773
  else {
774
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').removeAttr('target');
775
  }
776
+
777
  copy_attributes = false;
778
  }
779
  else if(textbox_link.val() == '' && textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').hasClass('cs-element')) {
780
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').attr('class', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').attr('class')).removeClass('ui-draggable');
781
+
782
  // Reapply CSS and custom CSS
783
  applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
784
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('top', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('top'));
785
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('left', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('left'));
786
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').css('z-index', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').css('z-index'));
787
+
788
  // Reapply custom css classes
789
  crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
790
+
791
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').unwrap();
792
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').parent('a').draggable('destroy');
793
  copy_attributes = false;
794
  }
795
+
796
  if(copy_attributes) {
797
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').parent().attr('style', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style'));
798
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').parent().attr('class', textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('class')).removeClass('ui-draggable');
799
+
800
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('style');
801
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').removeAttr('class');
802
  textbox_link.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ') > *').draggable('destroy');
803
  }
804
+
805
  crellyslider_draggableElements();
806
+
807
  if(reapply_css) {
808
  applyCustomCss(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css'));
809
  crellyslider_applyCustomCssClasses(textbox_link.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
810
  }
811
  }
812
+
813
  // Apply custom CSS
814
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css', function() {
815
  applyCustomCss($(this));
816
  });
817
+
818
  function applyCustomCss(textarea) {
819
  var index = textarea.closest('.cs-element-settings').index();
820
  // Save current positions
821
  var left = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left');
822
  var top = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top');
823
  var z_index = textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index');
824
+
825
  // Apply CSS
826
  if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
827
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').attr('style', textarea.val());
833
  }
834
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('top', top);
835
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('left', left);
836
+ textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').css('z-index', z_index);
837
  }
838
+
839
  // Add custom CSS classes
840
  $('.cs-admin').on('keydown', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-custom_css_classes', function() {
841
  var textarea = $(this);
842
  var index = textarea.closest('.cs-element-settings').index();
843
+
844
  if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
845
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').removeClass(textarea.val());
846
  }
856
  });
857
  function crellyslider_applyCustomCssClasses(textarea) {
858
  var index = textarea.closest('.cs-element-settings').index();
859
+
860
  if(! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').is('a') && ! textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').hasClass('cs-video-element')) {
861
  textarea.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')').addClass(textarea.val());
862
  }
867
  avoid_interaction.addClass('cs-avoid-interaction');
868
  }
869
  }
870
+
871
  // TEXT ELEMENTS
872
+
873
+ // Convert textareas to WP editors
874
+ $('.cs-admin .cs-slide .cs-elements .cs-text-element-settings .cs-element-inner_html').each(function() {
875
+ var textarea = $(this);
876
+
877
+ if(textarea.closest('.cs-text-element-settings').hasClass('cs-void-text-element-settings')) {
878
+ return; // It means "continue;"
879
+ }
880
+
881
+ crellyslider_convertToWPEditor(textarea);
882
+ });
883
+
884
+ // Converts a textarea to something similar to wp_editor()
885
+ function crellyslider_convertToWPEditor(textarea) {
886
+ // Static counter: generates a new ID for each editor
887
+ if(crellyslider_convertToWPEditor.static_counter == undefined) {
888
+ crellyslider_convertToWPEditor.static_counter = 0;
889
+ }
890
+ else {
891
+ crellyslider_convertToWPEditor.static_counter++;
892
+ }
893
+
894
+ textarea.attr('id', 'cs-element-editor-' + crellyslider_convertToWPEditor.static_counter);
895
+
896
+ var lan = crellyslider_locale.split('_');
897
+ lan = lan[0];
898
+
899
+ settings = {
900
+ selector : '#cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter),
901
+ body_class : ('cs-element-editor-' + (crellyslider_convertToWPEditor.static_counter) + ' locale-' + crellyslider_locale).toLowerCase(),
902
+
903
+ toolbar1 : "bold,italic,strikethrough,alignleft,aligncenter,alignright,link,unlink,underline,forecolor,backcolor ",
904
+ toolbar2 : "fontselect,fontsizeselect ",
905
+ toolbar3 : "",
906
+ toolbar4 : "",
907
+ height : 200,
908
+ forced_root_block : false,
909
+ wpautop : false,
910
+ fontsize_formats : "1px 2px 3px 4px 5px 6px 7px 8px 9px 10px 11px 12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px 30px 31px 32px 33px 34px 35px 36px 37px 38px 39px 40px 41px 42px 43px 44px 45px 46px 47px 48px 49px 50px 51px 52px 53px 54px 55px 56px 57px 58px 59px 60px 61px 62px 63px 64px 65px 66px 67px 68px 69px 70px 71px 72px 73px 74px 75px 76px 77px 78px 79px 80px 81px 82px 83px 84px 85px 86px 87px 88px 89px 90px 91px 92px 93px 94px 95px 96px 97px 98px 99px 100px 101px 102px 103px 104px 105px 106px 107px 108px 109px 110px 111px 112px 113px 114px 115px 116px 117px 118px 119px 120px 121px 122px 123px 124px 125px 126px 127px 128px 129px 130px 131px 132px 133px 134px 135px 136px 137px 138px 139px 140px 141px 142px 143px 144px 145px 146px 147px 148px 149px 150px 151px 152px 153px 154px 155px 156px 157px 158px 159px 160px 161px 162px 163px 164px 165px 166px 167px 168px 169px 170px 171px 172px 173px 174px 175px 176px 177px 178px 179px 180px 181px 182px 183px 184px 185px 186px 187px 188px 189px 190px 191px 192px 193px 194px 195px 196px 197px 198px 199px 200px",
911
+
912
+ wp_lang_attr : crellyslider_locale,
913
+ content_css : "",
914
+ cache_suffix : "",
915
+ language : lan,
916
+ theme:"modern",skin:"lightgray",formats:{alignleft: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left"}},{selector: "img,table,dl.wp-caption", classes: "alignleft"}],aligncenter: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center"}},{selector: "img,table,dl.wp-caption", classes: "aligncenter"}],alignright: [{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right"}},{selector: "img,table,dl.wp-caption", classes: "alignright"}],strikethrough: {inline: "del"}},relative_urls:false,remove_script_host:false,convert_urls:false,browser_spellcheck:true,fix_list_elements:true,entities:"38,amp,60,lt,62,gt",entity_encoding:"raw",keep_styles:false,preview_styles:"font-family font-size font-weight font-style text-decoration text-transform",end_container_on_empty_block:true,wpeditimage_disable_captions:false,wpeditimage_html5_captions:true,plugins:"charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview,wpembed,image",resize:"vertical",menubar:false,indent:true,tabfocus_elements:":prev,:next",
917
+
918
+ setup : function(editor) {
919
+ editor.on("KeyUp ExecCommand ContextMenu Change", function (e) {
920
+ editor.save();
921
+ crellyslider_triggerTinyMCE(editor.id);
922
+ });
923
+
924
+ editor.on("init", function() {
925
+ // Set default CSS
926
+ this.getDoc().body.style.fontSize = "14px";
927
+ this.getDoc().body.style.fontFamily = "Verdana";
928
+
929
+ // Insert switch button
930
+ textarea.parent().prepend('<div class="cs-switch-editor"><div onclick="tinyMCE.execCommand(\'mceToggleEditor\', false, \'' + editor.id + '\')" class="cs-button cs-is-default cs-tinymce">' + crellyslider_translations.switch_editor + '</div></div>');
931
+ });
932
+ }
933
+ };
934
+
935
+ tinyMCE.init(settings);
936
+ }
937
+
938
+ // When the user modifies the text in the TinyMCE editor, apply the changes to the preview area
939
+ function crellyslider_triggerTinyMCE(editor_id) {
940
+ crellyslider_changeText(jQuery('#' + editor_id));
941
+ }
942
+
943
+ // Add text click
944
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-text-element', function() {
945
  var slide_parent = $(this).closest('.cs-slide');
946
  crellyslider_addTextElement(slide_parent);
947
  });
948
+
949
  // Add text. Receives the slide as object
950
  function crellyslider_addTextElement(slide_parent) {
951
  var area = slide_parent.find('.cs-slide-editing-area');
952
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
953
  var settings = '<div class="cs-element-settings cs-text-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-text-element-settings').html() + '</div>';
954
+
955
  // Insert in editing area
956
  area.append('<div class="cs-element cs-text-element" style="z-index: 1;">' + crellyslider_translations.text_element_default_html + '</div>');
957
+
958
  // Insert the options
959
  settings_div.before(settings);
960
+
961
  // Make draggable
962
  crellyslider_draggableElements();
963
+
964
+ // Convert textarea to WP editor
965
+ crellyslider_convertToWPEditor(slide_parent.find('.cs-elements .cs-elements-list .cs-text-element-settings:not(.cs-void-text-element-settings)').last().find('.cs-element-inner_html'));
966
+
967
  // Display settings
968
  crellyslider_selectElement(area.find('.cs-element').last());
969
  }
970
+
971
+ // Modify text
972
  $('.cs-admin').on('keyup', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-inner_html', function() {
973
+ crellyslider_changeText($(this));
974
+ });
975
+ crellyslider_changeText = function crellyslider_changeText(element) {
976
+ var index = element.closest('.cs-element-settings').index();
977
+ var text_element = element.closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
978
+
979
  if(! text_element.is('a')) {
980
+ text_element.html(element.val());
981
+
982
+ text_element.css('width', '');
983
+ text_element.css('height', '');
984
  }
985
  else {
986
+ text_element.find('> div').html(element.val());
987
+
988
+ text_element.find('> div').css('width', '');
989
+ text_element.find('> div').css('height', '');
990
  }
991
+ }
992
+
993
  // IMAGE ELEMENTS
994
+
995
  // Add images click
996
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-image-element', function() {
997
  var slide_parent = $(this).closest('.cs-slide');
998
  crellyslider_addImageElement(slide_parent);
999
  });
1000
+
1001
  // Upload click
1002
  $('.cs-admin').on('click', '.cs-elements .cs-elements-list .cs-image-element-settings .cs-image-element-upload-button', function() {
1003
  var slide_parent = $(this).closest('.cs-slide');
1004
  crellySliderUploadImageElement(slide_parent);
1005
  });
1006
+
1007
  // Add image. Receives the slide as object
1008
  function crellyslider_addImageElement(slide_parent) {
1009
  var area = slide_parent.find('.cs-slide-editing-area');
1010
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1011
  var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1012
+
1013
  // Temporarily insert an element with no src and alt
1014
  // Add the image into the editing area.
1015
  area.append('<img class="cs-element cs-image-element" src="nothing_now.jpg" style="z-index: 1;" />');
1016
+
1017
  // Insert the options
1018
  settings_div.before(settings);
1019
+
1020
  // Make draggable
1021
  crellyslider_draggableElements();
1022
+
1023
  // Display settings
1024
  crellyslider_selectElement(area.find('.cs-element').last());
1025
+
1026
  // Upload
1027
+ crellySliderUploadImageElement(slide_parent);
1028
  }
1029
+
1030
  function crellySliderUploadImageElement(slide_parent) {
1031
  var area = slide_parent.find('.cs-slide-editing-area');
1032
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1033
  var settings = '<div class="cs-element-settings cs-image-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-image-element-settings').html() + '</div>';
1034
+
1035
  var file_frame;
1036
 
1037
  // If the media frame already exists, reopen it.
1057
  // Do something with attachment.id and/or attachment.url here
1058
  var image_src = attachment.url;
1059
  var image_alt = attachment.alt;
1060
+ var attachment_id = attachment.id;
1061
+
1062
  // Set attributes. If is a link, do the right thing
1063
  var image = area.find('.cs-image-element.active').last();
1064
+
1065
  if(! image.is('a')) {
1066
  image.attr('src', image_src);
1067
  image.attr('alt', image_alt);
1068
  }
1069
  else {
1070
+ image.find('> img').attr('src', image_src);
1071
+ image.find('> img').attr('alt', image_alt);
1072
  }
1073
+
1074
  // Set data (will be used in the ajax call)
1075
+ settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('src', attachment_id);
1076
  settings_div.parent().find('.cs-element-settings.active .cs-image-element-upload-button').data('alt', image_alt);
1077
  });
1078
 
1079
  // Finally, open the modal
1080
  file_frame.open();
1081
  }
1082
+
1083
  // VIDEO ELEMENTS
1084
+
1085
  // Add video click
1086
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-add-video-element', function() {
1087
  var slide_parent = $(this).closest('.cs-slide');
1088
  crellyslider_addVideoElement(slide_parent);
1089
  });
1090
+
1091
  // Adds a video container. Receives the slide as object
1092
  function crellyslider_addVideoElement(slide_parent) {
1093
  var area = slide_parent.find('.cs-slide-editing-area');
1094
  var settings_div = slide_parent.find('.cs-elements .cs-elements-list .cs-void-text-element-settings');
1095
  var settings = '<div class="cs-element-settings cs-video-element-settings">' + $('.cs-admin .cs-slide .cs-elements .cs-void-video-element-settings').html() + '</div>';
1096
+
1097
  // Insert in editing area
1098
  area.append('<div class="cs-element cs-video-element" style="z-index: 1;"></div>');
1099
+
1100
  // Insert the options
1101
  settings_div.before(settings);
1102
+
1103
  // Make draggable
1104
  crellyslider_draggableElements();
1105
+
1106
  // Display settings
1107
  crellyslider_selectElement(area.find('.cs-element').last());
1108
+
1109
  // Select youtube video as default
1110
  area.find('.cs-element').last().closest('.cs-slide').find('.cs-elements .cs-elements-list .cs-element-video_src').trigger('change');
1111
  }
1112
+
1113
  // Change video id
1114
  $('.cs-admin').on('change keyup input', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_id', function() {
1115
  var index = $(this).closest('.cs-element-settings').index();
1116
  var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1117
+
1118
  crellyslider_changeVideo($(this), element, $(this).parent().find('.cs-element-video_src').val(), $(this).val());
1119
  });
1120
  // Change video source
1121
  $('.cs-admin').on('change', '.cs-elements .cs-elements-list .cs-element-settings .cs-element-video_src', function() {
1122
  var index = $(this).closest('.cs-element-settings').index();
1123
  var element = $(this).closest('.cs-elements').find('.cs-slide-editing-area .cs-element:eq(' + index + ')');
1124
+
1125
  crellyslider_changeVideo($(this), element, $(this).val(), $(this).parent().find('.cs-element-video_id').val());
1126
+ });
1127
  function crellyslider_changeVideo(input, element, source, video_id) {
1128
  if(source == 'youtube') {
1129
  element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-yt-iframe" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/' + video_id + '?enablejsapi=1" frameborder="0"></iframe>');
1131
  else {
1132
  element.html('<div class="cs-avoid-interaction"></div><iframe class="cs-vimeo-iframe" src="https://player.vimeo.com/video/' + video_id + '?api=1" width="560" height="315" frameborder="0" ></iframe>');
1133
  }
1134
+
1135
  // Re-apply custom CSS and custom CSS classes
1136
  crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css'));
1137
  crellyslider_keyup(input.closest('.cs-element-settings').find('.cs-element-custom_css_classes'));
1138
  }
1139
+
1140
  /******************/
1141
  /** LIVE PREVIEW **/
1142
  /******************/
1143
+
1144
  // Live preview click
1145
  $('.cs-admin #cs-slides').on('click', '.cs-slide .cs-elements .cs-elements-actions .cs-live-preview', function() {
1146
  var btn = $(this);
1147
  var slide_parent = btn.closest('.cs-slide');
1148
+
1149
  if(! btn.hasClass('cs-live-preview-running')) {
1150
  btn.addClass('cs-live-preview-running');
1151
  btn.text(crellyslider_translations.slide_stop_preview);
1157
  crellyslider_stopLivePreview(slide_parent);
1158
  }
1159
  });
1160
+
1161
  function crellyslider_startLivePreview(slide_parent) {
1162
  crellyslider_deselectElements();
1163
+
1164
  var area = slide_parent.find('.cs-slide-editing-area');
1165
+
1166
  area.clone().addClass('cs-slide-live-preview-area').insertAfter(area);
1167
  var prev = slide_parent.find('.cs-slide-live-preview-area');
1168
+
1169
  area.css('display', 'none');
1170
+
1171
  // Set elements data and styles
1172
  var elements = prev.find('.cs-element');
1173
  var original_elements = area.closest('.cs-slide').find('.cs-elements .cs-element-settings');
1174
  var i = 0;
1175
  elements.each(function() {
1176
  var element = $(this);
1177
+
1178
+ // Video elements settings only
1179
+ var html_class = false;
 
 
 
 
 
 
 
 
 
1180
  if(element.find('.cs-yt-iframe').length > 0) {
1181
  element.find('.cs-avoid-interaction').remove();
1182
  element = element.find('.cs-yt-iframe');
1185
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1186
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1187
  });
1188
+ html_class = 'cs-yt-iframe';
1189
  }
1190
  else if(element.find('.cs-vimeo-iframe').length > 0) {
1191
  element.find('.cs-avoid-interaction').remove();
1195
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1196
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1197
  });
1198
+ html_class = 'cs-vimeo-iframe';
1199
  }
1200
+
1201
+ element.removeAttr('style');
1202
+ element.attr('style', original_elements.eq(i).find('.cs-element-custom_css').val());
1203
+ element.css({
1204
+ 'z-index' : parseInt(original_elements.eq(i).find('.cs-element-z_index').val()),
1205
+ 'display' : 'none',
1206
+ });
1207
+
1208
+ element.removeAttr('class');
1209
+ element.addClass(original_elements.eq(i).find('.cs-element-custom_css_classes').val());
1210
+ if(html_class) {
1211
+ element.addClass(html_class);
1212
+ }
1213
+
1214
  element.attr({
1215
  'data-left' : parseInt(original_elements.eq(i).find('.cs-element-data_left').val()),
1216
  'data-top' : parseInt(original_elements.eq(i).find('.cs-element-data_top').val()),
1222
  'data-ease-in' : parseInt(original_elements.eq(i).find('.cs-element-data_easeIn').val()),
1223
  'data-ease-out' : parseInt(original_elements.eq(i).find('.cs-element-data_easeOut').val()),
1224
  });
1225
+
1226
  i++;
1227
  });
1228
+
1229
  // Prepare HTML structure
1230
  prev.wrapInner('<li />');
1231
  prev.wrapInner('<ul />');
1232
+
1233
+
1234
  var slide = prev.find('ul > li');
1235
  var original_slide = area.closest('.cs-slide');
1236
  var content = original_slide.find('.cs-slide-settings-list');
1237
+
1238
  // Set slide link
1239
  if(content.find('.cs-background-link').val() != '') {
1240
  if(! content.find('.cs-background-link_new_tab').prop('checked')) {
1244
  slide.prepend('<a class="cs-background-link" target="_blank" href="' + content.find('.cs-background-link').val() + '"></a>');
1245
  }
1246
  }
1247
+
1248
  // Set slide data and styles
1249
  slide.attr({
1250
  'data-in' : content.find('.cs-slide-data_in').val(),
1253
  'data-ease-in' : parseInt(content.find('.cs-slide-data_easeIn').val()),
1254
  'data-ease-out' : parseInt(content.find('.cs-slide-data_easeOut').val()),
1255
  });
1256
+
1257
  slide.attr('style', content.find('.cs-slide-custom_css').val());
1258
  slide.css({
1259
  'background-image' : area.css('background-image') ,
1262
  'background-repeat' : content.find('input[name="cs-slide-background_repeat"]:checked').val() == '0' ? 'no-repeat' : 'repeat',
1263
  'background-size' : content.find('.cs-slide-background_propriety_size').val(),
1264
  });
1265
+
1266
  var slider = $('.cs-admin .cs-slider #cs-slider-settings');
1267
+
1268
  // Run Crelly Slider
1269
  prev.crellySlider({
1270
  'layout' : 'fixed',
1271
  'responsive' : false,
1272
  'startWidth' : parseInt(slider.find('#cs-slider-startWidth').val()),
1273
  'startHeight' : parseInt(slider.find('#cs-slider-startHeight').val()),
1274
+
1275
  'automaticSlide' : true,
1276
  'showControls' : false,
1277
  'showNavigation' : false,
1279
  'showProgressBar' : false,
1280
  'pauseOnHover' : false,
1281
  });
1282
+
1283
  // Warning: click on background links
1284
  $('.cs-slide-live-preview-area a').click(function(event) {
1285
  if($(this).prop('target') != '_blank') {
1290
  }
1291
  });
1292
  }
1293
+
1294
  function crellyslider_stopLivePreview(slide_parent) {
1295
  var area = slide_parent.find('.cs-slide-editing-area');
1296
  var prev = slide_parent.find('.cs-slide-live-preview-area');
1297
+
1298
  prev.remove();
1299
  area.css('display', 'block');
1300
  }
1301
+
1302
  /****************/
1303
  /** AJAX CALLS **/
1304
  /****************/
1305
+
1306
  // Save or update the new slider in the database
1307
  $('.cs-admin .cs-slider .cs-save-settings').click(function() {
1308
  $('.cs-admin #cs-slides .cs-live-preview').each(function() {
1309
  var btn = $(this);
1310
  var slide_parent = btn.closest('.cs-slide');
1311
+
1312
  if(btn.hasClass('cs-live-preview-running')) {
1313
  btn.removeClass('cs-live-preview-running');
1314
  btn.text(crellyslider_translations.slide_live_preview);
1315
  crellyslider_stopLivePreview(slide_parent);
1316
  }
1317
  });
1318
+
1319
  crellyslider_saveSlider();
1320
  });
1321
+
1322
  // Delete slider
1323
  $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-delete-slider', function() {
1324
  var confirm = window.confirm(crellyslider_translations.slider_delete_confirm);
1325
  if(!confirm) {
1326
  return;
1327
  }
1328
+
1329
  crellyslider_deleteSlider($(this));
1330
  });
1331
+
1332
  // Duplicate slider
1333
  $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-duplicate-slider', function() {
1334
  crellyslider_duplicateSlider($(this));
1335
  });
1336
+
1337
  // Export slider
1338
  $('.cs-admin .cs-home').on('click', '.cs-sliders-list .cs-export-slider', function() {
1339
  crellyslider_exportSlider($(this));
1340
  });
1341
+
1342
  // Import slider
1343
  $('.cs-admin .cs-home').on('click', '.cs-import-slider', function() {
1344
  $('#cs-import-file').trigger('click');
1346
  $('.cs-admin .cs-home').on('change', '#cs-import-file', function() {
1347
  crellyslider_importSlider();
1348
  });
1349
+
1350
  // Sends an array with the new or current slider options
1351
+ function crellyslider_saveSlider() {
1352
  var content = $('.cs-admin .cs-slider #cs-slider-settings');
1353
  var options = {
1354
  id : parseInt($('.cs-admin .cs-slider .cs-save-settings').data('id')),
1364
  enableSwipe : parseInt(content.find('#cs-slider-enableSwipe').val()),
1365
  showProgressBar : parseInt(content.find('#cs-slider-showProgressBar').val()),
1366
  pauseOnHover : parseInt(content.find('#cs-slider-pauseOnHover').val()),
1367
+ randomOrder : parseInt(content.find('#cs-slider-randomOrder').val()),
1368
+ startFromSlide : parseInt(content.find('#cs-slider-startFromSlide').val()),
1369
  callbacks : content.find('#cs-slider-callbacks').val(),
1370
  };
1371
+
1372
  // Do the ajax call
1373
  jQuery.ajax({
1374
  type : 'POST',
1388
  window.location.href = '?page=crellyslider&view=edit&id=' + response;
1389
  return;
1390
  }
1391
+
1392
  crellyslider_saveSlides();
1393
  }
1394
  else {
1395
  crellyslider_showError();
1396
  }
1397
  },
1398
+
1399
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1400
  alert('Error saving slider');
1401
  console.log(XMLHttpRequest.responseText);
1402
  crellyslider_showError();
1403
  }
1404
  });
1405
  }
1406
+
1407
  // Sends an array with all the slides options
1408
  function crellyslider_saveSlides() {
1409
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1410
  var i = 0;
1411
  var final_options = {};
1412
+
1413
+ final_options['options'] = new Array();
1414
  slides.each(function() {
1415
  var slide = $(this);
1416
  var content = slide.find('.cs-slide-settings-list');
1417
+
1418
  var background_type_color;
1419
  if(content.find('input[name="cs-slide-background_type_color"]:checked').val() == '0') {
1420
  background_type_color = 'transparent';
1425
  else {
1426
  background_type_color = content.find('.cs-slide-background_type_color-manual').val();
1427
  }
1428
+
1429
+ var options = {
1430
  slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1431
  position : i,
1432
+
1433
+ draft : parseInt(content.find('.cs-slide-draft').val()),
1434
+ background_type_image : slide.find('.cs-slide-editing-area').css('background-image') == 'none' ? 'none' : slide.find('.cs-slide-editing-area').data('background-image-src') + "",
1435
  background_type_color : background_type_color,
1436
  background_type_color_input : content.find('input[name="cs-slide-background_type_color"]:checked').val(),
1437
  background_propriety_position_x : content.find('.cs-slide-background_propriety_position_x').val(),
1447
  link_new_tab : slide.find('.cs-background-link_new_tab').prop('checked') ? 1 : 0,
1448
  custom_css : content.find('.cs-slide-custom_css').val(),
1449
  };
1450
+
1451
  final_options['options'][i] = options;
1452
+
1453
  i++;
1454
  });
1455
+
1456
  final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id')),
1457
+
1458
  // Do the ajax call
1459
  jQuery.ajax({
1460
  type : 'POST',
1473
  crellyslider_showError();
1474
  }
1475
  },
1476
+
1477
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1478
  alert('Error saving slides');
1479
  console.log(XMLHttpRequest.responseText);
1480
  crellyslider_showError();
1481
  }
1482
  });
1483
  }
1484
+
1485
  // Sends an array with all the elements options of each slide
1486
  function crellyslider_saveElements() {
1487
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1488
  var i = 0, j = 0;
1489
  var final_options = {};
1490
+
1491
  final_options['options'] = new Array();
1492
  slides.each(function() {
1493
  var slide = $(this);
1494
  var elements = slide.find('.cs-elements .cs-element-settings');
1495
+
1496
  elements.each(function() {
1497
  var element = $(this);
1498
+
1499
  // Stop each loop when reach the void element
1500
  if(element.hasClass('cs-void-element-settings')) {
1501
  return;
1502
  }
1503
+
1504
  // Get the type of the element
1505
  var type;
1506
  if(element.hasClass('cs-text-element-settings')) {
1520
  else {
1521
  type = 'undefined';
1522
  }
1523
+
1524
  var options = {
1525
+ slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1526
+ slide_parent : i,
1527
  position : element.index(),
1528
  type : type,
1529
+
1530
  inner_html : element.hasClass('cs-text-element-settings') ? element.find('.cs-element-inner_html').val() : '',
1531
  image_src : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('src') : '',
1532
  image_alt : element.hasClass('cs-image-element-settings') ? element.find('.cs-image-element-upload-button').data('alt') : '',
1548
  video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1549
  video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1550
  };
1551
+
1552
  final_options['options'][j] = options;
1553
+
1554
  j++;
1555
  });
1556
+
1557
  i++;
1558
  });
1559
+
1560
  // Proceed?
1561
  final_options['elements'] = 1;
1562
  if(final_options['options'].length == 0) {
1563
  final_options['elements'] = 0;
1564
  }
1565
+
1566
  final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1567
+
1568
  final_options['options'] = JSON.stringify(final_options['options']);
1569
+
1570
  // Do the ajax call
1571
  jQuery.ajax({
1572
  type : 'POST',
1585
  crellyslider_showError();
1586
  }
1587
  },
1588
+
1589
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1590
  alert('Error saving elements');
1591
  console.log(XMLHttpRequest.responseText);
1592
  crellyslider_showError();
1593
  }
1594
  });
1595
  }
1596
+
1597
  function crellyslider_deleteSlider(content) {
1598
  // Get options
1599
  var options = {
1600
  id : parseInt(content.data('delete')),
1601
  };
1602
+
1603
  // Do the ajax call
1604
  jQuery.ajax({
1605
  type : 'POST',
1624
  crellyslider_showError();
1625
  }
1626
  },
1627
+
1628
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1629
  alert('Error deleting slider');
1630
  console.log(XMLHttpRequest.responseText);
1631
  crellyslider_showError();
1632
  },
1633
  });
1634
  }
1635
+
1636
  function crellyslider_duplicateSlider(content) {
1637
  // Get options
1638
  var options = {
1639
  id : parseInt(content.data('duplicate')),
1640
  };
1641
+
1642
  // Do the ajax call
1643
  jQuery.ajax({
1644
  type : 'POST',
1661
  cloned_slider.find('.cs-duplicate-slider').data('duplicate', response['cloned_slider_id']);
1662
  cloned_slider.find('.cs-delete-slider').data('delete', response['cloned_slider_id']);
1663
  cloned_slider.find('.cs-export-slider').data('export', response['cloned_slider_id']);
1664
+
1665
  crellyslider_showSuccess();
1666
  }
1667
  else {
1668
  crellyslider_showError();
1669
  }
1670
  },
1671
+
1672
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1673
  alert('Error duplicating slider');
1674
  console.log(XMLHttpRequest.responseText);
1675
  crellyslider_showError();
1676
  },
1677
  });
1678
  }
1679
+
1680
  function crellyslider_exportSlider(content) {
1681
  // Get options
1682
  var options = {
1683
  id : parseInt(content.data('export')),
1684
  };
1685
+
1686
  // Do the ajax call
1687
  jQuery.ajax({
1688
  type : 'POST',
1693
  datas : options,
1694
  },
1695
  success: function(response) {
1696
+ if(response['response'] !== false) {
1697
  window.location.href = response['url'];
1698
  crellyslider_showSuccess();
1699
  }
1701
  crellyslider_showError();
1702
  }
1703
  },
1704
+
1705
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1706
  alert('Error while exporting the slider');
1707
  console.log(XMLHttpRequest.responseText);
1708
  crellyslider_showError();
1709
  },
1710
  });
1711
  }
1712
+
1713
  function crellyslider_importSlider() {
1714
  var file = $('#cs-import-file')[0].files[0];
1715
+
1716
  if(! file) {
1717
  return;
1718
  }
1719
+
1720
  // Reset input file. Prevents conflicts
1721
  $('#cs-import-file').val('');
1722
+
1723
  // Form data (for file uploads)
1724
  var fd = new FormData();
1725
  fd.append('file', file);
1726
+ fd.append('action', 'crellyslider_importSlider');
1727
+
1728
  // Do the ajax call
1729
  jQuery.ajax({
1730
  type : 'POST',
1733
  processData : false,
1734
  data : fd,
1735
  success: function(response) {
1736
+ response = JSON.parse(response);
1737
+ //console.log(response);
1738
  if(response['response'] !== false) {
1739
  var content = $('.cs-sliders-list .cs-duplicate-slider:eq(0)');
1740
  if(content.length > 0) {
1752
  else {
1753
  location.reload();
1754
  }
1755
+
1756
  crellyslider_showSuccess();
1757
  }
1758
  else {
1759
  crellyslider_showError();
1760
  }
1761
  },
1762
+
1763
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1764
  alert('Error while importing the slider');
1765
  console.log(XMLHttpRequest.responseText);
1766
  crellyslider_showError();
1769
  }
1770
 
1771
  });
1772
+ })(jQuery);
wordpress/slider.php CHANGED
@@ -12,6 +12,10 @@
12
  1 => array(__('Yes', 'crelly-slider'), true),
13
  0 => array(__('No', 'crelly-slider'), false),
14
  ),
 
 
 
 
15
  );
16
  ?>
17
 
@@ -240,6 +244,56 @@
240
  <?php _e('Pause the current slide when hovered.', 'crelly-slider'); ?>
241
  </td>
242
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  <tr>
244
  <td class="cs-name"><?php _e('Callbacks', 'crelly-slider'); ?></td>
245
  <td class="cs-content">
12
  1 => array(__('Yes', 'crelly-slider'), true),
13
  0 => array(__('No', 'crelly-slider'), false),
14
  ),
15
+ 'boolean_not' => array(
16
+ 1 => array(__('Yes', 'crelly-slider'), false),
17
+ 0 => array(__('No', 'crelly-slider'), true),
18
+ ),
19
  );
20
  ?>
21
 
244
  <?php _e('Pause the current slide when hovered.', 'crelly-slider'); ?>
245
  </td>
246
  </tr>
247
+ <tr>
248
+ <td class="cs-name"><?php _e('Random order', 'crelly-slider'); ?></td>
249
+ <td class="cs-content">
250
+ <select id="cs-slider-randomOrder">
251
+ <?php
252
+ foreach($slider_select_options['boolean_not'] as $key => $value) {
253
+ echo '<option value="' . $key . '"';
254
+ if((!$edit && $value[1]) || ($edit && $slider->randomOrder == $key)) {
255
+ echo ' selected';
256
+ }
257
+ echo '>' . $value[0] . '</option>';
258
+ }
259
+ ?>
260
+ </select>
261
+ </td>
262
+ <td class="cs-description">
263
+ <?php _e('The order of the slides is random (instead of being linear).', 'crelly-slider'); ?>
264
+ </td>
265
+ </tr>
266
+ <tr>
267
+ <td class="cs-name"><?php _e('Start from slide', 'crelly-slider'); ?></td>
268
+ <td class="cs-content">
269
+ <select id="cs-slider-startFromSlide">
270
+ <?php
271
+ if(! $edit) {
272
+ echo '<option selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
273
+ echo '<option selected value="0">' . __('Slide', 'crelly-slider') . ' 1</option>';
274
+ }
275
+ else {
276
+ if($edit && $slider->startFromSlide == -1) {
277
+ echo '<option selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
278
+ }
279
+ else {
280
+ echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
281
+ }
282
+ for($i = 0; $i < count($slides); $i++) {
283
+ echo '<option value="' . $i . '"';
284
+ if((!$edit && $i == 0) || ($edit && $slider->startFromSlide == $i)) {
285
+ echo ' selected';
286
+ }
287
+ echo '>' . __('Slide', 'crelly-slider') . ' ' . ($i + 1) . '</option>';
288
+ }
289
+ }
290
+ ?>
291
+ </select>
292
+ </td>
293
+ <td class="cs-description">
294
+ <?php _e('The slide that will be displayed first.', 'crelly-slider'); ?>
295
+ </td>
296
+ </tr>
297
  <tr>
298
  <td class="cs-name"><?php _e('Callbacks', 'crelly-slider'); ?></td>
299
  <td class="cs-content">
wordpress/slides.php CHANGED
@@ -317,6 +317,26 @@ function crellyslider_printSlide($slider, $slide, $edit) {
317
  <?php _e('Apply CSS to the slide.', 'crelly-slider'); ?>
318
  </td>
319
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  </tbody>
321
  </table>
322
 
317
  <?php _e('Apply CSS to the slide.', 'crelly-slider'); ?>
318
  </td>
319
  </tr>
320
+ <tr>
321
+ <td class="cs-name"><?php _e('Draft', 'crelly-slider'); ?></td>
322
+ <td class="cs-content">
323
+ <select class="cs-slide-draft">
324
+ <?php
325
+ if(!$void && $slide->draft) {
326
+ echo '<option selected value="1">' . __('Yes', 'crelly-slider') . '</option>';
327
+ echo '<option value="0">' . __('No', 'crelly-slider') . '</option>';
328
+ }
329
+ else {
330
+ echo '<option value="1">' . __('Yes', 'crelly-slider') . '</option>';
331
+ echo '<option selected value="0">' . __('No', 'crelly-slider') . '</option>';
332
+ }
333
+ ?>
334
+ </select>
335
+ </td>
336
+ <td class="cs-description">
337
+ <?php _e('If it is set to "Yes", the slide will not be displayed to the users.', 'crelly-slider'); ?>
338
+ </td>
339
+ </tr>
340
  </tbody>
341
  </table>
342
 
wordpress/tables.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
  class CrellySliderTables {
5
 
@@ -37,6 +37,8 @@ class CrellySliderTables {
37
  enableSwipe INT DEFAULT 1,
38
  showProgressBar INT,
39
  pauseOnHover INT,
 
 
40
  callbacks TEXT CHARACTER SET utf8,
41
  UNIQUE KEY id (id)
42
  );";
@@ -54,6 +56,7 @@ class CrellySliderTables {
54
  id mediumint(9) NOT NULL AUTO_INCREMENT,
55
  slider_parent mediumint(9),
56
  position INT,
 
57
  background_type_image TEXT CHARACTER SET utf8,
58
  background_type_color TEXT CHARACTER SET utf8,
59
  background_type_color_input INT DEFAULT -1,
@@ -129,6 +132,11 @@ class CrellySliderTables {
129
  $wpdb->query($sql);
130
  }
131
 
 
 
 
 
 
132
  }
133
 
134
  ?>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
  class CrellySliderTables {
5
 
37
  enableSwipe INT DEFAULT 1,
38
  showProgressBar INT,
39
  pauseOnHover INT,
40
+ randomOrder INT DEFAULT 0,
41
+ startFromSlide INT DEFAULT 0,
42
  callbacks TEXT CHARACTER SET utf8,
43
  UNIQUE KEY id (id)
44
  );";
56
  id mediumint(9) NOT NULL AUTO_INCREMENT,
57
  slider_parent mediumint(9),
58
  position INT,
59
+ draft INT DEFAULT 0,
60
  background_type_image TEXT CHARACTER SET utf8,
61
  background_type_color TEXT CHARACTER SET utf8,
62
  background_type_color_input INT DEFAULT -1,
132
  $wpdb->query($sql);
133
  }
134
 
135
+ // Removes everything related to Crelly Slider from the database
136
+ public static function clearDatabase() {
137
+ self::dropTables();
138
+ self::removeVersion();
139
+ }
140
  }
141
 
142
  ?>