PageSourceSearch

https://www.allpics4u.com/www/wp-content/themes/AllPics4U/js/jquery.scrollable.js

js allpics4u.com collected 2026-10-02 10:45:31 UTC 7,537 bytes, 305 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10
11/**
12 * jquery.scrollable 0.11. Making HTML elements scroll.
13 * 
14 * http://flowplayer.org/tools/scrollable.html
15 *
16 * Copyright (c) 2008 Tero Piirainen ([email protected])
17 *
18 * Released under the MIT License:
19 * http://www.opensource.org/licenses/mit-license.php
20 * 
21 * >> Basically you can do anything you want but leave this header as is <<
22 *
23 * Since  : 0.01 - 03/01/2008
24 * Version: 0.11 - 05/29/2008
25 */
26(function($) {
27		
28	// plugin initialization
29	$.fn.extend({
30		scrollable: function(arg1, arg2, arg3) { 
31			
32			return this.each(function() {
33				if (typeof arg1 == "string") {
34					var el = $.data(this, "scrollable");
35					el[arg1].apply(el, [arg2, arg3]);
36					
37				} else { 
38					new $.scrollable(this, arg1, arg2);
39				}
40			});
41		}		
42	});
43		
44	// constructor
45	$.scrollable = function(el, opts) {   
46			
47		// store this instance
48		$.data(el, "scrollable", this);
49		
50		this.init(el, opts); 
51	};
52	
53	
54	// methods
55	$.extend($.scrollable.prototype, { 
56			
57		init: function(el, config)  {
58			 
59			// current instance
60			var self = this;  
61			
62			var opts = {								
63				size: 5,
64				horizontal:false,				
65				activeClass:'active',
66				speed: 300,
67				onSeek: null,
68				
69				// jquery selectors
70				items: '.items',
71				prev:'.prev',
72				next:'.next',
73				navi:'.navi',
74				naviItem:'span'
75			}; 
76	
77			this.opts = $.extend(opts, config); 			
78	
79			// root / itemRoot
80			var root = this.root = $(el);			
81			var itemRoot = $(opts.items, root);			
82			if (!itemRoot.length) itemRoot = root;			
83				
84			// wrap itemRoot.children() inside container
85			itemRoot.css({position:'relative', overflow:'hidden', visibility:'visible'});
86			itemRoot.children().wrapAll('<div class="__scrollable" style="position:absolute"/>');
87			
88			this.wrap = itemRoot.children(":first");
89			this.wrap.css(opts.horizontal ? "width" : "height", "200000em").after('<br clear="all"/>');			
90			this.items = this.wrap.children();
91			this.index = 0;
92
93			
94			// set height based on size
95			if (opts.horizontal) {
96				itemRoot.width(opts.size * (this.items.eq(1).offset().left - this.items.eq(0).offset().left) -2);	
97			} else {
98				itemRoot.height(opts.size * (this.items.eq(1).offset().top - this.items.eq(0).offset().top) -2);	
99			} 
100	
101			// mousewheel
102			if ($.isFunction($.fn.mousewheel)) { 
103				root.bind("mousewheel.scrollable", function(event, delta)  { 
104					self.move(-delta, 50);		
105					return false;
106				});
107			} 
108	
109			// keyboard
110			$(window).bind("keypress.scrollable", function(evt) {
111
112				if ($(evt.target).parents(".__scrollable").length) {
113					
114					if (opts.horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) {
115						self.move(evt.keyCode == 37 ? -1 : 1);
116						return false;
117					}	
118					
119					if (!opts.horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) {
120						self.move(evt.keyCode == 38 ? -1 : 1);
121						return false;
122					}
123				}
124				
125				return true;
126				
127			});	
128			
129			
130			// item.click()
131			this.items.each(function(index, arg) {
132				$(this).bind("click.scrollable", function() {
133					self.click(index);		
134				});
135			});
136
137			this.activeIndex = 0;
138			
139			// prev
140			$(opts.prev, root).click(function() { self.prev() });
141			
142
143			// next
144			$(opts.next, root).click(function() { self.next() });
145			
146
147			// navi 			
148			$(opts.navi, root).each(function() { 				
149				var navi = $(this);
150				
151				var status = self.getStatus();
152				
153				// generate new entries
154				if (navi.is(":empty")) {
155					for (var i = 0; i < status.pages; i++) {		
156						
157						var item = $("<" + opts.naviItem + "/>").attr("page", i).click(function() {							
158							var el = $(this);
159							el.parent().children().removeClass(opts.activeClass);
160							el.addClass(opts.activeClass);
161							self.setPage(el.attr("page"));
162							
163						});
164						
165						if (i == 0) item.addClass(opts.activeClass);
166						navi.append(item);					
167					}
168					
169				// assign onClick events to existing entries
170				} else {
171					
172					navi.children().each(function(i)  {
173						var item = $(this);
174						item.attr("page", i);
175						if (i == 0) item.addClass(opts.activeClass);
176						
177						item.click(function() {
178							item.parent().children().removeClass(opts.activeClass);
179							item.addClass(opts.activeClass);
180							self.setPage(item.attr("page"));
181						});
182						
183					});
184				}
185				
186			});			
187			
188		},
189		
190
191		click: function(index) {
192
193			var item = this.items.eq(index);
194			var klass = this.opts.activeClass;
195			
196			if (!item.hasClass(klass) && (index >= 0 || index < this.items.size())) { 
197				
198				var prev = this.items.eq(this.activeIndex).removeClass(klass);
199				item.addClass(klass);   
200				
201				this.seekTo(index - Math.floor(this.opts.size / 2));
202				this.activeIndex = index;
203			}  
204		},
205		
206		getStatus: function() {
207			var len =  this.items.size();
208			var s = {
209				length: len, 
210				index: this.index, 
211				size: this.opts.size,
212				pages: Math.floor(len / this.opts.size),
213				page: Math.floor(this.index / this.opts.size)
214			};
215
216			return s;
217		}, 
218
219		
220		// all other seeking functions depend on this generic seeking function		
221		seekTo: function(index, time) {
222			
223			if (index < 0) index = 0;			
224			index = Math.min(index, this.items.length - this.opts.size);			
225			
226			var item = this.items.eq(index);			
227			if (item.size() == 0) return false; 			
228			this.index = index;
229
230			
231			if (this.opts.horizontal) {
232				var left = this.wrap.offset().left - item.offset().left;				
233				this.wrap.animate({left: left}, time || this.opts.speed);
234				
235			} else {
236				var top = this.wrap.offset().top - item.offset().top;
237				this.wrap.animate({top: top}, time || this.opts.speed);							
238			}
239
240			// custom onSeek callback
241			if ($.isFunction(this.opts.onSeek)) {
242				this.opts.onSeek.call(this.getStatus());
243			}
244			
245			// navi status update
246			var navi = $(this.opts.navi, this.root);
247			
248			if (navi.length) {
249				var klass = this.opts.activeClass;
250				var page = Math.round(index / this.opts.size);
251				navi.children().removeClass(klass).eq(page).addClass(klass);
252			}
253			
254			
255			return true; 
256		},
257		
258			
259		move: function(offset, time) {
260			this.seekTo(this.index + offset, time);
261		},
262		
263		next: function(time) {
264			this.move(1, time);	
265		},
266		
267		prev: function(time) {
268			this.move(-1, time);	
269		},
270		
271		movePage: function(offset, time) {
272			this.move(this.opts.size * offset, time);		
273		},
274		
275		setPage: function(index, time) {
276			this.seekTo(this.opts.size * index, time);
277		},
278		
279		prevPage: function(time) {
280			var page = Math.floor(this.index / this.opts.size);
281			this.seekTo(this.opts.size * (page-1), time);
282		},  
283
284		nextPage: function(time) {
285			var page = Math.floor(this.index / this.opts.size);
286			this.seekTo(this.opts.size * (page+1), time);
287		}, 
288		
289		begin: function(time) {
290			this.seekTo(0, time);	
291		},
292		
293		end: function(time) {
294			this.seekTo(this.items.size() - this.opts.size, time);	
295		}
296
297		
298	});  
299	
300})(jQuery);
301
302
303
304
305}

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.