PageSourceSearch

https://www.newsis.com/assets/js/js.js

js newsis.com collected 2026-09-24 08:38:45 UTC 17,354 bytes, 536 lines download raw bytes

1
2	function shuffle(array) {
3		var currentIndex = array.length, temporaryValue, randomIndex;
4			while (0 !== currentIndex) {
5			randomIndex = Math.floor(Math.random() * currentIndex);
6			currentIndex -= 1;
7			temporaryValue = array[currentIndex];
8			array[currentIndex] = array[randomIndex];
9			array[randomIndex] = temporaryValue;
10		}
11		return array;
12	}
13
14	function base_img_url(str){
15		return str.replace('http://image.newsis.com', 'https://image.newsis.com');
16	}
17    
18    function base_secure_img_url_view(str){
19        return str.replace('http://image.newsis.com', 'https://img1.newsis.com');
20    }
21
22	function transferTime(time){
23		 var now = new Date();
24		 var sYear = time.substring(0,4);
25		 var sMonth = time.substring(4,6)-1;
26		 var sDate = time.substring(6,8);
27		 var sHour = time.substring(8,10);
28		 var sMin = time.substring(10,12);
29		 var sSecond = time.substring(12,14);
30		 var sc = 1000;
31		 var today = new Date(sYear,sMonth,sDate,sHour,sMin,sSecond);
32		 //지나간 초
33		 var pastSecond = Math.floor((now-today)/sc);
34		 var date,hour,min;
35		 var str = "";
36		 var restSecond = 0;
37		 if(pastSecond > 86400){
38			  date = Math.floor(pastSecond / 86400);
39			  restSecond = pastSecond % 86400;
40			  //if(restSecond > 0) date++;
41			  str = date + "일 전";
42		 }else if(pastSecond > 3600){
43			  hour = Math.floor(pastSecond / 3600);
44			  restSecond = pastSecond % 3600;
45			  //if(restSecond > 0) hour++;
46			  str = hour + "시간 전";
47		 }else if(pastSecond > 60){
48			  min = Math.floor(pastSecond / 60);
49			  restSecond = pastSecond % 60;
50			  //if(restSecond > 0) min++;
51			  str = min + "분 전";	
52		 }else{
53			  str = pastSecond + "초 전";
54		 }
55			 return str;
56	}
57
58	//테마포토 팝업
59	function fn_openpop(tid, sscid, eventflag){
60			
61			if(eventflag){
62				eventflag	=	'&eflag=' + eventflag;
63			}else{
64				eventflag	=	'';
65			}
66			
67			var p_pop_w	=	'1124';
68			var p_pop_h	=	'830';
69		if(getCookie('photopop_flag') == 'close' || !getCookie('photopop_flag')){
70				p_pop_w	=	'836';
71				p_pop_h	=	'830';
72		}
73
74        if(tid == 'T20200316_0000003071' || tid == 'T20200415_0000003162'){
75			var p_pop_w	=	'985';
76			var p_pop_h	=	'830';
77			if(getCookie('photopop_flag') == 'close' || !getCookie('photopop_flag')){
78					p_pop_w	=	'680';
79					p_pop_h	=	'830';
80			}
81            newsisPop('/pho/pop?type=the&tid='+ tid +'&cid=pho&sscid='+ sscid + eventflag,'',p_pop_w,p_pop_h,'100','100');
82        }else{
83            newsisPop('/pho/pop?type=the&tid='+ tid +'&cid=pho&sscid='+ sscid + eventflag,'',p_pop_w,p_pop_h,'100','100');
84        }
85	}
86	
87	//테마포토 팝업(이벤트용)
88	function fn_openpop2(tid, sscid){
89		// console.log('test');
90			var p_pop_w	=	'998';
91			var p_pop_h	=	'830';
92		if(getCookie('photopop_flag') == 'close' || !getCookie('photopop_flag')){
93				p_pop_w	=	'690';
94				p_pop_h	=	'830';
95		}
96
97        if(tid == 'T20200316_0000003071' || tid == 'T20200415_0000003162'){
98			var p_pop_w	=	'985';
99			var p_pop_h	=	'830';
100			if(getCookie('photopop_flag') == 'close' || !getCookie('photopop_flag')){
101					p_pop_w	=	'680';
102					p_pop_h	=	'830';
103			}
104            newsisPop('/pho/pop/event.php?type=the&tid='+ tid +'&cid=pho&sscid='+ sscid,'',p_pop_w,p_pop_h,'100','100');
105        }else{
106            newsisPop('/pho/pop/event.php?type=the&tid='+ tid +'&cid=pho&sscid='+ sscid,'',p_pop_w,p_pop_h,'100','100');
107        }
108	}
109	
110	var getParam = function(key){
111	var _parammap = {};
112		document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
113			function decode(s) {
114				return decodeURIComponent(s.split("+").join(" "));
115			}
116			_parammap[decode(arguments[1])] = decode(arguments[2]);
117		});
118			return _parammap[key];
119		};
120	function setCookie(name,value,expiredays) {
121		var todayDate = new Date();
122		todayDate.setDate(todayDate.getDate() + expiredays);
123		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
124	}
125
126	function getCookie(cname) {
127		var name = cname + "=";
128		var ca = document.cookie.split(';');
129		for(var i=0; i<ca.length; i++) {
130			var c = ca[i];
131			while (c.charAt(0)==' ') c = c.substring(1);
132			if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
133		}
134		return "";
135	}
136
137	function openWin(url, link, width, height, cmp_id, cnt){  
138	//	console.log(url);
139	//	console.log(link);
140	//	console.log(cnt);
141		//if(!url){return false;}
142		if(getCookie(cmp_id) != "done"){
143		 var imgTmp = new Image(); 
144		 w = width; 
145		 h = parseInt(height) + parseInt(28);
146		LeftPosition=(screen.width-w)/2;
147		TopPosition=(screen.height-h)/2;
148			//for(var i = 0; i < cnt; i ++){
149				//console.log(i);
150				//console.log(cmp_id);
151			  var pop  = window.open("",cmp_id,"width="+width+",height="+h+",status=no,toolbar=no,scrollbars=yes,resizable=no, top="+TopPosition+", left="+LeftPosition+""); 
152
153			  if(!link){
154				var alink =  url;
155			  }else{
156				var alink = '<a href="'+link+'">'+ url +'</a>';
157			  }	
158
159			  pop.document.write('<html><script type="text/javascript" src="/assets/js/jquery-1.11.1.min.js"></script><script src="/assets/js/ad_js.js?pub_dt=202009071030"></script><script type="text/javascript" src="/assets/js/js.js"></script><title>ad</title>' 
160			  +'<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 menubar=no>' 
161			  + alink  
162			  +'<table width="'+width +'" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="2b5e6b"><table width="100%" height="20" border="0" cellpadding="0" cellspacing="0" bgcolor="354fc1"><form name="checkClose"><tbody><tr><td width="75%" align="right"><input type="checkbox" name="ncook25" onclick="closeWin(\''+cmp_id+'\');" ><img src="//image.newsis.com/new_www/homepage/n_txt_busan.gif" width="118" height="22" align="absmiddle"></td><td align="right"><a href="javascript:closeWin(\''+cmp_id+'\')"><img src="//image.newsis.com/new_www/homepage/n_btn_close_busan.gif" width="58" height="22" border="0"></a></td></tr></tbody></table></td></tr></form></table></body></html>'); 
163			//}
164
165		}
166	}
167	function closeWin(cmp_id){
168		if(document.checkClose.ncook25.checked == true) {
169		  setCookie(cmp_id, "done" ,1);
170		}
171		self.close();
172	}
173
174	function new_logopop(){
175		
176		var now = new Date();
177		var month = now.getMonth()+1;
178		if((month+"").length < 2){
179			month="0"+month;      
180		}
181		var day = now.getDate();
182		if((day+"").length < 2){
183			day="0"+day;      
184		}
185		var year = now.getFullYear();
186		var h = now.getHours();
187		if((h+"").length < 2){
188			h="0"+h;      
189		}
190		var m = now.getMinutes();
191		if((m+"").length < 2){
192			m="0"+m;      
193		}
194
195		var target = year + '-' + month + '-' + day + ' ' + h + ':' + m;
196		var newimgurl = "//image.newsis.com/new_www/homepage/20200123_newyear_logo.gif";
197
198		//console.log(target);
199		//if(target >= "2018-12-31 10:05" && target <= "2019-01-01 23:59"){
200
201		if(target >= "2020-01-23 00:00" && target <= "2020-01-27 23:59"){
202		//if(target >= "2020-01-22 00:00" && target <= "2020-02-27 23:59"){
203			$(".bxcn1 .logobx .logo img").attr("src", newimgurl);
204			//$(".logobx .logo").css("margin-top", "20px")
205		}
206	}
207	
208	//sns
209
210	function openSNSWin(openUrl){
211		var winObj;
212		winObj = window.open(openUrl,"sendNewsWin","width=600, height=800, resizable=no, scrollbars=yes, status=no");
213	}
214
215	Kakao.init('342aaac21063e0d615fffc669603df88');
216	Kakao.isInitialized();
217	function snsSend(media, type, flag){
218        
219        if(flag == undefined){
220            flag = '';
221        }
222        
223        let sns_title_obj   = document.querySelector('meta[property="og:title"]');
224        let sns_url_obj     = document.querySelector('meta[property="og:url"]');
225        let sns_image_obj   = document.querySelector('meta[property="og:image"]');
226        
227        let sns_title       =   '';
228        let sns_url         =   '';
229        let sns_image       =   '';
230        if(sns_title_obj == null){
231        }else{
232            sns_title           =   sns_title_obj.content;
233        }
234        if(sns_url_obj == null){
235        }else{
236            sns_url             =   sns_url_obj.content;
237        }
238        if(sns_image_obj == null){
239        }else{
240            sns_image           =   sns_image_obj.content;
241        }
242        
243        if(sns_url.length > 0){
244            let sns_sendUrl = '';
245            switch(media) 
246            {
247                case "twitter":
248                    sns_sendUrl = "http://twitter.com/intent/tweet?text=" 
249                    + encodeURIComponent(sns_title) 
250                    + "+"
251                    + encodeURIComponent(sns_url) ;
252                break;
253
254                case "facebook":
255                    sns_sendUrl = "http://www.facebook.com/sharer.php?"
256                    + "u="+ encodeURIComponent(sns_url) 
257                    + "&t=" + encodeURIComponent(sns_title);
258                break;
259
260                case "kakao":
261                     Kakao.Link.sendDefault({
262                        objectType: 'feed',
263                        content: {
264                            title: sns_title,
265                            description: '',
266                            imageUrl: sns_image,
267                            link: {
268                                mobileWebUrl: sns_url,
269                                webUrl: sns_url
270                            }
271                        },
272                        buttons: [
273                            {
274                                title: '기사보기',
275                                link: {
276                                    mobileWebUrl: sns_url,
277                                    webUrl: sns_url
278                                }
279                            }
280                        ]
281                    });
282                break;
283                
284                case "kakaostory":
285                        sns_sendUrl = "https://story.kakao.com/share?"
286                        + "url="+ encodeURIComponent(sns_url);
287                break;
288
289                case "naver":
290                    sns_sendUrl = encodeURI("http://blog.naver.com/openapi/share?url=" + sns_url + "&title=") + encodeURIComponent(sns_title) + "";
291                break;
292            }
293            
294            if ( sns_sendUrl != '' ) openSNSWin(sns_sendUrl);
295        }
296		return false;
297	}	
298	
299		
300	function fn_view_font(flag, type){
301		min_flag	=	12
302		max_flag	=	20
303			
304		if(type == 'gra'){
305			var $contents = $('.txt');
306			min_flag	=	10
307			max_flag	=	18
308		}else if(type == 'msi'){
309			var $contents = $('.article_bx');
310		}else if(type == 'theme'){
311			var $contents = $('#ajax_body');
312		}else{
313			var $contents = $('article');
314		}
315		 var fontSize = $contents.css('fontSize'); //alert(fontSize);
316		 var num = parseFloat(fontSize, 10); 
317		 var unit = fontSize.slice(-2);
318			
319		if(flag == 'p'){
320		  num += 2;
321		}else if(flag == 'm'){
322		  num -= 2;
323		}
324		if(num < min_flag){
325			alert('본문최소크기입니다');
326			return false;
327		}else if(num > max_flag){
328			alert('본문최대크기입니다');
329			return false;
330		}
331		$contents.css('fontSize', num + unit);
332	}
333	
334	/********************************
335	** 검색
336	********************************/
337	function search(e, args){
338		if(args == undefined){
339			args	=	'';
340		}
341		var form_name	=	'search_form';
342		var val_name	=	'search_val';
343		
344		if(args == 'main'){
345			form_name	=	'search_form_'+args;
346			val_name	=	'search_val';
347		}
348		
349		if(document.forms[form_name].elements[val_name].length < 2){
350			alert('검색하려는 단어가 너무 짧습니다. 두자이상으로 검색해주세요.');
351			e.preventDefault();
352			return false;
353		}else{
354			$search_form = $('form#'+form_name);
355			$search_form.attr({
356				  action:'/search/'
357				, method:'post'
358			}).submit();
359		}
360	}
361	
362	function jogun_search(t, catg, listtype, p, e ){
363		//if(e.hasOwnProperty('preventDefault')){
364			e.preventDefault();
365		//}
366		if(document.search_jogun_form.search_val.value.length < 2){
367			if(document.search_jogun_form.search_val.value.length == 0){
368				alert('검색어를 입력하세요');
369			}else{
370				alert('검색하려는 단어가 너무 짧습니다. 두자이상으로 검색해주세요.');
371			}
372			return false;
373		}else{
374			var search_val 			= encodeURI(encodeURIComponent($("#search_val").val()));
375			var hidden_search_sort 	= $("#hidden_search_sort").val();
376			var hidden_search_jogun = $("#hidden_search_jogun").val();
377			var hidden_search_bun 	= $("#hidden_search_bun").val();
378			var hidden_search_term 	= $("#hidden_search_term").val();
379			var search_yn 			= $("#search_yn").val();
380			var detailSdate1 		= $("#detailSdate1").val();
381			var detailEdate2 		= $("#detailEdate2").val();
382
383			var params 				= $("#search_jogun_form").serialize();
384			
385			var counter = 0, // counter for checked checkboxes
386				i = 0,       // loop variable
387				url = '',    // final url string
388				// get a collection of objects with the specified 'input' TAGNAME
389				input_obj = document.getElementsByName('catg[]');
390			// loop through all collected objects
391
392			for (i = 0; i < input_obj.length; i++) {
393				// if input object is checkbox and checkbox is checked then ...
394				if (input_obj[i].type === 'checkbox' && input_obj[i].checked === true) {
395					// ... increase counter and concatenate checkbox value to the url string
396					counter++;
397					url = url + '&c[]=' + input_obj[i].value;
398				}
399			}
400			// display url string or message if there is no checked checkboxes
401			if (counter > 0) {
402				// remove first "&" from the generated url string
403				url = url.substr(1);
404				// display final url string
405				// or you can send checkbox values
406				// window.location.href = 'my_page.php?' + url; 
407			}
408			
409			if(!p ||  p < 0) p =1;
410			
411			var base_sch_rul  =  "?val=" + search_val + "&sort=" + hidden_search_sort + "&jo=" + hidden_search_jogun + "&bun=" + hidden_search_bun + "&sdate=" + detailSdate1 + "&term=" + hidden_search_term + "&edate=" + 
412								detailEdate2 + "&s_yn=Y&catg="+t+"&t=" + t + "&page=" + p + "&" + url;
413
414			var place = "/search/";
415			location.href = place + base_sch_rul;
416		}
417	}
418	
419	/********************************
420	** fooer 링크
421	********************************/
422
423	function intro_popup(pgv1, pgv2){
424		var itf = document.intro_form;
425		var url = '/company/';
426		var ntf 		=	window.open('','newsis_intro');   
427		 
428		itf.action 			= url; 
429		itf.target 			= 'newsis_intro';
430		itf.page.value 		= pgv1;
431		itf.sub_page.value 	= pgv2;   
432		itf.submit();
433		
434		ntf.focus();
435	}
436	
437	function checkDDay(date, getid, dflag){
438        var Dday = new Date(date.replace(/-/g, "/"));
439        Dday.setHours(0, 0, 0, 0);
440        
441        var now = new Date();
442        now.setHours(0, 0, 0, 0);
443
444		var gap = now.getTime() - Dday.getTime();
445		var result = Math.floor(gap / (1000 * 60 * 60 * 24)) * -1;
446		
447		if(!dflag){
448			if(result < 0){
449				result		=	'<span>' + ' + ' + '</span> ' + (result * -1).toString();
450			}else{
451				result		=	'<span>' + ' - ' + '</span> '  +  result.toString();
452			}
453			
454			$('#'+getid).html(result);
455		}else{
456			dflag	=	dflag.toUpperCase() ;
457			if(dflag == 'G'){
458				spantg_s	=	'';
459				spantg_e	=	'';
460				bugo_flag	=	'';
461				bugo_flag_plus	=	'+';
462				bugo_flag_minu	=	'-';
463				dflag			=	'D';
464			}else{
465				spantg_s		=	'';
466				spantg_e		=	'';
467				bugo_flag_plus	=	' + ';
468				bugo_flag_minu	=	' - ';
469			}
470			if(result < 0){
471				result		=	bugo_flag_plus + spantg_s + (result * -1).toString() + spantg_e;
472			}else{
473				result		=	bugo_flag_minu + spantg_s + result.toString() + spantg_e;
474			}
475			
476			$('#'+getid).html(dflag + result);
477		}
478	}
479	
480	function fix_checkDDay(date, getid, dflag){
481		
482		var Dday = new Date(date);
483		var now = new Date();                    // 현재(오늘) 날짜를 받아온다.
484
485		var gap = now.getTime() - Dday.getTime();    // 현재 날짜에서 D-day의 차이를 구한다.
486		var result = Math.floor(gap / (1000 * 60 * 60 * 24)) * -1;    // gap을 일
487		
488		if(!dflag){
489			// result		=	result.toString();
490			if(result < 0){
491				//result 	=	result * -1;
492				result		=	'<span>' + ' + ' + '</span> ' + (result * -1).toString();
493			}else{
494				result		=	'<span>' + ' - ' + '</span> '  +  result.toString();
495			}
496			
497			$('#'+getid).html(result);
498		}else{
499			dflag	=	dflag.toUpperCase() ;
500			spantg_s		=	'<span>';
501			spantg_e		=	'</span>';
502			bugo_flag_plus	=	' +';
503			bugo_flag_minu	=	' -';
504
505			if(result < 0){
506				result		=	spantg_s	+	dflag 	+	bugo_flag_plus  +	spantg_e	+	' ' + (result * -1).toString();
507			}else{
508				result		=	spantg_s	+	dflag	+	bugo_flag_minu 	+ 	spantg_e 	+ ' ' + result.toString();
509			}
510			
511			$('#'+getid).html(result);
512		}
513	}
514	
515	function fn_url_copy(val){
516		const t = document.createElement("textarea");
517		document.body.appendChild(t);
518		t.value = val;
519		t.select();
520		document.execCommand('copy');
521		document.body.removeChild(t);
522	}
523	
524	function addChannel() {
525		Kakao.Channel.addChannel({
526		  channelPublicId: '_iRxblK',
527		})
528	}
529	
530	function pic_imginfo_long(obj){
531		var pic_obj_width	=	obj.width;
532		var pic_obj_height	=	obj.height;
533		if(pic_obj_width < pic_obj_height){
534			$(obj).parent().addClass('coverH-long');
535		}
536	}

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.