PageSourceSearch

https://www.jisha.or.jp/js/dnncore.js?date=20250424143154

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