<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<!--<html xmlns:th="http://www.thymeleaf.org" lang="en">-->

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>客户详情</title>
    <link rel="stylesheet" href="/static/css/customerDetail/css/weui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/customerDetail/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="/static/css/customerDetail/css/style.css">
    <link rel="stylesheet" href="/static/css/customerDetail/css/style-new.css">
    <link rel="stylesheet" href="/static/css/wechat/tag.css">
</head>
<input type="hidden" id="customerId" th:value="${customer.id}"/>
<body ontouchstart class="kehu-detail">
<header>
    <div class="header">
        <a href="javascript:history.go(-1);" class="btn-a-back"><i class="iconfont">&#xe61f;</i></a>
        <h2>客户详情</h2>
        <a href="" class="btn-add-visit"
           th:href="'javascript:goToUrl(\'' + @{/customer/toUpdateCustomer(customerId=${customer.id})} + '\')'">编辑</a>
    </div>
</header>
<div class="kehu-panel">
    <div class="head-flex">
        <div class="img-container" th:if="${customer.sex} eq '0'">
            <img src="/static/css/customerDetail/img/uWomen.jpg" alt="">
        </div>
        <div class="img-container" th:if="${customer.sex} eq '1'">
            <img src="/static/css/customerDetail/img/uMan.jpg" alt="">
        </div>
        <div class="img-container" th:if="${customer.sex} eq '2'">
            <img src="/static/css/customerDetail/img/uUnknown.jpg" alt="">
        </div>
        <div class="detail">
            <div class="name">
                <input class="weui-input" type="text" th:value="${customer.name}" readonly/>
            </div>
            <a th:href="|tel:${customer.phone}|" th:text="${customer.phone}" class="tel"></a>
            <a th:href="|tel:${customer.bakPhone1}|" th:text="${customer.bakPhone1}" class="tel"></a>
            <div class="jingli"><img src="/static/css/customerDetail/img/u2749.png" alt="">
                <input class="weui-input" type="text" th:value="${customer.managerName}" readonly/>
            </div>
            <div class="bor-t">
                <div class="center" >
                    <span style="margin-right:2px;margin-bottom:2px" th:each="label: ${labs}" class="all-tag-item gray" th:data="${label.colorId}" th:attr="dataIndex=${label.labelId}" th:content="${label.labelId}"><p th:text="${label.labelName}"></p></span>
                </div>
            </div>
        </div>
        <div class="call">
            <a th:href="|tel:${customer.phone}|">
                <img src="/static/css/customerDetail/img/u2747.png" alt="">
            </a>
        </div>
    </div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell weui-cell_select weui-cell_select-after">
            <div class="weui-cell__hd">
                <label for="" class="weui-label">跟踪状态</label>
            </div>
            <div class="weui-cell__bd">
                <select id="traceStatus" class="weui-select" name="selectCustomerInfo">
                    <option value="1" th:selected="${customer.traceStatus==1}">有效</option>
                    <option value="2" th:selected="${customer.traceStatus==2}">已购</option>
                    <option value="3" th:selected="${customer.traceStatus==3}">我购</option>
                    <option value="4" th:selected="${customer.traceStatus==4}">暂缓</option>
                </select>
            </div>
        </div>
        <div class="weui-cell weui-cell_select weui-cell_select-after">
            <div class="weui-cell__hd">
                <label for="" class="weui-label">购房意向</label>
            </div>
            <div class="weui-cell__bd" th:switch="${customer.buyIntention}">
                <select id="buyIntention" class="weui-select" name="selectCustomerInfo">
<!--                    <option value="" th:selected="${customer.buyIntention==''}">待定</option>-->
                    <option value="1" th:selected="${customer.buyIntention=='1'}">A</option>
                    <option value="2" th:selected="${customer.buyIntention=='2'}">B</option>
                    <option value="3" th:selected="${customer.buyIntention=='3'}">C</option>
                    <option value="4" th:selected="${customer.buyIntention=='4'}">D</option>
                    <option value="5" th:selected="${customer.buyIntention=='5'}">E(丢入公海)</option>
                </select>
            </div>
        </div>
    </div>
