ÿØÿàJFIFÿÛ„ ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/netphim/layout/default/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/netphim/layout/default/js/custom.js
$(document).ready(function(){
    var open = false;
    var open_search = false;
    $('.aresp.nav-resp').click(function(){
        open = !open;
        if(open) {
            $('#arch-menu').show();
            $(this).addClass('active');
        } else {
            $('#arch-menu').hide();
            $(this).removeClass('active');
        }
    });
    $('.aresp.search-resp').click(function(){
        open_search = !open_search;
        if(open_search) {
            $('.search_responsive').show();
            $('#form-search-resp').addClass('formblock');
            $(this).addClass('active');
        } else {
            $('.search_responsive').hide();
            $('#form-search-resp').removeClass('formblock');
            $(this).removeClass('active');
        }
    });
    $('.owl-carousel').owlCarousel({
        loop:true,
        autoplay:true,
        margin:10,
        responsiveClass:true,
        nav:true,
        responsive:{
            0:{
                items:2
            },
            600:{
                items:3
            },
            1000:{
                items:5
            }
        }
    });
    if(!$.cookie('t_color_theme') || $.cookie('t_color_theme')=='undefined') {
        $('body').attr('data-bs-theme','light');
    }else{
        $('body').attr('data-bs-theme', $.cookie('t_color_theme'));
    }
    $( ".toggle-dark" ).bind( "click", function() {
        $.removeCookie('t_color_theme', { path: '/' });
        var t_color = $(this).attr('rel');
        if (t_color == 'dark') {
            $(this).attr('rel', 'light');
            $(this).css("color", "white");
        } else {
            $(this).attr('rel', 'dark');
            $(this).css("color", "yellow");
        }
        $('body').attr('data-bs-theme', t_color);
        $.cookie('t_color_theme', t_color, { path: '/' });
    });

    $('#search-kw').bind('click keyup', function(event) {
        event.stopPropagation();
        var keyword = $(this).val();
        if (keyword.trim()!='') {
            $('.suggestsearch').show();
            $.ajax({url: "/?act=ajax&code=search_manga&keyword="+keyword.trim(),
                dataType:'html',
                success: function(result){
                    $('#show_list_suggestsearch').html(result);
                }}
            );
        }
        $(window).click(function() {
            $('.suggestsearch').hide();
        });
    });
    $('#basic_addon2').click(function(){
        var keyword = $('#search-kw').val();
        if (keyword.trim()!='') {
            location.href='/?act=search&f[status]=all&f[sortby]=lastest-chap&f[keyword]='+keyword.trim();
        }
    });
    $('#search-kw').keydown(function (e) {
        if (e.keyCode === 13) {
            e.preventDefault();
            var keyword = $('#search-kw').val();
            if (keyword.trim()!='') {
                location.href='/?act=search&f[status]=all&f[sortby]=lastest-chap&f[keyword]='+keyword.trim();
            }
        }
    });
    /*document.onkeydown = function (event) {
        if (event.keyCode == 13) {
            var keyword = $('#search-kw').val();
            if (keyword.trim()!='') {
                alert(keyword.trim());
                location.href='/?act=search&f[keyword]='+keyword.trim();
            }
        }
    };*/

    /*$('#search-kw').click(function(event){
        event.stopPropagation();
        var keyword = $this.val();
        $('.suggestsearch').show();
        $(window).click(function() {
            $('.suggestsearch').hide();
        });
    });*/

    $('#icon_search_1').bind( "click", function() {
        if ($('#search-kw').css('display') == 'none') {
            $('#search-kw').show();
        }else{
            $('#search-kw').hide();
        }

    });
    $('#search_icon2').bind( "click", function() {
        if ($('#top_navbar').css('display') == 'none') {
            $('#top_navbar').show();
        }else{
            $('#top_navbar').hide();
        }
    });
    $('.update_and_login').click(function (){

        var password = $('#password').val();
        var re_password = $('#re_password').val();
        if(password=='' || re_password==''){
            $("#success-alert-text").html('Please enter password and re-password');
            $("#success-alert").fadeTo(3000, 500).slideUp(500, function() {
                $("#success-alert").slideUp(3000);
            });
            $('#password').focus();
            return  false;
        }
        if(password!=re_password){
            $("#success-alert-text").html('Please enter password same with re-password');
            $("#success-alert").fadeTo(3000, 500).slideUp(500, function() {
                $("#success-alert").slideUp(3000);
            });
            return  false;
        }

        $('#form_update_and_login .submit').click();
        return false;

    });
    $('.btn_login').click(function (){
        $('#login_form .submit').click();
        return false;
    });
    var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
    var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
        return new bootstrap.Tooltip(tooltipTriggerEl)
    });
    if(screen.width > 900){
        $(".jtip").hover(
            function () {
                var e = $($(this).data("jtip"));
                if (!e.length) return !1;
                e.find(".box_img img").attr("src", e.find(".box_img img").attr("data-original")), $('<div id="cluetip"></div>').html(e.html()).appendTo("body").fadeIn("300");
            },
            function () {
                $("#cluetip").remove();
            }
        ).mousemove(function (e) {
            var t = e.pageX + 20,
                a = e.pageY + 10;
            $("#cluetip").css({ top: a, left: t });
        });
    }

    var shortened = $('#summary_shortened').outerHeight(true);
    if(shortened>60){
        $('#summary_shortened').addClass('shortened');
        $('.morelink').show();
    }else{
        $('#summary_shortened').removeClass('shortened');
        $('.morelink').remove();
    }

    $('.morelink').click(function(){
        var this_rel = $(this).attr('rel');
        if(this_rel=='show_more'){
            $('#summary_shortened').removeClass('shortened');
            $(this).attr('rel','show_less');
            $(this).html('Show less <i class="fa fa-angle-left"></i>');
        }else{
            $('#summary_shortened').addClass('shortened');
            $(this).attr('rel','show_more');
            $(this).html('Show more <i class="fa fa-angle-right"></i>');
        }

    });
    $('#show_rating_id').barrating({
        showValues: false,
        theme: 'fontawesome-stars',
        onSelect: function (value, text, event) {
            var manga_id = $('#manga_id').val();

            /*var start_time = Math.floor(Date.now() / 1000);
            var ajax_time_res = $('#ajax_time_res').val();
            if((start_time-ajax_time_res)<5){
                var time_wait = 5-(start_time-ajax_time_res);
                Swal.fire('','You click too fast, please wait '+time_wait+' second(s) to continue');
                return false;
            }*/

            if (typeof (event) !== 'undefined') {
                $.ajax({
                    url: '/?act=ajax&code=star_rating',
                    type: 'post',
                    data: {
                        manga_id: manga_id,
                        rating: value
                    },
                    dataType: 'json',
                    success: function (data) {
                        var average = data['numRating'];
                        $('.show_rating').barrating('set',average);
                        $('span[itemprop="ratingValue"]').html(average);
                        $('span[itemprop="ratingCount"]').html(data['total_rating']);

                        var end_time = Math.floor(Date.now() / 1000);
                        $('#ajax_time_res').val(end_time);

                    }
                });
            }
        }
    });
    var rating_value = $('#rating_value').val();
    $('#show_rating_id').barrating('set',rating_value);


    //var totalSections = 1000;
    $(".reading-detail").click(function() {
        var currentSection = $(window).scrollTop();
        var viewportHeight = $(window).height()/2;
        currentSection=currentSection+viewportHeight;
        //if (currentSection > totalSections - 1) currentSection = totalSections - 1;
        $('html, body').animate({
            scrollTop: currentSection,
            complete: function () {
                scrollTop: 0
            }
        }, 100);
    });

    $('.alertError').click(function(){
        $('#alertError_modal').modal('show');
    });

    $('.send_error').click(function (){
        $('#form_error .submit').click();
        return false;
    });
    $('select[name="f[error_type]"]').change(function(){
        var title_rel = $('option:selected', this).attr('rel');
        $('.error_des').html('<i class="text-danger">'+title_rel+'</i>');
    });
    $('.select-chapter').click(function(){
        $('#chapter_modal').modal('show');
        /*$('#chapter_modal').on('shown.bs.modal', function (event) {
            var myChapId = $(this).data('chapid');
            var mangaId=$(this).data('mangaid');
            $('.modal-body').animate({
                scrollTop: $('#chapter_'+ myChapId).offset().top + 'px'
            }, 'fast');
        });*/
        /*$('#chapter_modal').modal('show');
        var myChapId = $(this).data('chapid');
        var mangaId=$(this).data('mangaid');
        $('.modal-body').animate({
            scrollTop: $('#chapter_'+ myChapId).offset().top + 'px'
        }, 'fast');*/

    });
    $("#chapter_modal").on('show.bs.modal', function(){
        var myChapId = $('.select-chapter').data('chapid');
        var mangaId=$('.select-chapter').data('mangaid');
        var pos = $('#chapter_'+myChapId).index();
        var phan_nguyen = (pos - (pos % 3));
        var new_pos = (phan_nguyen/3)*44;
        //alert(phan_nguyen+','+new_pos);
        $('.modal-body').animate({
            scrollTop: new_pos+'px'
        }, 'fast');
        $('#keyword_chapter_modal').bind('click keyup', function(event) {
            event.stopPropagation();
            var keyword_chapter = $('#keyword_chapter_modal').val();
            if (keyword_chapter.trim()!='') {
                load_list_chapter_modal(mangaId,1,keyword_chapter.trim(),myChapId);
            }
        });
    });
    /*$('.bell-notify').click(function(){
        $('#bell_notify_detail').modal('show');
    })*/
    $('.searchText').bind('keyup', function() {
        var searchString = $(this).val();
        $("ul#my_list_chapter li a").each(function(index, value) {
            currentName = $(value).text()
            if( currentName.toUpperCase().indexOf(searchString.toUpperCase()) > -1) {
                $(value).show();
            } else {
                $(value).hide();
            }
        });
    });
    $('.follow-link').click(function(){
        var myChapId = $(this).data('id');
        var follow_id = $(this).data('subid');
        /*var start_time = Math.floor(Date.now() / 1000);
        var ajax_time_res = $('#ajax_time_res').val();
        if((start_time-ajax_time_res)<5){
            var time_wait = 5-(start_time-ajax_time_res);
            Swal.fire('','You click too fast, please wait '+time_wait+' second(s) to continue');
            return false;
        }*/

        $.ajax({
            url: "/?act=ajax&code=follow&chap_id="+myChapId+'&follow_id='+follow_id,
            success: function(result){
                if(result=='need_login'){
                    alert('Please login to follow!');
                    /*swal.fire('','Please login to follow!');*/
                    return false;
                }
                var myArray = result.split("@");
                if(myArray[0]=='follow') {
                    $('.follow-link').html('<i class="fas fa-trash-alt"></i> <span>Unfollow</span>');
                    $('.follow-link').removeClass('btn-info').addClass('btn-danger');
                }else{
                    /*$('.follow-link').html('<i class="fa fa-heart"></i> <span>Follow</span>');
                    $('.follow-link').removeClass('btn-danger').addClass('btn-info');*/
                    $('#unfollow-follow-link-'+myChapId).html('<i class="fa fa-heart"></i> <span>Follow</span>');
                    $('#unfollow-follow-link-'+myChapId).removeClass('btn-danger').addClass('btn-info');
                }
                $('#total_follow').text(myArray[1]);
                var end_time = Math.floor(Date.now() / 1000);
                $('#ajax_time_res').val(end_time);

            }
        });
    });
    if($("div.container").hasClass("follow_manga") || $("div.container").hasClass("user_account")){
        $('.delete-all-history').click(function(){
            Swal.fire({
                text: "Are you sure clear all history?",
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, clear all history!'
            }).then((result) => {
                if (result.isConfirmed) {
                    $.ajax({url: "/?act=ajax&code=delete_all_history",
                        dataType:'',
                        success: function(result){
                            location.reload();
                        }}
                    );
                }
            });
        });
        $('.mark-as-read').click(function(){
            var manga_id = $(this).data('id');
            $.ajax({url: "/?act=ajax&code=follow_already_read&manga_id="+manga_id,
                dataType:'',
                success: function(result){
                    $('#mark-as-read-'+manga_id).hide();
                }}
            );
        })
    }
    if($("div.container").hasClass("user_account")){
        $('#upload_avatar').on('submit',(function(e) {
            e.preventDefault();
            var formData = new FormData(this);
            $('#OpenImgUpload').attr('src','https://c.tenor.com/k-A2Bukh1lUAAAAi/loading-loading-symbol.gif');
            $.ajax({
                type:'POST',
                url: $(this).attr('action'),
                data:formData,
                cache:false,
                contentType: false,
                processData: false,
                success:function(data){
                    $('#OpenImgUpload').attr('src',data);
                    //$('.user-image').attr('src',data);
                },
                error: function(data){
                    alert(data);
                }
            });
        }));
        $('.button_edit_image').click(function(){
            $('#imgupload').trigger('click');
            $("#imgupload").on("change", function() {
                $('#upload_avatar .submit_avatar').click();
                return false;
            });
        });
        $('.send_request').click(function (){
            $('#form_request .submit').click();
            return false;
        });
        /*$('.close').click(function (){
            window.close();
        });*/
    }
    // if a key is pressed and then released
    if($("div.dtsingle").hasClass("mangadetail") || $("div.container").hasClass("mangadetail")){
        if($("div.dtsingle").hasClass("mangadetail")) {
            $('#keyword_chapter').bind('click keyup', function(event) {
                event.stopPropagation();
                var keyword_chapter = $('#keyword_chapter').val();
                if (keyword_chapter.trim()!='') {
                    load_list_chapter(1,keyword_chapter.trim());
                }
            });
            //load comment
            $.ajax({url: "/?act=ajax&code=emoji&content_id=trollface_content",
                dataType:'json',
                success: function(result){
                    window.emoji_content = result;
                }}
            );
            var comment_page_num = $('#comment_page_num').val();
            var comment_type_sort = $('#comment_type_sort').val();
            var comment_type_chap = $('#comment_type_chap').val();
            load_list_comment(comment_page_num,comment_type_sort,0);
            $('#lastest_comment_check').change(function(){
                if ($(this).prop('checked')==true){
                    load_list_comment(comment_page_num,'lasted',0);
                    $('#comment_type_sort').val('lasted');
                    $('.form-check-label').text('Lastest');
                }else{
                    load_list_comment(comment_page_num,'hoted',0);
                    $('#comment_type_sort').val('hoted');
                    $('.form-check-label').text('Most voted');
                }
            });
        }


        if($("div.container").hasClass("reading")) {

            var $obj = $('#chapterNav');
            var top = $obj.offset().top - parseFloat($obj.css('marginTop').replace(/auto/, 0));
            $(window).scroll(function (event) {
                // what the y position of the scroll is
                var y = $(this).scrollTop();
                // whether that's below the form
                if (y >= top) {
                    // if so, ad the fixed class
                    $obj.addClass('scroll-to-fixed-fixed');
                } else {
                    // otherwise remove it
                    $obj.removeClass('scroll-to-fixed-fixed');
                }
            });
            document.onkeydown = function (event) {
                if (event.keyCode == 37) {
                    var href = $('a.a_prev').attr('href');
                    if (href != 'javascript:void(0);') {
                        location.href = href;
                    } else {
                        Swal.fire('', 'You are watching the first chapter');
                        return false;
                    }
                }
                if (event.keyCode == 39) {
                    var href = $('a.a_next').attr('href');
                    if (href != 'javascript:void(0);') {
                        location.href = href;
                    } else {
                        Swal.fire('', 'You are watching the last chapter');
                        return false;
                    }
                }
            };
            var current_pos = 1;
            current_pos = $('a.loadchapter.btn-success').data('position');
            $('.changeserver span').text(current_pos);
            $('.loadchapter').click(function () {
                var id_server = $(this).data('id');
                var currentlink = $('#currentlink').val();
                var server_url = $(this).data('link');
                $('.reading-detail').find("img").each(function (k, el) {
                    var newSrc = $(el).attr("src").replace(currentlink, server_url);
                    $(el).attr("src", newSrc);
                });
                $('.loadchapter').removeClass('btn-success').addClass('btn-info');
                $('#a_loadchapter_' + id_server).removeClass('btn-info').addClass('btn-success');
                $('#currentlink').val(server_url);

            });
            $('.changeserver').click(function () {
                var currentlink = $('#currentlink').val();
                var current_pos = parseInt($('.changeserver span').text());
                var num_server = parseInt($('.loadchapter').length);
                var next_post = parseInt(parseInt(current_pos) + 1);
                if (next_post > num_server) {
                    next_post = 1;
                }
                $('.loadchapter').each(function (index, item) {
                    if (parseInt($(item).data('position')) == next_post) {
                        var server_url = $(item).data('link');
                        var id_server = $(item).data('id');
                        $('.reading-detail').find("img").each(function (k, el) {
                            var newSrc = $(el).attr("src").replace(currentlink, server_url);
                            $(el).attr("src", newSrc);
                        });
                        $('.loadchapter').removeClass('btn-success').addClass('btn-info');
                        $('#a_loadchapter_' + id_server).removeClass('btn-info').addClass('btn-success');
                        $('#currentlink').val(server_url);
                        $('.changeserver span').text(next_post);
                    }
                });
            });
            //load comment
            $.ajax({url: "/?act=ajax&code=emoji&content_id=trollface_content",dataType:'json', success: function(result){
                    window.emoji_content = result;
                }}
            );
            var comment_page_num = $('#comment_page_num').val();
            var comment_type_sort = $('#comment_type_sort').val();
            var comment_type_chap = $('#comment_type_chap').val();
            load_list_comment(comment_page_num,comment_type_sort,comment_type_chap);
            $('#lastest_comment_check').change(function(){
                if ($(this).prop('checked')==true){
                    load_list_comment(comment_page_num,'lasted',comment_type_chap);
                    $('#comment_type_sort').val('lasted');
                    $('.form-check-label').text('Lastest');
                }else{
                    load_list_comment(comment_page_num,'hoted',comment_type_chap);
                    $('#comment_type_sort').val('hoted');
                    $('.form-check-label').text('Most voted');
                }
            });
            $('.type_chap_load').click(function(){
                var type_chap_load = $(this).data('type');
                load_list_comment(comment_page_num,comment_type_sort,type_chap_load);
                $('#comment_type_chap').val(type_chap_load);
                $('.type_chap_load').removeClass('active');
                $(this).addClass('active');
            });
        }
    }
});
/*var trollface_button = function (context) {
    var ui = $.summernote.ui;
    var content = emoji_content.trollface;
    var trollface_button = ui.buttonGroup([
        ui.button({
            contents: '<div style="background: url(\'/layout/default/images/emo/trollface.png\') no-repeat;height: 30px;width: 30px;"></div>',
            data: {
                'bs-toggle': 'dropdown'
            }
        }),
        ui.dropdown({
            contents: content,
            callback: function (items) {
                $(items).find('a').each(function () {
                    $(this).click(function(e) {
                        var url_img = $(this).data('url');
                        var img_link = '<img src="'+url_img+'" alt="emo">';
                        context.invoke("editor.pasteHTML", img_link);
                        e.preventDefault();
                    });
                });
            }
        })
    ]);
    return trollface_button.render();
}
var onion_button = function (context) {
    var ui = $.summernote.ui;
    var content = emoji_content.onion;
    var onion_button = ui.buttonGroup([
        ui.button({
            contents: '<div style="background: url(\'/layout/default/images/emo/onion.gif\') no-repeat;height: 30px;width: 30px;"></div>',
            data: {
                'bs-toggle': 'dropdown'
            }
        }),
        ui.dropdown({
            contents: content,
            callback: function (items) {
                $(items).find('a').each(function () {
                    $(this).click(function(e) {
                        var url_img = $(this).data('url');
                        var img_link = '<img src="'+url_img+'" alt="emo">';
                        context.invoke("editor.pasteHTML", img_link);
                        e.preventDefault();
                    });
                });
            }
        })
    ]);
    return onion_button.render();
}*/

