Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baron

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baron - npm Package Compare versions

Comparing version 2.2.4 to 2.2.5

.eslintrc

1067

baron.js

@@ -1,10 +0,10 @@

(function(scopedWindow, undefined) {
'use strict';
(function(scopedWindow) {
'use strict'
var onClient = typeof window != 'undefined';
var $ = scopedWindow.$;
var _baron = baron; // Stored baron value for noConflict usage
var pos = ['left', 'top', 'right', 'bottom', 'width', 'height'];
var $ = scopedWindow.$
var _baron = baron // Stored baron value for noConflict usage
var Item = {}
var pos = ['left', 'top', 'right', 'bottom', 'width', 'height']
// Global store for all baron instances (to be able to dispose them on html-nodes)
var instances = [];
var instances = []
var origin = {

@@ -29,27 +29,28 @@ v: { // Vertical

}
};
}
// Some ugly vars
var opera12maxScrollbarSize = 17;
var opera12maxScrollbarSize = 17
// I hate you https://github.com/Diokuz/baron/issues/110
var macmsxffScrollbarSize = 15;
var macosxffRe = /[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/;
var isMacFF = macosxffRe.test(scopedWindow.navigator && scopedWindow.navigator.userAgent);
var macmsxffScrollbarSize = 15
var macosxffRe = /[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/
var isMacFF = macosxffRe.test(scopedWindow.navigator && scopedWindow.navigator.userAgent)
// removeIf(production)
var log = function() {
baron.fn.log.apply(this, arguments);
};
var liveBarons = 0;
baron.fn.log.apply(this, arguments)
}
var liveBarons = 0
var shownErrors = {
liveTooMany: false,
allTooMany: false
};
}
// endRemoveIf(production)
// window.baron and jQuery.fn.baron points to this function
function baron(params) {
var jQueryMode;
var roots;
var withParams = !!params;
function baron(user) {
var params = user
var jQueryMode
var roots
var withParams = !!params
var defaultParams = {

@@ -61,3 +62,3 @@ $: scopedWindow.jQuery,

event: function(elem, event, func, mode) {
params.$(elem)[mode || 'on'](event, func);
params.$(elem)[mode || 'on'](event, func)
},

@@ -67,5 +68,5 @@ cssGuru: false,

position: 'static'
};
}
params = params || {};
params = params || {}

@@ -75,5 +76,5 @@ // Extending default params by user-defined params

if (params[key] === undefined) {
params[key] = defaultParams[key];
params[key] = defaultParams[key]
}
};
}

@@ -85,3 +86,3 @@ // removeIf(production)

'https://github.com/Diokuz/baron/blob/master/docs/logs/no-jquery-detected.md'
].join(', '), params);
].join(', '), params)
}

@@ -93,3 +94,3 @@ if (params.position == 'absolute' && params.impact == 'clipper') {

'See more https://github.com/Diokuz/baron/issues/138'
].join(' '), params);
].join(' '), params)
}

@@ -99,31 +100,32 @@ // endRemoveIf(production)

// this - something or jQuery instance
jQueryMode = params.$ && this instanceof params.$;
jQueryMode = params.$ && this instanceof params.$
if (params._chain) {
roots = params.root;
roots = params.root
} else if (jQueryMode) {
params.root = roots = this;
params.root = roots = this
} else if (params.$) {
roots = params.$(params.root || params.scroller);
roots = params.$(params.root || params.scroller)
} else {
roots = []; // noop mode, like jQuery when no matched html-nodes found
roots = [] // noop mode, like jQuery when no matched html-nodes found
}
var instance = new baron.fn.constructor(roots, params, withParams);
var instance = new baron.fn.constructor(roots, params, withParams)
if (instance.autoUpdate) {
instance.autoUpdate();
instance.autoUpdate()
}
return instance;
return instance
}
function arrayEach(obj, iterator) {
var i = 0;
function arrayEach(_obj, iterator) {
var i = 0
var obj = _obj
if (obj.length === undefined || obj === scopedWindow) obj = [obj];
if (obj.length === undefined || obj === scopedWindow) obj = [obj]
while (obj[i]) {
iterator.call(this, obj[i], i);
i++;
iterator.call(this, obj[i], i)
i++
}

@@ -134,7 +136,7 @@ }

function getTime() {
return new Date().getTime();
return new Date().getTime()
}
// removeIf(production)
baron._instances = instances;
baron._instances = instances
// endRemoveIf(production)

@@ -144,3 +146,3 @@

constructor: function(roots, totalParams, withParams) {
var params = clone(totalParams);
var params = clone(totalParams)

@@ -150,11 +152,11 @@ // Intrinsic params.event is not the same as totalParams.event

arrayEach(elems, function(elem) {
totalParams.event(elem, e, func, mode);
});
};
totalParams.event(elem, e, func, mode)
})
}
this.length = 0;
this.length = 0
arrayEach.call(this, roots, function(root, i) {
var attr = manageAttr(root, params.direction);
var id = +attr; // Could be NaN
var attr = manageAttr(root, params.direction)
var id = +attr // Could be NaN

@@ -170,51 +172,51 @@ // baron() can return existing instances,

'https://github.com/Diokuz/baron/blob/master/docs/logs/repeated.md'
].join(', '), totalParams.root);
].join(', '), totalParams.root)
}
// endRemoveIf(production)
this[i] = instances[id];
this[i] = instances[id]
} else {
var perInstanceParams = clone(params);
var perInstanceParams = clone(params)
// root and scroller can be different nodes
if (params.root && params.scroller) {
perInstanceParams.scroller = params.$(params.scroller, root);
perInstanceParams.scroller = params.$(params.scroller, root)
if (!perInstanceParams.scroller.length) {
// removeIf(production)
console.log('Scroller not found!', root, params.scroller);
console.log('Scroller not found!', root, params.scroller)
// endRemoveIf(production)
return;
return
}
} else {
perInstanceParams.scroller = root;
perInstanceParams.scroller = root
}
perInstanceParams.root = root;
this[i] = init(perInstanceParams);
perInstanceParams.root = root
this[i] = init(perInstanceParams)
}
this.length = i + 1;
});
this.length = i + 1
})
this.params = params;
this.params = params
},
dispose: function() {
var params = this.params;
var params = this.params
arrayEach(this, function(instance, index) {
instance.dispose(params);
instances[index] = null;
});
instance.dispose(params)
instances[index] = null
})
this.params = null;
this.params = null
},
update: function() {
var args = arguments;
var args = arguments
arrayEach(this, function(instance, index) {
arrayEach(this, function(instance) {
// instance cannot be null, because it is stored by user
instance.update.apply(instance, args);
});
instance.update.apply(instance, args)
})
},

@@ -224,16 +226,16 @@

baron: function(params) {
params.root = [];
params.root = []
if (this.params.root) {
params.scroller = this.params.scroller;
params.scroller = this.params.scroller
}
arrayEach.call(this, this, function(elem) {
params.root.push(elem.root);
});
params.direction = (this.params.direction == 'v') ? 'h' : 'v';
params._chain = true;
params.root.push(elem.root)
})
params.direction = (this.params.direction == 'v') ? 'h' : 'v'
params._chain = true
return baron(params);
return baron(params)
}
};
}

@@ -248,3 +250,3 @@ function manageEvents(item, eventManager, mode) {

handler: function(e) {
item.scroll(e);
item.scroll(e)
},

@@ -258,3 +260,3 @@

handler: function() {
item.update();
item.update()
},

@@ -268,3 +270,3 @@

handler: function() {
item.update();
item.update()
},

@@ -278,7 +280,7 @@

handler: function(e) {
e.preventDefault(); // Text selection disabling in Opera
item.selection(); // Disable text selection in ie8
item.drag.now = 1; // Save private byte
e.preventDefault() // Text selection disabling in Opera
item.selection() // Disable text selection in ie8
item.drag.now = 1 // Save private byte
if (item.draggingCls) {
$(item.root).addClass(item.draggingCls);
$(item.root).addClass(item.draggingCls)
}

@@ -293,6 +295,6 @@ },

handler: function() {
item.selection(1); // Enable text selection
item.drag.now = 0;
item.selection(1) // Enable text selection
item.drag.now = 0
if (item.draggingCls) {
$(item.root).removeClass(item.draggingCls);
$(item.root).removeClass(item.draggingCls)
}

@@ -308,3 +310,3 @@ },

if (e.button != 2) { // Not RM
item._pos0(e);
item._pos0(e)
}

@@ -320,3 +322,3 @@ },

if (item.drag.now) {
item.drag(e);
item.drag(e)
}

@@ -332,3 +334,3 @@ },

handler: function() {
item.update();
item.update()
},

@@ -343,3 +345,3 @@

handler: function() {
item.update();
item.update()
},

@@ -353,3 +355,3 @@

handler: function() {
item.clipperOnScroll();
item.clipperOnScroll()
},

@@ -359,22 +361,22 @@

}
];
]
arrayEach(item._eventHandlers, function(event) {
if (event.element) {
eventManager(event.element, event.type, event.handler, mode);
eventManager(event.element, event.type, event.handler, mode)
}
});
})
// if (item.scroller) {
// event(item.scroller, 'scroll', item._eventHandlers.onScroll, mode);
// event(item.scroller, 'scroll', item._eventHandlers.onScroll, mode)
// }
// if (item.bar) {
// event(item.bar, 'touchstart mousedown', item._eventHandlers.onMouseDown, mode);
// event(item.bar, 'touchstart mousedown', item._eventHandlers.onMouseDown, mode)
// }
// event(document, 'mouseup blur touchend', item._eventHandlers.onMouseUp, mode);
// event(document, 'touchstart mousedown', item._eventHandlers.onCoordinateReset, mode);
// event(document, 'mousemove touchmove', item._eventHandlers.onMouseMove, mode);
// event(window, 'resize', item._eventHandlers.onResize, mode);
// event(document, 'mouseup blur touchend', item._eventHandlers.onMouseUp, mode)
// event(document, 'touchstart mousedown', item._eventHandlers.onCoordinateReset, mode)
// event(document, 'mousemove touchmove', item._eventHandlers.onMouseMove, mode)
// event(window, 'resize', item._eventHandlers.onResize, mode)
// if (item.root) {
// event(item.root, 'sizeChange', item._eventHandlers.onResize, mode);
// event(item.root, 'sizeChange', item._eventHandlers.onResize, mode)
// // Custon event for alternate baron update mechanism

@@ -387,11 +389,11 @@ // }

function manageAttr(node, direction, mode, id) {
var attrName = 'data-baron-' + direction + '-id';
var attrName = 'data-baron-' + direction + '-id'
if (mode == 'on') {
node.setAttribute(attrName, id);
node.setAttribute(attrName, id)
} else if (mode == 'off') {
node.removeAttribute(attrName);
} else {
return node.getAttribute(attrName);
node.removeAttribute(attrName)
}
return node.getAttribute(attrName)
}

@@ -401,11 +403,11 @@

// __proto__ of returning object is baron.prototype
var out = new item.prototype.constructor(params);
var out = new Item.prototype.constructor(params)
manageEvents(out, params.event, 'on');
manageEvents(out, params.event, 'on')
manageAttr(out.root, params.direction, 'on', instances.length);
instances.push(out);
manageAttr(out.root, params.direction, 'on', instances.length)
instances.push(out)
// removeIf(production)
liveBarons++;
liveBarons++
if (liveBarons > 100 && !shownErrors.liveTooMany) {

@@ -416,4 +418,4 @@ log('warn', [

'All baron instances can be found in baron._instances:'
].join(' '), instances);
shownErrors.liveTooMany = true;
].join(' '), instances)
shownErrors.liveTooMany = true
}

@@ -426,45 +428,31 @@ if (instances.length > 1000 && !shownErrors.allTooMany) {

'All baron instances can be found in baron._instances:'
].join(' '), instances);
shownErrors.allTooMany = true;
].join(' '), instances)
shownErrors.allTooMany = true
}
// endRemoveIf(production)
out.update();
out.update()
return out;
return out
}
function clone(input) {
var output = {};
function clone(_input) {
var output = {}
var input = _input || {}
input = input || {};
for (var key in input) {
if (input.hasOwnProperty(key)) {
output[key] = input[key];
output[key] = input[key]
}
}
return output;
return output
}
function validate(input) {
var output = clone(input);
output.event = function(elems, e, func, mode) {
arrayEach(elems, function(elem) {
input.event(elem, e, func, mode);
});
};
return output;
}
function fire(eventName) {
/* jshint validthis:true */
if (this.events && this.events[eventName]) {
for (var i = 0 ; i < this.events[eventName].length ; i++) {
var args = Array.prototype.slice.call( arguments, 1 );
for (var i = 0; i < this.events[eventName].length; i++) {
var args = Array.prototype.slice.call( arguments, 1 )
this.events[eventName][i].apply(this, args);
this.events[eventName][i].apply(this, args)
}

@@ -474,5 +462,3 @@ }

var item = {};
item.prototype = {
Item.prototype = {
// underscore.js realization

@@ -485,39 +471,39 @@ // used in autoUpdate plugin

// context, // and for context
timestamp;
// result; // and for result
timestamp
// result // and for result
var later = function() {
if (self._disposed) {
clearTimeout(timeout);
timeout = self = null;
return;
clearTimeout(timeout)
timeout = self = null
return
}
var last = getTime() - timestamp;
var last = getTime() - timestamp
if (last < wait && last >= 0) {
timeout = setTimeout(later, wait - last);
timeout = setTimeout(later, wait - last)
} else {
timeout = null;
// result = func.apply(context, args);
func();
// context = args = null;
timeout = null
// result = func.apply(context, args)
func()
// context = args = null
}
};
}
return function() {
// context = this;
// args = arguments;
timestamp = getTime();
// context = this
// args = arguments
timestamp = getTime()
if (!timeout) {
timeout = setTimeout(later, wait);
timeout = setTimeout(later, wait)
}
// return result;
};
// return result
}
},
constructor: function(params) {
var $,
var _$,
barPos,

@@ -528,50 +514,57 @@ scrollerPos0,

scrollingTimer,
scrollLastFire,
resizeLastFire,
oldBarSize;
oldBarSize
resizeLastFire = scrollLastFire = getTime();
resizeLastFire = getTime()
$ = this.$ = params.$;
this.event = params.event;
this.events = {};
_$ = this.$ = params.$
this.event = params.event
this.events = {}
function getNode(sel, context) {
return $(sel, context)[0]; // Can be undefined
return _$(sel, context)[0] // Can be undefined
}
// DOM elements
this.root = params.root; // Always html node, not just selector
this.scroller = getNode(params.scroller);
this.bar = getNode(params.bar, this.root);
track = this.track = getNode(params.track, this.root);
this.root = params.root // Always html node, not just selector
this.scroller = getNode(params.scroller)
// removeIf(production)
if (this.scroller.tagName == 'body') {
log('error', [
'Please, do not use BODY as a scroller.',
'https://github.com/Diokuz/baron/blob/master/docs/logs/do-not-use-body.md'
].join(', '), params)
}
// endRemoveIf(production)
this.bar = getNode(params.bar, this.root)
track = this.track = getNode(params.track, this.root)
if (!this.track && this.bar) {
track = this.bar.parentNode;
track = this.bar.parentNode
}
this.clipper = this.scroller.parentNode;
this.clipper = this.scroller.parentNode
// Parameters
this.direction = params.direction;
this.rtl = params.rtl;
this.origin = origin[this.direction];
this.barOnCls = params.barOnCls;
this.scrollingCls = params.scrollingCls;
this.draggingCls = params.draggingCls;
this.impact = params.impact;
this.position = params.position;
this.rtl = params.rtl;
this.barTopLimit = 0;
this.resizeDebounce = params.resizeDebounce;
this.direction = params.direction
this.rtl = params.rtl
this.origin = origin[this.direction]
this.barOnCls = params.barOnCls
this.scrollingCls = params.scrollingCls
this.draggingCls = params.draggingCls
this.impact = params.impact
this.position = params.position
this.rtl = params.rtl
this.barTopLimit = 0
this.resizeDebounce = params.resizeDebounce
// Updating height or width of bar
function setBarSize(size) {
/* jshint validthis:true */
var barMinSize = this.barMinSize || 20;
function setBarSize(_size) {
var barMinSize = this.barMinSize || 20
var size = _size
if (size > 0 && size < barMinSize) {
size = barMinSize;
size = barMinSize
}
if (this.bar) {
$(this.bar).css(this.origin.size, parseInt(size, 10) + 'px');
_$(this.bar).css(this.origin.size, parseInt(size, 10) + 'px')
}

@@ -581,10 +574,9 @@ }

// Updating top or left bar position
function posBar(pos) {
/* jshint validthis:true */
function posBar(_pos) {
if (this.bar) {
var was = $(this.bar).css(this.origin.pos),
will = +pos + 'px';
var was = _$(this.bar).css(this.origin.pos),
will = +_pos + 'px'
if (will && will != was) {
$(this.bar).css(this.origin.pos, will);
_$(this.bar).css(this.origin.pos, will)
}

@@ -596,4 +588,3 @@ }

function k() {
/* jshint validthis:true */
return track[this.origin.client] - this.barTopLimit - this.bar[this.origin.offset];
return track[this.origin.client] - this.barTopLimit - this.bar[this.origin.offset]
}

@@ -603,4 +594,3 @@

function relToPos(r) {
/* jshint validthis:true */
return r * k.call(this) + this.barTopLimit;
return r * k.call(this) + this.barTopLimit
}

@@ -610,4 +600,3 @@

function posToRel(t) {
/* jshint validthis:true */
return (t - this.barTopLimit) / k.call(this);
return (t - this.barTopLimit) / k.call(this)
}

@@ -618,8 +607,8 @@

return e['client' + this.origin.x] ||
(((e.originalEvent || e).touches || {})[0] || {})['page' + this.origin.x];
};
(((e.originalEvent || e).touches || {})[0] || {})['page' + this.origin.x]
}
// Text selection pos preventing
function dontPosSelect() {
return false;
return false
}

@@ -629,21 +618,21 @@

var ie = 'page' + this.origin.x + 'Offset',
key = (this.scroller[ie]) ? ie : this.origin.scroll;
key = (this.scroller[ie]) ? ie : this.origin.scroll
if (x !== undefined) this.scroller[key] = x;
if (x !== undefined) this.scroller[key] = x
return this.scroller[key];
};
return this.scroller[key]
}
this.rpos = function(r) { // Relative scroller position (0..1)
var free = this.scroller[this.origin.scrollSize] - this.scroller[this.origin.client],
x;
x
if (r) {
x = this.pos(r * free);
x = this.pos(r * free)
} else {
x = this.pos();
x = this.pos()
}
return x / (free || 1);
};
return x / (free || 1)
}

@@ -653,30 +642,29 @@ // Switch on the bar by adding user-defined CSS classname to scroller

if (this.barOnCls) {
if (dispose ||
this.scroller[this.origin.client] >= this.scroller[this.origin.scrollSize])
{
if ($(this.root).hasClass(this.barOnCls)) {
$(this.root).removeClass(this.barOnCls);
var noScroll = this.scroller[this.origin.client] >= this.scroller[this.origin.scrollSize]
if (dispose || noScroll) {
if (_$(this.root).hasClass(this.barOnCls)) {
_$(this.root).removeClass(this.barOnCls)
}
} else {
if (!$(this.root).hasClass(this.barOnCls)) {
$(this.root).addClass(this.barOnCls);
}
} else if (!_$(this.root).hasClass(this.barOnCls)) {
_$(this.root).addClass(this.barOnCls)
}
}
};
}
this._pos0 = function(e) {
scrollerPos0 = this.cursor(e) - barPos;
};
scrollerPos0 = this.cursor(e) - barPos
}
this.drag = function(e) {
var rel = posToRel.call(this, this.cursor(e) - scrollerPos0);
var k = (this.scroller[this.origin.scrollSize] - this.scroller[this.origin.client]);
this.scroller[this.origin.scroll] = rel * k;
};
var rel = posToRel.call(this, this.cursor(e) - scrollerPos0)
var sub = (this.scroller[this.origin.scrollSize] - this.scroller[this.origin.client])
this.scroller[this.origin.scroll] = rel * sub
}
// Text selection preventing on drag
this.selection = function(enable) {
this.event(document, 'selectpos selectstart', dontPosSelect, enable ? 'off' : 'on');
};
this.event(document, 'selectpos selectstart', dontPosSelect, enable ? 'off' : 'on')
}

