1(function ($){ 2 var ReadMore = function(target, options, index){ 3 this._init(target, options, index); 4 }; 5 6 ReadMore.prototype = { 7 8 options : null, 9 target : null, 10 11 buttonSelectorExpand: null, 12 buttonSelectorCollapse: null, 13 textSelector: null, 14 15 _init : function(target, options, index){ 16 var defaults = { 17 }; 18 19 this.target = $(target); 20 this.options = $.extend(true, defaults, options); 21 22 this.buttonSelectorExpand = '.expand'; 23 this.buttonSelectorCollapse = '.collapse'; 24 this.textSelector = '.text'; 25 26 this._setupHandler(); 27 }, 28 29 _setupHandler : function(){ 30 var _this = this; 31 32 33 $(this.buttonSelectorExpand, this.target).on('click.readmore', function(e){ 34 _this._expand(e); 35 }); 36 37 $(this.buttonSelectorCollapse, this.target).on('click.readmore', function(e){ 38 _this._collapse(e); 39 40 }); 41 }, 42 43 _expand : function(event){ 44 var button = $(event.currentTarget); 45 var parent = button.closest('.element'); 46 47 if(parent.hasClass('js-active') == true){ 48 return; 49 } 50 var text = $(this.textSelector, parent); 51 52 parent.addClass('js-active'); 53 54 text.velocity('finish').velocity('slideDown', { 55 duration: 300, 56 complete: function(){ 57 58 } 59 }); 60 61 }, 62 63 _collapse : function(event){ 64 var button = $(event.currentTarget); 65 var parent = button.closest('.element'); 66 67 if(parent.hasClass('js-active') == false){ 68 return; 69 } 70 71 var text = $(this.textSelector, parent); 72 73 text.velocity('finish').velocity('slideUp', { 74 duration: 300, 75 complete: function(){ 76 parent.removeClass('js-active'); 77 78 } 79 }); 80 } 81 }; 82 83 $.fn.readMore = function(o){ 84 return this.each(function(i, e){ 85 $(this).data('readMore', new ReadMore(this, o, i)); 86 }); 87 }; 88}(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.