bootstrap-slider-rails 9.7.0 → 9.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5f243169d633dd82915c568e48cab67eb8851f1
4
- data.tar.gz: 555a8610851458596e14ece0056414ee1824a945
3
+ metadata.gz: de07875d169d068b9ae5663bc3480b783a7b0f05
4
+ data.tar.gz: 8e9ccb27822b1d218354f59df3cdc1d039ba21fc
5
5
  SHA512:
6
- metadata.gz: 9cf33150dd82c50e3e84664cc832085a77f99ada4fb94d3977dd89dbfc4bf4720eaf338054e7e2d4b9434f6612d727628cb5ef5f808a3a1262e1f15db9f48390
7
- data.tar.gz: 2ec50f159871cae3f206190548965a27d55168a0e1951178e070809ff350f9d9cad407622bb67dabc19a53b49c27c97358ac608e3f37c517dd0f49a1d01e2061
6
+ metadata.gz: 496116b305bc13d8488958a33da9fbcb8e5a20027aba690d471be8cd1d5333431ba48cdedf69150d029a2efff53d4512b7c47612b1e2e8a329ee717f5e806f44
7
+ data.tar.gz: 9f23e5316abb908da020d3d53d8425d65feba8c3cc1acb1b9a42ecf93066405840bc659471484fde4938160e2681d525998e28cbdd460fd41df37e425ac55b9c
@@ -1,5 +1,5 @@
1
1
  module BootstrapSlider
2
2
  module Rails
3
- VERSION = '9.7.0'
3
+ VERSION = '9.8.0'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*! =======================================================
2
- VERSION 9.7.0
2
+ VERSION 9.8.0
3
3
  ========================================================= */
4
4
  "use strict";
5
5
 
@@ -460,12 +460,12 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
460
460
 
461
461
  /* Create highlight range elements */
462
462
  this.rangeHighlightElements = [];
463
- if (Array.isArray(this.options.rangeHighlights) && this.options.rangeHighlights.length > 0) {
464
- for (var j = 0; j < this.options.rangeHighlights.length; j++) {
465
-
463
+ var rangeHighlightsOpts = this.options.rangeHighlights;
464
+ if (Array.isArray(rangeHighlightsOpts) && rangeHighlightsOpts.length > 0) {
465
+ for (var j = 0; j < rangeHighlightsOpts.length; j++) {
466
466
  var rangeHighlightElement = document.createElement("div");
467
- rangeHighlightElement.className = "slider-rangeHighlight slider-selection";
468
-
467
+ var customClassString = rangeHighlightsOpts[j].class || "";
468
+ rangeHighlightElement.className = "slider-rangeHighlight slider-selection " + customClassString;
469
469
  this.rangeHighlightElements.push(rangeHighlightElement);
470
470
  sliderTrack.appendChild(rangeHighlightElement);
471
471
  }
@@ -1527,8 +1527,13 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1527
1527
  }
1528
1528
 
1529
1529
  var val = this._state.value[handleIdx] + dir * this.options.step;
1530
+ var percentage = val / this.options.max * 100;
1531
+ this._state.keyCtrl = handleIdx;
1530
1532
  if (this.options.range) {
1531
- val = [!handleIdx ? val : this._state.value[0], handleIdx ? val : this._state.value[1]];
1533
+ this._adjustPercentageForRangeSliders(percentage);
1534
+ var val1 = !this._state.keyCtrl ? val : this._state.value[0];
1535
+ var val2 = this._state.keyCtrl ? val : this._state.value[1];
1536
+ val = [val1, val2];
1532
1537
  }
1533
1538
 
1534
1539
  this._trigger('slideStart', val);
@@ -1540,6 +1545,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1540
1545
  this._layout();
1541
1546
 
1542
1547
  this._pauseEvent(ev);
1548
+ delete this._state.keyCtrl;
1543
1549
 
1544
1550
  return false;
1545
1551
  },
@@ -1600,6 +1606,14 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1600
1606
  } else if (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) {
1601
1607
  this._state.percentage[1] = this._state.percentage[0];
1602
1608
  this._state.dragged = 0;
1609
+ } else if (this._state.keyCtrl === 0 && this._state.value[1] / this.options.max * 100 < percentage) {
1610
+ this._state.percentage[0] = this._state.percentage[1];
1611
+ this._state.keyCtrl = 1;
1612
+ this.handle2.focus();
1613
+ } else if (this._state.keyCtrl === 1 && this._state.value[0] / this.options.max * 100 > percentage) {
1614
+ this._state.percentage[1] = this._state.percentage[0];
1615
+ this._state.keyCtrl = 0;
1616
+ this.handle1.focus();
1603
1617
  }
1604
1618
  }
1605
1619
  },
@@ -1863,26 +1877,24 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1863
1877
  /*********************************
1864
1878
  Attach to global namespace
1865
1879
  *********************************/
1866
- if ($) {
1867
- (function () {
1868
- var autoRegisterNamespace = void 0;
1880
+ if ($ && $.fn) {
1881
+ var autoRegisterNamespace = void 0;
1869
1882
 
1870
- if (!$.fn.slider) {
1871
- $.bridget(NAMESPACE_MAIN, Slider);
1872
- autoRegisterNamespace = NAMESPACE_MAIN;
1873
- } else {
1874
- if (windowIsDefined) {
1875
- window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead.");
1876
- }
1877
- autoRegisterNamespace = NAMESPACE_ALTERNATE;
1883
+ if (!$.fn.slider) {
1884
+ $.bridget(NAMESPACE_MAIN, Slider);
1885
+ autoRegisterNamespace = NAMESPACE_MAIN;
1886
+ } else {
1887
+ if (windowIsDefined) {
1888
+ window.console.warn("bootstrap-slider.js - WARNING: $.fn.slider namespace is already bound. Use the $.fn.bootstrapSlider namespace instead.");
1878
1889
  }
1879
- $.bridget(NAMESPACE_ALTERNATE, Slider);
1890
+ autoRegisterNamespace = NAMESPACE_ALTERNATE;
1891
+ }
1892
+ $.bridget(NAMESPACE_ALTERNATE, Slider);
1880
1893
 
1881
- // Auto-Register data-provide="slider" Elements
1882
- $(function () {
1883
- $("input[data-provide=slider]")[autoRegisterNamespace]();
1884
- });
1885
- })();
1894
+ // Auto-Register data-provide="slider" Elements
1895
+ $(function () {
1896
+ $("input[data-provide=slider]")[autoRegisterNamespace]();
1897
+ });
1886
1898
  }
1887
1899
  })($);
1888
1900
 
@@ -1,5 +1,5 @@
1
1
  /*! =======================================================
2
- VERSION 9.7.0
2
+ VERSION 9.8.0
3
3
  ========================================================= */
4
4
  /*! =========================================================
5
5
  * bootstrap-slider.js
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-slider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.7.0
4
+ version: 9.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedr Browne