1;(function ($) { 2 'use strict'; 3 4 var AmetysInvokerChangeText = window.AmetysInvokerChangeText || {}; 5 6 AmetysInvokerChangeText = (function () { 7 8 function AmetysInvokerChangeText(element, options) { 9 10 var $self = this; 11 12 /** 13 * Current element. 14 * 15 * @public 16 */ 17 this.$element = $(element); 18 19 /** 20 * Current options set by the caller including defaults. 21 * 22 * @public 23 */ 24 $self.options = $.extend(true, {}, AmetysInvokerChangeText.defaults, options); 25 26 this.initialize(); 27 28 } 29 30 return AmetysInvokerChangeText; 31 32 }()); 33 34 AmetysInvokerChangeText.defaults = { 35 containerSelector: null, 36 invokerSelector: null, 37 invokerTextSelector: null, 38 invokerIconSelector: null, 39 closedCheckClass: 'collapsed' 40 }; 41 42 /** 43 * Initialization of the plugin. 44 * 45 * @protected 46 */ 47 AmetysInvokerChangeText.prototype.initialize = function () { 48 // vars 49 var $self = this; 50 51 $self.options.containerSelector = '#' + $self.$element[0].id; 52 53 $self.options.invokerSelector = $self.options.containerSelector + ' [data-invoker]'; 54 $self.options.invokerIconSelector = '[data-invoker-icon]'; 55 $self.options.invokerTextSelector = '[data-invoker-text]'; 56 57 $($self.options.invokerSelector).each(function() { 58 59 var $this = $(this), 60 $thisText = $this.find($self.options.invokerTextSelector), 61 $thisIcon = $this.find($self.options.invokerIconSelector), 62 closeText = $this.data('close-text'), 63 openText = $this.data('open-text'), 64 closeIcon = $this.data('close-icon'), 65 openIcon = $this.data('open-icon'); 66 67 $this.on('click', function() { 68 69 setTimeout(function() { 70 71 if (!$this.hasClass($self.options.closedCheckClass)) { 72 73 $thisText.text(openText); 74 $thisIcon.removeClass(closeIcon); 75 $thisIcon.addClass(openIcon); 76 77 } else { 78 79 $thisText.text(closeText); 80 $thisIcon.removeClass(openIcon); 81 $thisIcon.addClass(closeIcon); 82 83 } 84 85 }) 86 87 }); 88 89 }); 90 91 return this; 92 93 }; 94 95 $.fn.HSAmetysInvokerChangeText = function () { 96 97 var _ = this, 98 opt = arguments[0], 99 args = Array.prototype.slice.call(arguments, 1), 100 l = _.length, 101 i, 102 ret; 103 104 for (i = 0; i < l; i++) { 105 if (typeof opt == 'object' || typeof opt == 'undefined') { 106 107 _[i].AmetysInvokerChangeText = new AmetysInvokerChangeText(_[i], opt); 108 109 } else { 110 111 ret = _[i].AmetysInvokerChangeText[opt].apply(_[i].AmetysInvokerChangeText, args
111); 112 113 } 114 115 if (typeof ret != 'undefined') { 116 117 return ret; 118 119 } 120 } 121 122 return _; 123 124 }; 125 126})(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.