PageSourceSearch

https://letsymca.or.kr/js/thinktree.sns.js?latest=Mon%20Oct%2005%2016:48:47%20KST%202026

js letsymca.or.kr collected 2026-10-05 07:52:49 UTC 15,022 bytes, 555 lines download raw bytes

1/****************************************************************************************************
2 *
3 *									THINK-TREE SNS Library
4 *
5 * author			: hk-cho
6 * available sns	: instagram, facebook, kakaotalk, Naver, Twitter, Line
7 * last-update		: 2017.02.20
8 * neccesary		: jQuery
9 ****************************************************************************************************/
10
11var ttSns = {};
12var _kakao = '';
13
14/**
15 * Instagram
16 * https://www.instagram.com/developer/
17 */
18/**
19 * Get Token
20 *  www.instagram.com/developer > Manage Clients > Security Tab > Disable implicit OAuth un check > redirect URIs 
21 *  https://api.instagram.com/oauth/authorize/?client_id=9557e1234541e59505de0872d66fbb&redirect_uri=http://XXXX &response_type=token 
22 */
23/*ttSns.Instagram = function(accessToken) {
24	var _at				= accessToken;
25	var access_param	= {};
26
27	var _ins = this;
28
29	_ins.setAccessToken = function(accessToken){
30		_at = accessToken;
31	}
32
33	// access_token에 설정된 사용자의 사진 리스트를 조회합니다.
34	_ins.getPhotoList = function(count, successCallback, errorCallback) {
35		if(!accesTokenIsExist()) throw '[tt.sns] 엑세스 토큰이 존재하지 않습니다.';
36		_callPhotoList(count, successCallback, errorCallback);
37	}
38	
39	// access_token에 설정된 사용자의 사진 리스트를 조회합니다
40	// next page 정보가 필요합니다.
41	_ins.getPage = function(listSize, maxNextId, successCallback, errorCallback) {
42		if(!accesTokenIsExist()) {
43			throw '[tt.sns] 엑세스 토큰이 존재하지 않습니다.';
44		}
45		_callPage(listSize, maxNextId, successCallback, errorCallback);
46	}
47
48	return init();
49
50	*//** PRIVATE **//*
51
52	// 초기화
53	function init() {return _ins;};
54
55	// 엑세스 토큰 존재여부 확인
56	function accesTokenIsExist() {
57		var valid = _at && _at.length > 0;
58
59		if(valid) access_param.access_token = _at;
60		else _at = null;
61
62		return valid;
63	};
64
65	// photo list 요청
66	function _callPhotoList(count, successCallback, errorCallback) {
67		if(!$.isFunction(successCallback)) {
68			try{console.error("성공 콜백함수는 반드시 설정해주어야 합니다.");}catch(e){};
69			return;
70		}
71
72		var _cnt = count || 10;
73		var photoUrl = 'https://api.instagram.com/v1/users/self/media/recent/?callback=?&count=' + _cnt;
74		$.getJSON(photoUrl, access_param, onDataLoadedSelf);
75
76		function onDataLoadedSelf(instagram_data) {
77//	 		console.log(instagram_data);
78			// 요청 성공
79			if (instagram_data.meta.code == 200) {
80				var photos = instagram_data.data;
81				if (photos.length > 0) successCallback(instagram_data.data);
82				else _errCallback("이미지가 존재하지 않습니다.");
83			}
84			// 요청 실패
85			else _errCallback(instagram_data.meta.error_message);
86			*//***//*
87			function _errCallback(err) {
88				// 넘어온 에러콜백이 있을 경우
89				if($.isFunction(errorCallback)) errorCallback(err);
90
91				// 넘어온 에러콜백이 없을 경우 default
92				else try{console.error(err);}catch(e){};
93			}
94		}
95	}
96	
97	// 인스타그램 photo list ( Paginated ) 불러오기
98	function _callPage( listSize, maxNextId, successCb, errorCb ) {
99		if(!$.isFunction(successCb)) {
100			throw "성공 콜백함수는 반드시 설정해주어야 합니다.";
101		}
102		
103		var _cnt = listSize || 10;
104		
105		var photoUrl = 'https://api.instagram.com/v1/users/self/media/recent/?count=' + _cnt;
106		if(maxNextId) {
107			photoUrl = photoUrl + "&max_id=" + maxNextId;
108		}
109		
110		$.getJSON(photoUrl, access_param, __onReceiveInstaPage);
111		*//***//*
112		function __onReceiveInstaPage(instagram_data) {
113			// 요청 성공
114			if (instagram_data.meta.code == 200) {
115				var photos = instagram_data.data;
116				if (photos.length > 0) successCb(instagram_data.data, instagram_data.pagination);
117				else _errCallback("이미지가 존재하지 않습니다.");
118			}
119			// 요청 실패
120			else _errCallback(instagram_data.meta.error_message);
121			*//***//*
122			function _errCallback(err) {
123				// 넘어온 에러콜백이 있을 경우
124				if($.isFunction(errorCb)) errorCb(err);
125
126				// 넘어온 에러콜백이 없을 경우 default
127				else try{console.error(err);}catch(e){};
128			}
129		}
130	}
131}*/
132
133
134/**
135 * Facebook
136 * https://developers.facebook.com/apps/
137 */
138ttSns.Facebook = function(appId) {
139	var _appId = appId;		//144591439384828
140	
141	var _fb = this;
142	
143	if(typeof appId != "undefined" || appId != null){
144		//페이스북 SDK 초기화
145		window.fbAsyncInit = function() {
146			FB.init({
147				appId	: _appId,
148				status	: true,
149				xfbml	: true,
150				//real
151				//version	: 'v2.8'
152				//dev
153				version	: 'v2.12'
154			});
155			FB.AppEvents.logPageView();
156		};
157	}
158	
159
160	(function(d, s, id) {
161		  var js, fjs = d.getElementsByTagName(s)[0];
162		  if (d.getElementById(id)) return;
163		  js = d.createElement(s); js.id = id;
164		  //real
165		  js.src = "//connect.facebook.net/ko_KR/sdk.js#xfbml=1&version=v2.12";
166		  //dev
167		  //js.src = "//connect.facebook.net/ko_KR/sdk.js#xfbml=1&version=v2.9";
168		  fjs.parentNode.insertBefore(js, fjs);
169		}(document, 'script', 'facebook-jssdk'));
170
171	// access_token에 설정된 사용자의 사진 리스트를 조회합니다.
172	_fb.checkLoginState = function(successCallback, errorCallback) {
173		_checkLoginState(successCallback, errorCallback);
174	}
175
176	_fb.shareBook = function(url) {
177		var popUrl = url;
178		var popOption = "width=670, height=470, resizable=no, scrollbars=no, status=no;";    //팝업창 옵션(optoin)
179		window.open(popUrl,"",popOption);
180	}
181
182	return init();
183
184	/** PRIVATE **/
185
186	// 초기화
187	function init() {return _fb;};
188
189	function _checkLoginState(successCallback, errorCallback) {
190		FB.getLoginStatus(function(response) {
191			if (response.status === 'connected') {			//이미 로그인이 되어 있음
192				FB.api('/me', {fields: 'id,name'}, function(response) {
193					if (response.error == null) {
194						successCallback(response);
195					}
196					// 요청 실패
197					else _errCallback(response);
198					/***/
199					function _errCallback(response) {
200						// 넘어온 에러콜백이 있을 경우
201						if($.isFunction(errorCallback)) errorCallback(response);
202						// 넘어온 에러콜백이 없을 경우 default
203						else try{console.error(response.error);}catch(e){};
204					}
205				});
206			/*
207			} else if (response.status === 'not_authorized') {
208			}
209			*/
210			}else {													//로그인이 필요한 상태 혹은 app에 대한 승인이 필요한 상태(FB.api로 두개모두 처리된다.)
211				FB.login(function(response){
212					FB.api('/me', {fields: 'id,email'}, function(response) {
213
214						if (response.error == null) {
215							successCallback(response);
216						}
217						// 요청 실패
218						else _errCallback(response);
219						/***/
220						function _errCallback(response) {
221							// 넘어온 에러콜백이 있을 경우
222							if($.isFunction(errorCallback)) errorCallback(response);
223							// 넘어온 에러콜백이 없을 경우 default
224							else try{console.error(response.error);}catch(e){};
225						}
226					});
227				},{
228					scope: 'public_profile, email',
229					return_scopes:true,
230				});
231			}
232		});
233	}
234}
235
236
237
238
239/**
240 * Kakao
241 * https://developers.kakao.com/
242 */
243ttSns._kakao = function(appId) {
244	var _at				= appId;
245	var access_param	= {};
246	var _ins = this;
247
248	_ins.setAccessToken = function(accessToken){
249		_at = accessToken;
250	}
251
252	//Kakao.init(appId);
253
254	// 카카오스토리 공유하기
255	_ins.shareStory = function(url, text) {
256		if(epayCtrl.isMobile){
257			Kakao.Story.open({
258				url: url,
259				text: text,
260				install: true
261			});
262		}else{
263			Kakao.Story.share({
264				url: url,
265				text: text
266			});
267		}
268	}
269
270	// 카카오링크(카카오톡) 공유하기
271	_ins.shareTalk = function(linkUrl, textLabel) {
272     /* Kakao.Link.sendTalkLink({
273        label: textLabel
274    	,webButton: {
275             text: textLabel,
276             url: linkUrl // 앱 설정의 웹 플랫폼에 등록한 도메인의 URL이어야 합니다.
277        }
278      });*/
279		/*Kakao.Link.sendScrap({
280	          requestUrl: linkUrl
281	      });*/
282	    /*Kakao.Link.sendScrap({
283	        requestUrl: linkUrl
284	      });*/
285		/*Kakao.Link.sendCustom({
286	        //templateId: 16899,
287			templateId: 510254,
288			templateArgs: {
289				'url': linkUrl
290	        }
291	      });*/
292
293			/*Kakao.Link.sendCustom({
294				templateId: 510254,
295	            requestUrl: linkUrl,
296	            fail: function (err) {
297	                console.log(err);
298	              }
299	        });*/
300			
301		/*Kakao.Link.sendScrap({
302			  requestUrl: 'http://3.34.4.52:8180',
303			  fail: function (err) {
304	                console.log(err);
305	              },
306		buttons: [
307		    {
308		      title: '웹으로 이동',
309		      link: {
310		        mobileWebUrl: linkUrl,
311		      },
312		    },
313		    {
314		      title: '앱으로 이동',
315		      link: {
316		        mobileWebUrl: linkUrl,
317		      },
318		    },
319		  ]
320			});*/
321	
322		/*Kakao.Link.createCustomButton({
323			  container: '#zzfzz',
324			  requestUrl: 'http://3.34.4.52:8180',
325			  templateId: '510254',
326			  templateArgs: {
327			    'title': '제목 영역입니다.',
328			    'description': '설명 영역입니다.'
329			  }
330			});*/
331		/*Kakao.Link.createScrapButton({
332			  container: '#zzfzz',
333			  requestUrl: 'http://localhost:8080',
334				
335			});
336*/
337		/*Kakao.Link.sendScrap({
338		  requestUrl: 'http://3.34.4.52:8180',
339		});*/
340		/*Kakao.Link.sendDefault({
341		      objectType: 'text',
342		  text:
343			  textLabel,
344		  link: {
345		    mobileWebUrl:
346		    	location.href,
347		webUrl:
348			location.href,
349		  },
350		})*/
351		/*Kakao.Link.sendDefault({objectType: 'feed',
352		  text:
353			  textLabel,
354		  link: {
355		    mobileWebUrl:
356		    	location.href,
357		webUrl:
358			location.href,
359		  },
360		})*/
361		
362		Kakao.Link.sendDefault({
363			objectType: 'feed',
364			content: {
365				title: 'YMCA 고양국제청소년문화센터',
366				description: '청소년수련원, 유스호스텔, 스포츠/문화강좌',
367				imageUrl:'http://www.letsymca.or.kr/images/img_logo_intro.png',
368				link: {
369					mobileWebUrl: location.href,
370					webUrl: location.href,
371					}
372				}
373		});
374	}
375
376	//카카오 로그인하기
377	_ins.kakaoLogin = function(successCallback, errorCallback) {
378		if(!$.isFunction(successCallback)) {
379			console.log("successCallback Function error");
380			return;
381		}
382		if(!$.isFunction(errorCallback)) {
383			console.log("errorCallback Function error");
384			return;
385		}
386
387		Kakao.Auth.login({
388	        success: successCallback,
389	        fail: errorCallback
390	    });
391	}
392
393
394	return init();
395
396	// 초기화
397	function init() {return _ins;};
398}
399
400
401
402
403
404/**
405 * Twitter
406 * http://dev.twitter.com
407 * https://about.twitter.com/ko/resources/buttons#tweet
408 */
409ttSns.Twitter = function() {
410	var access_param	= {};
411
412	var _ins = this;
413
414	!function(d,s,id){
415		var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
416		if(!d.getElementById(id)){
417			js=d.createElement(s);
418			js.id=id;
419			js.src=p+'://platform.twitter.com/widgets.js';
420			fjs.parentNode.insertBefore(js,fjs);
421		}
422	}(document, 'script', 'twitter-wjs');
423
424	//TODO : 로그인 구연 예정
425	_ins.twitLogin = function() {
426	}
427	
428	
429	//공유하기
430	_ins.shareTwit = function(url, title, text) {
431		var popUrl = "https://twitter.com/intent/tweet?url="+encodeURIComponent(url)+"&text="+encodeURIComponent(title);
432		var popOption = "width=670, height=470, resizable=no, scrollbars=no, status=no;";    //팝업창 옵션(optoin)
433		
434		window.open(popUrl,"",popOption);
435		//location.href=popUrl;
436	}
437	
438
439	return init();
440
441	// 초기화
442	function init() {return _ins;};
443}
444
445
446
447
448
449
450
451
452
453/**
454 * Naver
455 * https://developers.naver.com
456 */
457ttSns.Naver = function(naverIdLogin) {
458	//var _at				= appId;
459	var access_param	= {};
460
461	var _ins = this;
462
463	//네이버 로그인하기
464	_ins.naverLogin = function() {
465		var naver_id_login = naverIdLogin;	//new naver_id_login(appId, callbackUrl);
466	  	var state = naver_id_login.getUniqState();
467//	  	naver_id_login.setDomain("http://thinktree-office.iptime.org:5580");//js-kim local
468	  	naver_id_login.setDomain("http://dev.think-tree.co.kr:13080");//js-kim ttDev
469//	  	naver_id_login.setDomain("http://thinktree-office.iptime.org:5480");//ms-kwon local
470	  	naver_id_login.setState(state);
471//	  	naver_id_login.setPopup();
472	  	naver_id_login.init_naver_id_login();
473	}
474	return init();
475
476	// 초기화
477	function init() {return _ins;};
478}
479
480
481/**
482 * Line
483 * https://media.line.me/en/
484 */
485ttSns.Line = function() {
486	var access_param	= {};
487
488	var _ins = this;
489
490	//네이버 공유하기
491	_ins.shareLine = function(url, title, text) {
492		var sns_title = title;	//기본 타이틀
493		var sns_summary = text; //페이지 설명
494		var sns_br = "\n"; 	//구분자
495		var sns_link = url;
496		var sns_img = "";
497
498		var url = "http://line.me/R/msg/text/?" + encodeURIComponent(sns_title + sns_br + sns_summary + sns_br + sns_link);
499		location.href=url;
500	}
501	return init();
502
503	// 초기화
504	function init() {return _ins;};
505}
506
507$(document).ready(function(){
508	//kakao = ttSns.Kakao('2f81c2987eae26c2d59bbbb7ae55bc1d');	// 20190627 카톡 여러번 init 하는 에러 고침
509	Kakao.init('0dd58d2ce71aa44f6fcd9cae4127b1ba');
510	_kakao = ttSns._kakao('0dd58d2ce71aa44f6fcd9cae4127b1ba');
511	//Kakao.init('0dd58d2ce71aa44f6fcd9cae4127b1ba');
512});
513
514//공유하기 공통으로 통합 (hannibal)
515shareSns = function(snsGubn ,url ,title){
516	switch (snsGubn) {
517		case 'kakao' : 
518			/** kakao **/
519			//var kakao = ttSns.Kakao('2f81c2987eae26c2d59bbbb7ae55bc1d');	//Think-tree 계정 app id	준석 2f81c2987eae26c2d59bbbb7ae55bc1d	원래	2a4df06509bdb12c94ad0361f9c1d4be
520			_kakao.shareTalk(url, title);
521			break;
522		case 'kakaoStory' : 
523			/**kakaoStory**/
524			//var kakao = ttSns.Kakao('2a4df06509bdb12c94ad0361f9c1d4be');	//Think-tree 계정 app id
525			_kakao.shareStory(url, title);
526			break;
527		case 'facebook' : 
528			/** facebook **/
529			var facebook = ttSns.Facebook('555149788217257');					//Think-tree 계정 app id
530			var facebookShareUrl = "http://www.facebook.com/share.php?u="+ url;
531			facebook.shareBook(facebookShareUrl);
532			break;
533		case 'line' : 
534			var line = ttSns.Line();
535			line.shareLine(url, title);
536			break;
537		case 'clipboard' : 
538			if ($.browser.msie) {
539				// ie 일때 init.
540				window.clipboardData.setData("Text", url);
541				alert("URL이 클립보드에 복사 되었습니다.");
542			} else {
543				// other browser 일때 init.
544				prompt("아래 URL을 복사해 사용해주세요.", url);
545			}
546			break;
547		}
548}
549function isMobile(ua) {
550    if (!!ua.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/)) {
551      return true;
552    } else {
553      return false;
554    }
555}

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.