@@ -687,19 +675,20 @@ // onResize & DOM modified handler

this.resize = function() {
var self = this;
var minPeriod = (self.resizeDebounce === undefined) ? 300 : self.resizeDebounce;
var delay = 0;
var self = this
var minPeriod = (self.resizeDebounce === undefined) ? 300 : self.resizeDebounce
var delay = 0
if (getTime() - resizeLastFire < minPeriod) {
clearTimeout(resizePauseTimer);
delay = minPeriod;
clearTimeout(resizePauseTimer)
delay = minPeriod
}
function upd() {
var offset = self.scroller[self.origin.crossOffset];
var client = self.scroller[self.origin.crossClient];
var padding = 0;
var offset = self.scroller[self.origin.crossOffset]
var client = self.scroller[self.origin.crossClient]
var padding = 0
var was, will
// https://github.com/Diokuz/baron/issues/110
if (isMacFF) {
padding = macmsxffScrollbarSize;
padding = macmsxffScrollbarSize

@@ -713,36 +702,36 @@ // Opera 12 bug https://github.com/Diokuz/baron/issues/105

// 17px for Windows XP-8.1, 15px for Mac (really rare).
offset = client + opera12maxScrollbarSize;
offset = client + opera12maxScrollbarSize
}
if (offset) { // if there is no size, css should not be set
self.barOn();
self.barOn()
if (self.impact == 'scroller') { // scroller
var delta = offset - client + padding;
var delta = offset - client + padding
// `static` position works only for `scroller` impact
if (self.position == 'static') { // static
var was = self.$(self.scroller).css(self.origin.crossSize);
var will = self.clipper[self.origin.crossClient] + delta + 'px';
was = self.$(self.scroller).css(self.origin.crossSize)
will = self.clipper[self.origin.crossClient] + delta + 'px'
if (was != will) {
self._setCrossSizes(self.scroller, will);
self._setCrossSizes(self.scroller, will)
}
} else { // absolute
var css = {};
var key = self.rtl ? 'Left' : 'Right';
var css = {}
var key = self.rtl ? 'Left' : 'Right'
if (self.direction == 'h') {
key = 'Bottom';
key = 'Bottom'
}
css['padding' + key] = delta + 'px';
self.$(self.scroller).css(css);
css['padding' + key] = delta + 'px'
self.$(self.scroller).css(css)
}
} else { // clipper
var was = $(self.clipper).css(self.origin.crossSize);
var will = client + 'px';
was = self.$(self.clipper).css(self.origin.crossSize)
will = client + 'px'
if (was != will) {
self._setCrossSizes(self.clipper, will);
self._setCrossSizes(self.clipper, will)
}

@@ -754,57 +743,55 @@ }

Array.prototype.unshift.call(arguments, 'resize');
fire.apply(self, arguments);
Array.prototype.unshift.call(arguments, 'resize')
fire.apply(self, arguments)
resizeLastFire = getTime();
resizeLastFire = getTime()
}
if (delay) {
resizePauseTimer = setTimeout(upd, delay);
resizePauseTimer = setTimeout(upd, delay)
} else {
upd();
upd()
}
};
}
this.updatePositions = function() {
var newBarSize,
self = this;
self = this
if (self.bar) {
newBarSize = (track[self.origin.client] - self.barTopLimit) *
self.scroller[self.origin.client] / self.scroller[self.origin.scrollSize];
self.scroller[self.origin.client] / self.scroller[self.origin.scrollSize]
// Positioning bar
if (parseInt(oldBarSize, 10) != parseInt(newBarSize, 10)) {
setBarSize.call(self, newBarSize);
oldBarSize = newBarSize;
setBarSize.call(self, newBarSize)
oldBarSize = newBarSize
}
barPos = relToPos.call(self, self.rpos());
barPos = relToPos.call(self, self.rpos())
posBar.call(self, barPos);
posBar.call(self, barPos)
}
Array.prototype.unshift.call( arguments, 'scroll' );
fire.apply(self, arguments);
Array.prototype.unshift.call( arguments, 'scroll' )
fire.apply(self, arguments)
}
scrollLastFire = getTime();
};
// onScroll handler
this.scroll = function() {
var self = this;
var self = this
self.updatePositions();
self.updatePositions()
if (self.scrollingCls) {
if (!scrollingTimer) {
self.$(self.root).addClass(self.scrollingCls);
self.$(self.root).addClass(self.scrollingCls)
}
clearTimeout(scrollingTimer);
clearTimeout(scrollingTimer)
scrollingTimer = setTimeout(function() {
self.$(self.root).removeClass(self.scrollingCls);
scrollingTimer = undefined;
}, 300);
self.$(self.root).removeClass(self.scrollingCls)
scrollingTimer = undefined
}, 300)
}
};
}

@@ -814,11 +801,11 @@ // https://github.com/Diokuz/baron/issues/116

// WTF is this line? https://github.com/Diokuz/baron/issues/134
// if (this.direction == 'h') return;
// if (this.direction == 'h') return
// assign `initial scroll position` to `clipper.scrollLeft` (0 for ltr, ~20 for rtl)
if (!this.rtl) {
this.clipper[this.origin.scrollEdge] = 0;
this.clipper[this.origin.scrollEdge] = 0
} else {
this.clipper[this.origin.scrollEdge] = this.clipper[this.origin.scrollSize];
this.clipper[this.origin.scrollEdge] = this.clipper[this.origin.scrollSize]
}
};
}

@@ -829,17 +816,17 @@ // Flexbox `align-items: stretch` (default) requires to set min-width for vertical

this._setCrossSizes = function(node, size) {
var css = {};
var css = {}
css[this.origin.crossSize] = size;
css[this.origin.crossMinSize] = size;
css[this.origin.crossMaxSize] = size;
css[this.origin.crossSize] = size
css[this.origin.crossMinSize] = size
css[this.origin.crossMaxSize] = size
this.$(node).css(css);
};
this.$(node).css(css)
}
// Set common css rules
this._dumbCss = function(on) {
if (params.cssGuru) return;
if (params.cssGuru) return
var overflow = on ? 'hidden' : null;
var msOverflowStyle = on ? 'none' : null;
var overflow = on ? 'hidden' : null
var msOverflowStyle = on ? 'none' : null

@@ -850,53 +837,52 @@ this.$(this.clipper).css({

position: this.position == 'static' ? '' : 'relative'
});
})
var scroll = on ? 'scroll' : null;
var axis = this.direction == 'v' ? 'y' : 'x';
var scrollerCss = {};
var scroll = on ? 'scroll' : null
var axis = this.direction == 'v' ? 'y' : 'x'
var scrollerCss = {}
scrollerCss['overflow-' + axis] = scroll;
scrollerCss['box-sizing'] = 'border-box';
scrollerCss.margin = '0';
scrollerCss.border = '0';
scrollerCss['overflow-' + axis] = scroll
scrollerCss['box-sizing'] = 'border-box'
scrollerCss.margin = '0'
scrollerCss.border = '0'
if (this.position == 'absolute') {
scrollerCss.position = 'absolute';
scrollerCss.top = '0';
scrollerCss.position = 'absolute'
scrollerCss.top = '0'
if (this.direction == 'h') {
scrollerCss.left = scrollerCss.right = '0';
scrollerCss.left = scrollerCss.right = '0'
} else {
scrollerCss.bottom = '0';
scrollerCss.right = this.rtl ? '0' : '';
scrollerCss.left = this.rtl ? '' : '0';
scrollerCss.bottom = '0'
scrollerCss.right = this.rtl ? '0' : ''
scrollerCss.left = this.rtl ? '' : '0'
}
}
this.$(this.scroller).css(scrollerCss);
};
this.$(this.scroller).css(scrollerCss)
}
// onInit actions
this._dumbCss(true);
this._dumbCss(true)
if (isMacFF) {
var padding = 'paddingRight';
var css = {};
var padding = 'paddingRight'
var css = {}
// getComputedStyle is ie9+, but we here only in f ff
var paddingWas = scopedWindow.getComputedStyle(this.scroller)[[padding]];
var delta = this.scroller[this.origin.crossOffset] -
this.scroller[this.origin.crossClient];
var paddingWas = scopedWindow.getComputedStyle(this.scroller)[[padding]]
if (params.direction == 'h') {
padding = 'paddingBottom';
padding = 'paddingBottom'
} else if (params.rtl) {
padding = 'paddingLeft';
padding = 'paddingLeft'
}
var numWas = parseInt(paddingWas, 10);
if (numWas != numWas) numWas = 0;
css[padding] = (macmsxffScrollbarSize + numWas) + 'px';
$(this.scroller).css(css);
var numWas = parseInt(paddingWas, 10)
if (numWas != numWas) numWas = 0
css[padding] = (macmsxffScrollbarSize + numWas) + 'px'
_$(this.scroller).css(css)
}
return this;
return this
},

@@ -912,11 +898,11 @@

this
].join(' '), params);
].join(' '), params)
}
// endRemoveIf(production)
fire.call(this, 'upd', params); // Update all plugins' params
fire.call(this, 'upd', params) // Update all plugins' params
this.resize(1);
this.updatePositions();
this.resize(1)
this.updatePositions()
return this;
return this
},

@@ -928,76 +914,73 @@

if (this._disposed) {
log('error', [
'Already disposed:',
this
].join(' '), params);
log('error', 'Already disposed:', this)
}
// endRemoveIf(production)
manageEvents(this, this.event, 'off');
manageAttr(this.root, params.direction, 'off');
manageEvents(this, this.event, 'off')
manageAttr(this.root, params.direction, 'off')
if (params.direction == 'v') {
this._setCrossSizes(this.scroller, '');
this._setCrossSizes(this.scroller, '')
} else {
this._setCrossSizes(this.clipper, '');
this._setCrossSizes(this.clipper, '')
}
this._dumbCss(false);
this.barOn(true);
fire.call(this, 'dispose');
this._disposed = true;
this._dumbCss(false)
this.barOn(true)
fire.call(this, 'dispose')
this._disposed = true
},
on: function(eventName, func, arg) {
var names = eventName.split(' ');
var names = eventName.split(' ')
for (var i = 0 ; i < names.length ; i++) {
for (var i = 0; i < names.length; i++) {
if (names[i] == 'init') {
func.call(this, arg);
func.call(this, arg)
} else {
this.events[names[i]] = this.events[names[i]] || [];
this.events[names[i]] = this.events[names[i]] || []
this.events[names[i]].push(function(userArg) {
func.call(this, userArg || arg);
});
func.call(this, userArg || arg)
})
}
}
}
};
}
baron.fn.constructor.prototype = baron.fn;
item.prototype.constructor.prototype = item.prototype;
baron.fn.constructor.prototype = baron.fn
Item.prototype.constructor.prototype = Item.prototype
// Use when you need "baron" global var for another purposes
baron.noConflict = function() {
scopedWindow.baron = _baron; // Restoring original value of "baron" global var
scopedWindow.baron = _baron // Restoring original value of "baron" global var
return baron;
};
return baron
}
baron.version = '2.2.4';
baron.version = '2.2.5'
// No AMD support, need it? Notify me.
if (typeof module != 'undefined') {
module.exports = baron;
module.exports = baron
// @todo webpack
require('./fix');
require('./pull');
require('./controls');
require('./autoUpdate');
require('./fix')
require('./pull')
require('./controls')
require('./autoUpdate')
} else {
window.baron = baron;
window.baron = baron
if ($ && $.fn) { // Adding baron to jQuery as plugin
$.fn.baron = baron;
$.fn.baron = baron
}
}
})(this);
}(this))
/* Fixable elements plugin for baron 0.6+ */
(function(scopedWindow, undefined) {
var scopedBaron;
(function(scopedWindow) {
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core.js');
scopedBaron = require('./core.js')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}

@@ -1007,4 +990,4 @@

var log = function() {
scopedBaron.fn.log.apply(this, arguments);
};
scopedBaron.fn.log.apply(this, arguments)
}
// endRemoveIf(production)

@@ -1030,3 +1013,3 @@

$ = this.$,
self = this;
self = this

@@ -1038,3 +1021,3 @@ // removeIf(production)

'See more https://github.com/Diokuz/baron/issues/135'
].join(' '), this.params);
].join(' '), this.params)
}

@@ -1045,16 +1028,17 @@ // endRemoveIf(production)

