﻿// ==UserScript==
// @name                邻所操作后续提示功能
// @description         邻所操作后续提示功能
// @created date        2009/11/30   20:28
// @created author      Tiger(tigershi0507@gmail.com)
// @version             1.0.1
// @version owner       Copyright (C) 2009-2010 keerr.com All rights reserved.
// ==/UserScript==
/*************************************************
verified time 	:	2009/12/2   15:45
verified author	:	Tiger
verified purpose:	完善注释
**************************************************/
/*************************************************
	verified time 	:	2009/12/4   9:25
	verified author	:	Tiger
	verified purpose:	尖子新添加了result这个参数，完善了
**************************************************/

/// <summary>
/// 弹出提示
/// </summary>
/// <param name="msgContent">显示内容</param>
/// <param name="json["score"]">动作资产数</param>
/// <param name="json["lc"]">剩余获得资产数</param>
/// <param name="s">其他属性的object，{top: 10}</param>
$.popMsgbox = function(msgContent, json, s) {
    var $_msgbox = $('<div id="msgwin" style="position: absolute; z-index: 100000;">' +
                        '<div class="popupmenu_layer">' +
                            '<p class="j_type"><b>更新心情</b></p>' +
                            '<p class="btn_line">资产 <strong class="j_assets">+10</strong></p>' +
                            '<p class="j_lc">本周期内，您还有 <strong class="j_leftChances">2</strong> 次机会获取资产</p>' +
                        '</div>' +
                    '</div>');
    $_msgbox.find(".j_type").text(msgContent);
    var poptip_timeout;
    clearTimeout(poptip_timeout);
    $("#msgwin").stop();
    $("#mwgwin_p").empty();
    $("#mwgwin_p").append($_msgbox);

    switch (json["lc"]) {
        case "-3": //注册码信息错误
            $(".btn_line").remove();
            $(".j_lc").text("继续您的百楼之旅");
            break;
        case "-2":
            $(".btn_line").remove();
            $(".j_lc").text("继续您的百楼之旅");
            break;
        case "-1":
            $(".j_lc").text("不限次数");
            break;
        case "0":
            if (json["score"] === "+0" || json["score"] === "0") {
                $(".btn_line").remove();
                $(".j_lc").text("继续您的百楼之旅");
            }
            //$(".j_lc").remove();
            break;
        default:
            $_msgbox.find(".j_assets").text(json["score"]);
            $_msgbox.find(".j_leftChances").text(json["lc"]);
    }
    $_msgbox
    .css({ top: s.top - 50 + "px", left: "50%", position: "absolute", opacity: 0 })
    .animate({ opacity: "0.9", top: s.top + 50 }, 1000, function() {
        poptip_timeout = setTimeout(function() {
            $("#msgwin").fadeOut(function() {
                $("#msgwin").remove();
            });
        }, 1500);
    });
};
