//修改列表图片大小
$(function () {
    //if( ($('#pageViewId').val() == 'shouye') || ($('#pageViewId').val() == 'online_first') || ($('#pageViewId').val() == 'latest_all') || ($('#pageViewId').val() == 'latest_accepted') || ($('#pageViewId').val() == 'current') || ($('#pageViewId').val() == 'online_first_en') || ($('#pageViewId').val() == 'current_en') || ($('#pageViewId').val() == 'latest_all_en') || ($('#pageViewId').val() == 'latest_accepted_en') || ($('#pageViewId').val() == 'archive')|| ($('#pageViewId').val() == 'archive_en') ){
    if ($('.article-list')) {
        // $("#onlineFirst .article-list,#lan .article-list,#topdownlist .article-list ,#current .article-list,#archive-article .article-list").each(function(){
        $('.article-list').each(function () {
            $(this).find(".article-list-left").css({"height": 105});
            $(this).find(".article-list-left").children().addClass("allCenter");
            $(this).find(".article-list-left").children("span").css({
                "height": '100%',
                "line-height": 105,
                'width': '100%'
            })
        });
    } else {
        /* console.log('ss') */
        $(".article-list").each(function () {
            var h = $(this).find(".article-list-title a").css("line-height");
            $(this).css({'paddingLeft': '20px', 'paddingRight': '20px'})
            $(this).find(".article-list-left").css({"height": h});
            $(this).find(".article-list-left").children().addClass("allCenter");
            $(this).find(".article-list-left").children("span").css({"height": h, "line-height": h})
        });
    }

})

//判断屏幕分辨率，根据屏幕分辨率设置样式
$(function () {
    if ($(window).width() < 1190) {
        if ($('#pageViewId').val() == 'shouye') {
            //console.log(1)
        } else {
            $('.main-right').css({'width': '100%'})
            $('.article-list .article-list-right').css({'width': '100%'})
            //console.log(2)
        }

    }
})

$(function () {
    //console.log($('.arcwrap .navarccon li').length)
    if ($('.arcwrap .navarccon li').length == 0) {
        $('.arcwrap .navarccon').css({'display': 'none'})
    }
})


//详情页面滚动事件处理
$(document).scroll(function () {
    if ($('.left-slip-box').length > 0) {
        var scroH = $(document).scrollTop();
        //console.log(scroH)
        if (scroH > 240) {
            $('.left-slip-box').css({'top': '0%', 'position': 'fixed'})

        } else {
            $('.left-slip-box').css({'top': 'auto', 'position': 'absolute'})
        }


    }

})


//限制导航下拉宽度和一级导航宽度相等
//$(function(){
//	$('.top-nav ul > li').each(function(){
//		var w = $(this).width();
//		$(this).find('ol li').each(function(){
//			$(this).width(w)
//		})

//	})
//})

/* 字符串截取 */
// $(function(){
//
//     $(".rmsjz ul li a").subTextMax({
//     	keep_len:14
//     });
//
// })

