PageSourceSearch

https://sitiosuy.com//modules/mod_image_slider/slide.js

js sitiosuy.com collected 2026-10-07 23:20:58 UTC 6,826 bytes, 218 lines download raw bytes

1var SimpleSlide = new Class({
2	initialize: function(container,options) {
3		this.container = container;
4		this.options = options;
5		var automated;
6        var direction;
7        var hideshow_flag;
8
9        this.hideshow_flag=true;
10
11		if(this.options) this.direction = this.options.direction;
12		else this.direction = "forward";
13
14		//	Is it on autorun or manual?
15		if (this.direction!="pause")
16		{
17		if(this.options.auto == "loop" || this.options.auto == "once") {
18
19	 	   this.automated = this.slider.periodical(this.options.time,this,$(this.container));
20		} else {
21			this.slider($(this.container))
22		}
23        }
24	},
25
26    next: function(type) {
27             if(this.options.auto == "loop" || this.options.auto == "once") {
28               this.pause();
29             };
30              this.options.type=type;
31              this.direction="forward";
32              this.slider($(this.container));
33    	},
34    prev: function(type) {
35               if(this.options.auto == "loop" || this.options.auto == "once") {
36               this.pause();
37             };
38              this.options.type=type;
39              this.direction="back";
40              this.slider($(this.container));
41    	},
42    pause: function() {
43              this.direction="pause";
44              this.slider($(this.container));
45    	},
46	run: function() {
47		   this.direction="forward";
48	 	   this.automated = this.slider.periodical(this.options.time,this,$(this.container));
49                             },
50	slider: function(container) {
51		if ((this.options.auto == "once" || this.options.auto == "loop") && this.direction == "pause")
52		{
53		   $clear(this.automated);
54		}else{
55		var child;
56		// Get all child nodes to scroll between.
57		var children = container.getChildren().getChildren()[0];
58		// Run through all child nodes to see if there is a tagged one.
59		children.each(function(e) {
60			// If there is, make it current child.
61			if(e.id == "currentChild") {
62				child = e;
63			}
64           // alert(e.id);
65		});
66		//alert(this.direction);
67
68		if(!child && (this.direction == "forward" || this.direction == "pause")) {
69			// If there isn't, make the first one current child.
70			child = children[0].getNext();
71			child.id = "currentChild";
72		} else {
73			// Are we going to the next or previous node?
74			if(this.direction == "forward") {
75				var lastElement = container.getChildren()[0].getLast();
76				// Stops the loop at the last element.
77				if(lastElement == child.getNext() && this.options.auto == "once") $clear(this.automated);
78				// Is the current child the last node? Then set the first node as child, otherwise set the next node as child.
79				if(lastElement == child) child = children[0];
80				else child = child.getNext();
81			}
82			else if(this.direction == "back") child = child.getPrevious();
83		}
84		// Is the child defined?
85		if(child && this.direction != "pause") {
86			// Which type of slider is defined?
87			if(this.options.type == "scroll") this.scroll(container,children,child);
88			else if(this.options.type == "fade") this.fade(container,children,child);
89			else if(this.options.type == "scrollfade") this.scrollfade(container,children,child);
90		}
91		}
92	},
93
94    init_vertical: function() {
95
96       $(this.container).setStyle('position','relative');
97       var children = $(this.container).getChildren().getChildren()[0];
98       var i;
99       var s_h;
100       var s_w;
101       var b_w;
102
103       b_w=$(this.container).getStyle('border-width').toInt();
104
105       s_h=$(this.container).getSize().size.y-2*b_w;
106       s_w=$(this.container).getSize().size.x-2*b_w;
107
108       //s_h=100;
109       //s_w=600;
110
111       i=0;
112       children.each(function(e) {
113          if (i!=0)
114          {
115            e.id = "currentChild";
116            $('currentChild').setStyle('position','relative');
117            $('currentChild').setStyle('left',0-s_w*i);
118            $('currentChild').setStyle('top',0+s_h*i);
119            e.id = "";
120          }
121		  i++;
122		});
123
124        children.each(function(e) {
125				e.id = "";
126			});
127    	},
128    init_horizontal: function() {
129 $(this.container).setStyle('position','relative');
130       var children = $(this.container).getChildren().getChildren()[0];
131       var i;
132       var s_h;
133       var s_w;
134       var b_w;
135
136       b_w=$(this.container).getStyle('border-width').toInt();
137
138       s_h=$(this.container).getSize().size.y-2*b_w;
139       s_w=$(this.container).getSize().size.x-2*b_w;
140
141       //s_h=100;
142       //s_w=600;
143
144       i=0;
145       children.each(function(e) {
146          if (i!=0)
147          {
148            e.id = "currentChild";
149            $('currentChild').setStyle('position','relative');
150            $('currentChild').setStyle('left',0);
151            $('currentChild').setStyle('top',0);
152            e.id = "";
153          }
154		  i++;
155		});
156    	},
157	scroll: function(container,children,child) {
158		// Make it a scroll slide.
159  	    var scroll = new Fx.Scroll(container,{duration: this.options.duration, onComplete: function() {
160			// Remove tags from all child nodes.
161			children.each(function(e) {
162				e.id = "";
163			});
164			// Tag this child as current
165			child.id = "currentChild";
166		}}).toElement(child);
167	},
168	fade: function(container,children,child) {
169		// Make it a fade slide
170		var fade = new Fx.Style(container,'opacity',{duration: this.options.duration, onComplete: function() {
171			new Fx.Scroll(container,{duration: 1,onComplete: function() {
172				// Remove tags from all child nodes.
173				children.each(function(e) {
174					e.id = "";
175				});
176				// Tag this child as current
177				child.id = "currentChild";
178				new Fx.Style(container,'opacity').start(0.01,1);
179			}}).toElement(child);
180		}})
181		fade.start(1,0.01);
182	},
183	scrollfade: function(container,children,child) {
184		// In case you input the miliseconds as a string instead of integer.
185		var durationInt = this.options.duration.toInt();
186		// Make it a scrollfade slide
187		var fade = new Fx.Style(container,'opacity',{duration: (durationInt/2)})
188		fade.start(1,0.01).chain(function() {
189			fade.start(0.01,1);
190		});
191		new Fx.Scroll(container,{duration: durationInt, onComplete: function() {
192			// Remove tags from all child nodes.
193			children.each(function(e) {
194				e.id = "";
195			});
196			// Tag this child as current
197			child.id = "currentChild";
198		}}).toElement(child);
199	},
200	hide_and_show_fade:function()
201	{
202	   var fade = new Fx.Style($(this.container),'opacity',{duration: this.options.duration});
203       if (this.hideshow_flag)
204       {
205         fade.start(1,0.01);
206       }else
207       {
208         fade.start(0.01,1);
209       }
210       this.hideshow_flag=!this.hideshow_flag;
211	}
212});
213window.addEvent('domready', function() {
214
215var Tips1 = new Tips($$('.youjoomla3'));
216
217
218});

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.