Permalink
alvarotrigo
- Updating version and dist files
361521d
Aug 1, 2018
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up/*! | |
* multiscroll.js 0.2.2 - Extensions 0.0.7 | |
* https://github.com/alvarotrigo/multiscroll.js | |
* @license MIT licensed | |
* | |
* Copyright (C) 2016 alvarotrigo.com - A project by Alvaro Trigo | |
*/ | |
!function(e,t,n,o,i){e.fn.multiscroll=function(s){var l=e.fn.multiscroll;l.shared={afterRender:O};var a="multiscroll-wrapper",r="."+a,c=(e("html, body"),e("body"));s=e.extend({verticalCentered:!0,scrollingSpeed:700,easing:"easeInOutCubic",menu:!1,sectionsColor:[],anchors:[],navigation:!1,navigationPosition:"right",navigationColor:"#000",navigationTooltips:[],loopBottom:!1,loopTop:!1,css3:!1,autoScrolling:!0,paddingTop:0,paddingBottom:0,fixedElements:null,normalScrollElements:null,keyboardScrolling:!0,touchSensitivity:5,responsiveWidth:null,responsiveHeight:null,responsiveExpand:!1,responsiveCombine:!1,scrollOverflow:!1,scrollOverflowOptions:null,sectionSelector:".ms-section",leftSelector:".ms-left",rightSelector:".ms-right",afterLoad:null,onLeave:null,afterRender:null,afterResize:null},s);var d,m,v=600,f=navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),u="ontouchstart"in t||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints,h={};".ms-right"!==s.rightSelector&&e(s.rightSelector).addClass("ms-right"),".ms-left"!==s.leftSelector&&e(s.leftSelector).addClass("ms-left");var p,g,x=e(".ms-left").find(".ms-section").length,w=!1,b=e(t).height(),S=e(t).width(),C=function(){var e;e=t.PointerEvent?{down:"pointerdown",move:"pointermove"}:{down:"MSPointerDown",move:"MSPointerMove"};return e}(),y={touchmove:"ontouchmove"in t?"touchmove":C.move,touchstart:"ontouchstart"in t?"touchstart":C.down};function O(){e.isFunction(s.afterRender)&&s.afterRender.call(this),s.scrollOverflow&&l.scrollOverflow.iscrollHandler.afterLoad()}function T(){var n=t.location.hash.replace("#","");if(n.length){var o=$("responsiveExpand","isResponsive")?e(".ms-left").find('[data-panel="ms-left"][data-anchor="'+n+'"]'):e(".ms-left").find('[data-anchor="'+n+'"]');("undefined"==typeof lastScrolledDestiny||n!==lastScrolledDestiny)&&k(o)}}e(this).length&&(l.getMultiscrollData=function(){return{options:s,internals:{isTouch:u,isTouchDevice:f,isReallyTouch:F,getEventsPage:K,numberSections:x,setLastScrollDestiny:Q,setURLHash:z,activateMenuElement:A,activateNavDots:Z,getYmovement:P,removeMouseWheelHandler:M,addMouseWheelHandler:B,removeTouchHandler:q,addTouchHandler:V,transformContainer:W,c:ne}}}),_("responsiveExpand"),_("scrollOverflow"),_("responsiveCombine"),B(),V(),s.css3&&(s.css3=function(){var e,o=n.createElement("p"),s={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var l in n.body.insertBefore(o,null),s)o.style[l]!==i&&(o.style[l]="translate3d(1px,1px,1px)",e=t.getComputedStyle(o).getPropertyValue(s[l]));return n.body.removeChild(o),e!==i&&e.length>0&&"none"!==e}()),e("html, body").css({overflow:"hidden",height:"100%"}),e(this).addClass(a),".ms-section"!==s.sectionSelector&&e(s.sectionSelector).each(function(){e(this).addClass("ms-section")}),s.navigation&&(e("body").append('<div id="multiscroll-nav"><ul></ul></div>'),(p=e("#multiscroll-nav")).css("color",s.navigationColor),p.addClass(s.navigationPosition)),e(".ms-right, .ms-left").css({width:"50%",position:"absolute",height:"100%","-ms-touch-action":"none"}),e(".ms-right").css({right:"1px",top:"0","-ms-touch-action":"none","touch-action":"none"}),e(".ms-left").css({left:"0",top:"0","-ms-touch-action":"none","touch-action":"none"}),e(".ms-left .ms-section, .ms-right .ms-section").each(function(){var t,n=e(this).index();if((s.paddingTop||s.paddingBottom)&&e(this).css("padding",s.paddingTop+" 0 "+s.paddingBottom+" 0"),void 0!==s.sectionsColor[n]&&e(this).css("background-color",s.sectionsColor[n]),void 0!==s.anchors[n]&&e(this).attr("data-anchor",s.anchors[n]),s.verticalCentered&&(t=e(this)).addClass("ms-table").wrapInner('<div class="ms-tableCell" style="height: '+Y(t)+'px" />'),e(this).closest(".ms-left").length&&s.navigation){var o="";s.anchors.length&&(o=s.anchors[n]);var i=s.navigationTooltips[n];void 0===i&&(i=""),s.navigation&&p.find("ul").append('<li data-tooltip="'+i+'"><a href="#'+o+'"><span></span></a></li>')}}),e(".ms-right").html(e(".ms-right").find(".ms-section").get().reverse()),e(".ms-left .ms-section, .ms-right .ms-section").each(function(){var t=e(this).index();e(this).css({height:"100%"}),!t&&s.navigation&&p.find("li").eq(t).find("a").addClass("active")}).promise().done(function(){e(".ms-left .ms-section.active").length||(e(".ms-right").find(".ms-section").last().addClass("active"),e(".ms-left").find(".ms-section").first().addClass("active")),J("responsiveExpand")&&(l.responsiveExpand.setIndex("ms-left"),l.responsiveExpand.setIndex("ms-right"),l.responsiveExpand.init()),J("responsiveCombine")&&l.responsiveCombine.init(),J("scrollOverflow")&&(l.scrollOverflow.init(),d=l.scrollOverflow.iscrollHandler.init(s)),s.navigation&&p.css("margin-top","-"+p.height()/2+"px"),O(),D(),j(),e(t).on("load",function(){var n,o;n=t.location.hash.replace("#",""),o=e('.ms-left .ms-section[data-anchor="'+n+'"]'),n.length&&k(o)})}),e(t).on("hashchange",T),e(n).keydown(function(t){if(clearTimeout(g),!s.autoScrolling)return;var o=e(n.activeElement);if(!o.is("textarea")&&!o.is("input")&&!o.is("select")&&s.keyboardScrolling){var i=t.which;e.inArray(i,[40,38,32,33,34])>-1&&t.preventDefault(),g=setTimeout(function(){!function(t){var n=t.shiftKey;switch(t.which){case 38:case 33:l.moveSectionUp();break;case 32:if(n){l.moveSectionUp();break}case 40:case 34:l.moveSectionDown();break;case 36:l.moveTo(1);break;case 35:l.moveTo(e(".ms-left .ms-section").length);break;default:;}}(t)},150)}}),e(n).mousedown(function(e){if(1==e.button)return e.preventDefault(),!1}),e(n).on("click","#multiscroll-nav a",function(t){t.preventDefault();var n=e(this).parent().index();k(e(".ms-left .ms-section").eq(n))}),e(n).on({mouseenter:function(){var t=e(this).data("tooltip");e('<div class="multiscroll-tooltip '+s.navigationPosition+'">'+t+"</div>").hide().appendTo(e(this)).fadeIn(200)},mouseleave:function(){e(this).find(".multiscroll-tooltip").fadeOut(200,function(){e(this).remove()})}},"#multiscroll-nav li"),s.normalScrollElements&&(e(n).on("mouseenter",s.normalScrollElements,function(){l.setMouseWheelScrolling(!1)}),e(n).on("mouseleave",s.normalScrollElements,function(){l.setMouseWheelScrolling(!0)})),e(t).on("resize",L);var E=b;function L(){if(f){var i=e(n.activeElement);if(!i.is("textarea")&&!i.is("input")&&!i.is("select")){var s=e(t).height();o.abs(s-E)>20*o.max(E,s)/100&&(I(!0),E=s)}}else clearTimeout(m),m=setTimeout(function(){I(!0)},350)}function I(n){b=e(t).height(),S=e(t).width(),e(".ms-tableCell").each(function(){e(this).css({height:Y(e(this).parent())})}),s.scrollOverflow&&d.createScrollBarForAll(),s.scrollOverflow&&l.scrollOverflow.iscrollHandler.afterLoad(),D(),e.isFunction(s.afterResize)&&s.afterResize.call(this)}function D(){s.css3&&s.autoScrolling?(W(e(".ms-left"),"translate3d(0px, -"+e(".ms-left").find(".ms-section.active").position().top+"px, 0px)",!1),W(e(".ms-right"),"translate3d(0px, -"+e(".ms-right").find(".ms-section.active").position().top+"px, 0px)",!1)):s.autoScrolling?(e(".ms-left").css("top",-e(".ms-left").find(".ms-section.active").position().top),e(".ms-right").css("top",-e(".ms-right").find(".ms-section.active").position().top)):e("html,body").scrollTop(e(".ms-left").find(".ms-section.active").position().top)}function k(t){var n=t.index(),o=e(".ms-right").find(".ms-section").eq(x-1-n),i=t.data("anchor"),a=e(".ms-left .ms-section.active").index()+1,r=P(t);w=!0;var c={left:t.position().top};if($("responsiveExpand","isResponsive")||(c.right=o.position().top),$("responsiveExpand","isResponsive")||o.addClass("active").siblings().removeClass("active"),t.addClass("active").siblings().removeClass("active"),z(i),$("responsiveExpand","isResponsive"))l.responsiveExpand.performMovement(t),setTimeout(function(){w=!1},s.scrollingSpeed);else if(s.css3){e.isFunction(s.onLeave)&&s.onLeave.call(this,a,n+1,r),s.scrollOverflow&&l.scrollOverflow.iscrollHandler.onLeave();var d="translate3d(0px, -"+c.left+"px, 0px)",m="translate3d(0px, -"+c.right+"px, 0px)";W(e(".ms-left"),d,!0),W(e(".ms-right"),m,!0),setTimeout(function(){e.isFunction(s.afterLoad)&&s.afterLoad.call(this,i,n+1),s.scrollOverflow&&l.scrollOverflow.iscrollHandler.afterLoad(),setTimeout(function(){w=!1},v)},s.scrollingSpeed)}else e.isFunction(s.onLeave)&&s.onLeave.call(this,a,n+1,r),e(".ms-left").animate({top:-c.left},s.scrollingSpeed,s.easing,function(){e.isFunction(s.afterLoad)&&s.afterLoad.call(this,i,n+1),s.scrollOverflow&&l.scrollOverflow.iscrollHandler.afterLoad(),setTimeout(function(){w=!1},v)}),e(".ms-right").animate({top:-c.right},s.scrollingSpeed,s.easing);lastScrolledDestiny=i,A(i),Z(i,n)}function M(){n.addEventListener?(n.removeEventListener("mousewheel",H,!1),n.removeEventListener("wheel",H,!1)):n.detachEvent("onmousewheel",H)}function B(){n.addEventListener?(n.addEventListener("mousewheel",H,!1),n.addEventListener("wheel",H,!1)):n.attachEvent("onmousewheel",H)}function H(n){e(r).trigger("onMouseWheel",[n,S]),n=t.event||n;var i=o.max(-1,o.min(1,n.wheelDelta||-n.deltaY||-n.detail));return w||R(i<0?"down":"up"),!1}function R(t){var n="down"===t?l.moveSectionDown:l.moveSectionUp;if(s.scrollOverflow){var o=l.scrollOverflow.iscrollHandler.scrollable(e.fn.multiscroll.scrollOverflow.g_overedPanel()),i="down"===t?"bottom":"top";if(o.length>0){if(!l.scrollOverflow.iscrollHandler.isScrolled(i,o))return!0;n()}else n()}else n()}function W(e,t,n){var o;e.toggleClass("ms-easing",n),e.css({"-webkit-transform":o=t,"-moz-transform":o,"-ms-transform":o,transform:o})}function Z(t,n){s.navigation&&(e("#multiscroll-nav").find(".active").removeClass("active"),t?e("#multiscroll-nav").find('a[href="#'+t+'"]').addClass("active"):e("#multiscroll-nav").find("li").eq(n).find("a").addClass("active"))}function A(t){s.menu&&(e(s.menu).find(".active").removeClass("active"),e(s.menu).find('[data-menuanchor="'+t+'"]').addClass("active"))}function P(t){return e(".ms-left .ms-section.active").index()>t.index()?"up":"down"}function z(e){s.anchors.length&&(location.hash=e),j()}function j(){var t=e(".ms-left .ms-section.active"),n=t.data("anchor"),o=t.index(),i=String(o);if(s.anchors.length&&(i=n),void 0!==i){i=i.replace("/","-").replace("#","");var l=new RegExp("\\b\\s?ms-viewing-[^\\s]+\\b","g");e("body")[0].className=e("body")[0].className.replace(l,""),e("body").addClass("ms-viewing-"+i)}}function Y(e){var t=b;if(s.paddingTop||s.paddingBottom){var n=parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"));t=b-n}return t}l.silentScroll=D,l.moveSectionUp=function(){var t=e(".ms-left .ms-section.active").prev(".ms-section");!t.length&&s.loopTop&&(t=e(".ms-left .ms-section").last()),t.length&&k(t)},l.moveSectionDown=function(){var t=e(".ms-left .ms-section.active").next(".ms-section");!t.length&&s.loopBottom&&(t=e(".ms-left .ms-section").first()),t.length&&k(t)},l.moveTo=function(t){k(isNaN(t)?e('.ms-left [data-anchor="'+t+'"]'):e(".ms-left .ms-section").eq(t-1))},l.setKeyboardScrolling=function(e){s.keyboardScrolling=e},l.setMouseWheelScrolling=function(e){e?B():M()},l.setScrollingSpeed=function(e){s.scrollingSpeed=e};var G=0,N=0;function X(n){if(F(n)){event.preventDefault();e(".ms-left .ms-section.active");if(!w){var i=K(n);N=i.y,i.x,o.abs(G-N)>e(t).height()/100*s.touchSensitivity&&(G>N?R("down"):N>G&&R("up"))}}}function F(e){return void 0===e.pointerType||"mouse"!=e.pointerType}function U(t){if(e(r).trigger("onTouch",[t,S]),F(t)){var n=K(t);G=n.y,n.x}}function V(){(u||f)&&(n.removeEventListener(y.touchstart,U),n.removeEventListener(y.touchmove,X,{passive:!1}),n.addEventListener(y.touchstart,U),n.addEventListener(y.touchmove,X,{passive:!1}))}function q(){(u||f)&&(n.removeEventListener(y.touchstart,U),n.removeEventListener(y.touchmove,X,{passive:!1}))}function K(e){var t=[];return t.y=void 0!==e.pageY&&(e.pageY||e.pageX)?e.pageY:e.touches[0].pageY,t.x=void 0!==e.pageX&&(e.pageY||e.pageX)?e.pageX:e.touches[0].pageX,u&&F(e)&&void 0!==e.touches&&(t.y=e.touches[0].pageY,t.x=e.touches[0].pageX),t}function Q(e){lastScrolledDestiny=e}function _(e){var n="ms_"+e+"Extension";h[e]=s[e+"Key"],l[e]=void 0!==t[n]?new t[n]:null,l[e]&&l[e].c(e)}function J(e){return s[e]&&l[e]}function $(e,t,n){var o=Array.isArray(n)?n.join(", "):n;return!!J(e)&&l[e][t](o)}function ee(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n(e){var n,o,i,s,l,a,r="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)n=t.indexOf(e.charAt(c++))<<2|(s=t.indexOf(e.charAt(c++)))>>4,o=(15&s)<<4|(l=t.indexOf(e.charAt(c++)))>>2,i=(3&l)<<6|(a=t.indexOf(e.charAt(c++))),r+=String.fromCharCode(n),64!=l&&(r+=String.fromCharCode(o)),64!=a&&(r+=String.fromCharCode(i));return r=function(e){var t,n="",o=0,i=0,s=0;for(;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):i>191&&i<224?(s=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&s),o+=2):(s=e.charCodeAt(o+1),t=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&s)<<6|63&t),o+=3);return n}(r)}function o(e){return e.slice(3).slice(0,-3)}return function(e){var t=e.split("_");if(t.length>1){var i=t[1];return e.replace(o(t[1]),"").split("_")[0]+"_"+n(i.slice(3).slice(0,-3))}return o(e)}(n(e))}function te(e){var t=function(){if(n.domain.length){for(var e=n.domain.replace(/^(www\.)/,"").split(".");e.length>2;)e.shift();return e.join(".").replace(/(^\.*)|(\.*$)/g,"")}return""}(),o=["localhost","127.0.0.1","jshell.net","UDdDQU5ZNlNN"],i=o[0],s=o[1],l=o[2],a=ee(o[3]),r=[i,s,l].indexOf(t)<0&&0!==t.length,c=void 0!==h[e]&&h[e].length;if(!c&&r)return!1;var d=c?ee(h[e]):"",m=(d=d.split("_")).length>1&&d[1].indexOf(e,d[1].length-e.length)>-1;return!(d[0].indexOf(t,d[0].length-t.length)<0&&r&&a!=d[0])&&m||!r}function ne(e){if(J(e)&&l[e]){var t=ee("MTIzPGRpdiBzdHlsZT0iei1pbmRleDo5OTk5OTk5O3Bvc2l0aW9uOmZpeGVkOyB0b3A6IDIwcHg7IGxlZnQ6MjBweDsgYmFja2dyb3VuZDpyZWQ7IHBhZGRpbmc6IDdweCAxNXB4OyBmb250LXNpemU6IDE0cHg7IGZvbnQtZmFtaWx5OiBhcmlhbDsgY29sb3I6ICNmZmY7IGRpc3BsYXk6IGlubGluZS1ibG9jazsiPjxhIGhyZWY9Imh0dHA6Ly9hbHZhcm90cmlnby5jb20vbXVsdGlTY3JvbGwvZXh0ZW5zaW9ucy8iIHN0eWxlPSJjb2xvcjogI2ZmZjsgdGV4dC1kZWNvcmF0aW9uOm5vbmU7Ij5VbmxpY2Vuc2VkIG11bHRpU2Nyb2xsLmpzIEV4dGVuc2lvbjwvYT48L2Rpdj4xMjM="),n=o.random()<.5;if(!te(e)){var i=function(){"9999999"!==(n?c.find("div").first():c.find("div").last()).css("z-index")&&(n?c.prepend(t):c.append(t))};i(),setInterval(i,2e3)}}}l.destroy=function(){l.setKeyboardScrolling(!1),l.setMouseWheelScrolling(!1),q(),e(t).off("hashchange",T).off("resize",L),e(n).off("mouseenter","#multiscroll-nav li").off("mouseleave","#multiscroll-nav li").off("click","#multiscroll-nav a")},l.build=function(){l.setKeyboardScrolling(!0),l.setMouseWheelScrolling(!0),e(t).on("hashchange",T).on("resize",L),e(n).on("mouseenter","#multiscroll-nav li").on("mouseleave","#multiscroll-nav li").on("click","#multiscroll-nav a")},l.extensionCall=$}}(jQuery,window,document,Math); |