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.5 to 2.2.6

4

baron.js

@@ -872,2 +872,4 @@ (function(scopedWindow) {

}
liveBarons--
// endRemoveIf(production)

@@ -915,3 +917,3 @@

baron.version = '2.2.5'
baron.version = '2.2.6'

@@ -918,0 +920,0 @@ // No AMD support, need it? Notify me.

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

!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));
!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;l<i&&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&&s<i&&(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.6","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;i<s?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.5",
"version": "2.2.6",
"readmeFilename": "README.md",

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

"test": "./node_modules/gulp/bin/gulp.js t",
"build": "./node_modules/gulp/bin/gulp.js build"
"build": "./node_modules/gulp/bin/gulp.js"
},

@@ -13,0 +13,0 @@ "authors": [

@@ -872,2 +872,4 @@ (function(scopedWindow) {

}
liveBarons--
// endRemoveIf(production)

@@ -915,3 +917,3 @@

baron.version = '2.2.5'
baron.version = '2.2.6'

@@ -918,0 +920,0 @@ // No AMD support, need it? Notify me.

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