Namespace.register("U.MD.D.Blog"); //Blog加载
//#region 初始化首页
//获取Blog数据
U.MD.D.Blog.Blog = function (UCB) {
if (!U.MD.D.H.ET["UB"]) {
U.UF.A.Request(US.AUTH, ["GFA"], U.MD.D.Blog.AsynBlog, [[$("#UD_SYSXZBR")[0], true], UCB]);
}
}
//朋友圈大小同步函数
U.MD.D.Blog.SYDJBH = function (UDOD, UP, UTF) {
var _UDPD = $($($(UDOD).Parent()).Child()[0]).Child()[0];
_UDPD.style.width = US.width - 50 + "px";
$(_UDPD).Child()[1].style.width = US.width - 170 + "px";
}
//异步Blog数据
U.MD.D.Blog.AsynBlog = function (r) {
var i, _UDE = U.MD.D.H.ET["UB"] = [[]], context = r.context, UCB = context[1]; r = r.value;
for (i = 1; i < r.length; i++) { _UDE[i] = r[i]; } //保存数据
U.MD.D.Blog.ZFSYPFY(_UDE[0][1] = r[0]); U.MD.D.Blog.Dt.ZMBMAIN(_UDE); (UCB) && (UCB()); //打印数据
}
//转发信息整理
U.MD.D.Blog.ZFSYPFY = function (UDE) {
for (i = 0; i < UDE.length; i++) { UDE[i]["JZ"] = true; if (UDE[i].Forward) { j = UDE.length; while (j--) { if (UDE[i].Forward == UDE[j].ArticleID) { UDE[j].JZ = true; UDE[i].ZF = UDE.splice(j, 1)[0]; break; } } } }
return UDE;
}
//#endregion
//#region 朋友圈数据查看
//窗体朋友圈
U.MD.D.Blog.CTPYQ = function (userid) {
var _UDOD = $("#UD_SYSXZBR"),
_UDPD = _UDOD.Parent(),
_UDRD = U.UF.UI.Form({ resizeend: U.UF.M.apply(this, [[U.MD.D.Blog.ZXWZ, [_UDOD[0], 0]]]), id: "UD_BLOG", content: _UDPD, title: "
云端圈子
", hst: { style: { "padding": "0"} }, style: { width: "90%", height: "85%", padding: "0"} }).be;
_UDPD.style.display = "block";
U.MD.D.Blog.QHCTBK(false);
return _UDRD; //初始化数据
}
//我的和首页的切换
U.MD.D.Blog.QHCTBK = function (UTF, UDOD) {
if (!UTF || !U.MD.U.L.isLogin(3)) {
var i, _UTP, _UDCD, _UDAD = UDOD ? $(UDOD).parentg().childg(0) : null;
if (_UDAD) {
for (i = 0; i < _UDAD.length; i++) {
_UTP = _UDAD[i] == UDOD ? "addClass" : "removeClass";
_UDCD = $(_UDAD).childg(i)[0];
_UDAD[_UTP]("UD_SYSXSZCVLOS", i);
_UDCD[_UTP]("UD_SYSXSZCVLOI" + (i ? "O" : "") + "T");
}
}
U.MD.D.Blog.GDQHCTBK(UTF);
U.UF.UI.Form.et["UD_BLOG"].body.onscroll = U.UF.M.SSCH({ "AF": U.UF.M.apply(null, [[U.MD.D.Blog.GDQHCTBK, [UTF]]]) }).SCH(); //查看朋友圈
}
}
//滚动处理
U.MD.D.Blog.GDQHCTBK = function (UTF) {
var _UP = this.P == null ? 1 : this.P + 2;
UTF ? U.MD.D.Blog.GBL($("#UD_SYSXZBR")[0], _UP, US.userInfo.userid) : U.MD.D.Blog.PFY(_UP);
}
//#region 公共数据查看
//非朋友数据查看
U.MD.D.Blog.PFY = function (UP, UTF) {
var _UGE = U.MD.D.H.ET["UB"][0],
_UDPD = $("#UD_SYSXN")[0],
_UDOD = $("#UD_SYSXZBR")[0],
_UDE = U.MD.D.D.FYGBL(_UGE, UP, [30, 120]), _UE = _UDE[1] * 120;
if (_UDE[0] && UTF !== true) {
(UP == 1) && (_UDOD.innerText = "");
U.MD.D.Blog.U.ZXBlog(_UDOD, _UDE[0], false, $(_UDOD).Child().length);
} //Blog数据使用 (_UDPD.scrollHeight <= _UDPD.offsetHeight) && (U.MD.D.Blog.PFY(UP + 1));
else if (!_UGE) {
UTF = UTF && _UDE[0] && _UDE[0].length != 0;
U.MD.D.Blog.Blog(U.UF.M.apply(this, [[U.MD.D.Blog.PFY, [UP]]]));
}
else { //获取数据
U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UB_B_S_NewPost", _UE - 120, _UE, UTF ? _UDE[0][0].ArticleID : US.EMPTYGUID], U.MD.D.Blog.AsynPFY, [[$("#UD_SYSXSZCD")[0], 1], UP, _UDE[1], UTF]);
// U.UF.A.Request(US.AUTH,"Blog.getNewArticess", [_UE - 120, _UE, UTF ? _UDE[0][0].ArticleID : ""], U.MD.D.Blog.AsynPFY, [[$("#UD_SYSXSZCD")[0], 1], UP, _UDE[1], UTF]);
}
}
//最新blog异步
U.MD.D.Blog.AsynPFY = function (r) {
var i, _UAE, _UDE = U.MD.D.H.ET["UB"][0], context = r.context, _UP = context[1], _UTP = context[2], _UTF = context[3]; r = r.value
if (_UTF) { if ((_UAE = r).length) { for (i = 1; i < _UDE.length; i++) { _UDE[i] = _UAE.concat(_UDE[i]); _UAE = _UDE[i].splice(120, _UAE.length - 120); } } }
else { _UAE = _UDE[_UTP] = r; } (_UAE.length > 1) && (U.MD.D.Blog.ZFSYPFY(_UAE)); U.MD.D.Blog.PFY(_UP); //打印
}
//#endregion
//#region 好友圈查看
//根据用户ID获取用户数据
U.MD.D.Blog.GBL = function (UDOD, UP, userid) {
var _UGE = U.MD.D.H.ET["UL"]["HY"], _userid = _UGE["userid"] || userid, _UDE = U.MD.D.D.FYGBL(_UGE[_userid], UP, [15, 150]), _UCE = ["ReplayMost", [(_UDE[1] - 1) * 150, _UDE[1] * 150, _userid, US.EMPTYGUID]]; (UP == 1) && (UDOD.innerText = "");
if (_UDE[0]) {//直接打印显示
if (_UDE[0].length) {
U.MD.D.Blog.PGBL(UDOD, _UDE[0], null);
if (UDOD.scrollHeight < US.height - UDOD.offsetTop - 120) { U.MD.D.Blog.GBL(UDOD, UP + 1, userid); }
}
else { (UP == 1) && (U.MD.D.Blog.PGBLK(UDOD)); }
}
else {//获取数据
(UP == 1) && (UDOD.style.height = Math.max((US.height - 110 - UDOD.offsetTop), 50) + "px"); //初始化大小
if (_userid != "RM") { _UCE[1].unshift(_userid); _UCE[0] = "GFA"; };
_UCE[1].unshift(_UCE[0]);
U.UF.A.Request(US.AUTH, (_UCE[1]), U.MD.D.Blog.AsynGBL, [UP == 1 ? [UDOD, true] : null, UDOD, UP, _UDE[1], _userid]);
}
}
//获取朋友圈异步
U.MD.D.Blog.AsynGBL = function (r) {
var _UDE, _UGE = U.MD.D.H.ET["UL"]["HY"],
context = r.context,
_UDOD = context[1],
_UP = context[2],
_UTP = context[3],
_userid = context[4];
r = r.value;
if (r) {
_UDE = _UGE[_userid];
(!_UDE) && (_UDE = _UGE[_userid] = []);
_UDE[_UTP] = U.MD.D.Blog.ZFSGBL(r);
U.MD.D.Blog.GBL(_UDOD, _UP, _userid);
} //设置
}
//#endregion
//转发生成
U.MD.D.Blog.ZFSGBL = function (UDE) {
var i, j;
U.UF.Ut.AddArr(UDE, { "JZ": true });
for (i = 0; i < UDE.length; i++) {
if (UDE[i].Forward) {
for (j = UDE.length - 1; j > i; j--) {
if (UDE[i].Forward == UDE[j].ArticleID) {
UDE[i].ZF = UDE.splice(j, 1)[0]; break;
}
}
}
}
return UDE;
}
//打印朋友圈信息
U.MD.D.Blog.PGBL = function (UDOD, UDE, UTF, UIE, USID) {
if (UTF) { U.MD.D.Blog.ZLNRPY(UDOD, UDE); } //个人信息里的朋友圈展示
else { U.MD.D.Blog.U.ZXBlog(UDOD, UDE, USID, UIE != null ? (UIE === true ? $(UDOD).Child().length - 1 : UIE) : null, true); } //首页朋友圈样式
}
//打印朋友圈空消息的
U.MD.D.Blog.PGBLK = function (UDOD) {
var _UTF = US.friend[1].length, _UDSD, _UDMD = $("#UD_SYSXZLRSSI")[0], _UDTD = $$("div", { "className": "UD_SYSXZLRSRDO" }, UDOD);
$$("div", { "className": "UD_SYSXZLRSRDOS", "innerHTML": _UTF ? "暂无追随好友消息" : "你还没有追随喜欢的人哦 ! !" }, _UDTD);
$$("div", { "className": "UD_SYSXZLRSRDOZ", "innerHTML": _UTF ? "可以查看热门用户" : "可以尝试追随喜欢的人。" }, _UDTD);
_UDSD = $$("div", { "className": "UD_SYSXZLRSRDOX", "innerHTML": "或者:" }, _UDTD);
$$("span", { "innerHTML": "发布动静..", "onclick": U.MD.D.Blog.A.FBCKME }, _UDSD);
}
//资料内容里的朋友圈信息
U.MD.D.Blog.ZLNRPY = function (UDOD, UDE) {
var i, _UTF, _UCE, _UDHD, _UDTD, _UDMD, _UDSD, _UDLD, _UDRD, _UDWD, _UDYD, _UDND, _UDID, _UDIOD, _UDITD, _UDFD = $$("frag");
for (i = 0; i < UDE.length; i++) {
_UTF = true; _UDTD = $$("div", { "className": "UD_SYSXZLRSRDTK" }, _UDFD);
_UDMD = $$("div", { "className": "UD_SYSXZLRSRDTKO" }, _UDTD);
if ((_UCE = UDE[i].ZF) || UDE[i].Forward) {//
_UDSD = $$("div", { "className": "UD_SYSXZLRSRDTS" }, _UDMD);
$$("div", { "className": "UD_SYSXZLRSRDTSL UD_SYI" }, _UDSD);
_UDLD = $$("div", { "className": "UD_SYSXZLRSRDTSI" }, _UDSD);
$$("img", { "onerror": U.UF.M.ImgError, "title": "点击查看", "onclick": [[U.UF.M.StopBubble], [U.MD.U.I.ViewOtherUserInfo, [UDE[i].UserID]]], "src": U.UF.M.GetImgU(UDE[i].UserThumbnailImageHead) }, _UDLD);
_UDLD = $$("div", { "className": "UD_SYSXZLRSRDTSR" }, _UDSD);
_UDRD = $$("div", { "className": "UD_SYSXZLRSRDTSRS" }, _UDLD);
$$("div", { "className": "UD_SYSXZLRSRDTSRSL", "innerHTML": UDE[i].UserName }, _UDRD);
$$("div", { "className": "UD_SYSXZLRSRDTSRSR", "innerHTML": "推荐了" }, _UDRD);
$$("div", { "className": "UD_SYSXZLRSRDTSRX", "innerHTML": UDE[i].ArticleContentBrief }, _UDLD);
if (UDE[i].UserID == US.userInfo.userid) { $$("div", { "className": "UD_SYSXZLRSRDTRZTI UD_SYSXZLRSRDTRZTIO UD_SYI", "onclick": [[U.UF.M.StopBubble], [U.UF.UI.Confirm, ["是否取消转发", [U.MD.D.Blog.F.SCPGBL, [UDE[i], _UDTD]]]]], "title": "取消转发" }, _UDSD) } //
else { $$("div", { "className": "UD_SYSXZLRSRDTRZTI UD_SYSXZLRSRDTRZTIT UD_SYI", "title": "点击展开" }, _UDSD); }
_UTF = !_UTF; (_UCE == null) && (_UCE = new U.MD.D.Blog.A.BLEI([UDE[i].ArticleID, 0, 0, UDE[i].ArticleAddTime, "很遗憾,动静已被作者删除了", "很遗憾,动静已被作者删除了", "", "", "", 0])); //原文被删除
}
_UCE = _UCE || UDE[i]; _UDHD = $$("div", { "className": "UD_SYSXZLRSRDTKLO" }, _UDMD);
_UDSD = $$("div", { "className": "UD_SYSXZLRSRDTKL" }, _UDHD);
_UDLD = $$("div", { "className": "UD_SYSXZLRSRDTLI" }, _UDSD);
$$("img", { "onerror": U.UF.M.ImgError, "title": "点击查看", "onclick": [[U.UF.M.StopBubble], [U.MD.U.I.ViewOtherUserInfo, [_UCE.UserID]]], "src": U.UF.M.GetImgU(_UCE.UserThumbnailImageHead) }, _UDLD);
$$("div", { "style": { "fontWeight": "100" }, "className": "UD_SYSXZLRSRDTLKN UTDF", "innerHTML": _UCE.UserName || US.userInfo.UserNickName }, _UDSD);
_UDRD = $$("div", { "className": "UD_SYSXZLRSRDTKR UD_SYUPCC" }, _UDHD);
_UDYD = $$("div", { "className": "UD_SYSXZLRSRDTRZ UD_SYUPCCY" }, _UDRD);
_UDND = $$("div", { "className": "UD_SYSXZLRSRDTRZTC UD_SYUPCCT" }, _UDYD);
U.MD.D.Blog.TPGBL(_UDND, _UCE, true, true); //打印图片
if (_UTF && _UCE.UserID == US.userInfo.userid) {
if (_UCE.UserID == US.userInfo.userid) { $$("div", { "className": "UD_SYSXZLRSRDTRZTI UD_SYSXZLRSRDTRZTIM UD_SYSXZLRSRDTRZTIO UD_SYI", "onclick": [[U.UF.M.StopBubble], [U.UF.UI.Confirm, ["是否删除该消息", [U.MD.D.Blog.F.SCPGBL, [UDE[i], _UDTD]]]]], "title": "移除消息" }, _UDHD); }
else if (!UDE[i].Forward) { $$("div", { "className": "UD_SYSXZLRSRDTRZTI UD_SYSXZLRSRDTRZTIT UD_SYI", "title": "点击展开" }, _UDHD); }
}
if (_UCE.UserID) {
_UDID = $$("div", { "className": "UD_SYSXZLRSRDTRD UD_SYSXZLRSRDTKRD" }, _UDYD);
_UDHD = $$("div", { "className": "UD_SYSXZLRSRDTRDY" }, _UDID);
_UDIOD = $$("div", { "className": "UD_SYSXZLRSRDTRDRT" }, _UDID);
_UDITD = $$("div", { "className": "UD_SYSXZLRSRDTRDRZ", "title": "转发", "onclick": _UCE["UserID"] ? [[U.UF.M.StopBubble], [U.MD.D.Blog.A.PAZF, [_UCE, "this"]]] : "" }, _UDIOD);
$$("div", { "className": "UD_SYSXZLRSRDTRDRZI UD_SYSXZLRSRDTRDRZIO UD_SYI" }, _UDITD);
$$("div", { "className": "UD_SYSXZLRSRDTRDRZN", "innerHTML": _UCE.ArticleZFN }, _UDITD);
_UDITD = $$("div", { "className": "UD_SYSXZLRSRDTRDRZ", "title": "回复" }, _UDIOD);
$$("div", { "className": "UD_SYSXZLRSRDTRDRZI UD_SYSXZLRSRDTRDRZIT UD_SYI" }, _UDITD);
$$("div", { "className": "UD_SYSXZLRSRDTRDRZN", "innerHTML": _UCE.ArticleReplayNumber }, _UDITD);
_UDTD["onclick"] = U.UF.M.apply(this, [[U.MD.D.Blog.F.GSHGBL, [_UCE, null, null]]]);
}
$$("div", { "className": "UD_SYSXZLRSRDTD", "innerHTML": U.UF.D.getDateInterval(_UCE.ArticleAddTime) }, _UDTD)
}
UDOD.appendChild(_UDFD);
}
//打印图片
U.MD.D.Blog.TPGBL = function (UDOD, UDE, TF, UFT) {
var _UIMG, _UDTD, _UDCD, _UDID, _UDKD, _UTH, _ULT, _UIE = [];
UDOD.innerHTML = UDE.ArticleContent || UDE.ArticleContentBrief; _UIMG = $("img", UDOD); _UTH = UDOD.innerText || UDE.ArticleContentBrief || ""; UDOD.innerText = ""; _ULT = TF ? 1 : _UIMG.length;
_UDTD = $$("div", { "className": UFT ? "UD_SYSXZLRSRDTRZTCS" : "UD_SYSXZLRSRDTRZTKCS", "style": UDE.UserID ? {} : { "color": "#9B9B9B", "textAlign": "center", "padding": "95px 0 90px 0" }, "innerHTML": _UTH }, UDOD);
(_UTH = _UDTD.innerText); _UDTD.innerText = (TF ? (_UTH.length > 60 ? _UTH.substring(0, 60) + "..." : _UTH) : _UTH); _UDTD.innerText = _UDTD.innerText.trim() || "图片分享";
if (_UIMG.length) {
_UDCD = $$("div", { "className": "UD_SYSXZLRSRDTRZTCD" + (UFT ? " UD_SYSXZLRSRDTRZTKCD" : ""), "style": TF ? {} : { "width": "100%", "height": "auto", "paddingBottom": "10px"} }, UDOD);
for (i = 0; i < _ULT; i++) { _UIE.push({ "Time": UDE.ArticleAddTime || UDE.UserFilesAddTime, "Thm": _UIMG[i].src, "Img": _UIMG[i].alt.indexOf(US.FILESYSTEMURL) > -1 ? _UIMG[i].title : _UIMG[i].src }); } //生成图片阅览数组
for (i = 0; i < _ULT; i++) { //生成图片
_UDID = $$("div", { "className": TF ? "UD_SYSXZLRSRDTRZTCDT" : "UD_SYSXZLRSRDTRZTCDO", "onclick": U.UF.M.apply() }, _UDCD);
if (TF) { U.MD.D.H.JZTPJS(_UIMG[i].src, _UDID, UDE); } //居中图查看
else { $$("img", { "onerror": U.UF.M.ImgError, "title": "点击查看", "onclick": [[U.UF.M.StopBubble], [U.MD.I.Img, [UDE, _UIE, i]]], "src": _UIMG[i].src }, _UDID); } //查看
}
}
}
//位置偏移算法
U.MD.D.Blog.ZXWZ = function (UDOD, UIE, UDCD, UTF) {
var i, j, _UST, _UL, _UDSD, _UKE, _UDMD, _UDE = [], _UDND = $(UDOD).Child(), _UBE = U.UF.CI.getBrowser(), _UFT = (_UBE.browser == "msie" && (parseInt(_UBE["ver"]) < 10)), _UW = $(UDOD).Parent().offsetWidth - 30, _USH = UDOD.offsetHeight, _UMW = 350, _UTI = Math.floor((_UW + 20) / (_UMW + 20)), j = Math.ceil(UIE / _UTI) - 1, k = UIE % _UTI;
for (i = 0; i < _UTI; i++) { _UDE[i] = [20]; }; _UKE = [_UMW, 100 / _UTI, _UTI, k, (_UW - _UMW) / 2, _USH - (US.height / 2), _UFT]; //添加的位置定位
if (UDCD) {//需要添加元素
if (j > -1) { for (i = 0; i < _UTI; i++) { _UDSD = _UDND[(j - (i < (k || _UTI) ? 0 : 1)) * _UTI + i]; _UDE[i] = [_UDSD.offsetHeight + _UDSD.style.top.toInt() + 20]; }; } //制定的位置设定
for (i = 0; i < UDCD.length; i++) { _UIM = (i + k) % _UTI; _UDE[_UIM].push(_UDE[_UIM][_UDE[_UIM].length - 1] + UDCD[i].offsetHeight + 20); }
for (i = 0; i < UDCD.length; i++) { _UIM = (i + k) % _UTI; UDCD[i].style.cssText = "top:" + (_UDE[_UIM].shift()) + "px;left:" + (_UIM * (_UMW + 20)) + "px;"; }
UIE += i;
}
if (!UTF) {//需要定位添加
if (UIE < _UDND.length) {
for (i = UIE; i < _UDND.length; i++) { _UIM = i % _UTI; _UDE[_UIM].push(_UDE[_UIM][_UDE[_UIM].length - 1] + _UDND[i].offsetHeight + 20); }
for (i = UIE; i < _UDND.length; i++) { _UIM = i % _UTI; _UDND[i].style.cssText = "top:" + (_UDE[_UIM].shift()) + "px;left:" + (_UIM * (_UMW + 20)) + "px;"; }
}
_USH = 0; for (i = 0; i < _UDE.length; i++) { _USH = Math.max(_UDE[i], _USH); }; (_USH) && ($(UDOD).css("cssText", ";height:" + _USH + "px;width:" + (_UTI * (_UMW + 20) - 20) + "px"));
}
return _UKE;
}
//#endregion