</div>
<div class="switch-panel">
    <div class="switch-bar">
        <a class="switch-bar-item active">客户跟进</a>
        <a class="switch-bar-item">约看记录</a>
        <a class="switch-bar-item">客户日志</a>
    </div>
    <div class="switch-item active">
        <div class="weui-cells__title">回访记录</div>
        <div class="timeline">
            <div th:if="${backLogList}" th:each="backLog:${backLogList}" class="timeline-item">
                <div class="dot"></div>
                <div class="timeline-header">
                    <span th:text="${backLog.managerName}"></span>
                    <span th:text="${#dates.format(backLog.createTime.time,'yyyy-MM-dd HH:mm:ss')}"></span>
                </div>
                <div class="content">
                    <input class="weui-input" type="text" th:value="${backLog.content}" readonly/>

                    <span th:if="${backLog.callRecordId} gt 0">
                         <audio controls>
                             <source th:src="${backLog.callRecordName}">
                               Your browser does not support this audio format.
                         </audio>
                    </span>
                </div>
            </div>
            <div th:if="${#lists.isEmpty(backLogList)}" class="timeline-item">
                <span style="font-size: 14px">暂无记录</span>
            </div>
        </div>
        <div class="weui-cells__title">客户情况与来源</div>
        <div class="weui-cells weui-cells_form">
            <div th:each="oldCustomer:${oldList}" class="weui-cell">
                <div class="weui-cell__bd">
                    <div class="b-title">
                        <input class="weui-input" type="text" th:value="${oldCustomer.actSource}" readonly/>
                    </div>
                    <div class="time">
                        <span th:text="${#dates.format(oldCustomer.createTime.time,'yyyy-MM-dd HH:mm:ss')}"></span>
                    </div>
                </div>
                <div class="weui-cell__ft">
                    <span th:text="${oldCustomer.createSource}"></span>
                </div>
            </div>
        </div>
    </div>
    <div class="switch-item">
        <div th:if="${cpList}" class="weui-cells" th:each="cp:${cpList}">
            <a class="weui-cell weui-cell_access"
               th:onclick="'goToUrl(\'' + @{/project/reportcustomer(customerProjectId=${cp.id})} + '\')'">
                <div class="weui-cell__bd">
                    <div class="link-title">
                        <span th:text="${cp.projectName}" readonly></span>
                        <span th:if="${cp.remark} != '' " class="new-icon" th:text="${cp.remark}" readonly></span>
                    </div>
                    <div class="time">
                        <span th:text="${#dates.format(cp.createTime.time,'yyyy-MM-dd HH:mm:ss')}"></span>
                    </div>
                </div>
                <div class="weui-cell__ft">
                    <span th:if="${cp.status eq 1}">约看</span>
                    <span th:if="${cp.status eq 2}">到访</span>
                    <span th:if="${cp.status eq 3}">认筹</span>
                    <span th:if="${cp.status eq 4}">认购</span>
                    <span th:if="${cp.status eq 5}">签约</span>
                    <span th:if="${cp.status eq 6}">退房</span>
                </div>
            </a>
        </div>
        <div th:if="${#lists.isEmpty(cpList)}" class="weui-cells">
            <span style="font-size: 14px">暂无记录</span>
        </div>
    </div>
    <div class="switch-item">
        <div class="timeline" style="margin-top: 10px" th:each="log:${logShowList}">
            <div class="timeline-item">
                <div class="dot"></div>
                <div class="timeline-header">
                    <span th:text="${log.createTime}"></span>
                </div>
                <div class="content">
                    <span th:text="${log.showWord}" readonly></span>
                </div>
            </div>

        </div>
    </div>
</div>
<div style="height: 56px">
    <div class="tool-bar">
        <a class="tool-item a" id="crmView"><img src="/static/css/customerDetail/img/u2995.png" alt="">视图</a>
        <a th:href="'javascript:goToUrl(\'' + @{/project/addvisit(customerId=${customer.id},buyIntention=${customer.buyIntention})} + '\')'"
           class="tool-item s">
            <img src="/static/css/customerDetail/img/u2808.png" alt="">添加回访
        </a>
        <a class="tool-item d" onclick="projectShow()">
            <img src="/static/css/customerDetail/img/u2999.png" alt="">约看客户
        </a>
    </div>
