PageSourceSearch

https://zajedno-do-zdravlja.hr/script/sweetTitles.js

js zajedno-do-zdravlja.hr collected 2026-10-08 05:47:00 UTC 5,375 bytes, 162 lines download raw bytes

1/*
2Sweet Titles (c) Creative Commons 2005
3http://creativecommons.org/licenses/by-sa/2.5/
4Author: Dustin Diaz | http://www.dustindiaz.com
5*/
6var sweetTitles = { 
7	xCord : 0,								// @Number: x pixel value of current cursor position
8	yCord : 0,								// @Number: y pixel value of current cursor position
9	tipElements : ['a','abbr','acronym'],	// @Array: Allowable elements that can have the toolTip
10	obj : Object,							// @Element: That of which you're hovering over
11	tip : Object,							// @Element: The actual toolTip itself
12	active : 0,								// @Number: 0: Not Active || 1: Active
13	init : function() {
14		if ( !document.getElementById ||
15			!document.createElement ||
16			!document.getElementsByTagName ) {
17			return;
18		}
19		var i,j;
20		this.tip = document.createElement('div');
21		this.tip.id = 'toolTip';
22		document.getElementsByTagName('body')[0].appendChild(this.tip);
23		this.tip.style.top = '0';
24		this.tip.style.visibility = 'hidden';
25		var tipLen = this.tipElements.length;
26		for ( i=0; i<tipLen; i++ ) {
27			var current = document.getElementsByTagName(this.tipElements[i]);
28			var curLen = current.length;
29			for ( j=0; j<curLen; j++ ) {
30				if (current[j].getAttribute('id') == 'hideTT'){
31				addEvent(current[j],this.tipOut);
32			} 
33			else if (current[j].getAttribute('id') =='hidelink'){
34				addEvent(current[j],'mouseover',this.tipOnlink);
35				addEvent(current[j],'mouseout',this.tipOut);
36				current[j].setAttribute('tip',current[j].title);
37				current[j].removeAttribute('title');
38			}
39			else {					
40				addEvent(current[j],'mouseover',this.tipOver);
41				addEvent(current[j],'mouseout',this.tipOut);
42				current[j].setAttribute('tip',current[j].title);
43				current[j].removeAttribute('title');
44			}
45		}
46	}
47},
48	updateXY : function(e) {
49		if ( document.captureEvents ) {
50			sweetTitles.xCord = e.pageX;
51			sweetTitles.yCord = e.pageY;
52		} else if ( window.event.clientX ) {
53			sweetTitles.xCord = window.event.clientX+document.documentElement.scrollLeft;
54			sweetTitles.yCord = window.event.clientY+document.documentElement.scrollTop;
55		}
56	},
57	tipOut: function() {
58		if ( window.tID ) {
59			clearTimeout(tID);
60		}
61		if ( window.opacityID ) {
62			clearTimeout(opacityID);
63		}
64		sweetTitles.tip.style.visibility = 'hidden';
65	},
66	checkNode : function() {
67		var trueObj = this.obj;
68		if ( this.tipElements.inArray(trueObj.nodeName.toLowerCase()) ) {
69			return trueObj;
70		} else {
71			return trueObj.parentNode;
72		}
73	},
74	tipOver : function(e) {
75		sweetTitles.obj = this;
76		tID = window.setTimeout("sweetTitles.tipShow()",100);
77		sweetTitles.updateXY(e);
78	},
79	
80	tipOnlink : function(e) {
81		sweetTitles.obj = this;
82		tID = window.setTimeout("sweetTitles.tipNolink()",100);
83		sweetTitles.updateXY(e);
84	},
85	tipNolink : function() {		
86		var scrX = Number(this.xCord);
87		var scrY = Number(this.yCord);
88		var tp = parseInt(scrY+15);
89		var lt = parseInt(scrX+10);
90		var anch = this.checkNode();
91		var addy = '';
92		var access = '';
93		
94		if ( anch.nodeName.toLowerCase() == 'a' ) {
95			addy = addy = anch.firstChild.nodeValue;
96		}
97		
98		this.tip.innerHTML = "<p>"+anch.getAttribute('tip')+"<em>"+access+addy+"</em></p>";
99		if ( parseInt(document.documentElement.clientWidth+document.documentElement.scrollLeft) < parseInt(this.tip.offsetWidth+lt) ) {
100			this.tip.style.left = parseInt(lt-(this.tip.offsetWidth+10))+'px';
101		} else {
102			this.tip.style.left = lt+'px';
103		}
104		if ( parseInt(document.documentElement.clientHeight+document.documentElement.scrollTop) < parseInt(this.tip.offsetHeight+tp) ) {
105			this.tip.style.top = parseInt(tp-(this.tip.offsetHeight+10))+'px';
106		} else {
107			this.tip.style.top = tp+'px';
108		}
109		this.tip.style.visibility = 'visible';
110		this.tip.style.opacity = '.1';
111		this.tipFade(10);
112	},
113	tipShow : function() {		
114		var scrX = Number(this.xCord);
115		var scrY = Number(this.yCord);
116		var tp = parseInt(scrY+15);
117		var lt = parseInt(scrX+10);
118		var anch = this.checkNode();
119		var addy = '';
120		var access = '';
121		
122		if ( anch.nodeName.toLowerCase() == 'a' ) {
123			addy = (anch.href.length > 25 ? anch.href.toString().substring(0,25)+"..." : anch.href);
124			var access = ( anch.accessKey ? ' <span>['+anch.accessKey+']</span> ' : '' );
125		} 
126		else {
127			addy = anch.firstChild.nodeValue;
128		}
129		
130		this.tip.innerHTML = "<p>"+anch.getAttribute('tip')+"<em>"+access+addy+"</em></p>";
131		if ( parseInt(document.documentElement.clientWidth+document.documentElement.scrollLeft) < parseInt(this.tip.offsetWidth+lt) ) {
132			this.tip.style.left = parseInt(lt-(this.tip.offsetWidth+10))+'px';
133		} else {
134			this.tip.style.left = lt+'px';
135		}
136		if ( parseInt(document.documentElement.clientHeight+document.documentElement.scrollTop) < parseInt(this.tip.offsetHeight+tp) ) {
137			this.tip.style.top = parseInt(tp-(this.tip.offsetHeight+10))+'px';
138		} else {
139			this.tip.style.top = tp+'px';
140		}
141		this.tip.style.visibility = 'visible';
142		this.tip.style.opacity = '.1';
143		this.tipFade(10);
144	},
145	tipFade: function(opac) {
146		var passed = parseInt(opac);
147		var newOpac = parseInt(passed+10);
148		if ( newOpac < 80 ) {
149			this.tip.style.opacity = '.'+newOpac;
150			this.tip.style.filter = "alpha(opacity:"+newOpac+")";
151			opacityID = window.setTimeout("sweetTitles.tipFade('"+newOpac+"')",20);
152		}
153		else { 
154			this.tip.style.opacity = '.100';
155			this.tip.style.filter = "alpha(opacity:100)";
156		}
157	}
158};
159function pageLoader() {
160	sweetTitles.init();
161}
162addEvent(window,'load',pageLoader);

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.