window.msg = {}; if (typeof ntd_language_active === 'undefined') { window.msg.title = "Comments"; window.msg.login_text = "Please Sign up or Login to comment"; window.msg.signup_btn = "SIGN UP"; window.msg.login_btn = "LOGIN"; } else { if (ntd_language_active === 'ntd_korea') { window.msg.before_title = "댓글"; window.msg.title = "댓글"; window.msg.close = "닫기"; window.msg.login_text = "로그인 후 댓글 등록을 하실 수 있습니다."; window.msg.signup_btn = "회원가입"; window.msg.login_btn = "로그인"; } else if (ntd_language_active === 'ntd_spanish') { window.msg.title = "Deje un comentario"; window.msg.login_text = "Regístrese o ingrese a su cuenta para dejar comentarios"; window.msg.signup_btn = "REGISTRARSE"; window.msg.login_btn = "INGRESAR"; } else if (ntd_language_active === 'ntd_portuguese') { window.msg.title = "Faça um comentário"; window.msg.login_text = "Inscreva-se ou acesse sua conta para fazer um comentário"; window.msg.signup_btn = "INSCREVA-SE"; window.msg.login_btn = "ENTRE"; } } $(document).ready(function() { $('.premium-program-single a.cmt_link').click(function (e) { e.preventDefault(); var comment_pos = $('.premium-program-single #sidebar_comments').offset().top; $("body,html").animate({ scrollTop: comment_pos - 100 }, 800); }); window.addEventListener("message", function(evt) { if (evt.data && typeof evt.data === 'string' && evt.data.includes("comment_count")) { var data_arr = evt.data.split(":"); var comment_count = parseInt(data_arr[1]); $('.remark__counter').empty().append(comment_count); } } ); //fix scroll freeze for -webkit-overflow-scrolling:touch on ios var scrollTimer; $('#remark-side-panel').on('scroll', function(e) { clearTimeout(scrollTimer); scrollTimer = setTimeout(function() { this.scrollTop = Math.max(1, Math.min(this.scrollTop, this.scrollHeight - this.clientHeight - 1)); }, 300); }); }); function remark_panel_init(userToken) { var remarkpanel = '
'; $('#sidebar_comments').append(remarkpanel); if (typeof userToken === 'undefined') { userToken = ''; $(".login_wrapper").show(); $("#remark_login_btn").on("click", function (e) { e.preventDefault(); if (window.epSubs) { window.epSubs.showTemplate("signin-popup", "POPUP", { width: "800px", height: "550px", }, { source: "comment" } ); } else if (window.paywall) { window.paywall.showTemplate('sign-in-combo'); } trackEvent('comment:login', 'open-login-popup'); trackPage('/virtual/comment/login/open-login-popup'); }); $("#remark_signup_btn").on("click", function (e) { e.preventDefault(); if (window.epSubs) { window.epSubs.showTemplate("signin-popup", "POPUP", { width: "800px", height: "550px", }, { source: "comment", signup: "true" } ); } else if (window.paywall) { window.paywall.showTemplate('sign-in-combo'); } trackEvent('comment:registration', 'open-registration-popup'); trackPage('/virtual/comment/open-registration-popup'); }); } else { $(".login_wrapper").hide(); } window.remark_config = { host: "https://comment.youmaker.com", site_id: window.siteConfig.siteId, components: ['embed', 'counter'], url: get_remark_host() + decodeURI(window.location.pathname), url_id: ntd_post_id, provider: 'youmaker', token: userToken, toolbar: 'true', max_shown_comments: 10 }; //for Korean, try to replace comment section if is in certain post_ids if (typeof ntd_language_active === 'string' && 'ntd_korea' === ntd_language_active && typeof window.commentToShare === 'number' && typeof window.listShareCommentPosts === 'object' && window.listShareCommentPosts.length > 0) { if ($.inArray(parseInt(ntd_post_id), window.listShareCommentPosts) > -1) { window.remark_config.url_id = window.commentToShare; } } if ($("body").css("background-color") === "rgb(18, 25, 43)") { window.remark_config.theme = "eetwdark"; } (function(c) { for(var i = 0; i < c.length; i++){ var d = document, s = d.createElement('script'); s.src = window.remark_config.host + '/web/' +c[i] +'.js'; s.defer = true; (d.head || d.body).appendChild(s); } })(window.remark_config.components || ['embed']); } function get_remark_host() { return window.location.hostname; }