// Invocation only in case when fix-state changed
function fixElement(i, pos, flag) {
var ori = flag == 1 ? 'pos' : 'oppos';
function fixElement(i, _pos, flag) {
var pos = _pos
var ori = flag == 1 ? 'pos' : 'oppos'
if (viewPortSize < (params.minView || 0)) { // No headers fixing when no enought space for viewport
pos = undefined;
pos = undefined
}
// Removing all fixing stuff - we can do this because fixElement triggers only when fixState really changed
this.$(elements[i]).css(this.origin.pos, '').css(this.origin.oppos, '').removeClass(params.outside);
this.$(elements[i]).css(this.origin.pos, '').css(this.origin.oppos, '').removeClass(params.outside)
// Fixing if needed
if (pos !== undefined) {
pos += 'px';
this.$(elements[i]).css(this.origin[ori], pos).addClass(params.outside);
pos += 'px'
this.$(elements[i]).css(this.origin[ori], pos).addClass(params.outside)
}

@@ -1065,49 +1049,52 @@ }

try {
i = document.createEvent('WheelEvent'); // i - for extra byte
// evt.initWebKitWheelEvent(deltaX, deltaY, window, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
i.initWebKitWheelEvent(e.originalEvent.wheelDeltaX, e.originalEvent.wheelDeltaY);
scroller.dispatchEvent(i);
e.preventDefault();
} catch (e) {}
var i = document.createEvent('WheelEvent') // i - for extra byte
// evt.initWebKitWheelEvent(deltaX, deltaY, window, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey)
i.initWebKitWheelEvent(e.originalEvent.wheelDeltaX, e.originalEvent.wheelDeltaY)
scroller.dispatchEvent(i)
e.preventDefault()
} catch (ex) {
//
}
}
function init(_params) {
var pos;
var pos
for (var key in _params) {
params[key] = _params[key];
params[key] = _params[key]
}
elements = this.$(params.elements, this.scroller);
elements = this.$(params.elements, this.scroller)
if (elements) {
viewPortSize = this.scroller[this.origin.client];
for (var i = 0 ; i < elements.length ; i++) {
viewPortSize = this.scroller[this.origin.client]
for (var i = 0; i < elements.length; i++) {
// Variable header heights
pos = {};
pos[this.origin.size] = elements[i][this.origin.offset];
pos = {}
pos[this.origin.size] = elements[i][this.origin.offset]
if (elements[i].parentNode !== this.scroller) {
this.$(elements[i].parentNode).css(pos);
this.$(elements[i].parentNode).css(pos)
}
pos = {};
pos[this.origin.crossSize] = elements[i].parentNode[this.origin.crossClient];
this.$(elements[i]).css(pos);
pos = {}
pos[this.origin.crossSize] = elements[i].parentNode[this.origin.crossClient]
this.$(elements[i]).css(pos)
// Between fixed headers
viewPortSize -= elements[i][this.origin.offset];
viewPortSize -= elements[i][this.origin.offset]
headerTops[i] = elements[i].parentNode[this.origin.offsetPos]; // No paddings for parentNode
headerTops[i] = elements[i].parentNode[this.origin.offsetPos] // No paddings for parentNode
// Summary elements height above current
topFixHeights[i] = (topFixHeights[i - 1] || 0); // Not zero because of negative margins
topRealHeights[i] = (topRealHeights[i - 1] || Math.min(headerTops[i], 0));
topFixHeights[i] = (topFixHeights[i - 1] || 0) // Not zero because of negative margins
topRealHeights[i] = (topRealHeights[i - 1] || Math.min(headerTops[i], 0))
if (elements[i - 1]) {
topFixHeights[i] += elements[i - 1][this.origin.offset];
topRealHeights[i] += elements[i - 1][this.origin.offset];
topFixHeights[i] += elements[i - 1][this.origin.offset]
topRealHeights[i] += elements[i - 1][this.origin.offset]
}
if ( !(i == 0 && headerTops[i] == 0)/* && force */) {
this.event(elements[i], 'mousewheel', bubbleWheel, 'off');
this.event(elements[i], 'mousewheel', bubbleWheel);
this.event(elements[i], 'mousewheel', bubbleWheel, 'off')
this.event(elements[i], 'mousewheel', bubbleWheel)
}

@@ -1118,14 +1105,14 @@ }

if (this.track && this.track != this.scroller) {
pos = {};
pos[this.origin.pos] = elements[0].parentNode[this.origin.offset];
this.$(this.track).css(pos);
pos = {}
pos[this.origin.pos] = elements[0].parentNode[this.origin.offset]
this.$(this.track).css(pos)
} else {
this.barTopLimit = elements[0].parentNode[this.origin.offset];
this.barTopLimit = elements[0].parentNode[this.origin.offset]
}
// this.barTopLimit = elements[0].parentNode[this.origin.offset];
this.scroll();
// this.barTopLimit = elements[0].parentNode[this.origin.offset]
this.scroll()
}
if (params.limiter === false) { // undefined (in second fix instance) should have no influence on bar limit
this.barTopLimit = 0;
this.barTopLimit = 0
}

@@ -1140,10 +1127,10 @@ }

top = parent.offsetTop,
num;
num
// finding num -> elements[num] === this
for (var i = 0 ; i < elements.length ; i++ ) {
if (elements[i] === this) num = i;
for (var j = 0; j < elements.length; j++ ) {
if (elements[j] === this) num = j
}
var pos = top - topFixHeights[num];
var locPos = top - topFixHeights[num]

@@ -1153,6 +1140,6 @@ if (params.scroll) { // User defined callback

x1: self.scroller.scrollTop,
x2: pos
});
x2: locPos
})
} else {
self.scroller.scrollTop = pos;
self.scroller.scrollTop = locPos
}

@@ -1162,51 +1149,53 @@ },

type: 'click'
};
}
if (params.clickable) {
this._eventHandlers.push(event); // For auto-dispose
// eventManager(event.element, event.type, event.handler, 'off');
eventManager(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
// eventManager(event.element, event.type, event.handler, 'off')
eventManager(event.element, event.type, event.handler, 'on')
}
}
this.on('init', init, userParams);
this.on('init', init, userParams)
var fixFlag = [], // 1 - past, 2 - future, 3 - current (not fixed)
gradFlag = [];
gradFlag = []
this.on('init scroll', function() {
var fixState, hTop, gradState;
var fixState, hTop, gradState
var i
if (elements) {
var change;
var change
// fixFlag update
for (var i = 0 ; i < elements.length ; i++) {
fixState = 0;
for (i = 0; i < elements.length; i++) {
fixState = 0
if (headerTops[i] - this.pos() < topRealHeights[i] + params.radius) {
// Header trying to go up
fixState = 1;
hTop = topFixHeights[i];
fixState = 1
hTop = topFixHeights[i]
} else if (headerTops[i] - this.pos() > topRealHeights[i] + viewPortSize - params.radius) {
// Header trying to go down
fixState = 2;
// console.log('topFixHeights[i] + viewPortSize + topRealHeights[i]', topFixHeights[i], this.scroller[this.origin.client], topRealHeights[i]);
hTop = this.scroller[this.origin.client] - elements[i][this.origin.offset] - topFixHeights[i] - viewPortSize;
// console.log('hTop', hTop, viewPortSize, elements[this.origin.offset], topFixHeights[i]);
//(topFixHeights[i] + viewPortSize + elements[this.origin.offset]) - this.scroller[this.origin.client];
fixState = 2
// console.log('topFixHeights[i] + viewPortSize + topRealHeights[i]', topFixHeights[i], this.scroller[this.origin.client], topRealHeights[i])
hTop = this.scroller[this.origin.client] - elements[i][this.origin.offset] - topFixHeights[i] - viewPortSize
// console.log('hTop', hTop, viewPortSize, elements[this.origin.offset], topFixHeights[i])
// (topFixHeights[i] + viewPortSize + elements[this.origin.offset]) - this.scroller[this.origin.client]
} else {
// Header in viewport
fixState = 3;
hTop = undefined;
fixState = 3
hTop = undefined
}
gradState = false;
gradState = false
if (headerTops[i] - this.pos() < topRealHeights[i] || headerTops[i] - this.pos() > topRealHeights[i] + viewPortSize) {
gradState = true;
gradState = true
}
if (fixState != fixFlag[i] || gradState != gradFlag[i]) {
fixElement.call(this, i, hTop, fixState);
fixFlag[i] = fixState;
gradFlag[i] = gradState;
change = true;
fixElement.call(this, i, hTop, fixState)
fixFlag[i] = fixState
gradFlag[i] = gradState
change = true
}

@@ -1217,24 +1206,24 @@ }

if (change) { // At leats one change in elements flag structure occured
for (i = 0 ; i < elements.length ; i++) {
for (i = 0; i < elements.length; i++) {
if (fixFlag[i] == 1 && params.past) {
this.$(elements[i]).addClass(params.past).removeClass(params.future);
this.$(elements[i]).addClass(params.past).removeClass(params.future)
}
if (fixFlag[i] == 2 && params.future) {
this.$(elements[i]).addClass(params.future).removeClass(params.past);
this.$(elements[i]).addClass(params.future).removeClass(params.past)
}
if (fixFlag[i] == 3) {
if (params.future || params.past) this.$(elements[i]).removeClass(params.past).removeClass(params.future);
if (params.inside) this.$(elements[i]).addClass(params.inside);
if (params.future || params.past) this.$(elements[i]).removeClass(params.past).removeClass(params.future)
if (params.inside) this.$(elements[i]).addClass(params.inside)
} else if (params.inside) {
this.$(elements[i]).removeClass(params.inside);
this.$(elements[i]).removeClass(params.inside)
}
if (fixFlag[i] != fixFlag[i + 1] && fixFlag[i] == 1 && params.before) {
this.$(elements[i]).addClass(params.before).removeClass(params.after); // Last top fixed header
this.$(elements[i]).addClass(params.before).removeClass(params.after) // Last top fixed header
} else if (fixFlag[i] != fixFlag[i - 1] && fixFlag[i] == 2 && params.after) {
this.$(elements[i]).addClass(params.after).removeClass(params.before); // First bottom fixed header
this.$(elements[i]).addClass(params.after).removeClass(params.before) // First bottom fixed header
} else {
this.$(elements[i]).removeClass(params.before).removeClass(params.after);
this.$(elements[i]).removeClass(params.before).removeClass(params.after)
}

@@ -1244,5 +1233,5 @@

if (gradFlag[i]) {
this.$(elements[i]).addClass(params.grad);
this.$(elements[i]).addClass(params.grad)
} else {
this.$(elements[i]).removeClass(params.grad);
this.$(elements[i]).removeClass(params.grad)
}

@@ -1253,38 +1242,39 @@ }

}
});
})
this.on('resize upd', function(updParams) {
init.call(this, updParams && updParams.fix);
});
};
init.call(this, updParams && updParams.fix)
})
}
scopedBaron.fn.fix = function(params) {
var i = 0;
var i = 0
while (this[i]) {
fix.call(this[i], params);
i++;
fix.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))
/* Autoupdate plugin for baron 0.6+ */
(function(scopedWindow) {
var scopedBaron;
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core');
scopedBaron = require('./core')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}
var MutationObserver = scopedWindow.MutationObserver || scopedWindow.WebKitMutationObserver || scopedWindow.MozMutationObserver || null;
var MutationObserver = scopedWindow.MutationObserver || scopedWindow.WebKitMutationObserver || scopedWindow.MozMutationObserver || null
var autoUpdate = function() {
var self = this;
var watcher;
var self = this
var watcher
if (this._au) {
return;
return
}

@@ -1294,5 +1284,5 @@

if (!self.root[self.origin.offset]) {
startWatch();
startWatch()
} else {
stopWatch();
stopWatch()
}

@@ -1303,26 +1293,26 @@ }

function startWatch() {
if (watcher) return;
if (watcher) return
watcher = setInterval(function() {
if (self.root[self.origin.offset]) {
stopWatch();
self.update();
stopWatch()
self.update()
}
}, 300); // is it good enought for you?)
}, 300) // is it good enought for you?)
}
function stopWatch() {
clearInterval(watcher);
watcher = null;
clearInterval(watcher)
watcher = null
}
var debouncedUpdater = self._debounce(function() {
self.update();
}, 300);
self.update()
}, 300)
this._observer = new MutationObserver(function() {
actualizeWatcher();
self.update();
debouncedUpdater();
});
actualizeWatcher()
self.update()
debouncedUpdater()
})

@@ -1339,38 +1329,38 @@ this.on('init', function() {

// Other cases are covered by watcher, and you still can do .update by yourself
});
})
actualizeWatcher();
});
actualizeWatcher()
})
this.on('dispose', function() {
self._observer.disconnect();
stopWatch();
delete self._observer;
});
self._observer.disconnect()
stopWatch()
delete self._observer
})
this._au = true;
};
this._au = true
}
scopedBaron.fn.autoUpdate = function(params) {
if (!MutationObserver) return this;
if (!MutationObserver) return this
var i = 0;
var i = 0
while (this[i]) {
autoUpdate.call(this[i], params);
i++;
autoUpdate.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))
/* Controls plugin for baron 0.6+ */
(function(scopedWindow, undefined) {
var scopedBaron;
(function(scopedWindow) {
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core');
scopedBaron = require('./core')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}

@@ -1381,8 +1371,8 @@

self = this, // AAAAAA!!!!!11
event;
event
screen = params.screen || 0.9;
screen = params.screen || 0.9
if (params.forward) {
forward = this.$(params.forward, this.clipper);
forward = this.$(params.forward, this.clipper)

@@ -1393,16 +1383,16 @@ event = {

handler: function() {
var y = self.pos() + (params.delta || 30);
var y = self.pos() + (params.delta || 30)
self.pos(y);
self.pos(y)
},
type: 'click'
};
}
this._eventHandlers.push(event); // For auto-dispose
this.event(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
this.event(event.element, event.type, event.handler, 'on')
}
if (params.backward) {
backward = this.$(params.backward, this.clipper);
backward = this.$(params.backward, this.clipper)

@@ -1413,12 +1403,12 @@ event = {

handler: function() {
var y = self.pos() - (params.delta || 30);
var y = self.pos() - (params.delta || 30)
self.pos(y);
self.pos(y)
},
type: 'click'
};
}
this._eventHandlers.push(event); // For auto-dispose
this.event(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
this.event(event.element, event.type, event.handler, 'on')
}

@@ -1428,5 +1418,5 @@

if (params.track === true) {
track = this.track;
track = this.track
} else {
track = this.$(params.track, this.clipper)[0];
track = this.$(params.track, this.clipper)[0]
}

@@ -1440,50 +1430,51 @@

// https://github.com/Diokuz/baron/issues/121
if (e.target != track) return;
if (e.target != track) return
var x = e['offset' + self.origin.x],
xBar = self.bar[self.origin.offsetPos],
sign = 0;
sign = 0
if (x < xBar) {
sign = -1;
sign = -1
} else if (x > xBar + self.bar[self.origin.offset]) {
sign = 1;
sign = 1
}
var y = self.pos() + sign * screen * self.scroller[self.origin.client];
self.pos(y);
var y = self.pos() + sign * screen * self.scroller[self.origin.client]
self.pos(y)
},
type: 'mousedown'
};
}
this._eventHandlers.push(event); // For auto-dispose
this.event(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
this.event(event.element, event.type, event.handler, 'on')
}
}
};
}
scopedBaron.fn.controls = function(params) {
var i = 0;
var i = 0
while (this[i]) {
controls.call(this[i], params);
i++;
controls.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))
// removeIf(production)
baron.fn.log = function(level, msg, nodes) {
var time = new Date().toString();
var func = console[level] || console.log;
var time = new Date().toString()
var func = console[level] || console.log
var args = [
'Baron [ ' + time.substr(16, 8) + ' ]: ' + msg,
nodes
];
]
Function.prototype.apply.call(func, console, args);
};
Function.prototype.apply.call(func, console, args)
}
// endRemoveIf(production)

@@ -1,1 +0,1 @@

