PageSourceSearch

https://www.wmxe.net/javascript/article_toolbar_functions.js

js wmxe.net collected 2026-10-02 22:21:44 UTC 17,069 bytes, 487 lines download raw bytes

1var isMozilla;
2var objDiv = null;
3var originalDivHTML = "";
4var DivID = "";
5var over = false;
6// dinamically add a div to
7// dim all the page
8function buildDimmerDiv(){
9    document.write('<div id="dimmer" class="dimmer" style="width:10px; height:10px"></div>');
10}//End of function buildDimmerDiv
11
12function displayFloatingDiv(divId, title, width, height, left, top) {
13	DivID = divId;
14	document.getElementById('dimmer').style.visibility = "visible";
15	document.getElementById(divId).style.display = "block";
16    document.getElementById(divId).style.width = width + 'px';
17    document.getElementById(divId).style.height = height + 'px';
18    $(document.getElementById(divId)).find('iframe').show();
19    document.getElementById(divId).style.left = left + 'px';
20    document.getElementById(divId).style.top = top + 'px';
21	var addHeader;
22	if (originalDivHTML == "")
23	    originalDivHTML = document.getElementById(divId).innerHTML;
24	addHeader = '<table style="width:' + width + 'px" class="section_header">' +
25	            '<tr><td ondblclick="void(0);" align="left" valign="top" onmouseover="over=true;" onmouseout="over=false;" style="cursor:move;height:18px">' + title + '</td>' +
26	            '<td style="width:18px" align="right"><a href="javascript:hiddenFloatingDiv(\'' + divId + '\');void(0);">' +
27	            '<img alt="Close" title="Close" src="/image/APPX/close_tooltip.JPG" border="0"></a></td></tr></table>';
28    // add to your div an header
29	document.getElementById(divId).innerHTML = addHeader + originalDivHTML;
30	if (document.getElementById(divId).className) {
31		document.getElementById(divId).className = document.getElementById(divId).className + ' dimming';
32	}
33	else {
34		document.getElementById(divId).className = 'dimming';
35	}
36	document.getElementById(divId).style.visibility = "visible";
37}//End of function displayFloatingDiv
38
39function allowOnlyOnePopup(divId) {
40	followPopup_Top_Obj = document.getElementById('windowfollowcontenttop');
41	followPopup_Bottom_Obj = document.getElementById('windowfollowcontentbutton');
42	
43	emailPopup_Top_Obj = document.getElementById('windowcontenttop');
44	emailPopup_Bottom_Obj = document.getElementById('windowcontentbutton');
45	
46	if (divId == 'windowfollowcontenttop') { //follow top
47		if (followPopup_Bottom_Obj && followPopup_Bottom_Obj != 'undefined')
48			hiddenArticleToolbarFloatingDiv('windowfollowcontentbutton');
49		
50		if (emailPopup_Top_Obj && emailPopup_Top_Obj != 'undefined')
51			hiddenArticleToolbarFloatingDiv('windowcontenttop');
52			
53		if (emailPopup_Bottom_Obj && emailPopup_Bottom_Obj != 'undefined')
54			hiddenArticleToolbarFloatingDiv('windowcontentbutton');		
55				
56	}
57	else if (divId == 'windowcontenttop') { //Email top
58		if (followPopup_Bottom_Obj && followPopup_Bottom_Obj != 'undefined')
59			hiddenArticleToolbarFloatingDiv('windowfollowcontentbutton');
60		
61		if (followPopup_Top_Obj && followPopup_Top_Obj != 'undefined')
62			hiddenArticleToolbarFloatingDiv('windowfollowcontenttop');
63			
64		if (emailPopup_Bottom_Obj && emailPopup_Bottom_Obj != 'undefined')
65			hiddenArticleToolbarFloatingDiv('windowcontentbutton');
66	}
67	else if (divId == 'windowfollowcontentbutton') { //follow bottom
68		if (followPopup_Top_Obj && followPopup_Top_Obj != 'undefined')
69			hiddenArticleToolbarFloatingDiv('windowfollowcontenttop');
70		
71		if (emailPopup_Top_Obj && emailPopup_Top_Obj != 'undefined')
72			hiddenArticleToolbarFloatingDiv('windowcontenttop');
73			
74		if (emailPopup_Bottom_Obj && emailPopup_Bottom_Obj != 'undefined')
75			hiddenArticleToolbarFloatingDiv('windowcontentbutton');
76	}
77	else if (divId == 'windowcontentbutton') { //Email bottom
78		if (followPopup_Bottom_Obj && followPopup_Bottom_Obj != 'undefined')
79			hiddenArticleToolbarFloatingDiv('windowfollowcontentbutton');
80		
81		if (emailPopup_Top_Obj && emailPopup_Top_Obj != 'undefined')
82			hiddenArticleToolbarFloatingDiv('windowcontenttop');
83			
84		if (followPopup_Top_Obj && followPopup_Top_Obj != 'undefined')
85			hiddenArticleToolbarFloatingDiv('windowfollowcontenttop');
86	}
87}//End of function allowOnlyOnePopup
88
89function displayFloatingDiv2(divId, title, width, height, left, top) {
90	//allowOnlyOnePopup(divId);
91	document.getElementById('dimmer').style.visibility = "visible";
92	document.getElementById(divId).style.display = "block";
93	$(document.getElementById(divId)).find('iframe').show();
94    document.getElementById(divId).style.width = width + 'px';
95    document.getElementById(divId).style.height = height + 'px';
96    document.getElementById(divId).style.left = left + 'px';
97    document.getElementById(divId).style.top = top + 'px';
98    if (document.getElementById(divId).className) {
99		document.getElementById(divId).className = document.getElementById(divId).className + ' dimming';
100	}
101	else {
102		document.getElementById(divId).className = 'dimming';
103	}
104	document.getElementById(divId).style.visibility = "visible";
105}//End of function displayFloatingDiv2
106
107function hiddenArticleToolbarFloatingDiv(divId) {
108	//document.getElementById(divId).innerHTML = originalDivHTML;
109	document.getElementById(divId).style.visibility='hidden';
110	document.getElementById(divId).style.display = 'none';
111	$(document.getElementById(divId)).find('iframe').hide();
112	document.getElementById('dimmer').style.visibility = 'hidden';
113	DivID = "";
114}//End of function hiddenArticleToolbarFloatingDiv
115
116function MouseDown(e) {
117    if (over) {
118        if (isMozilla) {
119            objDiv = document.getElementById(DivID);
120            X = e.layerX;
121            Y = e.layerY;
122            return false;
123        }
124        else {
125            objDiv = document.getElementById(DivID);
126            objDiv = objDiv.style;
127            X = event.offsetX;
128            Y = event.offsetY;
129        }
130    }
131}//End of function MouseDown
132
133function MouseMove(e) {
134    if (objDiv) {
135        if (isMozilla) {
136            objDiv.style.top = (e.pageY-Y) + 'px';
137            objDiv.style.left = (e.pageX-X) + 'px';
138            return false;
139        }
140        else {
141            objDiv.pixelLeft = event.clientX-X + document.body.scrollLeft;
142            objDiv.pixelTop = event.clientY-Y + document.body.scrollTop;
143            return false;
144        }
145    }
146}//End of function MouseMove
147
148function MouseUp() {
149    objDiv = null;
150}//End of function MouseUp
151
152function init() {
153    // check browser
154    isMozilla = (document.all) ? 0 : 1;
155    if (isMozilla) {
156        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
157    }
158    document.onmousedown = MouseDown;
159    document.onmousemove = MouseMove;
160    document.onmouseup = MouseUp;
161    // add the div
162    // used to dim the page
163	buildDimmerDiv();
164}//End of function init
165
166// call init
167init();
168
169// function added to get the position of the Email Story <a> object.
170// added on 6th jan 2009
171function getPosition(e) {
172	var left = 0;
173	var top  = 0;
174	try{
175		while (e.offsetParent) {
176			left += e.offsetLeft + (e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);
177			top  += e.offsetTop  + (e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);
178			e     = e.offsetParent;
179		}
180		left += e.offsetLeft + (e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);
181		top  += e.offsetTop  + (e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);
182	}
183	catch(error) {
184		// for the ie.
185		var idOfElement=e.id;
186		var ObjOfEle = eval('document.all.'+idOfElement+'.offsetParent');
187		while(ObjOfEle.offsetParent) {
188			left +=  ObjOfEle.offsetLeft;
189			top  +=  ObjOfEle.offsetTop;
190			ObjOfEle = ObjOfEle.offsetParent;
191		}
192		left += e.offsetLeft ;
193		top  += e.offsetTop  ;
194	}
195	return {x:left, y:top};
196}//End of function getPosition
197
198//************************************************************************************
199function displayWindow(iframelink, extraParamArr) {
200	var w, h, l, t;
201	w = 470;
202	//h = 455;
203	h = 520;
204	/*l = screen.width/4;
205	t = screen.height/4;*/
206	
207	var n_isMobilePage = iframelink.indexOf("isMobilePage=1");
208	if (n_isMobilePage >= 0) {
209		w = 315;
210		h = 680;
211	}
212
213	currentObj = document.getElementById('emailStoryLinkId');
214	var currentPosHeightWidth = getPosition(currentObj);
215	t = currentPosHeightWidth.y+20;
216	l = currentPosHeightWidth.x;
217
218	// with title
219	displayFloatingDiv2('windowcontenttop', 'Email Story', w, h, l, t);
220}//End of function displayWindow
221
222function displayFollowWindow(iframelink, extraParamArr) {
223	var w, h, l, t;
224	w = 320;
225	//h = 455;
226	h = 520;
227	/*l = screen.width/4;
228	t = screen.height/4;*/
229
230	currentObj = document.getElementById('followStoryLinkId');
231	var currentPosHeightWidth = getPosition(currentObj);
232	t = currentPosHeightWidth.y+20;
233	l = currentPosHeightWidth.x;
234
235	// with title
236	displayFloatingDiv2('windowfollowcontenttop', 'Follow Story', w, h, l, t);
237}//End of function displayFollowWindow
238
239function displayWindowBottom(iframelink, extraParamArr) {
240	var w, h, l, t;
241	w = 470;
242	//h = 455;
243	h = 520;
244	/*l = screen.width/4;
245	t = screen.height/4;*/
246	
247	var n_isMobilePage = iframelink.indexOf("isMobilePage=1");
248	if (n_isMobilePage >= 0) {
249		w = 315;
250		h = 600;
251	}
252
253	currentObj = document.getElementById('emailStoryLinkId2');
254	var currentPosHeightWidth = getPosition(currentObj);
255	t = currentPosHeightWidth.y+20;
256	l = currentPosHeightWidth.x;
257
258	//displayFloatingDiv2(divId, title, width, height, left, top)
259	// with title
260	displayFloatingDiv2('windowcontentbutton', 'Email Info', w, h, l, t);
261}//End of function displayWindowBottom
262
263function displayFollowWindowBottom(iframelink, extraParamArr) {
264	var w, h, l, t;
265	w = 320;
266	//h = 455;
267	h = 520;
268	/*l = screen.width/4;
269	t = screen.height/4;*/
270	currentObj = document.getElementById('followStoryLinkId2');
271	var currentPosHeightWidth = getPosition(currentObj);
272	t = currentPosHeightWidth.y+20;
273	l = currentPosHeightWidth.x;
274
275	//displayFloatingDiv2(divId, title, width, height, left, top)
276	// with title
277	displayFloatingDiv2('windowfollowcontentbutton', 'Follow Story', w, h, l, t);
278}//End of function displayFollowWindowBottom
279
280//************************************************************************************
281
282function getCssClassObj(clanSheetame) {
283	var re = new RegExp(clanSheetame);
284	var rules, nRule, nRules, SS, nSheet = 0,nSheets = document.styleSheets.length;
285	for (nSheet; nSheet < nSheets; ++nSheet) {
286		SS = document.styleSheets.item(nSheet);
287		rules = (typeof SS.cssRules == 'object')?SS.cssRules:SS.rules;
288		nRules = rules.length;
289		for (nRule = 0; nRule < nRules; ++nRule) {
290			rule = rules.item(nRule);
291			if (re.test(rule.selectorText)) {
292				return rule;
293				//rule.style.fontSize = (parseInt(rule.style.fontSize.replace("%",""))+10)+"%";
294			}// end if.
295		}// end for.
296	}// end for.
297}// end function getCssClassObj
298
299//DO NOT MODIFY BELOW
300/* Module Change Font (string) */
301function changeFont(fontClass,stnBoxIdParam,fromFileCallFlag) {
302	var element = document.getElementById('blurb_body');
303	
304	if (stnBoxIdParam && stnBoxIdParam != 'undefined') {
305		
306	}
307	else {
308		stnBoxIdParam = '';
309	}
310	
311	//VI-4294
312	if (fromFileCallFlag && fromFileCallFlag != 'undefined') {
313		
314	}
315	else {
316		fromFileCallFlag = '';
317	}
318	
319	if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') {
320		var element_1 = document.getElementById('calendar_date_container');
321		var element_2 = document.getElementById('calendar_desc');
322		var element_3 = document.getElementById('calendar_org_container');
323	}
324	
325	if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') {
326		// get all direct child.
327		var directChild_1 = element_1.childNodes ;
328		var directChild_2 = element_2.childNodes ;
329		var directChild_3 = element_3.childNodes ;
330		
331		//var directChild = element_1.childNodes ;
332		/*for(x in directChild_3) {
333			directChild[x] = directChild_3[x];
334		}
335		for(x in directChild_2) {
336			directChild[x] = directChild_2[x];
337		}*/
338		
339		var directChild = new Array();
340		i = 0;
341		for (eltIndex = directChild_1.length - 1; eltIndex >= 0; eltIndex--) {
342			if (directChild_1[eltIndex] && directChild_1[eltIndex] != 'undefined')
343				directChild[i++] = directChild_1[eltIndex];
344		}
345		for (eltIndex = directChild_2.length - 1; eltIndex >= 0; eltIndex--) {
346			if (directChild_2[eltIndex] && directChild_2[eltIndex] != 'undefined')
347				directChild[i++] = directChild_2[eltIndex];
348		}
349		for (eltIndex = directChild_3.length - 1; eltIndex >= 0; eltIndex--) {
350			if (directChild_3[eltIndex] && directChild_3[eltIndex] != 'undefined')
351				directChild[i++] = directChild_3[eltIndex];
352		}
353	}
354	else {
355		// get all direct child.
356		var directChild = element.childNodes ;
357	}
358	
359	if(directChild.length > 0) {
360		for(x in directChild) {
361			try{
362				switch(fontClass) {
363					case 'xxsmall_blurb_font':
364						directChild[x].style.fontSize = "xx-small";
365					break;
366					case 'xsmall_blurb_font':
367						directChild[x].style.fontSize = "x-small";
368					break;
369					case 'xlarge_blurb_font':
370						directChild[x].style.fontSize = "large";
371					break;
372					case 'xxlarge_blurb_font':
373						directChild[x].style.fontSize = "xx-large";
374					break;
375					/*case 'medium_blurb_font': //VI-4294
376						if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') {
377							directChild[x].style.fontSize = "medium";	
378						}
379						else { //this will be same as default for article because article donot have this case.
380							try{
381							// get all direct child.
382							//var cssClassObj = getCssClassObj("Box__Font");
383							var cssClassObj = getCssClassObj("Box_"+stnBoxIdParam+"_Font");
384							directChild[x].style.fontSize = cssClassObj.style.fontSize;
385							directChild[x].style.fontFamily = cssClassObj.style.fontFamily;
386							directChild[x].style.fontWeight = cssClassObj.style.fontWeight;
387							}catch(e){directChild[x].style.fontSize = "9pt"; directChild[x].style.fontFamily = "Arial, Helvetica, sans-serif";}
388							//fontClass = "Box__Font";
389							fontClass = "Box_"+stnBoxIdParam+"_Font";
390						}
391					break;*/
392					default:
393						try{
394						// get all direct child.
395						//var cssClassObj = getCssClassObj("Box__Font");
396						var cssClassObj = getCssClassObj("Box_"+stnBoxIdParam+"_Font");
397						directChild[x].style.fontSize = cssClassObj.style.fontSize;
398						directChild[x].style.fontFamily = cssClassObj.style.fontFamily;
399						directChild[x].style.fontWeight = cssClassObj.style.fontWeight;
400						}catch(e){directChild[x].style.fontSize = "9pt"; directChild[x].style.fontFamily = "Arial, Helvetica, sans-serif";}
401						//fontClass = "Box__Font";
402						fontClass = "Box_"+stnBoxIdParam+"_Font";
403					break;
404					
405					}//End of switch(fontClass)
406					
407			}catch(e){};
408		}// end for(x in directChild)
409	}// end if childs are greater then zero.
410	
411	if (fromFileCallFlag == 'content_topic_calendar_event_display.lib') { //VI-4294
412		element_1.className = fontClass;
413		element_2.className = fontClass;
414		element_3.className = fontClass;
415	}
416	else {
417		element.className = fontClass;
418	}
419}//End of function changeFont
420/*
421 * Name:
422 *	changeContentFont
423 * Description:
424 *  copied and modified function changeFont to show font size wise
425 * Author:
426 *   Rahul Tupparwar [VI-4048]
427 */
428function changeContentFont(trId,fontClass,stnBoxIdParam) {
429	var element = "";
430	$element = $('.'+trId);
431	switch(fontClass) {
432		case 'xxsmall_blurb_font':
433			//$(+"."+trId).css({'fontSize':'xx-small','border':'9px solid red'});
434			$element.css('fontSize','xx-small');
435			//$element.css('border','9px solid red');
436			//directChild[x].style.fontSize = "xx-small";
437		break;
438		case 'xsmall_blurb_font':
439			$element.css('fontSize','x-small');
440			//element.css({'fontSize':'x-small'});
441			//directChild[x].style.fontSize = "x-small";
442		break;
443		case 'xlarge_blurb_font':
444			$element.css('fontSize','large');
445			//element.css({'fontSize':'large'});
446			//directChild[x].style.fontSize = "large";
447		break;
448		case 'xxlarge_blurb_font':
449			$element.css('fontSize','xx-large');
450			//element.css({'fontSize':'xx-large'});
451			//directChild[x].style.fontSize = "xx-large";
452		break;
453		default:
454			try{
455			// get all direct child.
456			//var cssClassObj = getCssClassObj("Box_< ?=$stnBoxId ?>_Font");
457			var cssClassObj = getCssClassObj("Box_"+stnBoxIdParam+"_Font");
458			$element.css({'fontSize':cssClassObj.style.fontSize});
459			$element.css({'fontFamily':cssClassObj.style.fontFamily});
460			$element.css({'fontWeight':cssClassObj.style.fontWeight});
461			}catch(e){
462				$element.css({'fontSize':'9pt','fontFamily':'Arial, Helvetica, sans-serif'});
463			}
464			//fontClass = "Box_< ?=$stnBoxId ?>_Font";
465			//fontClass = "Box_"+stnBoxIdParam+"_Font";
466		}
467	//element.className = fontClass;
468}//End of function changePostFont
469
470function myOpenPrint(url) {
471    myWindowHandle = window.open(url,'windowName','width=700,height=600,resizable=1,scrollbars=1,location=0');
472	//myWindowHandle.moveTo(0,0);
473    if (!myWindowHandle.opener)
474        myWindowHandle.opener = self;
475}//End of function myOpenPrint
476
477//added by karl schipul for [vi-1629]
478function iframeHeightCorrector(setHeightNum, iframeWithThisURL){
479	var elements = document.getElementsByTagName('iframe'); 
480	var ilength = elements.length;
481	var sum = setHeightNum + 50;
482	while(ilength--){
483		if(elements[ilength].src == iframeWithThisURL){
484			elements[ilength].style.minHeight = sum + "px";
485		}
486	}
487}//End of function iframeHeightCorrector

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.