framework7rails 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 1.0.0
2
+ * Framework7 1.0.2
3
3
  * Full Featured Mobile HTML Framework For Building iOS Apps
4
4
  *
5
5
  * http://www.idangero.us/framework7
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * Licensed under MIT
12
12
  *
13
- * Released on: February 6, 2015
13
+ * Released on: February 22, 2015
14
14
  */
15
15
  (function () {
16
16
 
@@ -24,7 +24,7 @@
24
24
  var app = this;
25
25
 
26
26
  // Version
27
- app.version = '1.0.0';
27
+ app.version = '1.0.2';
28
28
 
29
29
  // Default Parameters
30
30
  app.params = {
@@ -147,7 +147,7 @@
147
147
  };
148
148
 
149
149
  // Link to local storage
150
- app.ls = localStorage;
150
+ app.ls = window.localStorage;
151
151
 
152
152
  // RTL
153
153
  app.rtl = $('body').css('direction') === 'rtl';
@@ -303,6 +303,7 @@
303
303
  activeNavBackIcon,
304
304
  previousNavBackIcon,
305
305
  dynamicNavbar,
306
+ pageShadow,
306
307
  el;
307
308
 
308
309
  view.handleTouchStart = function (e) {
@@ -354,6 +355,15 @@
354
355
  isTouched = false;
355
356
  return;
356
357
  }
358
+
359
+ if (view.params.swipeBackPageAnimateShadow && !app.device.android) {
360
+ pageShadow = activePage.find('.swipeback-page-shadow');
361
+ if (pageShadow.length === 0) {
362
+ pageShadow = $('<div class="swipeback-page-shadow"></div>');
363
+ activePage.append(pageShadow);
364
+ }
365
+ }
366
+
357
367
  if (dynamicNavbar) {
358
368
  activeNavbar = container.find('.navbar-on-center:not(.cached)');
359
369
  previousNavbar = container.find('.navbar-on-left:not(.cached)');
@@ -399,7 +409,7 @@
399
409
  }
400
410
 
401
411
  activePage.transform('translate3d(' + activePageTranslate + 'px,0,0)');
402
- if (view.params.swipeBackPageAnimateShadow && app.device.os !== 'android') activePage[0].style.boxShadow = '0px 0px 12px rgba(0,0,0,' + (0.5 - 0.5 * percentage) + ')';
412
+ if (view.params.swipeBackPageAnimateShadow && !app.device.android) pageShadow[0].style.opacity = 1 - 1 * percentage;
403
413
 
404
414
  previousPage.transform('translate3d(' + previousPageTranslate + 'px,0,0)');
405
415
  if (view.params.swipeBackPageAnimateOpacity) previousPage[0].style.opacity = 0.9 + 0.1 * percentage;
@@ -529,6 +539,7 @@
529
539
  app.pageAnimCallbacks('after', view, {pageContainer: previousPage[0], url: url, position: 'left', newPage: previousPage, oldPage: activePage, swipeBack: true});
530
540
  app.router.afterBack(view, activePage, previousPage);
531
541
  }
542
+ if (pageShadow && pageShadow.length > 0) pageShadow.remove();
532
543
  });
533
544
  };
534
545
  view.attachEvents = function (detach) {
@@ -1199,7 +1210,7 @@
1199
1210
  },
1200
1211
  error: function (xhr) {
1201
1212
  callback(xhr.responseText, true);
1202
- if (app.params.onAjaxError) app.params.onAjaxonAjaxError(xhr);
1213
+ if (app.params.onAjaxError) app.params.onAjaxError(xhr);
1203
1214
  }
1204
1215
  });
1205
1216
  if (view) view.xhr = app.xhr;
@@ -1344,6 +1355,7 @@
1344
1355
  view: view,
1345
1356
  url: pageContainer.f7PageData && pageContainer.f7PageData.url,
1346
1357
  query: pageContainer.f7PageData && pageContainer.f7PageData.query,
1358
+ navbarInnerContainer: pageContainer.f7PageData && pageContainer.f7PageData.navbarInnerContainer,
1347
1359
  from: position,
1348
1360
  context: pageContext
1349
1361
  };
@@ -1367,6 +1379,7 @@
1367
1379
  view: view,
1368
1380
  from: params.position,
1369
1381
  context: pageContext,
1382
+ navbarInnerContainer: pageContainer.f7PageData && pageContainer.f7PageData.navbarInnerContainer,
1370
1383
  swipeBack: params.swipeBack
1371
1384
  };
1372
1385
 
@@ -1398,6 +1411,7 @@
1398
1411
  from: params.position,
1399
1412
  context: pageContext,
1400
1413
  swipeBack: params.swipeBack,
1414
+ navbarInnerContainer: pageContainer.f7PageData && pageContainer.f7PageData.navbarInnerContainer,
1401
1415
  fromPage: params.fromPage
1402
1416
  };
1403
1417
  var oldPage = params.oldPage,
@@ -1458,8 +1472,9 @@
1458
1472
 
1459
1473
  // Init Page Events and Manipulations
1460
1474
  app.initPage = function (pageContainer) {
1475
+ pageContainer = $(pageContainer);
1461
1476
  // Size navbars on page load
1462
- if (app.sizeNavbars) app.sizeNavbars($(pageContainer).parents('.' + app.params.viewClass)[0]);
1477
+ if (app.sizeNavbars) app.sizeNavbars(pageContainer.parents('.' + app.params.viewClass)[0]);
1463
1478
  // Init messages
1464
1479
  if (app.initMessages) app.initMessages(pageContainer);
1465
1480
  // Init forms storage
@@ -1483,14 +1498,26 @@
1483
1498
  if (app.initImagesLazyLoad) app.initImagesLazyLoad(pageContainer);
1484
1499
  };
1485
1500
  app.reinitPage = function (pageContainer) {
1501
+ pageContainer = $(pageContainer);
1486
1502
  // Size navbars on page reinit
1487
- if (app.sizeNavbars) app.sizeNavbars($(pageContainer).parents('.' + app.params.viewClass)[0]);
1503
+ if (app.sizeNavbars) app.sizeNavbars(pageContainer.parents('.' + app.params.viewClass)[0]);
1488
1504
  // Reinit slider
1489
1505
  if (app.reinitSlider) app.reinitSlider(pageContainer);
1490
1506
  if (app.reinitSwiper) app.reinitSwiper(pageContainer);
1491
1507
  // Reinit lazy load
1492
1508
  if (app.reinitLazyLoad) app.reinitLazyLoad(pageContainer);
1493
1509
  };
