1/** 2 * HSMalihuScrollBar component. 3 * 4 * @author Htmlstream 5 * @version 1.0 6 * @requires malihu jquery custom scrollbar plugin (v3.1.5.) 7 * 8 */ 9;(function ($) { 10 'use strict'; 11 12 $.HSCore.components.HSMalihuScrollBar = { 13 14 /** 15 * Base configuration. 16 * 17 * @private 18 */ 19 _baseConfig: { 20 scrollInertia: 150, 21 theme: 'minimal-dark' 22 }, 23 24 /** 25 * Collection of all initalized items on the page. 26 * 27 * @private 28 */ 29 _pageCollection: $(), 30 31 32 /** 33 * Initialization of HSMalihuScrollBar component. 34 * 35 * @param {jQuery} collection 36 * @param {Object} config 37 * 38 * @return {jQuery} 39 */ 40 init: function (collection, config) { 41 42 if(!collection || !collection.length) return; 43 44 var self = this; 45 46 config = config && $.isPlainObject(config) ? $.extend(true, {}, config, this._baseConfig) : this._baseConfig; 47 48 return collection.each(function(i, el){ 49 50 var $this = $(el), 51 scrollBar, 52 scrollBarThumb, 53 itemConfig = $.extend(true, {}, config, $this.data()); 54 55 56 $this.mCustomScrollbar(itemConfig); 57 58 scrollBar = $this.find('.mCSB_scrollTools'); 59 scrollBarThumb = $this.find('.mCSB_dragger_bar'); 60 61 if(scrollBar.length && $this.data('scroll-classes')) { 62 scrollBar.addClass($this.data('scroll-classes')); 63 } 64 65 if(scrollBarThumb.length && $this.data('scroll-thumb-classes')) { 66 scrollBarThumb.addClass($this.data('scroll-thumb-classes')); 67 } 68 69 self._pageCollection = self._pageCollection.add($this); 70 71 }); 72 73 }, 74 75 /** 76 * Destroys the component. 77 * 78 * @param {jQuery} collection 79 * 80 * @return {jQuery} 81 */ 82 destroy: function( collection ) { 83 84 if( !collection && !collection.length ) return $(); 85 86 var _self = this; 87 88 return collection.each(function(i, el){ 89 90 var $this = $(el); 91 92 $this.mCustomScrollbar('destroy'); 93 94 _self._pageCollection = _self._pageCollection.not( $this ); 95 96 }); 97 98 } 99 100 } 101 102})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.