PageSourceSearch

https://www.peorian.com/modules/mod_janews_featured/tmpl/default/script.js

js peorian.com collected 2026-10-02 11:22:21 UTC 7,898 bytes, 227 lines download raw bytes

1/**
2 * ------------------------------------------------------------------------
3 * JA News Featured Module for Joomla 2.5
4 * ------------------------------------------------------------------------
5 * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
6 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
7 * Author: J.O.O.M Solutions Co., Ltd
8 * Websites: http://www.joomlart.com - http://www.joomlancers.com
9 * ------------------------------------------------------------------------
10 */
11
12var requesting = false;
13
14var JANEWSFP_DEFAULT = new Class({
15	initialize: function(options) {
16		
17		this.options = $extend({
18			moduleid: 0,
19			duration: 400,
20			autoplay_duration:1000,
21			autoplay: 1,
22			animType: 'animNewsMoveHor',
23			changeTransition:	Fx.Transitions.Pow.easeIn
24		}, options || {});
25		
26		var moduleid = this.options.moduleid;
27		this.panelwrap = $('ja-zinfp-'+moduleid).getElement('div.ja-zinfp-featured');	
28		this.cur_activePanel = this.panelwrap.getElement('div.active');
29		var obwrap = $('ja-zinfp-'+moduleid).getElement('.ja-zinfp-featured-border');
30		this.panelwrap.setStyle('height', this.cur_activePanel.offsetHeight);
31		this.panelwrap.setStyle('width', this.panelwrap.getParent().getCoordinates().width-2);
32		//Set equal height
33		var HN = Math.max($('ja-zinfp-'+moduleid).getElement('.ja-zinfp-normal-wrap').offsetHeight+13,this.panelwrap.offsetHeight );
34			
35		this.panelwrap.getParent().setStyle('height', HN);
36		//this.jaTooltips = new Tips($('ja-zinfp-'+moduleid).getElements('.jahasTip'), { maxTitleChars: 50, fixed: false, className: 'tool-tip janews-tool'});
37		$$('.jahasTip').each(function(el) {
38			var title = el.get('title');
39			if (title) {
40				var parts = title.split('::', 2);
41				el.store('tip:title', parts[0]);
42				el.store('tip:text', parts[1]);
43			}
44		});
45		this.jaTooltips = new Tips($$('.jahasTip'), { maxTitleChars: 50, fixed: false});
46		
47		this.panels = this.panelwrap.getElements('.ja-zincontent-wrap');
48		if(this.panels.length<=1) return;
49		
50		this.panels.each(function(el){
51			el.setStyle('width', this.panelwrap.offsetWidth);
52		}.bind(this))
53		
54		this.next_bt = $('ja-zinfp-'+moduleid).getElement('.ja-zinfp-links-actions a.next');
55		this.prev_bt = $('ja-zinfp-'+moduleid).getElement('.ja-zinfp-links-actions a.prev');
56		this.next_img	= $('ja-zinfp-'+moduleid).getElement('.ja-zinfp-links-actions span.next');
57		this.counter = $('ja-zinfp-'+moduleid).getElement('.ja-zinfp-links-actions span.counter');
58					
59		if(this.next_bt!=null){
60			
61			this.anim = eval ('new '+this.options.animType + '(this)');
62			
63			this.time = $time();
64			if(this.options.autoplay==1){
65				this.timer = this.next.periodical(this.options.autoplay_duration, this);	
66			}
67			var H = Math.max($('ja-zinfp-'+moduleid).getElement('.ja-zinfp-normal-wrap').offsetHeight+13, (this.panelwrap.offsetHeight + $('ja-zinfp-'+moduleid).getElement('.ja-zinfp-links-actions').offsetHeight));
68			this.panelwrap.getParent().setStyle('height', H);
69			this.next_bt.addEvent('click', function () {
70				this.timer = $clear(this.timer);
71		    	this.next();
72				if(this.options.autoplay==1){
73				this.timer = this.next.periodical(this.options.autoplay_duration, this);	
74			    }
75		    }.bind(this));
76		    
77		    this.prev_bt.addEvent('click', function () {
78		    	this.timer = $clear(this.timer);
79		    	this.previous();
80				if(this.options.autoplay==1){
81				this.timer = this.next.periodical(this.options.autoplay_duration, this);	
82			    } 
83		    }.bind(this));		    
84		}
85	},
86	    
87    next: function(){  
88		if (!this.mainfx) this.mainfx = new Fx.Tween(this.panelwrap,{duration:this.options.duration});
89		
90		var moduleid = this.options.moduleid;
91		this.current_activePanel = this.panelwrap.getElement('div.active');
92		
93		if(this.current_activePanel.getNext()==null){
94			
95			this.activePanel = this.panelwrap.getFirst();
96			
97			this.counter.set('text', 1);
98		}
99		else{
100			this.activePanel = this.current_activePanel.getNext();
101			this.counter.set('text', this.counter.get('text').toInt()+1);
102		}
103		
104		this.current_activePanel.removeClass('active');		
105		this.activePanel.addClass('active');				
106    	this.anim.move (this.current_activePanel, this.activePanel, false);      	    			
107		this.mainfx.start('height', this.activePanel.offsetHeight);		
108    },
109    
110    previous: function(){
111    	this.current_activePanel = this.panelwrap.getElement('div.active');    	
112    	var activePanel = this.current_activePanel.getPrevious();
113
114    	if(activePanel!=null){
115    		
116    		if (!this.mainfx) this.mainfx = new Fx.Tween(this.panelwrap,{duration:this.options.duration});
117    		//this.mainfx.stop();
118    		
119    		this.activePanel = activePanel;
120    		this.current_activePanel.removeClass('active');
121    		this.activePanel.addClass('active');
122    		this.anim.move (this.current_activePanel, this.activePanel, false);
123    		
124    		this.counter.set('text', this.counter.get('text').toInt()-1);    		    		
125    		this.mainfx.start('height', this.activePanel.offsetHeight);
126    	}    	
127    }
128	
129});
130
131var animNewsMoveHor = new Class ({
132	initialize: function(tabwrap) {
133		this.options = tabwrap.options || {};
134		this.tabwrap = tabwrap;
135		this.changeEffect = new Fx.Elements(this.tabwrap.panels, {duration: this.options.duration});
136		var left = 0;
137	    this.tabwrap.panels.each (function (panel) {
138	      panel.setStyle('left', left);
139	      left += panel.offsetWidth;
140	    });
141	    this.tabwrap.panels.setStyle('top', 0);
142	},
143
144	move: function (curTab, newTab, skipAnim) {
145		if(this.options.changeTransition != 'none' && !skipAnim)
146		{
147			//this.changeEffect.stop();
148			var obj = {};
149			var offset = newTab.offsetLeft.toInt();
150			i=0;			
151			
152			this.tabwrap.panels.each(function(panel) {
153				obj[i++] = {'left':[panel.offsetLeft.toInt(), panel.offsetLeft.toInt() - offset] };			
154			});
155			this.changeEffect.start(obj);
156		}
157	}
158});
159
160
161var animNewsMoveVir = new Class ({
162	initialize: function(tabwrap) {
163		this.options = tabwrap.options || {};
164		this.tabwrap = tabwrap;
165		this.changeEffect = new Fx.Elements(this.tabwrap.panels, {duration: this.options.duration});
166	
167	    var top = 0;
168	    this.tabwrap.panels.each (function (panel) {
169	      panel.setStyle('top', top);     
170	      top += Math.max(panel.offsetHeight,  panel.getParent().offsetHeight);
171	    });
172	    this.tabwrap.panels.setStyle('left', 0);
173	},
174	move: function (curTab, newTab, skipAnim) {
175		if(skipAnim==false)
176		{
177      //reposition newTab
178      
179			//this.changeEffect.stop();
180			var obj = {}; 
181			var offset = newTab.offsetTop.toInt();
182			i=0;
183			this.tabwrap.panels.each(function(panel) {
184				obj[i++] = {'top':[panel.offsetTop.toInt(), panel.offsetTop.toInt() - offset]};			
185			});
186			this.changeEffect.start(obj);
187		}
188	}
189});
190
191
192var animNewsFade = new Class ({
193	initialize: function(tabwrap) {
194		
195		this.options = tabwrap.options || {};
196		this.tabwrap = tabwrap;
197		this.changeEffect = new Fx.Elements(this.tabwrap.panels, {duration: this.options.duration});
198		
199		this.tabwrap.panels.setStyles({'opacity':0,'width':'100%','display':'none'});		
200		this.tabwrap.panels[0].setStyles({'opacity':1,'display':'block'});
201	},
202
203	move: function (curTab, newTab, skipAnim) {
204		
205		if(this.options.changeTransition != 'none' && !skipAnim)
206		{
207			if (curTab)
208			{
209				curOpac = curTab.getStyle('opacity');
210				var changeEffect1 = new Fx.Tween(curTab, {duration: this.options.duration, transition: this.options.changeTransition});
211				changeEffect1.start('opacity',curOpac,0).chain(function(){
212				    curTab.setStyle("display",'none');
213				});
214				
215			}
216			curOpac = newTab.getStyle('opacity');
217			var changeEffect = new Fx.Tween(newTab, {duration: this.options.duration, transition: this.options.changeTransition});
218			changeEffect.start('opacity', curOpac,1).chain(function(){
219				 newTab.setStyle('display','block');													
220			});
221			
222		} else {
223			if (curTab) curTab.setStyle('opacity', 0);
224			newTab.setStyle('opacity', 1);
225		}
226	}
227});

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.