diff --git a/js/baron.min.js b/js/baron.min.js new file mode 100644 index 0000000000000000000000000000000000000000..b7a309c4fb71b9c1ebace79c5d94c733071b821e --- /dev/null +++ b/js/baron.min.js @@ -0,0 +1,30 @@ +!function(t,i){"use strict";function s(e){var r,o=!e,n={$:t.jQuery,direction:"v",barOnCls:"_scrollbar",resizeDebounce:0,event:function(t,i,s,r){e.$(t)[r||"on"](i,s)},cssGuru:!1};e=e||{};for(var l in n)e[l]===i&&(e[l]=n[l]);this instanceof e.$?e.root=r=this:r=e.$(e.root||e.scroller);var c=new s.fn.constructor(r,e,o);return c.autoUpdate&&!o&&c.autoUpdate(),c}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.bar).addClass(i.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){i.selection(1),i.drag.now=0,i.draggingCls&&h(i.bar).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){n(t.root,t.direction)&&console.log("Error! Baron for this node already initialized",t.root);var i=new v.prototype.constructor(t);return o(i,t.event,"on"),n(i.root,t.direction,"on",p.length),p.push(i),i.update(),i.scrollEdge=0,t.rtl&&(i.scrollEdge=i.clipper[i.origin.scrollEdge]),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=0?s=setTimeout(n,i-l):(s=null,t())};return function(){e=r(),s||(s=setTimeout(n,i))}},constructor:function(t){function s(t,i){return u(t,i)[0]}function e(t){var i=this.barMinSize||20;t>0&&t=this.scroller[this.origin.scrollSize]?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=c.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,i=s.scroller[s.origin.crossOffset],e=s.scroller[s.origin.crossClient];if(e>0&&0===i&&(i=e+17),i)if(s.barOn(),e=s.scroller[s.origin.crossClient],s.impact?"scroller"==s.impact:"v"==s.direction){var o=i-e;u(s.clipper).css(s.origin.crossSize)!=(t=s.clipper[s.origin.crossClient]+o+"px")&&s._setCrossSizes(s.scroller,t)}else u(s.clipper).css(s.origin.crossSize)!=(t=e+"px")&&s._setCrossSizes(s.clipper,t);Array.prototype.unshift.call(arguments,"resize"),a.apply(s,arguments),C=r()}var s=this,e=s.resizeDebounce===i?300:s.resizeDebounce,o=0;r()-Ch[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]+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;fo+r.bar[r.origin.offset]&&(n=1);var l=r.pos()+n*s*r.scroller[r.origin.client];r.pos(l)}},type:"mousedown"},this._eventHandlers.push(e),this.event(e.element,e.type,e.handler,"on"))};baron.fn.controls=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(window),function(t,i){var s=function(t){function i(){return m.scroller[m.origin.scroll]+m.scroller[m.origin.offset]}function s(){return m.scroller[m.origin.scrollSize]}function e(){return m.scroller[m.origin.client]}function r(t,i){var s=5e-4*t;return Math.floor(i-s*(t+550))}function o(t){h=t,t?(n(),l=setInterval(n,200)):clearInterval(l)}function n(){var n,l,h={},w=i(),$=s(),S=1==b;if(l=0,b>0&&(l=40),n=r(z,l),w>=$-z&&b>-1?S&&(z+=n):z=0,z<0&&(z=0),h[f]=z+"px",e()<=s()){m.$(u).css(h);for(var _=0;_p&&!a&&(d(),a=!0),0==z?C++:C=0,C>1&&(o(!1),a=!1,g&&m.$(m.root).removeClass(g))}var l,c,a,h,u=this.$(t.block),f=t.size||this.origin.size,p=t.limit||80,d=t.onExpand,v=t.elements||[],g=t.inProgress||"",m=this,b=0,C=0,z=0,y=t.waiting||500;this.on("init",function(){o(!0)}),this.on("dispose",function(){o(!1)}),this.event(this.scroller,"mousewheel DOMMouseScroll",function(t){(t.wheelDelta<0||t.originalEvent&&t.originalEvent.wheelDelta<0||t.detail>0)&&(b=1,clearTimeout(c),!h&&i()>=s()&&o(!0))})};baron.fn.pull=function(t){for(var i=0;this[i];)s.call(this[i],t),i++;return this}}(window); + +window.onload = function() { + baron({ + root: '.main__clipper', + scroller: '.main__scroller', + bar: '.main__bar', + scrollingCls: '_scrolling', + draggingCls: '_dragging', + direction: 'h', + impact: 'scroller' + }); + baron({ + root: '.baron', + scroller: '.baron__scroller', + bar: '.baron__bar', + scrollingCls: '_scrolling', + draggingCls: '_dragging' + }).fix({ + elements: '.header__title', + outside: 'header__title_state_fixed', + before: 'header__title_position_top', + after: 'header__title_position_bottom', + clickable: true + }).controls({ + track: '.baron__track', + forward: '.baron__down', + backward: '.baron__up' + }); +}; \ No newline at end of file