//点击下载弹出弹框列表
$(function () {
    $(".pdftc").click(function (n) {
        var articleId = $(this).attr("downarticleid");
        //console.log(articleId);
        var html = $("#article_file_div_" + articleId).html();
        $("#articleFile").empty();
        $("#articleFile").append(html);
        $('#myModaltc').modal('show');
    })
    /*
    $.ajax({
        url: local_host + 'articleFile/list',
        success:function(data){
            try {
                $.each(data,function(i,e){
                    $("#article_file_" + i).show();
                    var html = "";
                    $.each(e, function(ii,ee){
                        html += "<li><a href=\"javascript:void(0);\" onclick=\"downloadFile('"+ee.fileId+"');\">"+ee.fileName+"<img src=\""+local_host+"style/web/images/custom/download.png\"></a></li>";
                    });
                    $("#article_file_div_" + i).append(html);
                });
            } catch (e) {
                console.log(e);
            }
        }
    });
    */
    /*数字滚动*/
    var options = {
        useEasing: true,
        useGrouping: true,
        separator: ',',
        decimal: '.',
        prefix: '',
        suffix: ''
    };
    var options1 = {
        useEasing: true,
        useGrouping: true,
        separator: ',',
        decimal: '.',
        prefix: '',
        suffix: '<i>GB</i>'
    };
    if ($("#public_left_hot_article").length > 0) {
        $.ajax({
            url: local_host + 'articleFile/systemTotal',
            success: function (data) {
                new CountUp("sjjzdx", 0, data.sjsl, 0, 2.5, options).start();
                //new CountUp("sjjzdx", 0, data.sjjzdx + 128.3, 2, 2.5, options1).start();
                new CountUp("llcs", 0, data.llcs, 0, 2.5, options).start();
                new CountUp("xzcs", 0, data.xzcs, 0, 2.5, options).start();
                //new CountUp("sjjxzl", 0, data.sjjxzl, 2, 2.5, options1).start();
                new CountUp("bycs", 0, data.bycs, 0, 2.5, options).start();
            }
        });


        $.ajax({
            url: local_host + 'articleFile/getAllView',
            data: {'maxPaper': 8},
            success: function (result) {
                var html = "";
                html = "<li><a href='javascript:void(0);' class='fr'>浏览量</a></li>";
                $.each(result.records, function (i, v) {
                    var href = "";
                    if (v.doi != null && v.doi != '') {
                        href = "cn/article/doi/" + v.doi;
                    } else {
                        href = "cn/article/id/" + v.id;
                    }
                    html += "<li><a href='" + local_host + href + "' class='search-article-abstract'>" + v.titleCn + "</a><i>" + v.viewCount + "</i></li>";
                });
                $("#public_left_hot_article").html(html);
                $(".search-article-abstract").subTextMax({
                    trim: false,
                    keep_len: 15,
                    add_title: false,
                    content_type: 'html'
                });
            }
        });
    }

    //馆藏报告-热门报告
    if ($("#left_hot_gcbg").length > 0) {
        $.ajax({
            url: local_host + 'articleFile/getAllView',
            data: {'maxPaper': 8, 'columnType': 4},
            success: function (result) {
                var html = "";
                html = "<li><a href='javascript:void(0);' class='fr'>浏览量</a></li>";
                $.each(result.records, function (i, v) {
                    var href = "";
                    if (v.doi != null && v.doi != '') {
                        href = "cn/article/doi/" + v.doi;
                    } else {
                        href = "cn/article/id/" + v.id;
                    }
                    html += "<li><a href='" + local_host + href + "' class='search-article-abstract'>" + v.titleCn + "</a><i>" + v.viewCount + "</i></li>";
                });
                $("#left_hot_gcbg").html(html);
                $("#right_hot_gcbg").html(html);
                $(".search-article-abstract").subTextMax({
                    trim: false,
                    keep_len: 15,
                    add_title: false,
                    content_type: 'html'
                });
            }
        });

        //馆藏报告-统计信息
        $.ajax({
            url: local_host + 'articleFile/systemTotal',
            data: {'columnType': 4},
            success: function (result) {
                new CountUp("bggs", 0, result.sjsl, 0, 2.5, options).start();
                new CountUp("wjgs", 0, result.sjjs, 0, 2.5, options).start();
                new CountUp("llcs", 0, result.llcs, 0, 2.5, options).start();
                new CountUp("xzcs", 0, result.xzcs, 0, 2.5, options).start();
            }
        });
    }

    //馆藏报告-热门报告
    if ($("#right_hot_gcbg").length > 0) {
        $.ajax({
            url: local_host + 'articleFile/getAllView',
            data: {'maxPaper': 8, 'columnType': 4},
            success: function (result) {
                var html = "";
                html = "<li><a href='javascript;' class='fr gcbg-hot-view'>浏览量</a></li>";
                $.each(result.records, function (i, v) {
                    var href = "";
                    if (v.doi != null && v.doi != '') {
                        href = "cn/article/doi/" + v.doi;
                    } else {
                        href = "cn/article/id/" + v.id;
                    }
                    html += "<li><a href='" + local_host + href + "' class='search-article-abstract'>" + v.titleCn + "</a><i>" + v.viewCount + "</i></li>";
                });
                $("#right_hot_gcbg").html(html);
                $(".search-article-abstract").subTextMax({
                    trim: false,
                    keep_len: 12,
                    add_title: false,
                    content_type: 'html'
                });
            }
        });

        //馆藏报告-统计信息
        $.ajax({
            url: local_host + 'articleFile/systemTotal',
            data: {'columnType': 4},
            success: function (result) {
                new CountUp("gcbg_bggs", 0, result.sjsl, 0, 2.5, options).start();
                new CountUp("gcbg_wjgs", 0, result.sjjs, 0, 2.5, options).start();
                new CountUp("gcbg_llcs", 0, result.llcs, 0, 2.5, options).start();
                new CountUp("gcbg_xzcs", 0, result.xzcs, 0, 2.5, options).start();
            }
        });
    }
})

function initPagination_MuseumHide() {
    $("#gcFormAction").submit();
}


//	function pdftc(str){
//		$('#myModaltc').modal('show')
//	}


$(function () {
    var ajaxArg = {
        url: local_host + "zcustom/setAccessCount",
        returnFun: getAccessCount
    };
    ajaxPost(ajaxArg);
})

function getAccessCount(data) {
    var accessCount = eval(data.AccessCount);
    $(".accessCount").html(accessCount);
}









