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 mon_width : 0, 115 navPosition : 'vertical',/* values: horizontal|vertical*/ 116 navigatorHeight : '13', 117 navigatorWidth : 120, 118 duration : 600, 119 navItemsSelector : '.recomm_circle', 120 navOuterSelector : '.navigator-wrapper' , 121 isPreloaded : true, 122 easing : 'easeInOutQuad', 123 onPlaySlider:function(obj, slider){}, 124 onComplete:function(slider, index){ } 125 } 126 $.extend( this.settings, settings ||{} ); 127 this.nextNo = null; 128 this.previousNo = null; 129 this.maxWidth = this.settings.mon_width; 130 131 132 133 this.wrapper = $( obj ).find( this.settings.wapperSelector ); 134 var wrapOuter = $('<div class="sliders-wrapper"></div>').width( this.maxWidth ); 135 this.wrapper.wrap( wrapOuter ); 136 137 this.slides = this.wrapper.find( this.settings.mainItemSelector ); 138 if( !this.wrapper.length || !this.slides.length ) return ; 139 // set width of wapper 140 if( this.settings.maxItemDisplay > this.slides.length ){ 141 this.settings.maxItemDisplay = this.slides.length; 142 } 143 this.currentNo = isNaN(this.settings.startItem)||this.settings.startItem > this.slides.length?0:this.settings.startItem; 144 this.navigatorOuter = $( obj ).find( this.settings.navOuterSelector ); 145 this.navigatorItems = $( obj ).find( this.settings.navItemsSelector ) ;
146 this.navigatorInner = this.navigatorOuter.find( this.settings.navInnerSelector ); 147 // if use automactic calculate width of navigator 148 149 if( this.settings.navigatorHeight == null || this.settings.navigatorWidth == null ){ 150 this.settings.navigatorHeight = this.navigatorItems.eq(0).outerWidth(true); 151 this.settings.navigatorWidth = this.navigatorItems.eq(0).outerHeight(true); 152 153 } 154 if( this.settings.navPosition == 'horizontal' ){ 155 this.navigatorInner.width( this.slides.length * this.settings.navigatorWidth ); 156 //this.navigatorOuter.width( this.settings.maxItemDisplay * this.settings.navigatorWidth ); 157 this.navigatorOuter.width( this.settings.navigatorWidth); 158 this.navigatorOuter.height( this.settings.navigatorHeight ); 159 160 } else { 161 this.navigatorInner.height( this.slides.length * this.settings.navigatorHeight ); 162 163 this.navigatorOuter.height( this.settings.maxItemDisplay * this.settings.navigatorHeight ); 164 this.navigatorOuter.width( this.settings.navigatorWidth ); 165 } 166 this.slides.width( this.settings.mon_width ); 167 this.navigratorStep = this.__getPositionMode( this.settings.navPosition ); 168 this.directionMode = this.__getDirectionMode(); 169 170 171 if( this.settings.direction == 'opacity') { 172 this.wrapper.addClass( 'lof-opacity' ); 173 $(this.slides).css({'opacity':0,'z-index':1}).eq(this.currentNo).css({'opacity':1,'z-index':3}); 174 } else { 175 this.wrapper.css({'left':'-'+this.currentNo*this.maxSize+'px', 'width':( this.maxWidth ) * this.slides.length } ); 176 } 177 178 179 if( this.settings.isPreloaded ) { 180 this.preLoadImage( this.onComplete ); 181 } else { 182 this.onComplete(); 183 } 184 185 $buttonControl = $( ".button-control", obj); 186 if( this.settings.auto ){ 187 $buttonControl.addClass("action-stop"); 188 } else { 189 $buttonControl.addClass("action-start"); 190 } 191 var self = this; 192 193 $( obj ).hover(function(){ 194 self.stop(); 195 $buttonControl.addClass("action-start").removeClass("action-stop").addClass("hover-stop"); 196 }, function(){ 197 self.play( self.settings.interval,'next', true ); 198 }); 199 200 201 $buttonControl.click( function() { 202 if( $buttonControl.hasClass("action-start") ){ 203 self.settings.auto =true; 204 self.play( self.settings.interval,'next', true ); 205 $buttonControl.removeClass("action-start").addClass("action-stop"); 206 } else{ 207 self.settings.auto =false; 208 self.stop(); 209 $buttonControl.addClass("action-start").removeClass("action-stop"); 210 } 211 } ); 212 } 213 $.lofSidernews.fn = $.lofSidernews.prototype; 214 $.lofSidernews.fn.extend = $.lofSidernews.extend = $.extend; 215 216 $.lofSidernews.fn.extend({ 217 218 startUp:function( obj, wrapper ) { 219 seft = this; 220 221 this.navigatorItems.each( function(index, item ){ 222 $(item).bind( seft.settings.navigatorEvent,( function(){ 223 seft.jumping( index, true ); 224 seft.setNavActive( index, item ); 225 } )); 226 $(item).css( {'height': seft.settings.navigatorHeight, 'width': seft.settings.navigatorWidth} ); 227 }) 228 this.registerWheelHandler( this.navigatorOuter, this ); 229 this.setNavActive( this.currentNo ); 230 this.settings.onComplete( this.slides.eq(this.currentNo ),this.currentNo ); 231 if( this.settings.buttons && typeof (this.settings.buttons) == "object" ){ 232 this.registerButtonsControl( 'click', this.settings.buttons, this ); 233 234 } 235 if( this.settings.auto ) 236 this.play( this.settings.interval,'next', true ); 237 238 return this; 239 }, 240 onComplete:function(){ 241 setTimeout( function(){ $('.preload').fadeOut( 900, function(){ $('.preload').remove(); } ); }, 400 ); this.startUp( ); 242 }, 243 preLoadImage:function( callback ){ 244 var self = this; 245 var images = this.wrapper.find( 'img' ); 246 247 var count = 0; 248 images.each( function(index,image){ 249 if( !image.complete ){ 250 image.onload =function(){ 251 count++; 252 if( count >= images.length ){ 253 self.onComplete(); 254 } 255 } 256 image.onerror =function(){ 257 count++; 258 if( count >= images.length ){ 259 self.onComplete(); 260 } 261 } 262 }else { 263 count++; 264 if( count >= images.length ){ 265 self.onComplete(); 266 } 267 } 268 } ); 269 }, 270 navivationAnimate:function( currentIndex ) { 271 if (currentIndex <= this.settings.startItem 272 || currentIndex - this.settings.startItem >= this.settings.maxItemDisplay-1) { 273 this.settings.startItem = currentIndex - this.settings.maxItemDisplay+2; 274 if (this.settings.startItem < 0) this.settings.startItem = 0; 275 if (this.settings.startItem >this.slides.length-this.settings.maxItemDisplay) { 276 this.settings.startItem = this.slides.length-this.settings.maxItemDisplay; 277 } 278 } 279 280 this.navigatorInner.stop().animate( eval('({'+this.navigratorStep[0]+':-'+this.settings.startItem*this.navigratorStep[1]+'})'), 281 {duration:500, easing:'easeInOutQuad'} ); 282 }, 283 setNavActive:function( index, item ){ 284 if( (this.navigatorItems) ){ 285 this.navigatorItems.removeClass( 'active' ); 286 $(this.navigatorItems.get(index)).addClass( 'active' ); 287 this.navivationAnimate( this.currentNo ); 288 } 289 }, 290 __getPositionMode:function( position ){ 291 if( position == 'horizontal' ){ 292 return ['left', this.settings.navigatorWidth]; 293 } 294 return ['top', this.settings.navigatorHeight]; 295 }, 296 __getDirectionMode:function(){ 297 switch( this.settings.direction ){ 298 case 'opacity': this.maxSize=0; return ['opacity','opacity']; 299 default: this.maxSize=this.maxWidth; return ['left','width']; 300 } 301 }, 302 registerWheelHandler:function( element, obj ){ 303 element.bind('mousewheel', function(event, delta ) { 304 var dir = delta > 0 ? 'Up' : 'Down', 305 vel = Math.abs(delta); 306 if( delta > 0 ){ 307 obj.previous( true ); 308 } else { 309 obj.next( true ); 310 } 311 return false;
312 }); 313 }, 314 registerButtonsControl:function( eventHandler, objects, self ){ 315 for( var action in objects ){ 316 switch (action.toString() ){ 317 case 'next': 318 objects[action].click( function() { self.next( true) } ); 319 break; 320 case 'previous': 321 objects[action].click( function() { self.previous( true) } ); 322 break; 323 } 324 } 325 return this; 326 }, 327 onProcessing:function( manual, start, end ){ 328 this.previousNo = this.currentNo + (this.currentNo>0 ? -1 : this.slides.length-1); 329 this.nextNo = this.currentNo + (this.currentNo < this.slides.length-1 ? 1 : 1- this.slides.length); 330 return this; 331 }, 332 finishFx:function( manual ){ 333 if( manual ) this.stop(); 334 if( manual && this.settings.auto ){ 335 this.play( this.settings.interval,'next', true ); 336 } 337 this.setNavActive( this.currentNo ); 338 this.settings.onPlaySlider( this, $(this.slides).eq(this.currentNo) ); 339 }, 340 getObjectDirection:function( start, end ){ 341 return eval("({'"+this.directionMode[0]+"':-"+(this.currentNo*start)+"})"); 342 }, 343 fxStart:function( index, obj, currentObj ){ 344 var s = this; 345 if( this.settings.direction == 'opacity' ) { 346 347 $(this.slides).stop().animate({opacity:0}
347, {duration: this.settings.duration, easing:this.settings.easing,complete:function(){ 348 s.slides.css("z-index","1") 349 s.slides.eq(index).css("z-index","3"); 350 }} ); 351 $(this.slides).eq(index).stop().animate( {opacity:1}, { duration : this.settings.duration, 352 easing :this.settings.easing, 353 complete :function(){ s.settings.onComplete($(s.slides).eq(index),index); }} ); 354 }else { 355 this.wrapper.stop().animate( obj, {duration: this.settings.duration, easing:this.settings.easing,complete:function(){ 356 s.settings.onComplete($(s.slides).eq(index),index) 357 } } ); 358 } 359 return this; 360 }, 361 jumping:function( no, manual ){ 362 this.stop(); 363 if( this.currentNo == no ) return; 364 var obj = eval("({'"+this.directionMode[0]+"':-"+(this.maxSize*no)+"})"); 365 this.onProcessing( null, manual, 0, this.maxSize ) 366 .fxStart( no, obj, this ) 367 .finishFx( manual ); 368 this.currentNo = no; 369 }, 370 next:function( manual , item){ 371 372 this.currentNo += (this.currentNo < this.slides.length-1) ? 1 : (1 - this.slides.length); 373 this.onProcessing( item, manual, 0, this.maxSize ) 374 .fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this ) 375 .finishFx( manual ); 376 }, 377 previous:function( manual, item ){ 378 this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1; 379 this.onProcessing( item, manual ) 380 .fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this ) 381 .finishFx( manual ); 382 }, 383 play:function( delay, direction, wait ){ 384 this.stop(); 385 if(!wait){ this[direction](false); } 386 var self = this; 387 this.isRun = setTimeout(function() { self[direction](true); }, delay); 388 }, 389 stop:function(){ 390 if (this.isRun == null) return; 391 clearTimeout(this.isRun); 392 this.isRun = null; 393 } 394 }) 395})(jQuery) 396
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.