﻿
$(function () {
    //$(".nav li").each(function () {
    //    $this = $(this);
    //    if (String(window.location.pathname)==$this.children("a:eq(0)").attr("href")) {
    //        $this.addClass("active");
    //    }
    //});

    //head Fixed
    $(window).scroll(function () {
        if ($(window).scrollTop() > 90) {
            $("#header").addClass("fixed");
        }
        else {
            $("#header").removeClass("fixed");
        }
    });

    $("body").on("click", ".navbar-toggle", function () {
        $("body").toggleClass("navbar-on"),
        0 == $(".navbar-on-shadow").length && $("#wrap").append('<div class="navbar-on-shadow"></div>'),
        $("nav").removeClass("collapsing").addClass("collapse in")
    });

    $(".search-index a").click(function ()
    { $(".search-index .search-form").animate({ width: "220px" }, "fast") }),
    $(document).on("click", function (t) { $target = $(t.target), 0 == $target.closest(".search-index .search-form").length && 0 == $target.closest(".search-index a").length && $(".search-index .search-form").animate({ width: "0" }, "fast") })

    $(window).scroll(function () { $(window).scrollTop() > 100 ? $("#j-top").fadeIn("slow") : $("#j-top").fadeOut("slow") })

    var l, o;
    $(".action").on("mouseenter", ".wechat", function () { clearTimeout(l), $(".contact-wrap").hide(), $(".wechat-wrap").show() }).on("mouseleave", ".wechat", function () { l = setTimeout(function () { $(".wechat-wrap").hide() }, 300) }).on("mouseenter", ".contact", function () { clearTimeout(o), $(".wechat-wrap").hide(), $(".contact-wrap").show() }).on("mouseleave", ".contact", function () { o = setTimeout(function () { $(".contact-wrap").hide() }, 300) }).on("click", "#j-top", function () { $("html, body").animate({ scrollTop: 0 }, "slow") }).on("mouseenter", ".bds_more", function () { $(this).hasClass("share") ? $(".bdshare_popup_box").length ? $(".bdshare_popup_box").addClass("j-share") : setTimeout(function () { t() }, 15) : $(".bdshare_popup_box").removeClass("j-share") })

    $("img.j-lazy").lazyload({ effect: "fadeIn" });
});
function t() { var e = document.createElement("bootstrap"), t = { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend" }; for (var a in t) if (void 0 !== e.style[a]) return { end: t[a] }; return !1 }

//获取点击总数
function ajaxView(obj, webpath, id) {
    $.get(webpath + "tools/submit_ajax.ashx?action=view_article_click&click=1&id=" + id, function (data) {
        $(obj).text(data);
    }, "html");
}
//初始化视频播放器需配合ckplayer.js使用
function initCKPlayer(boxId, videoSrc, playerSrc) {
    var flashvars = {
        f: videoSrc,
        c: 0,
        loaded: 'loadedHandler'
    };
    var video = [videoSrc];
    CKobject.embed(playerSrc, boxId, 'video_v1', '100%', '100%', false, flashvars, video);
}