PageSourceSearch

https://www.bratkovice.cz/js/dom.js?v=v6.5.0d

js bratkovice.cz collected 2026-10-03 00:59:14 UTC 3,269 bytes, 138 lines download raw bytes

1/*
2find actual version of this library at:
3http://www.fczbkk.com/js/dom/
4*/
5
6// library for cross-browser event management
7evt = {
8
9	// attach event
10	add : function(obj, evType, fn, useCapture) {
11		// Opera hack
12		if (window.opera && (obj == window) && parseFloat(navigator.appVersion)<9.8) {
13			obj = document;
14		}
15		
16		if (obj.addEventListener){
17			obj.addEventListener(evType, fn, useCapture);
18			return true;
19		} else if (obj.attachEvent){
20			var r = obj.attachEvent("on"+evType, fn);
21			return r;
22		} else {
23			return false;
24		}
25	},
26	
27	// remove event
28	remove : function(obj, evType, fn, useCapture) {
29		// Opera hack
30		if (window.opera && (obj == window)) {
31			obj = document;
32		}
33		
34		if (obj.removeEventListener) {
35			obj.removeEventListener(evType, fn, useCapture);
36			return true;
37		} else if (obj.detachEvent) {
38			var r = obj.detachEvent("on"+evType, fn);
39			return r;
40		} else {
41			return false;
42		}
43	},
44	
45	// fix for IE event model
46	fix : function(e) {
47		if (typeof e == 'undefined') e = window.event;
48		if (typeof e.target == 'undefined') e.target = e.srcElement;
49		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
50		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
51		if ((typeof e.which == 'undefined') && e.keyCode) e.which = e.keyCode;
52
53		// thanx to KKL2401 for preventDefault hack
54		if (!e.preventDefault) e.preventDefault = function() {
55			e.returnValue = false;
56		}
57
58		return e;
59	}
60
61}
62
63// library for working with multiple classes
64var cls = {
65	
66	// vrati pole obsahujuce vsetky triedy daneho elementu
67	get : function (elm) {
68		if (elm && elm.tagName) {
69			var classes = [];
70			if (elm.className) {	// na zaklade Centiho upozornenia o divnej interpretacii v Opere
71				var cl = elm.className.replace(/\s+/g, " ");
72				classes = cl.split(" ");
73			}
74			return classes;
75		}
76		return false;
77	},
78	
79	// vrati true, ak element obsahuje triedu
80	has : function (elm, cl) {
81		if ((actCl = cls.get(elm)) && (typeof(cl) == "string")) {
82			for (var i = 0; i < actCl.length; i++) {
83				if (actCl[i] == cl) {
84					return true;
85				}
86			}
87		}
88		return false;
89	},
90	
91	// prida triedu elementu
92	add : function (elm, cl) {
93		if ((actCl = cls.get(elm)) && (typeof(cl) == "string")) {
94			if (!cls.has(elm, cl)) {
95				elm.className += (actCl.length > 0) ? " " + cl : cl;
96			}
97			return true;
98		}
99		return false;
100	},
101	
102	// odstrani triedu z elementu
103	remove : function (elm, cl) {
104		if ((actCl = cls.get(elm)) && (typeof(cl) == "string")) {
105			var tempCl = "";
106			for (var i = 0; i < actCl.length; i++) {
107				if (actCl[i] != cl) {
108					if (tempCl != "") {tempCl += " ";}
109					tempCl += actCl[i];
110				}
111				elm.className = tempCl;
112			}
113			return true;
114		}
115		return false;
116	},
117	
118	// nahradi staru triedu elementu novou, ak stara neexistuje, prida novu
119	replace : function (elm, oldCl, newCl) {
120		if ((actCl = cls.get(elm)) && (typeof(oldCl) == "string") && (typeof(newCl) == "string")) {
121			tempCl = "";
122			if (cls.has(elm, newCl)) {
123				cls.remove(elm, oldCl);
124			} else if (cls.has(elm, oldCl)) {
125				for (var i = 0; i < actCl.length; i++) {
126					if (tempCl != "") {tempCl += " ";}
127					tempCl += (actCl[i] == oldCl) ? newCl : actCl[i];
128				}
129				elm.className = tempCl;
130			} else {
131				cls.add(elm, newCl);
132			}
133			return true;
134		}
135		return false;
136	}
137
138}

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.