!function(t,i){"use strict";function s(e){var r,o,n=!!e,l={$:t.jQuery,direction:"v",barOnCls:"_scrollbar",resizeDebounce:0,event:function(t,i,s,r){e.$(t)[r||"on"](i,s)},cssGuru:!1,impact:"scroller",position:"static"};e=e||{};for(var c in l)e[c]===i&&(e[c]=l[c]);r=e.$&&this instanceof e.$,e._chain?o=e.root:r?e.root=o=this:o=e.$?e.$(e.root||e.scroller):[];var a=new s.fn.constructor(o,e,n);return a.autoUpdate&&a.autoUpdate(),a}function e(s,e){var r=0;for(s.length!==i&&s!==t||(s=[s]);s[r];)e.call(this,s[r],r),r++}function r(){return(new Date).getTime()}function o(i,s,r){i._eventHandlers=i._eventHandlers||[{element:i.scroller,handler:function(t){i.scroll(t)},type:"scroll"},{element:i.root,handler:function(){i.update()},type:"transitionend animationend"},{element:i.scroller,handler:function(){i.update()},type:"keyup"},{element:i.bar,handler:function(t){t.preventDefault(),i.selection(),i.drag.now=1,i.draggingCls&&h(i.root).addClass(i.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){i.selection(1),i.drag.now=0,i.draggingCls&&h(i.root).removeClass(i.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(t){2!=t.button&&i._pos0(t)},type:"touchstart mousedown"},{element:document,handler:function(t){i.drag.now&&i.drag(t)},type:"mousemove touchmove"},{element:t,handler:function(){i.update()},type:"resize"},{element:i.root,handler:function(){i.update()},type:"sizeChange"},{element:i.clipper,handler:function(){i.clipperOnScroll()},type:"scroll"}],e(i._eventHandlers,function(t){t.element&&s(t.element,t.type,t.handler,r)})}function n(t,i,s,e){var r="data-baron-"+i+"-id";if("on"==s)t.setAttribute(r,e);else{if("off"!=s)return t.getAttribute(r);t.removeAttribute(r)}}function l(t){var i=new C.prototype.constructor(t);return o(i,t.event,"on"),n(i.root,t.direction,"on",p.length),p.push(i),i.update(),i}function c(t){var i={};t=t||{};for(var s in t)t.hasOwnProperty(s)&&(i[s]=t[s]);return i}function a(t){if(this.events&&this.events[t])for(var i=0;i<this.events[t].length;i++){var s=Array.prototype.slice.call(arguments,1);this.events[t][i].apply(this,s)}}var h=("undefined"!=typeof window,t.$),u=s,f=["left","top","right","bottom","width","height"],p=[],d={v:{x:"Y",pos:f[1],oppos:f[3],crossPos:f[0],crossOpPos:f[2],size:f[5],crossSize:f[4],crossMinSize:"min-"+f[4],crossMaxSize:"max-"+f[4],client:"clientHeight",crossClient:"clientWidth",scrollEdge:"scrollLeft",offset:"offsetHeight",crossOffset:"offsetWidth",offsetPos:"offsetTop",scroll:"scrollTop",scrollSize:"scrollHeight"},h:{x:"X",pos:f[0],oppos:f[2],crossPos:f[1],crossOpPos:f[3],size:f[4],crossSize:f[5],crossMinSize:"min-"+f[5],crossMaxSize:"max-"+f[5],client:"clientWidth",crossClient:"clientHeight",scrollEdge:"scrollTop",offset:"offsetWidth",crossOffset:"offsetHeight",offsetPos:"offsetLeft",scroll:"scrollLeft",scrollSize:"scrollWidth"}},v=17,g=15,m=/[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/,b=m.test(t.navigator&&t.navigator.userAgent);s.fn={constructor:function(t,i,s){var r=c(i);r.event=function(t,s,r,o){e(t,function(t){i.event(t,s,r,o)})},this.length=0,e.call(this,t,function(t,i){var s=n(t,r.direction),e=+s;if(e==e&&null!==s&&p[e])this[i]=p[e];else{var o=c(r);if(r.root&&r.scroller){if(o.scroller=r.$(r.scroller,t),!o.scroller.length)return}else o.scroller=t;o.root=t,this[i]=l(o)}this.length=i+1}),this.params=r},dispose:function(){var t=this.params;e(this,function(i,s){i.dispose(t),p[s]=null}),this.params=null},update:function(){var t=arguments;e(this,function(i,s){i.update.apply(i,t)})},baron:function(t){return t.root=[],this.params.root&&(t.scroller=this.params.scroller),e.call(this,this,function(i){t.root.push(i.root)}),t.direction="v"==this.params.direction?"h":"v",t._chain=!0,s(t)}};var C={};C.prototype={_debounce:function(t,s){var e,o,n=this,l=function(){if(n._disposed)return clearTimeout(e),e=n=null,i;var c=r()-o;s>c&&c>=0?e=setTimeout(l,s-c):(e=null,t())};return function(){o=r(),e||(e=setTimeout(l,s))}},constructor:function(s){function e(t,i){return f(t,i)[0]}function o(t){var i=this.barMinSize||20;t>0&&i>t&&(t=i),this.bar&&f(this.bar).css(this.origin.size,parseInt(t,10)+"px")}function n(t){if(this.bar){var i=f(this.bar).css(this.origin.pos),s=+t+"px";s&&s!=i&&f(this.bar).css(this.origin.pos,s)}}function l(){return C[this.origin.client]-this.barTopLimit-this.bar[this.origin.offset]}function c(t){return t*l.call(this)+this.barTopLimit}function h(t){return(t-this.barTopLimit)/l.call(this)}function u(){return!1}var f,p,m,C,y,z,$,S,_;if(S=$=r(),f=this.$=s.$,this.event=s.event,this.events={},this.root=s.root,this.scroller=e(s.scroller),this.bar=e(s.bar,this.root),C=this.track=e(s.track,this.root),!this.track&&this.bar&&(C=this.bar.parentNode),this.clipper=this.scroller.parentNode,this.direction=s.direction,this.rtl=s.rtl,this.origin=d[this.direction],this.barOnCls=s.barOnCls,this.scrollingCls=s.scrollingCls,this.draggingCls=s.draggingCls,this.impact=s.impact,this.position=s.position,this.rtl=s.rtl,this.barTopLimit=0,this.resizeDebounce=s.resizeDebounce,this.cursor=function(t){return t["client"+this.origin.x]||(((t.originalEvent||t).touches||{})[0]||{})["page"+this.origin.x]},this.pos=function(t){var s="page"+this.origin.x+"Offset",e=this.scroller[s]?s:this.origin.scroll;return t!==i&&(this.scroller[e]=t),this.scroller[e]},this.rpos=function(t){var i,s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];return i=t?this.pos(t*s):this.pos(),i/(s||1)},this.barOn=function(t){this.barOnCls&&(t||this.scroller[this.origin.client]>=this.scroller[this.origin.scrollSize]?f(this.root).hasClass(this.barOnCls)&&f(this.root).removeClass(this.barOnCls):f(this.root).hasClass(this.barOnCls)||f(this.root).addClass(this.barOnCls))},this._pos0=function(t){m=this.cursor(t)-p},this.drag=function(t){var i=h.call(this,this.cursor(t)-m),s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=i*s},this.selection=function(t){this.event(document,"selectpos selectstart",u,t?"off":"on")},this.resize=function(){function t(){var t=s.scroller[s.origin.crossOffset],i=s.scroller[s.origin.crossClient],e=0;if(b?e=g:i>0&&0===t&&(t=i+v),t)if(s.barOn(),"scroller"==s.impact){var o=t-i+e;if("static"==s.position){var n=s.$(s.scroller).css(s.origin.crossSize),l=s.clipper[s.origin.crossClient]+o+"px";n!=l&&s._setCrossSizes(s.scroller,l)}else{var c={},h=s.rtl?"Left":"Right";"h"==s.direction&&(h="Bottom"),c["padding"+h]=o+"px",s.$(s.scroller).css(c)}}else{var n=f(s.clipper).css(s.origin.crossSize),l=i+"px";n!=l&&s._setCrossSizes(s.clipper,l)}Array.prototype.unshift.call(arguments,"resize"),a.apply(s,arguments),S=r()}var s=this,e=s.resizeDebounce===i?300:s.resizeDebounce,o=0;r()-S<e&&(clearTimeout(y),o=e),o?y=setTimeout(t,o):t()},this.updatePositions=function(){var t,i=this;i.bar&&(t=(C[i.origin.client]-i.barTopLimit)*i.scroller[i.origin.client]/i.scroller[i.origin.scrollSize],parseInt(_,10)!=parseInt(t,10)&&(o.call(i,t),_=t),p=c.call(i,i.rpos()),n.call(i,p)),Array.prototype.unshift.call(arguments,"scroll"),a.apply(i,arguments),$=r()},this.scroll=function(){var t=this;t.updatePositions(),t.scrollingCls&&(z||t.$(t.root).addClass(t.scrollingCls),clearTimeout(z),z=setTimeout(function(){t.$(t.root).removeClass(t.scrollingCls),z=i},300))},this.clipperOnScroll=function(){this.rtl?this.clipper[this.origin.scrollEdge]=this.clipper[this.origin.scrollSize]:this.clipper[this.origin.scrollEdge]=0},this._setCrossSizes=function(t,i){var s={};s[this.origin.crossSize]=i,s[this.origin.crossMinSize]=i,s[this.origin.crossMaxSize]=i,this.$(t).css(s)},this._dumbCss=function(t){if(!s.cssGuru){var i=t?"hidden":null,e=t?"none":null;this.$(this.clipper).css({overflow:i,msOverflowStyle:e,position:"static"==this.position?"":"relative"});var r=t?"scroll":null,o="v"==this.direction?"y":"x",n={};n["overflow-"+o]=r,n["box-sizing"]="border-box",n.margin="0",n.border="0","absolute"==this.position&&(n.position="absolute",n.top="0","h"==this.direction?n.left=n.right="0":(n.bottom="0",n.right=this.rtl?"0":"",n.left=this.rtl?"":"0")),this.$(this.scroller).css(n)}},this._dumbCss(!0),b){var w="paddingRight",x={},O=t.getComputedStyle(this.scroller)[[w]];this.scroller[this.origin.crossOffset]-this.scroller[this.origin.crossClient];"h"==s.direction?w="paddingBottom":s.rtl&&(w="paddingLeft");var T=parseInt(O,10);T!=T&&(T=0),x[w]=g+T+"px",f(this.scroller).css(x)}return this},update:function(t){return a.call(this,"upd",t),this.resize(1),this.updatePositions(),this},dispose:function(t){o(this,this.event,"off"),n(this.root,t.direction,"off"),"v"==t.direction?this._setCrossSizes(this.scroller,""):this._setCrossSizes(this.clipper,""),this._dumbCss(!1),this.barOn(!0),a.call(this,"dispose"),this._disposed=!0},on:function(t,i,s){for(var e=t.split(" "),r=0;r<e.length;r++)"init"==e[r]?i.call(this,s):(this.events[e[r]]=this.events[e[r]]||[],this.events[e[r]].push(function(t){i.call(this,t||s)}))}},s.fn.constructor.prototype=s.fn,C.prototype.constructor.prototype=C.prototype,s.noConflict=function(){return t.baron=u,s},s.version="2.2.4","undefined"!=typeof module?(module.exports=s,require("./fix"),require("./pull"),require("./controls"),require("./autoUpdate")):(window.baron=s,h&&h.fn&&(h.fn.baron=s))}(this),function(t,s){var e;e="undefined"!=typeof module?require("./core.js"):t.baron;var r=function(t){function e(t,i,e){var r=1==e?"pos":"oppos";l<(c.minView||0)&&(i=s),this.$(n[t]).css(this.origin.pos,"").css(this.origin.oppos,"").removeClass(c.outside),i!==s&&(i+="px",this.$(n[t]).css(this.origin[r],i).addClass(c.outside))}function r(t){try{i=document.createEvent("WheelEvent"),i.initWebKitWheelEvent(t.originalEvent.wheelDeltaX,t.originalEvent.wheelDeltaY),f.dispatchEvent(i),t.preventDefault()}catch(t){}}function o(t){var i;for(var s in t)c[s]=t[s];if(n=this.$(c.elements,this.scroller)){l=this.scroller[this.origin.client];for(var e=0;e<n.length;e++)i={},i[this.origin.size]=n[e][this.origin.offset],n[e].parentNode!==this.scroller&&this.$(n[e].parentNode).css(i),i={},i[this.origin.crossSize]=n[e].parentNode[this.origin.crossClient],this.$(n[e]).css(i),l-=n[e][this.origin.offset],u[e]=n[e].parentNode[this.origin.offsetPos],a[e]=a[e-1]||0,h[e]=h[e-1]||Math.min(u[e],0),n[e-1]&&(a[e]+=n[e-1][this.origin.offset],h[e]+=n[e-1][this.origin.offset]),0==e&&0==u[e]||(this.event(n[e],"mousewheel",r,"off"),this.event(n[e],"mousewheel",r));c.limiter&&n[0]&&(this.track&&this.track!=this.scroller?(i={},i[this.origin.pos]=n[0].parentNode[this.origin.offset],this.$(this.track).css(i)):this.barTopLimit=n[0].parentNode[this.origin.offset],this.scroll()),c.limiter===!1&&(this.barTopLimit=0)}var o={element:n,handler:function(){for(var t,i=d(this)[0].parentNode,s=i.offsetTop,e=0;e<n.length;e++)n[e]===this&&(t=e);var r=s-a[t];c.scroll?c.scroll({x1:v.scroller.scrollTop,x2:r}):v.scroller.scrollTop=r},type:"click"};c.clickable&&(this._eventHandlers.push(o),p(o.element,o.type,o.handler,"on"))}var n,l,c={outside:"",inside:"",before:"",after:"",past:"",future:"",radius:0,minView:0},a=[],h=[],u=[],f=this.scroller,p=this.event,d=this.$,v=this;this.on("init",o,t);var g=[],m=[];this.on("init scroll",function(){var t,i,r;if(n){for(var o,f=0;f<n.length;f++)t=0,u[f]-this.pos()<h[f]+c.radius?(t=1,i=a[f]):u[f]-this.pos()>h[f]+l-c.radius?(t=2,i=this.scroller[this.origin.client]-n[f][this.origin.offset]-a[f]-l):(t=3,i=s),r=!1,(u[f]-this.pos()<h[f]||u[f]-this.pos()>h[f]+l)&&(r=!0),t==g[f]&&r==m[f]||(e.call(this,f,i,t),g[f]=t,m[f]=r,o=!0);if(o)for(f=0;f<n.length;f++)1==g[f]&&c.past&&this.$(n[f]).addClass(c.past).removeClass(c.future),2==g[f]&&c.future&&this.$(n[f]).addClass(c.future).removeClass(c.past),3==g[f]?((c.future||c.past)&&this.$(n[f]).removeClass(c.past).removeClass(c.future),c.inside&&this.$(n[f]).addClass(c.inside)):c.inside&&this.$(n[f]).removeClass(c.inside),g[f]!=g[f+1]&&1==g[f]&&c.before?this.$(n[f]).addClass(c.before).removeClass(c.after):g[f]!=g[f-1]&&2==g[f]&&c.after?this.$(n[f]).addClass(c.after).removeClass(c.before):this.$(n[f]).removeClass(c.before).removeClass(c.after),c.grad&&(m[f]?this.$(n[f]).addClass(c.grad):this.$(n[f]).removeClass(c.grad))}}),this.on("resize upd",function(t){o.call(this,t&&t.fix)})};e.fn.fix=function(t){for(var i=0;this[i];)r.call(this[i],t),i++;return this}}(this),function(t){var i;i="undefined"!=typeof module?require("./core"):t.baron;var s=t.MutationObserver||t.WebKitMutationObserver||t.MozMutationObserver||null,e=function(){function t(){o.root[o.origin.offset]?e():i()}function i(){r||(r=setInterval(function(){o.root[o.origin.offset]&&(e(),o.update())},300))}function e(){clearInterval(r),r=null}var r,o=this;if(!this._au){var n=o._debounce(function(){o.update()},300);this._observer=new s(function(){t(),o.update(),n()}),this.on("init",function(){o._observer.observe(o.root,{childList:!0,subtree:!0,characterData:!0}),t()}),this.on("dispose",function(){o._observer.disconnect(),e(),delete o._observer}),this._au=!0}};i.fn.autoUpdate=function(t){if(!s)return this;for(var i=0;this[i];)e.call(this[i],t),i++;return this}}(this),function(t,i){var s;s="undefined"!=typeof module?require("./core"):t.baron;var e=function(t){var i,s,e,r,o,n=this;r=t.screen||.9,t.forward&&(i=this.$(t.forward,this.clipper),o={element:i,handler:function(){var i=n.pos()+(t.delta||30);n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.backward&&(s=this.$(t.backward,this.clipper),o={element:s,handler:function(){var i=n.pos()-(t.delta||30);n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.track&&(e=t.track===!0?this.track:this.$(t.track,this.clipper)[0],e&&(o={element:e,handler:function(t){if(t.target==e){var i=t["offset"+n.origin.x],s=n.bar[n.origin.offsetPos],o=0;s>i?o=-1:i>s+n.bar[n.origin.offset]&&(o=1);var l=n.pos()+o*r*n.scroller[n.origin.client];n.pos(l)}},type:"mousedown"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")))};s.fn.controls=function(t){for(var i=0;this[i];)e.call(this[i],t),i++;return this}}(this);
!function(t){"use strict";function i(s){var e,r,o=s,n=!!o,l={$:t.jQuery,direction:"v",barOnCls:"_scrollbar",resizeDebounce:0,event:function(t,i,s,e){o.$(t)[e||"on"](i,s)},cssGuru:!1,impact:"scroller",position:"static"};o=o||{};for(var c in l)void 0===o[c]&&(o[c]=l[c]);e=o.$&&this instanceof o.$,o._chain?r=o.root:e?o.root=r=this:r=o.$?o.$(o.root||o.scroller):[];var a=new i.fn.constructor(r,o,n);return a.autoUpdate&&a.autoUpdate(),a}function s(i,s){var e=0,r=i;for((void 0===r.length||r===t)&&(r=[r]);r[e];)s.call(this,r[e],e),e++}function e(){return(new Date).getTime()}function r(i,e,r){i._eventHandlers=i._eventHandlers||[{element:i.scroller,handler:function(t){i.scroll(t)},type:"scroll"},{element:i.root,handler:function(){i.update()},type:"transitionend animationend"},{element:i.scroller,handler:function(){i.update()},type:"keyup"},{element:i.bar,handler:function(t){t.preventDefault(),i.selection(),i.drag.now=1,i.draggingCls&&a(i.root).addClass(i.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){i.selection(1),i.drag.now=0,i.draggingCls&&a(i.root).removeClass(i.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(t){2!=t.button&&i._pos0(t)},type:"touchstart mousedown"},{element:document,handler:function(t){i.drag.now&&i.drag(t)},type:"mousemove touchmove"},{element:t,handler:function(){i.update()},type:"resize"},{element:i.root,handler:function(){i.update()},type:"sizeChange"},{element:i.clipper,handler:function(){i.clipperOnScroll()},type:"scroll"}],s(i._eventHandlers,function(t){t.element&&e(t.element,t.type,t.handler,r)})}function o(t,i,s,e){var r="data-baron-"+i+"-id";return"on"==s?t.setAttribute(r,e):"off"==s&&t.removeAttribute(r),t.getAttribute(r)}function n(t){var i=new u.prototype.constructor(t);return r(i,t.event,"on"),o(i.root,t.direction,"on",p.length),p.push(i),i.update(),i}function l(t){var i={},s=t||{};for(var e in s)s.hasOwnProperty(e)&&(i[e]=s[e]);return i}function c(t){if(this.events&&this.events[t])for(var i=0;i<this.events[t].length;i++){var s=Array.prototype.slice.call(arguments,1);this.events[t][i].apply(this,s)}}var a=t.$,h=i,u={},f=["left","top","right","bottom","width","height"],p=[],d={v:{x:"Y",pos:f[1],oppos:f[3],crossPos:f[0],crossOpPos:f[2],size:f[5],crossSize:f[4],crossMinSize:"min-"+f[4],crossMaxSize:"max-"+f[4],client:"clientHeight",crossClient:"clientWidth",scrollEdge:"scrollLeft",offset:"offsetHeight",crossOffset:"offsetWidth",offsetPos:"offsetTop",scroll:"scrollTop",scrollSize:"scrollHeight"},h:{x:"X",pos:f[0],oppos:f[2],crossPos:f[1],crossOpPos:f[3],size:f[4],crossSize:f[5],crossMinSize:"min-"+f[5],crossMaxSize:"max-"+f[5],client:"clientWidth",crossClient:"clientHeight",scrollEdge:"scrollTop",offset:"offsetWidth",crossOffset:"offsetHeight",offsetPos:"offsetLeft",scroll:"scrollLeft",scrollSize:"scrollWidth"}},v=17,g=15,m=/[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/,b=m.test(t.navigator&&t.navigator.userAgent);i.fn={constructor:function(t,i,e){var r=l(i);r.event=function(t,e,r,o){s(t,function(t){i.event(t,e,r,o)})},this.length=0,s.call(this,t,function(t,i){var s=o(t,r.direction),e=+s;if(e==e&&null!==s&&p[e])this[i]=p[e];else{var c=l(r);if(r.root&&r.scroller){if(c.scroller=r.$(r.scroller,t),!c.scroller.length)return}else c.scroller=t;c.root=t,this[i]=n(c)}this.length=i+1}),this.params=r},dispose:function(){var t=this.params;s(this,function(i,s){i.dispose(t),p[s]=null}),this.params=null},update:function(){var t=arguments;s(this,function(i){i.update.apply(i,t)})},baron:function(t){return t.root=[],this.params.root&&(t.scroller=this.params.scroller),s.call(this,this,function(i){t.root.push(i.root)}),t.direction="v"==this.params.direction?"h":"v",t._chain=!0,i(t)}},u.prototype={_debounce:function(t,i){var s,r,o=this,n=function(){if(o._disposed)return clearTimeout(s),void(s=o=null);var l=e()-r;i>l&&l>=0?s=setTimeout(n,i-l):(s=null,t())};return function(){r=e(),s||(s=setTimeout(n,i))}},constructor:function(i){function s(t,i){return u(t,i)[0]}function r(t){var i=this.barMinSize||20,s=t;s>0&&i>s&&(s=i),this.bar&&u(this.bar).css(this.origin.size,parseInt(s,10)+"px")}function o(t){if(this.bar){var i=u(this.bar).css(this.origin.pos),s=+t+"px";s&&s!=i&&u(this.bar).css(this.origin.pos,s)}}function n(){return m[this.origin.client]-this.barTopLimit-this.bar[this.origin.offset]}function l(t){return t*n.call(this)+this.barTopLimit}function a(t){return(t-this.barTopLimit)/n.call(this)}function h(){return!1}var u,f,p,m,C,y,z,$;if(z=e(),u=this.$=i.$,this.event=i.event,this.events={},this.root=i.root,this.scroller=s(i.scroller),this.bar=s(i.bar,this.root),m=this.track=s(i.track,this.root),!this.track&&this.bar&&(m=this.bar.parentNode),this.clipper=this.scroller.parentNode,this.direction=i.direction,this.rtl=i.rtl,this.origin=d[this.direction],this.barOnCls=i.barOnCls,this.scrollingCls=i.scrollingCls,this.draggingCls=i.draggingCls,this.impact=i.impact,this.position=i.position,this.rtl=i.rtl,this.barTopLimit=0,this.resizeDebounce=i.resizeDebounce,this.cursor=function(t){return t["client"+this.origin.x]||(((t.originalEvent||t).touches||{})[0]||{})["page"+this.origin.x]},this.pos=function(t){var i="page"+this.origin.x+"Offset",s=this.scroller[i]?i:this.origin.scroll;return void 0!==t&&(this.scroller[s]=t),this.scroller[s]},this.rpos=function(t){var i,s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];return i=t?this.pos(t*s):this.pos(),i/(s||1)},this.barOn=function(t){if(this.barOnCls){var i=this.scroller[this.origin.client]>=this.scroller[this.origin.scrollSize];t||i?u(this.root).hasClass(this.barOnCls)&&u(this.root).removeClass(this.barOnCls):u(this.root).hasClass(this.barOnCls)||u(this.root).addClass(this.barOnCls)}},this._pos0=function(t){p=this.cursor(t)-f},this.drag=function(t){var i=a.call(this,this.cursor(t)-p),s=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=i*s},this.selection=function(t){this.event(document,"selectpos selectstart",h,t?"off":"on")},this.resize=function(){function t(){var t,s,r=i.scroller[i.origin.crossOffset],o=i.scroller[i.origin.crossClient],n=0;if(b?n=g:o>0&&0===r&&(r=o+v),r)if(i.barOn(),"scroller"==i.impact){var l=r-o+n;if("static"==i.position)t=i.$(i.scroller).css(i.origin.crossSize),s=i.clipper[i.origin.crossClient]+l+"px",t!=s&&i._setCrossSizes(i.scroller,s);else{var a={},h=i.rtl?"Left":"Right";"h"==i.direction&&(h="Bottom"),a["padding"+h]=l+"px",i.$(i.scroller).css(a)}}else t=i.$(i.clipper).css(i.origin.crossSize),s=o+"px",t!=s&&i._setCrossSizes(i.clipper,s);Array.prototype.unshift.call(arguments,"resize"),c.apply(i,arguments),z=e()}var i=this,s=void 0===i.resizeDebounce?300:i.resizeDebounce,r=0;e()-z<s&&(clearTimeout(C),r=s),r?C=setTimeout(t,r):t()},this.updatePositions=function(){var t,i=this;i.bar&&(t=(m[i.origin.client]-i.barTopLimit)*i.scroller[i.origin.client]/i.scroller[i.origin.scrollSize],parseInt($,10)!=parseInt(t,10)&&(r.call(i,t),$=t),f=l.call(i,i.rpos()),o.call(i,f)),Array.prototype.unshift.call(arguments,"scroll"),c.apply(i,arguments)},this.scroll=function(){var t=this;t.updatePositions(),t.scrollingCls&&(y||t.$(t.root).addClass(t.scrollingCls),clearTimeout(y),y=setTimeout(function(){t.$(t.root).removeClass(t.scrollingCls),y=void 0},300))},this.clipperOnScroll=function(){this.rtl?this.clipper[this.origin.scrollEdge]=this.clipper[this.origin.scrollSize]:this.clipper[this.origin.scrollEdge]=0},this._setCrossSizes=function(t,i){var s={};s[this.origin.crossSize]=i,s[this.origin.crossMinSize]=i,s[this.origin.crossMaxSize]=i,this.$(t).css(s)},this._dumbCss=function(t){if(!i.cssGuru){var s=t?"hidden":null,e=t?"none":null;this.$(this.clipper).css({overflow:s,msOverflowStyle:e,position:"static"==this.position?"":"relative"});var r=t?"scroll":null,o="v"==this.direction?"y":"x",n={};n["overflow-"+o]=r,n["box-sizing"]="border-box",n.margin="0",n.border="0","absolute"==this.position&&(n.position="absolute",n.top="0","h"==this.direction?n.left=n.right="0":(n.bottom="0",n.right=this.rtl?"0":"",n.left=this.rtl?"":"0")),this.$(this.scroller).css(n)}},this._dumbCss(!0),b){var S="paddingRight",_={},w=t.getComputedStyle(this.scroller)[[S]];"h"==i.direction?S="paddingBottom":i.rtl&&(S="paddingLeft");var x=parseInt(w,10);x!=x&&(x=0),_[S]=g+x+"px",u(this.scroller).css(_)}return this},update:function(t){return c.call(this,"upd",t),this.resize(1),this.updatePositions(),this},dispose:function(t){r(this,this.event,"off"),o(this.root,t.direction,"off"),"v"==t.direction?this._setCrossSizes(this.scroller,""):this._setCrossSizes(this.clipper,""),this._dumbCss(!1),this.barOn(!0),c.call(this,"dispose"),this._disposed=!0},on:function(t,i,s){for(var e=t.split(" "),r=0;r<e.length;r++)"init"==e[r]?i.call(this,s):(this.events[e[r]]=this.events[e[r]]||[],this.events[e[r]].push(function(t){i.call(this,t||s)}))}},i.fn.constructor.prototype=i.fn,u.prototype.constructor.prototype=u.prototype,i.noConflict=function(){return t.baron=h,i},i.version="2.2.5","undefined"!=typeof module?(module.exports=i,require("./fix"),require("./pull"),require("./controls"),require("./autoUpdate")):(window.baron=i,a&&a.fn&&(a.fn.baron=i))}(this)(function(t){var i;i="undefined"!=typeof module?require("./core.js"):t.baron;var s=function(t){function i(t,i,s){var e=i,l=1==s?"pos":"oppos";o<(n.minView||0)&&(e=void 0),this.$(r[t]).css(this.origin.pos,"").css(this.origin.oppos,"").removeClass(n.outside),void 0!==e&&(e+="px",this.$(r[t]).css(this.origin[l],e).addClass(n.outside))}function s(t){try{var i=document.createEvent("WheelEvent");i.initWebKitWheelEvent(t.originalEvent.wheelDeltaX,t.originalEvent.wheelDeltaY),h.dispatchEvent(i),t.preventDefault()}catch(s){}}function e(t){var i;for(var e in t)n[e]=t[e];if(r=this.$(n.elements,this.scroller)){o=this.scroller[this.origin.client];for(var h=0;h<r.length;h++)i={},i[this.origin.size]=r[h][this.origin.offset],r[h].parentNode!==this.scroller&&this.$(r[h].parentNode).css(i),i={},i[this.origin.crossSize]=r[h].parentNode[this.origin.crossClient],this.$(r[h]).css(i),o-=r[h][this.origin.offset],a[h]=r[h].parentNode[this.origin.offsetPos],l[h]=l[h-1]||0,c[h]=c[h-1]||Math.min(a[h],0),r[h-1]&&(l[h]+=r[h-1][this.origin.offset],c[h]+=r[h-1][this.origin.offset]),(0!=h||0!=a[h])&&(this.event(r[h],"mousewheel",s,"off"),this.event(r[h],"mousewheel",s));n.limiter&&r[0]&&(this.track&&this.track!=this.scroller?(i={},i[this.origin.pos]=r[0].parentNode[this.origin.offset],this.$(this.track).css(i)):this.barTopLimit=r[0].parentNode[this.origin.offset],this.scroll()),n.limiter===!1&&(this.barTopLimit=0)}var d={element:r,handler:function(){for(var t,i=f(this)[0].parentNode,s=i.offsetTop,e=0;e<r.length;e++)r[e]===this&&(t=e);var o=s-l[t];n.scroll?n.scroll({x1:p.scroller.scrollTop,x2:o}):p.scroller.scrollTop=o},type:"click"};n.clickable&&(this._eventHandlers.push(d),u(d.element,d.type,d.handler,"on"))}var r,o,n={outside:"",inside:"",before:"",after:"",past:"",future:"",radius:0,minView:0},l=[],c=[],a=[],h=this.scroller,u=this.event,f=this.$,p=this;this.on("init",e,t);var d=[],v=[];this.on("init scroll",function(){var t,s,e,h;if(r){var u;for(h=0;h<r.length;h++)t=0,a[h]-this.pos()<c[h]+n.radius?(t=1,s=l[h]):a[h]-this.pos()>c[h]+o-n.radius?(t=2,s=this.scroller[this.origin.client]-r[h][this.origin.offset]-l[h]-o):(t=3,s=void 0),e=!1,(a[h]-this.pos()<c[h]||a[h]-this.pos()>c[h]+o)&&(e=!0),(t!=d[h]||e!=v[h])&&(i.call(this,h,s,t),d[h]=t,v[h]=e,u=!0);if(u)for(h=0;h<r.length;h++)1==d[h]&&n.past&&this.$(r[h]).addClass(n.past).removeClass(n.future),2==d[h]&&n.future&&this.$(r[h]).addClass(n.future).removeClass(n.past),3==d[h]?((n.future||n.past)&&this.$(r[h]).removeClass(n.past).removeClass(n.future),n.inside&&this.$(r[h]).addClass(n.inside)):n.inside&&this.$(r[h]).removeClass(n.inside),d[h]!=d[h+1]&&1==d[h]&&n.before?this.$(r[h]).addClass(n.before).removeClass(n.after):d[h]!=d[h-1]&&2==d[h]&&n.after?this.$(r[h]).addClass(n.after).removeClass(n.before):this.$(r[h]).removeClass(n.before).removeClass(n.after),n.grad&&(v[h]?this.$(r[h]).addClass(n.grad):this.$(r[h]).removeClass(n.grad))}}),this.on("resize upd",function(t){e.call(this,t&&t.fix)})};i.fn.fix=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(this))(function(t){var i;i="undefined"!=typeof module?require("./core"):t.baron;var s=t.MutationObserver||t.WebKitMutationObserver||t.MozMutationObserver||null,e=function(){function t(){o.root[o.origin.offset]?e():i()}function i(){r||(r=setInterval(function(){o.root[o.origin.offset]&&(e(),o.update())},300))}function e(){clearInterval(r),r=null}var r,o=this;if(!this._au){var n=o._debounce(function(){o.update()},300);this._observer=new s(function(){t(),o.update(),n()}),this.on("init",function(){o._observer.observe(o.root,{childList:!0,subtree:!0,characterData:!0}),t()}),this.on("dispose",function(){o._observer.disconnect(),e(),delete o._observer}),this._au=!0}};i.fn.autoUpdate=function(t){if(!s)return this;for(var i=0;this[i];)e.call(this[i],t),i++;return this}}(this))(function(t){var i;i="undefined"!=typeof module?require("./core"):t.baron;var s=function(t){var i,s,e,r,o,n=this;r=t.screen||.9,t.forward&&(i=this.$(t.forward,this.clipper),o={element:i,handler:function(){var i=n.pos()+(t.delta||30);n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.backward&&(s=this.$(t.backward,this.clipper),o={element:s,handler:function(){var i=n.pos()-(t.delta||30);n.pos(i)},type:"click"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")),t.track&&(e=t.track===!0?this.track:this.$(t.track,this.clipper)[0],e&&(o={element:e,handler:function(t){if(t.target==e){var i=t["offset"+n.origin.x],s=n.bar[n.origin.offsetPos],o=0;s>i?o=-1:i>s+n.bar[n.origin.offset]&&(o=1);var l=n.pos()+o*r*n.scroller[n.origin.client];n.pos(l)}},type:"mousedown"},this._eventHandlers.push(o),this.event(o.element,o.type,o.handler,"on")))};i.fn.controls=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(this));
{
"name": "baron",
"description": "A small, fast and crossbrowser custom scrollbar with native system scroll mechanic.",
"version": "2.2.4",
"version": "2.2.5",
"readmeFilename": "README.md",

@@ -29,4 +29,3 @@ "homepage": "https://github.com/Diokuz/baron",

"gulp-concat": "^2.4.2",
"gulp-jscs": "^2.0.0",
"gulp-jshint": "^1.11.2",
"gulp-eslint": "^2.0.0",
"gulp-mocha": "^2.2.0",

@@ -33,0 +32,0 @@ "gulp-mocha-phantomjs": "^0.10.1",

/* Autoupdate plugin for baron 0.6+ */
(function(scopedWindow) {
var scopedBaron;
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core');
scopedBaron = require('./core')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}
var MutationObserver = scopedWindow.MutationObserver || scopedWindow.WebKitMutationObserver || scopedWindow.MozMutationObserver || null;
var MutationObserver = scopedWindow.MutationObserver || scopedWindow.WebKitMutationObserver || scopedWindow.MozMutationObserver || null
var autoUpdate = function() {
var self = this;
var watcher;
var self = this
var watcher
if (this._au) {
return;
return
}

@@ -23,5 +23,5 @@

if (!self.root[self.origin.offset]) {
startWatch();
startWatch()
} else {
stopWatch();
stopWatch()
}

@@ -32,26 +32,26 @@ }

function startWatch() {
if (watcher) return;
if (watcher) return
watcher = setInterval(function() {
if (self.root[self.origin.offset]) {
stopWatch();
self.update();
stopWatch()
self.update()
}
}, 300); // is it good enought for you?)
}, 300) // is it good enought for you?)
}
function stopWatch() {
clearInterval(watcher);
watcher = null;
clearInterval(watcher)
watcher = null
}
var debouncedUpdater = self._debounce(function() {
self.update();
}, 300);
self.update()
}, 300)
this._observer = new MutationObserver(function() {
actualizeWatcher();
self.update();
debouncedUpdater();
});
actualizeWatcher()
self.update()
debouncedUpdater()
})

@@ -68,28 +68,28 @@ this.on('init', function() {

// Other cases are covered by watcher, and you still can do .update by yourself
});
})
actualizeWatcher();
});
actualizeWatcher()
})
this.on('dispose', function() {
self._observer.disconnect();
stopWatch();
delete self._observer;
});
self._observer.disconnect()
stopWatch()
delete self._observer
})
this._au = true;
};
this._au = true
}
scopedBaron.fn.autoUpdate = function(params) {
if (!MutationObserver) return this;
if (!MutationObserver) return this
var i = 0;
var i = 0
while (this[i]) {
autoUpdate.call(this[i], params);
i++;
autoUpdate.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))
/* Controls plugin for baron 0.6+ */
(function(scopedWindow, undefined) {
var scopedBaron;
(function(scopedWindow) {
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core');
scopedBaron = require('./core')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}

@@ -14,8 +14,8 @@

self = this, // AAAAAA!!!!!11
event;
event
screen = params.screen || 0.9;
screen = params.screen || 0.9
if (params.forward) {
forward = this.$(params.forward, this.clipper);
forward = this.$(params.forward, this.clipper)

@@ -26,16 +26,16 @@ event = {

handler: function() {
var y = self.pos() + (params.delta || 30);
var y = self.pos() + (params.delta || 30)
self.pos(y);
self.pos(y)
},
type: 'click'
};
}
this._eventHandlers.push(event); // For auto-dispose
this.event(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
this.event(event.element, event.type, event.handler, 'on')
}
if (params.backward) {
backward = this.$(params.backward, this.clipper);
backward = this.$(params.backward, this.clipper)

@@ -46,12 +46,12 @@ event = {

handler: function() {
var y = self.pos() - (params.delta || 30);
var y = self.pos() - (params.delta || 30)
self.pos(y);
self.pos(y)
},
type: 'click'
};
}
this._eventHandlers.push(event); // For auto-dispose
this.event(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
this.event(event.element, event.type, event.handler, 'on')
}

@@ -61,5 +61,5 @@

if (params.track === true) {
track = this.track;
track = this.track
} else {
track = this.$(params.track, this.clipper)[0];
track = this.$(params.track, this.clipper)[0]
}

@@ -73,37 +73,38 @@

// https://github.com/Diokuz/baron/issues/121
if (e.target != track) return;
if (e.target != track) return
var x = e['offset' + self.origin.x],
xBar = self.bar[self.origin.offsetPos],
sign = 0;
sign = 0
if (x < xBar) {
sign = -1;
sign = -1
} else if (x > xBar + self.bar[self.origin.offset]) {
sign = 1;
sign = 1
}
var y = self.pos() + sign * screen * self.scroller[self.origin.client];
self.pos(y);
var y = self.pos() + sign * screen * self.scroller[self.origin.client]
self.pos(y)
},
type: 'mousedown'
};
}
this._eventHandlers.push(event); // For auto-dispose
this.event(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
this.event(event.element, event.type, event.handler, 'on')
}
}
};
}
scopedBaron.fn.controls = function(params) {
var i = 0;
var i = 0
while (this[i]) {
controls.call(this[i], params);
i++;
controls.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))

@@ -1,10 +0,10 @@

(function(scopedWindow, undefined) {
'use strict';
(function(scopedWindow) {
'use strict'
var onClient = typeof window != 'undefined';
var $ = scopedWindow.$;
var _baron = baron; // Stored baron value for noConflict usage
var pos = ['left', 'top', 'right', 'bottom', 'width', 'height'];
var $ = scopedWindow.$
var _baron = baron // Stored baron value for noConflict usage
var Item = {}
var pos = ['left', 'top', 'right', 'bottom', 'width', 'height']
// Global store for all baron instances (to be able to dispose them on html-nodes)
var instances = [];
var instances = []
var origin = {

@@ -29,27 +29,28 @@ v: { // Vertical

}
};
}
// Some ugly vars
var opera12maxScrollbarSize = 17;
var opera12maxScrollbarSize = 17
// I hate you https://github.com/Diokuz/baron/issues/110
var macmsxffScrollbarSize = 15;
var macosxffRe = /[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/;
var isMacFF = macosxffRe.test(scopedWindow.navigator && scopedWindow.navigator.userAgent);
var macmsxffScrollbarSize = 15
var macosxffRe = /[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/
var isMacFF = macosxffRe.test(scopedWindow.navigator && scopedWindow.navigator.userAgent)
// removeIf(production)
var log = function() {
baron.fn.log.apply(this, arguments);
};
var liveBarons = 0;
baron.fn.log.apply(this, arguments)
}
var liveBarons = 0
var shownErrors = {
liveTooMany: false,
allTooMany: false
};
}
// endRemoveIf(production)
// window.baron and jQuery.fn.baron points to this function
function baron(params) {
var jQueryMode;
var roots;
var withParams = !!params;
function baron(user) {
var params = user
var jQueryMode
var roots
var withParams = !!params
var defaultParams = {

@@ -61,3 +62,3 @@ $: scopedWindow.jQuery,

event: function(elem, event, func, mode) {
params.$(elem)[mode || 'on'](event, func);
params.$(elem)[mode || 'on'](event, func)
},

@@ -67,5 +68,5 @@ cssGuru: false,

position: 'static'
};
}
params = params || {};
params = params || {}

@@ -75,5 +76,5 @@ // Extending default params by user-defined params

if (params[key] === undefined) {
params[key] = defaultParams[key];
params[key] = defaultParams[key]
}
};
}

@@ -85,3 +86,3 @@ // removeIf(production)

'https://github.com/Diokuz/baron/blob/master/docs/logs/no-jquery-detected.md'
].join(', '), params);
].join(', '), params)
}

@@ -93,3 +94,3 @@ if (params.position == 'absolute' && params.impact == 'clipper') {

'See more https://github.com/Diokuz/baron/issues/138'
].join(' '), params);
].join(' '), params)
}

@@ -99,31 +100,32 @@ // endRemoveIf(production)

// this - something or jQuery instance
jQueryMode = params.$ && this instanceof params.$;
jQueryMode = params.$ && this instanceof params.$
if (params._chain) {
roots = params.root;
roots = params.root
} else if (jQueryMode) {
params.root = roots = this;
params.root = roots = this
} else if (params.$) {
roots = params.$(params.root || params.scroller);
roots = params.$(params.root || params.scroller)
} else {
roots = []; // noop mode, like jQuery when no matched html-nodes found
roots = [] // noop mode, like jQuery when no matched html-nodes found
}
var instance = new baron.fn.constructor(roots, params, withParams);
var instance = new baron.fn.constructor(roots, params, withParams)
if (instance.autoUpdate) {
instance.autoUpdate();
instance.autoUpdate()
}
return instance;
return instance
}
function arrayEach(obj, iterator) {
var i = 0;
function arrayEach(_obj, iterator) {
var i = 0
var obj = _obj
if (obj.length === undefined || obj === scopedWindow) obj = [obj];
if (obj.length === undefined || obj === scopedWindow) obj = [obj]
while (obj[i]) {
iterator.call(this, obj[i], i);
i++;
iterator.call(this, obj[i], i)
i++
}

@@ -134,7 +136,7 @@ }

function getTime() {
return new Date().getTime();
return new Date().getTime()
}
// removeIf(production)
baron._instances = instances;
baron._instances = instances
// endRemoveIf(production)

@@ -144,3 +146,3 @@

constructor: function(roots, totalParams, withParams) {
var params = clone(totalParams);
var params = clone(totalParams)

@@ -150,11 +152,11 @@ // Intrinsic params.event is not the same as totalParams.event

arrayEach(elems, function(elem) {
totalParams.event(elem, e, func, mode);
});
};
totalParams.event(elem, e, func, mode)
})
}
this.length = 0;
this.length = 0
arrayEach.call(this, roots, function(root, i) {
var attr = manageAttr(root, params.direction);
var id = +attr; // Could be NaN
var attr = manageAttr(root, params.direction)
var id = +attr // Could be NaN

@@ -170,51 +172,51 @@ // baron() can return existing instances,

'https://github.com/Diokuz/baron/blob/master/docs/logs/repeated.md'
].join(', '), totalParams.root);
].join(', '), totalParams.root)
}
// endRemoveIf(production)
this[i] = instances[id];
this[i] = instances[id]
} else {
var perInstanceParams = clone(params);
var perInstanceParams = clone(params)
// root and scroller can be different nodes
if (params.root && params.scroller) {
perInstanceParams.scroller = params.$(params.scroller, root);
perInstanceParams.scroller = params.$(params.scroller, root)
if (!perInstanceParams.scroller.length) {
// removeIf(production)
console.log('Scroller not found!', root, params.scroller);
console.log('Scroller not found!', root, params.scroller)
// endRemoveIf(production)
return;
return
}
} else {
perInstanceParams.scroller = root;
perInstanceParams.scroller = root
}
perInstanceParams.root = root;
this[i] = init(perInstanceParams);
perInstanceParams.root = root
this[i] = init(perInstanceParams)
}
this.length = i + 1;
});
this.length = i + 1
})
this.params = params;
this.params = params
},
dispose: function() {
var params = this.params;
var params = this.params
arrayEach(this, function(instance, index) {
instance.dispose(params);
instances[index] = null;
});
instance.dispose(params)
instances[index] = null
})
this.params = null;
this.params = null
},
update: function() {
var args = arguments;
var args = arguments
arrayEach(this, function(instance, index) {
arrayEach(this, function(instance) {
// instance cannot be null, because it is stored by user
instance.update.apply(instance, args);
});
instance.update.apply(instance, args)
})
},