1510
+ app.initPageWithCallback = function (pageContainer) {
1511
+ pageContainer = $(pageContainer);
1512
+ var viewContainer = pageContainer.parents('.' + app.params.viewClass);
1513
+ if (viewContainer.length === 0) return;
1514
+ var view = viewContainer[0].f7View || false;
1515
+ var url = view && view.url ? view.url : false;
1516
+ if (viewContainer) {
1517
+ viewContainer.attr('data-page', pageContainer.attr('data-page') || undefined);
1518
+ }
1519
+ app.pageInitCallback(view, {pageContainer: pageContainer[0], url: url, position: 'center'});
1520
+ };
1494
1521
 
1495
1522
  /*======================================================
1496
1523
  ************ Navigation / Router ************
@@ -1528,15 +1555,11 @@
1528
1555
  // Loading new page
1529
1556
  var removeClasses = 'page-on-center page-on-right page-on-left';
1530
1557
  if (direction === 'to-left') {
1531
- // leftPage.removeClass('page-on-center').addClass('page-from-center-to-left');
1532
- // rightPage.removeClass('page-on-left').addClass('page-from-right-to-center');
1533
1558
  leftPage.removeClass(removeClasses).addClass('page-from-center-to-left');
1534
1559
  rightPage.removeClass(removeClasses).addClass('page-from-right-to-center');
1535
1560
  }
1536
1561
  // Go back
1537
1562
  if (direction === 'to-right') {
1538
- // leftPage.removeClass('page-on-left').addClass('page-from-left-to-center');
1539
- // rightPage.removeClass('page-on-center').addClass('page-from-center-to-right');
1540
1563
  leftPage.removeClass(removeClasses).addClass('page-from-left-to-center');
1541
1564
  rightPage.removeClass(removeClasses).addClass('page-from-center-to-right');
1542
1565
 
@@ -2014,17 +2037,15 @@
2014
2037
  view.refreshPreviousPage();
2015
2038
  }
2016
2039
  }
2017
-
2018
2040
  if (animatePages) {
2019
2041
  // Set pages before animation
2020
2042
  app.router.animatePages(oldPage, newPage, 'to-left', view);
2021
2043
 
2022
2044
  // Dynamic navbar animation
2023
2045
  if (dynamicNavbar) {
2024
- setTimeout(function () {
2046
+ setTimeout(function() {
2025
2047
  app.router.animateNavbars(oldNavbarInner, newNavbarInner, 'to-left', view);
2026
2048
  }, 0);
2027
-
2028
2049
  }
2029
2050
  newPage.animationEnd(function (e) {
2030
2051
  afterAnimation();
@@ -2034,6 +2055,7 @@
2034
2055
  newNavbarInner.find('.sliding, .sliding .back .icon').transform('');
2035
2056
  afterAnimation();
2036
2057
  }
2058
+
2037
2059
  };
2038
2060
 
2039
2061
  app.router.load = function (view, options) {
@@ -3221,8 +3243,10 @@
3221
3243
  side = $('.panel.active').hasClass('panel-left') ? 'left' : 'right';
3222
3244
  }
3223
3245
  else {
3246
+ if (app.params.swipePanelOnlyClose) return;
3224
3247
  side = app.params.swipePanel;
3225
3248
  }
3249
+ if (!side) return;
3226
3250
  }
3227
3251
  panel = $('.panel.panel-' + side);
3228
3252
  opened = panel.hasClass('active');
@@ -4218,7 +4242,7 @@
4218
4242
  select[i].selected = select[i].textContent.trim() === selectedText.trim();
4219
4243
  }
4220
4244
  } else {
4221
- itemAfter.text(valueText);
4245
+ itemAfter.text(valueText.join(', '));
4222
4246
  }
4223
4247
  }
4224
4248
 
@@ -5491,24 +5515,24 @@
5491
5515
  if (el.disabled || el.readOnly) return false;
5492
5516
  if (tag === 'textarea') return true;
5493
5517
  if (tag === 'select') {
5494
- if (app.device.os === 'android') return false;
5518
+ if (app.device.android) return false;
5495
5519
  else return true;
5496
5520
  }
5497
5521
  if (tag === 'input' && skipInputs.indexOf(el.type) < 0) return true;
5498
5522
  }
5499
5523
  function targetNeedsPrevent(el) {
5500
5524
  el = $(el);
5525
+ var prevent = true;
5501
5526
  if (el.is('label') || el.parents('label').length > 0) {
5502
- if (app.device.os === 'android') {
5503
- var osv = app.device.osVersion.split('.');
5504
- if (osv[0] * 1 > 4 || (osv[0] * 1 === 4 && osv[1] * 1 >= 4)) {
5505
- return false;
5506
- }
5507
- else return true;
5527
+ if (app.device.android) {
5528
+ prevent = false;
5508
5529
  }
5509
- else return false;
5530
+ else if (app.device.ios && el.is('input')) {
5531
+ prevent = true;
5532
+ }
5533
+ else prevent = false;
5510
5534
  }
5511
- return true;
5535
+ return prevent;
5512
5536
  }
5513
5537
 
5514
5538
  // Mouse Handlers
@@ -5539,7 +5563,7 @@
5539
5563
  trackClick = false;
5540
5564
  return true;
5541
5565
  }
5542
- if (app.device.os === 'ios') {
5566
+ if (app.device.ios) {
5543
5567
  var selection = window.getSelection();
5544
5568
  if (selection.rangeCount && selection.focusNode !== document.body && (!selection.isCollapsed || document.activeElement === selection.focusNode)) {
5545
5569
  activeSelection = true;
@@ -5549,7 +5573,7 @@
5549
5573
  activeSelection = false;
5550
5574
  }
5551
5575
  }
5552
- if (app.device.os === 'android') {
5576
+ if (app.device.android) {
5553
5577
  if (androidNeedsBlur(e.target)) {
5554
5578
  document.activeElement.blur();
5555
5579
  }
@@ -5562,7 +5586,7 @@
5562
5586
  touchStartY = e.targetTouches[0].pageY;
5563
5587
 
5564
5588
  // Detect scroll parent
5565
- if (app.device.os === 'ios') {
5589
+ if (app.device.ios) {
5566
5590
  scrollParent = undefined;
5567
5591
  $(targetElement).parents().each(function () {
5568
5592
  var parent = this;
@@ -5616,7 +5640,11 @@
5616
5640
  clearTimeout(activeTimeout);
5617
5641
 
5618
5642
  if (!trackClick) {
5619
- if (!activeSelection && needsFastClick) e.preventDefault();
5643
+ if (!activeSelection && needsFastClick) {
5644
+ if (!(app.device.android && !e.cancelable)) {
5645
+ e.preventDefault();
5646
+ }
5647
+ }
5620
5648
  return true;
5621
5649
  }
5622
5650
 
@@ -5637,7 +5665,7 @@
5637
5665
 
5638
5666
  trackClick = false;
5639
5667
 
5640
- if (app.device.os === 'ios' && scrollParent) {
5668
+ if (app.device.ios && scrollParent) {
5641
5669
  if (scrollParent.scrollTop !== scrollParent.f7ScrollTop) {
5642
5670
  return false;
5643
5671
  }
@@ -5666,13 +5694,12 @@
5666
5694
  var touch = e.changedTouches[0];
5667
5695
  var evt = document.createEvent('MouseEvents');
5668
5696
  var eventType = 'click';
5669
- if (app.device.os === 'android' && targetElement.nodeName.toLowerCase() === 'select') {
5697
+ if (app.device.android && targetElement.nodeName.toLowerCase() === 'select') {
5670
5698
  eventType = 'mousedown';
5671
5699
  }
5672
5700
  evt.initMouseEvent(eventType, true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
5673
5701
  evt.forwardedTouchEvent = true;
5674
5702
  targetElement.dispatchEvent(evt);
5675
-
5676
5703
  return false;
5677
5704
  }
5678
5705
  function handleTouchCancel(e) {
@@ -5682,7 +5709,6 @@
5682
5709
 
5683
5710
  function handleClick(e) {
5684
5711
  var allowClick = false;
5685
-
5686
5712
  if (trackClick) {
5687
5713
  targetElement = null;
5688
5714
  trackClick = false;
@@ -5692,9 +5718,11 @@
5692
5718
  if (e.target.type === 'submit' && e.detail === 0) {
5693
5719
  return true;
5694
5720
  }
5695
-
5696
- if (!targetElement) {
5697
- allowClick = true;
5721
+ // if (!targetElement) {
5722
+ // allowClick = true;
5723
+ // }
5724
+ if (!needsFastClick) {
5725
+ allowClick = true;
5698
5726
  }
5699
5727
  if (document.activeElement === targetElement) {
5700
5728
  allowClick = true;
@@ -5705,7 +5733,6 @@
5705
5733
  if (!e.cancelable) {
5706
5734
  allowClick = true;
5707
5735
  }
5708
-
5709
5736
  if (!allowClick) {
5710
5737
  e.stopImmediatePropagation();
5711
5738
  e.stopPropagation();
@@ -5719,7 +5746,6 @@
5719
5746
  }
5720
5747
  targetElement = null;
5721
5748
  }
5722
-
5723
5749
  return allowClick;
5724
5750
  }
5725
5751
  if (app.support.touch) {
@@ -6812,7 +6838,7 @@
6812
6838
 
6813
6839
  if (pb.params.swipeToClose && pb.params.type !== 'page') {
6814
6840
  sliderSettings.onTouchStart = pb.swipeCloseTouchStart;
6815
- sliderSettings.onOppositeTouchMove = pb.swipeCloseTouchMove;
6841
+ sliderSettings.onTouchMoveOpposite = pb.swipeCloseTouchMove;
6816
6842
  sliderSettings.onTouchEnd = pb.swipeCloseTouchEnd;
6817
6843
  }
6818
6844
 
@@ -7703,14 +7729,14 @@
7703
7729
  monthPickerTemplate:
7704
7730
  '<div class="picker-calendar-month-picker">' +
7705
7731
  '<a href="#" class="link icon-only picker-calendar-prev-month"><i class="icon icon-prev"></i></a>' +
7706
- '<span class="current-month-value">August</span>' +
7732
+ '<span class="current-month-value"></span>' +
7707
7733
  '<a href="#" class="link icon-only picker-calendar-next-month"><i class="icon icon-next"></i></a>' +
7708
7734
  '</div>',
7709
7735
  yearPicker: true,
7710
7736
  yearPickerTemplate:
7711
7737
  '<div class="picker-calendar-year-picker">' +
7712
7738
  '<a href="#" class="link icon-only picker-calendar-prev-year"><i class="icon icon-prev"></i></a>' +
7713
- '<span class="current-year-value">2015</span>' +
7739
+ '<span class="current-year-value"></span>' +
7714
7740
  '<a href="#" class="link icon-only picker-calendar-next-year"><i class="icon icon-next"></i></a>' +
7715
7741
  '</div>',
7716
7742
  weekHeader: true,
@@ -8707,15 +8733,7 @@
8707
8733
 
8708
8734
  // Init each page callbacks
8709
8735
  $('.page:not(.cached)').each(function () {
8710
- var pageContainer = $(this);
8711
- var viewContainer = pageContainer.parents('.' + app.params.viewClass);
8712
- if (viewContainer.length === 0) return;
8713
- var view = viewContainer[0].f7View || false;
8714
- var url = view && view.url ? view.url : false;
8715
- if (viewContainer) {
8716
- viewContainer.attr('data-page', pageContainer.attr('data-page') || undefined);
8717
- }
8718
- app.pageInitCallback(view, {pageContainer: this, url: url, position: 'center'});
8736
+ app.initPageWithCallback(this);
8719
8737
  });
8720
8738
 
8721
8739
  // Init resize events
@@ -8822,7 +8840,7 @@
8822
8840
  var classes = className.split(' ');
8823
8841
  for (var i = 0; i < classes.length; i++) {
8824
8842
  for (var j = 0; j < this.length; j++) {
8825
- this[j].classList.add(classes[i]);
8843
+ if (typeof this[j].classList !== 'undefined') this[j].classList.add(classes[i]);
8826
8844
  }
8827
8845
  }
8828
8846
  return this;
@@ -8831,7 +8849,7 @@
8831
8849
  var classes = className.split(' ');
8832
8850
  for (var i = 0; i < classes.length; i++) {
8833
8851
  for (var j = 0; j < this.length; j++) {
8834
- this[j].classList.remove(classes[i]);
8852
+ if (typeof this[j].classList !== 'undefined') this[j].classList.remove(classes[i]);
8835
8853
  }
8836
8854
  }
8837
8855
  return this;
@@ -8844,7 +8862,7 @@
8844
8862
  var classes = className.split(' ');
8845
8863
  for (var i = 0; i < classes.length; i++) {
8846
8864
  for (var j = 0; j < this.length; j++) {
8847
- this[j].classList.toggle(classes[i]);
8865
+ if (typeof this[j].classList !== 'undefined') this[j].classList.toggle(classes[i]);
8848
8866
  }
8849
8867
  }
8850
8868
  return this;
@@ -9620,7 +9638,14 @@
9620
9638
 
9621
9639
  // Cache for GET/HEAD requests
9622
9640
  if (_method === 'GET' || _method === 'HEAD') {
9623
- if (options.cache === false) options.url += ('_nocache=' + Date.now());
9641
+ if (options.cache === false) {
9642
+ if (options.url.indexOf('?') >= 0) {
9643
+ options.url += ('&_nocache=' + Date.now());
9644
+ }
9645
+ else {
9646
+ options.url += ('?_nocache=' + Date.now());
9647
+ }
9648
+ }
9624
9649
  }
9625
9650
 
9626
9651
  // Create XHR
@@ -9743,7 +9768,7 @@
9743
9768
  xhrTimeout = setTimeout(function () {
9744
9769
  xhr.abort();
9745
9770
  fireAjaxCallback('ajaxError', {xhr: xhr, timeout: true}, 'error', xhr, 'timeout');
9746
- fireAjaxCallback('complete', {xhr: xhr, timeout: true}, 'complete', xhr, 'timeout');
9771
+ fireAjaxCallback('ajaxComplete', {xhr: xhr, timeout: true}, 'complete', xhr, 'timeout');
9747
9772
  }, options.timeout);
9748
9773
  }
9749
9774
 
@@ -10010,13 +10035,14 @@
10010
10035
  var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
10011
10036
  var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
10012
10037
 
10013
- device.ios = device.android = device.iphone = device.ipad = false;
10038
+ device.ios = device.android = device.iphone = device.ipad = device.androidChrome = false;
10014
10039
 
10015
10040
  // Android
10016
10041
  if (android) {
10017
10042
  device.os = 'android';
10018
10043
  device.osVersion = android[2];
10019
10044
  device.android = true;
10045
+ device.androidChrome = ua.toLowerCase().indexOf('chrome') >= 0;
10020
10046
  }
10021
10047
  if (ipad || iphone || ipod) {
10022
10048
  device.os = 'ios';
@@ -10556,7 +10582,7 @@
10556
10582
  grabCursor: false,
10557
10583
  // Clicks
10558
10584
  preventClicks: true,
10559
- clicksStopPropagation: true,
10585
+ preventClicksPropagation: true,
10560
10586
  releaseFormElements: true,
10561
10587
  slideToClickedSlide: false,
10562
10588
  // Images
@@ -10589,8 +10615,12 @@
10589
10615
  // Observer
10590
10616
  observer: false,
10591
10617
  observeParents: false,
10618
+ // Callbacks
10619
+ runCallbacksOnInit: true
10592
10620
  /*
10593
10621
  Callbacks:
10622
+ onInit: function (swiper)
10623
+ onDestroy: function (swiper)
10594
10624
  onClick: function (swiper, e)
10595
10625
  onTap: function (swiper, e)
10596
10626
  onDoubleTap: function (swiper, e)
@@ -10601,9 +10631,9 @@
10601
10631
  onTransitionEnd: function (swiper)
10602
10632
  onImagesReady: function (swiper)
10603
10633
  onProgress: function (swiper, progress)
10604
- onDestroy: function ()
10605
10634
  onTouchStart: function (swiper, e)
10606
10635
  onTouchMove: function (swiper, e)
10636
+ onTouchMoveOpposite: function (swiper, e)
10607
10637
  onTouchEnd: function (swiper, e)
10608
10638
  onReachBeginning: function (swiper)
10609
10639
  onReachEnd: function (swiper)
@@ -10713,6 +10743,11 @@
10713
10743
 
10714
10744
  // RTL
10715
10745
  s.rtl = isH() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
10746
+ if (s.rtl) s.container.addClass('swiper-container-rtl');
10747
+ // Wrong RTL support
10748
+ if (s.rtl) {
10749
+ s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
10750
+ }
10716
10751
 
10717
10752
  // Translate
10718
10753
  s.translate = 0;
@@ -10855,6 +10890,15 @@
10855
10890
  });
10856
10891
  }
10857
10892
  };
10893
+ /*=========================
10894
+ Min/Max Translate
10895
+ ===========================*/
10896
+ s.minTranslate = function () {
10897
+ return (-s.snapGrid[0]);
10898
+ };
10899
+ s.maxTranslate = function () {
10900
+ return (-s.snapGrid[s.snapGrid.length - 1]);
10901
+ };
10858
10902
  /*=========================
10859
10903
  Slider/slides sizes
10860
10904
  ===========================*/
