PageSourceSearch

https://ksen.co.kr/js/social.js

js ksen.co.kr collected 2026-10-06 12:07:44 UTC 8,462 bytes, 316 lines download raw bytes

1function openSocial(social, url, title, domain, sitename, desc, image, image_width, image_height)
2{
3	title = decodeURIComponent(title);
4	desc = decodeURIComponent(desc);
5	
6	if(social == "naverblog" && $("meta[property='naverblog:title']").attr("content"))
7	{
8		title = $("meta[property='naverblog:title']").attr("content");
9	}
10	else if($("meta[property='og:title']").attr("content"))
11	{
12		title = $("meta[property='og:title']").attr("content");
13	}
14
15	var o;
16    var _url = encodeURIComponent(url);
17    var _title = encodeURIComponent(title);
18    var _desc = encodeURIComponent(desc);
19    var _image = encodeURIComponent(image);
20    var _br  = encodeURIComponent('\r\n');
21	var prefix_title = title;
22	var prefix_title_kakaotalk = title;
23	if(sitename)
24	{
25		// 2023.09.07 by [email protected]
26		// 제목 매체명 제거 (og:title 에 제거)
27		// C : 50053
28		prefix_title = encodeURIComponent(title);
29		
30		/*
31		//2022.07.21 by [email protected]
32		// CS : 40970
33		if ( sitename == "팩트신문" )
34		{
35			prefix_title = encodeURIComponent(title);
36		}
37		else
38		{
39			prefix_title = encodeURIComponent("[" + sitename + "] " + title);
40			prefix_title_kakaotalk = "[" + sitename + "] " + title;
41		}
42		*/
43	}
44				//console.log(_image);
45	switch(social)
46	{
47        case 'facebook':
48            o = {
49                method:'popup',
50                url:"http://www.facebook.com/sharer/sharer.php?u=" + _url + "&v=1&t=" + prefix_title
51            };
52			ajaxUpdateSnsCount(social, url);
53            break;
54 
55        case 'twitter':
56            o = {
57                method:'popup',
58                url:"https://twitter.com/intent/tweet?source=webclient&text=" +  prefix_title + "&url=" + _url
59            };
60			ajaxUpdateSnsCount(social, url);
61            break;
62 
63        case 'me2day':
64            o = {
65                method:'popup',
66                url:'http://me2day.net/posts/new?new_post[body]=' + prefix_title + _br + _url + '&new_post[tags]=' + sitename
67            };
68			ajaxUpdateSnsCount(social, url);
69            break;
70
71		case "google+":
72            o = {
73                method:'popup',
74                url:"https://plus.google.com/share?url=" + _url
75            };
76			ajaxUpdateSnsCount(social, url);
77			break; 
78
79		case "kakaostory" :
80
81			if(navigator.userAgent.match(/android/i) || navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i))
82			{
83                Kakao.Story.share({
84                    url: url,
85                    text: prefix_title_kakaotalk
86                });
87				return false;
88			}
89			else
90			{
91				o = {
92					method:'popup',
93					url:"https://story.kakao.com/share?cmd=blank&url=" + _url
94				};
95			}
96			ajaxUpdateSnsCount(social, url);
97			break;
98
99		case 'kakaotalk':
100            sendLink(prefix_title_kakaotalk, image, url);
101            ajaxUpdateSnsCount(social, url);
102			break;
103
104		case 'band':
105
106			if(navigator.userAgent.match(/android/i) || navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i))
107			{
108				o = {
109					method:'web2app',
110					param:'create/post?text=' + prefix_title + _br + _url,
111					a_store:'itms-apps://itunes.apple.com/app/id542613198?mt=8',
112					g_store:'market://details?id=com.nhn.android.band',
113					a_proto:'bandapp://',
114					g_proto:'scheme=bandapp;package=com.nhn.android.band'
115				};
116			}
117			else
118			{
119				o = {
120					method:'popup',
121					url:"http://www.band.us/plugin/share?body=" + prefix_title + "%0D%0A" + _url + "&route=" + domain
122				};
123			}
124			ajaxUpdateSnsCount(social, url);
125			break;
126
127		case 'line':
128
129			if(navigator.userAgent.match(/android/i) || navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i))
130			{
131				o = {
132					method:'popup',
133					url:"http://line.me/R/msg/text/?" + prefix_title + "%0D%0A" + _url
134				};
135				ajaxUpdateSnsCount(social, url);
136			}
137			else
138			{
139				alert('이 기능은 모바일에서만 사용할 수 있습니다.');
140				return false;
141			}
142			break;
143
144        case 'naverblog':
145            o = {
146                method:'popup',
147                url:"http://blog.naver.com/LinkShare.nhn?url=" + _url + "&title=" + prefix_title
148            };
149			ajaxUpdateSnsCount(social, url);
150            break;
151 
152        case 'navershare':
153            o = {
154                method:'popup',
155                url:"http://share.naver.com/web/shareView.nhn?url=" + _url + "&title=" + prefix_title
156            };
157			ajaxUpdateSnsCount(social, url);
158            break;
159        case 'disco':
160            if (navigator.userAgent.match(/android/i) || navigator.userAgent.match(/(i
160phone)|(ipod)|(ipad)/i)) {
161                o = {
162                    method: 'popup',
163                    url: "https://m.disco.me/share?p__g=i__n&url=" + _url
164                }
165            }
166            ajaxUpdateSnsCount(social, url);
167            break;
168		
169		case 'sms' :
170			if (navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)) {
171                location.href = "sms:&body=" + _title + '\r\n' + _url;               
172            } else {
173                location.href = "sms:?body=" +  _title + '\r\n' + _url;
174            }		
175			break;
176		case 'weibo' :
177			o = {
178                method:'popup',
179                url:"http://service.weibo.com/share/share.php?url=" + _url + "&title=" + prefix_title
180            };
181			ajaxUpdateSnsCount(social, url);
182			break;
183		case 'blogger':
184            o = {
185                method:'popup',
186                url:"https://www.blogger.com/blog-this.g?u=" + _url + "&n=" + prefix_title
187            };
188			ajaxUpdateSnsCount(social, url);
189            break;
190
191		default:
192
193			alert('지원하지 않는 SNS입니다.');
194			return false;
195	}
196	if (social != 'kakaotalk') {
197		switch(o.method)
198		{
199			case 'popup':
200
201				if(social == "naverblog")
202				{
203					window.open(o.url,'window_social',"width=500px,height=560px,toolbars=no,scrollbars=yes")
204				}
205				else
206				{
207					window.open(o.url,'window_social',"width=640px,height=640px,toolbars=no,scrollbars=yes")
208				}
209				break;
210
211			case 'web2app':
212				if(navigator.userAgent.match(/android/i))
213				{
214					// Android
215					setTimeout(function(){ location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end'}, 100);
216				}
217				else if(navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i))
218				{
219					// Apple
220					setTimeout(function(){ location.href = o.a_store; }, 200);
221					setTimeout(function(){ location.href = o.a_proto + o.param }, 100);
222				}
223				else
224				{
225					alert('이 기능은 모바일에서만 사용할 수 있습니다.');
226				}
227				break;
228		}
229	}
230}
231function sendLink(prefix_title_kakaotalk, image, url) {
232    Kakao.Link.sendDefault({
233        objectType: 'feed',
234        content: {
235            title: prefix_title_kakaotalk + '\r\n' + url,
236            description: '',
237            imageUrl: image,
238            link: {
239                mobileWebUrl: encodeURI(url),
240                webUrl: encodeURI(url)
241            }
242        }
243    });
244}
245
246
247function CenterWin(url,winname,features) 
248{ 
249	features = features.toLowerCase(); 
250	len = features.length; 
251	sumchar= ""; 
252	
253	for (i=1; i <= len; i++) // 빈칸 제거 
254	{ 
255		onechar = features.substr(i-1, 1); 
256		if (onechar != " ") sumchar += onechar; 
257	} 
258	
259	features = sumchar; 
260	sp = new Array(); 
261	sp = features.split(',', 10); // 배열에 옵션을 분리해서 입력 
262	splen = sp.length; // 배열 갯수 
263	
264	for (i=0; i < splen; i++) // width, height 값을 구하기 위한 부분 
265	{ 
266		if (sp[i].indexOf("width=") == 0) // width 값일때 
267		{ 
268			width = Number(sp[i].substring(6)); 
269		}
270		else if (sp[i].indexOf("height=") == 0) // height 값일때 
271		{ 
272			height = Number(sp[i].substring(7)); 
273		} 
274	} 
275	
276	sleft = (screen.width - width) / 2; 
277	stop = (screen.height - height) / 2; 
278	features = features + ",left=" + sleft + ",top=" + stop; 
279	popwin = window.open(url,winname,features); 
280} 
281
282function send_note()
283{
284	var msg = document.title;
285	var meta;
286	if (document.getElementsByTagName) {
287		meta = document.getElementsByTagName('meta');
288		for (var i=0; i<meta.length; i++){
289			if(meta.item(i).getAttribute('name') == "nate-note"){
290				msg = meta.item(i).getAttribute('content');
291				break;
292			}
293		}
294	}
295	var url = "http://api.nateon.nate.com/web/note/SendNote.do?msg="+encodeURIComponent(msg)+"&lurl=<%$head.sns_url_enc%>";
296	window.open(url);
297}
298
299
300function ajaxUpdateSnsCount(social, url)
301{
302	$.ajax({
303		url: '/news/ajax.php',
304		data:  {'mode' :  'update_sns_count', 'social' : social, 'url' : url},
305		dataType: 'json',
306		type:'POST',
307		error: function(error) {
308			console.log(error); 
309			return; 
310		},
311		success: function(data){
312
313			console.log('success');
314		},
315	});
316}

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.