PageSourceSearch

https://www.edaily.co.kr/common/lib/sns.share.js

js edaily.co.kr collected 2026-10-01 08:52:49 UTC 8,733 bytes, 293 lines download raw bytes

1
2//ÇöÀç URL
3var redirectUrl = document.location.href;
4
5
6//°øÀ¯Çϱâ
7function SnsShare(sns, url, txt, img) {
8  //sns : snsÁ¾·ù
9  //url : 񃯇 url
10  //txt : ±â»ç Á¦¸ñ
11
12    var o;
13    //var url = "http://www.edaily.co.kr/news/contents/ReadPage/SnsReply/commentShare.asp?cseq=" + cseq;
14    //var url = "/member/login.html";
15    
16    if(typeof url== 'undefined' || url == null){
17    		url = location.href;
18    }
19    if(sns =='fb'){    	
20//	    	if(url.indexOf('/news_detail.html?')>0){
21//	    		url = url.substring(url.indexOf('?'));
22//	    		url = 'http://m.edaily.co.kr/news/news_detail.asp'+url;
23//	    	}
24    }
25    
26    // http://v2.m.edaily.co.kr  >>>> ¼­ºñ½º µµ¸ÞÀÎÀ¸·Î º¯°æ
27    url = url.replace('http://local.edaily.co.kr',getDomain());
28    url = url.replace('http://v2.m.edaily.co.kr',getDomain());
29    if(url.indexOf('http')!=0){
30    		url = getDomain() + url;
31    }
32    
33    if(typeof txt == 'undefined' || txt == null || txt == ''){
34		txt = $('.dev_share_title').eq(0).text();
35		if(txt == ""){
36			txt = $('.tit').eq(0).text();
37		}
38    }
39    
40
41    if(typeof img == 'undefined'){
42    		img = getMetatag('property','og:image','content');
43    		if((img+'') == '' || (img+'') == 'null'){
44    		  	img = undefined;
45    		}
46    		if(typeof img == 'undefined'){
47	    		if(location.href.indexOf('/news/news_detail')>0){
48	    			img = $('.article_body').find('img').eq(0).attr('src');
49	    		}else if(location.href.indexOf('/news/photo_detail')>0){
50	    			img = $('.photo_list').find('img').eq(0).attr('src');
51	    		}	
52    		}
53    }
54    if((img+'') == '' || (img+'') == 'null'){
55	  	img = undefined;
56	}
57    
58    
59    if(url.indexOf(getDomain())<0){
60    		//url = getDomain()+url;
61    }
62    var _url = encodeURIComponent(url);
63    var _txt = encodeURIComponent(txt);
64    var _img = encodeURIComponent(img);
65    var _br = encodeURIComponent('\r\n');
66
67    switch (sns) {
68        case 'fb':
69            o = {
70        			type:'facebook',
71    				method: 'popup',
72                url: 'http://www.facebook.com/sharer/sharer.php?u=' + _url 
73            };
74            break;
75
76        case 'tw':
77            o = {
78        			type:'twitter',
79    				method: 'popup',
80                url: 'http://twitter.com/intent/tweet?text=' + _txt + '&url=' + _url + '&original_referer='+_url
81            };
82            break;
83
84        case 'kas':
85            o = {
86        			type:'kas',
87    				method: 'popup',
88                url: 'https://story.kakao.com/share?url=' + _url +'&text=' + _txt + _br
89            };
90            break;
91        case 'kakao':
92            o = {
93        			type:'kakao',
94    				method: 'popup',
95    				text : _txt, 
96                url: _url,
97                img: _img
98            };
99            break;            
100
101        case 'band':
102            o = {
103        			type:'band',
104        			method: 'popup',
105                url: 'http://www.band.us/plugin/share?body=' + _txt + _br + _url + "&route=http://www.edaily.co.kr"
106            };
107            break;
108        case 'gplus':
109            o = {
110        			type:'gplus',
111        			method: 'popup',
112                url: "https://plus.google.com/share?url=" + _url + "&t=" + _txt
113            };
114            break;
115        case 'line':
116            o = {
117        			type:'line',
118        			method: 'popup',
119                url: "http://line.me/R/msg/text/?" + _txt + _br + _url
120            };
121            break;
122            
123            
124        case 'mail':
125        	
126        	
127        	
128        	break;
129                    
130        default:
131            alert('Áö¿øÇÏÁö ¾Ê´Â SNSÀÔ´Ï´Ù.');
132            return false;
133    }
134
135    switch (o.method) {
136        case 'popup':{
137        		if(o.type=='kakao'){
138        			sendKakaoTalk(txt,url,img);
139        		}else{
140        		    if (comGlo_userTerminal == "app") {
141        		        app_browserOpen(o.url);
142        		    } else {
143        		        window.open(o.url,o.type);
144        		    }       			
145        		}
146        }break;
147
148        case 'web2app':
149            if (navigator.userAgent.match(/android/i)) {
150                // Android
151                setTimeout(function () { location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end' }, 100);
152            }
153            else if (navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)) {
154                // Apple
155                setTimeout(function () { location.href = o.a_store; }, 200);
156                setTimeout(function () { location.href = o.a_proto + o.param }, 100);
157            }
158            else {
159                alert('ÀÌ ±â´ÉÀº ¸ð¹ÙÀÏ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.');
160            }
161            break;
162    }
163}
164
165
166function sendSns(sns, url, txt, img)
167{
168    var o;
169    var _url = encodeURIComponent(url);
170    var _txt = encodeURIComponent(txt);
171    var _img = encodeURIComponent(img);
172    var _br  = encodeURIComponent('\r\n');
173
174    switch(sns)
175    {
176        case 'facebook':
177            o = {
178                method:'popup',
179                url:'http://www.facebook.com/sharer/sharer.php?u=' + _url
180            };
181            break;
182
183        case 'twitter':
184            o = {
185                method:'popup',
186                url:'http://twitter.com/intent/tweet?text=' + _txt + '&url=' + _url+'&original_referer='+_url
187            };
188            break;
189
190        case 'me2day':
191            o = {
192                method:'popup',
193                url:'http://me2day.net/posts/new?new_post[body]=' + _txt + _br + _url + '&new_post[tags]=epiloum'
194            };
195            break;
196
197        case 'kakaotalk':
198            o = {
199                method:'web2app',
200                param:'sendurl?msg=' + _txt + '&url=' + _url + '&type=link&apiver=2.0.1&appver=2.0&appid=dev.epiloum.net&appname=' + encodeURIComponent('Epiloum °³¹ß³ëÆ®'),
201                a_store:'itms-apps://itunes.apple.com/app/id362057947?mt=8',
202                g_store:'market://details?id=com.kakao.talk',
203                a_proto:'kakaolink://',
204                g_proto:'scheme=kakaolink;package=com.kakao.talk'
205            };
206            break;
207
208        case 'kakaostory':
209            o = {
210                method:'web2app',
211                param:'posting?post=' + _txt + _br + _url + '&apiver=1.0&appver=2.0&appid=dev.epiloum.net&appname=' + encodeURIComponent('Epiloum °³¹ß³ëÆ®'),
212                a_store:'itms-apps://itunes.apple.com/app/id486244601?mt=8',
213                g_store:'market://details?id=com.kakao.story',
214                a_proto:'storylink://',
215                g_proto:'scheme=kakaolink;package=com.kakao.story'
216            };
217            break;
218
219        case 'band':
220            o = {
221                method:'web2app',
222                param:'create/post?text=' + _txt + _br + _url,
223                a_store:'itms-apps://itunes.apple.com/app/id542613198?mt=8',
224                g_store:'market://details?id=com.nhn.android.band',
225                a_proto:'bandapp://',
226                g_proto:'scheme=bandapp;package=com.nhn.android.band'
227            };
228            break;
229
230        default:
231            alert('Áö¿øÇÏÁö ¾Ê´Â SNSÀÔ´Ï´Ù.');
232            return false;
233    }
234
235    switch(o.method)
236    {
237        case 'popup':
238            window.open(o.url);
239            break;
240
241        case 'web2app':
242            if(navigator.userAgent.match(/android/i))
243            {
244                // Android
245                setTimeout(function(){ location.href = 'intent://' + o.param + '#Intent;' + o.g_proto + ';end'}, 100);
246            }
247            else if(navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i))
248            {
249                // Apple
250                setTimeout(function(){ location.href = o.a_store; }, 200);
251                setTimeout(function(){ location.href = o.a_proto + o.param }, 100);
252            }
253            else
254            {
255                alert('ÀÌ ±â´ÉÀº ¸ð¹ÙÀÏ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.');
256            }
257            break;
258    }
259}
260
261// īī¿ÀÅå(¸µÅ©) °øÀ¯Çϱâ
262function sendKakaoTalk(title, url, image){
263	try{		
264		Kakao.cleanup();
265		Kakao.init('26c06f7d38662735d3fcccb3fd57afcd');
266		if(typeof image == 'undefined'){
267			Kakao.Link.sendTalkLink({
268				label: title,
269				webButton: {
270					text: '¹Ù·Îº¸±â',
271					url: url // ¾Û ¼³Á¤ÀÇ À¥ Ç÷§Æû¿¡ µî·ÏÇÑ µµ¸ÞÀÎÀÇ URLÀ̾î¾ß ÇÕ´Ï´Ù.
272				}
273			});				
274		}else{
275			Kakao.Link.sendTalkLink({
276				label: title,
277				image: {
278					src: image,
279					width: '300',
280					height: '200'
281				},
282				webButton: {
283					text: '¹Ù·Îº¸±â',
284					url: url // ¾Û ¼³Á¤ÀÇ À¥ Ç÷§Æû¿¡ µî·ÏÇÑ µµ¸ÞÀÎÀÇ URLÀ̾î¾ß ÇÕ´Ï´Ù.
285				}
286			});			
287		}
288
289	}catch(e){
290		
291	}
292}
293

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.