</div>

<div class="js_dialog" id="bindDialog" style="opacity: 0; display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">是否约看至该项目</strong></div>
        <div class="weui-dialog__bd"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">否</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">是</a>
        </div>
    </div>
</div>

<!--提交成功提示-->
<div id="toast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-icon-success-no-circle weui-icon_toast"></i>
        <p class="weui-toast__content">保存成功</p>
    </div>
</div>

<div id="noProjectToast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-icon_toast"></i>
        <p class="weui-toast__content">暂时没有可指派的项目</p>
    </div>
</div>

<div class="weui-mask" id="projectMask" style="display: none"></div>

<div class="weui-actionsheet" id="projectMasksheet2"
     style="height: 3.35rem;z-index: 10000;position: absolute;bottom: 23.35rem;display: none">
    <div class="weui-actionsheet__menu" id="projectSheet2">
        <div class="clearfix" style="padding: 0.9rem;position: relative;">

            <input id="project" type="search" class="inp-search fl" placeholder=""
                   style="width: 13.5rem;height: 1.55rem;"/>

            <div class="text-search" id="projectSearch" th:onclick="'projectNameShow()'"
                 style="width: 4.25rem;float:right;text-align: center;position: absolute;right: 0rem;height: 3.3rem;top: 0;line-height: 3.3rem;">
                搜索
            </div>
        </div>
    </div>

</div>

<div class="weui-actionsheet" id="projectMasksheet" style="padding-top:3.35rem">
    <div class="weui-actionsheet__menu" id="projectSheet">
        <div class="weui-actionsheet__cell" th:each="project : ${projectListData}"
             th:onclick="'bindProject('+${project.id}+')'" th:text="${project.projectName}"></div>
    </div>
</div>

<div id="loadingToast" style="opacity: 0; display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">数据加载中</p>
    </div>
</div>

<div class="js_dialog" id="deleteDialog" style=" display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">设置无效后，客户将被转移至公海，是否继续？</strong></div>
        <div class="weui-dialog__bd"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">否</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">是</a>
        </div>
    </div>
</div>

<input type="hidden" name="bindCustomerId" id="bindCustomerId">
<input type="hidden" name="bindProjectId" id="bindProjectId">