@@ -10972,6 +11016,10 @@
10972
11016
 
10973
11017
  var newSlidesGrid;
10974
11018
 
11019
+ if (s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
11020
+ s.wrapper.css({width: s.virtualWidth + s.params.spaceBetween + 'px'});
11021
+ }
11022
+
10975
11023
  if (s.params.slidesPerColumn > 1) {
10976
11024
  s.virtualWidth = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
10977
11025
  s.virtualWidth = Math.ceil(s.virtualWidth / s.params.slidesPerColumn) - s.params.spaceBetween;
@@ -11017,22 +11065,6 @@
11017
11065
  }
11018
11066
  };
11019
11067
 
11020
- s.update = function () {
11021
- s.updateContainerSize();
11022
- s.updateSlidesSize();
11023
- s.updateProgress();
11024
- s.updatePagination();
11025
- s.updateClasses();
11026
- };
11027
-
11028
- // Min/max translates
11029
- s.minTranslate = function () {
11030
- return (-s.snapGrid[0]);
11031
- };
11032
- s.maxTranslate = function () {
11033
- return (-s.snapGrid[s.snapGrid.length - 1]);
11034
- };
11035
-
11036
11068
  /*=========================
11037
11069
  Slider/slides progress
11038
11070
  ===========================*/
@@ -11044,6 +11076,7 @@
11044
11076
  if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
