Crelly Slider - Version 1.3.6

Version Description

  • Fixed PHP warning "Cannot modify header information - headers already sent" as reported here
Download this release

Release Info

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

Code changes from version 1.3.5 to 1.3.6

LICENSE.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright <2014 - 2019> <The Crelly Slider authors>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
crellyslider.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Crelly Slider
4
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
5
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
- * Version: 1.3.5
7
  * Author: Fabio Rinaldi
8
  * Author URI: https://github.com/fabiorino
9
  * Text Domain: crelly-slider
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18
 
19
  define('CS_DEBUG', false);
20
 
21
- define('CS_VERSION', '1.3.5');
22
  define('CS_MIN_CAPABILITY', 'manage_options');
23
  define('CS_PATH', plugin_dir_path(__FILE__));
24
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
@@ -32,18 +32,14 @@ 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
- // This is a variable that should be included first to prevent backend issues.
36
- if(is_admin()) {
37
- require_once CS_PATH . 'wordpress/admin.php';
38
- CrellySliderAdmin::setIsAdminJs();
39
- }
40
-
41
  // CSS and Javascript
42
  CrellySliderCommon::setEnqueues();
43
 
44
  CrellySliderFrontend::addShortcode();
45
 
46
  if(is_admin()) {
 
 
47
  // Tables
48
  if(CS_DEBUG || CS_VERSION != get_option('cs_version')) {
49
  CrellySliderTables::setTables();
@@ -52,7 +48,7 @@ if(is_admin()) {
52
  CrellySliderTables::setVersion();
53
  }
54
 
55
- CrellySliderAdmin::setEnqueues();
56
  CrellySliderAdmin::showSettings();
57
 
58
  // Ajax functions
3
  * Plugin Name: Crelly Slider
4
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
5
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
6
+ * Version: 1.3.6
7
  * Author: Fabio Rinaldi
8
  * Author URI: https://github.com/fabiorino
9
  * Text Domain: crelly-slider
18
 
19
  define('CS_DEBUG', false);
20
 
21
+ define('CS_VERSION', '1.3.6');
22
  define('CS_MIN_CAPABILITY', 'manage_options');
23
  define('CS_PATH', plugin_dir_path(__FILE__));
24
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
32
  register_activation_hook(__FILE__, array('CrellySliderTables', 'setTables'));
33
  register_uninstall_hook(__FILE__, array('CrellySliderTables', 'clearDatabase'));
34
 
 
 
 
 
 
 
35
  // CSS and Javascript
36
  CrellySliderCommon::setEnqueues();
37
 
38
  CrellySliderFrontend::addShortcode();
39
 
40
  if(is_admin()) {
41
+ require_once CS_PATH . 'wordpress/admin.php';
42
+
43
  // Tables
44
  if(CS_DEBUG || CS_VERSION != get_option('cs_version')) {
45
  CrellySliderTables::setTables();
48
  CrellySliderTables::setVersion();
49
  }
50
 
51
+ CrellySliderAdmin::loadAssets();
52
  CrellySliderAdmin::showSettings();
53
 
54
  // Ajax functions
css/crellyslider.css CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.6
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
css/crellyslider.min.css CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.6
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
js/jquery.crellyslider.js CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.5
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
@@ -67,6 +67,7 @@ var crellyslider_vimeo_api_ready = false;
67
 
68
  var paused = false;
69
  var can_pause = false; // Also used as "can change slide"
 
70
  var executed_slide = false; // Will be true as soon as the current slide is executed
71
  var first_play = true;
72
 
@@ -313,6 +314,9 @@ var crellyslider_vimeo_api_ready = false;
313
  var player = new YT.Player(element.attr('id'), {
314
  events: {
315
  'onReady' : function() {
 
 
 
316
  loaded_videos++;
317
  if(loaded_videos == total_yt_videos) {
318
  def.resolve();
@@ -320,10 +324,6 @@ var crellyslider_vimeo_api_ready = false;
320
  },
321
 
322
  'onStateChange' : function(e) {
323
- if(e.data === YT.PlayerState.ENDED && getItemData(element, 'loop')) {
324
- player.playVideo();
325
- }
326
-
327
  if(can_pause) {
328
  if(e.data === YT.PlayerState.PAUSED) {
329
  youtube_videos[element.attr('id')].manually_paused = true;
@@ -332,6 +332,19 @@ var crellyslider_vimeo_api_ready = false;
332
  youtube_videos[element.attr('id')].manually_paused = false;
333
  }
334
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  },
336
  },
337
  });
@@ -375,23 +388,45 @@ var crellyslider_vimeo_api_ready = false;
375
  var player = $f(element[0]);
376
 
377
  player.addEvent('ready', function() {
 
 
 
 
378
  player.addEvent('finish', function() {
379
  vimeo_videos[element.attr('id')].ended = true;
 
 
 
 
 
 
380
  });
381
 
382
  player.addEvent('play', function() {
383
  vimeo_videos[element.attr('id')].played_once = true;
384
  vimeo_videos[element.attr('id')].ended = false;
 
385
 
386
  if(can_pause) {
387
  vimeo_videos[element.attr('id')].manually_paused = false;
388
  }
 
 
 
 
 
389
  });
390
 
391
  player.addEvent('pause', function() {
392
  if(can_pause) {
393
  vimeo_videos[element.attr('id')].manually_paused = true;
394
  }
 
 
 
 
 
 
395
  });
396
 
397
  if(getItemData(element, 'loop')) {
@@ -409,6 +444,7 @@ var crellyslider_vimeo_api_ready = false;
409
  played_once : false,
410
  ended : false,
411
  manually_paused : false,
 
412
  };
413
 
414
  vimeo_videos[element.attr('id')] = temp;
@@ -543,11 +579,15 @@ var crellyslider_vimeo_api_ready = false;
543
  // Pause on hover
544
  if(settings.pauseOnHover) {
545
  SLIDER.find(CRELLY).find(SLIDES).hover(function() {
546
- pause();
 
 
547
  });
548
 
549
  SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
550
- resume();
 
 
551
  });
552
  }
553
  }
@@ -990,6 +1030,26 @@ var crellyslider_vimeo_api_ready = false;
990
  return settings.videoLoop;
991
  break;
992
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
  case 'top' :
994
  case 'left' :
995
  case 'width' :
@@ -1451,6 +1511,49 @@ var crellyslider_vimeo_api_ready = false;
1451
  getVimeoPlayer(element).api('pause');
1452
  }
1453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1454
  /****************/
1455
  /** ANIMATIONS **/
1456
  /****************/
@@ -2144,6 +2247,8 @@ var crellyslider_vimeo_api_ready = false;
2144
 
2145
  videoAutoplay : false,
2146
  videoLoop : false,
 
 
2147
 
2148
  beforeStart : function() {},
2149
  beforeSetResponsive : function() {},
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.6
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
67
 
68
  var paused = false;
69
  var can_pause = false; // Also used as "can change slide"
70
+ var prevent_hover_interactions = 0; // Allow the user to trigger an action on mouse over. This is used to prevent the slider from resuming while watching a video
71
  var executed_slide = false; // Will be true as soon as the current slide is executed
72
  var first_play = true;
73
 
314
  var player = new YT.Player(element.attr('id'), {
315
  events: {
316
  'onReady' : function() {
317
+ if(getItemData(element, 'start-mute')) {
318
+ player.mute();
319
+ }
320
  loaded_videos++;
321
  if(loaded_videos == total_yt_videos) {
322
  def.resolve();
324
  },
325
 
326
  'onStateChange' : function(e) {
 
 
 
 
327
  if(can_pause) {
328
  if(e.data === YT.PlayerState.PAUSED) {
329
  youtube_videos[element.attr('id')].manually_paused = true;
332
  youtube_videos[element.attr('id')].manually_paused = false;
333
  }
334
  }
335
+
336
+ if(e.data === YT.PlayerState.PLAYING) {
337
+ if(getItemData(element, 'pause-while-watching')) {
338
+ prevent_hover_interactions = true;
339
+ pause();
340
+ }
341
+ }
342
+ else if(e.data === YT.PlayerState.PAUSED || e.data === YT.PlayerState.ENDED) {
343
+ if(!watchingAndWait()) {
344
+ prevent_hover_interactions = false;
345
+ resume();
346
+ }
347
+ }
348
  },
349
  },
350
  });
388
  var player = $f(element[0]);
389
 
390
  player.addEvent('ready', function() {
391
+ if(getItemData(element, 'start-mute')) {
392
+ player.api('setVolume', 0);
393
+ }
394
+
395
  player.addEvent('finish', function() {
396
  vimeo_videos[element.attr('id')].ended = true;
397
+ vimeo_videos[element.attr('id')].playing = false;
398
+
399
+ if(!watchingAndWait()) {
400
+ prevent_hover_interactions = false;
401
+ resume();
402
+ }
403
  });
404
 
405
  player.addEvent('play', function() {
406
  vimeo_videos[element.attr('id')].played_once = true;
407
  vimeo_videos[element.attr('id')].ended = false;
408
+ vimeo_videos[element.attr('id')].playing = true;
409
 
410
  if(can_pause) {
411
  vimeo_videos[element.attr('id')].manually_paused = false;
412
  }
413
+
414
+ if(getItemData(element, 'pause-while-watching')) {
415
+ prevent_hover_interactions = true;
416
+ pause();
417
+ }
418
  });
419
 
420
  player.addEvent('pause', function() {
421
  if(can_pause) {
422
  vimeo_videos[element.attr('id')].manually_paused = true;
423
  }
424
+ vimeo_videos[element.attr('id')].playing = false;
425
+
426
+ if(!watchingAndWait()) {
427
+ prevent_hover_interactions = false;
428
+ resume();
429
+ }
430
  });
431
 
432
  if(getItemData(element, 'loop')) {
444
  played_once : false,
445
  ended : false,
446
  manually_paused : false,
447
+ playing : false,
448
  };
449
 
450
  vimeo_videos[element.attr('id')] = temp;
579
  // Pause on hover
580
  if(settings.pauseOnHover) {
581
  SLIDER.find(CRELLY).find(SLIDES).hover(function() {
582
+ if(prevent_hover_interactions == 0) {
583
+ pause();
584
+ }
585
  });
586
 
587
  SLIDER.find(CRELLY).find(SLIDES).mouseleave(function() {
588
+ if(prevent_hover_interactions == 0) {
589
+ resume();
590
+ }
591
  });
592
  }
593
  }
1030
  return settings.videoLoop;
1031
  break;
1032
 
1033
+ case 'start-mute' :
1034
+ if(parseInt(item.data(data)) == 1) {
1035
+ return true;
1036
+ }
1037
+ else if(parseInt(item.data(data)) == 0) {
1038
+ return false;
1039
+ }
1040
+ return settings.videoStartMute;
1041
+ break;
1042
+
1043
+ case 'pause-while-watching' :
1044
+ if(parseInt(item.data(data)) == 1) {
1045
+ return true;
1046
+ }
1047
+ else if(parseInt(item.data(data)) == 0) {
1048
+ return false;
1049
+ }
1050
+ return settings.videoPauseWhileWatching;
1051
+ break;
1052
+
1053
  case 'top' :
1054
  case 'left' :
1055
  case 'width' :
1511
  getVimeoPlayer(element).api('pause');
1512
  }
1513
 
1514
+ // Returns true if there is at least one video playing with "pauseWhileWatching" enabled
1515
+ function watchingAndWait() {
1516
+ var ret = false;
1517
+
1518
+ getSlide(current_slide).find(ELEMENTS + '.cs-yt-iframe').each(function() {
1519
+ if(ret) {
1520
+ return;
1521
+ }
1522
+
1523
+ var element = $(this);
1524
+
1525
+ if(!getItemData(element, 'pause-while-watching')) {
1526
+ return;
1527
+ }
1528
+
1529
+ if(getYoutubePlayerState(element) == 1) {
1530
+ ret = true;
1531
+ }
1532
+ });
1533
+
1534
+ if(ret) {
1535
+ return true;
1536
+ }
1537
+
1538
+ getSlide(current_slide).find(ELEMENTS + '.cs-vimeo-iframe').each(function() {
1539
+ if(ret) {
1540
+ return;
1541
+ }
1542
+
1543
+ var element = $(this);
1544
+
1545
+ if(!getItemData(element, 'pause-while-watching')) {
1546
+ return;
1547
+ }
1548
+
1549
+ if(vimeo_videos[element.attr('id')].playing) {
1550
+ ret = true;
1551
+ }
1552
+ });
1553
+
1554
+ return ret;
1555
+ }
1556
+
1557
  /****************/
1558
  /** ANIMATIONS **/
1559
  /****************/
2247
 
2248
  videoAutoplay : false,
2249
  videoLoop : false,
2250
+ videoStartMute : false,
2251
+ videoPauseWhileWatching : true,
2252
 
2253
  beforeStart : function() {},
2254
  beforeSetResponsive : function() {},
js/jquery.crellyslider.min.js CHANGED
@@ -2,10 +2,10 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
- * Version: 1.3.5
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(se){var e,t,i;e=this,t=document,i=function(e,t,i,n){function l(e,t,i,n){var a=i.type;i.type=t,n?d.event.trigger(i,s,e):d.event.dispatch.call(e,i),i.type=a}var d,o,s,p,a,r,c,f,u,h,v;(function(f,e,t,u){function h(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(e){for(var t,i,n={};e;){for(i in t=f.data(e,k))t[i]&&(n[i]=n.hasVirtualBinding=!0);e=e.parentNode}return n}function a(){M=!0}function s(){M=!1}function r(){c(),P=setTimeout(function(){C=P=0,Y.length=0,O=!1,a()},f.vmouse.resetTimerDuration)}function c(){P&&(clearTimeout(P),P=0)}function l(e,t,i){var n;return(i&&i[e]||!i&&function(e,t){for(var i;e;){if((i=f.data(e,k))&&(!t||i[t]))return e;e=e.parentNode}return null}(t.target,e))&&(n=function(e,t){var i,n,a,o,s,r,c,l,d,p=e.type;if((e=f.Event(e)).type=t,i=e.originalEvent,n=f.event.props,-1<p.search(/^(mouse|click)/)&&(n=E),i)for(c=n.length;c;)e[o=n[--c]]=i[o];if(-1<p.search(/mouse(down|up)|click/)&&!e.which&&(e.which=1),-1!==p.search(/^touch/)&&(p=(a=h(i)).touches,s=a.changedTouches,r=p&&p.length?p[0]:s&&s.length?s[0]:u))for(l=0,d=D.length;l<d;l++)e[o=D[l]]=r[o];return e}(t,e),f(t.target).trigger(n)),n}function d(e){var t,i=f.data(e.target,S);O||C&&C===i||(t=l("v"+e.type,e))&&(t.isDefaultPrevented()&&e.preventDefault(),t.isPropagationStopped()&&e.stopPropagation(),t.isImmediatePropagationStopped()&&e.stopImmediatePropagation())}function p(e){var t,i,n,a=h(e).touches;!a||1!==a.length||(i=o(t=e.target)).hasVirtualBinding&&(C=z++,f.data(t,S,C),c(),s(),F=!1,n=h(e).touches[0],N=n.pageX,L=n.pageY,l("vmouseover",e,i),l("vmousedown",e,i))}function v(e){M||(F||l("vmousecancel",e,o(e.target)),F=!0,r())}function y(e){if(!M){var t=h(e).touches[0],i=F,n=f.vmouse.moveDistanceThreshold,a=o(e.target);(F=F||Math.abs(t.pageX-N)>n||Math.abs(t.pageY-L)>n)&&!i&&l("vmousecancel",e,a),l("vmousemove",e,a),r()}}function m(e){if(!M){a();var t,i,n=o(e.target);l("vmouseup",e,n),F||(t=l("vclick",e,n))&&t.isDefaultPrevented()&&(i=h(e).changedTouches[0],Y.push({touchID:C,x:i.clientX,y:i.clientY}),O=!0),l("vmouseout",e,n),F=!1,r()}}function g(e){var t,i=f.data(e,k);if(i)for(t in i)if(i[t])return!0;return!1}function b(){}function i(i){var n=i.substr(1);return{setup:function(){g(this)||f.data(this,k,{}),f.data(this,k)[i]=!0,_[i]=(_[i]||0)+1,1===_[i]&&R.bind(n,d),f(this).bind(n,b),x&&(_.touchstart=(_.touchstart||0)+1,1===_.touchstart&&R.bind("touchstart",p).bind("touchend",m).bind("touchmove",y).bind("scroll",v))},teardown:function(){--_[i],_[i]||R.unbind(n,d),x&&(--_.touchstart,_.touchstart||R.unbind("touchstart",p).unbind("touchmove",y).unbind("touchend",m).unbind("scroll",v));var e=f(this),t=f.data(this,k);t&&(t[i]=!1),e.unbind(n,b),g(this)||e.removeData(k)}}}var w,n,k="virtualMouseBindings",S="virtualTouchID",T="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),D="clientX clientY pageX pageY screenX screenY".split(" "),I=f.event.mouseHooks?f.event.mouseHooks.props:[],E=f.event.props.concat(I),_={},P=0,N=0,L=0,F=!1,Y=[],O=!1,M=!1,x="addEventListener"in t,R=f(t),z=1,C=0;for(f.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},n=0;n<T.length;n++)f.event.special[T[n]]=i(T[n]);x&&t.addEventListener("click",function(e){var t,i,n,a,o,s=Y.length,r=e.target;if(s)for(t=e.clientX,i=e.clientY,w=f.vmouse.clickDistanceThreshold,n=r;n;){for(a=0;a<s;a++)if(o=Y[a],0,n===r&&Math.abs(o.x-t)<w&&Math.abs(o.y-i)<w||f.data(n,S)===o.touchID)return e.preventDefault(),void e.stopPropagation();n=n.parentNode}},!0)})(e,0,i),e.mobile={},v={touch:"ontouchend"in i},(h=e).mobile.support=h.mobile.support||{},h.extend(h.support,v),h.extend(h.mobile.support,v),o=this,p=(d=e)(i),a=d.mobile.support.touch,r="touchmove scroll",c=a?"touchstart":"mousedown",f=a?"touchend":"mouseup",u=a?"touchmove":"mousemove",d.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(e,t){d.fn[t]=function(e){return e?this.bind(t,e):this.trigger(t)},d.attrFn&&(d.attrFn[t]=!0)}),d.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){l(a,(i=t)?"scrollstart":"scrollstop",e)}var i,n,a=this;d(a).bind(r,function(e){d.event.special.scrollstart.enabled&&(i||t(e,!0),clearTimeout(n),n=setTimeout(function(){t(e,!1)},50))})},teardown:function(){d(this).unbind(r)}},d.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var s=this,r=d(s),c=!1;r.bind("vmousedown",function(e){function t(){clearTimeout(a)}function i(){t(),r.unbind("vclick",n).unbind("vmouseup",t),p.unbind("vmousecancel",i)}function n(e){i(),c||o!==e.target?c&&e.preventDefault():l(s,"tap",e)}if(c=!1,e.which&&1!==e.which)return!1;var a,o=e.target;r.bind("vmouseup",t).bind("vclick",n),p.bind("vmousecancel",i),a=setTimeout(function(){d.event.special.tap.emitTapOnTaphold||(c=!0),l(s,"taphold",d.Event("taphold",{target:o}))},d.event.special.tap.tapholdThreshold)})},teardown:function(){d(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),p.unbind("vmousecancel")}},d.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var t=o.pageXOffset,i=o.pageYOffset,n=e.clientX,a=e.clientY;return 0===e.pageY&&Math.floor(a)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(n)>Math.floor(e.pageX)?(n-=t,a-=i):(a<e.pageY-i||n<e.pageX-t)&&(n=e.pageX-t,a=e.pageY-i),{x:n,y:a}},start:function(e){var t=e.originalEvent.touches?e.originalEvent.touches[0]:e,i=d.event.special.swipe.getLocation(t);return{time:(new Date).getTime(),coords:[i.x,i.y],origin:d(e.target)}},stop:function(e){var t=e.originalEvent.touches?e.originalEvent.touches[0]:e,i=d.event.special.swipe.getLocation(t);return{time:(new Date).getTime(),coords:[i.x,i.y]}},handleSwipe:function(e,t,i,n){if(t.time-e.time<d.event.special.swipe.durationThreshold&&Math.abs(e.coords[0]-t.coords[0])>d.event.special.swipe.horizontalDistanceThreshold&&Math.abs(e.coords[1]-t.coords[1])<d.event.special.swipe.verticalDistanceThreshold){var a=e.coords[0]>t.coords[0]?"swipeleft":"swiperight";return l(i,"swipe",d.Event("swipe",{target:n,swipestart:e,swipestop:t}),!0),l(i,a,d.Event(a,{target:n,swipestart:e,swipestop:t}),!0),!0}return!1},eventInProgress:!1,setup:function(){var e,o=this,t=d(o),s={};(e=d.data(this,"mobile-events"))||(e={length:0},d.data(this,"mobile-events",e)),e.length++,(e.swipe=s).start=function(e){if(!d.event.special.swipe.eventInProgress){d.event.special.swipe.eventInProgress=!0;var t,i=d.event.special.swipe.start(e),n=e.target,a=!1;s.move=function(e){i&&!e.isDefaultPrevented()&&(t=d.event.special.swipe.stop(e),a||(a=d.event.special.swipe.handleSwipe(i,t,o,n))&&(d.event.special.swipe.eventInProgress=!1),Math.abs(i.coords[0]-t.coords[0])>d.event.special.swipe.scrollSupressionThreshold&&e.preventDefault())},s.stop=function(){a=!0,d.event.special.swipe.eventInProgress=!1,p.off(u,s.move),s.move=null},p.on(u,s.move).one(f,s.stop)}},t.on(c,s.start)},teardown:function(){var e,t;(e=d.data(this,"mobile-events"))&&(t=e.swipe,delete e.swipe,e.length--,0===e.length&&d.removeData(this,"mobile-events")),t&&(t.start&&d(this).off(c,t.start),t.move&&p.off(u,t.move),t.stop&&p.off(f,t.stop))}},d.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(e,t){d.event.special[e]={setup:function(){d(this).bind(t,d.noop)},teardown:function(){d(this).unbind(t)}}})},"function"==typeof define&&define.amd?define(["jquery"],function(e){return i(e,0,t),e.mobile}):i(e.jQuery,0,t),se.CrellySlider=function(e,a){var o,s=se(e),r="div.crellyslider",c="ul.cs-slides",t="li.cs-slide",d="> *",l=0,i=!1,p=!1,n=!1,f=!0,u=new B(function(){},0),h=new Array,v=new Array,y={},m={},g=1,b=0;if(!crellyslider_youtube_api_ready&&k("youtube")&&function(){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),crellyslider_youtube_api_ready=!0}(),!crellyslider_vimeo_api_ready&&k("vimeo")&&function(){var o,s,r;function t(e){return new t.fn.init(e)}function c(e,t,i){if(!i.contentWindow.postMessage)return!1;e=JSON.stringify({method:e,value:t}),i.contentWindow.postMessage(e,r)}function e(e){var t,i;try{i=(t=JSON.parse(e.data)).event||t.method}catch(e){}if("ready"!=i||s||(s=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===r&&(r=e.origin),e=t.value;var n=t.data,a=""===a?null:t.player_id;return t=a?o[a][i]:o[i],i=[],!!t&&(void 0!==e&&i.push(e),n&&i.push(n),a&&i.push(a),0<i.length?t.apply(null,i):t.call())}function l(e,t,i){i?(o[i]||(o[i]={}),o[i][e]=t):o[e]=t}s=!(o={}),r="*",(t.fn=t.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,t){if(!this.element||!e)return!1;var i=this.element,n=""!==i.id?i.id:null,a=t&&t.constructor&&t.call&&t.apply?null:t,o=t&&t.constructor&&t.call&&t.apply?t:null;return o&&l(e,o,n),c(e,a,i),this},addEvent:function(e,t){if(!this.element)return!1;var i=this.element,n=""!==i.id?i.id:null;return l(e,t,n),"ready"!=e?c("addEventListener",e,i):"ready"==e&&s&&t.call(null,n),this},removeEvent:function(e){if(!this.element)return!1;var t=this.element,i=""!==t.id?t.id:null;e:{if(i&&o[i]){if(!o[i][e]){i=!1;break e}o[i][e]=null}else{if(!o[e]){i=!1;break e}o[e]=null}i=!0}"ready"!=e&&i&&c("removeEventListener",e,t)}}).init.prototype=t.fn,window.addEventListener?window.addEventListener("message",e,!1):window.attachEvent("onmessage",e),window.Froogaloop=window.$f=t,crellyslider_vimeo_api_ready=!0}(),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&void 0!==YT.Player)S();else var w=setInterval(function(){"undefined"!=typeof YT&&void 0!==YT.Player&&(clearInterval(w),S())},100);function k(e){return"youtube"==e?0<s.find(".cs-yt-iframe").length:"vimeo"==e?0<s.find(".cs-vimeo-iframe").length:-1}function S(){if(s.wrapInner('<div class="crellyslider" />'),s.find(r+" > ul").addClass("cs-slides"),s.find(r+" "+c+" > li").addClass("cs-slide"),0==(o=X().length))return!1;if(1==o){var e=A(0),t=s.find(r).find(c);e.clone().prependTo(t),o++}if(function(){if(!a.randomOrder&&0==a.startFromSlide)return;var e=new Array,t=new Array;if(-1==a.startFromSlide){var i=Math.floor(Math.random()*o);e[0]=i,t[0]=A(i)}else e[0]=a.startFromSlide,t[0]=A(a.startFromSlide);for(var n=1;n<o;n++){if(a.randomOrder)for(;i=Math.floor(Math.random()*o),-1!=e.indexOf(i););else i=n+e[0]<o?n+e[0]:n+e[0]-o;e[n]=i,t[n]=A(i)}s.find(r).find(c).empty();for(n=0;n<o;n++)s.find(r).find(c).append(t[n])}(),a.showControls&&s.find(r).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),a.showNavigation){for(var i='<div class="cs-navigation">',n=0;n<o;n++)i+='<span class="cs-slide-link"></span>';i+="</div>",s.find(r).append(i)}a.showProgressBar?s.find(r).append('<div class="cs-progress-bar"></div>'):s.find(r).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),s.css("display","block"),a.responsive&&P(),D(),X().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),function(){s.find(r).find(c).css("visibility","hidden"),s.find(r).find(".cs-progress-bar").css("display","none"),s.find(r).find(".cs-navigation").css("display","none"),s.find(r).find(".cs-controls").css("display","none");var e=A(0).css("background-image");(e=e.replace(/^url\(["']?/,"").replace(/["']?\)$/,"")).match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?se("<img>").load(function(){t()}).attr("src",e).each(function(){this.complete&&se(this).load()}):t();function t(){s.find(r).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),s.find(r).find(".cs-preloader").css({"background-color":A(l).css("background-color"),"background-image":A(l).css("background-image"),"background-position":A(l).css("background-position"),"background-repeat":A(l).css("background-repeat"),"background-size":A(l).css("background-size")}),s.find(r).find(".cs-preloader > .cs-bg").css({"background-color":A(l).css("background-color"),"background-image":A(l).css("background-image"),"background-position":A(l).css("background-position"),"background-repeat":A(l).css("background-repeat"),"background-size":A(l).css("background-size")})}}(),function(){var e=new se.Deferred,t=X().find(".cs-yt-iframe, .cs-vimeo-iframe").length,i=0;return 0!=t?(X().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){se(this).one("load",function(){++i==t&&function(){var e,n=new se.Deferred,t=X(),a=t.find(d+".cs-yt-iframe").length,o=0;return 0!=a?(t.each(function(){se(this).find(d+".cs-yt-iframe").each(function(){var t=se(this);t.uniqueId(),t.attr("id","cs-yt-iframe-"+t.attr("id"));var i=new YT.Player(t.attr("id"),{events:{onReady:function(){++o==a&&n.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&C(t,"loop")&&i.playVideo(),p&&(e.data===YT.PlayerState.PAUSED&&(y[t.attr("id")].manually_paused=!0),e.data===YT.PlayerState.PLAYING&&(y[t.attr("id")].manually_paused=!1))}}});e={player:i,played_once:!1,manually_paused:!1},y[t.attr("id")]=e})}),n.promise()):n.resolve().promise()}().done(function(){(function(){var i,n=new se.Deferred,e=X(),a=e.find(d+".cs-vimeo-iframe").length,o=0;return 0!=a?(e.each(function(){se(this).find(d+".cs-vimeo-iframe").each(function(){var e=se(this);e.uniqueId(),e.attr("id","cs-vimeo-iframe-"+e.attr("id")),e.attr("src",e.attr("src")+"&player_id="+e.attr("id"));var t=$f(e[0]);t.addEvent("ready",function(){t.addEvent("finish",function(){m[e.attr("id")].ended=!0}),t.addEvent("play",function(){m[e.attr("id")].played_once=!0,m[e.attr("id")].ended=!1,p&&(m[e.attr("id")].manually_paused=!1)}),t.addEvent("pause",function(){p&&(m[e.attr("id")].manually_paused=!0)}),C(e,"loop")&&t.api("setLoop",!0),++o==a&&n.resolve()}),i={player:t,played_once:!1,ended:!1,manually_paused:!1},m[e.attr("id")]=i})}),n.promise()):n.resolve().promise()})().done(function(){e.resolve()})})})}),e.promise()):e.resolve().promise()}().done(function(){var e=setInterval(function(){"complete"==document.readyState&&0<s.find(r).find(".cs-preloader").length&&(clearInterval(e),function(){a.responsive&&P();D(),b=se(window).width(),void X().each(function(){var e=se(this);e.find(d).each(function(){var e=se(this);e.find("*").each(function(){T(se(this))}),T(e)}),e.css("display","none"),e.data("opacity",parseFloat(e.css("opacity")))}),function(){a.responsive&&se(window).resize(function(){b!=se(window).width()&&("full-width"==a.layout&&M()!=se(s).width()||se(s).width()<M()||se(s).width()>M()&&M()<a.startWidth)&&E()});s.find(r).find(".cs-controls > .cs-previous").click(function(){W(z())}),s.find(r).find(".cs-controls > .cs-next").click(function(){W(R())}),a.enableSwipe&&(s.find(r).on("swipeleft",function(){O(),W(R())}),s.find(r).on("swiperight",function(){O(),W(z())}));s.find(r).find(".cs-navigation > .cs-slide-link").click(function(){W(se(this).index())}),a.pauseOnHover&&(s.find(r).find(c).hover(function(){Y()}),s.find(r).find(c).mouseleave(function(){O()}))}(),s.find(r).find(c).css("visibility","visible"),s.find(r).find(".cs-progress-bar").css("display","block"),s.find(r).find(".cs-navigation").css("display","block"),s.find(r).find(".cs-controls").css("display","block"),ie(A(0)),A(0).finish(),void s.find(r).find(".cs-preloader").animate({opacity:0},300,function(){s.find(r).find(".cs-preloader").remove()}),a.beforeStart(),a.responsive?E():L()}())},100)})}function T(e){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):"normal"==e.css("line-height")?e.data("line-height",1.15*C(e,"font-size")):e.data("line-height",parseFloat(e.css("line-height"))*C(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity")))}function D(){var e,t;switch(a.layout){case"fixed":e=a.startWidth,t=a.startHeight,s.find(r).css({width:N(e),height:N(t)}),X().css({width:N(e),height:N(t)});break;case"full-width":e=s.width(),t=a.startHeight,s.find(r).css({width:e,height:N(t)}),X().css({width:e,height:N(t)});break;default:return!1}}function I(){var e=(x()-a.startHeight)/2,t=(M()-a.startWidth)/2,i=0,n=0;return 0<e&&(i=e),0<t&&(n=t),{top:i,left:n}}function E(){a.beforeSetResponsive();var e=X();F(!0),e.each(function(){var e=se(this),t=e.find(d);e.finish(),ie(e),e.finish(),t.each(function(){var e=se(this);e.finish(),ae(e),e.finish(),q(e)&&J(e)})}),P(),D(),e.each(function(){var e=se(this);e.find(d).each(function(){var e=se(this);e.find("*").each(function(){_(se(this))}),_(e),e.finish(),oe(e),e.finish(),q(e)&&J(e)}),e.finish(),ne(e),e.finish()}),b=se(window).width(),L()}function _(e){e.css({top:N(C(e,"top")+I().top),left:N(C(e,"left")+I().left),"padding-top":N(C(e,"padding-top")),"padding-right":N(C(e,"padding-right")),"padding-bottom":N(C(e,"padding-bottom")),"padding-left":N(C(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":N(C(e,"line-height"))+"px","letter-spacing":N(C(e,"letter-spacing")),"font-size":N(C(e,"font-size"))}):e.css({width:N(C(e,"width")),height:N(C(e,"height"))})}function P(){var e=s.width(),t=a.startWidth;g=t<=e||!a.responsive?1:e/t}function N(e){return e*g}function L(){a.automaticSlide?function e(){V(l).done(function(){i||(l=R(),e())})}():V(l),f=!1}function F(t){for(var e=0;e<h.length;e++)h[e].clear();for(e=0;e<v.length;e++)v[e].clear();u.clear(),X().each(function(){var e=se(this);t?e.finish():e.stop(!0,!0),e.find(d).each(function(){var e=se(this);t?e.finish():e.stop(!0,!0)})}),U()}function Y(){!i&&p&&(a.beforePause(),s.find(r).find(".cs-progress-bar").stop(!0),u.pause(),i=!0)}function O(){if(i&&p){a.beforeResume();var e=s.find(r).find(".cs-progress-bar"),t=(C(A(l),"time"),u.getRemaining());e.animate({width:"100%"},t),u.resume(),i=!1}}function M(){return s.find(r).width()}function x(){return s.find(r).height()}function R(){return l+1==o?0:l+1}function z(){return l-1<0?o-1:l-1}function C(e,t){var i;switch(i=!!e.parent("ul").hasClass("cs-slides"),t){case"ease-in":return i?isNaN(parseInt(e.data(t)))?a.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?a.elementsEaseIn:parseInt(e.data(t));case"ease-out":return i?isNaN(parseInt(e.data(t)))?a.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?a.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?a.elementsDelay:parseInt(e.data(t));case"time":return i?isNaN(parseInt(e.data(t)))?a.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?a.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&a.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&a.videoAutoplay;case"loop":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&a.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 X(){return s.find(r).find(c).find(t)}function A(e){return X().eq(e)}function B(e,t){var i,n,a=t;this.pause=function(){clearTimeout(i),a-=new Date-n},this.resume=function(){n=new Date,clearTimeout(i),i=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(i)},this.getRemaining=function(){return a},this.resume()}function H(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function U(){var e=s.find(r).find(".cs-progress-bar");e.stop(),e.css("width",0)}function W(e){e!=l&&(p||n)&&(F(!1),j(l,!1,!0).done(function(){l=e,L()}))}function V(e){a.beforeSlideStart();var t=new se.Deferred;n=!1;for(var i=0;i<h.length;i++)h[i].clear();for(i=0;i<v.length;i++)v[i].clear();return u.clear(),A(e).finish(),ne(e),A(e).finish(),A(e).find(d).each(function(){var e=se(this);e.finish(),oe(e),e.finish()}),s.find(r).find(".cs-navigation").find("> .cs-slide-link").each(function(){var e=se(this);e.index()==l?e.addClass("cs-active"):e.removeClass("cs-active")}),function(e){var i=A(e).find(d),n=0,a=!1,o=new se.Deferred;p=!1,ie(e).done(function(){!function(){var e=s.find(r).find(".cs-progress-bar");U(),e.animate({width:"100%"},C(A(l),"time"))}(),(a=p=!0)&&n==i.length&&o.resolve()}),i.each(function(){var e=se(this),t=C(e,"delay");v.push(new B(function(){ae(e).done(function(){q(e)&&function(e){Q(e)?function(e){!C(e,"autoplay")||y[e.attr("id")].played_once||H()||G(e).playVideo();2!=K(e)||y[e.attr("id")].manually_paused||G(e).playVideo();y[e.attr("id")].played_once=!0}(e):function(e){!C(e,"autoplay")||m[e.attr("id")].played_once||H()||ee(e).api("play");ee(e).api("paused")&&!m[e.attr("id")].ended&&m[e.attr("id")].played_once&&!m[e.attr("id")].manually_paused&&ee(e).api("play")}(e)}(e),n++,a&&n==i.length&&o.resolve()})},t))}),o.promise()}(e),a.automaticSlide?j(e,!0,!0).done(function(){n=!0,t.resolve()}):j(e,!0,!1).done(function(){n=!0,t.resolve()}),t.promise()}function j(n,a,o){var e=A(n),s=e.find(d),t=a?C(e,"time")+C(e,"ease-in"):0,r=0,c=!1,l=new se.Deferred;return s.each(function(){var e=se(this),t=C(e,"time");if("all"!=t){var i=a?t:0;C(e,"ignore-ease-out")&&(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve())),h.push(new B(function(){oe(e).done(function(){C(e,"ignore-ease-out")||(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve()))})},i))}}),u=new B(function(){p=!1,U(),c=!0,s.length==r&&c&&o&&($(n),ne(n),l.resolve()),o?s.each(function(){var e=se(this);"all"==C(e,"time")&&(C(e,"ignore-ease-out")&&(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve())),oe(e).done(function(){C(e,"ignore-ease-out")||(r++,s.length==r&&c&&o&&($(n),ne(n),l.resolve()))}))}):l.resolve()},t),l.promise()}function q(e){return Q(e)||function(e){return e.hasClass("cs-vimeo-iframe")}(e)}function $(e){!function(e){A(e).each(function(){se(this).find(d+".cs-yt-iframe").each(function(){Z(se(this))})})}(e),function(e){A(e).each(function(){se(this).find(d+".cs-vimeo-iframe").each(function(){te(se(this))})})}(e)}function J(e){Q(e)?Z(e):te(e)}function Q(e){return e.hasClass("cs-yt-iframe")}function G(e){return y[e.attr("id")].player}function K(e){return G(e).getPlayerState()}function Z(e){1==K(e)&&G(e).pauseVideo()}function ee(e){return m[e.attr("id")].player}function te(e){ee(e).api("pause")}function ie(e){var t=A(e),i=C(t,"in"),n=C(t,"ease-in"),a=new se.Deferred;if("block"==t.css("display"))return a.resolve().promise();if(f)return t.css({display:"block",top:0,left:0,opacity:C(t,"opacity")}),a.resolve().promise();switch(i){case"fade":t.css({display:"block",top:0,left:0,opacity:0}),t.animate({opacity:C(t,"opacity")},n,function(){a.resolve()});break;case"fadeLeft":t.css({display:"block",top:0,left:M(),opacity:0}),t.animate({opacity:C(t,"opacity"),left:0},n,function(){a.resolve()});break;case"fadeRight":t.css({display:"block",top:0,left:-M(),opacity:0}),t.animate({opacity:C(t,"opacity"),left:0},n,function(){a.resolve()});break;case"slideLeft":t.css({display:"block",top:0,left:M(),opacity:C(t,"opacity")}),t.animate({left:0},n,function(){a.resolve()});break;case"slideRight":t.css({display:"block",top:0,left:-M(),opacity:C(t,"opacity")}),t.animate({left:0},n,function(){a.resolve()});break;case"slideUp":t.css({display:"block",top:x(),left:0,opacity:C(t,"opacity")}),t.animate({top:0},n,function(){a.resolve()});break;case"slideDown":t.css({display:"block",top:-x(),left:0,opacity:C(t,"opacity")}),t.animate({top:0},n,function(){a.resolve()});break;default:t.css({display:"block",top:0,left:0,opacity:C(t,"opacity")}),a.resolve()}return a.promise()}function ne(e){var t=A(e),i=C(t,"out"),n=C(t,"ease-out"),a=new se.Deferred;if("none"==t.css("display"))return a.resolve().promise();switch(i){case"fade":t.animate({opacity:0},n,function(){t.css({display:"none",opacity:C(t,"opacity")}),a.resolve()});break;case"fadeLeft":t.animate({opacity:0,left:-M()},n,function(){t.css({display:"none",opacity:C(t,"opacity"),left:0}),a.resolve()});break;case"fadeRight":t.animate({opacity:0,left:M()},n,function(){t.css({display:"none",opacity:C(t,"opacity"),left:0}),a.resolve()});break;case"slideLeft":t.animate({left:-M()},n,function(){t.css({display:"none",left:0}),a.resolve()});break;case"slideRight":t.animate({left:M()},n,function(){t.css({display:"none",left:0}),a.resolve()});break;case"slideUp":t.animate({top:-x()},n,function(){t.css({display:"none",top:0}),a.resolve()});break;case"slideDown":t.animate({top:x()},n,function(){t.css({display:"none",top:0}),a.resolve()});break;default:t.css({display:"none"}),a.resolve()}return a.promise()}function ae(e){var t=e.outerWidth(),i=e.outerHeight(),n=C(e,"in"),a=C(e,"ease-in"),o=C(e,"top"),s=C(e,"left"),r=new se.Deferred;if("block"==e.css("display"))return r.resolve().promise();switch(n){case"slideDown":e.css({display:"block",top:-i,left:N(s+I().left),opacity:C(e,"opacity")}).animate({top:N(o+I().top)},a,function(){r.resolve()});break;case"slideUp":e.css({display:"block",top:x(),left:N(s+I().left),opacity:C(e,"opacity")}).animate({top:N(o+I().top)},a,function(){r.resolve()});break;case"slideLeft":e.css({display:"block",top:N(o+I().top),left:M(),opacity:C(e,"opacity")}).animate({left:N(s+I().left)},a,function(){r.resolve()});break;case"slideRight":e.css({display:"block",top:N(o+I().top),left:-t,opacity:C(e,"opacity")}).animate({left:N(s+I().left)},a,function(){r.resolve()});break;case"fade":e.css({display:"block",top:N(o+I().top),left:N(s+I().left),opacity:0}).animate({opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeDown":e.css({display:"block",top:-i,left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeUp":e.css({display:"block",top:x(),left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeLeft":e.css({display:"block",top:N(o+I().top),left:M(),opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeRight":e.css({display:"block",top:N(o+I().top),left:-t,opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallDown":e.css({display:"block",top:N(o+I().top-30),left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallUp":e.css({display:"block",top:N(o+I().top+30),left:N(s+I().left),opacity:0}).animate({top:N(o+I().top),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallLeft":e.css({display:"block",top:N(o+I().top),left:N(s+I().left+30),opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;case"fadeSmallRight":e.css({display:"block",top:N(o+I().top),left:N(s+I().left-30),opacity:0}).animate({left:N(s+I().left),opacity:C(e,"opacity")},a,function(){r.resolve()});break;default:e.css({display:"block",top:N(o+I().top),left:N(s+I().left),opacity:C(e,"opacity")}),r.resolve()}return r.promise()}function oe(e){var t=e.outerWidth(),i=e.outerHeight(),n=C(e,"out"),a=C(e,"ease-out"),o=new se.Deferred;if("none"==e.css("display"))return o.resolve().promise();switch(n){case"slideDown":e.animate({top:x()},a,function(){e.css({display:"none"}),o.resolve()});break;case"slideUp":e.animate({top:-i},a,function(){e.css({display:"none"}),o.resolve()});break;case"slideLeft":e.animate({left:-t},a,function(){e.css({display:"none"}),o.resolve()});break;case"slideRight":e.animate({left:M()},a,function(){e.css({display:"none"}),o.resolve()});break;case"fade":e.animate({opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeDown":e.animate({top:x(),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeUp":e.animate({top:-i,opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeLeft":e.animate({left:-t,opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeRight":e.animate({left:M(),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallDown":e.animate({top:N(C(e,"top")+I().top+30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallUp":e.animate({top:N(C(e,"top")+I().top-30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallLeft":e.animate({left:N(C(e,"left")+I().left-30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;case"fadeSmallRight":e.animate({left:N(C(e,"left")+I().left+30),opacity:0},a,function(){e.css({display:"none",opacity:C(e,"opacity")}),o.resolve()});break;default:e.css({display:"none"}),o.resolve()}return o.promise()}this.resume=function(){O()},this.pause=function(){Y()},this.nextSlide=function(){W(R())},this.previousSlide=function(){W(z())},this.changeSlide=function(e){W(e)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return o}},se.fn.crellySlider=function(e){var t=se.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(){}},e);return this.each(function(){if(null==se(this).data("crellySlider")){var e=new se.CrellySlider(this,t);se(this).data("crellySlider",e)}})}}(jQuery);
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: https://wordpress.org/plugins/crelly-slider/
4
  * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
5
+ * Version: 1.3.6
6
  * Author: Fabio Rinaldi
7
  * Author URI: https://github.com/fabiorino
8
  * License: MIT
9
  */
10
 
11
+ var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(e){var t,i,n;t=this,i=document,n=function(e,t,i,n){var a,o;(function(e,t,i,n){function a(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(t){for(var i,n,a={};t;){for(n in i=e.data(t,k))i[n]&&(a[n]=a.hasVirtualBinding=!0);t=t.parentNode}return a}function s(){M=!0}function r(){M=!1}function c(){l(),P=setTimeout(function(){P=0,C=0,Y.length=0,O=!1,s()},e.vmouse.resetTimerDuration)}function l(){P&&(clearTimeout(P),P=0)}function d(t,i,o){var s;return(o&&o[t]||!o&&function(t,i){for(var n;t;){if((n=e.data(t,k))&&(!i||n[i]))return t;t=t.parentNode}return null}(i.target,t))&&(s=function(t,i){var o,s,r,c,l,d,p,f,u,h=t.type;if((t=e.Event(t)).type=i,o=t.originalEvent,s=e.event.props,h.search(/^(mouse|click)/)>-1&&(s=E),o)for(p=s.length;p;)t[c=s[--p]]=o[c];if(h.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==h.search(/^touch/)&&(h=(r=a(o)).touches,l=r.changedTouches,d=h&&h.length?h[0]:l&&l.length?l[0]:n))for(f=0,u=D.length;f<u;f++)t[c=D[f]]=d[c];return t}(i,t),e(i.target).trigger(s)),s}function p(t){var i,n=e.data(t.target,S);!O&&(!C||C!==n)&&((i=d("v"+t.type,t))&&(i.isDefaultPrevented()&&t.preventDefault(),i.isPropagationStopped()&&t.stopPropagation(),i.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function f(t){var i,n,s,c=a(t).touches;c&&1===c.length&&((n=o(i=t.target)).hasVirtualBinding&&(C=z++,e.data(i,S,C),l(),r(),F=!1,s=a(t).touches[0],N=s.pageX,L=s.pageY,d("vmouseover",t,n),d("vmousedown",t,n)))}function u(e){M||(F||d("vmousecancel",e,o(e.target)),F=!0,c())}function h(t){if(!M){var i=a(t).touches[0],n=F,s=e.vmouse.moveDistanceThreshold,r=o(t.target);(F=F||Math.abs(i.pageX-N)>s||Math.abs(i.pageY-L)>s)&&!n&&d("vmousecancel",t,r),d("vmousemove",t,r),c()}}function v(e){if(!M){s();var t,i,n=o(e.target);d("vmouseup",e,n),F||(t=d("vclick",e,n))&&t.isDefaultPrevented()&&(i=a(e).changedTouches[0],Y.push({touchID:C,x:i.clientX,y:i.clientY}),O=!0),d("vmouseout",e,n),F=!1,c()}}function y(t){var i,n=e.data(t,k);if(n)for(i in n)if(n[i])return!0;return!1}function m(){}function g(t){var i=t.substr(1);return{setup:function(){y(this)||e.data(this,k,{}),e.data(this,k)[t]=!0,_[t]=(_[t]||0)+1,1===_[t]&&R.bind(i,p),e(this).bind(i,m),x&&(_.touchstart=(_.touchstart||0)+1,1===_.touchstart&&R.bind("touchstart",f).bind("touchend",v).bind("touchmove",h).bind("scroll",u))},teardown:function(){--_[t],_[t]||R.unbind(i,p),x&&(--_.touchstart,_.touchstart||R.unbind("touchstart",f).unbind("touchmove",h).unbind("touchend",v).unbind("scroll",u));var n=e(this),a=e.data(this,k);a&&(a[t]=!1),n.unbind(i,m),y(this)||n.removeData(k)}}}var b,w,k="virtualMouseBindings",S="virtualTouchID",T="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),D="clientX clientY pageX pageY screenX screenY".split(" "),I=e.event.mouseHooks?e.event.mouseHooks.props:[],E=e.event.props.concat(I),_={},P=0,N=0,L=0,F=!1,Y=[],O=!1,M=!1,x="addEventListener"in i,R=e(i),z=1,C=0;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},w=0;w<T.length;w++)e.event.special[T[w]]=g(T[w]);x&&i.addEventListener("click",function(t){var i,n,a,o,s,r=Y.length,c=t.target;if(r)for(i=t.clientX,n=t.clientY,b=e.vmouse.clickDistanceThreshold,a=c;a;){for(o=0;o<r;o++)if(s=Y[o],0,a===c&&Math.abs(s.x-i)<b&&Math.abs(s.y-n)<b||e.data(a,S)===s.touchID)return t.preventDefault(),void t.stopPropagation();a=a.parentNode}},!0)})(e,0,i),e.mobile={},o={touch:"ontouchend"in i},(a=e).mobile.support=a.mobile.support||{},a.extend(a.support,o),a.extend(a.mobile.support,o),function(e,t,n){function a(t,i,a,o){var s=a.type;a.type=i,o?e.event.trigger(a,n,t):e.event.dispatch.call(t,a),a.type=s}var o=e(i),s=e.mobile.support.touch,r="touchmove scroll",c=s?"touchstart":"mousedown",l=s?"touchend":"mouseup",d=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,i){e.fn[i]=function(e){return e?this.bind(i,e):this.trigger(i)},e.attrFn&&(e.attrFn[i]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){a(o,(i=t)?"scrollstart":"scrollstop",e)}var i,n,o=this;e(o).bind(r,function(a){e.event.special.scrollstart.enabled&&(i||t(a,!0),clearTimeout(n),n=setTimeout(function(){t(a,!1)},50))})},teardown:function(){e(this).unbind(r)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,i=e(t),n=!1;i.bind("vmousedown",function(s){function r(){clearTimeout(d)}function c(){r(),i.unbind("vclick",l).unbind("vmouseup",r),o.unbind("vmousecancel",c)}function l(e){c(),n||p!==e.target?n&&e.preventDefault():a(t,"tap",e)}if(n=!1,s.which&&1!==s.which)return!1;var d,p=s.target;i.bind("vmouseup",r).bind("vclick",l),o.bind("vmousecancel",c),d=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(n=!0),a(t,"taphold",e.Event("taphold",{target:p}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),o.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var i=t.pageXOffset,n=t.pageYOffset,a=e.clientX,o=e.clientY;return 0===e.pageY&&Math.floor(o)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(a)>Math.floor(e.pageX)?(a-=i,o-=n):(o<e.pageY-n||a<e.pageX-i)&&(a=e.pageX-i,o=e.pageY-n),{x:a,y:o}},start:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y],origin:e(t.target)}},stop:function(t){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,n=e.event.special.swipe.getLocation(i);return{time:(new Date).getTime(),coords:[n.x,n.y]}},handleSwipe:function(t,i,n,o){if(i.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-i.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-i.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>i.coords[0]?"swipeleft":"swiperight";return a(n,"swipe",e.Event("swipe",{target:o,swipestart:t,swipestop:i}),!0),a(n,s,e.Event(s,{target:o,swipestart:t,swipestop:i}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,i=this,n=e(i),a={};(t=e.data(this,"mobile-events"))||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=a,a.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var n,s=e.event.special.swipe.start(t),r=t.target,c=!1;a.move=function(t){s&&!t.isDefaultPrevented()&&(n=e.event.special.swipe.stop(t),c||(c=e.event.special.swipe.handleSwipe(s,n,i,r))&&(e.event.special.swipe.eventInProgress=!1),Math.abs(s.coords[0]-n.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault())},a.stop=function(){c=!0,e.event.special.swipe.eventInProgress=!1,o.off(d,a.move),a.move=null},o.on(d,a.move).one(l,a.stop)}},n.on(c,a.start)},teardown:function(){var t,i;(t=e.data(this,"mobile-events"))&&(i=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),i&&(i.start&&e(this).off(c,i.start),i.move&&o.off(d,i.move),i.stop&&o.off(l,i.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,i){e.event.special[t]={setup:function(){e(this).bind(i,e.noop)},teardown:function(){e(this).unbind(i)}}})}(e,this)},"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(e,0,i),e.mobile}):n(t.jQuery,0,i),e.CrellySlider=function(t,i){var n,a=e(t),o="div.crellyslider",s="ul.cs-slides",r="li.cs-slide",c="> *",l=0,d=!1,p=!1,f=!1,u=!0,h=new H(function(){},0),v=new Array,y=new Array,m={},g={},b=1,w=0;if(!crellyslider_youtube_api_ready&&S("youtube")&&function(){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),crellyslider_youtube_api_ready=!0}(),!crellyslider_vimeo_api_ready&&S("vimeo")&&(!function(){function e(t){return new e.fn.init(t)}function t(e,t,i){if(!i.contentWindow.postMessage)return!1;e=JSON.stringify({method:e,value:t}),i.contentWindow.postMessage(e,s)}function i(e){var t,i;try{i=(t=JSON.parse(e.data)).event||t.method}catch(e){}if("ready"!=i||o||(o=!0),!/^https?:\/\/player.vimeo.com/.test(e.origin))return!1;"*"===s&&(s=e.origin),e=t.value;var n=t.data,r=""===r?null:t.player_id;return t=r?a[r][i]:a[i],i=[],!!t&&(void 0!==e&&i.push(e),n&&i.push(n),r&&i.push(r),0<i.length?t.apply(null,i):t.call())}function n(e,t,i){i?(a[i]||(a[i]={}),a[i][e]=t):a[e]=t}var a={},o=!1,s="*";e.fn=e.prototype={element:null,init:function(e){return"string"==typeof e&&(e=document.getElementById(e)),this.element=e,this},api:function(e,i){if(!this.element||!e)return!1;var a=this.element,o=""!==a.id?a.id:null,s=i&&i.constructor&&i.call&&i.apply?null:i,r=i&&i.constructor&&i.call&&i.apply?i:null;return r&&n(e,r,o),t(e,s,a),this},addEvent:function(e,i){if(!this.element)return!1;var a=this.element,s=""!==a.id?a.id:null;return n(e,i,s),"ready"!=e?t("addEventListener",e,a):"ready"==e&&o&&i.call(null,s),this},removeEvent:function(e){if(!this.element)return!1;var i=this.element,n=""!==i.id?i.id:null;e:{if(n&&a[n]){if(!a[n][e]){n=!1;break e}a[n][e]=null}else{if(!a[e]){n=!1;break e}a[e]=null}n=!0}"ready"!=e&&n&&t("removeEventListener",e,i)}},e.fn.init.prototype=e.fn,window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent("onmessage",i),window.Froogaloop=window.$f=e}(),crellyslider_vimeo_api_ready=!0),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&void 0!==YT.Player)T();else var k=setInterval(function(){"undefined"!=typeof YT&&void 0!==YT.Player&&(clearInterval(k),T())},100);function S(e){return"youtube"==e?a.find(".cs-yt-iframe").length>0:"vimeo"==e?a.find(".cs-vimeo-iframe").length>0:-1}function T(){if(a.wrapInner('<div class="crellyslider" />'),a.find(o+" > ul").addClass("cs-slides"),a.find(o+" "+s+" > li").addClass("cs-slide"),0==(n=A().length))return!1;if(1==n){var t=B(0),r=a.find(o).find(s);t.clone().prependTo(r),n++}if(function(){if(!i.randomOrder&&0==i.startFromSlide)return;var e=new Array,t=new Array;if(-1==i.startFromSlide){var r=Math.floor(Math.random()*n);e[0]=r,t[0]=B(r)}else e[0]=i.startFromSlide,t[0]=B(i.startFromSlide);for(var c=1;c<n;c++){if(i.randomOrder)do{r=Math.floor(Math.random()*n)}while(-1!=e.indexOf(r));else r=c+e[0]<n?c+e[0]:c+e[0]-n;e[c]=r,t[c]=B(r)}a.find(o).find(s).empty();for(var c=0;c<n;c++)a.find(o).find(s).append(t[c])}(),i.showControls&&a.find(o).append('<div class="cs-controls"><span class="cs-next"></span><span class="cs-previous"></span></div>'),i.showNavigation){for(var d='<div class="cs-navigation">',f=0;f<n;f++)d+='<span class="cs-slide-link"></span>';d+="</div>",a.find(o).append(d)}i.showProgressBar?a.find(o).append('<div class="cs-progress-bar"></div>'):a.find(o).append('<div class="cs-progress-bar cs-progress-bar-hidden"></div>'),a.css("display","block"),i.responsive&&N(),I(),A().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),function(){a.find(o).find(s).css("visibility","hidden"),a.find(o).find(".cs-progress-bar").css("display","none"),a.find(o).find(".cs-navigation").css("display","none"),a.find(o).find(".cs-controls").css("display","none");var t=B(0).css("background-image");(t=t.replace(/^url\(["']?/,"").replace(/["']?\)$/,"")).match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?e("<img>").load(function(){i()}).attr("src",t).each(function(){this.complete&&e(this).load()}):i();function i(){a.find(o).append('<div class="cs-preloader"><div class="cs-bg"></div><div class="cs-loader"><div class="cs-spinner"></div></div></div>'),a.find(o).find(".cs-preloader").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")}),a.find(o).find(".cs-preloader > .cs-bg").css({"background-color":B(l).css("background-color"),"background-image":B(l).css("background-image"),"background-position":B(l).css("background-position"),"background-repeat":B(l).css("background-repeat"),"background-size":B(l).css("background-size")})}}(),function(){var t=new e.Deferred,i=A().find(".cs-yt-iframe, .cs-vimeo-iframe").length,n=0;if(0==i)return t.resolve().promise();return A().find(".cs-yt-iframe, .cs-vimeo-iframe").each(function(){e(this).one("load",function(){var a,o,s,r,l;++n==i&&(o=new e.Deferred,s=A(),r=s.find(c+".cs-yt-iframe").length,l=0,0==r?o.resolve().promise():(s.each(function(){e(this).find(c+".cs-yt-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-yt-iframe-"+t.attr("id"));var i=new YT.Player(t.attr("id"),{events:{onReady:function(){++l==r&&o.resolve()},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&X(t,"loop")&&i.playVideo(),p&&(e.data===YT.PlayerState.PAUSED&&(m[t.attr("id")].manually_paused=!0),e.data===YT.PlayerState.PLAYING&&(m[t.attr("id")].manually_paused=!1))}}});a={player:i,played_once:!1,manually_paused:!1},m[t.attr("id")]=a})}),o.promise())).done(function(){var i,n,a,o,s;(n=new e.Deferred,a=A(),o=a.find(c+".cs-vimeo-iframe").length,s=0,0==o?n.resolve().promise():(a.each(function(){e(this).find(c+".cs-vimeo-iframe").each(function(){var t=e(this);t.uniqueId(),t.attr("id","cs-vimeo-iframe-"+t.attr("id")),t.attr("src",t.attr("src")+"&player_id="+t.attr("id"));var a=$f(t[0]);a.addEvent("ready",function(){a.addEvent("finish",function(){g[t.attr("id")].ended=!0}),a.addEvent("play",function(){g[t.attr("id")].played_once=!0,g[t.attr("id")].ended=!1,p&&(g[t.attr("id")].manually_paused=!1)}),a.addEvent("pause",function(){p&&(g[t.attr("id")].manually_paused=!0)}),X(t,"loop")&&a.api("setLoop",!0),++s==o&&n.resolve()}),i={player:a,played_once:!1,ended:!1,manually_paused:!1},g[t.attr("id")]=i})}),n.promise())).done(function(){t.resolve()})})})}),t.promise()}().done(function(){var t=setInterval(function(){"complete"==document.readyState&&a.find(o).find(".cs-preloader").length>0&&(clearInterval(t),function(){i.responsive&&N();I(),w=e(window).width(),A().each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){var t=e(this);D(t)}),D(t)}),t.css("display","none"),t.data("opacity",parseFloat(t.css("opacity")))}),i.responsive&&e(window).resize(function(){w!=e(window).width()&&("full-width"==i.layout&&x()!=e(a).width()||e(a).width()<x()||e(a).width()>x()&&x()<i.startWidth)&&_()}),a.find(o).find(".cs-controls > .cs-previous").click(function(){V(C())}),a.find(o).find(".cs-controls > .cs-next").click(function(){V(z())}),i.enableSwipe&&(a.find(o).on("swipeleft",function(){M(),V(z())}),a.find(o).on("swiperight",function(){M(),V(C())})),a.find(o).find(".cs-navigation > .cs-slide-link").click(function(){V(e(this).index())}),i.pauseOnHover&&(a.find(o).find(s).hover(function(){O()}),a.find(o).find(s).mouseleave(function(){M()})),a.find(o).find(s).css("visibility","visible"),a.find(o).find(".cs-progress-bar").css("display","block"),a.find(o).find(".cs-navigation").css("display","block"),a.find(o).find(".cs-controls").css("display","block"),ne(B(0)),B(0).finish(),a.find(o).find(".cs-preloader").animate({opacity:0},300,function(){a.find(o).find(".cs-preloader").remove()}),i.beforeStart(),i.responsive?_():F()}())},100)})}function D(e){e.data("width",parseFloat(e.width())),e.data("height",parseFloat(e.height())),e.data("letter-spacing",parseFloat(e.css("letter-spacing"))),e.data("font-size",parseFloat(e.css("font-size"))),"px"==e.css("line-height").slice(-2).toLowerCase()?e.data("line-height",parseFloat(e.css("line-height"))):"normal"==e.css("line-height")?e.data("line-height",1.15*X(e,"font-size")):e.data("line-height",parseFloat(e.css("line-height"))*X(e,"font-size")),e.data("padding-top",parseFloat(e.css("padding-top"))),e.data("padding-right",parseFloat(e.css("padding-right"))),e.data("padding-bottom",parseFloat(e.css("padding-bottom"))),e.data("padding-left",parseFloat(e.css("padding-left"))),e.data("opacity",parseFloat(e.css("opacity")))}function I(){var e,t;switch(i.layout){case"fixed":e=i.startWidth,t=i.startHeight,a.find(o).css({width:L(e),height:L(t)}),A().css({width:L(e),height:L(t)});break;case"full-width":e=a.width(),t=i.startHeight,a.find(o).css({width:e,height:L(t)}),A().css({width:e,height:L(t)});break;default:return!1}}function E(e){var t=(R()-i.startHeight)/2,n=(x()-i.startWidth)/2,a=0,o=0;return t>0&&(a=t),n>0&&(o=n),{top:a,left:o}}function _(){i.beforeSetResponsive();var t=A();Y(!0),t.each(function(){var t=e(this),i=t.find(c);t.finish(),ne(t),t.finish(),i.each(function(){var t=e(this);t.finish(),oe(t),t.finish(),$(t)&&Q(t)})}),N(),I(),t.each(function(){var t=e(this);t.find(c).each(function(){var t=e(this);t.find("*").each(function(){P(e(this))}),P(t),t.finish(),se(t),t.finish(),$(t)&&Q(t)}),t.finish(),ae(t),t.finish()}),w=e(window).width(),F()}function P(e){e.css({top:L(X(e,"top")+E().top),left:L(X(e,"left")+E().left),"padding-top":L(X(e,"padding-top")),"padding-right":L(X(e,"padding-right")),"padding-bottom":L(X(e,"padding-bottom")),"padding-left":L(X(e,"padding-left"))}),e.is("input")||e.is("button")||e.text().trim().length?e.css({"line-height":L(X(e,"line-height"))+"px","letter-spacing":L(X(e,"letter-spacing")),"font-size":L(X(e,"font-size"))}):e.css({width:L(X(e,"width")),height:L(X(e,"height"))})}function N(){var e=a.width(),t=i.startWidth;b=e>=t||!i.responsive?1:e/t}function L(e){return e*b}function F(){i.automaticSlide?function e(){j(l).done(function(){d||(l=z(),e())})}():j(l),u=!1}function Y(t){for(var i=0;i<v.length;i++)v[i].clear();for(i=0;i<y.length;i++)y[i].clear();h.clear(),A().each(function(){var i=e(this);t?i.finish():i.stop(!0,!0),i.find(c).each(function(){var i=e(this);t?i.finish():i.stop(!0,!0)})}),W()}function O(){!d&&p&&(i.beforePause(),a.find(o).find(".cs-progress-bar").stop(!0),h.pause(),d=!0)}function M(){if(d&&p){i.beforeResume();var e=a.find(o).find(".cs-progress-bar"),t=(X(B(l),"time"),h.getRemaining());e.animate({width:"100%"},t),h.resume(),d=!1}}function x(){return a.find(o).width()}function R(){return a.find(o).height()}function z(){return l+1==n?0:l+1}function C(){return l-1<0?n-1:l-1}function X(e,t){var n;switch(n=!!e.parent("ul").hasClass("cs-slides"),t){case"ease-in":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseIn:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseIn:parseInt(e.data(t));case"ease-out":return n?isNaN(parseInt(e.data(t)))?i.slidesEaseOut:parseInt(e.data(t)):isNaN(parseInt(e.data(t)))?i.elementsEaseOut:parseInt(e.data(t));case"delay":return isNaN(parseInt(e.data(t)))?i.elementsDelay:parseInt(e.data(t));case"time":return n?isNaN(parseInt(e.data(t)))?i.slidesTime:parseInt(e.data(t)):"all"==e.data(t)?"all":isNaN(parseInt(e.data(t)))?i.itemsTime:parseInt(e.data(t));case"ignore-ease-out":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.ignoreElementsEaseOut;case"autoplay":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoAutoplay;case"loop":return 1==parseInt(e.data(t))||0!=parseInt(e.data(t))&&i.videoLoop;case"top":case"left":case"width":case"height":case"padding-top":case"padding-right":case"padding-bottom":case"padding-left":case"line-height":case"letter-spacing":case"font-size":return isNaN(parseFloat(e.data(t)))?0:parseFloat(e.data(t));case"in":case"out":case"opacity":return e.data(t);default:return!1}}function A(){return a.find(o).find(s).find(r)}function B(e){return A().eq(e)}function H(e,t){var i,n,a=t;this.pause=function(){clearTimeout(i),a-=new Date-n},this.resume=function(){n=new Date,clearTimeout(i),i=window.setTimeout(function(){e()},a)},this.clear=function(){clearTimeout(i)},this.getRemaining=function(){return a},this.resume()}function U(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function W(){var e=a.find(o).find(".cs-progress-bar");e.stop(),e.css("width",0)}function V(e){e!=l&&(p||f)&&(Y(!1),q(l,!1,!0).done(function(){l=e,F()}))}function j(t){i.beforeSlideStart();var n,s,r,d,u,b=new e.Deferred;f=!1;for(var w=0;w<v.length;w++)v[w].clear();for(w=0;w<y.length;w++)y[w].clear();return h.clear(),B(t).finish(),ae(t),B(t).finish(),B(t).find(c).each(function(){var t=e(this);t.finish(),se(t),t.finish()}),a.find(o).find(".cs-navigation").find("> .cs-slide-link").each(function(){var t=e(this);t.index()==l?t.addClass("cs-active"):t.removeClass("cs-active")}),s=B(n=t).find(c),r=0,d=!1,u=new e.Deferred,p=!1,ne(n).done(function(){var e;e=a.find(o).find(".cs-progress-bar"),W(),e.animate({width:"100%"},X(B(l),"time")),p=!0,(d=!0)&&r==s.length&&u.resolve()}),s.each(function(){var t=e(this),i=X(t,"delay");y.push(new H(function(){oe(t).done(function(){var e,i,n;$(t)&&(G(n=t)?(!X(i=n,"autoplay")||m[i.attr("id")].played_once||U()||K(i).playVideo(),2!=Z(i)||m[i.attr("id")].manually_paused||K(i).playVideo(),m[i.attr("id")].played_once=!0):(!X(e=n,"autoplay")||g[e.attr("id")].played_once||U()||te(e).api("play"),te(e).api("paused")&&!g[e.attr("id")].ended&&g[e.attr("id")].played_once&&!g[e.attr("id")].manually_paused&&te(e).api("play"))),r++,d&&r==s.length&&u.resolve()})},i))}),u.promise(),i.automaticSlide?q(t,!0,!0).done(function(){f=!0,b.resolve()}):q(t,!0,!1).done(function(){f=!0,b.resolve()}),b.promise()}function q(t,i,n){var a=B(t),o=a.find(c),s=i?X(a,"time")+X(a,"ease-in"):0,r=0,l=!1,d=new e.Deferred;return o.each(function(){var a=e(this),s=X(a,"time");if("all"!=s){var c=i?s:0;X(a,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),v.push(new H(function(){se(a).done(function(){X(a,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))})},c))}}),h=new H(function(){p=!1,W(),l=!0,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()),n?o.each(function(){var i=e(this);"all"==X(i,"time")&&(X(i,"ignore-ease-out")&&(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve())),se(i).done(function(){X(i,"ignore-ease-out")||(r++,o.length==r&&l&&n&&(J(t),ae(t),d.resolve()))}))}):d.resolve()},s),d.promise()}function $(e){return G(e)||e.hasClass("cs-vimeo-iframe")}function J(t){B(t).each(function(){var t=e(this);t.find(c+".cs-yt-iframe").each(function(){ee(e(this))})}),B(t).each(function(){var t=e(this);t.find(c+".cs-vimeo-iframe").each(function(){ie(e(this))})})}function Q(e){G(e)?ee(e):ie(e)}function G(e){return e.hasClass("cs-yt-iframe")}function K(e){return m[e.attr("id")].player}function Z(e){return K(e).getPlayerState()}function ee(e){1==Z(e)&&K(e).pauseVideo()}function te(e){return g[e.attr("id")].player}function ie(e){te(e).api("pause")}function ne(t){var i=B(t),n=X(i,"in"),a=X(i,"ease-in"),o=new e.Deferred;if("block"==i.css("display"))return o.resolve().promise();if(u)return i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve().promise();switch(n){case"fade":i.css({display:"block",top:0,left:0,opacity:0}),i.animate({opacity:X(i,"opacity")},a,function(){o.resolve()});break;case"fadeLeft":i.css({display:"block",top:0,left:x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"fadeRight":i.css({display:"block",top:0,left:-x(),opacity:0}),i.animate({opacity:X(i,"opacity"),left:0},a,function(){o.resolve()});break;case"slideLeft":i.css({display:"block",top:0,left:x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideRight":i.css({display:"block",top:0,left:-x(),opacity:X(i,"opacity")}),i.animate({left:0},a,function(){o.resolve()});break;case"slideUp":i.css({display:"block",top:R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;case"slideDown":i.css({display:"block",top:-R(),left:0,opacity:X(i,"opacity")}),i.animate({top:0},a,function(){o.resolve()});break;default:i.css({display:"block",top:0,left:0,opacity:X(i,"opacity")}),o.resolve()}return o.promise()}function ae(t){var i=B(t),n=X(i,"out"),a=X(i,"ease-out"),o=new e.Deferred;if("none"==i.css("display"))return o.resolve().promise();switch(n){case"fade":i.animate({opacity:0},a,function(){i.css({display:"none",opacity:X(i,"opacity")}),o.resolve()});break;case"fadeLeft":i.animate({opacity:0,left:-x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"fadeRight":i.animate({opacity:0,left:x()},a,function(){i.css({display:"none",opacity:X(i,"opacity"),left:0}),o.resolve()});break;case"slideLeft":i.animate({left:-x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideRight":i.animate({left:x()},a,function(){i.css({display:"none",left:0}),o.resolve()});break;case"slideUp":i.animate({top:-R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;case"slideDown":i.animate({top:R()},a,function(){i.css({display:"none",top:0}),o.resolve()});break;default:i.css({display:"none"}),o.resolve()}return o.promise()}function oe(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"in"),o=X(t,"ease-in"),s=X(t,"top"),r=X(t,"left"),c=new e.Deferred;if("block"==t.css("display"))return c.resolve().promise();switch(a){case"slideDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:X(t,"opacity")}).animate({top:L(s+E().top)},o,function(){c.resolve()});break;case"slideLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"slideRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:X(t,"opacity")}).animate({left:L(r+E().left)},o,function(){c.resolve()});break;case"fade":t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:0}).animate({opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeDown":t.css({display:"block",top:-n,left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeUp":t.css({display:"block",top:R(),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeLeft":t.css({display:"block",top:L(s+E().top),left:x(),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeRight":t.css({display:"block",top:L(s+E().top),left:-i,opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallDown":t.css({display:"block",top:L(s+E().top-30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallUp":t.css({display:"block",top:L(s+E().top+30),left:L(r+E().left),opacity:0}).animate({top:L(s+E().top),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallLeft":t.css({display:"block",top:L(s+E().top),left:L(r+E().left+30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;case"fadeSmallRight":t.css({display:"block",top:L(s+E().top),left:L(r+E().left-30),opacity:0}).animate({left:L(r+E().left),opacity:X(t,"opacity")},o,function(){c.resolve()});break;default:t.css({display:"block",top:L(s+E().top),left:L(r+E().left),opacity:X(t,"opacity")}),c.resolve()}return c.promise()}function se(t){var i=t.outerWidth(),n=t.outerHeight(),a=X(t,"out"),o=X(t,"ease-out"),s=new e.Deferred;if("none"==t.css("display"))return s.resolve().promise();switch(a){case"slideDown":t.animate({top:R()},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideUp":t.animate({top:-n},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideLeft":t.animate({left:-i},o,function(){t.css({display:"none"}),s.resolve()});break;case"slideRight":t.animate({left:x()},o,function(){t.css({display:"none"}),s.resolve()});break;case"fade":t.animate({opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeDown":t.animate({top:R(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeUp":t.animate({top:-n,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeLeft":t.animate({left:-i,opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeRight":t.animate({left:x(),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallDown":t.animate({top:L(X(t,"top")+E().top+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallUp":t.animate({top:L(X(t,"top")+E().top-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallLeft":t.animate({left:L(X(t,"left")+E().left-30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;case"fadeSmallRight":t.animate({left:L(X(t,"left")+E().left+30),opacity:0},o,function(){t.css({display:"none",opacity:X(t,"opacity")}),s.resolve()});break;default:t.css({display:"none"}),s.resolve()}return s.promise()}this.resume=function(){M()},this.pause=function(){O()},this.nextSlide=function(){V(z())},this.previousSlide=function(){V(C())},this.changeSlide=function(e){V(e)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return n}},e.fn.crellySlider=function(t){var i=e.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},t);return this.each(function(){if(null==e(this).data("crellySlider")){var t=new e.CrellySlider(this,i);e(this).data("crellySlider",t)}})}}(jQuery);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: fabiorino
3
  Donate link: http://crellyslider.altervista.org/contribute-and-support/
4
  Tags: animations, layers, texts, images, videos
5
  Requires at least: 3.9
6
- Tested up to: 5.2
7
- Stable tag: 1.3.5
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -54,6 +54,9 @@ You can find the documentation <a href="http://crellyslider.altervista.org/docum
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 1.3.5 =
58
  * Security patch
59
  * Improved import/export slider functions. They should now be compatible with web hosting services that block file_get_contents
3
  Donate link: http://crellyslider.altervista.org/contribute-and-support/
4
  Tags: animations, layers, texts, images, videos
5
  Requires at least: 3.9
6
+ Tested up to: 5.4
7
+ Stable tag: 1.3.6
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.3.6 =
58
+ * Fixed PHP warning "Cannot modify header information - headers already sent" as reported <a href="https://wordpress.org/support/topic/incompatibility-with-athemes-sydney-pros-customizer">here</a>
59
+
60
  = 1.3.5 =
61
  * Security patch
62
  * Improved import/export slider functions. They should now be compatible with web hosting services that block file_get_contents
wordpress/admin.php CHANGED
@@ -182,44 +182,12 @@ class CrellySliderAdmin {
182
  <?php
183
  }
184
 
185
- // Avoid incompatibility issues
186
- public static function isAdminJs() {
187
  ?>
188
  <script type="text/javascript">
189
- var crellyslider_is_wordpress_admin = true;
190
  var crellyslider_locale = '<?php echo get_locale(); ?>';
191
  </script>
192
  <?php
193
- }
194
-
195
- public static function setIsAdminJs() {
196
- add_action('admin_enqueue_scripts', 'CrellySliderAdmin::isAdminJs');
197
- }
198
-
199
- // Include CSS and JavaScript
200
- public static function enqueues() {
201
- wp_enqueue_script('jquery-ui-draggable');
202
- wp_enqueue_script('jquery-ui-tabs');
203
- wp_enqueue_script('jquery-ui-sortable');
204
- wp_enqueue_script('jquery-ui-dialog');
205
- wp_enqueue_script('jquery-ui-datepicker');
206
- wp_enqueue_style('wp-color-picker');
207
- wp_enqueue_media();
208
-
209
- wp_register_script('datetimepicker', CS_PLUGIN_URL . '/wordpress/js/jquery.datetimepicker.js', array('jquery'), "2.5.17", true);
210
- wp_enqueue_script('datetimepicker');
211
- wp_enqueue_style('datetimepicker', CS_PLUGIN_URL . '/wordpress/css/jquery.datetimepicker.css', array(), "2.5.17");
212
-
213
- add_action('admin_print_footer_scripts', array( __CLASS__, 'printTinyMCEOptions'), 1);
214
- wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
215
-
216
- wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
217
- self::createNonces();
218
- self::localization();
219
-
220
- wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
221
- wp_enqueue_script('crellyslider-admin');
222
-
223
  $wp_version = get_bloginfo('version');
224
  $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
225
  if($wp_version < 3.8) {
@@ -277,7 +245,33 @@ class CrellySliderAdmin {
277
  }
278
  }
279
 
280
- public static function setEnqueues() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  add_action('admin_enqueue_scripts', 'CrellySliderAdmin::enqueues');
282
  }
283
 
182
  <?php
183
  }
184
 
185
+ public static function rawHeadAssets() {
 
186
  ?>
187
  <script type="text/javascript">
 
188
  var crellyslider_locale = '<?php echo get_locale(); ?>';
189
  </script>
190
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  $wp_version = get_bloginfo('version');
192
  $menu_icon_url = CS_PLUGIN_URL . '/wordpress/images/menu-icon.png';
193
  if($wp_version < 3.8) {
245
  }
246
  }
247
 
248
+ // Include CSS and JavaScript
249
+ public static function enqueues() {
250
+ wp_enqueue_script('jquery-ui-draggable');
251
+ wp_enqueue_script('jquery-ui-tabs');
252
+ wp_enqueue_script('jquery-ui-sortable');
253
+ wp_enqueue_script('jquery-ui-dialog');
254
+ wp_enqueue_script('jquery-ui-datepicker');
255
+ wp_enqueue_style('wp-color-picker');
256
+ wp_enqueue_media();
257
+
258
+ wp_register_script('datetimepicker', CS_PLUGIN_URL . '/wordpress/js/jquery.datetimepicker.js', array('jquery'), "2.5.17", true);
259
+ wp_enqueue_script('datetimepicker');
260
+ wp_enqueue_style('datetimepicker', CS_PLUGIN_URL . '/wordpress/css/jquery.datetimepicker.css', array(), "2.5.17");
261
+
262
+ add_action('admin_print_footer_scripts', array( __CLASS__, 'printTinyMCEOptions'), 1);
263
+ wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
264
+
265
+ wp_register_script('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/js/admin.js', array('wp-color-picker', 'datetimepicker'), CS_VERSION, true);
266
+ self::createNonces();
267
+ self::localization();
268
+
269
+ wp_enqueue_style('crellyslider-admin', CS_PLUGIN_URL . '/wordpress/css/admin.css', array(), CS_VERSION);
270
+ wp_enqueue_script('crellyslider-admin');
271
+ }
272
+
273
+ public static function loadAssets() {
274
+ add_action('admin_head', 'CrellySliderAdmin::rawHeadAssets');
275
  add_action('admin_enqueue_scripts', 'CrellySliderAdmin::enqueues');
276
  }
277
 
wordpress/ajax.php CHANGED
@@ -169,8 +169,8 @@ function crellyslider_editSlider_callback() {
169
  'showProgressBar' => $options['showProgressBar'],
170
  'pauseOnHover' => $options['pauseOnHover'],
171
  'callbacks' => $options['callbacks'],
172
- 'randomOrder' => $options['randomOrder'],
173
- 'startFromSlide' => $options['startFromSlide'],
174
  'enableSwipe' => $options['enableSwipe'],
175
  'fromDate' => sanitize_text_field($options['fromDate']),
176
  'toDate' => sanitize_text_field($options['toDate']),
@@ -206,7 +206,7 @@ function crellyslider_editSlider_callback() {
206
  die();
207
  }
208
 
209
- // Edit slides. Receives an array with all the slides options. Delete al the old slides then recreate them
210
  add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
211
  function crellyslider_editSlides_callback() {
212
  if(! current_user_can(CS_MIN_CAPABILITY)) {
@@ -225,33 +225,46 @@ function crellyslider_editSlides_callback() {
225
  die('Could not verify nonce');
226
  }
227
 
228
- $output = true;
 
 
 
 
 
 
 
229
 
230
- // Remove all the old slides
231
- $output = $wpdb->delete($wpdb->prefix . 'crellyslider_slides', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
232
- if($output === false) {
233
  echo json_encode(false);
 
234
  }
235
- else {
236
- // It's impossible to have 0 slides (jQuery checks it)
237
- if(count($options['options']) == 0) {
238
- echo json_encode(false);
239
- return;
240
- }
241
 
242
- $options_array = array();
243
- for($i = 0; $i < count($options['options']); $i++) {
244
- $options_array[$i] = (object)($options['options'][$i]);
245
- }
246
 
247
- $output = crellyslider_insertSlidesSQL($options_array);
248
 
249
- // Returning
250
- $output = json_encode($output);
251
- if(is_array($output)) print_r($output);
252
- else echo $output;
 
 
 
 
 
 
 
253
  }
254
 
 
 
 
 
 
255
  die();
256
  }
257
 
@@ -273,7 +286,7 @@ function crellyslider_insertSlidesSQL($options) {
273
  return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_slides');
274
  }
275
 
276
- // Edit elements. Receives an array with all the elements options. Delete al the old elements then recreate them
277
  add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
278
  function crellyslider_editElements_callback() {
279
  if(! current_user_can(CS_MIN_CAPABILITY)) {
@@ -294,34 +307,55 @@ function crellyslider_editElements_callback() {
294
 
295
  $output = true;
296
 
297
- // Remove all the old elements
298
- $output = $wpdb->delete($wpdb->prefix . 'crellyslider_elements', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
299
- if($output === false) {
300
- echo json_encode(false);
301
- }
302
- else {
303
- // No elements
304
- $quick_temp = json_decode(stripslashes($options['options']));
305
- if(empty($quick_temp)) {
306
  $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
307
  echo json_encode($newNonce);
308
  }
 
 
 
 
 
 
 
309
  else {
310
- $options_array = json_decode(stripslashes($options['options']));
 
311
 
312
- $output = crellyslider_insertElementsSQL($options_array);
313
 
314
- // Generate new nonce on success and return it
315
- if($output) {
316
- $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
317
- echo json_encode($newNonce);
 
 
318
  }
319
- else {
320
- $output = json_encode($output);
321
- if(is_array($output)) print_r($output);
322
- else echo $output;
 
 
 
 
 
 
323
  }
324
  }
 
 
 
 
 
325
  }
326
 
327
  die();
169
  'showProgressBar' => $options['showProgressBar'],
170
  'pauseOnHover' => $options['pauseOnHover'],
171
  'callbacks' => $options['callbacks'],
172
+ 'randomOrder' => $options['randomOrder'],
173
+ 'startFromSlide' => $options['startFromSlide'],
174
  'enableSwipe' => $options['enableSwipe'],
175
  'fromDate' => sanitize_text_field($options['fromDate']),
176
  'toDate' => sanitize_text_field($options['toDate']),
206
  die();
207
  }
208
 
209
+ // Edit slides. Receives an array with all the slides options. Delete al the old slides (performs a backup first) then recreate them
210
  add_action('wp_ajax_crellyslider_editSlides', 'crellyslider_editSlides_callback');
211
  function crellyslider_editSlides_callback() {
212
  if(! current_user_can(CS_MIN_CAPABILITY)) {
225
  die('Could not verify nonce');
226
  }
227
 
228
+ // Get the latest slide ID. If we are able to save the new slides succesfully, we remove the old ones, otherwise we do the opposite
229
+ $latestID = $wpdb->get_results($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d ORDER BY id DESC LIMIT 0, 1', esc_sql($options['slider_parent'])), ARRAY_A);
230
+ if(!empty($latestID)) {
231
+ $latestID = $latestID[0]['id'];
232
+ }
233
+ else {
234
+ $latestID = null;
235
+ }
236
 
237
+ // It's impossible to have 0 slides (jQuery checks it)
238
+ if(count($options['options']) == 0) {
 
239
  echo json_encode(false);
240
+ return;
241
  }
 
 
 
 
 
 
242
 
243
+ $options_array = array();
244
+ for($i = 0; $i < count($options['options']); $i++) {
245
+ $options_array[$i] = (object)($options['options'][$i]);
246
+ }
247
 
248
+ $output = crellyslider_insertSlidesSQL($options_array);
249
 
250
+ if($output) {
251
+ // Remove all the old slides
252
+ if($latestID != null) {
253
+ $output = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d AND id <= %d', esc_sql($options['slider_parent']), $latestID));
254
+ }
255
+ }
256
+ else {
257
+ // Remove all the new slides
258
+ if($latestID != null) {
259
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_slides WHERE slider_parent = %d AND id > %d', esc_sql($options['slider_parent']), $latestID));
260
+ }
261
  }
262
 
263
+ // Returning
264
+ $output = json_encode($output);
265
+ if(is_array($output)) print_r($output);
266
+ else echo $output;
267
+
268
  die();
269
  }
270
 
286
  return crellyslider_wp_insert_rows($options, $wpdb->prefix . 'crellyslider_slides');
287
  }
288
 
289
+ // Edit elements. Receives an array with all the elements options. Delete al the old elements (performs a backup first) then recreate them
290
  add_action('wp_ajax_crellyslider_editElements', 'crellyslider_editElements_callback');
291
  function crellyslider_editElements_callback() {
292
  if(! current_user_can(CS_MIN_CAPABILITY)) {
307
 
308
  $output = true;
309
 
310
+ // If no elements just delete the existing ones
311
+ if(empty(json_decode(stripslashes($options['options'])))) {
312
+ // Remove all the old elements
313
+ $output = $wpdb->delete($wpdb->prefix . 'crellyslider_elements', array('slider_parent' => esc_sql($options['slider_parent'])), array('%d'));
314
+ if(! $output) {
315
+ echo json_encode(false);
316
+ }
317
+ // Generate new nonce and return it
318
+ else {
319
  $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
320
  echo json_encode($newNonce);
321
  }
322
+ }
323
+ else {
324
+ // Get the latest element ID. If we are able to save the new elements succesfully, we remove the old ones, otherwise we do the opposite
325
+ $latestID = $wpdb->get_results($wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d ORDER BY id DESC LIMIT 0, 1', esc_sql($options['slider_parent'])), ARRAY_A);
326
+ if(!empty($latestID)) {
327
+ $latestID = $latestID[0]['id'];
328
+ }
329
  else {
330
+ $latestID = null;
331
+ }
332
 
333
+ $options_array = json_decode(stripslashes($options['options']));
334
 
335
+ $output = crellyslider_insertElementsSQL($options_array);
336
+
337
+ if($output) {
338
+ // Remove all the old elements
339
+ if($latestID != null) {
340
+ $output = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND id <= %d', esc_sql($options['slider_parent']), $latestID));
341
  }
342
+
343
+ // Generate new nonce and return it
344
+ $newNonce = CrellySliderHelpers::setNonce(esc_sql($options['slider_parent']));
345
+ echo json_encode($newNonce);
346
+ die();
347
+ }
348
+ else {
349
+ // Remove all the new elements
350
+ if($latestID != null) {
351
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'crellyslider_elements WHERE slider_parent = %d AND id > %d', esc_sql($options['slider_parent']), $latestID));
352
  }
353
  }
354
+
355
+ // Returning
356
+ $output = json_encode($output);
357
+ if(is_array($output)) print_r($output);
358
+ else echo $output;
359
  }
360
 
361
  die();
wordpress/common.php CHANGED
@@ -6,13 +6,13 @@ class CrellySliderCommon {
6
  public static function enqueues() {
7
  wp_enqueue_script('jquery');
8
  wp_enqueue_script('jquery-ui-core');
9
-
10
  if(CS_DEBUG) {
11
- wp_enqueue_script('jquery.crellyslider', CS_PLUGIN_URL . '/js/jquery.crellyslider.js', array(), CS_VERSION, false);
12
  wp_enqueue_style('crellyslider', CS_PLUGIN_URL . '/css/crellyslider.css', array(), CS_VERSION);
13
  }
14
  else {
15
- wp_enqueue_script('jquery.crellyslider.min', CS_PLUGIN_URL . '/js/jquery.crellyslider.min.js', array(), CS_VERSION, false);
16
  wp_enqueue_style('crellyslider.min', CS_PLUGIN_URL . '/css/crellyslider.min.css', array(), CS_VERSION);
17
  }
18
  }
6
  public static function enqueues() {
7
  wp_enqueue_script('jquery');
8
  wp_enqueue_script('jquery-ui-core');
9
+
10
  if(CS_DEBUG) {
11
+ wp_enqueue_script('jquery.crellyslider', CS_PLUGIN_URL . '/js/jquery.crellyslider.js', array('jquery', 'jquery-ui-core'), CS_VERSION, false);
12
  wp_enqueue_style('crellyslider', CS_PLUGIN_URL . '/css/crellyslider.css', array(), CS_VERSION);
13
  }
14
  else {
15
+ wp_enqueue_script('jquery.crellyslider.min', CS_PLUGIN_URL . '/js/jquery.crellyslider.min.js', array('jquery', 'jquery-ui-core'), CS_VERSION, false);
16
  wp_enqueue_style('crellyslider.min', CS_PLUGIN_URL . '/css/crellyslider.min.css', array(), CS_VERSION);
17
  }
18
  }
wordpress/css/admin.css CHANGED
@@ -583,3 +583,9 @@
583
  .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
584
  display: block !important;
585
  }
 
 
 
 
 
 
583
  .cs-admin .cs-slide .cs-elements .cs-text-element-settings .mce-toolbar {
584
  display: block !important;
585
  }
586
+
587
+ .cs-admin .cs-label-input label {
588
+ display: inline-block;
589
+ width: 110px;
590
+ cursor: default;
591
+ }
wordpress/elements.php CHANGED
@@ -117,7 +117,7 @@ function crellyslider_printElements($edit, $slider, $slide, $elements) {
117
  "
118
  >
119
  <div class="cs-avoid-interaction"></div>
120
- <iframe style="<?php echo stripslashes($element->custom_css); ?>" class="cs-yt-iframe <?php echo stripslashes($element->custom_css_classes); ?>" type="text/html" width="560" height="315" src="<?php echo esc_url('http://www.youtube.com/embed/' . $element->video_id); ?>?enablejsapi=1" frameborder="0"></iframe>
121
  </div>
122
  <?php
123
  break;
@@ -137,7 +137,7 @@ function crellyslider_printElements($edit, $slider, $slide, $elements) {
137
  "
138
  >
139
  <div class="cs-avoid-interaction"></div>
140
- <iframe style="<?php echo stripslashes($element->custom_css); ?>" class="cs-vimeo-iframe <?php echo stripslashes($element->custom_css_classes); ?>" src="<?php echo esc_url('https://player.vimeo.com/video/' . $element->video_id); ?>?api=1" width="560" height="315" frameborder="0" ></iframe>
141
  </div>
142
  <?php
143
  break;
@@ -773,41 +773,74 @@ function crellyslider_printVideoElement($element) {
773
  </td>
774
  </tr>
775
  <tr>
776
- <td class="cs-name"><?php _e('Loop video', 'crelly-slider'); ?></td>
777
  <td class="cs-content">
778
- <?php
779
- if($void) echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
780
- else {
781
- if($element->video_loop == 0) {
782
- echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783
  }
 
 
 
 
 
 
 
784
  else {
785
- echo '<select class="cs-element-video_loop"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
 
 
 
 
 
786
  }
787
- }
788
- ?>
789
  </td>
790
  <td class="cs-description">
791
- <?php _e('The video will automatically restart from the beginning when it reaches the end.', 'crelly-slider'); ?>
792
  </td>
793
  </tr>
794
  <tr>
795
- <td class="cs-name"><?php _e('Autoplay', 'crelly-slider'); ?></td>
796
  <td class="cs-content">
797
  <?php
798
- if($void) echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
799
  else {
800
- if($element->video_autoplay == 0) {
801
- echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
802
  }
803
  else {
804
- echo '<select class="cs-element-video_autoplay"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
805
  }
806
  }
807
  ?>
808
  </td>
809
  <td class="cs-description">
810
- <?php _e('The video will automatically be played after the in animation.', 'crelly-slider'); ?>
811
  </td>
812
  </tr>
813
  <tr>
117
  "
118
  >
119
  <div class="cs-avoid-interaction"></div>
120
+ <iframe allow="autoplay" style="<?php echo stripslashes($element->custom_css); ?>" class="cs-yt-iframe <?php echo stripslashes($element->custom_css_classes); ?>" type="text/html" width="560" height="315" src="<?php echo esc_url('http://www.youtube.com/embed/' . $element->video_id); ?>?enablejsapi=1" frameborder="0"></iframe>
121
  </div>
122
  <?php
123
  break;
137
  "
138
  >
139
  <div class="cs-avoid-interaction"></div>
140
+ <iframe allow="autoplay" style="<?php echo stripslashes($element->custom_css); ?>" class="cs-vimeo-iframe <?php echo stripslashes($element->custom_css_classes); ?>" src="<?php echo esc_url('https://player.vimeo.com/video/' . $element->video_id); ?>?api=1" width="560" height="315" frameborder="0" ></iframe>
141
  </div>
142
  <?php
143
  break;
773
  </td>
774
  </tr>
775
  <tr>
776
+ <td class="cs-name"><?php _e('Player settings', 'crelly-slider'); ?></td>
777
  <td class="cs-content">
778
+ <div class="cs-label-input">
779
+ <label><?php _e('Loop video', 'crelly-slider'); ?></label>
780
+ <?php
781
+ if($void) echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
782
+ else {
783
+ if($element->video_loop == 0) {
784
+ echo '<select class="cs-element-video_loop"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
785
+ }
786
+ else {
787
+ echo '<select class="cs-element-video_loop"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
788
+ }
789
+ }
790
+ ?>
791
+ </div>
792
+
793
+ <div class="cs-label-input">
794
+ <label><?php _e('Autoplay', 'crelly-slider'); ?></label>
795
+ <?php
796
+ if($void) echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
797
+ else {
798
+ if($element->video_autoplay == 0) {
799
+ echo '<select class="cs-element-video_autoplay"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
800
+ }
801
+ else {
802
+ echo '<select class="cs-element-video_autoplay"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
803
+ }
804
  }
805
+ ?>
806
+ </div>
807
+
808
+ <div class="cs-label-input">
809
+ <label><?php _e('Mute on start', 'crelly-slider'); ?></label>
810
+ <?php
811
+ if($void) echo '<select class="cs-element-video_start_mute"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
812
  else {
813
+ if($element->video_start_mute == 0) {
814
+ echo '<select class="cs-element-video_start_mute"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
815
+ }
816
+ else {
817
+ echo '<select class="cs-element-video_start_mute"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
818
+ }
819
  }
820
+ ?>
821
+ </div>
822
  </td>
823
  <td class="cs-description">
824
+ <?php _e('Video player settings.', 'crelly-slider'); ?>
825
  </td>
826
  </tr>
827
  <tr>
828
+ <td class="cs-name"><?php _e('Pause while watching', 'crelly-slider'); ?></td>
829
  <td class="cs-content">
830
  <?php
831
+ if($void) echo '<select class="cs-element-video_pause_while_watching"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
832
  else {
833
+ if($element->video_pause_while_watching == 0) {
834
+ echo '<select class="cs-element-video_pause_while_watching"><option value="1">' . __('Yes', 'crelly-slider') . '</option><option selected value="0">' . __('No', 'crelly-slider') . '</option></select>';
835
  }
836
  else {
837
+ echo '<select class="cs-element-video_pause_while_watching"><option selected value="1">' . __('Yes', 'crelly-slider') . '</option><option value="0">' . __('No', 'crelly-slider') . '</option></select>';
838
  }
839
  }
840
  ?>
841
  </td>
842
  <td class="cs-description">
843
+ <?php _e('Pause the current slide timer while the user is watching the video.', 'crelly-slider'); ?>
844
  </td>
845
  </tr>
846
  <tr>
wordpress/frontend.php CHANGED
@@ -43,6 +43,17 @@ class CrellySliderFrontend {
43
  return __('The slider hasn\'t been found', 'crelly-slider');
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
46
  // Get the slider. Return if now() is not between from/to dates
47
  $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE NOW() BETWEEN fromDate AND toDate AND alias=%s', esc_sql($alias)));
48
  if(! $slider) {
@@ -54,7 +65,7 @@ class CrellySliderFrontend {
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) . '\');';
@@ -160,11 +171,13 @@ class CrellySliderFrontend {
160
  break;
161
 
162
  case 'youtube_video':
163
- $output .= '<iframe frameborder="0" type="text/html" width="560" height="315"' . "\n" .
164
  'class="cs-yt-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
165
  'src="' . esc_url('https://www.youtube.com/embed/' . $element->video_id . '?enablejsapi=1') . '"' . "\n" .
166
  'data-autoplay="' . $element->video_autoplay . '"' . "\n" .
167
  'data-loop="' . $element->video_loop . '"' . "\n" .
 
 
168
  'style="' . "\n" .
169
  'z-index: ' . $element->z_index . ';' . "\n" .
170
  stripslashes($element->custom_css) . "\n" .
@@ -182,11 +195,13 @@ class CrellySliderFrontend {
182
  break;
183
 
184
  case 'vimeo_video':
185
- $output .= '<iframe frameborder="0" width="560" height="315"' . "\n" .
186
  'class="cs-vimeo-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
187
  'src="' . esc_url('https://player.vimeo.com/video/' . $element->video_id . '?api=1') . '"' . "\n" .
188
  'data-autoplay="' . esc_attr($element->video_autoplay) . '"' . "\n" .
189
  'data-loop="' . esc_attr($element->video_loop) . '"' . "\n" .
 
 
190
  'style="' . "\n" .
191
  'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
192
  stripslashes($element->custom_css) . "\n" .
@@ -217,7 +232,7 @@ class CrellySliderFrontend {
217
  $output .= '<script type="text/javascript">' . "\n";
218
  $output .= '(function($) {' . "\n";
219
  $output .= '$(document).ready(function() {' . "\n";
220
- $output .= '$("#crellyslider-' . $slider_id . '").crellySlider({' . "\n";
221
  $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
222
  $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
223
  $output .= 'startWidth: ' . $slider->startWidth . ',' . "\n";
43
  return __('The slider hasn\'t been found', 'crelly-slider');
44
  }
45
 
46
+ // Generate a unique ID for each slider. This is needed because we might want to display the same slider on the same page more than once.
47
+ // The first slider of the page will have id="crellyslider-theSliderID". All the others will have id="crellyslider-theSliderID-aRandomString"
48
+ static $loadedSliders = array();
49
+ $uid = $slider->id;
50
+ if(in_array($slider->id, $loadedSliders)) {
51
+ $uid .= '-' . uniqid();
52
+ }
53
+ else {
54
+ array_push($loadedSliders, $slider->id);
55
+ }
56
+
57
  // Get the slider. Return if now() is not between from/to dates
58
  $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders WHERE NOW() BETWEEN fromDate AND toDate AND alias=%s', esc_sql($alias)));
59
  if(! $slider) {
65
 
66
  $output = '';
67
 
68
+ $output .= '<div style="display: none;" class="crellyslider-slider crellyslider-slider-' . esc_attr($slider->layout) . ' crellyslider-slider-' . esc_attr($alias) . ' crellyslider-' . esc_attr($slider_id) . '" id="crellyslider-' . $uid . '">' . "\n";
69
  $output .= '<ul>' . "\n";
70
  foreach($slides as $slide) {
71
  $background_type_image = $slide->background_type_image == 'undefined' || $slide->background_type_image == 'none' ? 'none;' : 'url(\'' . CrellySliderCommon::getURL($slide->background_type_image) . '\');';
171
  break;
172
 
173
  case 'youtube_video':
174
+ $output .= '<iframe allow="autoplay" frameborder="0" type="text/html" width="560" height="315"' . "\n" .
175
  'class="cs-yt-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
176
  'src="' . esc_url('https://www.youtube.com/embed/' . $element->video_id . '?enablejsapi=1') . '"' . "\n" .
177
  'data-autoplay="' . $element->video_autoplay . '"' . "\n" .
178
  'data-loop="' . $element->video_loop . '"' . "\n" .
179
+ 'data-start-mute="' . $element->video_start_mute . '"' . "\n" .
180
+ 'data-pause-while-watching="' . $element->video_pause_while_watching . '"' . "\n" .
181
  'style="' . "\n" .
182
  'z-index: ' . $element->z_index . ';' . "\n" .
183
  stripslashes($element->custom_css) . "\n" .
195
  break;
196
 
197
  case 'vimeo_video':
198
+ $output .= '<iframe allow="autoplay" frameborder="0" width="560" height="315"' . "\n" .
199
  'class="cs-vimeo-iframe ' . esc_attr($element->custom_css_classes) . '"' . "\n" .
200
  'src="' . esc_url('https://player.vimeo.com/video/' . $element->video_id . '?api=1') . '"' . "\n" .
201
  'data-autoplay="' . esc_attr($element->video_autoplay) . '"' . "\n" .
202
  'data-loop="' . esc_attr($element->video_loop) . '"' . "\n" .
203
+ 'data-start-mute="' . $element->video_start_mute . '"' . "\n" .
204
+ 'data-pause-while-watching="' . $element->video_pause_while_watching . '"' . "\n" .
205
  'style="' . "\n" .
206
  'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
207
  stripslashes($element->custom_css) . "\n" .
232
  $output .= '<script type="text/javascript">' . "\n";
233
  $output .= '(function($) {' . "\n";
234
  $output .= '$(document).ready(function() {' . "\n";
235
+ $output .= '$("#crellyslider-' . $uid . '").crellySlider({' . "\n";
236
  $output .= 'layout: \'' . $slider->layout . '\',' . "\n";
237
  $output .= 'responsive: ' . $slider->responsive . ',' . "\n";
238
  $output .= 'startWidth: ' . $slider->startWidth . ',' . "\n";
wordpress/js/admin.js CHANGED
@@ -284,8 +284,8 @@
284
 
285
  crellyslider_slidesColorPicker();
286
 
287
- // Update "start from slide" in the slider settings
288
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
289
  }
290
 
291
  // Add new on click
@@ -295,6 +295,11 @@
295
  // Also add a new slide if slides_number == 0
296
  if(slides_number == 0) {
297
  crellyslider_addSlide();
 
 
 
 
 
298
  }
299
  else {
300
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
@@ -335,11 +340,12 @@
335
  slide.find('.cs-slide-index').text(indx - 1);
336
  }
337
 
338
- // Update "start from slide" in the slider settings
339
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
340
- if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').length == 0) {
341
- $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().first().val('0');
342
- }
 
343
  });
344
 
345
  // Duplicate
@@ -1218,6 +1224,8 @@
1218
  element.attr({
1219
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1220
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
 
 
1221
  });
1222
  html_class = 'cs-yt-iframe';
1223
  }
@@ -1228,6 +1236,8 @@
1228
  element.attr({
1229
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1230
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
 
 
1231
  });
1232
  html_class = 'cs-vimeo-iframe';
1233
  }
@@ -1423,7 +1433,7 @@
1423
  data : {
1424
  // Is it saving or updating?
1425
  action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1426
- security: sliderNonce,
1427
  datas : options,
1428
  },
1429
  success: function(response) {
@@ -1595,6 +1605,8 @@
1595
  video_id : element.hasClass('cs-video-element-settings') ? element.find('.cs-element-video_id').val() : '',
1596
  video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1597
  video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
 
 
1598
  };
1599
 
1600
  final_options['options'][j] = options;
284
 
285
  crellyslider_slidesColorPicker();
286
 
287
+ // Update "start from slide" in the slider settings
288
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').append('<option value="' + (slides_number - 1) + '">' + crellyslider_translations.slide + ' ' + slides_number + '</option>');
289
  }
290
 
291
  // Add new on click
295
  // Also add a new slide if slides_number == 0
296
  if(slides_number == 0) {
297
  crellyslider_addSlide();
298
+ // Start from first slide by default, unless the user specifically picked random order
299
+ if(!$('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=-1]').is('[selected]')) {
300
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').val('0');
301
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=0]').attr('selected', 'selected');
302
+ }
303
  }
304
  else {
305
  $('.cs-admin #cs-slides .cs-slide-tabs > ul > li').eq(0).find('a').click();
340
  slide.find('.cs-slide-index').text(indx - 1);
341
  }
342
 
343
+ // Update "start from slide" in the slider settings
344
+ if($('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').find('option:selected').val() >= slides_number) { console.log("sdfsd")
345
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').val('0');
346
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide option[value=0]').attr('selected', 'selected');
347
+ }
348
+ $('.cs-admin #cs-slider-settings .cs-slider-settings-list #cs-slider-startFromSlide').children().last().remove();
349
  });
350
 
351
  // Duplicate
1224
  element.attr({
1225
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1226
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1227
+ 'data-start-mute' : parseInt(original_elements.eq(i).find('.cs-element-video_start_mute').val()),
1228
+ 'data-pause-while-watching' : parseInt(original_elements.eq(i).find('.cs-element-video_pause_while_watching').val()),
1229
  });
1230
  html_class = 'cs-yt-iframe';
1231
  }
1236
  element.attr({
1237
  'data-autoplay' : parseInt(original_elements.eq(i).find('.cs-element-video_autoplay').val()),
1238
  'data-loop' : parseInt(original_elements.eq(i).find('.cs-element-video_loop').val()),
1239
+ 'data-start-mute' : parseInt(original_elements.eq(i).find('.cs-element-video_start_mute').val()),
1240
+ 'data-pause-while-watching' : parseInt(original_elements.eq(i).find('.cs-element-video_pause_while_watching').val()),
1241
  });
1242
  html_class = 'cs-vimeo-iframe';
1243
  }
1433
  data : {
1434
  // Is it saving or updating?
1435
  action: $('.cs-admin .cs-slider').hasClass('cs-add-slider') ? 'crellyslider_addSlider' : 'crellyslider_editSlider',
1436
+ security: sliderNonce,
1437
  datas : options,
1438
  },
1439
  success: function(response) {
1605
  video_id : element.hasClass('cs-video-element-settings') ? element.find('.cs-element-video_id').val() : '',
1606
  video_loop : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_loop').val()) : -1,
1607
  video_autoplay : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_autoplay').val()) : -1,
1608
+ video_start_mute : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_start_mute').val()) : -1,
1609
+ video_pause_while_watching : element.hasClass('cs-video-element-settings') ? parseInt(element.find('.cs-element-video_pause_while_watching').val()) : -1,
1610
  };
1611
 
1612
  final_options['options'][j] = options;
wordpress/js/gutenberg.js DELETED
@@ -1,79 +0,0 @@
1
- var el = wp.element.createElement;
2
- var registerBlockType = wp.blocks.registerBlockType;
3
-
4
- var sliders = null;
5
- var options = null;
6
-
7
- registerBlockType( 'crelly-slider/select-slider', {
8
- title: 'Crelly Slider',
9
- icon: 'universal-access-alt',
10
- category: 'layout',
11
- attributes: {
12
- sliderAlias: {
13
- type: 'string'
14
- }
15
- },
16
-
17
- edit: function (props) {
18
- if(sliders == null) {
19
- jQuery.ajax({
20
- type : 'POST',
21
- url : ajaxurl,
22
- async: false,
23
- data : {
24
- action: 'crellyslider_getSlidersList',
25
- },
26
- success: function(response) {
27
- sliders = JSON.parse(response);
28
-
29
- var attributes = props.attributes;
30
- var savedAlias = attributes.sliderAlias;
31
-
32
- options = [];
33
- for(var i = 0; i < sliders.length; i++) {
34
- var s = sliders[i];
35
- if(s['alias'] == savedAlias) {
36
- o = el('option', {value: s['alias'], selected:true}, s['name']);
37
- }
38
- else {
39
- o = el('option', {value: s['alias']}, s['name']);
40
- }
41
- options.push(o);
42
- }
43
- },
44
-
45
- error: function(XMLHttpRequest, textStatus, errorThrown) {
46
- alert('Cannot request sliders list');
47
- console.log(XMLHttpRequest.responseText);
48
- }
49
- });
50
- }
51
-
52
- console.log("edit")
53
- console.log(props);
54
- return el(
55
- 'select',
56
- {
57
- className: props.className,
58
- onChange: function(event) {
59
- var alias = event.target.value;
60
- if(alias == 'crellyslider-no-slider') {
61
- alias = null;
62
- }
63
- props.setAttributes({
64
- sliderAlias: alias
65
- });
66
- }
67
- },
68
- el('option', {value: 'crellyslider-no-slider'}, crellyslider_translations.select_slider),
69
- options
70
- );
71
- },
72
-
73
- save: function(props) {
74
- var attributes = props.attributes;
75
- var alias = attributes.sliderAlias;
76
- console.log(props);
77
- return el('div', {className: props.className + 'crellyslider-block-slider-' + alias}, '[crellyslider alias="' + alias + '"]');
78
- },
79
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wordpress/slider.php CHANGED
@@ -269,22 +269,22 @@
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
  ?>
269
  <select id="cs-slider-startFromSlide">
270
  <?php
271
  if(! $edit) {
272
+ echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
273
  echo '<option selected value="0">' . __('Slide', 'crelly-slider') . ' 1</option>';
274
  }
275
  else {
276
+ if($slider->startFromSlide == -1) {
277
  echo '<option selected value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
278
  }
279
  else {
280
  echo '<option value="-1">' . __('Random slide', 'crelly-slider') . '</option>';
281
+ for($i = 0; $i < count($slides); $i++) {
282
+ echo '<option value="' . $i . '"';
283
+ if($slider->startFromSlide == $i) {
284
+ echo ' selected';
285
+ }
286
+ echo '>' . __('Slide', 'crelly-slider') . ' ' . ($i + 1) . '</option>';
287
  }
 
288
  }
289
  }
290
  ?>
wordpress/tables.php CHANGED
@@ -126,6 +126,8 @@ class CrellySliderTables {
126
  video_id TEXT CHARACTER SET utf8,
127
  video_loop INT,
128
  video_autoplay INT,
 
 
129
  UNIQUE KEY id (id)
130
  );";
131
 
126
  video_id TEXT CHARACTER SET utf8,
127
  video_loop INT,
128
  video_autoplay INT,
129
+ video_start_mute INT DEFAULT 0,
130
+ video_pause_while_watching INT DEFAULT 0,
131
  UNIQUE KEY id (id)
132
  );";
133