PageSourceSearch

https://www.strumski.com/js/java.js

js strumski.com collected 2026-09-24 21:50:24 UTC 1,941 bytes, 74 lines download raw bytes

1/*
2Yetii - Yet (E)Another Tab Interface Implementation
3http://www.kminek.pl/lab/yetii/
4Copyright (c) 2007 Grzegorz Wojcik
5Code licensed under the BSD License:
6http://www.kminek.pl/bsdlicense.txt
7*/
8
9function Yetii() {
10
11	this.defaults = {
12		
13		id: null,
14		active: 1,
15		timeout: null,
16		interval: null,
17		tabclass: 'tab',
18		activeclass: 'active'
19	
20	};
21	
22	for (var n in arguments[0]) { this.defaults[n]=arguments[0][n]; };	
23	
24	this.getTabs = function() {
25        
26		
27        var retnode = [];
28        var elem = document.getElementById(this.defaults.id).getElementsByTagName('*');
29		
30		var regexp = new RegExp("(^|\\s)" + this.defaults.tabclass.replace(/\-/g, "\\-") + "(\\s|$)");
31	
32        for (var i = 0; i < elem.length; i++) {
33        if (regexp.test(elem[i].className)) retnode.push(elem[i]);
34        }
35    
36        return retnode;
37    
38    };
39	
40	this.links = document.getElementById(this.defaults.id + '-nav').getElementsByTagName('a');
41	
42	this.show = function(number){
43        
44        for (var i = 0; i < this.tabs.length; i++) {
45        this.tabs[i].style.display = ((i+1)==number) ? 'block' : 'none';
46        this.links[i].className = ((i+1)==number) ? this.defaults.activeclass : '';
47        }
48    
49    };
50	
51	 this.rotate = function(interval){
52    
53        this.show(this.defaults.active);
54        this.defaults.active++;
55    
56        if(this.defaults.active > this.tabs.length) this.defaults.active = 1;
57    
58        var self = this;
59        this.defaults.timeout = setTimeout(function(){self.rotate(interval);}, interval*1000);
60    
61    };
62	
63	this.tabs = this.getTabs();
64	this.show(this.defaults.active);
65	
66	var self = this;
67	for (var i = 0; i < this.links.length; i++) {
68	this.links[i].customindex = i+1;
69	this.links[i].onclick = function(){ if (self.defaults.timeout) clearTimeout(self.defaults.timeout); self.show(this.customindex); return false; };
70    }
71	
72	if (this.defaults.interval) this.rotate(this.defaults.interval);
73	
74};

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.