@@ -224,16 +226,16 @@

baron: function(params) {
params.root = [];
params.root = []
if (this.params.root) {
params.scroller = this.params.scroller;
params.scroller = this.params.scroller
}
arrayEach.call(this, this, function(elem) {
params.root.push(elem.root);
});
params.direction = (this.params.direction == 'v') ? 'h' : 'v';
params._chain = true;
params.root.push(elem.root)
})
params.direction = (this.params.direction == 'v') ? 'h' : 'v'
params._chain = true
return baron(params);
return baron(params)
}
};
}

@@ -248,3 +250,3 @@ function manageEvents(item, eventManager, mode) {

handler: function(e) {
item.scroll(e);
item.scroll(e)
},

@@ -258,3 +260,3 @@

handler: function() {
item.update();
item.update()
},

@@ -268,3 +270,3 @@

handler: function() {
item.update();
item.update()
},

@@ -278,7 +280,7 @@

handler: function(e) {
e.preventDefault(); // Text selection disabling in Opera
item.selection(); // Disable text selection in ie8
item.drag.now = 1; // Save private byte
e.preventDefault() // Text selection disabling in Opera
item.selection() // Disable text selection in ie8
item.drag.now = 1 // Save private byte
if (item.draggingCls) {
$(item.root).addClass(item.draggingCls);
$(item.root).addClass(item.draggingCls)
}

@@ -293,6 +295,6 @@ },

handler: function() {
item.selection(1); // Enable text selection
item.drag.now = 0;
item.selection(1) // Enable text selection
item.drag.now = 0
if (item.draggingCls) {
$(item.root).removeClass(item.draggingCls);
$(item.root).removeClass(item.draggingCls)
}

@@ -308,3 +310,3 @@ },

if (e.button != 2) { // Not RM
item._pos0(e);
item._pos0(e)
}

@@ -320,3 +322,3 @@ },