<script type="text/javascript" src="/static/css/customerDetail/js/zepto.min.js"></script>
<script type="text/javascript" src="/static/js/history.js"></script>
<script type="text/javascript" src="/static/js/statistics.js"></script>
<script>

    var isLoading = false;
    var page = 2;
    var tmpPage;

    $(function () {
        var tags = document.getElementsByClassName("all-tag-item");
        if(tags != undefined && tags != ''){
            for(var i=0;i<tags.length;i++){
                var value = tags[i].attributes.data.value;
                if(value == 1){
                    tags[i].className = "all-tag-item gray active"
                }
                if(value == 2){
                    tags[i].className = "all-tag-item red active"
                }
                if(value == 3){
                    tags[i].className = "all-tag-item orange active"
                }
                if(value == 4){
                    tags[i].className = "all-tag-item green active"
                }
                if(value == 5){
                    tags[i].className = "all-tag-item blue active"
                }
                if(value == 6){
                    tags[i].className = "all-tag-item darkblue active"
                }
                if(value == 7){
                    tags[i].className = "all-tag-item zi active"
                }
            }
        }

        $('.switch-bar-item').click(function () {
            var index = $(this).index();
            $('.switch-bar-item').removeClass('active');
            $('.switch-item').removeClass('active');
            $('.switch-item').eq(index).addClass('active');
            $('.switch-bar-item').eq(index).addClass('active');
        });

        var tags = document.getElementsByClassName("all-tag-item");
        if(tags != undefined && tags != ''){
            for(var i=0;i<tags.length;i++){
                var value = tags[i].attributes.data.value;
                if(value == 1){
                    tags[i].className = "all-tag-item gray active"
                }
                if(value == 2){
                    tags[i].className = "all-tag-item red active"
                }
                if(value == 3){
                    tags[i].className = "all-tag-item orange active"
                }
                if(value == 4){
                    tags[i].className = "all-tag-item green active"
                }
                if(value == 5){
                    tags[i].className = "all-tag-item blue active"
                }
                if(value == 6){
                    tags[i].className = "all-tag-item darkblue active"
                }
                if(value == 7){
                    tags[i].className = "all-tag-item zi active"
                }
            }
        }

        // 提交成功提示
        var $toast = $('#toast');
        $('#showToast').on('click', function () {
            if ($toast.css('display') != 'none') {
                return;
            }
            $toast.fadeIn(100);
            setTimeout(function () {
                $toast.fadeOut(100);
            }, 2000);
        });

        //crm视图查看
        $("#crmView").on("click", function () {
            debugger;
            $.ajax({
                url: '/project/getCRMURL',
                data: {"customerId": $("#customerId").val()},
                type: "GET",
                success: function (data) {
                    debugger;
                    if (data.result === '1') {
                        if (data.data.entity === "" || data.data.entity === null) {
                            showMessage("error", "该用户暂未推送至CRM！", 1000);
                            return false;
                        }
                        window.location.href = data.data.entity;
                    } else {
                        showMessage("error", "操作失败！", 1000);
                    }
                }
            });
        });

        //约看项目
        $('#succBtn').on('click', function () {
            $("#successDialog").fadeOut(200);
            $("#bindDialog").fadeOut(200);
        });

        var $traceMasksheet = $('#traceMasksheet');
        var $traceMask = $('#traceMask');

        function hideTraceSheet() {
            $traceMasksheet.removeClass('weui-actionsheet_toggle');
            //解除列表滚动
            $("html,body").css({overflow: "auto", height: '100%'});
            $traceMask.fadeOut(200);
            $(document).on('scroll', onScroll);
        }

        $traceMask.on('click', hideTraceSheet);
        $("#traceShow").on("click", function () {
            $traceMasksheet.addClass('weui-actionsheet_toggle');
            //禁止列表滚动
            $("html,body").css({overflow: "hidden", height: '100%'});
            $traceMask.fadeIn(200);
            $(document).off();
        });
        $('.weui-actionsheet__cell').on('click', hideTraceSheet);

        var $statusMasksheet = $('#statusMasksheet');
        var $statusMask = $('#statusMask');

        function hideStatusSheet() {
            $statusMasksheet.removeClass('weui-actionsheet_toggle');
            //解除列表滚动

            $("html,body").css({overflow: "auto", height: '100%'});
            $statusMask.fadeOut(200);
            $(document).on('scroll', onScroll);
        }

        $statusMask.on('click', hideStatusSheet);
        $("#statusShow").on("click", function () {
            $statusMasksheet.addClass('weui-actionsheet_toggle');
            //禁止列表滚动
            $("html,body").css({overflow: "hidden", height: '100%'});
            $statusMask.fadeIn(200);
            $(document).off();
        });
        $('.weui-actionsheet__cell').on('click', hideStatusSheet);

        var $projectMasksheet = $('#projectMasksheet');
        var $projectMasksheet2 = $('#projectMasksheet2');
        var $projectMask = $('#projectMask');

        function hideProjectSheet() {
            $projectMasksheet.removeClass('weui-actionsheet_toggle');
            $projectMasksheet2.removeClass('weui-actionsheet_toggle');
            //解除列表滚动

            $("#projectMasksheet2").css('display', 'none');
//            $("#projectMasksheet2").style.display
            $("html,body").css({overflow: "auto", height: '100%'});
            $projectMask.fadeOut(200);
            $(document).on('scroll', onScroll);
        }

        $projectMask.on('click', hideProjectSheet);

        $('#bindDialog').on('click', '.weui-dialog__btn_default', function () {
            $('#bindDialog').fadeOut(200);
        });

        $('#bindDialog').on('click', '.weui-dialog__btn_primary', function () {
            saveBind();
        });

        $(document).on('scroll', onScroll);

        $("[name=selectCustomerInfo]").on("change", function () {
            var _id = $(this).attr("id");
            if (_id == "buyIntention" && $("#" + _id).val() == '5') {
                checkModify();
            } else {
                updateCustomerInfo(_id);
            }
        });

        $('#deleteDialog').on('click', '.weui-dialog__btn_default', function () {
            var len = window.location.href.indexOf("random");
            if (len > 0) {
                window.location.href = window.location.href.substring(0, len) + "random=" + Math.random();
            } else {
                window.location.href = window.location.href + "&random=" + Math.random();
            }
        });

        $('#deleteDialog').on('click', '.weui-dialog__btn_primary', function () {
            $('#deleteDialog').fadeOut(200);
            updateCustomerInfo('buyIntention');
        });
    });

    function checkModify() {
        var deleteDialog = $('#deleteDialog');
        deleteDialog.fadeIn(200);
    }

    function updateCustomerInfo(_id) {
        $.ajax({
            url: "/customer/modifytextarea",
            data: {
                customerId: $("#customerId").val(),
                key: _id,
                value: $("#" + _id).val()
            },
            type: "post",
            success: function (data) {
                if (data.result == "1") {
                    // 提交成功提示
                    var $toast = $('#toast');
                    if ($toast.css('display') != 'none') return;

                    $toast.fadeIn(100);
                    setTimeout(function () {
                        $toast.fadeOut(100);
                    }, 2000);
                }
            }
        });
    }

    function projectShow() {
        var customerId = $("#customerId").val();
        // 校验是否已有回访记录
        $.ajax({
            url: "/project/getvisitrecords",
            type: "post",
            data: {'customerId': customerId},
            success: function (data) {
                if (data.data.list.length == 0) {
                    // 若无回访记录，弹框提示“请先添加客户回访，才能约看客户”
                    alert("请先添加客户回访，才能约看客户");
                    return;
                } else {
                    $("#projectSheet").text("");
                    $("#bindCustomerId").val(customerId);
                    var projectName = $("#projectSearch").val();
                    $.ajax({
                        url: "/customer/getBindProject",
                        type: "post",
                        data: {
                            'customerId': customerId
                        },
                        success: function (data) {
                            if (data && data.length > 0) {
                                $.each(data, function (index, info) {
                                    $("#projectSheet").append("<div class='weui-actionsheet__cell' onclick=\"bindProject('" + info.id + "')\">" + info.projectName + "</div>");
                                });

                                $('#projectMasksheet').addClass('weui-actionsheet_toggle');
                                $('#projectMasksheet2').addClass('weui-actionsheet_toggle');
                                //禁止列表滚动
                                $("html,body").css({overflow: "hidden", height: '100%'});
                                $('#projectMask').fadeIn(100);
                                $(document).off();
                            } else {
                                //noProjectToast
                                if ($('#noProjectToast').css('display') != 'none') return;
                                $('#noProjectToast').fadeIn(100);
                                setTimeout(function () {
                                    $('#noProjectToast').fadeOut(100);
                                }, 2000);
                            }
                            setTimeout(function () {
                                var aaaa = $("#projectMasksheet").height() * 2 / 40 - 3.35
                                $("#projectMasksheet2").css({'bottom': aaaa + 'rem', 'display': 'block'})
                            }, 10);
                        }
                    });
                }
            }
        });
    }

    function projectNameShow() {
        var bindCustomerId = $("#bindCustomerId").val();
        var projectName = $("#project").val();
        $("#projectSheet").text("");
        $.ajax({
            url: "/customer/getBindProject",
            type: "post",
            data: {'customerId': bindCustomerId, projectName: projectName},
            success: function (data) {
                $("#project").val('');
                if (data && data.length > 0) {
                    $.each(data, function (index, info) {
                        $("#projectSheet").append("<div class='weui-actionsheet__cell' onclick=\"bindProject('" + info.id + "')\">" + info.projectName + "</div>");
                    });
                    $('#projectMasksheet').addClass('weui-actionsheet_toggle');

                    //禁止列表滚动
                    $("html,body").css({overflow: "hidden", height: '100%'});
                    $('#projectMask').fadeIn(100);
                    $(document).off();
                } else {
                    if ($('#noProjectToast').css('display') != 'none') return;
                    $('#noProjectToast').fadeIn(100);
                    setTimeout(function () {
                        $('#noProjectToast').fadeOut(100);
                    }, 2000);
                }
                setTimeout(function () {
                    var aaaa = $("#projectMasksheet").height() * 2 / 40 - 3.35
                    //noProjectToast
                    $("#projectMasksheet2").css({'bottom': aaaa + 'rem', 'display': 'block'})
                }, 10);
            }
        });
    }

    function showMessage(type, message, timeout, url) {
        var $toast = $('#toast');
        if (type == "error") {
            $toast.find("i").removeClass().addClass("weui-icon_toast")
        } else if (type == "success") {
            $toast.find("i").removeClass().addClass("weui-icon_toast").addClass("weui-icon-success-no-circle")
        }
        $toast.find("p").text(message);
        if ($toast.css('display') != 'none') return;

        $toast.fadeIn(100);
        setTimeout(function () {
            $toast.fadeOut(100);
            if (url != undefined) {
                window.location.href = url + "?time=" + Math.random();
            }
        }, timeout);
    }

    function bindProject(projectId) {
        var $bindDialog = $('#bindDialog');
        $("#bindProjectId").val(projectId);
        $bindDialog.fadeIn(200);
    }

    function saveBind() {
        var customerId = $("#bindCustomerId").val();
        var bindProjectId = $("#bindProjectId").val();
        $.ajax({
            url: "/customer/saveBindProject",
            type: "post",
            data: {'customerId': customerId, 'bindProjectId': bindProjectId},
            success: function (data) {
                if ($('#toast').css('display') != 'none') return;
                $('#toast').fadeIn(100);
                setTimeout(function () {
                    $('#toast').fadeOut(100);
                }, 2000);

                $('#bindDialog').fadeOut(200);

                var $projectMasksheet = $('#projectMasksheet');
                var $projectMask = $('#projectMask');
                $projectMasksheet.removeClass('weui-actionsheet_toggle');
                //解除列表滚动
                $("html,body").css({overflow: "auto", height: '100%'});
                $projectMask.fadeOut(200);
                $(document).on('scroll', onScroll);
                window.location.reload();
            }
        });
    }

    function onScroll() {
        if (!isLoading) {
            var closeToBottom = ($(window).scrollTop() + $(window).height() > $(document).height() - 100);
            if (closeToBottom && page > 0) {

                var $loadingToast = $('#loadingToast');
                if ($loadingToast.css('display') != 'none') {
                    return;
                }
                $loadingToast.fadeIn(100);

                loadData();
            }
        }
    }

    function loadData() {
        isLoading = true;
        $.ajax({
            url: "/customer/myCustomerListCell", //buyIntention startDate endDate traceStatus projectStatus
            data: {
                page: page, 'type': $("#type").val(), 'buyIntention': $("#buyIntention").val()
                , 'startDate': $("#startDate").val(), 'endDate': $("#endDate").val()
                , 'traceStatus': $("#traceStatus").val(), 'projectStatus': $("#projectStatus").val()
                , 'searchKey': $("#searchKey").val(), 'userPhone': $("#userPhone").val()
            }, // Page parameter to make sure we load new data
            success: onLoadData
        });
    }

    function onLoadData(data) {
        // Increment page index for future calls.
        page++;

        $(".my-client :last").after(data);

        // Create HTML for the images.
        var html = '';
        var i = 0, length = data.length, image;
        if (!length || length <= 1) {
            tmpPage = page;
            page = -1;
        }
        isLoading = false;

        var $loadingToast = $('#loadingToast');
        $loadingToast.fadeOut(100);
    }

</script>
</body>

</html>