PageSourceSearch

https://realestate.jiminypeak.com/js/Debug/dnncore.js?cdv=140

js jiminypeak.com collected 2026-09-24 19:02:55 UTC 13,472 bytes, 518 lines download raw bytes

1//General
2//for example: instead of each module writing out script found in moduleMaxMin_OnClick have the functionality cached
3//
4
5var DNN_COL_DELIMITER = String.fromCharCode(16);
6var DNN_ROW_DELIMITER = String.fromCharCode(15);
7var __dnn_m_bPageLoaded = false;
8
9if (window.addEventListener)
10    window.addEventListener("load", __dnn_Page_OnLoad, false);
11else
12    window.attachEvent("onload", __dnn_Page_OnLoad);
13
14function __dnn_ClientAPIEnabled()
15{
16    return typeof(dnn) != 'undefined' && typeof (dnn.dom) != 'undefined';
17}
18
19function __dnn_Page_OnLoad()
20{
21	if (__dnn_ClientAPIEnabled())
22	{	
23		dnn.dom.attachEvent(window, 'onscroll', __dnn_bodyscroll);
24	}
25	__dnn_m_bPageLoaded = true;
26}
27
28function __dnn_KeyDown(iKeyCode, sFunc, e)
29{
30	if (e == null)
31		e = window.event;
32
33	if (e.keyCode == iKeyCode)
34	{
35		eval(unescape(sFunc));
36		return false;
37	}
38}
39
40function __dnn_bodyscroll() 
41{
42	var oF=document.forms[0];	
43	if (__dnn_ClientAPIEnabled() && __dnn_m_bPageLoaded && typeof(oF.ScrollTop) != 'undefined')
44		oF.ScrollTop.value=document.documentElement.scrollTop ? document.documentElement.scrollTop : dnn.dom.getByTagName("body")[0].scrollTop;
45}
46
47function __dnn_setScrollTop(iTop)
48{
49	if (__dnn_ClientAPIEnabled())
50	{
51		if (iTop == null)
52			iTop = document.forms[0].ScrollTop.value;
53	
54		var sID = dnn.getVar('ScrollToControl');
55		if (sID != null && sID.length > 0)
56		{
57			var oCtl = dnn.dom.getById(sID);
58			if (oCtl != null)
59			{
60				iTop = dnn.dom.positioning.elementTop(oCtl);
61				dnn.setVar('ScrollToControl', '');
62			}
63		}
64
65		if (document.getElementsByTagName("html")[0].style["overflow"] != "hidden") {
66			window.scrollTo(0, iTop);
67		}
68	}
69}
70
71//Focus logic
72function __dnn_SetInitialFocus(sID)
73{
74	var oCtl = dnn.dom.getById(sID);	
75	if (oCtl != null && __dnn_CanReceiveFocus(oCtl))
76		oCtl.focus();
77}	
78
79function __dnn_CanReceiveFocus(e)
80{
81	//probably should call getComputedStyle for classes that cause item to be hidden
82	if (e.style.display != 'none' && e.tabIndex > -1 && e.disabled == false && e.style.visible != 'hidden')
83	{
84		var eParent = e.parentElement;
85		while (eParent != null && eParent.tagName != 'BODY')
86		{
87			if (eParent.style.display == 'none' || eParent.disabled || eParent.style.visible == 'hidden')
88				return false;
89			eParent = eParent.parentElement;
90		}
91		return true;
92	}
93	else
94		return false;
95}
96
97//Max/Min Script
98function __dnn_ContainerMaxMin_OnClick(oLnk, sContentID)
99{
100	var oContent = dnn.dom.getById(sContentID);
101	if (oContent != null)
102	{
103		var oBtn = oLnk.childNodes[0];
104		var sContainerID = dnn.getVar('containerid_' + sContentID); //oLnk.getAttribute('containerid');
105		var sCookieID = dnn.getVar('cookieid_' + sContentID); //oLnk.getAttribute('cookieid');
106		var sCurrentFile = oBtn.src.toLowerCase().substr(oBtn.src.lastIndexOf('/'));
107		var sMaxFile;
108		var sMaxIcon;
109		var sMinIcon;
110
111		if (dnn.getVar('min_icon_' + sContainerID))
112			sMinIcon = dnn.getVar('min_icon_' + sContainerID);
113		else
114			sMinIcon = dnn.getVar('min_icon');
115
116		if (dnn.getVar('max_icon_' + sContainerID))
117			sMaxIcon = dnn.getVar('max_icon_' + sContainerID);
118		else
119			sMaxIcon = dnn.getVar('max_icon');
120
121		sMaxFile = sMaxIcon.toLowerCase().substr(sMaxIcon.lastIndexOf('/'));
122
123		var iNum = 5;
124
125		var animf = dnn.getVar('animf_' + sContentID);
126		if (animf != null)
127			iNum = new Number(animf);
128			
129		if (sCurrentFile == sMaxFile)
130		{
131			oBtn.src = sMinIcon;				
132			//oContent.style.display = '';
133			dnn.dom.expandElement(oContent, iNum);
134			oBtn.title = dnn.getVar('min_text');
135			if (sCookieID != null)
136			{
137				if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true')
138					dnn.dom.setCookie(sCookieID, 'true', 365);
139				else
140					dnn.dom.deleteCookie(sCookieID);
141			}
142			else
143				dnn.setVar('__dnn_' + sContainerID + '_Visible', 'true');
144		}
145		else
146		{
147			oBtn.src = sMaxIcon;				
148			//oContent.style.display = 'none';
149			dnn.dom.collapseElement(oContent, iNum);
150			oBtn.title = dnn.getVar('max_text');
151			if (sCookieID != null)
152			{
153				if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true')
154					dnn.dom.deleteCookie(sCookieID);
155				else
156					dnn.dom.setCookie(sCookieID, 'false', 365);				
157			}
158			else
159				dnn.setVar('__dnn_' + sContainerID + '_Visible', 'false');			
160		}
161		
162		return true;	//cancel postback
163	}
164	return false;	//failed so do postback
165}
166
167function __dnn_Help_OnClick(sHelpID)
168{
169	var oHelp = dnn.dom.getById(sHelpID);
170	if (oHelp != null)
171	{
172		if (oHelp.style.display == 'none')
173			oHelp.style.display = '';
174		else
175			oHelp.style.display = 'none';
176
177		return true;	//cancel postback
178	}
179	return false;	//failed so do postback
180}
181
182function __dnn_SectionMaxMin(oBtn, sContentID)
183{
184	var oContent = dnn.dom.getById(sContentID);
185	if (oContent != null)
186	{
187		var sMaxIcon = oBtn.getAttribute('max_icon');
188		var sMinIcon = oBtn.getAttribute('min_icon');
189		var bCallback = oBtn.getAttribute('userctr') != null;
190		var sVal;
191		if (oContent.style.display == 'none')
192		{
193			oBtn.src = sMinIcon;				
194			oContent.style.display = '';
195			if (bCallback)
196			    sVal = 'True';
197			else
198			    dnn.setVar(oBtn.id + ':exp', 1);
199		}
200		else
201		{
202			oBtn.src = sMaxIcon;				
203			oContent.style.display = 'none';
204			if (bCallback)
205			    sVal = 'False';
206			else
207                dnn.setVar(oBtn.id + ':exp', 0);
208		}
209		if (bCallback)
210		    dnncore.setUserProp(oBtn.getAttribute('userctr'), oBtn.getAttribute('userkey'), sVal, null);
211		return true;	//cancel postback
212	}
213	return false;	//failed so do postback
214}
215
216//Drag N Drop
217function __dnn_enableDragDrop()
218{
219	var aryConts = dnn.getVar('__dnn_dragDrop').split(";");	
220	var aryTitles;
221
222	for (var i=0; i < aryConts.length; i++)
223	{
224		aryTitles = aryConts[i].split(" ");
225		if (aryTitles[0].length > 0)
226		{			
227			var oCtr = dnn.dom.getById(aryTitles[0]);
228			var oTitle = dnn.dom.getById(aryTitles[1]);
229			if (oCtr != null && oTitle != null)
230			{
231				oCtr.setAttribute('moduleid', aryTitles[2]);
232				dnn.dom.positioning.enableDragAndDrop(oCtr, oTitle, '__dnn_dragComplete()', '__dnn_dragOver()');
233			}	
234		}
235	}
236}
237
238var __dnn_oPrevSelPane;
239var __dnn_oPrevSelModule;
240var __dnn_dragEventCount=0;
241function __dnn_dragOver()
242{
243	__dnn_dragEventCount++;
244	if (__dnn_dragEventCount % 75 != 0)	//only calculate position every 75 events
245		return;
246	
247	var oCont = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);
248
249	var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);
250		
251	if (__dnn_oPrevSelPane != null)	//reset previous pane's border
252		__dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder;
253
254	if (oPane != null)
255	{		
256		__dnn_oPrevSelPane = oPane;
257		oPane.pane.style.border = '4px double ' + DNN_HIGHLIGHT_COLOR;
258		var iIndex = __dnn_getPaneControlIndex(oCont, oPane);
259
260		var oPrevCtl;
261		var oNextCtl;
262		for (var i=0; i<oPane.controls.length; i++)
263		{
264			if (iIndex > i && oPane.controls[i].id != oCont.id)
265				oPrevCtl = oPane.controls[i];
266			if (iIndex <= i && oPane.controls[i].id != oCont.id)
267			{
268				oNextCtl = oPane.controls[i];
269				break;
270			}
271		}			
272		
273		if (__dnn_oPrevSelModule != null)
274			dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder;
275			
276
277		if (oNextCtl != null)
278		{
279			__dnn_oPrevSelModule = oNextCtl;
280			dnn.dom.getNonTextNode(oNextCtl.control).style.borderTop = '5px groove ' + DNN_HIGHLIGHT_COLOR;
281		}
282		else if (oPrevCtl != null)
283		{
284			__dnn_oPrevSelModule = oPrevCtl;
285			dnn.dom.getNonTextNode(oPrevCtl.control).style.borderBottom = '5px groove ' + DNN_HIGHLIGHT_COLOR;
286		}
287	}
288}
289
290function __dnn_dragComplete()
291{
292	var oCtl = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);
293	var sModuleID = oCtl.getAttribute('moduleid');
294	
295	if (__dnn_oPrevSelPane != null)
296		__dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder;
297
298	if (__dnn_oPrevSelModule != null)
299		dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder;
300		
301	var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);
302	var iIndex;
303	if (oPane == null)
304	{
305		var oPanes = __dnn_Panes();
306		for (var i=0; i<oPanes.length; i++)
307		{
308			if (oPanes[i].id == oCtl.parentNode.id)
309				oPane = oPanes[i];
310		}
311	}	
312	if (oPane != null)
313	{
314		iIndex = __dnn_getPaneControlIndex(oCtl, oPane);
315		__dnn_MoveToPane(oPane, oCtl, iIndex);
316
317		dnn.callPostBack('MoveToPane', 'moduleid=' + sModuleID, 'pane=' + oPane.paneName, 'order=' + iIndex * 2); 
318	}
319}
320
321function __dnn_MoveToPane(oPane, oCtl, iIndex)
322{
323
324	if (oPane != null)
325	{
326		var aryCtls = new Array();
327		for (var i=iIndex; i<oPane.controls.length; i++)
328		{
329			if (oPane.controls[i].control.id != oCtl.id)
330				aryCtls[aryCtls.length] = oPane.controls[i].control;
331
332			dnn.dom.removeChild(oPane.controls[i].control);
333		}
334		dnn.dom.appendChild(oPane.pane, oCtl);
335		oCtl.style.top=0;
336		oCtl.style.left=0;
337		oCtl.style.position = 'relative';
338		for (var i=0; i<aryCtls.length; i++)
339		{
340			dnn.dom.appendChild(oPane.pane, aryCtls[i]);
341		}
342		__dnn_RefreshPanes();
343	}
344	else
345	{
346		oCtl.style.top=0;
347		oCtl.style.left=0;
348		oCtl.style.position = 'relative';
349	}
350}
351
352function __dnn_RefreshPanes()
353{
354	var aryPanes = dnn.getVar('__dnn_Panes').split(';');
355	var aryPaneNames = dnn.getVar('__dnn_PaneNames').split(';');
356	__dnn_m_aryPanes = new Array();
357	for (var i=0; i<aryPanes.length; i++)
358	{
359		if (aryPanes[i].length > 0)
360			__dnn_m_aryPanes[__dnn_m_aryPanes.length] = new __dnn_Pane(dnn.dom.getById(aryPanes[i]), aryPaneNames[i]);
361	}
362}
363
364var __dnn_m_aryPanes;
365var __dnn_m_aryModules;
366function __dnn_Panes()
367{
368	if (__dnn_m_aryPanes == null)
369	{
370		__dnn_m_aryPanes = new Array();
371		__dnn_RefreshPanes();
372	}
373	return __dnn_m_aryPanes;
374}
375
376function __dnn_Modules(sModuleID)
377{
378	if (__dnn_m_aryModules == null)
379		__dnn_RefreshPanes();
380	
381	return __dnn_m_aryModules[sModuleID];
382}
383
384function __dnn_getMostSelectedPane(oContent)
385{
386	var oCDims = new dnn.dom.positioning.dims(oContent);
387	var iTopScore=0;
388	var iScore;
389	var oTopPane;
390	for (var i=0; i<__dnn_Panes().length; i++)
391	{
392		var oPane = __dnn_Panes()[i];
393		var oPDims = new dnn.dom.positioning.dims(oPane.pane);
394		iScore = dnn.dom.positioning.elementOverlapScore(oPDims, oCDims);
395		
396		if (iScore > iTopScore)
397		{
398			iTopScore = iScore;
399			oTopPane = oPane;
400		}
401	}
402	return oTopPane;
403}
404
405function __dnn_getPaneControlIndex(oContent, oPane)
406{
407	if (oPane == null)
408		return;
409	var oCDims = new dnn.dom.positioning.dims(oContent);
410	var oCtl;
411	if (oPane.controls.length == 0)
412		return 0;
413	for (var i=0; i<oPane.controls.length; i++)
414	{
415		oCtl = oPane.controls[i];
416		var oIDims = new dnn.dom.positioning.dims(oCtl.control);
417		if (oCDims.t < oIDims.t)
418			return oCtl.index;
419	}
420	if (oCtl != null)
421		return oCtl.index+1;
422	else
423		return 0;
424}
425
426//Objects
427function __dnn_Pane(ctl, sPaneName)
428{
429	this.pane = ctl;
430	this.id = ctl.id;
431	this.controls = new Array();
432	this.origBorder = ctl.style.border;
433	this.paneName = sPaneName;
434	
435	var iIndex = 0;
436	var strModuleOrder='';
437	for (var i=0; i<ctl.childNodes.length; i++)
438	{
439		var oNode = ctl.childNodes[i];
440		if (dnn.dom.isNonTextNode(oNode))	
441		{
442			if (__dnn_m_aryModules == null)
443				__dnn_m_aryModules = new Array();
444
445			//if (oNode.tagName == 'A' && oNode.childNodes.length > 0)
446			//	oNode = oNode.childNodes[0];	//DNN now embeds anchor tag 
447				
448			var sModuleID = oNode.getAttribute('moduleid');
449			if (sModuleID != null && sModuleID.length > 0)
450			{
451				strModuleOrder += sModuleID + '~';
452				this.controls[this.controls.length] = new __dnn_PaneControl(oNode, iIndex);
453				__dnn_m_aryModules[sModuleID] = oNode.id;
454				iIndex+=1;
455			}
456		}
457	}
458	this.moduleOrder = strModuleOrder;
459
460}
461
462function __dnn_PaneControl(ctl, iIndex)
463{
464	this.control = ctl;
465	this.id = ctl.id;
466	this.index = iIndex;
467	this.origBorder = ctl.style.border;
468
469}
470
471function __dnn_ShowModalPage(urlPage) {
472    dnnModal.show(urlPage, /*showReturn*/true, 550, 950, true, '');    
473}
474
475//move towards dnncore ns.  right now only for personalization
476function __dnncore()
477{
478    this.GetUserVal = 0;
479    this.SetUserVal = 1;
480}
481
482__dnncore.prototype = {
483getUserProp: function(sNameCtr, sKey, pFunc) {
484    this._doUserCallBack(dnncore.GetUserVal, sNameCtr, sKey, null, new dnncore.UserPropArgs(sNameCtr, sKey, pFunc));
485},
486
487setUserProp: function(sNameCtr, sKey, sVal, pFunc) {
488    this._doUserCallBack(dnncore.SetUserVal, sNameCtr, sKey, sVal, new dnncore.UserPropArgs(sNameCtr, sKey, pFunc));
489},
490
491_doUserCallBack: function(iType, sNameCtr, sKey, sVal, pFunc) {
492    if (dnn && dnn.xmlhttp)
493    {
494        var sPack = iType + COL_DELIMITER + sNameCtr + COL_DELIMITER + sKey + COL_DELIMITER + sVal;
495        dnn.xmlhttp.doCallBack('__Page',sPack,dnncore._callBackSuccess,pFunc,dnncore._callBackFail,null,true,null,0);
496    }
497    else
498        alert('Client Personalization not enabled');
499},
500
501_callBackSuccess: function (result, ctx, req) {
502    if (ctx.pFunc)
503        ctx.pFunc(ctx.namingCtr, ctx.key, result);
504},
505
506_callBackFail: function (result, ctx) {
507	window.status = result;
508}
509}
510
511__dnncore.prototype.UserPropArgs = function(sNameCtr, sKey, pFunc)
512{
513    this.namingCtr = sNameCtr;
514	this.key = sKey;
515	this.pFunc = pFunc;
516}
517
518var dnncore = new __dnncore();

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.