var domainwww = $("body").attr("data-domainwww");
var zburl = domainwww + "get";
var puturl = domainwww + "put";
if ($(".zbtwonav").length > 0) {
    var navSwiper = new Swiper('.zbtwonav', {
        freeMode: true,
        slidesPerView: 'auto',
        freeModeSticky: true,
    });
    var dhsyz = '';
    var gdwz = 0;
    $(".swiper-wrapper a").each(function(i, o) {
        if ($(o).hasClass("zbtwohover")) {
            dhsyz = i;
            navSlideWidth = $(this).css('width')
        }
    });
    if (dhsyz < 6) {
        navSwiper.setTranslate(0)
    } else {
        gdwz = (parseInt(navSlideWidth) / 2) * (dhsyz + 1);
        navSwiper.setTranslate(-gdwz)
    }
};
if ($(".zb_plzx").length > 0) {
    $(".zxpl_list").children().eq(0).show().siblings().hide();
    $(".zb_plzx li").eq(0).addClass("zbhover").siblings().removeClass("zbhover");
    $(".zb_plzx li").click(function() {
        $(this).addClass("zbhover").siblings().removeClass("zbhover");
        $(".zxpl_list").children().eq($(this).index()).show().siblings().hide()
    })
};
if ($(".lxxhlist").length > 0) {
    $(".lxxhlist").click(function() {
        $(".lxxinhaolb").show();
        $(".zxpl_list").hide()
    });
    $(".offlxxhlb").click(function() {
        $(".lxxinhaolb").hide();
        $(".zxpl_list").show()
    })
};
if ($(".replylist").length > 0) {
    $(".comment_xg_reply").click(function() {
        $(".replylist").hide();
        $(".pinlungrlist").show()
    });
    $(".grpltitle").click(function() {
        $(".replylist").show();
        $(".pinlungrlist").hide()
    })
};
if ($(".wdplnr").length) {
    $('.wdplnr').bind({
        focus: function() {
            $(".yh_photo").hide();
            $(".fabuplbtn").show()
        },
        blur: function() {},
    })
};
$(".fabuplbtn").click(function() {
    $(".tskuan_black").show();
    $(".tskuan_black p").html("发表成功");
    setTimeout(function() {
        $(".tskuan_black").hide()
    }, 1500)
});
$(".pl_nrong").on("click", ".pl_zan", function() {
    var b = $(this).parents(".comment_xg").find(".comment_replynum .huifupl").attr("data-id");
    var c = this;
    $.ajax({
        url: puturl,
        dataType: "json",
        async: true,
        data: {
            act: 5,
            id: b,
            from: 1,
        },
        type: "POST",
        success: function(r) {
            if (r.status == 1) {
                var a = $(c).find("cite").html();
                $(c).find("cite").html(parseInt(a) + 1)
            } else {
                $(".tskuan_black p").html(r.message);
                $(".tskuan_black").show();
                setTimeout(function() {
                    $(".tskuan_black").hide()
                }, 2000)
            }
        },
        error: function(r) {},
    })
});
$(".pl_nrong").on("click", ".pl_cai", function() {
    var b = $(this).parents(".comment_xg").find(".comment_replynum .huifupl").attr("data-id");
    var c = this;
    $.ajax({
        url: puturl,
        dataType: "json",
        async: true,
        data: {
            act: 5,
            id: b,
            from: 2,
        },
        type: "POST",
        success: function(r) {
            if (r.status == 1) {
                var a = $(c).find("cite").html();
                $(c).find("cite").html(parseInt(a) + 1)
            } else {
                $(".tskuan_black p").html(r.message);
                $(".tskuan_black").show();
                setTimeout(function() {
                    $(".tskuan_black").hide()
                }, 2000)
            }
        },
        error: function(r) {},
    })
});
$(".pl_nrong").on("click", ".jubaopl", function() {
    var c = $(this).parents(".comment_block").find(".comment_xg .huifupl").attr("data-id");
    $(".report_block").addClass("jubao_active");
    if ($(".mask").length > 0) {
        $(".mask").addClass("mask_active")
    } else {
        $("body").append('<div class="mask"></div>');
        $(".mask").addClass("mask_active")
    };
    $(".report_block").attr("data-id", c);
    $.ajax({
        url: zburl,
        dataType: "json",
        async: true,
        data: {
            act: 51,
        },
        type: "POST",
        success: function(r) {
            var b = r.data;
            if (r.data.length > 0) {
                $(".report_item").html('');
                $.each(b, function(i, v) {
                    var a = "<li data-id='" + v.id + "'><span></span>" + v.option + "</li>";
                    $(".report_item").append(a)
                })
            }
        },
        error: function(r) {},
    })
});
$(".offjubao").click(function() {
    $(".report_block").removeClass("jubao_active");
    setTimeout(function() {
        $(".mask_active").removeClass("mask_active");
        $(".mask").remove()
    }, 300)
});
$(".report_item").on("click", "li", function() {
    if ($(this).is('.report_item_select')) {
        $(this).removeClass("report_item_select")
    } else {
        $(this).addClass("report_item_select").siblings().removeClass("report_item_select")
    }
});
$(".report_btn_queding").click(function() {
    var a = $(".report_item").find(".report_item_select").attr("data-id");
    var b = $(".report_block").attr("data-id");
    var c = '';
    if (a == undefined) {
        c = ''
    } else {
        c = a
    }; if (c == '') {
        $(".tskuan_black").show();
        $(".tskuan_black p").html("举报内容不能为空");
        setTimeout(function() {
            $(".tskuan_black").hide()
        }, 2000)
    } else {
        $.ajax({
            url: puturl,
            dataType: "json",
            async: true,
            data: {
                act: 6,
                id: b,
                reportid: c,
            },
            type: "POST",
            success: function(r) {
                $(".report_block").removeClass("jubao_active");
                setTimeout(function() {
                    $(".mask_active").removeClass("mask_active");
                    $(".mask").remove()
                }, 300);
                $(".report_block").attr("data-id", '');
                $(".tskuan_black p").html(r.message);
                $(".tskuan_black").show();
                setTimeout(function() {
                    $(".tskuan_black").hide()
                }, 1000)
            },
            error: function(r) {},
        })
    }
});