vendor/assets/javascripts/perfect-scrollbar.js in perfect-scrollbar-rails-0.6.8.1 vs vendor/assets/javascripts/perfect-scrollbar.js in perfect-scrollbar-rails-0.6.9
- old
+ new
@@ -1,10 +1,7 @@
-/* perfect-scrollbar v0.6.8 */
+/* perfect-scrollbar v0.6.9 */
(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){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var ps = require('../main')
, psInstances = require('../plugin/instances');
@@ -46,13 +43,10 @@
}
module.exports = mountJQuery;
},{"../main":7,"../plugin/instances":18}],2:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
function oldAdd(element, className) {
var classes = element.className.split(' ');
if (classes.indexOf(className) < 0) {
@@ -93,13 +87,10 @@
return element.className.split(' ');
}
};
},{}],3:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var DOM = {};
DOM.e = function (tagName, className) {
@@ -182,13 +173,10 @@
};
module.exports = DOM;
},{}],4:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var EventElement = function (element) {
this.element = element;
this.events = {};
@@ -258,13 +246,10 @@
};
module.exports = EventManager;
},{}],5:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
module.exports = (function () {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
@@ -276,13 +261,10 @@
s4() + '-' + s4() + s4() + s4();
};
})();
},{}],6:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var cls = require('./class')
, d = require('./dom');
@@ -362,13 +344,10 @@
supportsTouch: (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch),
supportsIePointer: window.navigator.msMaxTouchPoints !== null
};
},{"./class":2,"./dom":3}],7:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var destroy = require('./plugin/destroy')
, initialize = require('./plugin/initialize')
, update = require('./plugin/update');
@@ -378,13 +357,10 @@
update: update,
destroy: destroy
};
},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":21}],8:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
module.exports = {
maxScrollbarLength: null,
minScrollbarLength: null,
@@ -396,17 +372,15 @@
swipePropagation: true,
useBothWheelAxes: false,
useKeyboard: true,
useSelectionScroll: false,
wheelPropagation: false,
- wheelSpeed: 1
+ wheelSpeed: 1,
+ theme: 'default'
};
},{}],9:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var d = require('../lib/dom')
, h = require('../lib/helper')
, instances = require('./instances');
@@ -427,13 +401,10 @@
instances.remove(element);
};
},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var h = require('../../lib/helper')
, instances = require('../instances')
, updateGeometry = require('../update-geometry')
@@ -492,13 +463,10 @@
var i = instances.get(element);
bindClickRailHandler(element, i);
};
},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var d = require('../../lib/dom')
, h = require('../../lib/helper')
, instances = require('../instances')
@@ -600,16 +568,14 @@
bindMouseScrollXHandler(element, i);
bindMouseScrollYHandler(element, i);
};
},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],12:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var h = require('../../lib/helper')
+ , d = require('../../lib/dom')
, instances = require('../instances')
, updateGeometry = require('../update-geometry')
, updateScroll = require('../update-scroll');
function bindKeyboardHandler(element, i) {
@@ -648,11 +614,14 @@
i.event.bind(i.ownerDocument, 'keydown', function (e) {
if (e.isDefaultPrevented && e.isDefaultPrevented()) {
return;
}
- if (!hovered) {
+ var focused = d.matches(i.scrollbarX, ':focus') ||
+ d.matches(i.scrollbarY, ':focus');
+
+ if (!hovered && !focused) {
return;
}
var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;
if (activeElement) {
@@ -726,14 +695,11 @@
module.exports = function (element) {
var i = instances.get(element);
bindKeyboardHandler(element, i);
};
-},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
+},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(require,module,exports){
'use strict';
var instances = require('../instances')
, updateGeometry = require('../update-geometry')
, updateScroll = require('../update-scroll');
@@ -866,13 +832,10 @@
var i = instances.get(element);
bindMouseWheelHandler(element, i);
};
},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],14:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var instances = require('../instances')
, updateGeometry = require('../update-geometry');
@@ -886,13 +849,10 @@
var i = instances.get(element);
bindNativeScrollHandler(element, i);
};
},{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var h = require('../../lib/helper')
, instances = require('../instances')
, updateGeometry = require('../update-geometry')
@@ -1000,13 +960,10 @@
var i = instances.get(element);
bindSelectionHandler(element, i);
};
},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],16:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var instances = require('../instances')
, updateGeometry = require('../update-geometry')
, updateScroll = require('../update-scroll');
@@ -1173,13 +1130,10 @@
var i = instances.get(element);
bindTouchHandler(element, i, supportsTouch, supportsIePointer);
};
},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],17:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var cls = require('../lib/class')
, h = require('../lib/helper')
, instances = require('./instances')
@@ -1201,10 +1155,11 @@
// Create a plugin instance.
var i = instances.add(element);
i.settings = h.extend(i.settings, userSettings);
+ cls.add(element, 'ps-theme-' + i.settings.theme);
clickRailHandler(element);
dragScrollbarHandler(element);
mouseWheelHandler(element);
nativeScrollHandler(element);
@@ -1222,16 +1177,14 @@
updateGeometry(element);
};
},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
-var d = require('../lib/dom')
+var cls = require('../lib/class')
+ , d = require('../lib/dom')
, defaultSettings = require('./default-setting')
, EventManager = require('../lib/event-manager')
, guid = require('../lib/guid')
, h = require('../lib/helper');
@@ -1257,13 +1210,23 @@
})();
i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0;
i.event = new EventManager();
i.ownerDocument = element.ownerDocument || document;
+ function focus() {
+ cls.add(element, 'ps-focus');
+ }
+
+ function blur() {
+ cls.remove(element, 'ps-focus');
+ }
+
i.scrollbarXRail = d.appendTo(d.e('div', 'ps-scrollbar-x-rail'), element);
i.scrollbarX = d.appendTo(d.e('div', 'ps-scrollbar-x'), i.scrollbarXRail);
i.scrollbarX.setAttribute('tabindex', 0);
+ i.event.bind(i.scrollbarX, 'focus', focus);
+ i.event.bind(i.scrollbarX, 'blur', blur);
i.scrollbarXActive = null;
i.scrollbarXWidth = null;
i.scrollbarXLeft = null;
i.scrollbarXBottom = h.toInt(d.css(i.scrollbarXRail, 'bottom'));
i.isScrollbarXUsingBottom = i.scrollbarXBottom === i.scrollbarXBottom; // !isNaN
@@ -1277,10 +1240,12 @@
i.railXRatio = null;
i.scrollbarYRail = d.appendTo(d.e('div', 'ps-scrollbar-y-rail'), element);
i.scrollbarY = d.appendTo(d.e('div', 'ps-scrollbar-y'), i.scrollbarYRail);
i.scrollbarY.setAttribute('tabindex', 0);
+ i.event.bind(i.scrollbarY, 'focus', focus);
+ i.event.bind(i.scrollbarY, 'blur', blur);
i.scrollbarYActive = null;
i.scrollbarYHeight = null;
i.scrollbarYTop = null;
i.scrollbarYRight = h.toInt(d.css(i.scrollbarYRail, 'right'));
i.isScrollbarYUsingRight = i.scrollbarYRight === i.scrollbarYRight; // !isNaN
@@ -1332,14 +1297,11 @@
exports.get = function (element) {
return instances[getId(element)];
};
-},{"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
+},{"../lib/class":2,"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){
'use strict';
var cls = require('../lib/class')
, d = require('../lib/dom')
, h = require('../lib/helper')
@@ -1464,13 +1426,10 @@
updateScroll(element, 'top', 0);
}
};
},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-scroll":20}],20:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var instances = require('./instances');
var upEvent = document.createEvent('Event')
@@ -1509,33 +1468,29 @@
if (typeof value === 'undefined') {
throw 'You must provide a value to the update-scroll function';
}
if (axis === 'top' && value <= 0) {
- element.scrollTop = 0;
+ element.scrollTop = value = 0; // don't allow negative scroll
element.dispatchEvent(yStartEvent);
- return; // don't allow negative scroll
}
if (axis === 'left' && value <= 0) {
- element.scrollLeft = 0;
+ element.scrollLeft = value = 0; // don't allow negative scroll
element.dispatchEvent(xStartEvent);
- return; // don't allow negative scroll
}
var i = instances.get(element);
if (axis === 'top' && value >= i.contentHeight - i.containerHeight) {
- element.scrollTop = i.contentHeight - i.containerHeight;
+ element.scrollTop = value = i.contentHeight - i.containerHeight; // don't allow scroll past container
element.dispatchEvent(yEndEvent);
- return; // don't allow scroll past container
}
if (axis === 'left' && value >= i.contentWidth - i.containerWidth) {
- element.scrollLeft = i.contentWidth - i.containerWidth;
+ element.scrollLeft = value = i.contentWidth - i.containerWidth; // don't allow scroll past container
element.dispatchEvent(xEndEvent);
- return; // don't allow scroll past container
}
if (!lastTop) {
lastTop = element.scrollTop;
}
@@ -1571,12 +1526,9 @@
}
};
},{"./instances":18}],21:[function(require,module,exports){
-/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
- * Licensed under the MIT License
- */
'use strict';
var d = require('../lib/dom')
, h = require('../lib/helper')
, instances = require('./instances')