PageSourceSearch

https://nocutnews.co.kr/WebResource.axd?d=uwOdSAuA01rsLsJON_Q1bcfH…dwXSXHPvOtKtIrbtc_n1g0&t=639251474390963045

js nocutnews.co.kr collected 2026-10-01 10:14:27 UTC 11,290 bytes, 373 lines download raw bytes

1//<script type="text/javascript" src="enums.htm"></script>
2//<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.js"></script>
3//<script type="text/javascript" src="jqueryextend.htm"></script>
4//<script type="text/javascript">
5//<![CDATA[
6
7var __HtmlControlBase = function (json) {
8	this.version = "1.1.8";
9	this.modified = "2021.12.31";
10	this.parent = null;
11	this.selector = null;
12	this.data = { "items": [], "separator": "," };
13	this.type = HtmlControlType.None;
14
15	if (json) for (var key in json) this[key] = json[key];
16	return this;
17};
18__HtmlControlBase.prototype.init = function (parent) {
19	this.parent = parent;
20	this.onpreinit();
21	const rst = this.oninit();
22	if (rst === false) return;
23
24	if (this.selector == null || this.selector == "") {
25		this.load();
26		return;
27	}
28	var obj = $(this.selector);
29	if (obj.length == 0) {
30		this.load();
31		return;
32	}
33
34	var tagName = obj.prop("tagName").toLowerCase();
35	var hct = HtmlControlType;
36
37	switch (tagName) {
38		case "input":
39			switch (obj.attr("type").toLowerCase()) {
40				case "number":
41					this.type = hct.Text | hct.Number;
42					break;
43				case "date":
44					this.type = hct.Text | hct.Date;
45					break;
46				case "hidden":
47					this.type &= ~(hct.Select | hct.List | hct.Checkbox | hct.File | hct.Text | hct.Radio);
48					this.type |= hct.Hidden;
49					break;
50				case "file":
51					this.type |= hct.File | hct.String;
52					break;
53				case "radio":
54					this.type &= ~(
55						hct.Select | hct.List | hct.Checkbox | hct.File | hct.Text | hct.Hidden |
56						hct.Enum | hct.Array | hct.Json
57					);
58					this.type |= hct.Radio;
59					break;
60				case "checkbox":
61					if (obj.length == 1)
62						this.type = hct.Checkbox | hct.Boolean;
63					else {
64						this.type &= ~(
65							hct.Select | hct.List | hct.Radio | hct.File | hct.Text | hct.Hidden |
66							hct.Array | hct.Json
67						);
68						this.type |= hct.Checkbox;
69						if ((this.type & hct.Enum) == hct.Enum)
70							this.type |= hct.Number;
71						else
72							this.type |= hct.Array;
73					}
74					break;
75				case "button":
76				case "reset":
77				case "submit":
78					this.type = hct.Button;
79					break;
80				default:
81					this.type &= ~(hct.Select | hct.List | hct.Checkbox | hct.File | hct.Hidden | hct.Radio);
82					this.type |= hct.Text;
83					if (this.type & (hct.Number | hct.Date | hct.Boolean | hct.Json) == hct.None)
84						this.type |= hct.String;
85					break;
86			}
87			break;
88		case "textarea":
89			this.type = hct.Text | hct.String;
90			break;
91		case "select":
92			this.type &= ~(
93				hct.Select | hct.List | hct.Checkbox | hct.File | hct.Hidden | hct.Radio | hct.Text | hct.Array
94			);
95			if (obj.prop("multiple")) {
96				this.type |= hct.List;
97				if ((this.type & hct.Enum) == hct.None) this.type |= hct.Array;
98			} else
99				this.type |= hct.Select;
100			break;
101		case "a":
102		case "button":
103			this.type = hct.Button;
104			break;
105		default:
106			this.load();
107			return;
108	}
109
110	var _this_ = this;
111	if ((this.type & hct.Button) != hct.Button)
112		obj.focus(function () { return _this_.onfocus(this); })
113	if (this.type & (hct.Checkbox | hct.Radio | hct.Button))
114		obj.click(function () { return _this_.onclick(this); });
115	if (this.type & (hct.Select | hct.List))
116		obj.change(function () { return _this_.onchange(); })
117
118	this.load();
119};
120__HtmlControlBase.prototype.onpreinit = function () { };
121__HtmlControlBase.prototype.oninit = function () { };
122__HtmlControlBase.prototype.load = function () { this.onload(); };
123__HtmlControlBase.prototype.focus = function () { 
124	$(this.selector).focus();
125	return true;
126};
127__HtmlControlBase.prototype.select = function () {
128	$(this.selector).select();
129	return true;
130};
131__HtmlControlBase.prototype.onload = function () { };
132__HtmlControlBase.prototype.onclick = function (el) {
133	return this.type & HtmlControlType.Button ? this.isValid() : true;
134};
135__HtmlControlBase.prototype.onchange = function () { return true; };
136__HtmlControlBase.prototype.onfocus = function () { return true; };
137__HtmlControlBase.prototype.onblur = function () { return true; };
138__HtmlControlBase.prototype.val = function (value, type) {
139	type = type || this.type;
140
141	var _this_ = this, obj = $(this.selector), hct = HtmlControlType;
142	if (value === undefined) {
143		var _parse = function (val) {
144			var rst;
145			if (_this_.type & (hct.Number | hct.Enum))
146				rst = $.parseInt(val);
147			else if (_this_.type & hct.Boolean)
148				rst = $.parseBool(val);
149			else if (_this_.type & hct.Date)
150				rst = $.parseDate(val);
151			else if (_this_.type & hct.Json)
152				val ? eval("rst = " + val) : rst = null;
153			else
154				rst = val;
155			return rst;
156		};
157		var rst, val;
158
159		if (type & (hct.Text | hct.Hidden | hct.File)) {
160			if (type & hct.Array) {
161				rst = [];
162				val = $.trim(obj.val());
163				if (val != "") rst = val.split(this.data.separator);
164				$.each(rst, function (idx, item) { rst[idx] = _parse(item); });
165			} else
166				rst = _parse(obj.val());
167		} else if (type & hct.Select)
168			rst = _parse(obj.val());
169		else if (type & hct.List) {
170			if (type & hct.Enum) {
171				rst = 0;
172				obj.filter(":selected").each(function () { rst |= _parse(this.value); });
173			} else {
174				rst = [];
175				obj.filter(":selected").each(function () { rst.push(_parse(this.value)); });
176			}
177		} else if (type & hct.Checkbox) {
178			if (type & hct.Enum) {
179				rst = 0;
180				obj.filter(":checked").each(function () { rst |= _parse(this.value); });
181			} else if (type & hct.Boolean)
182				rst = obj.filter(":checked").length > 0;
183			else {
184				rst = [];
185				obj.filter(":checked").each(function () { rst.push(_parse(this.value)); });
186			}
187		} else if (type & hct.Radio)
188			rst = _parse(obj.filter(":checked").val());
189		else
190			rst = obj.val();
191		return rst;
192	} else {
193		if (obj.length == 0) return;
194		if (type & hct.File)
195			throw new __HtmlControlException({
196				"source": this, "args": arguments,
197				"message": "HtmlControlType.File은 값을 설정할 수 없습니다."
198			});
199		var _toString = function (val) {
200			var rst = "";
201			if (type & hct.Json) {
202				if (val) rst = $.stringify(val);
203			} else if(type & hct.Number) {
204				if (typeof val !== "number") val = $.parseInt(val);
205				rst = val.toString();
206			} else if (type & hct.Date) {
207				if (typeof val == "string" && val.length > 0)
208					val = $.parseDate(value);
209				if (typeof val == "object")
210					rst = $.formatDateTime(val, DateTimeFormat.JsShortDate);
211			} else if (val)
212				rst = $.trim(val);
213			return rst;
214		};
215		if ($.isArray(value)) {
216			if (type & hct.Enum) {
217				if (type & (hct.Text | hct.Hidden | hct.Select)) {
218					var sum = 0;
219					$.each(value, function () { sum += $.parseInt(this); });
220					obj.val(sum);
221				} else if (type & hct.List)
222					$.each(value, function () {
223						obj.find("option[value=" + _toString(this) + "]").prop("selected", true);
224					});
225				else if (type & hct.Checkbox)
226					$.each(value, function () {
227						obj.filter("[value=" + _toString(this) + "]").prop("checked", true);
228					})
229				else
230					throw new __HtmlControlException({
231						"source": this, "args": arguments,
232						"message": "지원되지 않습니다."
233					});
234			} else if (type & hct.Array) {
235				if (type & (hct.Text | hct.Hidden)) {
236					var tmp = [];
237					$.each(value, function (idx, item) { tmp.push(_toString(item)); });
238					obj.val(tmp.join(this.data.separator));
239				} else if (type & hct.List)
240					$.each(value, function () {
241						obj.find("option[value=" + _toString(this) + "]").prop("selected", true);
242					});
243				else if (type & hct.Checkbox)
244					$.each(value, function () {
245						obj.filter("[value=" + _toString(this) + "]").prop("checked", true);
246					});
247				else
248					throw new __HtmlControlException({
249						"source": this, "args": arguments,
250						"message": "지원되지 않습니다."
251					});
252			} else
253				throw new __HtmlControlException({
254					"source": this, "args": arguments,
255					"message": "지원되지 않습니다."
256				});
257		} else {
258			if (type & (hct.Text | hct.Hidden))
259				obj.val(_toString(value));
260			else if (type & (hct.Select | hct.List)) {
261				obj.val(_toString(value));
262				if (obj.prop("selectedIndex") == -1) obj.prop("selectedIndex", 0);
263			} else if (type & hct.Radio)
264				obj.filter("[value=" + _toString(value) + "]").prop("checked", true);
265			else if (type & hct.Checkbox) {
266				var n = 0, v;
267				obj.prop("checked", false);
268				do {
269					v = Math.pow(2, n);
270					if (value & v) obj.filter("[value=" + _toString(v) + "]").prop("checked", true);
271				} while (Math.pow(2, n++) < value)
272			} else if (type & hct.Button) {
273				switch (obj.prop("tagName")) {
274					case "input":
275						obj.val(value);
276						break;
277					default:
278						obj.text(value);
279						break;
280				}
281			} else
282				throw new __HtmlControlException({
283					"source": this, "args": arguments,
284					"message": "지원되지 않습니다."
285				});
286		}
287	}
288};
289__HtmlControlBase.prototype.isValid = function () {
290	var rst, hct = HtmlControlType, obj = $(this.selector);
291	if (this.type & hct.Button)
292		rst = true;
293	else if (this.type & hct.Checkbox)
294		rst = obj.filter(":checked").length > 0;
295	else if (this.type & hct.Select)
296		rst = obj.prop("selectedIndex") > 0;
297	else if (this.type & hct.List)
298		rst = obj.find("option:selected").length > 0;
299	else if (this.type & hct.Number)
300		rst = this.val() != 0;
301	else if (this.type & hct.String)
302		rst = $.trim(obj.val()) != "";
303	else if (this.type & (hct.Json | hct.Date))
304		rst = this.val() != null;
305	else
306		rst = this.val() != "";
307	return rst;
308};
309__HtmlControlBase.prototype.bind = function () { };
310__HtmlControlBase.prototype.render = function () { };
311__HtmlControlBase.prototype.root = function (obj) {
312	if (obj === undefined) obj = this;
313	return obj && !obj.parent ? obj : this.root(obj.parent);
314};
315__HtmlControlBase.prototype.setData = function (data) {
316	this.data.items = data || [];
317};
318__HtmlControlBase.prototype.parents = function () {
319	var rst = this;
320
321	var arg = arguments[0];
322
323	if (typeof arg === "number") {
324		var depth = Math.abs(arg || 1);
325
326		for (var i = 0; i < depth; i++) {
327			rst = rst.parent || null;
328			if (rst === null) break;
329		}
330
331	} else if (typeof arg === "string") {
332		var name = arg;
333		if (this.parent) {
334			var obj = this.parent[name];
335			if (obj && obj instanceof __HtmlControlBase)
336				rst = obj;
337			else
338				rst = this.parent.parents(name);
339		} else
340			rst = null;
341	} else
342		rst = null;
343
344	return rst;
345};
346__HtmlControlBase.prototype.extend = function (obj) {
347	$.extend(true, this, obj);
348};
349var __HtmlControlException = function (json) {
350	this.source = null;
351	this.args = null;
352	this.message = "";
353	if (json) for (var key in json) this[key] = json[key];
354	return this;
355};
356
357__HtmlControlBase.prototype.nodes = function () {
358	let rst;
359	if (this.selector)
360		rst = Array.from(document.querySelectorAll(this.selector));
361	else
362		rst = [];
363	return rst;
364};
365__HtmlControlBase.prototype.node = function (index) {
366	index = index || 0;
367	const nodes = this.nodes();
368	return 0 <= index && index < nodes.length ? nodes[index] : null;
369};
370
371const HtmlObject = __HtmlControlBase;
372//]]>
373//</script>

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.