PageSourceSearch

http://www.psicologia4u.com/wp-content/themes/Exciter/js/slider.js?ver=4.3.22

js psicologia4u.com collected 2026-10-06 01:47:17 UTC 10,842 bytes, 318 lines download raw bytes

1// JavaScript Document
2/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
3 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
4 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
5 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
6 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
7 *
8 * Version: 3.0.2
9 * 
10 * Requires: 1.2.2+
11 */
12
13(function($) {
14
15var types = ['DOMMouseScroll', 'mousewheel'];
16
17$.event.special.mousewheel = {
18	setup: function() {
19		if ( this.addEventListener )
20			for ( var i=types.length; i; )
21				this.addEventListener( types[--i], handler, false );
22		else
23			this.onmousewheel = handler;
24	},
25	
26	teardown: function() {
27		if ( this.removeEventListener )
28			for ( var i=types.length; i; )
29				this.removeEventListener( types[--i], handler, false );
30		else
31			this.onmousewheel = null;
32	}
33};
34
35$.fn.extend({
36	mousewheel: function(fn) {
37		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
38	},
39	
40	unmousewheel: function(fn) {
41		return this.unbind("mousewheel", fn);
42	}
43});
44
45
46function handler(event) {
47	var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
48	
49	event = $.event.fix(event || window.event);
50	event.type = "mousewheel";
51	
52	if ( event.wheelDelta ) delta = event.wheelDelta/120;
53	if ( event.detail     ) delta = -event.detail/3;
54	
55	// Add events and delta to the front of the arguments
56	args.unshift(event, delta);
57
58	return $.event.handle.apply(this, args);
59}
60
61})(jQuery);
62
63/**
64 * @version		$Id:  $Revision
65 * @package		jquery
66 * @subpackage	lofslidernews
67 * @copyright	Copyright (C) JAN 2010 LandOfCoder.com <@emai:[email protected]>. All rights reserved.
68 * @website     http://landofcoder.com
69 * @license		This plugin is dual-licensed under the GNU General Public License and the MIT License 
70 */
71// JavaScript Document
72(function($) {
73	 $.fn.lofJSidernews = function( settings ) {
74	 	return this.each(function() {
75			// get instance of the lofSiderNew.
76			new  $.lofSidernews( this, settings ); 
77		});
78 	 }
79	 $.lofSidernews = function( obj, settings ){
80		this.settings = {
81			direction	    	: '',
82			mainItemSelector    : 'li',
83			navInnerSelector	: 'ul',
84			navSelector  		: 'li' ,
85			navigatorEvent		: 'click',
86			wapperSelector: 	'.slider-main-wapper',
87			interval	  	 	: 4000,
88			auto			    : true, // whether to automatic play the slideshow
89			maxItemDisplay	 	: 3,
90			startItem			: 0,
91			navPosition			: 'vertical', 
92			navigatorHeight		: 100,
93			navigatorWidth		: 310,
94			duration			: 600,
95			navItemsSelector    : '.slider-navigator li',
96			navOuterSelector    : '.slider-navigator-outer' ,
97			isPreloaded			: true,
98			easing				: 'easeInOutQuad'
99		}	
100		$.extend( this.settings, settings ||{} );	
101		this.nextNo         = null;
102		this.previousNo     = null;
103		this.maxWidth  = this.settings.mainWidth || 600;
104		this.wrapper = $( obj ).find( this.settings.wapperSelector );	
105		this.slides = this.wrapper.find( this.settings.mainItemSelector );
106		if( !this.wrapper.length || !this.slides.length ) return ;
107		// set width of wapper
108		if( this.settings.maxItemDisplay > this.slides.length ){
109			this.settings.maxItemDisplay = this.slides.length;	
110		}
111		this.currentNo      = isNaN(this.settings.startItem)||this.settings.startItem > this.slides.length?0:this.settings.startItem;
112		this.navigatorOuter = $( obj ).find( this.settings.navOuterSelector );	
113		this.navigatorItems = $( obj ).find( this.settings.navItemsSelector ) ;
114		this.navigatorInner = this.navigatorOuter.find( this.settings.navInnerSelector );
115		
116		if( this.settings.navPosition == 'horizontal' ){ 
117			this.navigatorInner.width( this.slides.length * this.settings.navigatorWidth );
118			this.navigatorOuter.width( this.settings.maxItemDisplay * this.settings.navigatorWidth );
119			this.navigatorOuter.height(	this.settings.navigatorHeight );
120			
121		} else {
122			this.navigatorInner.height( this.slides.length * this.settings.navigatorHeight );	
123			
124			this.navigatorOuter.height( this.settings.maxItemDisplay * this.settings.navigatorHeight );
125			this.navigatorOuter.width(	this.settings.navigatorWidth );
126		}		
127		this.navigratorStep = this.__getPositionMode( this.settings.navPosition );		
128		this.directionMode = this.__getDirectionMode();  
129		
130		
131		if( this.settings.direction == 'opacity') {
132			this.wrapper.addClass( 'slider-opacity' );
133			$(this.slides).css('opacity',0).eq(this.currentNo).css('opacity',1);
134		} else { 
135			this.wrapper.css({'left':'-'+this.currentNo*this.maxSize+'px', 'width':( this.maxWidth ) * this.slides.length } );
136		}
137
138		
139		if( this.settings.isPreloaded ) {
140			this.preLoadImage( this.onComplete );
141		} else {
142			this.onComplete();
143		}
144		
145	 }
146     $.lofSidernews.fn =  $.lofSidernews.prototype;
147     $.lofSidernews.fn.extend =  $.lofSidernews.extend = $.extend;
148	 
149	 $.lofSidernews.fn.extend({
150							  
151		startUp:function( obj, wrapper ) {
152			seft = this;
153
154			this.navigatorItems.each( function(index, item ){
155				$(item).click( function(){
156					seft.jumping( index, true );
157					seft.setNavActive( index, item );					
158				} );
159				$(item).css( {'height': seft.settings.navigatorHeight, 'width':  seft.settings.navigatorWidth} );
160			})
161			this.registerWheelHandler( this.navigatorOuter, this );
162			this.setNavActive(this.currentNo );
163			
164			if( this.settings.buttons && typeof (this.settings.buttons) == "object" ){
165				this.registerButtonsControl( 'click', this.settings.buttons, this );
166
167			}
168			if( this.settings.auto ) 
169			this.play( this.settings.interval,'next', true );
170			
171			return this;
172		},
173		onComplete:function(){
174			setTimeout( function(){ $('.preload').fadeOut( 900 ); }, 400 );	this.startUp( );
175		},
176		preLoadImage:function(  callback ){
177			var self = this;
178			var images = this.wrapper.find( 'img' );
179	
180			var count = 0;
181			images.each( function(index,image){ 
182				if( !image.complete ){				  
183					image.onload =function(){
184						count++;
185						if( count >= images.length ){
186							self.onComplete();
187						}
188					}
189					image.onerror =function(){ 
190						count++;
191						if( count >= images.length ){
192							self.onComplete();
193						}	
194					}
195				}else {
196					count++;
197					if( count >= images.length ){
198						self.onComplete();
199					}	
200				}
201			} );
202		},
203		navivationAnimate:function( currentIndex ) { 
204			if (currentIndex <= this.settings.startItem 
205				|| currentIndex - this.settings.startItem >= this.settings.maxItemDisplay-1) {
206					this.settings.startItem = currentIndex - this.settings.maxItemDisplay+2;
207					if (this.settings.startItem < 0) this.settings.startItem = 0;
208					if (this.settings.startItem >this.slides.length-this.settings.maxItemDisplay) {
209						this.settings.startItem = this.slides.length-this.settings.maxItemDisplay;
210					}
211			}		
212			this.navigatorInner.stop().animate( eval('({'+this.navigratorStep[0]+':-'+this.settings.startItem*this.navigratorStep[1]+'})'), 
213												{duration:500, easing:'easeInOutQuad'} );	
214		},
215		setNavActive:function( index, item ){
216			if( (this.navigatorItems) ){ 
217				this.navigatorItems.removeClass( 'active' );
218				$(this.navigatorItems.get(index)).addClass( 'active' );	
219				this.navivationAnimate( this.currentNo );	
220			}
221		},
222		__getPositionMode:function( position ){
223			if(	position  == 'horizontal' ){
224				return ['left', this.settings.navigatorWidth];
225			}
226			return ['top', this.settings.navigatorHeight];
227		},
228		__getDirectionMode:function(){
229			switch( this.settings.direction ){
230				case 'opacity': this.maxSize=0; return ['opacity','opacity'];
231				default: this.maxSize=this.maxWidth; return ['left','width'];
232			}
233		},
234		registerWheelHandler:function( element, obj ){ 
235			 element.bind('mousewheel', function(event, delta ) {
236				var dir = delta > 0 ? 'Up' : 'Down',
237					vel = Math.abs(delta);
238				if( delta > 0 ){
239					obj.previous( true );
240				} else {
241					obj.next( true );
242				}
243				return false;
244			});
245		},
246		registerButtonsControl:function( eventHandler, objects, self ){ 
247			for( var action in objects ){ 
248				switch (action.toString() ){
249					case 'next':
250						objects[action].click( function() { self.next( true) } );
251						break;
252					case 'previous':
253						objects[action].click( function() { self.previous( true) } );
254						break;
255				}
256			}
257			return this;	
258		},
259		onProcessing:function( manual, start, end ){	 		
260			this.previousNo = this.currentNo + (this.currentNo>0 ? -1 : this.slides.length-1);
261			this.nextNo 	= this.currentNo + (this.currentNo < this.slides.length-1 ? 1 : 1- this.slides.length);				
262			return this;
263		},
264		finishFx:function( manual ){
265			if( manual ) this.stop();
266			if( manual && this.settings.auto ){ 
267				this.play( this.settings.interval,'next', true );
268			}		
269			this.setNavActive( this.currentNo );	
270		},
271		getObjectDirection:function( start, end ){
272			return eval("({'"+this.directionMode[0]+"':-"+(this.currentNo*start)+"})");	
273		},
274		fxStart:function( index, obj, currentObj ){
275				if( this.settings.direction == 'opacity' ) { 
276					$(this.slides).stop().animate({opacity:0}
276, {duration: this.settings.duration, easing:this.settings.easing} );
277					$(this.slides).eq(index).stop().animate( {opacity:1}, {duration: this.settings.duration, easing:this.settings.easing} );
278				}else {
279					this.wrapper.stop().animate( obj, {duration: this.settings.duration, easing:this.settings.easing} );
280				}
281			return this;
282		},
283		jumping:function( no, manual ){
284			this.stop(); 
285			if( this.currentNo == no ) return;		
286			 var obj = eval("({'"+this.directionMode[0]+"':-"+(this.maxSize*no)+"})");
287			this.onProcessing( null, manual, 0, this.maxSize )
288				.fxStart( no, obj, this )
289				.finishFx( manual );	
290				this.currentNo  = no;
291		},
292		next:function( manual , item){
293
294			this.currentNo += (this.currentNo < this.slides.length-1) ? 1 : (1 - this.slides.length);	
295			this.onProcessing( item, manual, 0, this.maxSize )
296				.fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this )
297				.finishFx( manual );
298		},
299		previous:function( manual, item ){
300			this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1;
301			this.onProcessing( item, manual )
302				.fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this )
303				.finishFx( manual	);			
304		},
305		play:function( delay, direction, wait ){	
306			this.stop(); 
307			if(!wait){ this[direction](false); }
308			var self  = this;
309			this.isRun = setTimeout(function() { self[direction](true); }, delay);
310		},
311		stop:function(){ 
312			if (this.isRun == null) return;
313			clearTimeout(this.isRun);
314            this.isRun = null; 
315		}
316	})
317})(jQuery)
318

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.