PageSourceSearch

https://megane-club.ru/mkportal/templates/Forum/mkp.ext.ajax.js

js megane-club.ru collected 2026-09-26 09:39:37 UTC 12,269 bytes, 369 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]; };
2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
3{
4  let window = _____WB$wombat$assign$function_____("window");
5  let self = _____WB$wombat$assign$function_____("self");
6  let document = _____WB$wombat$assign$function_____("document");
7  let location = _____WB$wombat$assign$function_____("location");
8  let top = _____WB$wombat$assign$function_____("top");
9  let parent = _____WB$wombat$assign$function_____("parent");
10  let frames = _____WB$wombat$assign$function_____("frames");
11  let opener = _____WB$wombat$assign$function_____("opener");
12
13/**********************************************************************************************
14| Mkportal Ajax Boxes & Tips
15| by Luponero aka Meo oct 2007
16|
17|----------------------------
18| Based on Original Ideas:
19| by DTHMLGoodies.com, Alf Magne Kalleland
20| by Lokesh Dhakar - http://www.huddletogether.com
21*************************************************************************************************/	
22
23
24//Meo: Mkportal settings ----------------------------
25var BalloonImg = MKAJAX_IMAGES_PATH + "freccia.gif";
26var BalloonImg2 = MKAJAX_IMAGES_PATH + "frecciad.gif";
27var LoadingImg = MKAJAX_IMAGES_PATH + "loadspin.gif";
28var OverlayImg = MKAJAX_IMAGES_PATH + "overlay.png";
29var CloseImg = MKAJAX_IMAGES_PATH + "closepl.gif";
30
31//Meo: General settings
32var popshowdelay = 800;
33var tipshowdelay = 400;
34
35// Meo: Inizialization
36var objOverlay = false;
37var objLightbox = false;
38var ajax_tooltipObj = false;
39var ajax_tooltipObj_iframe = false;
40var ajax_tooltip_MSIE = false;
41var ajax_tooltip_Myo = "";
42if(navigator.userAgent.indexOf('MSIE')>=0)ajax_tooltip_MSIE=true;
43
44
45/********************** Meo ShowPop ********************************/
46
47function ajax_showPop(externalFile, delayno)
48{
49// Meo: Clear all the external calling ant timeouts delay
50	ajaxPop_clear();
51
52	if(!objOverlay)
53	{
54		var objBody = document.getElementsByTagName("body").item(0);
55		objOverlay = document.createElement("div");
56		objOverlay.setAttribute('id','mkoverlay');
57		objOverlay.onclick = function () {ajax_hideLightbox(); return false;}
58		objOverlay.style.position = 'absolute';
59		objOverlay.style.display = 'none';
60		objOverlay.style.top = '0';
61		objOverlay.style.left = '0';
62		objOverlay.style.zIndex = '90';
63 		objOverlay.style.width = '100%';
64
65		//Meo: This method seems to be very much faster than using a png background
66		objOverlay.style.backgroundColor = '#111';
67		objOverlay.style.opacity = '.80';
68		objOverlay.style.filter = 'alpha(opacity=80)'; 
69		objOverlay.style.MozOpacity = '0.8';
70		objBody.insertBefore(objOverlay, objBody.firstChild);
71		
72		objLightbox = document.createElement("div");
73		objLightbox.setAttribute('id','mklightbox');
74		objLightbox.style.display = 'none';
75		objLightbox.style.position = 'absolute';
76		objLightbox.style.zIndex = '100';
77		
78		objLightbox.style.border = '1px solid #698490';
79		objLightbox.style.backgroundColor = '#f1f6fb';
80		objLightbox.style.padding = '4px';
81		objLightbox.style.fontSize = '0.8em';
82
83		objBody.insertBefore(objLightbox, objOverlay.nextSibling);
84
85		var objLink = document.createElement("a");
86		objLink.setAttribute('href','#');
87		objLink.setAttribute('title','Click to close');
88		objLink.onclick = function () {ajax_hideLightbox(); return false;}
89		objLink.style.textAlign = 'right';
90		objLightbox.appendChild(objLink);
91
92		var objCloseButton = document.createElement("img");
93		objCloseButton.src = CloseImg;
94		objCloseButton.setAttribute('id','mkcloseButton');
95		objCloseButton.style.position = 'absolute';
96		objCloseButton.style.zIndex = '200';
97		objLink.appendChild(objCloseButton);
98
99		var objContent = document.createElement("div");
100		objContent.setAttribute('id','mklightboxContent');
101		objContent.style.overflow = 'auto';
102		objLightbox.appendChild(objContent);
103
104
105	}
106		
107	var arrayPageSize = MkUtilsLib.getPageSize();
108	var arrayPageScroll = MkUtilsLib.getPageScroll();
109
110	objOverlay.style.width = (arrayPageSize[0] + 'px');
111	objOverlay.style.height = (arrayPageSize[1] + 'px');
112			
113//Meo: Reset runtime changed values
114	document.getElementById('mklightboxContent').style.height = "";
115	document.getElementById('mklightboxContent').style.width = "";
116	objLightbox.style.width =  "";
117	objLightbox.style.height = "";
118	
119// Meo: immediate or delay Calling?
120	if (delayno != null){
121		ajax_showPop2(externalFile);
122	} else {
123		delayshow=setTimeout("ajax_showPop2('" + externalFile + "')",popshowdelay);
124	}
125
126}
127
128function ajax_showPop2(externalFile)
129{
130	mkportal_Spinner_Show();
131	objOverlay.style.display = 'block';
132	objLightbox.style.display = 'none';
133	ajaxPopup_loadContent(externalFile);
134
135}
136
137function ajax_hideLightbox()
138{
139	document.getElementById('mkoverlay').style.display = 'none';
140	document.getElementById('mklightbox').style.display = 'none';
141	mkportal_Spinner_Hide();
142	if (typeof delayshow!="undefined")
143		clearTimeout(delayshow);
144}
145
146
147/********************** Meo ShowToolTip ********************************/
148function ajax_showTooltip(externalFile,inputObj,delayno)
149{
150	// Meo: Clear all the external calling ant timeouts delay
151	ajaxPop_clear();
152	 
153	if(!ajax_tooltipObj)
154	{
155		ajax_tooltipObj = document.createElement('DIV');
156		ajax_tooltipObj.style.position = 'absolute';
157		ajax_tooltipObj.style.zIndex = '1000000';
158		ajax_tooltipObj.style.textAlign = 'left';
159		ajax_tooltipObj.id = 'ajax_tooltipObj';			
160		document.body.appendChild(ajax_tooltipObj);
161
162		var leftDiv = document.createElement('DIV');
163		leftDiv.setAttribute('id','ajax_tooltip_arrow');
164		leftDiv.style.backgroundImage = "url('" + BalloonImg + "')";
165		leftDiv.style.width = '28px';
166		leftDiv.style.position = 'absolute';
167		leftDiv.style.left = '0px';
168		leftDiv.style.top = '20px';
169		leftDiv.style.zIndex = '1000005';
170		leftDiv.style.height = '26px';
171		leftDiv.style.backgroundRepeat = 'no-repeat';
172		leftDiv.style.backgroundPosition = 'center left';
173		ajax_tooltipObj.appendChild(leftDiv);
174		
175		
176		var contentDiv = document.createElement('DIV');
177		contentDiv.style.border = '1px solid #698490';
178		contentDiv.style.left = '-20px';
179		contentDiv.style.top = '45px';
180		contentDiv.style.position = 'absolute';
181		contentDiv.style.backgroundColor = '#f1f6fb';
182		contentDiv.style.padding = '5px';
183		contentDiv.style.fontSize = '0.8em';
184		contentDiv.style.zIndex = '1000001';
185
186		ajax_tooltipObj.appendChild(contentDiv);
187		contentDiv.id = 'ajax_tooltip_content';
188		
189		if(ajax_tooltip_MSIE){
190			ajax_tooltipObj_iframe = document.createElement('<IFRAME frameborder="0">');
191			ajax_tooltipObj_iframe.style.position = 'absolute';
192			ajax_tooltipObj_iframe.border='0';
193			ajax_tooltipObj_iframe.frameborder=0;
194			ajax_tooltipObj_iframe.style.backgroundColor='#FFF';
195			ajax_tooltipObj_iframe.src = 'about:blank';
196			contentDiv.appendChild(ajax_tooltipObj_iframe);
197			ajax_tooltipObj_iframe.style.left = '0px';
198			ajax_tooltipObj_iframe.style.top = '0px';
199		}	
200	}
201	
202	if(ajax_tooltip_MSIE){
203		ajax_tooltipObj_iframe.style.width = ajax_tooltipObj.clientWidth + 'px';
204		ajax_tooltipObj_iframe.style.height = ajax_tooltipObj.clientHeight + 'px';
205	}
206
207	ajax_tooltipObj.style.display='none';
208	
209	// Meo: delay function
210	ajax_tooltip_Myo = inputObj;
211
212	//Immediate or delay Calling?
213	delayno = (typeof delayno == 'undefined') ? 0 : delayno;	
214	if (delayno == 1) { //Help Popups
215		ajax_tooltipObj.style.visibility = 'hidden';
216		ajaxTooltip_loadContent(externalFile);
217
218	} else {
219		delayshow=setTimeout("ajaxTooltip_loadContent('" + externalFile + "')",tipshowdelay);
220	}
221
222}
223
224function ajax_hideTooltip()
225{
226	if(ajax_tooltipObj)
227	{	
228	ajax_tooltipObj.style.display='none';
229	if (typeof delayshow!="undefined")
230		clearTimeout(delayshow);
231	}
232}
233
234function ajax_positionTooltip(inputObj)
235{
236
237//Meo: Reset runtime changed values
238	ajax_tooltipObj.style.left = '';
239	ajax_tooltipObj.style.top = '';
240	document.getElementById('ajax_tooltip_arrow').style.backgroundImage = "url('" + BalloonImg + "')";
241	document.getElementById('ajax_tooltip_arrow').style.left = '0px';
242	document.getElementById('ajax_tooltip_arrow').style.top = '20px';
243	document.getElementById('ajax_tooltip_content').style.width = "";
244	ajax_tooltipObj.style.width = "";
245	ajax_tooltipObj.style.height = "";
246
247	var leftPos = (ajaxTooltip_getLeftPos(inputObj) + inputObj.offsetWidth);
248	var topPos = ajaxTooltip_getTopPos(inputObj);
249	var myw = document.getElementById('ajax_tooltip_content').offsetWidth;
250	if (myw < 1) myw = 150;
251	var myh = document.getElementById('ajax_tooltip_content').offsetHeight;
252	if (myh < 1) myh = 150;
253
254// Meo: outscreen correction x
255	var arrayPageSize = MkUtilsLib.getPageSize();
256	var arrayPageScroll = MkUtilsLib.getPageScroll();
257	var maxw = arrayPageSize[0];
258	if ((myw + leftPos) > maxw) {
259		var mydiff = (myw + leftPos) - maxw;
260		var arrowdiff = 10;
261		if (ajax_tooltip_MSIE == true) arrowdiff = 20;
262		leftPos = leftPos - (mydiff +5);
263		document.getElementById('ajax_tooltip_arrow').style.left = (mydiff - arrowdiff) +'px';
264	}
265// Meo: outscreen correction y
266	var maxy = ((arrayPageScroll[1] + arrayPageSize[3]) -5);
267	if ((topPos + myh + 45) > maxy) {
268		topPos = topPos - (myh +67);
269		document.getElementById('ajax_tooltip_arrow').style.backgroundImage = "url('" + BalloonImg2 + "')";
270		document.getElementById('ajax_tooltip_arrow').style.top = myh + 44 + "px";
271	}
272
273	ajax_tooltipObj.style.left = leftPos + 'px';
274	ajax_tooltipObj.style.top = topPos + 'px';
275
276}
277
278
279function ajaxTooltip_getTopPos(inputObj)
280{		
281  	var returnValue = inputObj.offsetTop;
282  	while((inputObj = inputObj.offsetParent) != null){
283  		if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
284  	}
285  	return returnValue;
286}
287
288function ajaxTooltip_getLeftPos(inputObj)
289{
290  	var returnValue = inputObj.offsetLeft;
291  	while((inputObj = inputObj.offsetParent) != null){
292  		if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
293  	}
294  	return returnValue;
295}
296
297// Meo: clear the timeouts
298function ajaxPop_clear(){
299
300	if (typeof delayshow!="undefined")
301		clearTimeout(delayshow);
302}
303
304
305/*
306**********************MEO AJAX INTEGRATION******************************
307*/
308
309//----------Meo: Popup Box -------------
310function ajaxPopup_loadContent(url)
311{
312	new MKP_ajax(url, {method: 'get',  onComplete: function(request) { ajaxPopup_showContent(request); }});	
313}
314
315function ajaxPopup_showContent(request)
316{
317	mkportal_Spinner_Hide();
318	objLightbox.style.display = 'block';
319	objLightbox.style.visibility='hidden';
320	
321	document.getElementById('mklightboxContent').innerHTML = request.responseText;
322	var arrayPageSize = MkUtilsLib.getPageSize();
323	var arrayPageScroll = MkUtilsLib.getPageScroll();
324	var myw = document.getElementById('mklightboxContent').offsetWidth;
325	var myh = document.getElementById('mklightboxContent').offsetHeight;
326
327
328	if (myh > arrayPageSize[3]) {
329		myh = myh -170;
330		document.getElementById('mklightboxContent').style.height = myh + "px";
331		objLightbox.style.height = myh + 'px';		
332	}
333
334	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 20 - myh) / 2);
335	var lightboxLeft = ((arrayPageSize[0] - 20 - myw) / 2);
336
337	objLightbox.style.width =  myw + 'px';
338	objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
339	objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
340
341	document.getElementById('mkcloseButton').style.top = "8px";	
342	document.getElementById('mkcloseButton').style.left = (myw -28) + "px";
343	objLightbox.style.visibility='visible';
344
345}
346
347//-------------Meo: ToolTip---------------
348function ajaxTooltip_loadContent(url)
349{
350	ajax_tooltipObj.style.display='block';
351	document.getElementById('ajax_tooltip_content').innerHTML = "<div style=\"text-align: center; border:1px solid #698490; padding: 6px; background: #FFF; color: #666;\"><br /><img src=\"" + LoadingImg + "\" border=\"\"><br /><br /><b>...Loading...</b><br /></div>";
352	ajax_positionTooltip(ajax_tooltip_Myo);
353	new MKP_ajax(url, {method: 'get',  onComplete: function(request) { ajaxTooltip_showContent(request); }});	
354	
355}
356
357function ajaxTooltip_showContent(request)
358{
359	document.getElementById('ajax_tooltip_content').innerHTML = request.responseText;
360	ajax_tooltipObj.style.visibility='hidden';
361	ajax_positionTooltip(ajax_tooltip_Myo);
362	ajax_tooltipObj.style.visibility='visible';
363}
364
365
366
367
368}
369

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.