function isMobile(){ var is_mobile = false; if(navigator.userAgent.match(/android/i)){ // Android is_mobile = true; }else if(navigator.userAgent.match(/(iphone)|(ipod)|(ipad)/i)){ // Apple is_mobile = true; } return is_mobile; } function doShareSns(type, title, summary, image){ switch(type){ case 'facebook': doShareFacebook(title, summary, image); break; case 'twitter': doShareTwitter(title, summary); break; case 'kakaotalk': if(isMobile()){ doShareKakaotalk(title, summary, image); }else{ alert("�� ����� ����Ͽ����� ����� �� �ֽ��ϴ�."); } break; case 'kakaostory': doShareKakaostory(title, summary, image); break; case 'pinterest': doSharePinterest(title, summary, image); break; case 'band': doShareBand(title, summary, image); break; case 'url': if(isMobile()){ alert("�� ����� PC������ ����� �� �ֽ��ϴ�."); }else{ doShareURL(); } break; } } // ���̽��� ���� function doShareFacebook(title, summary, image){ $( 'meta[name="url"]' ).attr( 'content' , encodeURIComponent(document.location.href)); $( 'meta[name="title"]' ).attr( 'content' , title); $( 'meta[name="description"]' ).attr( 'content' , summary); $( 'link[name="image_src"]' ).attr( 'content' , image); window.open("http://www.facebook.com/sharer.php?u=" + encodeURIComponent(document.location.href) + "&t=" + title, "FaceBook", "height=500, width=620, scrollbars=yes"); } // Ʈ���� ���� function doShareTwitter(title, summary) { var newwindow; var goUrl = 'http://twitter.com/share?'; var new_desc = title + ' - ' + summary; new_desc = new_desc.substring(0,50); var arr = []; arr.push("url=" + encodeURIComponent(document.location.href)); arr.push("text=" + encodeURIComponent(new_desc)); var url = arr.join("&"); goUrl += url; newwindow = window.open(goUrl, 'TwitterPopup', 'width=600, height=400, scrollbars=yes'); } // īī�����丮 ���� function doShareKakaostory(title, summary, image){ var newwindow; var goUrl = "https://story.kakao.com/share?"; summary = summary.substring(0,100); var arr = []; arr.push("url=" + encodeURIComponent(document.location.href)); arr.push("img=" + encodeURIComponent(image)); arr.push("title=" + encodeURIComponent(title)); arr.push("summary=" + encodeURIComponent(summary)); var url = arr.join("&"); goUrl += url; var w = 530; var h = 480; var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft - 20; var top = ((height / 2) - (h / 2)) + dualScreenTop + 30; newwindow = window.open(goUrl, 'kakaoPopup', 'width=600, height=600, scrollbars=yes, top=' + top + ',left=' + left); } //īī�� �ڹٽ�ũ��Ʈ key //Kakao.init('692446cb235a77b815a9619b6'); // īī���� - ����ϸ� ���� function doShareKakaotalk(title, summary, image){ var new_desc = title + ' - ' + summary; new_desc = new_desc.substring(0,100); Kakao.Link.sendTalkLink({ label: new_desc, image: {src: image, width: '300', height: '200'}, webButton: {text: '�ڼ��� ��������',url: document.location.href} }); } // ���ͷ���Ʈ ���� function doSharePinterest(title, summary, image){ var newwindow; var goUrl = 'http://www.pinterest.com/pin/create/bookmarklet/?'; var new_desc = title + ' - ' + summary; new_desc = new_desc.substring(0,100); var arr = []; arr.push("media=" + encodeURIComponent(image)); arr.push("is_video=false"); arr.push("url=" + encodeURIComponent(document.location.href)); arr.push("description=" + encodeURIComponent(new_desc)); var url = arr.join("&"); goUrl += url; newwindow = window.open(goUrl, 'PinterestPopup', 'width=600, height=600, scrollbars=yes'); } // ��� ���� function doShareBand(title, summary, image){ var enstr = encodeURIComponent(title); var u_str = encodeURIComponent(document.location.href); var url = "http://www.band.us/plugin/share?body="+enstr+" "+u_str; window.open(url, "share_band", "width=410, height=540, resizable=no"); //var BandshareUrl = "http://www.band.us/plugin/share?body="+encodeURIComponent(title)+"&route="+encodeURIComponent(shareUrl); //window.open(BandshareUrl, "share_band", "width=410, height=540, resizable=no"); } // URL ���� function doShareURL() { var code; code = document.location.href; window.clipboardData.setData('Text', code); alert('URL�ּҸ� Ŭ�����忡 �����Ͽ����ϴ�.'); }