if (item.drag.now) {
item.drag(e);
item.drag(e)
}

@@ -332,3 +334,3 @@ },

handler: function() {
item.update();
item.update()
},

@@ -343,3 +345,3 @@

handler: function() {
item.update();
item.update()
},

@@ -353,3 +355,3 @@

handler: function() {
item.clipperOnScroll();
item.clipperOnScroll()
},

@@ -359,22 +361,22 @@

}
];
]
arrayEach(item._eventHandlers, function(event) {
if (event.element) {
eventManager(event.element, event.type, event.handler, mode);
eventManager(event.element, event.type, event.handler, mode)
}
});
})
// if (item.scroller) {
// event(item.scroller, 'scroll', item._eventHandlers.onScroll, mode);
// event(item.scroller, 'scroll', item._eventHandlers.onScroll, mode)
// }
// if (item.bar) {
// event(item.bar, 'touchstart mousedown', item._eventHandlers.onMouseDown, mode);
// event(item.bar, 'touchstart mousedown', item._eventHandlers.onMouseDown, mode)
// }
// event(document, 'mouseup blur touchend', item._eventHandlers.onMouseUp, mode);
// event(document, 'touchstart mousedown', item._eventHandlers.onCoordinateReset, mode);
// event(document, 'mousemove touchmove', item._eventHandlers.onMouseMove, mode);
// event(window, 'resize', item._eventHandlers.onResize, mode);
// event(document, 'mouseup blur touchend', item._eventHandlers.onMouseUp, mode)
// event(document, 'touchstart mousedown', item._eventHandlers.onCoordinateReset, mode)
// event(document, 'mousemove touchmove', item._eventHandlers.onMouseMove, mode)
// event(window, 'resize', item._eventHandlers.onResize, mode)
// if (item.root) {
// event(item.root, 'sizeChange', item._eventHandlers.onResize, mode);
// event(item.root, 'sizeChange', item._eventHandlers.onResize, mode)
// // Custon event for alternate baron update mechanism

@@ -387,11 +389,11 @@ // }

function manageAttr(node, direction, mode, id) {
var attrName = 'data-baron-' + direction + '-id';
var attrName = 'data-baron-' + direction + '-id'
if (mode == 'on') {
node.setAttribute(attrName, id);
node.setAttribute(attrName, id)
} else if (mode == 'off') {
node.removeAttribute(attrName);
} else {
return node.getAttribute(attrName);
node.removeAttribute(attrName)
}
return node.getAttribute(attrName)
}

@@ -401,11 +403,11 @@

// __proto__ of returning object is baron.prototype
var out = new item.prototype.constructor(params);
var out = new Item.prototype.constructor(params)
manageEvents(out, params.event, 'on');
manageEvents(out, params.event, 'on')
manageAttr(out.root, params.direction, 'on', instances.length);
instances.push(out);
manageAttr(out.root, params.direction, 'on', instances.length)
instances.push(out)
// removeIf(production)
liveBarons++;
liveBarons++
if (liveBarons > 100 && !shownErrors.liveTooMany) {

@@ -416,4 +418,4 @@ log('warn', [

'All baron instances can be found in baron._instances:'
].join(' '), instances);
shownErrors.liveTooMany = true;
].join(' '), instances)
shownErrors.liveTooMany = true
}

