U.D.Blog.R.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. Namespace.register("U.D.Blog.R"); //朋友圈评论
  2. //#region 评论
  3. //打印内容
  4. U.D.Blog.R.PBPGBL = function (UDE, UDOD) {
  5. var i, _UDE = ["block", "none"], _UDCD = U.selectEl(UDOD).childg(0).Child();
  6. if (!UDE && UDE["KZ"]) { _UDE.reverse(); } //取消
  7. else {//打印
  8. var i, _UTL, _UDTD, _UDFD = $$("frag"),
  9. _UDAD = U.selectEl("div", _UDCD[0]),
  10. _UDID = U.M.SetElement(UDE.ArticleContent, "img", "De"),
  11. UTH = _UDID[1].innerText; _UDCD[0].scrollTop = 0;
  12. _UDAD[16].innerText = _UDAD[2].innerText = _UDAD[8].innerText = "";
  13. _UDAD[5].innerText = UDE.UserNickName || UDE.UserName;
  14. _UDAD[6].innerText = U.MT.getTDInterval(UDE.ArticleAddTime);
  15. _UDAD[7].innerText = UTH || "图片分享";
  16. _UDAD.addAttrArray({ "innerText": (UDE.ArticleZFN === undefined ? UDE.AricitleReadNumber : UDE.ArticleZFN), "onclick": [[U.M.StopBubble], [U.D.Blog.A.PAZF, ([UDE])]] }, 11);
  17. $$("img", { "onerror": U.M.ImgError, "onclick": [[U.U.I.UIFZX, ([UDE.UserID])]], "src": U.M.GetImgU(UDE.UserThumbnailImageHead), "title": "点击查看" }, _UDAD[2]); //用户头像
  18. //用户发表的图片展示 _UDID[0][i].onclick ||
  19. if ((_UTL = _UDID[0].length)) {
  20. for (i = 0; i < _UTL; i++) {
  21. $$("img", { "src": _UDID[0][i].src, "onclick": [[U.M.StopBubble], [U.D.Img.Img, ([UDE, [{ "Thm": _UDID[0][i].src, "Img": _UDID[0][i].alt.indexOf(US.fs) > -1 ? _UDID[0][i].alt : _UDID[0][i].src}]])]] }, _UDFD);
  22. } _UDAD[8].appendChild(_UDFD);
  23. }
  24. (_UDTD = _UDAD["UD_SYBNO"]).onclick = U.M.apply(null, [[U.D.Blog.R.FBHFRGBL, ([UDE, _UDTD, null])]]);
  25. }
  26. for (i = 0; i < _UDE.length; i++) { _UDCD[i].style.display = _UDE[i]; } return _UDAD;
  27. }
  28. //滚动回复数据
  29. U.D.Blog.R.GDHFRGBL = function (UDE, UDOD) {
  30. U.D.Blog.R.HFRGBL(UDE, UDOD, this.P + 2);
  31. }
  32. //用户回复数据
  33. U.D.Blog.R.HFRGBL = function (UDE, UDOD, P) {
  34. var _UDAD, _UGD = [undefined],
  35. _UET = U.D.T.FYGBL(UDE.Reply, P),
  36. _UDTD = U.selectEl(".UD_SYBAOO", UDOD)[0]; //获取回复数据
  37. if (_UET[0]) {
  38. _UDAD = U.selectEl("div", _UDTD);
  39. (P == 1) && (_UDAD["UD_SYBF"].innerText = "", _UDAD[14].innerText = UDE["ArticleReplayNumber"] || 0);
  40. if (_UET[0].length > 0) {
  41. (P == 1) && (U.D.Blog.R.PHFRGBLPL(_UET[0], _UDAD[16]), _UGD[0] = U.M.SSCH({ 'AF': U.M.apply(null, [[U.D.Blog.R.GDHFRGBL, ([UDE, UDOD])]]) }).SCH());
  42. U.D.Blog.R.PHFRGBL(_UET[0], _UDAD["UD_SYBF"], null, UDE);
  43. } else { _UGD[0] = null; } (_UGD[0] !== undefined) && (_UDTD.onscroll = _UGD[0]);
  44. } //打印评论数据
  45. else {
  46. U.A.Request(US.CD, ([US.DB, "UseStudio_Blog", "UB_P_S_SelectArticleAllReply", UDE.ArticleID, (_UET[1] - 1) * 100, _UET[1] * 100]), U.D.Blog.R.AsynHFRGBL, (["", UDE, UDOD, P, _UET[1]]));
  47. // U.A.Request("pb.ReplyList", ([UDE.ArticleID, (_UET[1] - 1) * 100, _UET[1] * 100]), U.D.Blog.R.AsynHFRGBL, (["", UDE, UDOD, P, _UET[1]]));
  48. } //获取评论数据
  49. }
  50. //异步获取回复数据
  51. U.D.Blog.R.AsynHFRGBL = function (request) {
  52. var i, context = request.context, _UDE = context[1], _UDOD = context[2], _UP = context[3], _UTP = context[4]; request = request.value; (_UDE.Reply == null) && (_UDE.Reply = []); _UDE.Reply[_UTP] = [];
  53. for (i = 0; i < request.length; i++) {
  54. if (!request[i].ReplyParentID) {
  55. _UDE.Reply[_UTP].push(request[i]);
  56. request[i]["RR"] = _$(request).Select({ "ReplyParentID": request[i].ReplyID });
  57. }
  58. }
  59. U.D.Blog.R.HFRGBL(_UDE, _UDOD, _UP);
  60. }
  61. //打印评论好友
  62. U.D.Blog.R.PHFRGBLPL = function (UDE, UDOD) {
  63. var i, _UET = {}, UDFD = $$("frag");
  64. for (i = 0; i < UDE.length; i++) { if (!_UET[UDE[i].ReplyAddUserID]) { $$("img", { "onerror": U.M.ImgError, "src": U.M.GetImgU(UDE[i].UserThumbnailImageHead), "title": UDE[i].UserNickName, "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([UDE[i].ReplyAddUserID])]] }, UDFD); _UET[UDE[i].ReplyAddUserID] = "Yes"; } }
  65. UDOD.appendChild(UDFD)
  66. }
  67. //打印回复数据
  68. U.D.Blog.R.PHFRGBL = function (UDE, UDPD, TF, UAE, UPE) {
  69. var i, j, _UME, _UKE, _UDTD, _UDSD, _UDFD = $$("frag"); _UKE = UDE.length == 1 ? UAE["Reply"][1] : UDE
  70. for (i = 0; i < UDE.length; i++) {
  71. _UDTD = U.D.Blog.R.YSPHFRGBL(UDE[i], _UDFD, UAE, UPE || UDE[i], UPE ? UDPD : null, _UKE); _UME = UDE[i]["RR"]; //打印回复
  72. for (j = 0; (_UME && j < _UME.length); j++) {
  73. U.D.Blog.R.YSPHFRGBL(_UME[j], _UDTD, UAE, UDE[i], _UDTD, _UME);
  74. } //打印回复的回复
  75. }
  76. if (TF && UDPD.firstChild) { UDPD.insertBefore(_UDFD, UDPD.firstChild); } else { UDPD.appendChild(_UDFD); }
  77. }
  78. //样式使用
  79. U.D.Blog.R.YSPHFRGBL = function (UDE, UDOD, UAE, UPE, UDMD, UME) {
  80. var _UDTD, _UDMD, _UDSD, _UDED, _UDGD, _UDJD, _UTF = UDE.ReplyAddUserID == US.userInfo.userid;
  81. _UDTD = $$("div", { "className": "UD_SYBFO" }, UDOD);
  82. _UDSD = $$("div", { "className": "UD_SYBFOI" }, _UDTD);
  83. $$("img", { "onerror": U.M.ImgError, "title": UDE.UserNickName, "src": U.M.GetImgU(UDE.UserThumbnailImageHead), "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([UDE.ReplyAddUserID])]] }, _UDSD);
  84. _UDED = $$("div", { "className": "UD_SYBFOZ" }, _UDTD);
  85. _UDGD = $$("div", { "className": "UD_SYBFOZK" }, _UDED);
  86. $$("div", { "className": "UD_SYBFOZTN", "innerHTML": UDE.UserNickName, "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([UDE.ReplyAddUserID])]] }, _UDGD);
  87. _UDJD = $$("div", { "className": "UD_SYBFOZTO" }, _UDGD);
  88. $$("div", { "className": "UD_SYBFOZT", "innerHTML": U.MT.getTDInterval(UDE.ReplyAddTime) }, _UDJD);
  89. _UDSD = $$("div", { "className": "UD_SYBFT" }, _UDTD);
  90. $$("div", { "className": "UD_SYBFOZTK" + (_UTF ? " UD_SYBFOZTKO" : ""), "title": _UTF ? "删除" : "回复", "innerHTML": _UTF ? "删除" : "回复", "onclick": _UTF ? [[U.UI.Confirm, (["是否撤销评论", [U.D.Blog.R.SCPHFRGBL, ([UME, UDE, UAE, _UDTD])]])]] : [[U.D.Blog.R.TCPHFRGBL, ([UAE, _UDSD, UPE, UDMD])]] }, _UDJD);
  91. (UDE.ParentUserNickName) && ($$("div", { "className": "UD_SYBFOZKT", "innerHTML": "回复" }, _UDGD), $$("div", { "className": "UD_SYBFOZKO", "innerHTML": "@" + UDE.ParentUserNickName, "onclick": [[U.M.StopBubble], [U.U.I.UIFZX, ([UDE.ParentUserId])]] }, _UDGD));
  92. $$("div", { "className": "UD_SYBFOZC UC_TF", "innerHTML": UDE.ReplyContent, "onselectstart": [[U.M.StopBubble], [U.M.apply(this, "return true")]] }, _UDED);
  93. return _UDSD;
  94. }
  95. //评论查看
  96. U.D.Blog.R.PLCKBL = function (UDOD) {
  97. if (!U.U.L.DLTC(3)) { U.MR.InputTip(UDOD, ["发表回复...", ""]); } //发表回复
  98. else { UDOD = U.selectEl($(UDOD).Parent(6)); U.D.SY.ET.DLHD = [U.M.apply(UDOD, [[UDOD.addAttrArray, ([{ "style": { "display": "block"}}])]])]; } //评论查看
  99. }
  100. //删除评论
  101. U.D.Blog.R.SCPHFRGBL = function (UPE, UDE, UAE, UDOD) {
  102. if (!U.U.L.DLTC(3)) {
  103. var _URID, _UAID, _UCB;
  104. if (U.Ut.isString(UPE)) { _URID = UPE; _UAID = UDE || US.NU; _UCB = UAE; }
  105. else {
  106. UPE.splice(UPE.inArray(UDE), 1);
  107. U.selectEl("#UD_SYBK&div")[4].innerText -= 1 + (UDE["RR"] ? UDE["RR"].length : 0);
  108. U.selectEl(UDOD).remove();
  109. _URID = UDE.ReplyID;
  110. _UAID = UAE.ArticleID;
  111. } //移除评论 //移除元素 //评论数-1
  112. U.A.Request(US.CD, ([US.DB, "UseStudio_Blog", "UB_P_D_DeleteOneReplyAndAllChildReply", US.userInfo.userid, _URID, _UAID || US.NU]), _UCB || U.M.apply, ([""])); //服务器同步
  113. // U.A.Request("pb.DeleteOneReplyAndChildReply", ([US.userInfo.userid, _URID, UAID || US.NU]), _UCB || U.M.apply, ([""])); //服务器同步
  114. }
  115. }
  116. //弹出回复的回复框
  117. U.D.Blog.R.TCPHFRGBL = function (UAE, UDOD, UPE, UDMD) {
  118. if (!U.U.L.DLTC(3)) {
  119. var _UDAD, _UDTD = U.selectEl("#UD_SYBNK")[0];
  120. if (!_UDTD) {
  121. _UDTD = U.selectEl("#UD_SYBN")[0].parentNode.cloneNode(true);
  122. _UDTD.id = "UD_SYBNK"; U.selectEl(_UDTD).Child()[0].onblur = U.D.Blog.R.YCTCPHFRGBL;
  123. };
  124. U.selectEl($(_UDTD).Child()[0]).addAttrArray({ "id": "", "innerHTML": "" });
  125. _UDTD.style.display = "block";
  126. _UDAD = U.selectEl(_UDTD).Child();
  127. _UDAD[1].onclick = U.M.apply(this, [[U.D.Blog.R.FBHFRGBL, ([UAE, _UDAD[1], UPE, _UDTD, UDMD])]]); UDOD.insertBefore(_UDTD, UDOD.firstChild);
  128. _UDAD[0].focus();
  129. }
  130. }
  131. //移除评论框
  132. U.D.Blog.R.YCTCPHFRGBL = function () {
  133. var _UDTD = U.selectEl(this.parentNode);
  134. setTimeout(U.M.apply(_UDTD, [[_UDTD.addAttrArray, ([{ "style": { "display": "none"}}])]]), 500); //延迟执行
  135. }
  136. //发表评论
  137. U.D.Blog.R.FBHFRGBL = function (UAE, UDOD, UPE, UDTD, UDMD) {
  138. var _UDED = U.M.GTCN(UDOD.parentNode.childNodes)[0], _UHT = _UDED.innerHTML;
  139. if (_UHT != "发表回复..." && _UHT != "") {
  140. U.A.Request("pb.ReportReply", ([UAE.ArticleID, _UDED.innerHTML, UPE ? (UPE.ReplyParentID || UPE.ReplyID) : "", UPE ? UPE.ReplyAddUserID : ""]), U.D.Blog.R.AsynFBHFRGBL, (["", UAE, _UDED.innerHTML, UPE, UDTD, UDMD]));
  141. (UDTD) && (UDTD.style.display = "none"); _UDED.innerText = "发表回复..."; U.Alert("正在发送中...");
  142. }
  143. }
  144. //添加回复
  145. U.D.Blog.R.TJFBHFRG = function (UAID, UTH) {
  146. if (!U.U.L.DLTC(3)) {
  147. var _UCB, _UPID = "",
  148. _UUID = "", _UDE = arguments;
  149. if (_UDE.length < 4) { _UCB = _UDE[2]; }
  150. else {
  151. _UPID = _UDE[3]; _UUID = _UDE[4]; _UCB = _UDE[5];
  152. }
  153. U.A.Request("pb.ReportReply", ([US.userInfo.userid, UAID, UTH, _UPID, _UUID]), U.D.Blog.R.AsynTJFBHFRG, (["", _UCB])); //添加回复到后台
  154. }
  155. }
  156. //添加回复异步
  157. U.D.Blog.R.AsynTJFBHFRG = function (request) {
  158. var context = request.context,
  159. _UCB = context[1];
  160. request = request.value; (_UCB) && (_UCB(request));
  161. }
  162. //发表评论成功异步
  163. U.D.Blog.R.AsynFBHFRGBL = function (reuqest) {
  164. var _UKE, _UME, UPE, _UTH, _UAE, _UDOD, _UDMD, _UDP;
  165. context = reuqest.context;
  166. reuqest = reuqest.value;
  167. _UAE = context[1];
  168. _UTH = context[2];
  169. UPE = context[3];
  170. _UDOD = context[4];
  171. _UDMD = context[5];
  172. _UDPD = U.selectEl("#UD_SYB" + _UAE.ArticleID).find("div")["UD_SYBF"];
  173. (_UKE = (UPE ? UPE["RR"] : _UAE["Reply"][1])).unshift((_UME = new U.D.Blog.R.FRGBLET([_UKE[0] ? (_UKE[0].AllCount + 1) : 1, UPE ? UPE.UserNickName : "", U.MT.SetDT(new Date()), US.userInfo.userid, _UTH, reuqest, UPE ? UPE.ReplyID : "", UPE ? UPE.ReplyAddUserID : "", US.userInfo.UserNickName, US.userInfo.UserThumbnailImageHead]))); //添加新的类
  174. (!UPE) && (_UME["RR"] = []);
  175. U.D.Blog.R.PHFRGBL([_UME], (UPE ? (_UDMD || _UDOD.parentNode) : _UDPD), true, _UAE, UPE);
  176. U.selectEl("div", _UDPD.parentNode)[14].innerText = _UME.AllCount; //添加回复
  177. }
  178. //回复的实体
  179. U.D.Blog.R.FRGBLET = function (UDE) {
  180. var i = UDE.length, _UET = ["AllCount", "ParentUserNickName", "ReplyAddTime", "ReplyAddUserID", "ReplyContent", "ReplyID", "ReplyParentID", "ReplyVerifyUserID", "UserNickName", "UserThumbnailImageHead"]
  181. while (i--) { this[_UET[i]] = UDE[i] }
  182. }
  183. //展开缩小消息发送
  184. U.D.Blog.R.SGBL = function (UDOD, TF) {
  185. var _UDPD = UDOD.parentNode, _UDE = ["block", { "width": "310px", "height": "25px" }, "none", "UD_SYSXZLRSSV UD_SYI"], _UDAD = U.selectEl(_UDPD).Child(), _UDCD = U.selectEl("div", _UDAD[1]); UDOD = U.selectEl(UDOD);
  186. (TF) && (_UDE[0] = "none", _UDE[1] = { "width": "100%", "height": "100px" }, _UDE[2] = "block", _UDE[3] = "UD_SYSXZLRSSVA");
  187. UDOD.addAttrArray({ "style": _UDE[1] }); _UDAD[1].className = _UDE[3]; _UDCD[0].style.display = _UDE[2]; //U.D.SY.DTGBL(_UDCD[1], true);
  188. }
  189. //#endregion