U.D.Blog.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. Namespace.register("U.D.Blog"); //Blog加载
  2. //#region 初始化首页
  3. //获取Blog数据
  4. U.D.Blog.Blog = function (UCB) {
  5. if (!U.D.SY.ET["UB"]) {
  6. U.A.Request("Blog.nologinload", ([]), U.D.Blog.AsynBlog, ([[$("#UD_SYSXZBR")[0], true], UCB]));
  7. }
  8. }
  9. //朋友圈大小同步函数
  10. U.D.Blog.SYDJBH = function (UDOD, UP, UTF) {
  11. var _UDPD = U.selectEl($($(UDOD).Parent()).Child()[0]).Child()[0];
  12. _UDPD.style.width = US.Width - 50 + "px";
  13. U.selectEl(_UDPD).Child()[1].style.width = US.Width - 170 + "px";
  14. }
  15. //异步Blog数据
  16. U.D.Blog.AsynBlog = function (request) {
  17. var i, _UDE = U.D.SY.ET["UB"] = [[]], context = request.context, UCB = context[1]; request = request.value;
  18. for (i = 1; i < request.length; i++) { _UDE[i] = request[i]; } //保存数据
  19. U.D.Blog.ZFSYPFY(_UDE[0][1] = request[0]); U.D.Blog.Dt.ZMBMAIN(_UDE); (UCB) && (UCB()); //打印数据
  20. }
  21. //转发信息整理
  22. U.D.Blog.ZFSYPFY = function (UDE) {
  23. 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; } } } }
  24. return UDE;
  25. }
  26. //#endregion
  27. //#region 朋友圈数据查看
  28. //窗体朋友圈
  29. U.D.Blog.CTPYQ = function (UID) {
  30. var _UDOD = U.selectEl("#UD_SYSXZBR"),
  31. _UDPD = _UDOD.Parent(),
  32. _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;
  33. _UDPD.style.display = "block";
  34. U.D.Blog.QHCTBK(false);
  35. return _UDRD; //初始化数据
  36. }
  37. //我的和首页的切换
  38. U.D.Blog.QHCTBK = function (UTF, UDOD) {
  39. if (!UTF || !U.U.L.DLTC(3)) {
  40. var i, _UTP, _UDCD, _UDAD = UDOD ? U.selectEl(UDOD).parentg().childg(0) : null;
  41. if (_UDAD) {
  42. for (i = 0; i < _UDAD.length; i++) {
  43. _UTP = _UDAD[i] == UDOD ? "addClass" : "removeClass";
  44. _UDCD = U.selectEl(_UDAD).childg(i)[0];
  45. _UDAD[_UTP]("UD_SYSXSZCVLOS", i);
  46. _UDCD[_UTP]("UD_SYSXSZCVLOI" + (i ? "O" : "") + "T");
  47. }
  48. }
  49. U.D.Blog.GDQHCTBK(UTF);
  50. U.UI.Form.et["UD_BLOG"].body.onscroll = U.M.SSCH({ "AF": U.M.apply(null, [[U.D.Blog.GDQHCTBK, ([UTF])]]) }).SCH(); //查看朋友圈
  51. }
  52. }
  53. //滚动处理
  54. U.D.Blog.GDQHCTBK = function (UTF) {
  55. var _UP = this.P == null ? 1 : this.P + 2;
  56. UTF ? U.D.Blog.GBL($("#UD_SYSXZBR")[0], _UP, US.userInfo.userid) : U.D.Blog.PFY(_UP);
  57. }
  58. //#region 公共数据查看
  59. //非朋友数据查看
  60. U.D.Blog.PFY = function (UP, UTF) {
  61. var _UGE = U.D.SY.ET["UB"][0],
  62. _UDPD = U.selectEl("#UD_SYSXN")[0],
  63. _UDOD = U.selectEl("#UD_SYSXZBR")[0],
  64. _UDE = U.D.T.FYGBL(_UGE, UP, [30, 120]), _UE = _UDE[1] * 120;
  65. if (_UDE[0] && UTF !== true) {
  66. (UP == 1) && (_UDOD.innerText = "");
  67. U.D.Blog.U.ZXBlog(_UDOD, _UDE[0], false, U.selectEl(_UDOD).Child().length);
  68. } //Blog数据使用 (_UDPD.scrollHeight <= _UDPD.offsetHeight) && (U.D.Blog.PFY(UP + 1));
  69. else if (!_UGE) {
  70. UTF = UTF && _UDE[0] && _UDE[0].length != 0;
  71. U.D.Blog.Blog(U.M.apply(this, [[U.D.Blog.PFY, ([UP])]]));
  72. }
  73. else { //获取数据
  74. 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]));
  75. // 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]));
  76. }
  77. }
  78. //最新blog异步
  79. U.D.Blog.AsynPFY = function (request) {
  80. 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
  81. 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); } } }
  82. else { _UAE = _UDE[_UTP] = request; } (_UAE.length > 1) && (U.D.Blog.ZFSYPFY(_UAE)); U.D.Blog.PFY(_UP); //打印
  83. }
  84. //#endregion
  85. //#region 好友圈查看
  86. //根据用户ID获取用户数据
  87. U.D.Blog.GBL = function (UDOD, UP, UID) {
  88. 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 = "");
  89. if (_UDE[0]) {//直接打印显示
  90. if (_UDE[0].length) {
  91. U.D.Blog.PGBL(UDOD, _UDE[0], null);
  92. if (UDOD.scrollHeight < US.Height - UDOD.offsetTop - 120) { U.D.Blog.GBL(UDOD, UP + 1, UID); }
  93. }
  94. else { (UP == 1) && (U.D.Blog.PGBLK(UDOD)); }
  95. }
  96. else {//获取数据
  97. (UP == 1) && (UDOD.style.height = Math.max((US.Height - 110 - UDOD.offsetTop), 50) + "px"); //初始化大小
  98. if (_UID != "RM") { _UCE[1].unshift(_UID); _UCE[0] = "GFA"; };
  99. U.A.Request("Blog." + _UCE[0], (_UCE[1]), U.D.Blog.AsynGBL, ([UP == 1 ? [UDOD, true] : null, UDOD, UP, _UDE[1], _UID]));
  100. }
  101. }
  102. //获取朋友圈异步
  103. U.D.Blog.AsynGBL = function (request) {
  104. var _UDE, _UGE = U.D.SY.ET["UL"]["HY"],
  105. context = request.context,
  106. _UDOD = context[1],
  107. _UP = context[2],
  108. _UTP = context[3],
  109. _UID = context[4];
  110. request = request.value;
  111. if (request) {
  112. _UDE = _UGE[_UID];
  113. (!_UDE) && (_UDE = _UGE[_UID] = []);
  114. _UDE[_UTP] = U.D.Blog.ZFSGBL(request);
  115. U.D.Blog.GBL(_UDOD, _UP, _UID);
  116. } //设置
  117. }
  118. //#endregion
  119. //转发生成
  120. U.D.Blog.ZFSGBL = function (UDE) {
  121. var i, j;
  122. U.Ut.AddArr(UDE, { "JZ": true });
  123. for (i = 0; i < UDE.length; i++) {
  124. if (UDE[i].Forward) {
  125. for (j = UDE.length - 1; j > i; j--) {
  126. if (UDE[i].Forward == UDE[j].ArticleID) {
  127. UDE[i].ZF = UDE.splice(j, 1)[0]; break;
  128. }
  129. }
  130. }
  131. }
  132. return UDE;
  133. }
  134. //打印朋友圈信息
  135. U.D.Blog.PGBL = function (UDOD, UDE, UTF, UIE, USID) {
  136. if (UTF) { U.D.Blog.ZLNRPY(UDOD, UDE); } //个人信息里的朋友圈展示
  137. else { U.D.Blog.U.ZXBlog(UDOD, UDE, USID, UIE != null ? (UIE === true ? U.selectEl(UDOD).Child().length - 1 : UIE) : null, true); } //首页朋友圈样式
  138. }
  139. //打印朋友圈空消息的
  140. U.D.Blog.PGBLK = function (UDOD) {
  141. var _UTF = US.Friend[1].length, _UDSD, _UDMD = U.selectEl("#UD_SYSXZLRSSI")[0], _UDTD = $$("div", { "className": "UD_SYSXZLRSRDO" }, UDOD);
  142. $$("div", { "className": "UD_SYSXZLRSRDOS", "innerHTML": _UTF ? "暂无追随好友消息" : "你还没有追随喜欢的人哦 ! &nbsp;!" }, _UDTD);
  143. $$("div", { "className": "UD_SYSXZLRSRDOZ", "innerHTML": _UTF ? "可以查看热门用户" : "可以尝试追随喜欢的人。" }, _UDTD);
  144. _UDSD = $$("div", { "className": "UD_SYSXZLRSRDOX", "innerHTML": "或者:" }, _UDTD);
  145. $$("span", { "innerHTML": "发布动静..", "onclick": U.D.Blog.A.FBCKME }, _UDSD);
  146. }
  147. //资料内容里的朋友圈信息
  148. U.D.Blog.ZLNRPY = function (UDOD, UDE) {
  149. var i, _UTF, _UCE, _UDHD, _UDTD, _UDMD, _UDSD, _UDLD, _UDRD, _UDWD, _UDYD, _UDND, _UDID, _UDIOD, _UDITD, _UDFD = $$("frag");
  150. for (i = 0; i < UDE.length; i++) {
  151. _UTF = true; _UDTD = $$("div", { "className": "UD_SYSXZLRSRDTK" }, _UDFD);
  152. _UDMD = $$("div", { "className": "UD_SYSXZLRSRDTKO" }, _UDTD);
  153. if ((_UCE = UDE[i].ZF) || UDE[i].Forward) {//
  154. _UDSD = $$("div", { "className": "UD_SYSXZLRSRDTS" }, _UDMD);
  155. $$("div", { "className": "UD_SYSXZLRSRDTSL UD_SYI" }, _UDSD);
  156. _UDLD = $$("div", { "className": "UD_SYSXZLRSRDTSI" }, _UDSD);
  157. $$("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);
  158. _UDLD = $$("div", { "className": "UD_SYSXZLRSRDTSR" }, _UDSD);
  159. _UDRD = $$("div", { "className": "UD_SYSXZLRSRDTSRS" }, _UDLD);
  160. $$("div", { "className": "UD_SYSXZLRSRDTSRSL", "innerHTML": UDE[i].UserName }, _UDRD);
  161. $$("div", { "className": "UD_SYSXZLRSRDTSRSR", "innerHTML": "推荐了" }, _UDRD);
  162. $$("div", { "className": "UD_SYSXZLRSRDTSRX", "innerHTML": UDE[i].ArticleContentBrief }, _UDLD);
  163. 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) } //
  164. else { $$("div", { "className": "UD_SYSXZLRSRDTRZTI UD_SYSXZLRSRDTRZTIT UD_SYI", "title": "点击展开" }, _UDSD); }
  165. _UTF = !_UTF; (_UCE == null) && (_UCE = new U.D.Blog.A.BLEI([UDE[i].ArticleID, 0, 0, UDE[i].ArticleAddTime, "很遗憾,动静已被作者删除了", "很遗憾,动静已被作者删除了", "", "", "", 0])); //原文被删除
  166. }
  167. _UCE = _UCE || UDE[i]; _UDHD = $$("div", { "className": "UD_SYSXZLRSRDTKLO" }, _UDMD);
  168. _UDSD = $$("div", { "className": "UD_SYSXZLRSRDTKL" }, _UDHD);
  169. _UDLD = $$("div", { "className": "UD_SYSXZLRSRDTLI" }, _UDSD);
  170. $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([_UCE.UserID])]], "src": U.M.GetImgU(_UCE.UserThumbnailImageHead) }, _UDLD);
  171. $$("div", { "style": { "fontWeight": "100" }, "className": "UD_SYSXZLRSRDTLKN UTDF", "innerHTML": _UCE.UserName || US.userInfo.UserNickName }, _UDSD);
  172. _UDRD = $$("div", { "className": "UD_SYSXZLRSRDTKR UD_SYUPCC" }, _UDHD);
  173. _UDYD = $$("div", { "className": "UD_SYSXZLRSRDTRZ UD_SYUPCCY" }, _UDRD);
  174. _UDND = $$("div", { "className": "UD_SYSXZLRSRDTRZTC UD_SYUPCCT" }, _UDYD);
  175. U.D.Blog.TPGBL(_UDND, _UCE, true, true); //打印图片
  176. if (_UTF && _UCE.UserID == US.userInfo.userid) {
  177. 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); }
  178. else if (!UDE[i].Forward) { $$("div", { "className": "UD_SYSXZLRSRDTRZTI UD_SYSXZLRSRDTRZTIT UD_SYI", "title": "点击展开" }, _UDHD); }
  179. }
  180. if (_UCE.UserID) {
  181. _UDID = $$("div", { "className": "UD_SYSXZLRSRDTRD UD_SYSXZLRSRDTKRD" }, _UDYD);
  182. _UDHD = $$("div", { "className": "UD_SYSXZLRSRDTRDY" }, _UDID);
  183. _UDIOD = $$("div", { "className": "UD_SYSXZLRSRDTRDRT" }, _UDID);
  184. _UDITD = $$("div", { "className": "UD_SYSXZLRSRDTRDRZ", "title": "转发", "onclick": _UCE["UserID"] ? [[U.M.StopBubble], [U.D.Blog.A.PAZF, ([_UCE, "this"])]] : "" }, _UDIOD);
  185. $$("div", { "className": "UD_SYSXZLRSRDTRDRZI UD_SYSXZLRSRDTRDRZIO UD_SYI" }, _UDITD);
  186. $$("div", { "className": "UD_SYSXZLRSRDTRDRZN", "innerHTML": _UCE.ArticleZFN }, _UDITD);
  187. _UDITD = $$("div", { "className": "UD_SYSXZLRSRDTRDRZ", "title": "回复" }, _UDIOD);
  188. $$("div", { "className": "UD_SYSXZLRSRDTRDRZI UD_SYSXZLRSRDTRDRZIT UD_SYI" }, _UDITD);
  189. $$("div", { "className": "UD_SYSXZLRSRDTRDRZN", "innerHTML": _UCE.ArticleReplayNumber }, _UDITD);
  190. _UDTD["onclick"] = U.M.apply(this, [[U.D.Blog.F.GSHGBL, ([_UCE, null, null])]]);
  191. }
  192. $$("div", { "className": "UD_SYSXZLRSRDTD", "innerHTML": U.MT.getTDInterval(_UCE.ArticleAddTime) }, _UDTD)
  193. }
  194. UDOD.appendChild(_UDFD);
  195. }
  196. //打印图片
  197. U.D.Blog.TPGBL = function (UDOD, UDE, TF, UFT) {
  198. var _UIMG, _UDTD, _UDCD, _UDID, _UDKD, _UTH, _ULT, _UIE = [];
  199. UDOD.innerHTML = UDE.ArticleContent || UDE.ArticleContentBrief; _UIMG = U.selectEl("img", UDOD); _UTH = UDOD.innerText || UDE.ArticleContentBrief || ""; UDOD.innerText = ""; _ULT = TF ? 1 : _UIMG.length;
  200. _UDTD = $$("div", { "className": UFT ? "UD_SYSXZLRSRDTRZTCS" : "UD_SYSXZLRSRDTRZTKCS", "style": UDE.UserID ? {} : { "color": "#9B9B9B", "textAlign": "center", "padding": "95px 0 90px 0" }, "innerHTML": _UTH }, UDOD);
  201. (_UTH = _UDTD.innerText); _UDTD.innerText = (TF ? (_UTH.length > 60 ? _UTH.substring(0, 60) + "..." : _UTH) : _UTH); _UDTD.innerText = _UDTD.innerText.Trim() || "图片分享";
  202. if (_UIMG.length) {
  203. _UDCD = $$("div", { "className": "UD_SYSXZLRSRDTRZTCD" + (UFT ? " UD_SYSXZLRSRDTRZTKCD" : ""), "style": TF ? {} : { "width": "100%", "height": "auto", "paddingBottom": "10px"} }, UDOD);
  204. 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 }); } //生成图片阅览数组
  205. for (i = 0; i < _ULT; i++) { //生成图片
  206. _UDID = $$("div", { "className": TF ? "UD_SYSXZLRSRDTRZTCDT" : "UD_SYSXZLRSRDTRZTCDO", "onclick": U.M.apply() }, _UDCD);
  207. if (TF) { U.D.SY.JZTPJS(_UIMG[i].src, _UDID, UDE); } //居中图查看
  208. else { $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], [U.D.Img.Img, ([UDE, _UIE, i])]], "src": _UIMG[i].src }, _UDID); } //查看
  209. }
  210. }
  211. }
  212. //位置偏移算法
  213. U.D.Blog.ZXWZ = function (UDOD, UIE, UDCD, UTF) {
  214. 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;
  215. for (i = 0; i < _UTI; i++) { _UDE[i] = [20]; }; _UKE = [_UMW, 100 / _UTI, _UTI, k, (_UW - _UMW) / 2, _USH - (US.Height / 2), _UFT]; //添加的位置定位
  216. if (UDCD) {//需要添加元素
  217. 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]; }; } //制定的位置设定
  218. for (i = 0; i < UDCD.length; i++) { _UIM = (i + k) % _UTI; _UDE[_UIM].push(_UDE[_UIM][_UDE[_UIM].length - 1] + UDCD[i].offsetHeight + 20); }
  219. 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;"; }
  220. UIE += i;
  221. }
  222. if (!UTF) {//需要定位添加
  223. if (UIE < _UDND.length) {
  224. for (i = UIE; i < _UDND.length; i++) { _UIM = i % _UTI; _UDE[_UIM].push(_UDE[_UIM][_UDE[_UIM].length - 1] + _UDND[i].offsetHeight + 20); }
  225. for (i = UIE; i < _UDND.length; i++) { _UIM = i % _UTI; _UDND[i].style.cssText = "top:" + (_UDE[_UIM].shift()) + "px;left:" + (_UIM * (_UMW + 20)) + "px;"; }
  226. }
  227. _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"));
  228. }
  229. return _UKE;
  230. }
  231. //#endregion