@@ -426,45 +428,31 @@ if (instances.length > 1000 && !shownErrors.allTooMany) {

'All baron instances can be found in baron._instances:'
].join(' '), instances);
shownErrors.allTooMany = true;
].join(' '), instances)
shownErrors.allTooMany = true
}
// endRemoveIf(production)
out.update();
out.update()
return out;
return out
}
function clone(input) {
var output = {};
function clone(_input) {
var output = {}
var input = _input || {}
input = input || {};
for (var key in input) {
if (input.hasOwnProperty(key)) {
output[key] = input[key];
output[key] = input[key]
}
}
return output;
return output
}
function validate(input) {
var output = clone(input);
output.event = function(elems, e, func, mode) {
arrayEach(elems, function(elem) {
input.event(elem, e, func, mode);
});
};
return output;
}
function fire(eventName) {
/* jshint validthis:true */
if (this.events && this.events[eventName]) {
for (var i = 0 ; i < this.events[eventName].length ; i++) {
var args = Array.prototype.slice.call( arguments, 1 );
for (var i = 0; i < this.events[eventName].length; i++) {
var args = Array.prototype.slice.call( arguments, 1 )
this.events[eventName][i].apply(this, args);
this.events[eventName][i].apply(this, args)
}

@@ -474,5 +462,3 @@ }

var item = {};
item.prototype = {
Item.prototype = {
// underscore.js realization

@@ -485,39 +471,39 @@ // used in autoUpdate plugin

// context, // and for context
timestamp;
// result; // and for result
timestamp
// result // and for result
var later = function() {
if (self._disposed) {
clearTimeout(timeout);
timeout = self = null;
return;
clearTimeout(timeout)
timeout = self = null
return
}
var last = getTime() - timestamp;
var last = getTime() - timestamp
if (last < wait && last >= 0) {
timeout = setTimeout(later, wait - last);
timeout = setTimeout(later, wait - last)
} else {
timeout = null;
// result = func.apply(context, args);
func();
// context = args = null;
timeout = null
// result = func.apply(context, args)
func()
// context = args = null
}
};
}
return function() {
// context = this;
// args = arguments;
timestamp = getTime();
// context = this
// args = arguments
timestamp = getTime()
if (!timeout) {
timeout = setTimeout(later, wait);
timeout = setTimeout(later, wait)
}
// return result;
};
// return result
}
},
constructor: function(params) {
var $,
var _$,
barPos,

@@ -528,50 +514,57 @@ scrollerPos0,

scrollingTimer,
scrollLastFire,
resizeLastFire,
oldBarSize;
oldBarSize
resizeLastFire = scrollLastFire = getTime();
resizeLastFire = getTime()
$ = this.$ = params.$;
this.event = params.event;
this.events = {};
_$ = this.$ = params.$
this.event = params.event
this.events = {}
function getNode(sel, context) {
return $(sel, context)[0]; // Can be undefined
return _$(sel, context)[0] // Can be undefined
}
// DOM elements
this.root = params.root; // Always html node, not just selector
this.scroller = getNode(params.scroller);
this.bar = getNode(params.bar, this.root);
track = this.track = getNode(params.track, this.root);
this.root = params.root // Always html node, not just selector
this.scroller = getNode(params.scroller)
// removeIf(production)
if (this.scroller.tagName == 'body') {
log('error', [
'Please, do not use BODY as a scroller.',
'https://github.com/Diokuz/baron/blob/master/docs/logs/do-not-use-body.md'
].join(', '), params)
}
// endRemoveIf(production)
this.bar = getNode(params.bar, this.root)
track = this.track = getNode(params.track, this.root)
if (!this.track && this.bar) {
track = this.bar.parentNode;
track = this.bar.parentNode
}
this.clipper = this.scroller.parentNode;
this.clipper = this.scroller.parentNode
// Parameters
this.direction = params.direction;
this.rtl = params.rtl;
this.origin = origin[this.direction];
this.barOnCls = params.barOnCls;
this.scrollingCls = params.scrollingCls;
this.draggingCls = params.draggingCls;
this.impact = params.impact;
this.position = params.position;
this.rtl = params.rtl;
this.barTopLimit = 0;
this.resizeDebounce = params.resizeDebounce;
this.direction = params.direction
this.rtl = params.rtl
this.origin = origin[this.direction]
this.barOnCls = params.barOnCls
this.scrollingCls = params.scrollingCls
this.draggingCls = params.draggingCls
this.impact = params.impact
this.position = params.position
this.rtl = params.rtl
this.barTopLimit = 0
this.resizeDebounce = params.resizeDebounce
// Updating height or width of bar
function setBarSize(size) {
/* jshint validthis:true */
var barMinSize = this.barMinSize || 20;
function setBarSize(_size) {
var barMinSize = this.barMinSize || 20
var size = _size
if (size > 0 && size < barMinSize) {
size = barMinSize;
size = barMinSize
}
if (this.bar) {
$(this.bar).css(this.origin.size, parseInt(size, 10) + 'px');
_$(this.bar).css(this.origin.size, parseInt(size, 10) + 'px')
}

@@ -581,10 +574,9 @@ }

// Updating top or left bar position
function posBar(pos) {
/* jshint validthis:true */
function posBar(_pos) {
if (this.bar) {
var was = $(this.bar).css(this.origin.pos),
will = +pos + 'px';
var was = _$(this.bar).css(this.origin.pos),
will = +_pos + 'px'
if (will && will != was) {
$(this.bar).css(this.origin.pos, will);
_$(this.bar).css(this.origin.pos, will)
}

@@ -596,4 +588,3 @@ }

function k() {
/* jshint validthis:true */
return track[this.origin.client] - this.barTopLimit - this.bar[this.origin.offset];
return track[this.origin.client] - this.barTopLimit - this.bar[this.origin.offset]
}

@@ -603,4 +594,3 @@

function relToPos(r) {
/* jshint validthis:true */
return r * k.call(this) + this.barTopLimit;
return r * k.call(this) + this.barTopLimit
}

@@ -610,4 +600,3 @@

function posToRel(t) {
/* jshint validthis:true */
return (t - this.barTopLimit) / k.call(this);
return (t - this.barTopLimit) / k.call(this)
}

@@ -618,8 +607,8 @@

return e['client' + this.origin.x] ||
(((e.originalEvent || e).touches || {})[0] || {})['page' + this.origin.x];
};
(((e.originalEvent || e).touches || {})[0] || {})['page' + this.origin.x]
}
// Text selection pos preventing
function dontPosSelect() {
return false;
return false
}

@@ -629,21 +618,21 @@

var ie = 'page' + this.origin.x + 'Offset',
key = (this.scroller[ie]) ? ie : this.origin.scroll;
key = (this.scroller[ie]) ? ie : this.origin.scroll
if (x !== undefined) this.scroller[key] = x;
if (x !== undefined) this.scroller[key] = x
return this.scroller[key];
};
return this.scroller[key]
}
this.rpos = function(r) { // Relative scroller position (0..1)
var free = this.scroller[this.origin.scrollSize] - this.scroller[this.origin.client],
x;
x
if (r) {
x = this.pos(r * free);
x = this.pos(r * free)
} else {
x = this.pos();
x = this.pos()
}
return x / (free || 1);
};
return x / (free || 1)
}

@@ -653,30 +642,29 @@ // Switch on the bar by adding user-defined CSS classname to scroller

if (this.barOnCls) {
if (dispose ||
this.scroller[this.origin.client] >= this.scroller[this.origin.scrollSize])
{
if ($(this.root).hasClass(this.barOnCls)) {
$(this.root).removeClass(this.barOnCls);
var noScroll = this.scroller[this.origin.client] >= this.scroller[this.origin.scrollSize]
if (dispose || noScroll) {
if (_$(this.root).hasClass(this.barOnCls)) {
_$(this.root).removeClass(this.barOnCls)
}
} else {
if (!$(this.root).hasClass(this.barOnCls)) {
$(this.root).addClass(this.barOnCls);
}
} else if (!_$(this.root).hasClass(this.barOnCls)) {
_$(this.root).addClass(this.barOnCls)
}
}
};
}
this._pos0 = function(e) {
scrollerPos0 = this.cursor(e) - barPos;
};
scrollerPos0 = this.cursor(e) - barPos
}
this.drag = function(e) {
var rel = posToRel.call(this, this.cursor(e) - scrollerPos0);
var k = (this.scroller[this.origin.scrollSize] - this.scroller[this.origin.client]);
this.scroller[this.origin.scroll] = rel * k;
};
var rel = posToRel.call(this, this.cursor(e) - scrollerPos0)
var sub = (this.scroller[this.origin.scrollSize] - this.scroller[this.origin.client])
this.scroller[this.origin.scroll] = rel * sub
}
// Text selection preventing on drag
this.selection = function(enable) {
this.event(document, 'selectpos selectstart', dontPosSelect, enable ? 'off' : 'on');
};
this.event(document, 'selectpos selectstart', dontPosSelect, enable ? 'off' : 'on')
}

@@ -687,19 +675,20 @@ // onResize & DOM modified handler

this.resize = function() {
var self = this;
var minPeriod = (self.resizeDebounce === undefined) ? 300 : self.resizeDebounce;
var delay = 0;
var self = this
var minPeriod = (self.resizeDebounce === undefined) ? 300 : self.resizeDebounce
var delay = 0
if (getTime() - resizeLastFire < minPeriod) {
clearTimeout(resizePauseTimer);
delay = minPeriod;
clearTimeout(resizePauseTimer)
delay = minPeriod
}
function upd() {
var offset = self.scroller[self.origin.crossOffset];
var client = self.scroller[self.origin.crossClient];
var padding = 0;
var offset = self.scroller[self.origin.crossOffset]
var client = self.scroller[self.origin.crossClient]
var padding = 0
var was, will
// https://github.com/Diokuz/baron/issues/110
if (isMacFF) {
padding = macmsxffScrollbarSize;
padding = macmsxffScrollbarSize

@@ -713,36 +702,36 @@ // Opera 12 bug https://github.com/Diokuz/baron/issues/105

// 17px for Windows XP-8.1, 15px for Mac (really rare).
offset = client + opera12maxScrollbarSize;
offset = client + opera12maxScrollbarSize
}
if (offset) { // if there is no size, css should not be set
self.barOn();
self.barOn()
if (self.impact == 'scroller') { // scroller
var delta = offset - client + padding;
var delta = offset - client + padding
// `static` position works only for `scroller` impact
if (self.position == 'static') { // static
var was = self.$(self.scroller).css(self.origin.crossSize);
var will = self.clipper[self.origin.crossClient] + delta + 'px';
was = self.$(self.scroller).css(self.origin.crossSize)
will = self.clipper[self.origin.crossClient] + delta + 'px'
if (was != will) {
self._setCrossSizes(self.scroller, will);
self._setCrossSizes(self.scroller, will)
}
} else { // absolute
var css = {};
var key = self.rtl ? 'Left' : 'Right';
var css = {}
var key = self.rtl ? 'Left' : 'Right'
if (self.direction == 'h') {
key = 'Bottom';
key = 'Bottom'
}
css['padding' + key] = delta + 'px';
self.$(self.scroller).css(css);
css['padding' + key] = delta + 'px'
self.$(self.scroller).css(css)
}
} else { // clipper
var was = $(self.clipper).css(self.origin.crossSize);
var will = client + 'px';
was = self.$(self.clipper).css(self.origin.crossSize)
will = client + 'px'
if (was != will) {
self._setCrossSizes(self.clipper, will);
self._setCrossSizes(self.clipper, will)
}

@@ -754,57 +743,55 @@ }

Array.prototype.unshift.call(arguments, 'resize');
fire.apply(self, arguments);
Array.prototype.unshift.call(arguments, 'resize')
fire.apply(self, arguments)
resizeLastFire = getTime();
resizeLastFire = getTime()
}
if (delay) {
resizePauseTimer = setTimeout(upd, delay);
resizePauseTimer = setTimeout(upd, delay)
} else {
upd();
upd()
}
};
}
this.updatePositions = function() {
var newBarSize,
self = this;
self = this
if (self.bar) {
newBarSize = (track[self.origin.client] - self.barTopLimit) *
self.scroller[self.origin.client] / self.scroller[self.origin.scrollSize];
self.scroller[self.origin.client] / self.scroller[self.origin.scrollSize]
// Positioning bar
if (parseInt(oldBarSize, 10) != parseInt(newBarSize, 10)) {
setBarSize.call(self, newBarSize);
oldBarSize = newBarSize;
setBarSize.call(self, newBarSize)
oldBarSize = newBarSize
}
barPos = relToPos.call(self, self.rpos());
barPos = relToPos.call(self, self.rpos())
posBar.call(self, barPos);
posBar.call(self, barPos)
}
Array.prototype.unshift.call( arguments, 'scroll' );
fire.apply(self, arguments);
Array.prototype.unshift.call( arguments, 'scroll' )
fire.apply(self, arguments)
}
scrollLastFire = getTime();
};
// onScroll handler
this.scroll = function() {
var self = this;
var self = this
self.updatePositions();
self.updatePositions()
if (self.scrollingCls) {
if (!scrollingTimer) {
self.$(self.root).addClass(self.scrollingCls);
self.$(self.root).addClass(self.scrollingCls)
}
clearTimeout(scrollingTimer);
clearTimeout(scrollingTimer)
scrollingTimer = setTimeout(function() {
self.$(self.root).removeClass(self.scrollingCls);
scrollingTimer = undefined;
}, 300);
self.$(self.root).removeClass(self.scrollingCls)
scrollingTimer = undefined
}, 300)
}
};
}

@@ -814,11 +801,11 @@ // https://github.com/Diokuz/baron/issues/116

// WTF is this line? https://github.com/Diokuz/baron/issues/134
// if (this.direction == 'h') return;
// if (this.direction == 'h') return
// assign `initial scroll position` to `clipper.scrollLeft` (0 for ltr, ~20 for rtl)
if (!this.rtl) {
this.clipper[this.origin.scrollEdge] = 0;
this.clipper[this.origin.scrollEdge] = 0
} else {
this.clipper[this.origin.scrollEdge] = this.clipper[this.origin.scrollSize];
this.clipper[this.origin.scrollEdge] = this.clipper[this.origin.scrollSize]
}
};
}

@@ -829,17 +816,17 @@ // Flexbox `align-items: stretch` (default) requires to set min-width for vertical

this._setCrossSizes = function(node, size) {
var css = {};
var css = {}
css[this.origin.crossSize] = size;
css[this.origin.crossMinSize] = size;
css[this.origin.crossMaxSize] = size;
css[this.origin.crossSize] = size
css[this.origin.crossMinSize] = size
css[this.origin.crossMaxSize] = size
this.$(node).css(css);
};
this.$(node).css(css)
}
// Set common css rules
this._dumbCss = function(on) {
if (params.cssGuru) return;
if (params.cssGuru) return
var overflow = on ? 'hidden' : null;
var msOverflowStyle = on ? 'none' : null;
var overflow = on ? 'hidden' : null
var msOverflowStyle = on ? 'none' : null

@@ -850,53 +837,52 @@ this.$(this.clipper).css({

position: this.position == 'static' ? '' : 'relative'
});
})
var scroll = on ? 'scroll' : null;
var axis = this.direction == 'v' ? 'y' : 'x';
var scrollerCss = {};
var scroll = on ? 'scroll' : null
var axis = this.direction == 'v' ? 'y' : 'x'
var scrollerCss = {}
scrollerCss['overflow-' + axis] = scroll;
scrollerCss['box-sizing'] = 'border-box';
scrollerCss.margin = '0';
scrollerCss.border = '0';
scrollerCss['overflow-' + axis] = scroll
scrollerCss['box-sizing'] = 'border-box'
scrollerCss.margin = '0'
scrollerCss.border = '0'
if (this.position == 'absolute') {
scrollerCss.position = 'absolute';
scrollerCss.top = '0';
scrollerCss.position = 'absolute'
scrollerCss.top = '0'
if (this.direction == 'h') {
scrollerCss.left = scrollerCss.right = '0';
scrollerCss.left = scrollerCss.right = '0'
} else {
scrollerCss.bottom = '0';
scrollerCss.right = this.rtl ? '0' : '';
scrollerCss.left = this.rtl ? '' : '0';
scrollerCss.bottom = '0'
scrollerCss.right = this.rtl ? '0' : ''
scrollerCss.left = this.rtl ? '' : '0'
}
}
this.$(this.scroller).css(scrollerCss);
};
this.$(this.scroller).css(scrollerCss)
}
// onInit actions
this._dumbCss(true);
this._dumbCss(true)
if (isMacFF) {
var padding = 'paddingRight';
var css = {};
var padding = 'paddingRight'
var css = {}
// getComputedStyle is ie9+, but we here only in f ff
var paddingWas = scopedWindow.getComputedStyle(this.scroller)[[padding]];
var delta = this.scroller[this.origin.crossOffset] -
this.scroller[this.origin.crossClient];
var paddingWas = scopedWindow.getComputedStyle(this.scroller)[[padding]]
if (params.direction == 'h') {
padding = 'paddingBottom';
padding = 'paddingBottom'
} else if (params.rtl) {
padding = 'paddingLeft';
padding = 'paddingLeft'
}
var numWas = parseInt(paddingWas, 10);
if (numWas != numWas) numWas = 0;
css[padding] = (macmsxffScrollbarSize + numWas) + 'px';
$(this.scroller).css(css);
var numWas = parseInt(paddingWas, 10)
if (numWas != numWas) numWas = 0
css[padding] = (macmsxffScrollbarSize + numWas) + 'px'
_$(this.scroller).css(css)
}
return this;
return this
},

@@ -912,11 +898,11 @@

this
].join(' '), params);
].join(' '), params)
}
// endRemoveIf(production)
fire.call(this, 'upd', params); // Update all plugins' params
fire.call(this, 'upd', params) // Update all plugins' params
this.resize(1);
this.updatePositions();
this.resize(1)
this.updatePositions()
return this;
return this
},

@@ -928,66 +914,63 @@

if (this._disposed) {
log('error', [
'Already disposed:',
this
].join(' '), params);
log('error', 'Already disposed:', this)
}
// endRemoveIf(production)
manageEvents(this, this.event, 'off');
manageAttr(this.root, params.direction, 'off');
manageEvents(this, this.event, 'off')
manageAttr(this.root, params.direction, 'off')
if (params.direction == 'v') {
this._setCrossSizes(this.scroller, '');
this._setCrossSizes(this.scroller, '')
} else {
this._setCrossSizes(this.clipper, '');
this._setCrossSizes(this.clipper, '')
}
this._dumbCss(false);
this.barOn(true);
fire.call(this, 'dispose');
this._disposed = true;
this._dumbCss(false)
this.barOn(true)
fire.call(this, 'dispose')
this._disposed = true
},
on: function(eventName, func, arg) {
var names = eventName.split(' ');
var names = eventName.split(' ')
for (var i = 0 ; i < names.length ; i++) {
for (var i = 0; i < names.length; i++) {
if (names[i] == 'init') {
func.call(this, arg);
func.call(this, arg)
} else {
this.events[names[i]] = this.events[names[i]] || [];
this.events[names[i]] = this.events[names[i]] || []
this.events[names[i]].push(function(userArg) {
func.call(this, userArg || arg);
});
func.call(this, userArg || arg)
})
}
}
}
};
}
baron.fn.constructor.prototype = baron.fn;
item.prototype.constructor.prototype = item.prototype;
baron.fn.constructor.prototype = baron.fn
Item.prototype.constructor.prototype = Item.prototype
// Use when you need "baron" global var for another purposes
baron.noConflict = function() {
scopedWindow.baron = _baron; // Restoring original value of "baron" global var
scopedWindow.baron = _baron // Restoring original value of "baron" global var
return baron;
};
return baron
}
baron.version = '2.2.4';
baron.version = '2.2.5'
// No AMD support, need it? Notify me.
if (typeof module != 'undefined') {
module.exports = baron;
module.exports = baron
// @todo webpack
require('./fix');
require('./pull');
require('./controls');
require('./autoUpdate');
require('./fix')
require('./pull')
require('./controls')
require('./autoUpdate')
} else {
window.baron = baron;
window.baron = baron
if ($ && $.fn) { // Adding baron to jQuery as plugin
$.fn.baron = baron;
$.fn.baron = baron
}
}
})(this);
}(this))
// removeIf(production)
baron.fn.log = function(level, msg, nodes) {
var time = new Date().toString();
var func = console[level] || console.log;
var time = new Date().toString()
var func = console[level] || console.log
var args = [
'Baron [ ' + time.substr(16, 8) + ' ]: ' + msg,
nodes
];
]
Function.prototype.apply.call(func, console, args);
};
Function.prototype.apply.call(func, console, args)
}
// endRemoveIf(production)
/* Fixable elements plugin for baron 0.6+ */
(function(scopedWindow, undefined) {
var scopedBaron;
(function(scopedWindow) {
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core.js');
scopedBaron = require('./core.js')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}

@@ -13,4 +13,4 @@

var log = function() {
scopedBaron.fn.log.apply(this, arguments);
};
scopedBaron.fn.log.apply(this, arguments)
}
// endRemoveIf(production)

@@ -36,3 +36,3 @@

$ = this.$,
self = this;
self = this

@@ -44,3 +44,3 @@ // removeIf(production)

'See more https://github.com/Diokuz/baron/issues/135'
].join(' '), this.params);
].join(' '), this.params)
}