/*
function openComment(){
    $('.placeholder').remove();
    $('#comment_form').summernote({
        toolbar: [
            ['mybutton', ['trollface_button','onion_button']]
        ],
        buttons: {
            trollface_button: trollface_button,
            onion_button: onion_button
        },
        focus: true
    });
}*/
function load_list_chapter_modal(manga_id,page_num,keyword='',chap_id=0){
    $.ajax({
        url: '/?act=ajax&code=load_list_chapter_modal&manga_id='+manga_id+'&page_num='+page_num+'&chap_id='+chap_id+'&keyword='+keyword,
        dataType:'json',
        success: function(result){
            $('#list_chapter_id_modal').html(result.list_chap);
            $('#nav_list_chapter_id_modal').html(result.nav);
            if(chap_id>0){
                var pos = $('#chapter_'+chap_id).index();
                var phan_nguyen = (pos - (pos % 3));
                var new_pos = (phan_nguyen/3)*44;
                $('.modal-body').animate({
                    scrollTop: new_pos+'px'
                }, 'fast');
            }
        }}
    );
}
function load_list_chapter(page_num,keyword='',chap_id=0){
    var manga_id = $('#title-detail-manga').data('manga');
    $.ajax({
        url: '/?act=ajax&code=load_list_chapter&manga_id='+manga_id+'&page_num='+page_num+'&chap_id='+chap_id+'&keyword='+keyword,
        dataType:'json',
        success: function(result){
            $('#list_chapter_id_detail').html(result.list_chap);
            $('#nav_list_chapter_id_detail').html(result.nav);
            $('html, body').animate({
                scrollTop: $("#nt_listchapter").offset().top
            }, 100);
            /*$('.comment-list').html(result.list);
            $('.commentpager').html('<ul class="pagination_comment">'+result.nav+'</ul>');
            $('#comment_page_num').val(comment_page_num);
            if(s_to!='') {
                var cur_url = document.location.href.split("#");
                var url_comment_page_num = cur_url[0] + "#"+s_to;
                document.location = url_comment_page_num;
            }
            var end_time = Math.floor(Date.now() / 1000);
            $('#ajax_time_res').val(end_time);*/
        }}
    );
}
function load_list_comment(comment_page_num,type_sort,type_chap=1,s_to=''){
    /*var start_time = Math.floor(Date.now() / 1000);
    var ajax_time_res = $('#ajax_time_res').val();
    if((start_time-ajax_time_res)<2){
        var time_wait = 2-(start_time-ajax_time_res);
        Swal.fire('','You comment too fast, please wait '+time_wait+' second(s) to continue');
        return false;
    }*/

    var manga_id = $('#title-detail-manga').data('manga');
    var chap_id = $('#title-detail-manga').data('chapter');
    $.ajax({
        url: '/?act=ajax&code=load_list_comment&manga_id='+manga_id+'&chap_id='+chap_id+'&comment_page_num='+comment_page_num+'&type_sort='+type_sort+'&type_chap='+type_chap,
        dataType:'json',
        success: function(result){
            $('.comment-list').html(result.list);
            $('.commentpager').html('<ul class="pagination_comment">'+result.nav+'</ul>');
            $('#comment_page_num').val(comment_page_num);
            if(s_to!='') {
                var cur_url = document.location.href.split("#");
                var url_comment_page_num = cur_url[0] + "#"+s_to;
                document.location = url_comment_page_num;
            }
            var end_time = Math.floor(Date.now() / 1000);
            $('#ajax_time_res').val(end_time);
        }}
    );
}
function sendComment(comment_id){
    //alert(comment_id);
    var start_time = Math.floor(Date.now() / 1000);
    var ajax_time_res = $('#ajax_time_res').val();
    if((start_time-ajax_time_res)<2){
        var time_wait = 2-(start_time-ajax_time_res);
        Swal.fire('','You comment too fast, please wait '+time_wait+' second(s) to continue');
        return false;
    }

    var value= $('#comment_form_'+comment_id).summernote('code');
    $('#comment_form_'+comment_id).summernote('reset');
    var value_check = value.replace( /<[^img].*?>/g, '' );
    if(value_check==''){
        swal.fire('','Comment can not empty!');
        return false;
    }
    var value_check_input = value.replace( /<[^img|p|\/p].*?>/g, '' );
    value_check_input = value_check_input.replace(/<p[^>]*>/g, '').replace(/<\/p>/g, '<br/>');
    value_check_input = value_check_input.replace(/(<br\/>)+/g, '<br\/>');
    value_check_input = value_check_input.replace(/^\s*<br\s*\/?>|<br\s*\/?>\s*$/g,'');

    var name = $('#comment_name_'+comment_id).val();
    var user_id = parseInt($('#user_id').val());
    if(user_id==0){
        swal.fire('','Please login to comment!');
        return false;
    }
    if(name==''){
        swal.fire('','Please input your name!');
        return false;
    }
    $('.send_comment_button_'+comment_id).html('<img src="layout/default/images/fb-loading.gif">');
    var manga_id = $('#title-detail-manga').data('manga');
    var chap_id = $('#title-detail-manga').data('chapter');
    $.ajax({
        url: '/?act=ajax&code=send_comment',
        type: "POST",
        data: {
            manga_id:manga_id,
            chap_id:chap_id,
            name:name,
            user_id:user_id,
            comment_id:comment_id,
            content: value_check_input
        },
        dataType:'json',
        success: function(result){
            if(result.comment_status=='locked'){
                swal.fire('','Your comment is currently being hidden because you are using the terms that violate the community. Your comment will be displayed after the admin approves it!');
                $('#comment_form_'+comment_id).summernote('destroy');
                $('#comment_form_'+comment_id).hide();
                $('#input_form_'+comment_id).hide();
                $('.placeholder').show();
                var end_time = Math.floor(Date.now() / 1000);
                $('#ajax_time_res').val(end_time);
                return false;
            }
            $('#comment_form_'+comment_id).summernote('destroy');
            $('#comment_form_'+comment_id).hide();
            $('#input_form_'+comment_id).hide();
            $('.placeholder').show();
            var comment_page_num = $('#comment_page_num').val();
            var comment_type_sort = $('#comment_type_sort').val();
            var comment_type_chap = $('#comment_type_chap').val();
            if(comment_id==0){
                load_list_comment(1,comment_type_sort,comment_type_chap,'tab_comment_id');
            }else {
                load_list_comment(comment_page_num, comment_type_sort, comment_type_chap);
                var cur_url = document.location.href.split("#");
                var url_comment_page_num = cur_url[0] + "#comment_" + result.comment_id_insert;
                document.location = url_comment_page_num;
            }
            var end_time = Math.floor(Date.now() / 1000);
            $('#ajax_time_res').val(end_time);
        }}
    );
}
function voteComment(comment_id,type){
    var start_time = Math.floor(Date.now() / 1000);
    var ajax_time_res = $('#ajax_time_res').val();
    if((start_time-ajax_time_res)<5){
        var time_wait = 5-(start_time-ajax_time_res);
        Swal.fire('','You voted too fast, please wait '+time_wait+' second(s) to continue');
        return false;
    }

    var user_id = parseInt($('#user_id').val());
    if(user_id==0){
        swal.fire('','Please login for vote comment!');
        return false;
    }
    $.ajax({url: '/?act=ajax&code=like_comment&comment_id='+comment_id+'&user_id='+user_id+'&type='+type,
        dataType:'json',
        success: function(result){
            if(type==1){
                $('.vote-up-count').text(' '+result.like_num);
            }
            if(type==2){
                $('.vote-down-count').text(' '+result.dislike_num);
            }
            if(result.error=='liked_before'){
                swal.fire('','You voted this comment before!');
            }
            var end_time = Math.floor(Date.now() / 1000);
            $('#ajax_time_res').val(end_time);
        }}
    );
}
function openCommentAction(comment_id){
    $('.comment-more').addClass('hidden');
    $('#comment_more_'+comment_id).removeClass('hidden');
    $(document).click(function(e)
    {
        var container = $(".comment-more-wrap");
        // if the target of the click isn't the container nor a descendant of the container
        if (!container.is(e.target) && container.has(e.target).length === 0)
        {
            $('.comment-more').addClass('hidden');
        }
    });
}
function reportComment(comment_id){
    if(confirm("Are you sure this comment violates the Community Standards?")){
        $.ajax({url: '/?act=ajax&code=report_comment&comment_id='+comment_id,
            dataType:'json',
            success: function(result){
                alert('This comment has been reported.');
            }}
        );
    }
    /*Swal.fire({
        text: "Are you sure this comment violates the Community Standards?",
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, report it!'
    }).then((result) => {
        if (result.isConfirmed) {
            $.ajax({url: '/?act=ajax&code=report_comment&comment_id='+comment_id,
                dataType:'json',
                success: function(result){
                    Swal.fire(
                        '',
                        'This comment has been reported.'
                    )
                }}
            );

        }
    });*/
}
function deleteComment(comment_id){
    Swal.fire({
        text: "Are you sure delete this comment?",
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, delete it!'
    }).then((result) => {
        if (result.isConfirmed) {
            $.ajax({url: '/?act=ajax&code=delete_comment&comment_id='+comment_id,
                dataType:'json',
                success: function(result){
                    $('#comment_'+comment_id).remove();
                }}
            );

        }
    });
}
function unFollow(chap_id){
    Swal.fire({
        text: "Are you sure unfollow this manga?",
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, unfollow!'
    }).then((result) => {
        if (result.isConfirmed) {
            $.ajax({url: '/?act=ajax&code=unfollow&chap_id='+chap_id,
                dataType:'',
                success: function(result){
                    $('#manga_follow_'+result).remove();
                }}
            );

        }
    });
}
function deleteHistory(chap_id){
    Swal.fire({
        text: "Are you sure delete history this manga?",
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, delete history!'
    }).then((result) => {
        if (result.isConfirmed) {
            $.ajax({url: '/?act=ajax&code=delete_history&chap_id='+chap_id,
                dataType:'',
                success: function(result){
                    $('#li_hitory_manga_'+result).remove();
                }}
            );

        }
    });
}

ZeroDay Forums Mini