U.D.Blog.js 15 KB

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