if (true) {
    var localHost = "/";
    var sign_in = false;            //今天是否签到 签到了:true 否则为false

    function signin() {
        if (!sign_in) {
            $.getJSON(localHost + "api/remote/sign_in.ashx?loadtype=load2&cprt=" + Math.random(), function (data) {
                if (data.signRest == true) {
                    var span = document.getElementById("sgin-span");
                    span.setAttribute("title", "连续签到" + data.continuous_day + "天");
                    span.innerHTML = "已经签到";
                    span.style.color = "#888";
                    span.style.cursor = "inherit";
                    var sInfoDiv = document.getElementById("sInfoDiv");
                    sInfoDiv.innerHTML = " 您已签到<span style='color:#f55'>" + data.sign_in_count + "</span>次<br/>连续签到<span style='color:#f55'>" + (data.continuous_day) + "</span>次<br/>获得积分:<span style='color:#f55'>" + (data.sign_in_cur) + "</span>积分<br/>连续签到:<span style='color:#f55'>" + (data.sign_in_csur) + "</span>积分";
                    sign_in = true;
                } else {
                    alert(data.Info)
                }
            });
        }
    }

    window.onload = function () {
        var continuous_day = 0;         //连续签到天数
        var sign_in_count = 0;          //签到次数
        var sign_in_cur = 0;            //总获得积分
        var sign_in_csur = 0;           //连续签到获得积分
        $.getJSON(localHost + "api/remote/sign_in.ashx?loadtype=load1&cprt=" + Math.random(), function (data) {
            continuous_day = data.continuous_day;
            sign_in_count = data.sign_in_count;
            sign_in_cur = data.sign_in_cur;
            sign_in_csur = data.sign_in_csur;
            sign_in = !data.signToday
            var sDiv = document.createElement("div");
            sDiv.setAttribute("id", "sign-in-div");
            sDiv.style.width = "120px";
            sDiv.style.position = "fixed";
            sDiv.style.height = "150px";
            sDiv.style.zIndex = "999999";
            sDiv.style.padding = "4px";
            sDiv.style.top = "100px";
            sDiv.style.left = "10px";
            sDiv.style.border = "1px solid #ccc";
            sDiv.style.font = "12px/1.6 '微软雅黑','宋体'";
            sDiv.style.backgroundColor = "#fefefe";
            var snDiv = document.createElement("div");
            snDiv.style.fontSize = "24px";
            snDiv.style.border = "1px solid #ddd";
            snDiv.style.margin = "2px 2px 0px 2px";
            snDiv.style.textAlign = "center";
            var snSpan = document.createElement("span");
            snSpan.setAttribute("id", "sgin-span");
            snSpan.style.fontWeight = "bold";
            snSpan.style.fontSize = "20px";
            snSpan.style.display = "block";
            snSpan.style.margin = "2px";
            snSpan.style.backgroundColor = "#e5e5e5";
            if (!sign_in) {
                snSpan.setAttribute("title", "点击签到");
                snSpan.onclick = function () { signin() };
                snSpan.style.cursor = "pointer";
                snSpan.style.color = "#494";
                snSpan.innerHTML = "每日签到";
            } else {
                snSpan.setAttribute("title", "连续签到" + continuous_day + "天");
                snSpan.style.cursor = "inherit";
                snSpan.style.backgroundColor = "#e5e5e5";
                snSpan.style.color = "#888";
                snSpan.innerHTML = "已经签到";
            }
            snDiv.appendChild(snSpan);
            sDiv.appendChild(snDiv);
            var sInfoDiv = document.createElement("div");
            sInfoDiv.setAttribute("id", "sInfoDiv");
            sInfoDiv.style.lineHeight = "24px";
            sInfoDiv.style.padding = "6px 2px";
            sInfoDiv.style.color = "#555";
            sInfoDiv.innerHTML = "您已签到:<span style='color:#f55'>" + sign_in_count + "</span>次<br/>连续签到:<span style='color:#f55'>" + continuous_day + "</span>次<br/>获得积分:<span style='color:#f55'>" + sign_in_cur + "</span>积分<br/>连续签到:<span style='color:#f55'>" + sign_in_csur + "</span>积分";
            sDiv.appendChild(sInfoDiv);
            document.body.appendChild(sDiv);
        });
    }

}