11045
11077
 
11046
11078
  var offsetCenter = s.params.centeredSlides ? -translate + s.size / 2 : -translate;
11079
+ if (s.rtl) offsetCenter = s.params.centeredSlides ? translate - s.size / 2 : translate;
11047
11080
 
11048
11081
  // Visible Slides
11049
11082
  var containerBox = s.container[0].getBoundingClientRect();
@@ -11065,7 +11098,7 @@
11065
11098
  s.slides.eq(i).addClass(s.params.slideVisibleClass);
11066
11099
  }
11067
11100
  }
11068
- slide.progress = slideProgress;
11101
+ slide.progress = s.rtl ? -slideProgress : slideProgress;
11069
11102
  }
11070
11103
  };
11071
11104
  s.updateProgress = function (translate) {
@@ -11183,7 +11216,33 @@
11183
11216
  s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
11184
11217
  }
11185
11218
  };
11186
-
11219
+ /*=========================
11220
+ Common update method
11221
+ ===========================*/
11222
+ s.update = function (updateTranslate) {
11223
+ s.updateContainerSize();
11224
+ s.updateSlidesSize();
11225
+ s.updateProgress();
11226
+ s.updatePagination();
11227
+ s.updateClasses();
11228
+ if (s.params.scrollbar && s.scrollbar) {
11229
+ s.scrollbar.set();
11230
+ }
11231
+ if (updateTranslate) {
11232
+ var translated, newTranslate;
11233
+ if (s.isEnd) {
11234
+ translated = s.slideTo(s.slides.length - 1, 0, false, true);
11235
+ }
11236
+ else {
11237
+ translated = s.slideTo(s.activeIndex, 0, false, true);
11238
+ }
11239
+ if (!translated) {
11240
+ newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
11241
+ s.setWrapperTranslate(newTranslate);
11242
+ }
11243
+
11244
+ }
11245
+ };
11187
11246
 
