PageSourceSearch

https://jaluzi-frame.ru/modules/mod_noo_ticker/assets/js/script.js

js jaluzi-frame.ru collected 2026-10-05 00:04:00 UTC 8,200 bytes, 253 lines download raw bytes

1/**
2 * @version		$Id$
3 * @author		NooTheme
4 * @package		Joomla.Site
5 * @subpackage	mod_noo_ticker
6 * @copyright	Copyright (C) 2013 NooTheme. All rights reserved.
7 * @license		License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
8 */
9
10!function ($) {
11
12  "use strict"
13
14  var Nooticker = function (_e, _o) {
15	
16    this.$element = $(_e)
17    this.options = _o
18    this.am = new Array()
19	this.am2 = new Array()
20    this.options.items = $(".noo-ticker-item",this.$element)
21    if(!this.options.items)
22    	return
23    	
24    this.$element.css('height',this.options.items[0].offsetHeight)
25    
26    this.options.items.each(function(index,item){
27    	if($(item).css('visibility') == "hidden"){
28			$(item).css({
29				visibility: 'visible',
30				opacity: 0
31			})
32		}
33    })
34    var self = this
35
36	this.onRunning = this.options.onRunning
37	
38	 if( isNaN(this.options.startItem) 
39			|| (this.options.startItem > this.options.items.length || this.options.startItem < 0 ) ){
40		this.options.startItem = 0 		 
41	 }
42	
43	var maxWidth = 0
44	this.options.items.each(function( index, _item){  
45		// set z-index for each item in the list.							 
46		 $(_item).css('z-index', self.options.items.length - index)
47		
48		 
49		 $(_item).css('width', _item.offsetWidth)
50		 
51		  if( _item.offsetWidth > maxWidth ){
52			  maxWidth = _item.offsetWidth
53		  }
54		  self.am2[index] = $(_item)
55		  self.am2[index].offsetWidth= _item.offsetWidth
56//			
57		 if( self.options.mode != 'opacity' ) { 
58			 self.am[index] = $(_item)
59		 }
60	})
61	
62	if(this.$element.offsetWidth <= 0 ){
63	
64		this.$element.css('width', maxWidth)
65		// this.options.size = maxWidth
66	}
67	if( this.options.mode == 'vertical_up' ||   this.options.mode == 'vertical_down' ){
68		this.options.msize = _e.offsetHeight	
69	} else {
70		this.options.msize = _e.offsetWidth	
71	}
72	// define list buttons drivent.
73	this.buttons = {previous: [], next: [], play: [], playback: [], stop: []}
74	this.options.autoRun = true
75	// _options.buttons ={ next:} 
76	if(_o.buttons ){
77		for( var action in _o.buttons ) {
78			this.bindingButtonsEvent( action, typeOf(_o.buttons[action])=='array' ? _o.buttons[action] : [_o.buttons[action]] )	
79		}
80	}	
81	// if auto run
82	if( this.options.autoRun ) {
83		this.play( this.options.interval,'next',true )	
84	}
85	// process when mouse over and mouse out.
86	
87	this.$element.bind("mouseenter", function(){
88		self.stop()									 
89	})
90	this.$element.bind("mouseleave", function(){										 	
91		self.play(self.options.interval,'next',true)							 
92	})
93  }
94
95Nooticker.prototype = {
96	previous: function(manual) {
97		this.options.currentIndex += this.options.currentIndex > 0 ? -1 : this.options.items.length-1
98		this.running( null, manual, 'previous' )	
99	},
100	next:function(manual){ 	
101		this.options.currentIndex += (this.options.currentIndex < this.options.items.length-1) ? 1 : (1 - this.options.items.length)
102		this.running( null, manual, 'next' )
103	},
104	play: function( delay, direction, wait ){
105		this.stop() 
106		if(!wait){
107			this[direction](false)
108		}
109		this.options.autoRun = this[direction].periodical(delay,this,false)
110	},
111	stop:function(){
112		clearTimeout(this.options.autoRun)	
113	},
114	running: function( item, manual, runningMode ){ 	
115		this.options.previousIndex = this.options.currentIndex + (this.options.currentIndex > 0 ? -1 : this.options.items.length-1)
116
117		this.options.nextIndex = this.options.currentIndex + (this.options.currentIndex < this.options.items.length-1 ? 1 : 1-this.options.items.length)
118		//
119		// if next item then hide previous element
120		//
121		
122		if( this.options.mode != 'opacity' ) {
123			var size1
124			var size2
125			var m1 = {}
126			var m2 = {}
127			var c = this.options.modes[this.options.mode];
128			if( this.options.mode == 'horizontal_right' || this.options.mode == 'vertical_up' ){
129				size1 =  -(this.options.msize)
130				size2 = this.options.msize
131			} else {
132				size1 = (this.options.msize)
133				size2 =  -(this.options.msize)	
134			}
135			
136			
137			
138			//window.console.log(m)
139			if( runningMode == 'next' ) {
140				switch ( this.options.mode) {
141					case 'horizontal_left':
142					case 'horizontal_right':
143						m1 = {left:size1}
144						m2 = {left:0}
145						break
146					case 'vertical_up':
147					case 'vertical_down':
148						m1 = {top:size1}
149						m2 = {top:0}
150						break
151				}
152				this.am2[this.options.previousIndex].css('opacity',1).animate({opacity:0},this.options.anOptions)
153				this.am[this.options.previousIndex].css(c , 0).animate(m1,this.options.anOptions)
154				this.am2[this.options.currentIndex].css('opacity',0).animate({opacity:1},this.options.anOptions)
155				this.am[this.options.currentIndex].css(c ,+size2).animate(m2,this.options.anOptions)
156				
157			} else if( runningMode == 'previous') {
158				switch ( this.options.mode) {
159					case 'horizontal_left':
160					case 'horizontal_right':
161						m1 = {left:-(this.options.msize)}
162						m2 = {left:0}
163						break
164					case 'vertical_up':
165					case 'vertical_down':
166						m1 = {top:-(this.options.msize)}
167						m2 = {top:0}
168						break
169				}
170				this.am2[this.options.nextIndex].css('opacity',1).animate({opacity:0},this.options.anOptions)
171				this.am[this.options.nextIndex].css(c , 0 ).animate(m1,this.options.anOptions)
172				
173				this.am2[this.options.currentIndex].css('opacity',0).animate({opacity:1},this.options.anOptions)
174				this.am[this.options.currentIndex].css( c , +(this.options.msize)).animate(m2,this.options.anOptions)
175				
176
177			}  
178		} else {
179			if( runningMode == 'next' ) {
180				this.am2[this.options.previousIndex].css('opacity',1).animate({opacity:0}
180,this.options.anOptions)
181				this.am2[this.options.currentIndex].css('opacity',0).animate({opacity:1},this.options.anOptions)
182				this.am2[this.options.previousIndex].css('z-index', 1)
183				this.am2[this.options.currentIndex].css('z-index', this.options.items.length + 10)
184			} else {
185				this.am2[this.options.nextIndex].css('opacity',1).animate({opacity:0},this.options.anOptions)
186				this.am2[this.options.currentIndex].css('opacity',0).animate({opacity:1},this.options.anOptions)
187				this.am2[this.options.nextIndex].css('z-index', 1)
188				this.am2[this.options.currentIndex].css('z-index', this.options.items.length + 10)
189			}
190		}
191
192		if( manual ){ this.stop() }
193		// if using callback method.
194		if(this.onRunning){ 
195			this.onRunning( this.options.items[this.options.currentIndex],(this.buttons ? this.buttons[this.options.currentIndex]:null) ) 
196		}
197		
198		if( manual && this.options.autoRun ){ 
199			this.play( this.options.interval,'next', true )
200		}
201	},
202	bindingButtonsEvent:function( action, buttons ){ 
203		for(var i=0; i<buttons.length; i++){
204			switch(action){
205				case 'next': 
206					$(buttons[i]).bind(this.options.buttonEvent,this.previous.bind(this,true)); 
207				break;
208				case 'previous': 	
209					$(buttons[i]).bind(this.options.buttonEvent,this.next.bind(this,true));
210					break;
211				case 'play':
212					$(buttons[i]).bind(this.options.buttonEvent, this.play.bind( this,[this.options.interval,'next',false]) ); 
213					break;
214				case 'playback': 
215					$(buttons[i]).bind( this.options.buttonEvent, 
216					this.play.bind(this,[this.options.interval,'previous',false]));
217						break;
218				case 'stop':
219					$(buttons[i]).bind(this.options.buttonEvent, this.stop.bind(this) ); break;
220			}
221			this.buttons[action].push(buttons[i]);
222		}
223	}
224	
225}
226
227
228  $.fn.nooticker = function (option) {
229    return this.each(function () {
230      var $this = $(this)
231        , data = $this.data('nooticker')
232        , options = $.extend({}, $.fn.nooticker.defaults, typeof option == 'object' && option)
233      if (!data) 
234    	  $this.data('nooticker', (data = new Nooticker(this, options)))
235    })
236  }
237
238$.fn.nooticker.defaults = {
239    modes: {horizontal_left:'left',horizontal_right:'left', vertical_up:'top', vertical_down:'top'},
240	msize:250,
241	mode: 'horizontal_left',
242	buttonEvent:'click',
243	handlerEvent:'click',
244	interval: 5000,
245	autoRun:true,
246	previousIndex:null,
247	nextIndex: null,
248	currentIndex:0,
249	startItem: 0,
250	onRunning:null
251}
252  $.fn.nooticker.Constructor = Nooticker
253}(window.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.