loleaflet/js/jquery.mCustomScrollbar.js | 786 ++++++++++++++++---------------- 1 file changed, 393 insertions(+), 393 deletions(-)
New commits: commit 8ea0b6acbcbe691cd31cabd1a357602591c94860 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Thu Jun 11 12:15:01 2020 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Jun 11 13:00:13 2020 +0200 jquery.mCustomScrollbar.js: whitespace changes only Change-Id: I23eadea7e0581ab068588af444794697c1d86bb5 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96113 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/loleaflet/js/jquery.mCustomScrollbar.js b/loleaflet/js/jquery.mCustomScrollbar.js index 79bf0521f..ffd8e1bba 100644 --- a/loleaflet/js/jquery.mCustomScrollbar.js +++ b/loleaflet/js/jquery.mCustomScrollbar.js @@ -1,8 +1,8 @@ /* -*- js-indent-level: 8; indent-tabs-mode: t; fill-column: 120 -*- */ /* -== malihu jquery custom scrollbar plugin == +== malihu jquery custom scrollbar plugin == Version: 3.1.5 -Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller +Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller Author: malihu Author URI: http://manos.malihu.gr License: MIT License (MIT) @@ -31,10 +31,10 @@ THE SOFTWARE. */ /* -The code below is fairly long, fully commented and should be normally used in development. -For production, use either the minified jquery.mCustomScrollbar.min.js script or -the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin -and dependencies (minified). +The code below is fairly long, fully commented and should be normally used in development. +For production, use either the minified jquery.mCustomScrollbar.min.js script or +the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin +and dependencies (minified). */ (function(factory){ @@ -55,60 +55,60 @@ and dependencies (minified). if(_njs){ require("jquery-mousewheel")($); }else{ - /* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS + /* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS (works when mCustomScrollbar fn is called on window load) */ $.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E")); } } init(); }(function(){ - - /* + + /* ---------------------------------------- - PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) + PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) ---------------------------------------- */ - + var pluginNS="mCustomScrollbar", pluginPfx="mCS", defaultSelector=".mCustomScrollbar", - - - - - - /* + + + + + + /* ---------------------------------------- - DEFAULT OPTIONS + DEFAULT OPTIONS ---------------------------------------- */ - + defaults={ /* - set element/content width/height programmatically - values: boolean, pixels, percentage + set element/content width/height programmatically + values: boolean, pixels, percentage option default ------------------------------------- setWidth false setHeight false */ /* - set the initial css top property of content + set the initial css top property of content values: string (e.g. "-100px", "10%" etc.) */ setTop:0, /* - set the initial css left property of content + set the initial css left property of content values: string (e.g. "-100px", "10%" etc.) */ setLeft:0, - /* - scrollbar axis (vertical and/or horizontal scrollbars) + /* + scrollbar axis (vertical and/or horizontal scrollbars) values (string): "y", "x", "yx" */ axis:"y", /* - position of scrollbar relative to content + position of scrollbar relative to content values (string): "inside", "outside" ("outside" requires elements with position:relative) */ scrollbarPosition:"inside", @@ -117,13 +117,13 @@ and dependencies (minified). values: integer (milliseconds) */ scrollInertia:950, - /* + /* auto-adjust scrollbar dragger length values: boolean */ autoDraggerLength:true, /* - auto-hide scrollbar when idle + auto-hide scrollbar when idle values: boolean option default ------------------------------------- @@ -137,7 +137,7 @@ and dependencies (minified). autoExpandScrollbar false */ /* - always show scrollbar, even when there's nothing to scroll + always show scrollbar, even when there's nothing to scroll values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean */ alwaysShowScrollbar:0, @@ -149,52 +149,52 @@ and dependencies (minified). snapAmount null */ /* - when snapping, snap with this number in pixels as an offset + when snapping, snap with this number in pixels as an offset values: integer */ snapOffset:0, - /* + /* mouse-wheel scrolling */ mouseWheel:{ - /* + /* enable mouse-wheel scrolling values: boolean */ enable:true, - /* + /* scrolling amount in pixels - values: "auto", integer + values: "auto", integer */ scrollAmount:"auto", - /* - mouse-wheel scrolling axis - the default scrolling direction when both vertical and horizontal scrollbars are present - values (string): "y", "x" + /* + mouse-wheel scrolling axis + the default scrolling direction when both vertical and horizontal scrollbars are present + values (string): "y", "x" */ axis:"y", - /* - prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached + /* + prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached values: boolean option default ------------------------------------- preventDefault null */ /* - the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls. - values: "auto", integer - "auto" uses the default OS/browser value + the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls. + values: "auto", integer + "auto" uses the default OS/browser value */ deltaFactor:"auto", /* - normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) + normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) values: boolean option default ------------------------------------- normalizeDelta null */ /* - invert mouse-wheel scrolling direction + invert mouse-wheel scrolling direction values: boolean option default ------------------------------------- @@ -205,10 +205,10 @@ and dependencies (minified). */ disableOver:["select","option","keygen","datalist","textarea"] }, - /* + /* scrollbar buttons */ - scrollButtons:{ + scrollButtons:{ /* enable scrollbar buttons values: boolean @@ -217,13 +217,13 @@ and dependencies (minified). enable null */ /* - scrollbar buttons scrolling type + scrollbar buttons scrolling type values (string): "stepless", "stepped" */ scrollType:"stepless", /* scrolling amount in pixels - values: "auto", integer + values: "auto", integer */ scrollAmount:"auto" /* @@ -234,34 +234,34 @@ and dependencies (minified). tabindex null */ }, - /* + /* keyboard scrolling */ - keyboard:{ + keyboard:{ /* enable scrolling via keyboard values: boolean */ enable:true, /* - keyboard scrolling type + keyboard scrolling type values (string): "stepless", "stepped" */ scrollType:"stepless", /* scrolling amount in pixels - values: "auto", integer + values: "auto", integer */ scrollAmount:"auto" }, /* - enable content touch-swipe scrolling + enable content touch-swipe scrolling values: boolean, integer, string (number) integer values define the axis-specific minimum amount required for scrolling momentum */ contentTouchScroll:25, /* - enable/disable document (default) touch-swipe scrolling + enable/disable document (default) touch-swipe scrolling */ documentTouchScroll:true, /* @@ -269,7 +269,7 @@ and dependencies (minified). */ advanced:{ /* - auto-expand content horizontally (for "x" or "yx" axis) + auto-expand content horizontally (for "x" or "yx" axis) values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method) option default ------------------------------------- @@ -280,8 +280,8 @@ and dependencies (minified). */ autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']", /* - auto-update scrollbars on content, element or viewport resize - should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. + auto-update scrollbars on content, element or viewport resize + should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. values: boolean */ updateOnContentResize:true, @@ -291,14 +291,14 @@ and dependencies (minified). */ jumpOnContentResize:true, /* - auto-update scrollbars each time each image inside the element is fully loaded + auto-update scrollbars each time each image inside the element is fully loaded values: "auto", boolean */ updateOnImageLoad:"auto", /* - auto-update scrollbars based on the amount and size changes of specific selectors - useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size - values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) + auto-update scrollbars based on the amount and size changes of specific selectors + useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size + values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) a value of true (boolean) will auto-update scrollbars each time any element is changed option default ------------------------------------- @@ -317,13 +317,13 @@ and dependencies (minified). releaseDraggableSelectors null */ /* - auto-update timeout + auto-update timeout values: integer (milliseconds) */ autoUpdateTimeout:60 }, - /* - scrollbar theme + /* + scrollbar theme values: string (see CSS/plugin URI for a list of ready-to-use themes) */ theme:"light", @@ -332,7 +332,7 @@ and dependencies (minified). */ callbacks:{ /* - Available callbacks: + Available callbacks: callback default ------------------------------------- onCreate null @@ -356,8 +356,8 @@ and dependencies (minified). alwaysTriggerOffsets:true } /* - add scrollbar(s) on all elements matching the current selector, now and in the future - values: boolean, string + add scrollbar(s) on all elements matching the current selector, now and in the future + values: boolean, string string values: "on" (enable), "once" (disable after first invocation), "off" (disable) liveSelector values: string (selector) option default @@ -366,17 +366,17 @@ and dependencies (minified). liveSelector null */ }, - - - - - - /* + + + + + + /* ---------------------------------------- - VARS, CONSTANTS + VARS, CONSTANTS ---------------------------------------- */ - + totalInstances=0, /* plugin instances amount */ liveTimers={}, /* live option timers */ oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */ @@ -387,41 +387,41 @@ and dependencies (minified). "mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer", "mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight" ], - - - - - - /* + + + + + + /* ---------------------------------------- - METHODS + METHODS ---------------------------------------- */ - + methods={ - - /* - plugin initialization method + + /* + plugin initialization method creates the scrollbar(s), plugin data object and options ---------------------------------------- */ - + init:function(options){ - + var options=$.extend(true,{},defaults,options), selector=_selector.call(this); /* validate selector */ - - /* - if live option is enabled, monitor for elements matching the current selector and - apply scrollbar(s) when found (now and in the future) + + /* + if live option is enabled, monitor for elements matching the current selector and + apply scrollbar(s) when found (now and in the future) */ if(options.live){ var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */ $liveSelector=$(liveSelector); /* live selector(s) as jquery object */ if(options.live==="off"){ - /* - disable live if requested - usage: $(selector).mCustomScrollbar({live:"off"}); + /* + disable live if requested + usage: $(selector).mCustomScrollbar({live:"off"}); */ removeLiveTimers(liveSelector); return; @@ -437,7 +437,7 @@ and dependencies (minified). }else{ removeLiveTimers(liveSelector); } - + /* options backward compatibility (for versions < 3.0.0) and normalization */ options.setWidth=(options.set_width) ? options.set_width : options.setWidth; options.setHeight=(options.set_height) ? options.set_height : options.setHeight; @@ -448,17 +448,17 @@ and dependencies (minified). } options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels; options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta; - options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); - + options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); + _theme(options); /* theme-specific options */ - + /* plugin constructor */ return $(selector).each(function(){ - + var $this=$(this); - + if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */ - + /* store options and create objects in jquery data */ $this.data(pluginPfx,{ idx:++totalInstances, /* instance index */ @@ -471,99 +471,99 @@ and dependencies (minified). sequential:{}, /* sequential scrolling object */ langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */ cbOffsets:null, /* object to check whether callback offsets always trigger */ - /* - object to check how scrolling events where last triggered - "internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) + /* + object to check how scrolling events where last triggered + "internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) usage: object.data("mCS").trigger */ trigger:null, - /* - object to check for changes in elements in order to call the update method automatically + /* + object to check for changes in elements in order to call the update method automatically */ poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}} }); - + var d=$this.data(pluginPfx),o=d.opt, /* HTML data attributes */ htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme"); - + if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */ if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */ if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */ o.theme=htmlDataTheme; _theme(o); /* theme-specific options */ } - + _pluginMarkup.call(this); /* add plugin markup */ - + if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */ - + $("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classes[2]); /* flag loaded images */ - + methods.update.call(null,$this); /* call the update method */ - + } - + }); - + }, /* ---------------------------------------- */ - - - - /* - plugin update method - updates content and scrollbar(s) values, events and status + + + + /* + plugin update method + updates content and scrollbar(s) values, events and status ---------------------------------------- usage: $(selector).mCustomScrollbar("update"); */ - + update:function(el,cb){ - + var selector=el || _selector.call(this); /* validate selector */ - + return $(selector).each(function(){ - + var $this=$(this); - + if($this.data(pluginPfx)){ /* check if plugin has initialized */ - + var d=$this.data(pluginPfx),o=d.opt, mCSB_container=$("#mCSB_"+d.idx+"_container"), mCustomScrollBox=$("#mCSB_"+d.idx), mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")]; - + if(!mCSB_container.length){return;} - + if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */ - + if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */ - + /* if element was disabled or destroyed, remove class(es) */ if($this.hasClass(classes[3])){$this.removeClass(classes[3]);} if($this.hasClass(classes[4])){$this.removeClass(classes[4]);} - + /* css flexbox fix, detect/set max-height */ mCustomScrollBox.css("max-height","none"); if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());} - + _expandContentHorizontally.call(this); /* expand content horizontally */ - + if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){ mCSB_container.css("width",_contentWidth(mCSB_container)); } - + d.overflowed=_overflowed.call(this); /* determine if scrolling is required */ - + _scrollbarVisibility.call(this); /* show/hide scrollbar(s) */ - + /* auto-adjust scrollbar dragger length analogous to content */ if(o.autoDraggerLength){_setDraggerLength.call(this);} - + _scrollRatio.call(this); /* calculate and store scrollbar to content ratio */ - + _bindEvents.call(this); /* bind scrollbar events */ - + /* reset scrolling position and/or events */ var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)]; if(o.axis!=="x"){ /* y/yx axis */ @@ -602,7 +602,7 @@ and dependencies (minified). d.contentReset.x=null; } } - + /* callbacks: onImageLoad, onSelectorChange, onUpdate */ if(cb && d){ if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){ @@ -613,38 +613,38 @@ and dependencies (minified). o.callbacks.onUpdate.call(this); } } - + _autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */ - + } - + }); - + }, /* ---------------------------------------- */ - - - - /* - plugin scrollTo method + + + + /* + plugin scrollTo method triggers a scrolling event to a specific value ---------------------------------------- usage: $(selector).mCustomScrollbar("scrollTo",value,options); */ - + scrollTo:function(val,options){ - + /* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */ if(typeof val=="undefined" || val==null){return;} - + var selector=_selector.call(this); /* validate selector */ - + return $(selector).each(function(){ - + var $this=$(this); - + if($this.data(pluginPfx)){ /* check if plugin has initialized */ - + /* Ugly hack extension: When vertical scrollbar position was very close to the end of spreadsheet, next part of the document has to be loaded. This contidion is fulfilled @@ -669,23 +669,23 @@ and dependencies (minified). }, methodOptions=$.extend(true,{},methodDefaults,options), to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia; - + /* translate yx values to actual scroll-to positions */ to[0]=_to.call(this,to[0],"y"); to[1]=_to.call(this,to[1],"x"); - - /* - check if scroll-to value moves the dragger instead of content. - Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) + + /* + check if scroll-to value moves the dragger instead of content. + Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) */ if(methodOptions.moveDragger){ to[0]*=d.scrollRatio.y; to[1]*=d.scrollRatio.x; } - + methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden - - setTimeout(function(){ + + setTimeout(function(){ /* do the scrolling */ if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */ methodOptions.dir="y"; @@ -698,147 +698,147 @@ and dependencies (minified). _scrollTo($this,to[1].toString(),methodOptions); } },methodOptions.timeout); - + } - + }); - + }, /* ---------------------------------------- */ - - - + + + /* - plugin stop method + plugin stop method stops scrolling animation ---------------------------------------- usage: $(selector).mCustomScrollbar("stop"); */ stop:function(){ - + var selector=_selector.call(this); /* validate selector */ - + return $(selector).each(function(){ - + var $this=$(this); - + if($this.data(pluginPfx)){ /* check if plugin has initialized */ - + _stop($this); - + } - + }); - + }, /* ---------------------------------------- */ - - - + + + /* - plugin disable method - temporarily disables the scrollbar(s) + plugin disable method + temporarily disables the scrollbar(s) ---------------------------------------- - usage: $(selector).mCustomScrollbar("disable",reset); - reset (boolean): resets content position to 0 + usage: $(selector).mCustomScrollbar("disable",reset); + reset (boolean): resets content position to 0 */ disable:function(r){ - + var selector=_selector.call(this); /* validate selector */ - + return $(selector).each(function(){ - + var $this=$(this); - + if($this.data(pluginPfx)){ /* check if plugin has initialized */ - + var d=$this.data(pluginPfx); - + _autoUpdate.call(this,"remove"); /* remove automatic updating */ - + _unbindEvents.call(this); /* unbind events */ - + if(r){_resetContentPosition.call(this);} /* reset content position */ - + _scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */ - + $this.addClass(classes[3]); /* add disable class */ - + } - + }); - + }, /* ---------------------------------------- */ - - - + + + /* - plugin destroy method + plugin destroy method completely removes the scrollbar(s) and returns the element to its original state ---------------------------------------- - usage: $(selector).mCustomScrollbar("destroy"); + usage: $(selector).mCustomScrollbar("destroy"); */ destroy:function(){ - + var selector=_selector.call(this); /* validate selector */ - + return $(selector).each(function(){ - + var $this=$(this); - + if($this.data(pluginPfx)){ /* check if plugin has initialized */ - + var d=$this.data(pluginPfx),o=d.opt, mCustomScrollBox=$("#mCSB_"+d.idx), mCSB_container=$("#mCSB_"+d.idx+"_container"), scrollbar=$(".mCSB_"+d.idx+"_scrollbar"); - + if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */ - + _autoUpdate.call(this,"remove"); /* remove automatic updating */ - + _unbindEvents.call(this); /* unbind events */ - + _resetContentPosition.call(this); /* reset content position */ - + $this.removeData(pluginPfx); /* remove plugin data object */ - + _delete(this,"mcs"); /* delete callbacks object */ - + /* remove plugin markup */ scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */ mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */ mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */ /* remove plugin classes from the element and add destroy class */ $this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]); - + } - + }); - + } /* ---------------------------------------- */ - + }, - - - - - - /* + + + + + + /* ---------------------------------------- FUNCTIONS ---------------------------------------- */ - + /* validates selector (if selector is invalid or undefined uses the default one) */ _selector=function(){ return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this; }, /* -------------------- */ - - + + /* changes options according to theme */ _theme=function(obj){ var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"], @@ -853,8 +853,8 @@ and dependencies (minified). obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition; }, /* -------------------- */ - - + + /* live option timers removal */ removeLiveTimers=function(selector){ if(liveTimers[selector]){ @@ -863,22 +863,22 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* normalizes axis option to valid values: "y", "x", "yx" */ _findAxis=function(val){ return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y"; }, /* -------------------- */ - - + + /* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */ _findScrollButtonsType=function(val){ return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless"; }, /* -------------------- */ - - + + /* generates plugin markup */ _pluginMarkup=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -915,16 +915,16 @@ and dependencies (minified). mCSB_dragger[1].css("min-width",mCSB_dragger[1].width()); }, /* -------------------- */ - - + + /* calculates content width */ _contentWidth=function(el){ var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width(); return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%"; }, /* -------------------- */ - - + + /* expands content horizontally */ _expandContentHorizontally=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -936,16 +936,16 @@ and dependencies (minified). if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){ mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"}); }else{ - /* - wrap content with an infinite width div and set its position to absolute and width to auto. - Setting width to auto before calculating the actual width is important! + /* + wrap content with an infinite width div and set its position to absolute and width to auto. + Setting width to auto before calculating the actual width is important! We must let the browser set the width as browser zoom values are impossible to calculate. */ mCSB_container.css({"overflow-x":"inherit","position":"absolute"}) .wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />") .css({ /* set actual width, original position and un-wrap */ - /* - get the exact width (with decimals) and then round-up. + /* + get the exact width (with decimals) and then round-up. Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width */ "width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)), @@ -956,8 +956,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* adds scrollbar buttons */ _scrollButtons=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -975,8 +975,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* auto-adjusts scrollbar dragger length */ _setDraggerLength=function(){ var $this=$(this),d=$this.data(pluginPfx), @@ -997,8 +997,8 @@ and dependencies (minified). }); }, /* -------------------- */ - - + + /* calculates scrollbar to content ratio */ _scrollRatio=function(){ var $this=$(this),d=$this.data(pluginPfx), @@ -1013,14 +1013,14 @@ and dependencies (minified). d.scrollRatio={y:ratio[0],x:ratio[1]}; }, /* -------------------- */ - - + + /* toggles scrolling classes */ _onDragClasses=function(el,action,xpnd){ var expandClass=xpnd ? classes[0]+"_expanded" : "", scrollbar=el.closest(".mCSB_scrollTools"); if(action==="active"){ - el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); + el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); el[0]._draggable=el[0]._draggable ? 0 : 1; }else{ if(!el[0]._draggable){ @@ -1033,8 +1033,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* checks if content overflows its container to determine if scrolling is required */ _overflowed=function(){ var $this=$(this),d=$this.data(pluginPfx), @@ -1048,8 +1048,8 @@ and dependencies (minified). return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()]; }, /* -------------------- */ - - + + /* resets content position to 0 */ _resetContentPosition=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -1073,8 +1073,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* binds scrollbar events */ _bindEvents=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt; @@ -1105,8 +1105,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* unbinds scrollbar events */ _unbindEvents=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -1130,8 +1130,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* toggles scrollbar visibility */ _scrollbarVisibility=function(disabled){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -1176,8 +1176,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* returns input coordinates of pointer, touch and mouse events (relative to document) */ _coordinates=function(e){ var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null, @@ -1196,11 +1196,11 @@ and dependencies (minified). } }, /* -------------------- */ - - - /* + + + /* SCROLLBAR DRAG EVENTS - scrolls content via scrollbar dragging + scrolls content via scrollbar dragging */ _draggable=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -1226,10 +1226,10 @@ and dependencies (minified). var offset=draggable.offset(),y=coordinates[0]-offset.top,x=coordinates[1]-offset.left, h=draggable.height()+offset.top,w=draggable.width()+offset.left; if(y<h && y>0 && x<w && x>0){ - dragY=y; + dragY=y; dragX=x; } - _onDragClasses(draggable,"active",o.autoExpandScrollbar); + _onDragClasses(draggable,"active",o.autoExpandScrollbar); }).bind("touchmove."+namespace,function(e){ e.stopImmediatePropagation(); e.preventDefault(); @@ -1246,7 +1246,7 @@ and dependencies (minified). } }).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){ if(draggable){ - _onDragClasses(draggable,"active",o.autoExpandScrollbar); + _onDragClasses(draggable,"active",o.autoExpandScrollbar); draggable=null; } touchActive=false; @@ -1264,7 +1264,7 @@ and dependencies (minified). } }, /* -------------------- */ - + _getTouchEvents=function(namespace){ var eventStart, eventMove, eventEnd; if ('ontouchstart' in window){ @@ -1283,10 +1283,10 @@ and dependencies (minified). return [eventStart, eventMove, eventEnd]; }, - /* + /* TOUCH SWIPE EVENTS - scrolls content via touch swipe - Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices + scrolls content via touch swipe + Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices */ _contentDraggable=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, @@ -1339,7 +1339,7 @@ and dependencies (minified). function _onTouchmove(e){ var coordinates = _coordinates(e); if(!_pointerTouch(e) || touchActive || coordinates[2]){return;} - if(!o.documentTouchScroll){e.preventDefault();} + if(!o.documentTouchScroll){e.preventDefault();} e.stopImmediatePropagation(); if(docDrag && !touchDrag){return;} if(draggable){ @@ -1358,13 +1358,13 @@ and dependencies (minified). preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx")); } if(prevent || preventX){ /* prevent native document scrolling */ - if(!touchAction){e.preventDefault();} + if(!touchAction){e.preventDefault();} touchDrag=1; }else{ docDrag=1; $this.addClass("mCS_touch_action"); } - if(touchAction){e.preventDefault();} + if(touchAction){e.preventDefault();} amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null]; mCSB_container[0].idleTimer=250; if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);} @@ -1428,11 +1428,11 @@ and dependencies (minified). } }, /* -------------------- */ - - - /* - SELECT TEXT EVENTS - scrolls content when text is selected + + + /* + SELECT TEXT EVENTS + scrolls content when text is selected */ _selectable=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential, @@ -1473,7 +1473,7 @@ and dependencies (minified). touchActive=false; }); function _sel(){ - return window.getSelection ? window.getSelection().toString() : + return window.getSelection ? window.getSelection().toString() : document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0; } function _seq(a,c,s){ @@ -1483,11 +1483,11 @@ and dependencies (minified). } }, /* -------------------- */ - - - /* + + + /* MOUSE WHEEL EVENT - scrolls content via mouse-wheel + scrolls content via mouse-wheel via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel) */ _mousewheel=function(){ @@ -1549,8 +1549,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* checks if iframe can be accessed */ _canAccessIFrameCache=new Object(), _canAccessIFrame=function(iframe){ @@ -1580,8 +1580,8 @@ and dependencies (minified). return result; }, /* -------------------- */ - - + + /* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */ _iframe=function(evt){ var el=this.find("iframe"); @@ -1590,8 +1590,8 @@ and dependencies (minified). el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */ }, /* -------------------- */ - - + + /* disables mouse-wheel when hovering specific elements like select, datalist etc. */ _disableMousewheel=function(el,target){ var tag=target.nodeName.toLowerCase(), @@ -1601,11 +1601,11 @@ and dependencies (minified). return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus")); }, /* -------------------- */ - - - /* + + + /* DRAGGER RAIL CLICK EVENT - scrolls content via dragger rail + scrolls content via dragger rail */ _draggerRail=function(){ var $this=$(this),d=$this.data(pluginPfx), @@ -1641,9 +1641,9 @@ and dependencies (minified). }); }, /* -------------------- */ - - - /* + + + /* FOCUS EVENT scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.) */ @@ -1678,8 +1678,8 @@ and dependencies (minified). }); }, /* -------------------- */ - - + + /* sets content wrapper scrollTop/scrollLeft always to 0 */ _wrapperScroll=function(){ var $this=$(this),d=$this.data(pluginPfx), @@ -1692,11 +1692,11 @@ and dependencies (minified). }); }, /* -------------------- */ - - - /* + + + /* BUTTONS EVENTS - scrolls content via up, down, left and right buttons + scrolls content via up, down, left and right buttons */ _buttons=function(){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential, @@ -1733,11 +1733,11 @@ and dependencies (minified). }); }, /* -------------------- */ - - - /* + + + /* KEYBOARD EVENTS - scrolls content via keyboard + scrolls content via keyboard Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End */ _keyboard=function(){ @@ -1824,8 +1824,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */ _sequentialScroll=function(el,action,trigger,e,s){ var d=el.data(pluginPfx),o=d.opt,seq=d.sequential, @@ -1850,7 +1850,7 @@ and dependencies (minified). } break; } - + /* starts sequence */ function _on(once){ if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */ @@ -1885,8 +1885,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* returns a yx array from value */ _arr=function(val){ var o=$(this).data(pluginPfx).opt,vals=[]; @@ -1904,8 +1904,8 @@ and dependencies (minified). return vals; }, /* -------------------- */ - - + + /* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */ _to=function(val,dir){ if(val==null || typeof val=="undefined"){return;} @@ -1962,15 +1962,15 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* calls the update method automatically */ _autoUpdate=function(rem){ var $this=$(this),d=$this.data(pluginPfx),o=d.opt, mCSB_container=$("#mCSB_"+d.idx+"_container"); if(rem){ - /* - removes autoUpdate timer + /* + removes autoUpdate timer usage: _autoUpdate.call(this,"remove"); */ clearTimeout(mCSB_container[0].autoUpdate); @@ -2049,15 +2049,15 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* snaps scrolling to a multiple of a pixels number */ _snapAmount=function(to,amount,offset){ - return (Math.round(to/amount)*amount-offset); + return (Math.round(to/amount)*amount-offset); }, /* -------------------- */ - - + + /* stops content and scrollbar animations */ _stop=function(el){ var d=el.data(pluginPfx), @@ -2067,10 +2067,10 @@ and dependencies (minified). }); }, /* -------------------- */ - - - /* - ANIMATES CONTENT + + + /* + ANIMATES CONTENT This is where the actual scrolling happens */ _scrollTo=function(el,to,options){ @@ -2216,16 +2216,16 @@ and dependencies (minified). function _cbOffsets(){ return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo]; } - /* - populates object with useful values for the user - values: + /* + populates object with useful values for the user + values: content: this.mcs.content - content top position: this.mcs.top - content left position: this.mcs.left - dragger top position: this.mcs.draggerTop - dragger left position: this.mcs.draggerLeft - scrolling y percentage: this.mcs.topPct - scrolling x percentage: this.mcs.leftPct + content top position: this.mcs.top + content left position: this.mcs.left + dragger top position: this.mcs.draggerTop + dragger left position: this.mcs.draggerLeft + scrolling y percentage: this.mcs.topPct + scrolling x percentage: this.mcs.leftPct scrolling direction: this.mcs.direction */ function _mcs(){ @@ -2239,19 +2239,19 @@ and dependencies (minified). topPct:Math.round((100*Math.abs(cp[0]))/(Math.abs(cl[0])-pl[0])),leftPct:Math.round((100*Math.abs(cp[1]))/(Math.abs(cl[1])-pl[1])), direction:options.dir }; - /* + /* this refers to the original element containing the scrollbar(s) - usage: this.mcs.top, this.mcs.leftPct etc. + usage: this.mcs.top, this.mcs.leftPct etc. */ } }, /* -------------------- */ - - - /* - CUSTOM JAVASCRIPT ANIMATION TWEEN - Lighter and faster than jquery animate() and css transitions - Animates top/left properties and includes easings + + + /* + CUSTOM JAVASCRIPT ANIMATION TWEEN + Lighter and faster than jquery animate() and css transitions + Animates top/left properties and includes easings */ _tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){ if(!el._mTween){el._mTween={top:{},left:{}};} @@ -2335,8 +2335,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* returns current time */ _getTime=function(){ if(window.performance && window.performance.now){ @@ -2350,8 +2350,8 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* stops a tween */ _stopTween=function(){ var el=this; @@ -2368,45 +2368,45 @@ and dependencies (minified). } }, /* -------------------- */ - - + + /* deletes a property (avoiding the exception thrown by IE) */ _delete=function(c,m){ try{delete c[m];}catch(e){c[m]=null;} }, /* -------------------- */ - - + + /* detects left mouse button */ _mouseBtnLeft=function(e){ return !(e.which && e.which!==1); }, /* -------------------- */ - - + + /* detects if pointer type event is touch */ _pointerTouch=function(e){ var t=e.originalEvent.pointerType; return !(t && t!=="touch" && t!==2); }, /* -------------------- */ - - + + /* checks if value is numeric */ _isNumeric=function(val){ return !isNaN(parseFloat(val)) && isFinite(val); }, /* -------------------- */ - - + + /* returns element position according to content */ _childPos=function(el){ var p=el.parents(".mCSB_container"); return [el.offset().top-p.offset().top,el.offset().left-p.offset().left]; }, /* -------------------- */ - - + + /* checks if browser tab is hidden/inactive via Page Visibility API */ _isTabHidden=function(){ var prop=_getHiddenProp(); @@ -2416,24 +2416,24 @@ and dependencies (minified). var pfx=["webkit","moz","ms","o"]; if("hidden" in document) return "hidden"; //natively supported for(var i=0; i<pfx.length; i++){ //prefixed - if((pfx[i]+"Hidden") in document) + if((pfx[i]+"Hidden") in document) return pfx[i]+"Hidden"; } return null; //not supported } }; /* -------------------- */ - - - - - - /* + + + + + + /* ---------------------------------------- - PLUGIN SETUP + PLUGIN SETUP ---------------------------------------- */ - + /* plugin constructor functions */ $.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */ if(methods[method]){ @@ -2453,25 +2453,25 @@ and dependencies (minified). $.error("Method "+method+" does not exist"); } }; - - /* - allow setting plugin default options. - usage: $.mCustomScrollbar.defaults.scrollInertia=500; - to apply any changed default options on default selectors (below), use inside document ready fn + + /* + allow setting plugin default options. + usage: $.mCustomScrollbar.defaults.scrollInertia=500; + to apply any changed default options on default selectors (below), use inside document ready fn e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; }); */ $[pluginNS].defaults=defaults; - - /* - add window object (window.mCustomScrollbar) + + /* + add window object (window.mCustomScrollbar) usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");} */ window[pluginNS]=true; - + $(window).bind("load",function(){ - + $(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */ - + /* extend jQuery expressions */ $.extend($.expr[":"],{ /* checks if element is within scrollable viewport */ @@ -2480,7 +2480,7 @@ and dependencies (minified). if(!content.length){return;} wrapper=content.parent(); cPos=[content[0].offsetTop,content[0].offsetLeft]; - return cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && + return cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false); }, /* checks if element or part of element is in view of scrollable viewport */ @@ -2492,7 +2492,7 @@ and dependencies (minified). pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]]; wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth]; wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]]; - return pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && + return pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0; }, /* checks if element is overflowed having visible scrollbar(s) */ @@ -2502,7 +2502,7 @@ and dependencies (minified). return d.overflowed[0] || d.overflowed[1]; } }); - + }); }))})); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits