123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- Namespace.register("U.D.Blog"); //Blog加载
- //#region 初始化首页
- //获取Blog数据
- U.D.Blog.Blog = function (UCB) {
- if (!U.D.SY.ET["UB"]) {
- U.A.Request("Blog.nologinload", ([]), U.D.Blog.AsynBlog, ([[$("#UD_SYSXZBR")[0], true], UCB]));
- }
- }
- //朋友圈大小同步函数
- U.D.Blog.SYDJBH = function (UDOD, UP, UTF) {
- var _UDPD = U.selectEl($($(UDOD).Parent()).Child()[0]).Child()[0];
- _UDPD.style.width = US.Width - 50 + "px";
- U.selectEl(_UDPD).Child()[1].style.width = US.Width - 170 + "px";
- }
- //异步Blog数据
- U.D.Blog.AsynBlog = function (request) {
- var i, _UDE = U.D.SY.ET["UB"] = [[]], context = request.context, UCB = context[1]; request = request.value;
- for (i = 1; i < request.length; i++) { _UDE[i] = request[i]; } //保存数据
- U.D.Blog.ZFSYPFY(_UDE[0][1] = request[0]); U.D.Blog.Dt.ZMBMAIN(_UDE); (UCB) && (UCB()); //打印数据
- }
- //转发信息整理
- U.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.D.Blog.CTPYQ = function (UID) {
- var _UDOD = U.selectEl("#UD_SYSXZBR"),
- _UDPD = _UDOD.Parent(),
- _UDRD = U.UI.Form({ resizeend: U.M.apply(this, [[U.D.Blog.ZXWZ, ([_UDOD[0], 0])]]), id: "UD_BLOG", content: _UDPD, title: "<div class='UD_SYF_STI'>云端圈子</div>", hst: { style: { "padding": "0"} }, style: { width: "90%", height: "85%", padding: "0"} }).be;
- _UDPD.style.display = "block";
- U.D.Blog.QHCTBK(false);
- return _UDRD; //初始化数据
- }
- //我的和首页的切换
- U.D.Blog.QHCTBK = function (UTF, UDOD) {
- if (!UTF || !U.U.L.DLTC(3)) {
- var i, _UTP, _UDCD, _UDAD = UDOD ? U.selectEl(UDOD).parentg().childg(0) : null;
- if (_UDAD) {
- for (i = 0; i < _UDAD.length; i++) {
- _UTP = _UDAD[i] == UDOD ? "addClass" : "removeClass";
- _UDCD = U.selectEl(_UDAD).childg(i)[0];
- _UDAD[_UTP]("UD_SYSXSZCVLOS", i);
- _UDCD[_UTP]("UD_SYSXSZCVLOI" + (i ? "O" : "") + "T");
- }
- }
- U.D.Blog.GDQHCTBK(UTF);
- U.UI.Form.et["UD_BLOG"].body.onscroll = U.M.SSCH({ "AF": U.M.apply(null, [[U.D.Blog.GDQHCTBK, ([UTF])]]) }).SCH(); //查看朋友圈
- }
- }
- //滚动处理
- U.D.Blog.GDQHCTBK = function (UTF) {
- var _UP = this.P == null ? 1 : this.P + 2;
- UTF ? U.D.Blog.GBL($("#UD_SYSXZBR")[0], _UP, US.userInfo.userid) : U.D.Blog.PFY(_UP);
- }
- //#region 公共数据查看
- //非朋友数据查看
- U.D.Blog.PFY = function (UP, UTF) {
- var _UGE = U.D.SY.ET["UB"][0],
- _UDPD = U.selectEl("#UD_SYSXN")[0],
- _UDOD = U.selectEl("#UD_SYSXZBR")[0],
- _UDE = U.D.T.FYGBL(_UGE, UP, [30, 120]), _UE = _UDE[1] * 120;
- if (_UDE[0] && UTF !== true) {
- (UP == 1) && (_UDOD.innerText = "");
- U.D.Blog.U.ZXBlog(_UDOD, _UDE[0], false, U.selectEl(_UDOD).Child().length);
- } //Blog数据使用 (_UDPD.scrollHeight <= _UDPD.offsetHeight) && (U.D.Blog.PFY(UP + 1));
- else if (!_UGE) {
- UTF = UTF && _UDE[0] && _UDE[0].length != 0;
- U.D.Blog.Blog(U.M.apply(this, [[U.D.Blog.PFY, ([UP])]]));
- }
- else { //获取数据
- U.A.Request(US.CD, ([US.DB, "UseStudio_Blog", "UB_B_S_NewPost", _UE - 120, _UE, UTF ? _UDE[0][0].ArticleID : US.NU]), U.D.Blog.AsynPFY, ([[$("#UD_SYSXSZCD")[0], 1], UP, _UDE[1], UTF]));
- // U.A.Request("Blog.getNewArticess", ([_UE - 120, _UE, UTF ? _UDE[0][0].ArticleID : ""]), U.D.Blog.AsynPFY, ([[$("#UD_SYSXSZCD")[0], 1], UP, _UDE[1], UTF]));
- }
- }
- //最新blog异步
- U.D.Blog.AsynPFY = function (request) {
- var i, _UAE, _UDE = U.D.SY.ET["UB"][0], context = request.context, _UP = context[1], _UTP = context[2], _UTF = context[3]; request = request.value
- if (_UTF) { if ((_UAE = request).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] = request; } (_UAE.length > 1) && (U.D.Blog.ZFSYPFY(_UAE)); U.D.Blog.PFY(_UP); //打印
- }
- //#endregion
- //#region 好友圈查看
- //根据用户ID获取用户数据
- U.D.Blog.GBL = function (UDOD, UP, UID) {
- var _UGE = U.D.SY.ET["UL"]["HY"], _UID = _UGE["UID"] || UID, _UDE = U.D.T.FYGBL(_UGE[_UID], UP, [15, 150]), _UCE = ["ReplayMost", [(_UDE[1] - 1) * 150, _UDE[1] * 150, _UID, US.NU]]; (UP == 1) && (UDOD.innerText = "");
- if (_UDE[0]) {//直接打印显示
- if (_UDE[0].length) {
- U.D.Blog.PGBL(UDOD, _UDE[0], null);
- if (UDOD.scrollHeight < US.Height - UDOD.offsetTop - 120) { U.D.Blog.GBL(UDOD, UP + 1, UID); }
- }
- else { (UP == 1) && (U.D.Blog.PGBLK(UDOD)); }
- }
- else {//获取数据
- (UP == 1) && (UDOD.style.height = Math.max((US.Height - 110 - UDOD.offsetTop), 50) + "px"); //初始化大小
- if (_UID != "RM") { _UCE[1].unshift(_UID); _UCE[0] = "GFA"; };
- U.A.Request("Blog." + _UCE[0], (_UCE[1]), U.D.Blog.AsynGBL, ([UP == 1 ? [UDOD, true] : null, UDOD, UP, _UDE[1], _UID]));
- }
- }
- //获取朋友圈异步
- U.D.Blog.AsynGBL = function (request) {
- var _UDE, _UGE = U.D.SY.ET["UL"]["HY"],
- context = request.context,
- _UDOD = context[1],
- _UP = context[2],
- _UTP = context[3],
- _UID = context[4];
- request = request.value;
- if (request) {
- _UDE = _UGE[_UID];
- (!_UDE) && (_UDE = _UGE[_UID] = []);
- _UDE[_UTP] = U.D.Blog.ZFSGBL(request);
- U.D.Blog.GBL(_UDOD, _UP, _UID);
- } //设置
- }
- //#endregion
- //转发生成
- U.D.Blog.ZFSGBL = function (UDE) {
- var i, j;
- U.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.D.Blog.PGBL = function (UDOD, UDE, UTF, UIE, USID) {
- if (UTF) { U.D.Blog.ZLNRPY(UDOD, UDE); } //个人信息里的朋友圈展示
- else { U.D.Blog.U.ZXBlog(UDOD, UDE, USID, UIE != null ? (UIE === true ? U.selectEl(UDOD).Child().length - 1 : UIE) : null, true); } //首页朋友圈样式
- }
- //打印朋友圈空消息的
- U.D.Blog.PGBLK = function (UDOD) {
- var _UTF = US.Friend[1].length, _UDSD, _UDMD = U.selectEl("#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.D.Blog.A.FBCKME }, _UDSD);
- }
- //资料内容里的朋友圈信息
- U.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.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([UDE[i].UserID])]], "src": U.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.M.StopBubble], [U.UI.Confirm, (["是否取消转发", [U.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.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.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([_UCE.UserID])]], "src": U.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.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.M.StopBubble], [U.UI.Confirm, (["是否删除该消息", [U.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.M.StopBubble], [U.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.M.apply(this, [[U.D.Blog.F.GSHGBL, ([_UCE, null, null])]]);
- }
- $$("div", { "className": "UD_SYSXZLRSRDTD", "innerHTML": U.MT.getTDInterval(_UCE.ArticleAddTime) }, _UDTD)
- }
- UDOD.appendChild(_UDFD);
- }
- //打印图片
- U.D.Blog.TPGBL = function (UDOD, UDE, TF, UFT) {
- var _UIMG, _UDTD, _UDCD, _UDID, _UDKD, _UTH, _ULT, _UIE = [];
- UDOD.innerHTML = UDE.ArticleContent || UDE.ArticleContentBrief; _UIMG = U.selectEl("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.fs) > -1 ? _UIMG[i].title : _UIMG[i].src }); } //生成图片阅览数组
- for (i = 0; i < _ULT; i++) { //生成图片
- _UDID = $$("div", { "className": TF ? "UD_SYSXZLRSRDTRZTCDT" : "UD_SYSXZLRSRDTRZTCDO", "onclick": U.M.apply() }, _UDCD);
- if (TF) { U.D.SY.JZTPJS(_UIMG[i].src, _UDID, UDE); } //居中图查看
- else { $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], [U.D.Img.Img, ([UDE, _UIE, i])]], "src": _UIMG[i].src }, _UDID); } //查看
- }
- }
- }
- //位置偏移算法
- U.D.Blog.ZXWZ = function (UDOD, UIE, UDCD, UTF) {
- var i, j, _UST, _UL, _UDSD, _UKE, _UDMD, _UDE = [], _UDND = U.selectEl(UDOD).Child(), _UBE = U.CI.getBrowser(), _UFT = (_UBE.browser == "msie" && (parseInt(_UBE["ver"]) < 10)), _UW = U.selectEl(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
|