Namespace.register("U.FTP");
U.FTP.WE = window.external; U.FTP.TI;

window.onload = function () { }


//这里是获取消息
_setT = function (json) {
    // "UsImag", "UsSYSUN", "UsName", "UsType" UsSYScontent UsParamet
    try {
        var e = eval("(" + json + ")"); var c = [[]];
        for (var i = 0; i < e.length; i++) { //只显示 最后一个消息
            switch (e[i].UsType) {
                case "UD_DiskCon": //文件添加消息
                    var g = e[i].UsSYScontent; e[i].UsParamet = [g[g.length - 1].UserFilesID, g[g.length - 1].UserDirectoryID, g[g.length - 1].UserId];
                    e[i].UsSYSUN = "云端发现新文件"; e[i].UsSYScontent = "<span>" + e[i].UsName + " </span>向你提交了<span> " + g.length + "个文件</span>"; c[0].push(e[i]);
                    break;
                case "TZ": //通知消息
                    e[i].UsSYSUN = "来自云端系统通知";
                    c[0].push(e[i]);
                    break;
                case "UPBR": //评论消息
                    if (!e[i].UsParamet) { c = e[i].UsSYScontent; e[i].UsParamet = [c.NewsType == 2, c.ArticleID]; e[i].UsSYScontent = e[i].ReplyContent; }
                    e[i].UsSYSUN = "您有一个评论提醒"; e[i].UsSYScontent = "<span>" + e[i].UsName + " </span>给您发了一条评论" + "<span> " + e[i].UsSYScontent + "</span>"; c[0].push(e[i]);
                    break;
                case 3: case 1: case 0: //好友或者群聊天消息
                    (!c[1]) && (e[i].UsParamet = e[i].UsSYScontent, c[1] = e[i]);
                    break;
                default: //即时获取消息
                    e[i] = e[i][0];
                    e[i].UsSYSUN = "来自云端系统通知";
                    e[i].UsSYScontent = e[i].ArticleContentBrief;
                    e[i].UsImag = U.M.GetImgU(e[i].UserThumbnailImageHead);
                    e[i].UsName = e[i].UserNickName; e[i].UsType = "TZ";
                    e[i].UsParamet = [true, e[i].ArticleID];
                    U.FTP.WE.setxx(e[i].ArticleID);
                    c[0].push(e[i]);
                    break;
            }
        }
        if (c[0].length) { $(".UFT_RXR")[0].onclick = U.M.apply(this, [[U.FTP.CKDJ, ([c[0]])]]); U.FTP.CKDJ(c[0]); U.FTP.WE._fs(); $("body").mouseenter(U.M.apply(this, [[U.FTP.YCCT, ([c[0]])]]), 0).mouseleave(U.M.apply(this, [[U.FTP.YCCT, ([c[0]])]])); }
        if (c[1]) { U.FTP.WE.xxs(c[1].UsImag, c[1].UsType, U.MS.SerializeJsonToStr(c[1].UsParamet)); } //消失闪烁处理
    } catch (e) { U.FTP.WE.dis(); }
}

//省略内容 换下一个
U.FTP.CKDJ = function (e) {
    clearTimeout(U.FTP.TI);
    if (e.length) {
        var c = e.shift(); var n = $(".UFT_RSR"); if (c.UsImag) { $(".UFT_RSL")[0].innerHTML = ""; $$("img", { "onerror": U.M.ImgError, "src": c.UsImag }, $(".UFT_RSL")[0]); }
        $(".UFT_LS")[0].innerHTML = c.UsSYSUN;
        n.addAttrArray({ "onclick": [[U.FTP.CKNR, ([c])], [U.FTP.CKDJ, ([e])]], "innerHTML": c.UsSYScontent }); U.M.SetElement(n, "img", "De");
        $(".UFT_RXL")[0].onclick = n[0].onclick; //阅读
        U.FTP.TI = setTimeout(U.M.apply(this, [[U.FTP.CKDJ, ([e])]]), 10000); return; //继续等待查看消息
    }
    U.FTP.WE._fh();
}

//显示窗体使用
U.FTP.YCCT = function (e) {
    clearTimeout(U.FTP.TI);
    if (event.type == "mouseout") { U.FTP.TI = setTimeout(U.M.apply(this, [[U.FTP.CKDJ, ([e])]]), 10000); }
}

//查看内容
U.FTP.CKNR = function (e) {
    U.FTP.WE.cknr(e.UsType + "", U.MS.SerializeJsonToStr(e.UsParamet || ""));
}