PageSourceSearch

https://tiniko.co.kr/adm/webedit/js/service/HuskyEZCreator.js

js tiniko.co.kr collected 2026-10-08 10:49:49 UTC 4,680 bytes, 151 lines download raw bytes

1/*
2Copyright (C) NAVER corp.  
3
4This library is free software; you can redistribute it and/or  
5modify it under the terms of the GNU Lesser General Public  
6License as published by the Free Software Foundation; either  
7version 2.1 of the License, or (at your option) any later version.  
8
9This library is distributed in the hope that it will be useful,  
10but WITHOUT ANY WARRANTY; without even the implied warranty of  
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  
12Lesser General Public License for more details.  
13
14You should have received a copy of the GNU Lesser General Public  
15License along with this library; if not, write to the Free Software  
16Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA  
17*/
18if(typeof window.nhn=='undefined') window.nhn = {};
19if (!nhn.husky) nhn.husky = {};
20
21/**
22 * @fileOverview This file contains application creation helper function, which would load up an HTML(Skin) file and then execute a specified create function.
23 * @name HuskyEZCreator.js
24 */
25nhn.husky.EZCreator = new (function(){
26	this.nBlockerCount = 0;
27
28	this.createInIFrame = function(htOptions){
29		if(arguments.length == 1){
30			var oAppRef = htOptions.oAppRef;
31			var elPlaceHolder = htOptions.elPlaceHolder;
32			var sSkinURI = htOptions.sSkinURI;
33			var fCreator = htOptions.fCreator;
34			var fOnAppLoad = htOptions.fOnAppLoad;
35			var bUseBlocker = htOptions.bUseBlocker;
36			var htParams = htOptions.htParams || null;
37		}else{
38			// for backward compatibility only
39			var oAppRef = arguments[0];
40			var elPlaceHolder = arguments[1];
41			var sSkinURI = arguments[2];
42			var fCreator = arguments[3];
43			var fOnAppLoad = arguments[4];
44			var bUseBlocker = arguments[5];
45			var htParams = arguments[6];
46		}
47
48		if(bUseBlocker) nhn.husky.EZCreator.showBlocker();
49
50		var attachEvent = function(elNode, sEvent, fHandler){ 
51			if(elNode.addEventListener){
52				elNode.addEventListener(sEvent, fHandler, false);
53			}else{
54				elNode.attachEvent("on"+sEvent, fHandler);
55			}
56		} 
57
58		if(!elPlaceHolder){
59			alert("Placeholder is required!");
60			return;
61		}
62
63		if(typeof(elPlaceHolder) != "object")
64			elPlaceHolder = document.getElementById(elPlaceHolder);
65
66		var elIFrame, nEditorWidth, nEditorHeight;
67		 
68
69		try{
70			elIFrame = document.createElement("<IFRAME frameborder=0 scrolling=no>");
71		}catch(e){
72			elIFrame = document.createElement("IFRAME");
73			elIFrame.setAttribute("frameborder", "0");
74			elIFrame.setAttribute("scrolling", "no");
75		}
76		
77		elIFrame.style.width = "1px";
78		elIFrame.style.height = "1px";
79		elPlaceHolder.parentNode.insertBefore(elIFrame, elPlaceHolder.nextSibling);
80		
81		attachEvent(elIFrame, "load", function(){
82			fCreator = elIFrame.contentWindow[fCreator] || elIFrame.contentWindow.createSEditor2;
83			
84//			top.document.title = ((new Date())-window.STime);
85//			window.STime = new Date();
86			
87			try{
88			
89				nEditorWidth = elIFrame.contentWindow.document.body.scrollWidth || "500px";
90				nEditorHeight = elIFrame.contentWindow.document.body.scrollHeight + 12;
91				elIFrame.style.width =  "100%";
92				elIFrame.style.height = nEditorHeight+ "px";
93				elIFrame.contentWindow.document.body.style.margin = "0";
94			}catch(e){
95				nhn.husky.EZCreator.hideBlocker(true);
96				elIFrame.style.border = "5px solid red";
97				elIFrame.style.width = "500px";
98				elIFrame.style.height = "500px";
99				alert("Failed to access "+sSkinURI);
100				return;
101			}
102			
103			var oApp = fCreator(elPlaceHolder, htParams);	// oEditor
104			
105
106			oApp.elPlaceHolder = elPlaceHolder;
107
108			oAppRef[oAppRef.length] = oApp;
109			if(!oAppRef.getById) oAppRef.getById = {};
110			
111			if(elPlaceHolder.id) oAppRef.getById[elPlaceHolder.id] = oApp;
112
113			oApp.run({fnOnAppReady:fOnAppLoad}); 
114			
115//			top.document.title += ", "+((new Date())-window.STime);
116			nhn.husky.EZCreator.hideBlocker();
117		});
118//		window.STime = new Date();
119		elIFrame.src = sSkinURI;
120		this.elIFrame = elIFrame;
121	};
122	
123	this.showBlocker = function(){
124		if(this.nBlockerCount<1){
125			var elBlocker = document.createElement("DIV");
126			elBlocker.style.position = "absolute";
127			elBlocker.style.top = 0;
128			elBlocker.style.left = 0;
129			elBlocker.style.backgroundColor = "#FFFFFF";
130			elBlocker.style.width = "100%";
131
132			document.body.appendChild(elBlocker);
133			
134			nhn.husky.EZCreator.elBlocker = elBlocker;
135		}
136
137		nhn.husky.EZCreator.elBlocker.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight)+"px";
138		
139		this.nBlockerCount++;
140	};
141	
142	this.hideBlocker = function(bForce){
143		if(!bForce){
144			if(--this.nBlockerCount > 0) return;
145		}
146		
147		this.nBlockerCount = 0;
148		
149		if(nhn.husky.EZCreator.elBlocker) nhn.husky.EZCreator.elBlocker.style.display = "none";
150	}
151})();

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.