11188
11247
  /*=========================
11189
11248
  Resize Handler
@@ -11194,14 +11253,14 @@
11194
11253
  s.updateProgress();
11195
11254
  s.updateClasses();
11196
11255
  if (s.params.slidesPerView === 'auto') s.updatePagination();
11256
+ if (s.params.scrollbar && s.scrollbar) {
11257
+ s.scrollbar.set();
11258
+ }
11197
11259
  if (s.isEnd) {
11198
- s.slideTo(s.slides.length - 1, 0, false);
11260
+ s.slideTo(s.slides.length - 1, 0, false, true);
11199
11261
  }
11200
11262
  else {
11201
- s.slideTo(s.activeIndex, 0, false);
11202
- }
11203
- if (s.params.scrollbar && s.scrollbar) {
11204
- s.scrollbar.init();
11263
+ s.slideTo(s.activeIndex, 0, false, true);
11205
11264
  }
11206
11265
  };
11207
11266
 
@@ -11227,26 +11286,28 @@
11227
11286
 
11228
11287
  // Attach/detach events
11229
11288
  s.events = function (detach) {
11230
- var action = detach ? 'off' : 'on';
11289
+ var actionDom = detach ? 'off' : 'on';
11290
+ var actionVanilla = detach ? 'removeEventListener' : 'addEventListener';
11231
11291
  var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container : s.wrapper;
11232
11292
  var target = s.support.touch ? touchEventsTarget : $(document);
11233
11293
 
11234
11294
  var moveCapture = s.params.nested ? true : false;
11295
+
11235
11296
  // Touch events
11236
- touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
11237
- target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
11238
- target[action](s.touchEvents.end, s.onTouchEnd, false);
11239
- $(window)[action]('resize', s.onResize);
11297
+ touchEventsTarget[0][actionVanilla](s.touchEvents.start, s.onTouchStart, false);
11298
+ target[0][actionVanilla](s.touchEvents.move, s.onTouchMove, moveCapture);
11299
+ target[0][actionVanilla](s.touchEvents.end, s.onTouchEnd, false);
11300
+ window[actionVanilla]('resize', s.onResize);
11240
11301
 
11241
11302
  // Next, Prev, Index
11242
- if (s.params.nextButton) $(s.params.nextButton)[action]('click', s.onClickNext);
11243
- if (s.params.prevButton) $(s.params.prevButton)[action]('click', s.onClickPrev);
11303
+ if (s.params.nextButton) $(s.params.nextButton)[actionDom]('click', s.onClickNext);
11304
+ if (s.params.prevButton) $(s.params.prevButton)[actionDom]('click', s.onClickPrev);
11244
11305
  if (s.params.pagination && s.params.paginationClickable) {
11245
- $(s.paginationContainer)[action]('click', '.' + s.params.bulletClass, s.onClickIndex);
11306
+ $(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
11246
11307
  }
11247
11308
 
11248
11309
  // Prevent Links Clicks
11249
- if (s.params.preventClicks || s.params.clicksStopPropagation) touchEventsTarget[action]('click', 'a', s.preventClicks, true);
11310
+ if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[0][actionVanilla]('click', s.preventClicks, true);
11250
11311
  };
11251
11312
  s.attachEvents = function (detach) {
11252
11313
  s.events();
@@ -11263,7 +11324,7 @@
11263
11324
  s.preventClicks = function (e) {
11264
11325
  if (!s.allowClick) {
11265
11326
  if (s.params.preventClicks) e.preventDefault();
11266
- if (s.params.clicksStopPropagation) {
11327
+ if (s.params.preventClicksPropagation) {
11267
11328
  e.stopPropagation();
11268
11329
  e.stopImmediatePropagation();
11269
11330
  }
@@ -11314,6 +11375,11 @@
11314
11375
  s.clickedSlide = slide;
11315
11376
  s.clickedIndex = $(slide).index();
11316
11377
  }
11378
+ else {
11379
+ s.clickedSlide = undefined;
11380
+ s.clickedIndex = undefined;
11381
+ return;
11382
+ }
11317
11383
  if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
11318
11384
  var slideToIndex = s.clickedIndex,
11319
11385
  realIndex;
@@ -11344,18 +11410,37 @@
11344
11410
  }
11345
11411
  };
11346
11412
 
11347
- var isTouched, isMoved, touchesStart = {}, touchesCurrent = {}, touchStartTime, isScrolling, currentTranslate, startTranslate, allowThresholdMove;
11413
+ var isTouched,
11414
+ isMoved,
11415
+ touchStartTime,
11416
+ isScrolling,
11417
+ currentTranslate,
11418
+ startTranslate,
11419
+ allowThresholdMove,
11420
+ // Form elements to match
11421
+ formElements = 'input, select, textarea, button',
11422
+ // Last click time
11423
+ lastClickTime = Date.now(), clickTimeout,
11424
+ //Velocities
11425
+ velocities = [],
11426
+ allowMomentumBounce;
11427
+
11428
+ // Animating Flag
11348
11429
  s.animating = false;
11349
- var lastClickTime = Date.now(), clickTimeout;
11350
- var velocities = [], allowMomentumBounce;
11351
- // Form elements to match
11352
- var formElements = 'input, select, textarea, button';
11430
+
11431
+ // Touches information
11432
+ s.touches = {
11433
+ startX: 0,
11434
+ startY: 0,
11435
+ currentX: 0,
11436
+ currentY: 0,
11437
+ diff: 0
11438
+ };
11353
11439
 
11354
11440
  // Touch handlers
11355
11441
  s.onTouchStart = function (e) {
11356
- if (e.originalEvent) e = e.originalEvent; //jQuery fix
11357
- if (e.type === 'mousedown' && 'which' in e && e.which === 3) return;
11358
11442
  if (e.originalEvent) e = e.originalEvent;
11443
+ if (e.type === 'mousedown' && 'which' in e && e.which === 3) return;
11359
11444
  if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) return;
11360
11445
  if (s.params.swipeHandler) {
11361
11446
  if (!findElementInEvent(e, s.params.swipeHandler)) return;
@@ -11363,23 +11448,26 @@
11363
11448
  isTouched = true;
11364
11449
  isMoved = false;
11365
11450
  isScrolling = undefined;
11366
- touchesStart.x = touchesCurrent.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
11367
- touchesStart.y = touchesCurrent.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
11451
+ s.touches.startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
11452
+ s.touches.startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
11368
11453
  touchStartTime = Date.now();
11369
11454
  s.allowClick = true;
11370
11455
  s.updateContainerSize();
11371
11456
  s.swipeDirection = undefined;
11372
11457
  if (s.params.threshold > 0) allowThresholdMove = false;
11373
- if (e.type === 'mousedown') {
11458
+ if (e.type !== 'touchstart') {
11374
11459
  var preventDefault = true;
11375
11460
  if ($(e.target).is(formElements)) preventDefault = false;
11376
11461
  if (document.activeElement && $(document.activeElement).is(formElements)) document.activeElement.blur();
11462
+ if (preventDefault) {
11463
+ e.preventDefault();
11464
+ }
11377
11465
  }
11378
11466
  if (s.params.onTouchStart) s.params.onTouchStart(s, e);
11379
11467
  };
11380
11468
 
11381
11469
  s.onTouchMove = function (e) {
11382
- if (e.originalEvent) e = e.originalEvent; //jQuery fix
11470
+ if (e.originalEvent) e = e.originalEvent;
11383
11471
  if (e.preventedByNestedSwiper) return;
11384
11472
  if (s.params.onlyExternal) {
11385
11473
  isMoved = true;
@@ -11388,17 +11476,20 @@
11388
11476
  }
11389
11477
  if (s.params.onTouchMove) s.params.onTouchMove(s, e);
11390
11478
  s.allowClick = false;
11391
- if (!isTouched) return;
11392
11479
  if (e.targetTouches && e.targetTouches.length > 1) return;
11393
11480
 
11394
- touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
11395
- touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
11481
+ s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
11482
+ s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
11396
11483
 
11397
- var touchAngle = Math.atan2(Math.abs(touchesCurrent.y - touchesStart.y), Math.abs(touchesCurrent.x - touchesStart.x)) * 180 / Math.PI;
11398
11484
  if (typeof isScrolling === 'undefined') {
11485
+ var touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
11399
11486
  isScrolling = isH() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle);
11400
11487
  // isScrolling = !!(isScrolling || Math.abs(touchesCurrent.y - touchesStart.y) > Math.abs(touchesCurrent.x - touchesStart.x));
11401
11488
  }
11489
+ if (isScrolling && s.params.onTouchMoveOpposite) {
11490
+ s.params.onTouchMoveOpposite(s, e);
11491
+ }
11492
+ if (!isTouched) return;
11402
11493
  if (isScrolling) {
11403
11494
  isTouched = false;
11404
11495
  return;
@@ -11414,7 +11505,7 @@
11414
11505
  if (params.loop) {
11415
11506
  s.fixLoop();
11416
11507
  }
11417
- startTranslate = s.params.effect === 'cube' ? (s.translate || 0) : s.getWrapperTranslate();
11508
+ startTranslate = s.params.effect === 'cube' ? ((s.rtl ? -s.translate: s.translate) || 0) : s.getWrapperTranslate();
11418
11509
  s.setWrapperTransition(0);
11419
11510
  if (s.animating) {
11420
11511
  s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
@@ -11438,7 +11529,7 @@
11438
11529
  }
11439
11530
  isMoved = true;
11440
11531
 
11441
- var diff = isH() ? touchesCurrent.x - touchesStart.x : touchesCurrent.y - touchesStart.y;
11532
+ var diff = s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
11442
11533
 
11443
11534
  diff = diff * s.params.touchRatio;
11444
11535
  if (s.rtl) diff = -diff;
@@ -11475,9 +11566,10 @@
11475
11566
  if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
11476
11567
  if (!allowThresholdMove) {
11477
11568
  allowThresholdMove = true;
11478
- touchesStart.x = touchesCurrent.x;
11479
- touchesStart.y = touchesCurrent.y;
11569
+ s.touches.startX = s.touches.currentX;
11570
+ s.touches.startY = s.touches.currentY;
11480
11571
  currentTranslate = startTranslate;
11572
+ s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
11481
11573
  return;
11482
11574
  }
11483
11575
  }
@@ -11494,12 +11586,12 @@
11494
11586
  //Velocity
11495
11587
  if (velocities.length === 0) {
11496
11588
  velocities.push({
11497
- position: touchesStart[isH() ? 'x' : 'y'],
11589
+ position: s.touches[isH() ? 'startX' : 'startY'],
11498
11590
  time: touchStartTime
11499
11591
  });
11500
11592
  }
11501
11593
  velocities.push({
11502
- position: touchesCurrent[isH() ? 'x' : 'y'],
11594
+ position: s.touches[isH() ? 'currentX' : 'currentY'],
11503
11595
  time: (new Date()).getTime()
11504
11596
  });
11505
11597
  }
@@ -11509,9 +11601,9 @@
11509
11601
  s.setWrapperTranslate(currentTranslate);
11510
11602
  };
11511
11603
  s.onTouchEnd = function (e) {
11512
- if (e.originalEvent) e = e.originalEvent; //jQuery fix
11513
- if (!isTouched) return;
11604
+ if (e.originalEvent) e = e.originalEvent;
11514
11605
  if (s.params.onTouchEnd) s.params.onTouchEnd(s, e);
11606
+ if (!isTouched) return;
11515
11607
 
11516
11608
  //Return Grab Cursor
11517
11609
  if (s.params.grabCursor && isMoved && isTouched) {
@@ -11553,9 +11645,7 @@
11553
11645
  if (s && s.allowClick) s.allowClick = true;
11554
11646
  }, 0);
11555
11647
 
11556
- var touchesDiff = isH() ? touchesCurrent.x - touchesStart.x : touchesCurrent.y - touchesStart.y;
11557
-
11558
- if (!isTouched || !isMoved || !s.swipeDirection || touchesDiff === 0 || currentTranslate === startTranslate) {
11648
+ if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
11559
11649
  isTouched = isMoved = false;
11560
11650
  return;
11561
11651
  }
@@ -11584,7 +11674,6 @@
11584
11674
 
11585
11675
  var distance = lastMoveEvent.position - velocityEvent.position;
11586
11676
  var time = lastMoveEvent.time - velocityEvent.time;
11587
-
11588
11677
  s.velocity = distance / time;
11589
11678
  s.velocity = s.velocity / 2;
11590
11679
  if (Math.abs(s.velocity) < 0.02) {
@@ -11592,8 +11681,7 @@
11592
11681
  }
11593
11682
  // this implies that the user stopped moving a finger then released.
11594
11683
  // There would be no events with distance zero, so the last event is stale.
11595
- // if (Math.abs(s.velocity) < 0.1 & time > 150 || timeDiff > 300) {
11596
- if (time > 150 || timeDiff > 300) {
11684
+ if (time > 150 || (new Date().getTime() - lastMoveEvent.time) > 300) {
11597
11685
  s.velocity = 0;
11598
11686
  }
11599
11687
  } else {
@@ -11601,22 +11689,26 @@
11601
11689
  }
11602
11690
 
11603
11691
  velocities.length = 0;
11604
-
11605
11692
  var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
11606
11693
  var momentumDistance = s.velocity * momentumDuration;
11607
11694
 
11608
11695
  var newPosition = s.translate + momentumDistance;
11696
+ if (s.rtl) newPosition = - newPosition;
11609
11697
  var doBounce = false;
11610
11698
  var afterBouncePosition;
11611
11699
  var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
11612
11700
  if (newPosition < s.maxTranslate()) {
11613
11701
  if (s.params.freeModeMomentumBounce) {
11614
- if (newPosition + s.maxTranslate() < -bounceAmount) newPosition = s.maxTranslate() - bounceAmount;
11702
+ if (newPosition + s.maxTranslate() < -bounceAmount) {
11703
+ newPosition = s.maxTranslate() - bounceAmount;
11704
+ }
11615
11705
  afterBouncePosition = s.maxTranslate();
11616
11706
  doBounce = true;
11617
11707
  allowMomentumBounce = true;
11618
11708
  }
11619
- else newPosition = s.maxTranslate();
11709
+ else {
11710
+ newPosition = s.maxTranslate();
11711
+ }
11620
11712
  }
11621
11713
  if (newPosition > s.minTranslate()) {
11622
11714
  if (s.params.freeModeMomentumBounce) {
@@ -11627,11 +11719,18 @@
11627
11719
  doBounce = true;
11628
11720
  allowMomentumBounce = true;
11629
11721
  }
11630
- else newPosition = s.minTranslate();
11722
+ else {
11723
+ newPosition = s.minTranslate();
11724
+ }
11631
11725
  }
11632
11726
  //Fix duration
11633
11727
  if (s.velocity !== 0) {
11634
- momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
11728
+ if (s.rtl) {
11729
+ momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
11730
+ }
11731
+ else {
11732
+ momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
11733
+ }
11635
11734
  }
11636
11735
 
11637
11736
  if (s.params.freeModeMomentumBounce && doBounce) {
@@ -11788,6 +11887,7 @@
11788
11887
 
11789
11888
  }
11790
11889
  s.updateClasses();
11890
+ return true;
11791
11891
  };
11792
11892
 
11793
11893
  s.onTransitionStart = function () {
@@ -11804,9 +11904,8 @@
11804
11904
  if (s.params.loop) {
11805
11905
  if (s.animating) return false;
11806
11906
  s.fixLoop();
11807
- setTimeout(function () {
11808
- return s.slideTo(s.activeIndex + 1, speed, runCallbacks, internal);
11809
- }, 0);
11907
+ var clientLeft = s.container[0].clientLeft;
11908
+ return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
11810
11909
  }
11811
11910
  else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
11812
11911
  };
@@ -11817,9 +11916,8 @@
11817
11916
  if (s.params.loop) {
11818
11917
  if (s.animating) return false;
11819
11918
  s.fixLoop();
11820
- setTimeout(function () {
11821
- return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
11822
- }, 0);
11919
+ var clientLeft = s.container[0].clientLeft;
11920
+ return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
11823
11921
  }
11824
11922
  else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
11825
11923
  };
@@ -11996,7 +12094,7 @@
11996
12094
  s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
11997
12095
  }
11998
12096
  };
11999
- s.deleteLoop = function () {
12097
+ s.destroyLoop = function () {
12000
12098
  s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
12001
12099
  };
12002
12100
  s.fixLoop = function () {
@@ -12015,11 +12113,11 @@
12015
12113
  }
12016
12114
  };
12017
12115
  /*=========================
12018
- Append/Prepend Slides
12116
+ Append/Prepend/Remove Slides
12019
12117
  ===========================*/