@@ -51,16 +51,17 @@ // endRemoveIf(production)

// Invocation only in case when fix-state changed
function fixElement(i, pos, flag) {
var ori = flag == 1 ? 'pos' : 'oppos';
function fixElement(i, _pos, flag) {
var pos = _pos
var ori = flag == 1 ? 'pos' : 'oppos'
if (viewPortSize < (params.minView || 0)) { // No headers fixing when no enought space for viewport
pos = undefined;
pos = undefined
}
// Removing all fixing stuff - we can do this because fixElement triggers only when fixState really changed
this.$(elements[i]).css(this.origin.pos, '').css(this.origin.oppos, '').removeClass(params.outside);
this.$(elements[i]).css(this.origin.pos, '').css(this.origin.oppos, '').removeClass(params.outside)
// Fixing if needed
if (pos !== undefined) {
pos += 'px';
this.$(elements[i]).css(this.origin[ori], pos).addClass(params.outside);
pos += 'px'
this.$(elements[i]).css(this.origin[ori], pos).addClass(params.outside)
}

@@ -71,49 +72,52 @@ }

try {
i = document.createEvent('WheelEvent'); // i - for extra byte
// evt.initWebKitWheelEvent(deltaX, deltaY, window, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
i.initWebKitWheelEvent(e.originalEvent.wheelDeltaX, e.originalEvent.wheelDeltaY);
scroller.dispatchEvent(i);
e.preventDefault();
} catch (e) {}
var i = document.createEvent('WheelEvent') // i - for extra byte
// evt.initWebKitWheelEvent(deltaX, deltaY, window, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey)
i.initWebKitWheelEvent(e.originalEvent.wheelDeltaX, e.originalEvent.wheelDeltaY)
scroller.dispatchEvent(i)
e.preventDefault()
} catch (ex) {
//
}
}
function init(_params) {
var pos;
var pos
for (var key in _params) {
params[key] = _params[key];
params[key] = _params[key]
}
elements = this.$(params.elements, this.scroller);
elements = this.$(params.elements, this.scroller)
if (elements) {
viewPortSize = this.scroller[this.origin.client];
for (var i = 0 ; i < elements.length ; i++) {
viewPortSize = this.scroller[this.origin.client]
for (var i = 0; i < elements.length; i++) {
// Variable header heights
pos = {};
pos[this.origin.size] = elements[i][this.origin.offset];
pos = {}
pos[this.origin.size] = elements[i][this.origin.offset]
if (elements[i].parentNode !== this.scroller) {
this.$(elements[i].parentNode).css(pos);
this.$(elements[i].parentNode).css(pos)
}
pos = {};
pos[this.origin.crossSize] = elements[i].parentNode[this.origin.crossClient];
this.$(elements[i]).css(pos);
pos = {}
pos[this.origin.crossSize] = elements[i].parentNode[this.origin.crossClient]
this.$(elements[i]).css(pos)
// Between fixed headers
viewPortSize -= elements[i][this.origin.offset];
viewPortSize -= elements[i][this.origin.offset]
headerTops[i] = elements[i].parentNode[this.origin.offsetPos]; // No paddings for parentNode
headerTops[i] = elements[i].parentNode[this.origin.offsetPos] // No paddings for parentNode
// Summary elements height above current
topFixHeights[i] = (topFixHeights[i - 1] || 0); // Not zero because of negative margins
topRealHeights[i] = (topRealHeights[i - 1] || Math.min(headerTops[i], 0));
topFixHeights[i] = (topFixHeights[i - 1] || 0) // Not zero because of negative margins
topRealHeights[i] = (topRealHeights[i - 1] || Math.min(headerTops[i], 0))
if (elements[i - 1]) {
topFixHeights[i] += elements[i - 1][this.origin.offset];
topRealHeights[i] += elements[i - 1][this.origin.offset];
topFixHeights[i] += elements[i - 1][this.origin.offset]
topRealHeights[i] += elements[i - 1][this.origin.offset]
}
if ( !(i == 0 && headerTops[i] == 0)/* && force */) {
this.event(elements[i], 'mousewheel', bubbleWheel, 'off');
this.event(elements[i], 'mousewheel', bubbleWheel);
this.event(elements[i], 'mousewheel', bubbleWheel, 'off')
this.event(elements[i], 'mousewheel', bubbleWheel)
}

@@ -124,14 +128,14 @@ }

if (this.track && this.track != this.scroller) {
pos = {};
pos[this.origin.pos] = elements[0].parentNode[this.origin.offset];
this.$(this.track).css(pos);
pos = {}
pos[this.origin.pos] = elements[0].parentNode[this.origin.offset]
this.$(this.track).css(pos)
} else {
this.barTopLimit = elements[0].parentNode[this.origin.offset];
this.barTopLimit = elements[0].parentNode[this.origin.offset]
}
// this.barTopLimit = elements[0].parentNode[this.origin.offset];
this.scroll();
// this.barTopLimit = elements[0].parentNode[this.origin.offset]
this.scroll()
}
if (params.limiter === false) { // undefined (in second fix instance) should have no influence on bar limit
this.barTopLimit = 0;
this.barTopLimit = 0
}

@@ -146,10 +150,10 @@ }

top = parent.offsetTop,
num;
num
// finding num -> elements[num] === this
for (var i = 0 ; i < elements.length ; i++ ) {
if (elements[i] === this) num = i;
for (var j = 0; j < elements.length; j++ ) {
if (elements[j] === this) num = j
}
var pos = top - topFixHeights[num];
var locPos = top - topFixHeights[num]

@@ -159,6 +163,6 @@ if (params.scroll) { // User defined callback

x1: self.scroller.scrollTop,
x2: pos
});
x2: locPos
})
} else {
self.scroller.scrollTop = pos;
self.scroller.scrollTop = locPos
}

@@ -168,51 +172,53 @@ },

type: 'click'
};
}
if (params.clickable) {
this._eventHandlers.push(event); // For auto-dispose
// eventManager(event.element, event.type, event.handler, 'off');
eventManager(event.element, event.type, event.handler, 'on');
this._eventHandlers.push(event) // For auto-dispose
// eventManager(event.element, event.type, event.handler, 'off')
eventManager(event.element, event.type, event.handler, 'on')
}
}
this.on('init', init, userParams);
this.on('init', init, userParams)
var fixFlag = [], // 1 - past, 2 - future, 3 - current (not fixed)
gradFlag = [];
gradFlag = []
this.on('init scroll', function() {
var fixState, hTop, gradState;
var fixState, hTop, gradState
var i
if (elements) {
var change;
var change
// fixFlag update
for (var i = 0 ; i < elements.length ; i++) {
fixState = 0;
for (i = 0; i < elements.length; i++) {
fixState = 0
if (headerTops[i] - this.pos() < topRealHeights[i] + params.radius) {
// Header trying to go up
fixState = 1;
hTop = topFixHeights[i];
fixState = 1
hTop = topFixHeights[i]
} else if (headerTops[i] - this.pos() > topRealHeights[i] + viewPortSize - params.radius) {
// Header trying to go down
fixState = 2;
// console.log('topFixHeights[i] + viewPortSize + topRealHeights[i]', topFixHeights[i], this.scroller[this.origin.client], topRealHeights[i]);
hTop = this.scroller[this.origin.client] - elements[i][this.origin.offset] - topFixHeights[i] - viewPortSize;
// console.log('hTop', hTop, viewPortSize, elements[this.origin.offset], topFixHeights[i]);
//(topFixHeights[i] + viewPortSize + elements[this.origin.offset]) - this.scroller[this.origin.client];
fixState = 2
// console.log('topFixHeights[i] + viewPortSize + topRealHeights[i]', topFixHeights[i], this.scroller[this.origin.client], topRealHeights[i])
hTop = this.scroller[this.origin.client] - elements[i][this.origin.offset] - topFixHeights[i] - viewPortSize
// console.log('hTop', hTop, viewPortSize, elements[this.origin.offset], topFixHeights[i])
// (topFixHeights[i] + viewPortSize + elements[this.origin.offset]) - this.scroller[this.origin.client]
} else {
// Header in viewport
fixState = 3;
hTop = undefined;
fixState = 3
hTop = undefined
}
gradState = false;
gradState = false
if (headerTops[i] - this.pos() < topRealHeights[i] || headerTops[i] - this.pos() > topRealHeights[i] + viewPortSize) {
gradState = true;
gradState = true
}
if (fixState != fixFlag[i] || gradState != gradFlag[i]) {
fixElement.call(this, i, hTop, fixState);
fixFlag[i] = fixState;
gradFlag[i] = gradState;
change = true;
fixElement.call(this, i, hTop, fixState)
fixFlag[i] = fixState
gradFlag[i] = gradState
change = true
}

@@ -223,24 +229,24 @@ }

if (change) { // At leats one change in elements flag structure occured
for (i = 0 ; i < elements.length ; i++) {
for (i = 0; i < elements.length; i++) {
if (fixFlag[i] == 1 && params.past) {
this.$(elements[i]).addClass(params.past).removeClass(params.future);
this.$(elements[i]).addClass(params.past).removeClass(params.future)
}
if (fixFlag[i] == 2 && params.future) {
this.$(elements[i]).addClass(params.future).removeClass(params.past);
this.$(elements[i]).addClass(params.future).removeClass(params.past)
}
if (fixFlag[i] == 3) {
if (params.future || params.past) this.$(elements[i]).removeClass(params.past).removeClass(params.future);
if (params.inside) this.$(elements[i]).addClass(params.inside);
if (params.future || params.past) this.$(elements[i]).removeClass(params.past).removeClass(params.future)
if (params.inside) this.$(elements[i]).addClass(params.inside)
} else if (params.inside) {
this.$(elements[i]).removeClass(params.inside);
this.$(elements[i]).removeClass(params.inside)
}
if (fixFlag[i] != fixFlag[i + 1] && fixFlag[i] == 1 && params.before) {
this.$(elements[i]).addClass(params.before).removeClass(params.after); // Last top fixed header
this.$(elements[i]).addClass(params.before).removeClass(params.after) // Last top fixed header
} else if (fixFlag[i] != fixFlag[i - 1] && fixFlag[i] == 2 && params.after) {
this.$(elements[i]).addClass(params.after).removeClass(params.before); // First bottom fixed header
this.$(elements[i]).addClass(params.after).removeClass(params.before) // First bottom fixed header
} else {
this.$(elements[i]).removeClass(params.before).removeClass(params.after);
this.$(elements[i]).removeClass(params.before).removeClass(params.after)
}

@@ -250,5 +256,5 @@

if (gradFlag[i]) {
this.$(elements[i]).addClass(params.grad);
this.$(elements[i]).addClass(params.grad)
} else {
this.$(elements[i]).removeClass(params.grad);
this.$(elements[i]).removeClass(params.grad)
}

@@ -259,19 +265,19 @@ }

}
});
})
this.on('resize upd', function(updParams) {
init.call(this, updParams && updParams.fix);
});
};
init.call(this, updParams && updParams.fix)
})
}
scopedBaron.fn.fix = function(params) {
var i = 0;
var i = 0
while (this[i]) {
fix.call(this[i], params);
i++;
fix.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))
/* Pull to load plugin for baron 0.6+ */
(function(scopedWindow, undefined) {
var scopedBaron;
(function(scopedWindow) {
var scopedBaron
if (typeof module != 'undefined') {
scopedBaron = require('./core');
scopedBaron = require('./core')
} else {
scopedBaron = scopedWindow.baron;
scopedBaron = scopedWindow.baron
}

@@ -26,6 +26,6 @@

_waiting = params.waiting || 500,
_on;
_on
function getSize() {
return self.scroller[self.origin.scroll] + self.scroller[self.origin.offset];
return self.scroller[self.origin.scroll] + self.scroller[self.origin.offset]
}

@@ -35,3 +35,3 @@

function getContentSize() {
return self.scroller[self.origin.scrollSize];
return self.scroller[self.origin.scrollSize]
}

@@ -41,19 +41,19 @@

function getScrollerSize() {
return self.scroller[self.origin.client];
return self.scroller[self.origin.client]
}
function step(x, force) {
var k = x * 0.0005;
var k = x * 0.0005
return Math.floor(force - k * (x + 550));
return Math.floor(force - k * (x + 550))
}
function toggle(on) {
_on = on;
_on = on
if (on) {
update(); // First time with no delay
_interval = setInterval(update, 200);
update() // First time with no delay
_interval = setInterval(update, 200)
} else {
clearInterval(_interval);
clearInterval(_interval)
}

@@ -68,59 +68,59 @@ }

op4,
scrollInProgress = _insistence == 1;
scrollInProgress = _insistence == 1
op4 = 0; // Возвращающая сила
op4 = 0 // Возвращающая сила
if (_insistence > 0) {
op4 = 40;
op4 = 40
}
//if (_insistence > -1) {
dx = step(_x, op4);
if (height >= scrollHeight - _x && _insistence > -1) {
if (scrollInProgress) {
_x += dx;
}
} else {
_x = 0;
// if (_insistence > -1) {
dx = step(_x, op4)
if (height >= scrollHeight - _x && _insistence > -1) {
if (scrollInProgress) {
_x += dx
}
} else {
_x = 0
}
if (_x < 0) _x = 0;
if (_x < 0) _x = 0
pos[size] = _x + 'px';
if (getScrollerSize() <= getContentSize()) {
self.$(block).css(pos);
for (var i = 0 ; i < elements.length ; i++) {
self.$(elements[i].self).css(elements[i].property, Math.min(_x / limit * 100, 100) + '%');
}
pos[size] = _x + 'px'
if (getScrollerSize() <= getContentSize()) {
self.$(block).css(pos)
for (var i = 0; i < elements.length; i++) {
self.$(elements[i].self).css(elements[i].property, Math.min(_x / limit * 100, 100) + '%')
}
}
if (inProgress && _x) {
self.$(self.root).addClass(inProgress);
}
if (inProgress && _x) {
self.$(self.root).addClass(inProgress)
}
if (_x == 0) {
if (params.onCollapse) {
params.onCollapse();
}
if (_x == 0) {
if (params.onCollapse) {
params.onCollapse()
}
}
_insistence = 0;
_timer = setTimeout(function() {
_insistence = -1;
}, _waiting);
//}
_insistence = 0
_timer = setTimeout(function() {
_insistence = -1
}, _waiting)
// }
if (onExpand && _x > limit && !_onExpandCalled) {
onExpand();
_onExpandCalled = true;
onExpand()
_onExpandCalled = true
}
if (_x == 0) {
_zeroXCount++;
_zeroXCount++
} else {
_zeroXCount = 0;
_zeroXCount = 0
}
if (_zeroXCount > 1) {
toggle(false);
_onExpandCalled = false;
toggle(false)
_onExpandCalled = false
if (inProgress) {
self.$(self.root).removeClass(inProgress);
self.$(self.root).removeClass(inProgress)
}

@@ -131,35 +131,35 @@ }

this.on('init', function() {
toggle(true);
});
toggle(true)
})
this.on('dispose', function() {
toggle(false);
});
toggle(false)
})
this.event(this.scroller, 'mousewheel DOMMouseScroll', function(e) {
var down = e.wheelDelta < 0 || (e.originalEvent && e.originalEvent.wheelDelta < 0) || e.detail > 0;
var down = e.wheelDelta < 0 || (e.originalEvent && e.originalEvent.wheelDelta < 0) || e.detail > 0
if (down) {
_insistence = 1;
clearTimeout(_timer);
_insistence = 1
clearTimeout(_timer)
if (!_on && getSize() >= getContentSize()) {
toggle(true);
toggle(true)
}
}
// else {
// toggle(false);
// toggle(false)
// }
});
};
})
}
scopedBaron.fn.pull = function(params) {
var i = 0;
var i = 0
while (this[i]) {
pull.call(this[i], params);
i++;
pull.call(this[i], params)
i++
}
return this;
};
})(this);
return this
}
}(this))
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc