'); } }); }, get_member_login: function(_callback) { var _t = this; if (typeof _callback == 'function') { _t._callback_login.push(_callback); } // call แล้ว if (_t._is_get_login_calling == 2) { // Callback all $.each(_t._callback_login, function(k, v) { v(); }); _t._callback_login = []; return true; } if (_t._is_get_login_calling <= 0) { _t._is_get_login_calling = 1; $.get("/member/get_member_login", function(data) { if (typeof data.userID != 'undefined') { _t.id = data.userID; _t.usrename = data.user_display_name; _t.name = data.user_name; _t.lastname = data.user_surname; _t.email = data.user_email; _t.avatar = data.user_avatar; _t.is_member_login = true; } _t._is_get_login_calling = 2; // Callback all $.each(_t._callback_login, function(k, v) { v(); }); _t._callback_login = []; }, "json"); } } } g_member.get_member_login(); var g_gallery = { initial_gallery: function() { var _i = 0; $('.articl-content img').each(function(index) { var _elm = $(this); var caption_str = _elm.parent().text(); // _elm.hide(); if (typeof _elm.data('img-highlight') === 'undefined') { // Render image gallery // var _width = $(this).width(); // var _height = $(this).height(); // if (((_width - _height) / _width) * 100 < 20) { // $(this).css('width', '336px'); // } // var _img = $(this); $(" ").attr("src", _elm.attr("src")).load(function(){ // var _t = $(this); var _width = this.width; var _height = this.height; var _article_container_width = $('.article-news').width(); var _elm_caption = _elm.parent().next(); if (_width <= 336) { // console.log('<=336'); _elm.css('width', _width + 'px'); _elm_caption.css('width', _width + 'px'); // } else if (((_width - _height) / _width) * 100 < 20) { } else if (_height > _width) { // รูปแนวตั้ง _elm.css('width', '336px'); _elm_caption.css('width', '336px'); } else if (_width < _article_container_width) { // ความกว้างของรูป น้อยกว่า ความกว้างของ article container _elm.css('width', _width + 'px'); _elm_caption.css('width', _width + 'px'); } else { _elm.css('width', '100%'); _elm_caption.css('width', '100%'); } // set width caption // if (_elm.parent().next().is('p')) { // } else { // console.log('else else'); // } // _elm.parent().next().css('width', _width + 'px'); // if (_width <= 336) { // disable gallery // if (_elm.parent().is('a')) { // _elm.parent().removeClass('gallery-icon'); // _elm.unwrap(); // } // } // _elm.show(); // _elm.parent().show(); }); _elm.attr('border', 0); _elm.attr('hspace', 0); _elm.attr('vspace', 0); _elm.wrap(''); _i++; } }); $(function(){ $(".js-img-viwer").SmartPhoto({ nav: false }); }); } }; var g_comment = { _is_open: false, // Is comment box open or not use_id: g_content_id, paging: 0, username: '', avatar: '', count_post: '', country_code: '', country_name_en: '', content_headline: '', content_url: 'https://www.bangkokpost.com/world/1980327/worlds-longest-song-drones-on', timing: false, reply_for_comment_id: false, first_access: true, member_id: '', get_commnet_ajax_requrest: false, order: 'latest', text_comment_limit: 650, time_interval: null, initial_comment: function() { var _t = this; $('body').append( '