perfect-scrollbar-rails 0.6.12 → 0.6.13

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: dce95f69cd3ace153a37b46e2765ad5a517e5298
4
- data.tar.gz: a0e2c5d47c57f290e33da46af4e48a237d092803
3
+ metadata.gz: d0f3739a83bff71b323487436d28aa884c001600
4
+ data.tar.gz: 10946fd93dbafcb50a5313b1278e6fe909a47aed
5
5
  SHA512:
6
- metadata.gz: d5fa0e89c7941ee431c86a483e5fbba3d0a5962dc5450af7c428cf7d2a8e3dea664b635db1ca2858ddcca43f523e6b46a75b6ab9742253036683dfb68822900a
7
- data.tar.gz: 4ba9dcd06bf7ee961fe2bdeee516826d4a893c2350dcf21b20b71a578a66583be2cdf95d37bc71c1167c54fe55287254625ebbc46f9f56327cecb1f21027677c
6
+ metadata.gz: c7383a7daae79e76f04e3cb874d4c644efcd3b68b0ddfe194eb928e88414bab492806deb9281b5e3d192c22b1ae8f0a5f66e740fb5e61c323c1b3f57088b8aeb
7
+ data.tar.gz: 6caca1bba72ca7bda171233f52a30fd9fcc11dcf021592dc44c5af32fe02f43ad06377eb45322b941166e5edfecae1bd7885d47e1331f50af097ae64dba0d306
@@ -1,5 +1,5 @@
1
1
  module PerfectScrollbar
2
2
  module Rails
