1/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 2 * Licensed under the MIT License (LICENSE.txt). 3 * 4 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 * Thanks to: Seamus Leahy for adding deltaX and deltaY 7 * 8 * Version: 3.0.6 9 * 10 * Requires: 1.2.2+ 11 */ 12 13(function($) { 14 15var types = ['DOMMouseScroll', 'mousewheel']; 16 17if ($.event.fixHooks) { 18 for ( var i=types.length; i; ) { 19 $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; 20 } 21} 22 23$.event.special.mousewheel = { 24 setup: function() { 25 if ( this.addEventListener ) { 26 for ( var i=types.length; i; ) { 27 this.addEventListener( types[--i], handler, false ); 28 } 29 } else { 30 this.onmousewheel = handler; 31 } 32 }, 33 34 teardown: function() { 35 if ( this.removeEventListener ) { 36 for ( var i=types.length; i; ) { 37 this.removeEventListener( types[--i], handler, false ); 38 } 39 } else { 40 this.onmousewheel = null; 41 } 42 } 43}; 44 45$.fn.extend({ 46 mousewheel: function(fn) { 47 return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 48 }, 49 50 unmousewheel: function(fn) { 51 return this.unbind("mousewheel", fn); 52 } 53}); 54 55 56function handler(event) { 57 var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; 58 event = $.event.fix(orgEvent); 59 event.type = "mousewheel"; 60 61 // Old school scrollwheel delta 62 if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } 63 if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } 64 65 // New school multidimensional scroll (touchpads) deltas 66 deltaY = delta; 67 68 // Gecko 69 if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 70 deltaY = 0; 71 deltaX = -1*delta; 72 } 73 74 // Webkit 75 if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } 76 if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } 77 78 // Add event and delta to the front of the arguments 79 args.unshift(event, delta, deltaX, deltaY); 80 81 return ($.event.dispatch || $.event.handle).apply(this, args); 82} 83 84})(jQuery); 85 86/** 87 * @version 2.0 88 * @package jquery 89 * @subpackage lofslidernews 90 * @copyright Copyright (C) JAN 2010 LandOfCoder.com <@emai:[email protected]>. All rights reserved. 91 * @website http://landofcoder.com 92 * @license This plugin is dual-licensed under the GNU General Public License and the MIT License 93 */ 94// JavaScript Document 95(function($) { 96 $.fn.lofJSidernews = function( settings ) { 97 return this.each(function() { 98 // get instance of the lofSiderNew. 99 new $.lofSidernews( this, settings ); 100 }); 101 } 102 $.lofSidernews = function( obj, settings ){ 103 this.settings = { 104 direction : '', 105 mainItemSelector : 'li', 106 navInnerSelector : 'ul', 107 navSelector : 'li' , 108 navigatorEvent : 'click'/* click|mouseenter */, 109 wapperSelector: '.sliders-wrap-inner', 110 interval : 5000, 111 auto : false, // whether to automatic play the slideshow 112 maxItemDisplay : 3, 113 startItem : 0, 114 navPosition : 'vertical',/* values: horizontal|vertical*/ 115 navigatorHeight : 100, 116 navigatorWidth : 160, 117 duration : 600, 118 navItemsSelector : '.navigator-wrap-inner li', 119 navOuterSelector : '.navigator-wrapper' , 120 isPreloaded : true, 121 easing : 'easeInOutQuad', 122 onPlaySlider:function(obj, slider){}, 123 onComplete:function(slider, index){ } 124 } 125 $.extend( this.settings, settings ||{} ); 126 this.nextNo = null; 127 this.previousNo = null; 128 this.maxWidth = this.settings.mainWidth || 590; 129 130 131 132 this.wrapper = $( obj ).find( this.settings.wapperSelector ); 133 var wrapOuter = $('<div class="sliders-wrapper"></div>').width( this.maxWidth ); 134 this.wrapper.wrap( wrapOuter ); 135 136 this.slides = this.wrapper.find( this.settings.mainItemSelector ); 137 if( !this.wrapper.length || !this.slides.length ) return ; 138 // set width of wapper 139 if( this.settings.maxItemDisplay > this.slides.length ){ 140 this.settings.maxItemDisplay = this.slides.length; 141 } 142 this.currentNo = isNaN(this.settings.startItem)||this.settings.startItem > this.slides.length?0:this.settings.startItem; 143 this.navigatorOuter = $( obj ).find( this.settings.navOuterSelector ); 144 this.navigatorItems = $( obj ).find( this.settings.navItemsSelector ) ;
145 this.navigatorInner = this.navigatorOuter.find( this.settings.navInnerSelector ); 146 // if use automactic calculate width of navigator 147 148 if( this.settings.navigatorHeight == null || this.settings.navigatorWidth == null ){ 149 this.settings.navigatorHeight = this.navigatorItems.eq(0).outerWidth(true); 150 this.settings.navigatorWidth = this.navigatorItems.eq(0).outerHeight(true); 151 152 } 153 if( this.settings.navPosition == 'horizontal' ){ 154 this.navigatorInner.width( this.slides.length * this.settings.navigatorWidth ); 155 this.navigatorOuter.width( this.settings.maxItemDisplay * this.settings.navigatorWidth ); 156 this.navigatorOuter.height( this.settings.navigatorHeight ); 157 158 } else { 159 this.navigatorInner.height( this.slides.length * this.settings.navigatorHeight ); 160 161 this.navigatorOuter.height( this.settings.maxItemDisplay * this.settings.navigatorHeight ); 162 this.navigatorOuter.width( this.settings.navigatorWidth ); 163 } 164 this.slides.width( this.settings.mainWidth ); 165 this.navigratorStep = this.__getPositionMode( this.settings.navPosition ); 166 this.directionMode = this.__getDirectionMode(); 167 168 169 if( this.settings.direction == 'opacity') { 170 this.wrapper.addClass( 'lof-opacity' ); 171 $(this.slides).css({'opacity':0,'z-index':1}).eq(this.currentNo).css({'opacity':1,'z-index':3}); 172 } else { 173 this.wrapper.css({'left':'-'+this.currentNo*this.maxSize+'px', 'width':( this.maxWidth ) * this.slides.length } ); 174 } 175 176 177 if( this.settings.isPreloaded ) { 178 this.preLoadImage( this.onComplete ); 179 } else { 180 this.onComplete(); 181 } 182 183 $buttonControl = $( ".button-control", obj); 184 if( this.settings.auto ){ 185 $buttonControl.addClass("action-stop"); 186 } else { 187 $buttonControl.addClass("action-start"); 188 } 189 var self = this; 190 191 $( obj ).hover(function(){ 192 self.stop(); 193 $buttonControl.addClass("action-start").removeClass("action-stop").addClass("hover-stop"); 194 }, function(){ 195 if( $buttonControl.hasClass("hover-stop") ){ 196 197 if( self.settings.auto ){ 198 $buttonControl.removeClass("action-start").removeClass("hover-stop").addClass("action-stop"); 199 self.play( self.settings.interval,'next', true ); 200 } 201 } 202 } ); 203 204 205 $buttonControl.click( function() { 206 if( $buttonControl.hasClass("action-start") ){ 207 self.settings.auto =true; 208 self.play( self.settings.interval,'next', true ); 209 $buttonControl.removeClass("action-start").addClass("action-stop"); 210 } else{ 211 self.settings.auto =false; 212 self.stop(); 213 $buttonControl.addClass("action-start").removeClass("action-stop"); 214 } 215 } ); 216 } 217 $.lofSidernews.fn = $.lofSidernews.prototype; 218 $.lofSidernews.fn.extend = $.lofSidernews.extend = $.extend; 219 220 $.lofSidernews.fn.extend({ 221 222 startUp:function( obj, wrapper ) { 223 seft = this; 224 225 this.navigatorItems.each( function(index, item ){ 226 $(item).bind( seft.settings.navigatorEvent,( function(){ 227 seft.jumping( index, true ); 228 seft.setNavActive( index, item ); 229 } )); 230 $(item).css( {'height': seft.settings.navigatorHeight, 'width': seft.settings.navigatorWidth} ); 231 }) 232 this.registerWheelHandler( this.navigatorOuter, this ); 233 this.setNavActive( this.currentNo ); 234 this.settings.onComplete( this.slides.eq(this.currentNo ),this.currentNo ); 235 if( this.settings.buttons && typeof (this.settings.buttons) == "object" ){ 236 this.registerButtonsControl( 'click', this.settings.buttons, this ); 237 238 } 239 if( this.settings.auto ) 240 this.play( this.settings.interval,'next', true ); 241 242 return this; 243 }, 244 onComplete:function(){ 245 setTimeout( function(){ $('.preload').fadeOut( 900, function(){ $('.preload').remove(); } ); }, 400 ); this.startUp( ); 246 }, 247 preLoadImage:function( callback ){ 248 var self = this; 249 var images = this.wrapper.find( 'img' ); 250 251 var count = 0; 252 images.each( function(index,image){ 253 if( !image.complete ){ 254 image.onload =function(){ 255 count++; 256 if( count >= images.length ){ 257 self.onComplete(); 258 } 259 } 260 image.onerror =function(){ 261 count++; 262 if( count >= images.length ){ 263 self.onComplete(); 264 } 265 } 266 }else { 267 count++; 268 if( count >= images.length ){ 269 self.onComplete(); 270 } 271 } 272 } ); 273 }, 274 navivationAnimate:function( currentIndex ) { 275 if (currentIndex <= this.settings.startItem 276 || currentIndex - this.settings.startItem >= this.settings.maxItemDisplay-1) { 277 this.settings.startItem = currentIndex - this.settings.maxItemDisplay+2; 278 if (this.settings.startItem < 0) this.settings.startItem = 0; 279 if (this.settings.startItem >this.slides.length-this.settings.maxItemDisplay) { 280 this.settings.startItem = this.slides.length-this.settings.maxItemDisplay; 281 } 282 } 283 284 this.navigatorInner.stop().animate( eval('({'+this.navigratorStep[0]+':-'+this.settings.startItem*this.navigratorStep[1]+'})'), 285 {duration:500, easing:'easeInOutQuad'} ); 286 }, 287 setNavActive:function( index, item ){ 288 if( (this.navigatorItems) ){ 289 this.navigatorItems.removeClass( 'active' ); 290 $(this.navigatorItems.get(index)).addClass( 'active' ); 291 this.navivationAnimate( this.currentNo ); 292 } 293 }, 294 __getPositionMode:function( position ){ 295 if( position == 'horizontal' ){ 296 return ['left', this.settings.navigatorWidth]; 297 } 298 return ['top', this.settings.navigatorHeight]; 299 }, 300 __getDirectionMode:function(){ 301 switch( this.settings.direction ){ 302 case 'opacity': this.maxSize=0; return ['opacity','opacity']; 303 default: this.maxSize=this.maxWidth; return ['left','width']; 304 } 305 }, 306 registerWheelHandler:function( element, obj ){ 307 element.bind('mousewheel', function(event, delta ) { 308 var dir = delta > 0 ? 'Up' : 'Down', 309 vel = Math.abs(delta); 310 if( delta > 0 ){ 311 obj.previous( true ); 312 } else { 313 obj.next( true ); 314 } 315 return false;
316 }); 317 }, 318 registerButtonsControl:function( eventHandler, objects, self ){ 319 for( var action in objects ){ 320 switch (action.toString() ){ 321 case 'next': 322 objects[action].click( function() { self.next( true) } ); 323 break; 324 case 'previous': 325 objects[action].click( function() { self.previous( true) } ); 326 break; 327 } 328 } 329 return this; 330 }, 331 onProcessing:function( manual, start, end ){ 332 this.previousNo = this.currentNo + (this.currentNo>0 ? -1 : this.slides.length-1); 333 this.nextNo = this.currentNo + (this.currentNo < this.slides.length-1 ? 1 : 1- this.slides.length); 334 return this; 335 }, 336 finishFx:function( manual ){ 337 if( manual ) this.stop(); 338 if( manual && this.settings.auto ){ 339 this.play( this.settings.interval,'next', true ); 340 } 341 this.setNavActive( this.currentNo ); 342 this.settings.onPlaySlider( this, $(this.slides).eq(this.currentNo) ); 343 }, 344 getObjectDirection:function( start, end ){ 345 return eval("({'"+this.directionMode[0]+"':-"+(this.currentNo*start)+"})"); 346 }, 347 fxStart:function( index, obj, currentObj ){ 348 var s = this; 349 if( this.settings.direction == 'opacity' ) { 350 351 $(this.slides).stop().animate({opacity:0}
351, {duration: this.settings.duration, easing:this.settings.easing,complete:function(){ 352 s.slides.css("z-index","1") 353 s.slides.eq(index).css("z-index","3"); 354 }} ); 355 $(this.slides).eq(index).stop().animate( {opacity:1}, { duration : this.settings.duration, 356 easing :this.settings.easing, 357 complete :function(){ s.settings.onComplete($(s.slides).eq(index),index); }} ); 358 }else { 359 this.wrapper.stop().animate( obj, {duration: this.settings.duration, easing:this.settings.easing,complete:function(){ 360 s.settings.onComplete($(s.slides).eq(index),index) 361 } } ); 362 } 363 return this; 364 }, 365 jumping:function( no, manual ){ 366 this.stop(); 367 if( this.currentNo == no ) return; 368 var obj = eval("({'"+this.directionMode[0]+"':-"+(this.maxSize*no)+"})"); 369 this.onProcessing( null, manual, 0, this.maxSize ) 370 .fxStart( no, obj, this ) 371 .finishFx( manual ); 372 this.currentNo = no; 373 }, 374 next:function( manual , item){ 375 376 this.currentNo += (this.currentNo < this.slides.length-1) ? 1 : (1 - this.slides.length); 377 this.onProcessing( item, manual, 0, this.maxSize ) 378 .fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this ) 379 .finishFx( manual ); 380 }, 381 previous:function( manual, item ){ 382 this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1; 383 this.onProcessing( item, manual ) 384 .fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this ) 385 .finishFx( manual ); 386 }, 387 play:function( delay, direction, wait ){ 388 this.stop(); 389 if(!wait){ this[direction](false); } 390 var self = this; 391 this.isRun = setTimeout(function() { self[direction](true); }, delay); 392 }, 393 stop:function(){ 394 if (this.isRun == null) return; 395 clearTimeout(this.isRun); 396 this.isRun = null; 397 } 398 }) 399})(jQuery) 400
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.