<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link},~{})">
    <title th:text="${application.website.name}+'_原创小说网站'"></title>
    <meta name="keywords" th:content="${application.website.keyword}"/>
    <meta name="description"
          th:content="${application.website.description}"/>
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
    <link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
    <link rel="stylesheet" href="/css/main.css"/>
</head>
<body>


<div th:replace="common/top :: top('0')">
</div>

<div class="main box_center cf">
    <div class="channelWrap channelBanner cf">
        <div class="leftBox">
            <div class="sliderContent">
                <dl class="scBigImg" id="carouseBig" th:if="${bookMap['0']}" >
                    <dd th:each="book,iterStat : ${bookMap['0']}" th:class="${iterStat.first}? 'on'"><a th:href="'/book/'+${book.bookId}+'.html'">
                        <img th:src="${book.picUrl}" th:alt="${book.bookName}"/></a></dd>
                </dl>
                <div class="scSmallImg" id="carouseSmall" >
                    <ul th:if="${bookMap['0']}">
                        <li th:each="book,iterStat : ${bookMap['0']}" th:class="${iterStat.first}? 'on'">
                        <img th:src="${book.picUrl}" th:alt="${book.bookName}"/></li>
                    </ul>
                </div>
            </div>
            <div class="hot_articles">
                <dl class="hot_recommend" id="topBooks1" th:if="${bookMap['1']} and ${#lists.size(bookMap['1']) > 0}">
                    <dt><a th:href="'/book/'+${bookMap['1'][0].bookId}+'.html'" th:text="${bookMap['1'][0].bookName}"></a></dt>
                    <dd th:if="${#lists.size(bookMap['1']) > 1}"><a th:href="'/book/'+${bookMap['1'][1].bookId}+'.html'" th:text="${bookMap['1'][1].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 2}" th:href="'/book/'+${bookMap['1'][2].bookId}+'.html'" th:text="${bookMap['1'][2].bookName}"></a></dd>
                    <dd th:if="${#lists.size(bookMap['1']) > 3}"><a th:href="'/book/'+${bookMap['1'][3].bookId}+'.html'" th:text="${bookMap['1'][3].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 4}" th:href="'/book/'+${bookMap['1'][4].bookId}+'.html'" th:text="${bookMap['1'][4].bookName}"></a></dd>
                </dl>
                <dl class="hot_recommend" id="topBooks2" th:if="${bookMap['1']} and ${#lists.size(bookMap['1']) > 5}">
                    <dt><a th:href="'/book/'+${bookMap['1'][5].bookId}+'.html'" th:text="${bookMap['1'][5].bookName}"></a></dt>
                    <dd th:if="${#lists.size(bookMap['1']) > 6}"><a th:href="'/book/'+${bookMap['1'][6].bookId}+'.html'" th:text="${bookMap['1'][6].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 7}" th:href="'/book/'+${bookMap['1'][7].bookId}+'.html'" th:text="${bookMap['1'][7].bookName}"></a></dd>
                    <dd th:if="${#lists.size(bookMap['1']) > 8}"><a th:href="'/book/'+${bookMap['1'][8].bookId}+'.html'" th:text="${bookMap['1'][8].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 9}" th:href="'/book/'+${bookMap['1'][9].bookId}+'.html'" th:text="${bookMap['1'][9].bookName}"></a></dd>
                </dl>

                <dl class="hot_notice" id="indexNews">
                    <dd style="text-align:left;" th:each="news : ${newsList}"><span th:text="'['+${news.catName}+']'"></span><a th:href="'/about/newsInfo-'+${news.id}+'.html'" th:utext="${news.title}"></a>
                    </dd>

                </dl>
            </div>
        </div>
        <div class="rightBox">
            <div class="title cf" id="weekcommend">
                <h3>本周强推</h3>
            </div>
            <div class="rightList">
                <ul id="currentWeek" th:if="${bookMap['2']}">
                    <li th:each="book,iterStat : ${bookMap['2']}"  th:class="${iterStat.first}? 'on num1': (${iterStat.index < 3}? 'num'+${iterStat.index+1})">
                        <div class="book_name"><i th:text="${iterStat.index+1}"></i><a class="name" th:href="'/book/'+${book.bookId}+'.html'" th:text="${book.bookName}"></a></div>
                        <div class="book_intro">
                            <div class="cover"><a th:href="'/book/'+${book.bookId}+'.html'"><img th:src="${book.picUrl}" th:alt="${book.bookName}"></a>
                            </div>
                            <a class="txt" th:href="'/book/'+${book.bookId}+'.html'" th:utext="${book.bookDesc}"></a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <div class="channelWrap channelPic cf">
        <div class="leftBox">
            <div class="title">
                <h2 class="on">热门推荐</h2>
            </div>
            <div class="picRecommend cf" id="hotRecBooks" th:if="${bookMap['3']}">
                <div class="itemsList" th:each="book : ${bookMap['3']}">
                    <a class="items_img" th:href="'/book/'+${book.bookId}+'.html'">
                        <img class="lazyload" src="/images/default.gif" th:data-src="${book.picUrl}" th:alt="${book.bookName}">
                    </a>
                    <div class="items_txt">
                        <h4><a th:href="'/book/'+${book.bookId}+'.html'" th:text="${book.bookName}"></a></h4>
                        <p class="author"><a href="javascript:void(0)" th:text="'作者：'+${book.authorName}"></a></p>
                        <p class="intro"><a th:href="'/book/'+${book.bookId}+'.html'" th:utext="${book.bookDesc}"></a>
                        </p>
                    </div>
                </div>

            </div>
        </div>
        <div id="bookrank1_ShowBookRank">
            <div class="rightBox ">
                <div class="title cf">
                    <h3 class="on">点击榜单</h3>
                </div>
                <div class="rightList">
                    <ul id="clickRankBooks">


                    </ul>
                    <div class="more"><a href="/book/book_ranking.html">查看更多&gt;</a></div>
                </div>
            </div>
        </div>
    </div>
    <div class="channelWrap channelPic cf">
        <div class="leftBox">
            <div class="title">
                <h2>精品推荐</h2>
            </div>
            <div class="picRecommend cf" id="classicBooks" th:if="${bookMap['4']}">
                <div class="itemsList" th:each="book : ${bookMap['4']}">
                    <a class="items_img" th:href="'/book/'+${book.bookId}+'.html'">
                        <img class="lazyload" src="/images/default.gif" th:data-src="${book.picUrl}" th:alt="${book.bookName}">
                    </a>
                    <div class="items_txt">
                        <h4><a th:href="'/book/'+${book.bookId}+'.html'" th:text="${book.bookName}"></a></h4>
                        <p class="author"><a href="javascript:void(0)" th:text="'作者：'+${book.authorName}"></a></p>
                        <p class="intro"><a th:href="'/book/'+${book.bookId}+'.html'" th:utext="${book.bookDesc}"></a>
                        </p>
                    </div>
                </div>

            </div>
        </div>
        <div id="bookrank2_ShowBookRank">
            <div class="rightBox ">
                <div class="title cf">
                    <h3 class="on">新书榜单</h3>
                </div>
                <div class="rightList">
                    <ul id="newRankBooks">


                    </ul>
                    <div class="more"><a href="/book/book_ranking.html?type=1">查看更多&gt;</a></div>
                </div>
            </div>
        </div>
    </div>
    <div class="channelWrap channelTable cf">
        <div class="leftBox">
            <div class="title">
                <h2>最新更新</h2>
            </div>
            <div class="updateTable">
                <table cellpadding="0" cellspacing="0">
                    <thead>
                    <tr>
                        <th class="style">类别</th>
                        <th class="name">书名</th>
                        <th class="chapter">最新章节</th>
                        <th class="author">作者</th>
                        <th class="time">更新时间</th>
                    </tr>
                    </thead>
                    <tbody id="newRankBooks2">


                    </tbody>
                </table>
            </div>
        </div>
        <div id="bookrank5_ShowBookRank">
            <div class="rightBox mb20">
                <div class="title cf">
                    <h3 class="on">更新榜单</h3>
                </div>
                <div class="rightList">
                    <ul id="updateRankBooks">


                    </ul>
                    <div class="more"><a href="/book/book_ranking.html?type=2">查看更多&gt;</a></div>
                </div>
            </div>
        </div>

    </div>