3
- VERSION = '0.6.12'
3
+ VERSION = '0.6.13'
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- /* perfect-scrollbar v0.6.12 */
1
+ /* perfect-scrollbar v0.6.13 */
2
2
  (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
3
3
  'use strict';
4
4
 
@@ -271,7 +271,7 @@ var toInt = exports.toInt = function (x) {
271
271
  };
272
272
 
273
273
  var clone = exports.clone = function (obj) {
274
- if (obj === null) {
274
+ if (!obj) {
275
275
  return null;
276
276
  } else if (obj.constructor === Array) {
277
277
  return obj.map(clone);
@@ -367,7 +367,6 @@ module.exports = {
367
367
  minScrollbarLength: null,
368
368
  scrollXMarginOffset: 0,
369
369
  scrollYMarginOffset: 0,
370
- stopPropagationOnClick: true,
371
370
  suppressScrollX: false,
372
371
  suppressScrollY: false,
373
372
  swipePropagation: true,
@@ -404,7 +403,6 @@ module.exports = function (element) {
404
403
  },{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){
405
404
  'use strict';
406
405
 
407
- var _ = require('../../lib/helper');
408
406
  var instances = require('../instances');
409
407
  var updateGeometry = require('../update-geometry');
410
408
  var updateScroll = require('../update-scroll');
@@ -415,43 +413,23 @@ function bindClickRailHandler(element, i) {
415
413
  }
416
414
  var stopPropagation = function (e) { e.stopPropagation(); };
417
415
 
418
- if (i.settings.stopPropagationOnClick) {
419
- i.event.bind(i.scrollbarY, 'click', stopPropagation);
420
- }
416
+ i.event.bind(i.scrollbarY, 'click', stopPropagation);
421
417
  i.event.bind(i.scrollbarYRail, 'click', function (e) {
422
- var halfOfScrollbarLength = _.toInt(i.scrollbarYHeight / 2);
423
- var positionTop = i.railYRatio * (e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength);
424
- var maxPositionTop = i.railYRatio * (i.railYHeight - i.scrollbarYHeight);
425
- var positionRatio = positionTop / maxPositionTop;
426
-
427
- if (positionRatio < 0) {
428
- positionRatio = 0;
429
- } else if (positionRatio > 1) {
430
- positionRatio = 1;
431
- }
418
+ var positionTop = e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top;
419
+ var direction = positionTop > i.scrollbarYTop ? 1 : -1;
432
420
 
433
- updateScroll(element, 'top', (i.contentHeight - i.containerHeight) * positionRatio);
421
+ updateScroll(element, 'top', element.scrollTop + direction * i.containerHeight);
434
422
  updateGeometry(element);
435
423
 
436
424
  e.stopPropagation();
437
425
  });
438
426
 
439
- if (i.settings.stopPropagationOnClick) {
440
- i.event.bind(i.scrollbarX, 'click', stopPropagation);
441
- }
427
+ i.event.bind(i.scrollbarX, 'click', stopPropagation);
442
428
  i.event.bind(i.scrollbarXRail, 'click', function (e) {
443
- var halfOfScrollbarLength = _.toInt(i.scrollbarXWidth / 2);
444
- var positionLeft = i.railXRatio * (e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength);
445
- var maxPositionLeft = i.railXRatio * (i.railXWidth - i.scrollbarXWidth);
446
- var positionRatio = positionLeft / maxPositionLeft;
447
-
448
- if (positionRatio < 0) {
449
- positionRatio = 0;
450
- } else if (positionRatio > 1) {
451
- positionRatio = 1;
452
- }
429
+ var positionLeft = e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left;
430
+ var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;
453
431
 
454
- updateScroll(element, 'left', ((i.contentWidth - i.containerWidth) * positionRatio) - i.negativeScrollAdjustment);
432
+ updateScroll(element, 'left', element.scrollLeft + direction * i.containerWidth);
455
433
  updateGeometry(element);
456
434
 
457
435
  e.stopPropagation();
@@ -463,7 +441,7 @@ module.exports = function (element) {
463
441
  bindClickRailHandler(element, i);
464
442
  };
465
443
 
466
- },{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){
444
+ },{"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){
467
445
  'use strict';
468
446
 
469
447
  var _ = require('../../lib/helper');
@@ -642,16 +620,40 @@ function bindKeyboardHandler(element, i) {
642
620
 
643
621
  switch (e.which) {
644
622
  case 37: // left
645
- deltaX = -30;
623
+ if (e.metaKey) {
624
+ deltaX = -i.contentWidth;
625
+ } else if (e.altKey) {
626
+ deltaX = -i.containerWidth;
627
+ } else {
628
+ deltaX = -30;
629
+ }
646
630
  break;
647
631
  case 38: // up
648
- deltaY = 30;
632
+ if (e.metaKey) {
633
+ deltaY = i.contentHeight;
634
+ } else if (e.altKey) {
635
+ deltaY = i.containerHeight;
636
+ } else {
637
+ deltaY = 30;
638
+ }
649
639
  break;
650
640
  case 39: // right
651
- deltaX = 30;
641
+ if (e.metaKey) {
642
+ deltaX = i.contentWidth;
643
+ } else if (e.altKey) {
644
+ deltaX = i.containerWidth;
645
+ } else {
646
+ deltaX = 30;
647
+ }
652
648
  break;
653
649
  case 40: // down
654
- deltaY = -30;
650
+ if (e.metaKey) {
651
+ deltaY = -i.contentHeight;
652
+ } else if (e.altKey) {
653
+ deltaY = -i.containerHeight;
654
+ } else {
655
+ deltaY = -30;
656
+ }
655
657
  break;
656
658
  case 33: // page up
657
659
  deltaY = 90;
@@ -755,13 +757,18 @@ function bindMouseWheelHandler(element, i) {
755
757
  deltaY = e.wheelDelta;
756
758
  }
757
759
 
760
+ if (e.shiftKey) {
761
+ // reverse axis with shift key
762
+ return [-deltaY, -deltaX];
763
+ }
758
764
  return [deltaX, deltaY];
759
765
  }
760
766
 
761
767
  function shouldBeConsumedByChild(deltaX, deltaY) {
762
768
  var child = element.querySelector('textarea:hover, select[multiple]:hover, .ps-child:hover');
763
769
  if (child) {
764
- if (child.tagName !== 'TEXTAREA' && !window.getComputedStyle(child).overflow.match(/(scroll|auto)/)) {
770
+ if (!window.getComputedStyle(child).overflow.match(/(scroll|auto)/)) {
771
+ // if not scrollable
765
772
  return false;
766
773
  }
767
774
 
@@ -913,6 +920,12 @@ function bindSelectionHandler(element, i) {
913
920
  stopScrolling();
914
921
  }
915
922
  });
923
+ i.event.bind(window, 'keyup', function () {
924
+ if (isSelected) {
925
+ isSelected = false;
926
+ stopScrolling();
927
+ }
928
+ });
916
929
 
917
930
  i.event.bind(window, 'mousemove', function (e) {
918
931
  if (isSelected) {
@@ -1097,6 +1110,11 @@ function bindTouchHandler(element, i, supportsTouch, supportsIePointer) {
1097
1110
  return;
1098
1111
  }
1099
1112
 
1113
+ if (!speed.x && !speed.y) {
1114
+ clearInterval(easingLoop);
1115
+ return;
1116
+ }
1117
+
1100
1118
  if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
1101
1119
  clearInterval(easingLoop);
1102
1120
  return;
@@ -1425,29 +1443,14 @@ module.exports = function (element) {
1425
1443
 
1426
1444
  var instances = require('./instances');
1427
1445
 
1428
- var upEvent = document.createEvent('Event');
1429
- var downEvent = document.createEvent('Event');
1430
- var leftEvent = document.createEvent('Event');
1431
- var rightEvent = document.createEvent('Event');
1432
- var yEvent = document.createEvent('Event');
1433
- var xEvent = document.createEvent('Event');
1434
- var xStartEvent = document.createEvent('Event');
1435
- var xEndEvent = document.createEvent('Event');
1436
- var yStartEvent = document.createEvent('Event');
1437
- var yEndEvent = document.createEvent('Event');
1438
1446
  var lastTop;
1439
1447
  var lastLeft;
1440
1448
 
1441
- upEvent.initEvent('ps-scroll-up', true, true);
1442
- downEvent.initEvent('ps-scroll-down', true, true);
1443
- leftEvent.initEvent('ps-scroll-left', true, true);
1444
- rightEvent.initEvent('ps-scroll-right', true, true);
1445
- yEvent.initEvent('ps-scroll-y', true, true);
1446
- xEvent.initEvent('ps-scroll-x', true, true);
1447
- xStartEvent.initEvent('ps-x-reach-start', true, true);
1448
- xEndEvent.initEvent('ps-x-reach-end', true, true);
1449
- yStartEvent.initEvent('ps-y-reach-start', true, true);
1450
- yEndEvent.initEvent('ps-y-reach-end', true, true);
1449
+ var createDOMEvent = function (name) {
1450
+ var event = document.createEvent("Event");
1451
+ event.initEvent(name, true, true);
1452
+ return event;
1453
+ };
1451
1454
 
1452
1455
  module.exports = function (element, axis, value) {
1453
1456
  if (typeof element === 'undefined') {
@@ -1464,12 +1467,12 @@ module.exports = function (element, axis, value) {
1464
1467
 
1465
1468
  if (axis === 'top' && value <= 0) {
1466
1469
  element.scrollTop = value = 0; // don't allow negative scroll
1467
- element.dispatchEvent(yStartEvent);
1470
+ element.dispatchEvent(createDOMEvent('ps-y-reach-start'));
1468
1471
  }
1469
1472
 
1470
1473
  if (axis === 'left' && value <= 0) {
1471
1474
  element.scrollLeft = value = 0; // don't allow negative scroll
1472
- element.dispatchEvent(xStartEvent);
1475
+ element.dispatchEvent(createDOMEvent('ps-x-reach-start'));
1473
1476
  }
1474
1477
 
1475
1478
  var i = instances.get(element);
@@ -1483,7 +1486,7 @@ module.exports = function (element, axis, value) {
1483
1486
  } else {
1484
1487
  element.scrollTop = value;
1485
1488
  }
1486
- element.dispatchEvent(yEndEvent);
1489
+ element.dispatchEvent(createDOMEvent('ps-y-reach-end'));
1487
1490
  }
1488
1491
 
1489
1492
  if (axis === 'left' && value >= i.contentWidth - i.containerWidth) {
@@ -1495,7 +1498,7 @@ module.exports = function (element, axis, value) {
1495
1498
  } else {
1496
1499
  element.scrollLeft = value;
1497
1500
  }
1498
- element.dispatchEvent(xEndEvent);
1501
+ element.dispatchEvent(createDOMEvent('ps-x-reach-end'));
1499
1502
  }
1500
1503
 
1501
1504
  if (!lastTop) {
@@ -1507,29 +1510,29 @@ module.exports = function (element, axis, value) {
1507
1510
  }
1508
1511
 
1509
1512
  if (axis === 'top' && value < lastTop) {
1510
- element.dispatchEvent(upEvent);
1513
+ element.dispatchEvent(createDOMEvent('ps-scroll-up'));
1511
1514
  }
1512
1515
 
1513
1516
  if (axis === 'top' && value > lastTop) {
1514
- element.dispatchEvent(downEvent);
1517
+ element.dispatchEvent(createDOMEvent('ps-scroll-down'));
1515
1518
  }
1516
1519
 
1517
1520
  if (axis === 'left' && value < lastLeft) {
1518
- element.dispatchEvent(leftEvent);
1521
+ element.dispatchEvent(createDOMEvent('ps-scroll-left'));
1519
1522
  }
1520
1523
 
1521
1524
  if (axis === 'left' && value > lastLeft) {
1522
- element.dispatchEvent(rightEvent);
1525
+ element.dispatchEvent(createDOMEvent('ps-scroll-right'));
1523
1526
  }
1524
1527
 
1525
1528
  if (axis === 'top') {
1526
1529
  element.scrollTop = lastTop = value;
1527
- element.dispatchEvent(yEvent);
1530
+ element.dispatchEvent(createDOMEvent('ps-scroll-y'));
1528
1531
  }
1529
1532
 
1530
1533
  if (axis === 'left') {
1531
1534
  element.scrollLeft = lastLeft = value;
1532
- element.dispatchEvent(xEvent);
1535
+ element.dispatchEvent(createDOMEvent('ps-scroll-x'));
1533
1536
  }
1534
1537
 
1535
1538
  };
@@ -1,7 +1,7 @@
1
- /* perfect-scrollbar v0.6.12 */
1
+ /* perfect-scrollbar v0.6.13 */
2
2
  .ps-container {
3
- -ms-touch-action: none;
4
- touch-action: none;
3
+ -ms-touch-action: auto;
4
+ touch-action: auto;
5
5
  overflow: hidden !important;
6
6
  -ms-overflow-style: none; }
7
7
  @supports (-ms-overflow-style: none) {
@@ -14,26 +14,26 @@
14
14
  .ps-container.ps-active-y > .ps-scrollbar-y-rail {
15
15
  display: block;
16
16
  background-color: transparent; }
17
- .ps-container.ps-in-scrolling {
18
- pointer-events: none; }
19
- .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
20
- background-color: #eee;
21
- opacity: 0.9; }
22
- .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
23
- background-color: #999; }
24
- .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
25
- background-color: #eee;
26
- opacity: 0.9; }
27
- .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
28
- background-color: #999; }
17
+ .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
18
+ background-color: #eee;
19
+ opacity: 0.9; }
20
+ .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
21
+ background-color: #999;
22
+ height: 11px; }
23
+ .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
24
+ background-color: #eee;
25
+ opacity: 0.9; }
26
+ .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
27
+ background-color: #999;
28
+ width: 11px; }
29
29
  .ps-container > .ps-scrollbar-x-rail {
30
30
  display: none;
31
31
  position: absolute;
32
32
  /* please don't change 'position' */
33
33
  opacity: 0;
34
34
  -webkit-transition: background-color .2s linear, opacity .2s linear;
35
- -moz-transition: background-color .2s linear, opacity .2s linear;
36
35
  -o-transition: background-color .2s linear, opacity .2s linear;
36
+ -moz-transition: background-color .2s linear, opacity .2s linear;
37
37
  transition: background-color .2s linear, opacity .2s linear;
38
38
  bottom: 0px;
39
39
  /* there must be 'bottom' for ps-scrollbar-x-rail */
@@ -47,8 +47,8 @@
47
47
  border-radius: 6px;
48
48
  -webkit-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
49
49
  transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
50
- -moz-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
51
50
  -o-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
51
+ -moz-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
52
52
  transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
53
53
  transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
54
54
  bottom: 2px;
@@ -62,8 +62,8 @@
62
62
  /* please don't change 'position' */
63
63
  opacity: 0;
64
64
  -webkit-transition: background-color .2s linear, opacity .2s linear;
65
- -moz-transition: background-color .2s linear, opacity .2s linear;
66
65
  -o-transition: background-color .2s linear, opacity .2s linear;
66
+ -moz-transition: background-color .2s linear, opacity .2s linear;
67
67
  transition: background-color .2s linear, opacity .2s linear;
68
68
  right: 0;
69
69
  /* there must be 'right' for ps-scrollbar-y-rail */
@@ -77,8 +77,8 @@
77
77
  border-radius: 6px;
78
78
  -webkit-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
79
79
  transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
80
- -moz-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
81
80
  -o-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
81
+ -moz-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
82
82
  transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
83
83
  transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
84
84
  right: 2px;
@@ -86,18 +86,18 @@
86
86
  width: 6px; }
87
87
  .ps-container > .ps-scrollbar-y-rail:hover > .ps-scrollbar-y, .ps-container > .ps-scrollbar-y-rail:active > .ps-scrollbar-y {
88
88
  width: 11px; }
89
- .ps-container:hover.ps-in-scrolling {
90
- pointer-events: none; }
91
- .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
92
- background-color: #eee;
93
- opacity: 0.9; }
94
- .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
95
- background-color: #999; }
96
- .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
97
- background-color: #eee;
98
- opacity: 0.9; }
99
- .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
100
- background-color: #999; }
89
+ .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
90
+ background-color: #eee;
91
+ opacity: 0.9; }
92
+ .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
93
+ background-color: #999;
94
+ height: 11px; }
95
+ .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
96
+ background-color: #eee;
97
+ opacity: 0.9; }
98
+ .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
99
+ background-color: #999;
100
+ width: 11px; }
101
101
  .ps-container:hover > .ps-scrollbar-x-rail,
102
102
  .ps-container:hover > .ps-scrollbar-y-rail {
103
103
  opacity: 0.6; }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfect-scrollbar-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Hain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2016-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.6.6
100
+ rubygems_version: 2.6.8
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: This Gem integrates noraesae's Jquery perfect-scrollbar with Rails, exposing