1(function($) 2{ 3 "use strict"; 4 5 // ------------------------------------------------------------------------------------------- 6 // Avia Text Rotator 7 // 8 // accordion slider script 9 // ------------------------------------------------------------------------------------------- 10 11 $.AviaTextRotator = function(options, slider) 12 { 13 this.$win = $( window ); 14 this.$slider = $( slider ); 15 this.$inner = this.$slider.find('.av-rotator-text'); 16 this.$slides = this.$inner.find('.av-rotator-text-single'); 17 this.$current = this.$slides.eq(0); 18 this.open = 0; 19 this.count = this.$slides.length; 20 21 if($.avia_utilities.supported.transition === undefined) 22 { 23 $.avia_utilities.supported.transition = $.avia_utilities.supports('transition'); 24 } 25 26 this.browserPrefix = $.avia_utilities.supported.transition; 27 this.cssActive = this.browserPrefix !== false ? true : false; 28 this.property = this.browserPrefix + 'transform', 29 30 //this.cssActive = false; //testing no css3 browser 31 32 this._init( options ); 33 } 34 35 $.AviaTextRotator.prototype = 36 { 37 _init: function( options ) 38 { 39 var _self = this; 40 41 if(this.count <= 1) return; 42 43 _self.options = $.extend({}, options, this.$slider.data()); 44 _self.$inner.addClass('av-rotation-active'); 45 //if(_self.options.fixwidth == 1) this.$inner.width(this.$current.width()); 46 _self._autoplay(); 47 48 if(_self.options.animation == "typewriter") 49 { 50 _self.$slider.addClass('av-caret av-blinking-caret'); 51 } 52 53 54 }, 55 56 _autoplay: function() 57 { 58 var _self = this; 59 60 _self.autoplay = setTimeout(function() 61 { 62 _self.open = _self.open === false ? 0 : _self.open + 1; 63 if(_self.open >= _self.count) _self.open = 0; 64 65 if(_self.options.animation != "typewriter") 66 { 67 _self._move({}, _self.open); 68 _self._autoplay(); 69 } 70 else 71 { 72 _self._typewriter(); 73 } 74 75 76 }, _self.options.interval * 1000); 77 }, 78 79 _typewriter: function(event) 80 { 81 var _self = this; 82 83 //mark text 84 _self.$current.css('background-color', _self.$current.css('color') ); 85 _self.$slider.removeClass('av-caret av-blinking-caret').addClass('av-marked-text'); 86 87 88 //store and hide text 89 setTimeout(function() 90 { 91 _self.$slider.addClass('av-caret av-blinking-caret').removeClass('av-marked-text'); 92 _self.$current.data('av_typewriter_text', _self.$current.html()); 93 _self.$current.css('background-color', 'transparent'); 94 _self.$current.html(""); 95 96 }, 800 ); 97 98 99 //start typing new text 100 setTimeout(function() 101 { 102 _self.$slider.removeClass('av-blinking-caret'); 103 _self.$next = _self.$slides.eq(_self.open); 104 var content = _self.$next.data('av_typewriter_text') || _self.$next.html(); 105 content = content.replace(/&/g, '&'); 106 107 _self.$current.css({display:'none'}); 108 _self.$next.css({display:'inline'}); 109 _self.$next.html(""); 110 111 var i = 0; 112 var speed = 50; /* The speed/duration of the effect in milliseconds */ 113 114 function typeWriter() { 115 116 if (i < content.length) { 117 _self.$next[0].innerHTML += content.charAt(i); 118 i++; 119 setTimeout(typeWriter, speed + Math.floor(Math.random() * 100 ) ); 120 } 121 else 122 { 123 _self.$slider.addClass('av-caret av-blinking-caret'); 124 _self.$current = _self.$slides.eq(_self.open); 125 _self._autoplay(); 126 } 127 128 } 129 130 typeWriter(); 131 132 }, 1500 ); 133 }, 134 135 _move: function(event) 136 { 137 var _self = this, 138 modifier = 30 * _self.options.animation, 139 fade_out = {opacity:0}, 140 fade_start = {display:'inline-block', opacity:0}, 141 fade_in = {opacity:1}; 142 143 this.$next = _self.$slides.eq(this.open); 144 145 if(this.cssActive) 146 { 147 fade_out[_self.property] = "translate(0px," + modifier +"px)"; 148 fade_start[_self.property] = "translate(0px," + (modifier * -1) +"px)"; 149 fade_in[_self.property] = "translate(0px,0px)"; 150 } 151 else 152 { 153 fade_out['top'] = modifier; 154 fade_start['top'] = (modifier * -1); 155 fade_in['top'] = 0; 156 } 157 158 159 _self.$current.avia_animate(fade_out, function() 160 { 161 _self.$current.css({display:'none'}); 162 _self.$next.css(fade_start).avia_animate(fade_in, function() 163 { 164 _self.$current = _self.$slides.eq(_self.open); 165 }); 166 }); 167 } 168 }; 169 170 171 $.fn.avia_textrotator = function( options ) 172 { 173 return this.each(function() 174 { 175 var active = $.data( this, 'AviaTextRotator' ); 176 177 if(!active) 178 { 179 //make sure that the function doesnt get aplied a second time 180 $.data( this, 'AviaTextRotator', 1 ); 181 182 //create the preparations for fullscreen slider 183 new $.AviaTextRotator( options, this ); 184 } 185 }); 186 }; 187 188}(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.