</div>
<div class="friend_link">
    <div class="box_center cf" id="friendLink">
        <span>友情链接：</span>
    </div>
</div>

<div th:replace="common/footer :: footer">
</div>


</body>
<div th:replace="common/js :: js"></div>
<script src="/javascript/lazyload.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    var $div = $('.scBigImg dl');//放置大图容器
    var $nav = $('.scSmallImg li');//放置缩略图容器
    var num = -1;
    var open;

    function changeKv() {
        if (num >= $nav.length - 1) {
            num = 0;
        } else {
            num++;
        }
        $nav.eq(num).trigger('mouseenter');
        open = setTimeout(changeKv, 3000);
    }

    changeKv();
    $nav.each(function (index) {
        $(this).off('mouseenter').on('mouseenter', function () {
            clearTimeout(open);

            $(this).addClass('on').siblings().removeClass('on');
            $('.scBigImg dd').eq(index).addClass('on').siblings().removeClass('on');
            $('.scSmallImg').off('mouseleave').on('mouseleave', function () {
                num = index;
                setTimeout(function () {
                    changeKv();
                }, 3000)
            })
        });
    });
    $div.each(function () {
        $(this).off('mouseenter').on('mouseenter', function () {
            clearTimeout(open);
        });
    });

    lazyload();
    $(function () {

        //点击榜单数据查询
        $.ajax({
            type: "get",
            url: "/book/listClickRank",
            data: {},
            dataType: "json",
            success: function (data) {
                if (data.code == 200) {
                    var clickRankBooks = data.data;
                    var clickRankBooksHtml = "";
                    for (var i = 0; i < clickRankBooks.length; i++) {
                        var clickRankBook = clickRankBooks[i];
                        var classHtml = "";
                        var imageHtml = "";
                        if (i == 0) {
                            classHtml = "on";
                            imageHtml = "<img src=\"" + clickRankBook.picUrl + "\" alt=\"" + clickRankBook.bookName + "\"/>";
                        }
                        if (i < 3) {
                            classHtml += (" num" + (i + 1));
                        }
                        clickRankBooksHtml += ("<li class=\"" + classHtml + "\">\n" +
                            "                            <div class=\"book_name\">\n" +
                            "                                <i>" + (i + 1) + "</i><a class=\"name\" href=\"/book/" + clickRankBook.id + ".html\">" + clickRankBook.bookName + "</a>\n" +
                            "                            </div>\n" +
                            "                            <div class=\"book_intro\">\n" +
                            "                                <div class=\"cover\">\n" +
                            "                                    <a href=\"book/" + clickRankBook.id + ".html\">"+ imageHtml +"</a>\n" +
                            "                                </div>\n" +
                            "                                <a class=\"txt\" href=\"/book/" + clickRankBook.id + ".html\">" + clickRankBook.bookDesc + "</a>\n" +
                            "                            </div>\n" +
                            "\n" +
                            "                        </li>");
                    }
                    $("#clickRankBooks").html(clickRankBooksHtml);
                } else {
                    layer.alert(data.msg);
                }

            },
            error: function () {
                layer.alert('网络异常');
            }
        })
        //新书榜单查询
        $.ajax({
            type: "get",
            url: "/book/listNewRank",
            data: {},
            dataType: "json",
            success: function (data) {
                if (data.code == 200) {
                    var newRankBooks = data.data;
                    var newRankBooksHtml = "";
                    for (var i = 0; i < newRankBooks.length; i++) {
                        var newRankBook = newRankBooks[i];
                        var classHtml = "";
                        var imageHtml = "";
                        if (i == 0) {
                            classHtml = "on";
                            imageHtml = "<img src=\"" + newRankBook.picUrl + "\" alt=\"" + newRankBook.bookName + "\"/>";
                        }
                        if (i < 3) {
                            classHtml += (" num" + (i + 1));
                        }
                        newRankBooksHtml += ("<li class=\"" + classHtml + "\">\n" +
                            "                            <div class=\"book_name\">\n" +
                            "                                <i>" + (i + 1) + "</i><a class=\"name\" href=\"/book/" + newRankBook.id + ".html\">" + newRankBook.bookName + "</a>\n" +
                            "                            </div>\n" +
                            "                            <div class=\"book_intro\">\n" +
                            "                                <div class=\"cover\">\n" +
                            "                                    <a href=\"book/" + newRankBook.id + ".html\">" + imageHtml + "</a>\n" +
                            "                                </div>\n" +
                            "                                <a class=\"txt\" href=\"/book/" + newRankBook.id + ".html\">" + newRankBook.bookDesc + "</a>\n" +
                            "                            </div>\n" +
                            "\n" +
                            "                        </li>");
                    }
                    $("#newRankBooks").html(newRankBooksHtml);
                } else {
                    layer.alert(data.msg);
                }

            },
            error: function () {
                layer.alert('网络异常');
            }
        })
        //更新榜单查询
        $.ajax({
            type: "get",
            url: "/book/listUpdateRank",
            data: {},
            dataType: "json",
            success: function (data) {
                if (data.code == 200) {
                    var updateRankBooks = data.data;
                    var updateRankBookHtml = "";
                    var updateRankBookHtml2 = "";
                    for (var i = 0; i < updateRankBooks.length; i++) {
                        var updateRankBook = updateRankBooks[i];
                        var classHtml = "";
                        var imageHtml = "";
                        if (i == 0) {
                            classHtml = "on";
                            imageHtml = "<img\ src=\"" + updateRankBook.picUrl + "\" alt=\"" + updateRankBook.bookName + "\"/>";
                        }
                        if (i < 3) {
                            classHtml += (" num" + (i + 1));
                        }
                        if (i < 10) {
                            updateRankBookHtml += ("<li class=\"" + classHtml + "\">\n" +
                                "                            <div class=\"book_name\">\n" +
                                "                                <i>" + (i + 1) + "</i><a class=\"name\" href=\"/book/" + updateRankBook.id + ".html\">" + updateRankBook.bookName + "</a>\n" +
                                "                            </div>\n" +
                                "                            <div class=\"book_intro\">\n" +
                                "                                <div class=\"cover\">\n" +
                                "                                    <a href=\"book/" + updateRankBook.id + ".html\">" + imageHtml + "</a>\n" +
                                "                                </div>\n" +
                                "                                <a class=\"txt\" href=\"/book/" + updateRankBook.id + ".html\">" + updateRankBook.bookDesc + "</a>\n" +
                                "                            </div>\n" +
                                "\n" +
                                "                        </li>");
                        }
                        updateRankBookHtml2 += ("<tr>\n" +
                            "                        <td class=\"style\"><a href=\"book/bookclass.html?c=" + updateRankBook.catId + "\">[" + updateRankBook.catName + "]</a></td>\n" +
                            "                        <td class=\"name\"><a href=\"/book/" + updateRankBook.id + ".html\">" + updateRankBook.bookName + "</a></td>\n" +
                            "                        <td class=\"chapter\"><a href=\"/book/" + updateRankBook.id + ".html\">" + updateRankBook.lastIndexName + "</a>\n" +
                            "                            <i class=\"\"></i>\n" +
                            "                        </td>\n" +
                            "                        <td class=\"author\"><a href=\"javascript:void(0)\">" + updateRankBook.authorName + "</a></td>\n" +
                            "                        <td class=\"time\">" + updateRankBook.lastIndexUpdateTime + "</td>\n" +
                            "                    </tr>");
                    }
                    $("#updateRankBooks").html(updateRankBookHtml);
                    $("#newRankBooks2").html(updateRankBookHtml2);
                } else {
                    layer.alert(data.msg);
                }

            }
            ,
            error: function () {
                layer.alert('网络异常');
            }
        })
        //友情链接查询
        $.ajax({
            type: "get",
            url: "/friendLink/listIndexLink",
            data: {},
            dataType: "json",
            success: function (data) {
                if (data.code == 200) {
                    var friendLinkList = data.data;
                    var friendLinkHtml = "";
                    for (var i = 0; i < friendLinkList.length; i++) {
                        var friendLink = friendLinkList[i];
                        friendLinkHtml += ("<a target='_blank' href=\"" + friendLink.linkUrl + "\">" + friendLink.linkName + "</a>");
                    }
                    $("#friendLink").append(friendLinkHtml);
                } else {
                    layer.alert(data.msg);
                }

            },
            error: function () {
                layer.alert('网络异常');
            }
        })
        $("#weekcommend h3").mouseover(function () {
            $("#weekcommend h3").removeClass("on");
            $(this).addClass("on");
            if ($(this).attr("class").indexOf("fr") >= 0) {
                $("#currentWeek").hide();
                $("#currentPreWeek").show();
            } else {
                $("#currentPreWeek").hide();
                $("#currentWeek").show();
            }
        });
    });
</script>
</html>