12020
12118
  s.appendSlide = function (slides) {
12021
12119
  if (s.params.loop) {
12022
- s.deleteLoop();
12120
+ s.destroyLoop();
12023
12121
  }
12024
12122
  if (typeof slides === 'object' && slides.length) {
12025
12123
  for (var i = 0; i < slides.length; i++) {
@@ -12033,12 +12131,12 @@
12033
12131
  s.createLoop();
12034
12132
  }
12035
12133
  if (!(s.params.observer && s.support.observer)) {
12036
- s.update();
12134
+ s.update(true);
12037
12135
  }
12038
12136
  };
12039
12137
  s.prependSlide = function (slides) {
12040
12138
  if (s.params.loop) {
12041
- s.deleteLoop();
12139
+ s.destroyLoop();
12042
12140
  }
12043
12141
  var newActiveIndex = s.activeIndex + 1;
12044
12142
  if (typeof slides === 'object' && slides.length) {
@@ -12054,10 +12152,43 @@
12054
12152
  s.createLoop();
12055
12153
  }
12056
12154
  if (!(s.params.observer && s.support.observer)) {
12057
- s.update();
12155
+ s.update(true);
12156
+ }
12157
+ s.slideTo(newActiveIndex, 0, false);
12158
+ };
12159
+ s.removeSlide = function (slidesIndexes) {
12160
+ if (s.params.loop) {
12161
+ s.destroyLoop();
12162
+ }
12163
+ var newActiveIndex = s.activeIndex,
12164
+ indexToRemove;
12165
+ if (typeof slidesIndexes === 'object' && slidesIndexes.length) {
12166
+ for (var i = 0; i < slidesIndexes.length; i++) {
12167
+ indexToRemove = slidesIndexes[i];
12168
+ if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
12169
+ if (indexToRemove < newActiveIndex) newActiveIndex--;
12170
+ }
12171
+ newActiveIndex = Math.max(newActiveIndex, 0);
12172
+ }
12173
+ else {
12174
+ indexToRemove = slidesIndexes;
12175
+ if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
12176
+ if (indexToRemove < newActiveIndex) newActiveIndex--;
12177
+ newActiveIndex = Math.max(newActiveIndex, 0);
12178
+ }
12179
+
12180
+ if (!(s.params.observer && s.support.observer)) {
12181
+ s.update(true);
12058
12182
  }
12059
12183
  s.slideTo(newActiveIndex, 0, false);
12060
12184
  };
12185
+ s.removeAllSlides = function () {
12186
+ var slidesIndexes = [];
12187
+ for (var i = 0; i < s.slides.length; i++) {
12188
+ slidesIndexes.push(i);
12189
+ }
12190
+ s.removeSlide(slidesIndexes);
12191
+ };
12061
12192
 
12062
12193
 
12063
12194
  /*=========================
@@ -12110,9 +12241,13 @@
12110
12241
  for (var i = 0; i < s.slides.length; i++) {
12111
12242
  var slide = s.slides.eq(i);
12112
12243
  var slideAngle = i * 90;
12244
+ var round = Math.floor(slideAngle / 360);
12245
+ if (s.rtl) {
12246
+ slideAngle = -slideAngle;
12247
+ round = Math.floor(-slideAngle / 360);
12248
+ }
12113
12249
  var progress = Math.max(Math.min(slide[0].progress, 1), -1);
12114
12250
  var tx = 0, ty = 0, tz = 0;
12115
- var round = Math.floor(slideAngle / 360);
12116
12251
  if (i % 4 === 0) {
12117
12252
  tx = - round * 4 * s.size;
12118
12253
  tz = 0;
@@ -12129,6 +12264,10 @@
12129
12264
  tx = - s.size;
12130
12265
  tz = 3 * s.size + s.size * 4 * round;
12131
12266
  }
12267
+ if (s.rtl) {
12268
+ tx = -tx;
12269
+ }
12270
+
12132
12271
  if (!isH()) {
12133
12272
  ty = tx;
12134
12273
  tx = 0;
@@ -12137,6 +12276,7 @@
12137
12276
  var transform = 'rotateX(' + (isH() ? 0 : -slideAngle) + 'deg) rotateY(' + (isH() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
12138
12277
  if (progress <= 1 && progress > -1) {
12139
12278
  wrapperRotate = i * 90 + progress * 90;
12279
+ if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
12140
12280
  }
12141
12281
  slide.transform(transform);
12142
12282
  if (s.params.cube.slideShadows) {
@@ -12251,7 +12391,7 @@
12251
12391
  Scrollbar
12252
12392
  ===========================*/
12253
12393
  s.scrollbar = {
12254
- init: function () {
12394
+ set: function () {
12255
12395
  if (!s.params.scrollbar) return;
12256
12396
  var sb = s.scrollbar;
12257
12397
  sb.track = $(s.params.scrollbar);
@@ -12394,17 +12534,17 @@
12394
12534
  s.updateSlidesSize();
12395
12535
  s.updatePagination();
12396
12536
  if (s.params.scrollbar && s.scrollbar) {
12397
- s.scrollbar.init();
12537
+ s.scrollbar.set();
12398
12538
  }
12399
12539
  if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
12400
12540
  if (!s.params.loop) s.updateProgress();
12401
12541
  s.effects[s.params.effect].setTranslate();
12402
12542
  }
12403
12543
  if (s.params.loop) {
12404
- s.slideTo(s.params.initialSlide + s.loopedSlides, 0, false);
12544
+ s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
12405
12545
  }
12406
12546
  else {
12407
- s.slideTo(s.params.initialSlide, 0, false);
12547
+ s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
12408
12548
  }
12409
12549
  s.attachEvents();
12410
12550
  if (s.params.observer && s.support.observer) {
@@ -12425,6 +12565,7 @@
12425
12565
  if (s.params.hashnav) {
12426
12566
  if (s.hashnav) s.hashnav.init();
12427
12567
  }
12568
+ if (s.params.onInit) s.params.onInit(s);
12428
12569
  };
12429
12570
 
12430
12571
  // Destroy
@@ -12432,10 +12573,10 @@
12432
12573
  s.detachEvents();
12433
12574
  s.disconnectObservers();
12434
12575
  if (s.params.keyboardControl) {
12435
- if (s.disableKeyboard) s.disableKeyboard();
12576
+ if (s.disableKeyboardControl) s.disableKeyboardControl();
12436
12577
  }
12437
12578
  if (s.params.mousewheelControl) {
12438
- if (s.disableMousewheel) s.disableMousewheel();
12579
+ if (s.disableMousewheelControl) s.disableMousewheelControl();
12439
12580
  }
12440
12581
  if (s.params.onDestroy) s.params.onDestroy();
12441
12582
  if (deleteInstance !== false) s = null;
@@ -12477,7 +12618,7 @@
12477
12618
 
12478
12619
  flexbox: (function () {
12479
12620
  var div = document.createElement('div').style;
12480
- var styles = ('WebkitBox msFlexbox MsFlexbox WebkitFlex MozBox fles').split(' ');
12621
+ var styles = ('WebkitBox msFlexbox MsFlexbox WebkitFlex MozBox flex').split(' ');
12481
12622
  for (var i = 0; i < styles.length; i++) {
12482
12623
  if (styles[i] in div) return true;
12483
12624
  }