/** * http://www.gnuwiz.com/board_tip/11 * @param svc *
트위터 카카오톡 */ (function($) { var social = ({ init: function(){ social.addClickEventListener('.btn-social-share', function () { social.shareTo($(this).data('service')); }); social.addClickEventListener('.btn-social-login', function () { social.openSocalLogin($(this).data('service')); }); }, addClickEventListener: function (id, func) { social.addEventListener('click', id, func); }, addEventListener: function (event_name, id, func) { if($(id).length) { $(id).off(); $(id).on(event_name, func); } }, shareTo: function (service) { var form = document.FRM_SNS; var base_url = form.base_url.value; var url = form.url.value; var short_url = url; var title = encodeURI(form.title.value); var title_url = title + ' : ' + encodeURIComponent(url); switch (service) { case "twitter": url = base_url + url; openCenterWin("https://twitter.com/intent/tweet?text=" + title + " " + encodeURIComponent(url), "", 600, 300, false, true); break; case "facebook": url = base_url + url; var link = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(url); var t = window.open(link, 'facebook', 'status=no, resizable=yes, toolbar=no, scrollbars=yes, width=790, height=440'); if (t == true) { t.focus(); } break; case "google": url = base_url + url; var link = "https://plus.google.com/share?url=" + encodeURIComponent(url); var t = window.open(link, 'google', 'status=no, resizable=yes, toolbar=no, scrollbars=yes, width=600, height=600'); if (t == true) { t.focus(); } break; case 'band' : openCenterWin("http://band.us/plugin/share?body=" + short_url + "&route=" + short_url, "band", 600, 300, false, true); break; case 'm_band' : openCenterWin("bandapp://create/post?text=" + short_url + "&route=" + title_url, "m_band", 600, 300, false, true); break; case 'blog': openCenterWin("http://blog.naver.com/openapi/share?url=" + short_url + "&title=" + title_url, "blog", 600, 300, false, true); break; case 'pholar': openCenterWin("http://www.pholar.co/spi/rephol?url=" + short_url + "&title=" + title_url, "pholar", 600, 300, false, true); break; case 'kakaostory': openCenterWin("https://story.kakao.com/share?url=" + short_url + "&title=" + title_url, "kakaostory", 600, 300, false, true); break; case 'kakaotalk': goKakaoLink(form.title.value, url); break; case 'telegram': openCenterWin("https://telegram.me/share/url?url=" + short_url + "&text="+title, "telegram", 600, 300, false, true); break; case 'tumblr': openCenterWin("http://www.tumblr.com/share?v=3&u=" + short_url + "&t="+title, "tumblr", 600, 300, false, true); break; } }, openSocalLogin: function (service) { var url = getHomePath() + 'module/plugins/socialLogin/oauth/login.php?mode=confirm&service='+service; openCenterWin(url, 'socialLogin', 870, 820, false, false); } }); $(document).ready(function () { social.init(); }); })(jQuery);