From 80d4f39b23619c077aa9bb4256987c67d54bbb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=BE=89?= <1101635162@qq.com> Date: Thu, 5 Sep 2024 10:01:29 +0800 Subject: [PATCH] :art: --- .../java/org/b3log/symphony/processor/IndexProcessor.java | 4 ++-- src/main/resources/js/channel.js | 2 +- src/main/resources/js/channel.min.js | 2 +- src/main/resources/js/chat-room.js | 2 +- src/main/resources/js/chat-room.min.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/b3log/symphony/processor/IndexProcessor.java b/src/main/java/org/b3log/symphony/processor/IndexProcessor.java index 8336b843..8b96c186 100644 --- a/src/main/java/org/b3log/symphony/processor/IndexProcessor.java +++ b/src/main/java/org/b3log/symphony/processor/IndexProcessor.java @@ -546,8 +546,8 @@ public synchronized void showIndex(final RequestContext context) { Elements imgElements = doc.select("img"); for (Element img : imgElements) { String src = img.attr("src"); - // 在 src 后面加上 ?imageView2/1/w/150/h/150/interlace/0/q/90 - img.attr("src", src + "?imageView2/1/w/150/h/150/interlace/0/q/90"); + // 在 src 后面加上 ?imageView2/0/w/150/h/150/interlace/0/q/90 + img.attr("src", src + "?imageView2/0/w/150/h/150/interlace/0/q/90"); } // 更新 message 中的 content 字段 diff --git a/src/main/resources/js/channel.js b/src/main/resources/js/channel.js index 7058e9e4..9c87d7cf 100644 --- a/src/main/resources/js/channel.js +++ b/src/main/resources/js/channel.js @@ -559,7 +559,7 @@ var ChatRoomChannel = { let imgList = dom.querySelectorAll('img'); imgList.forEach(ele=>{ //if(ele.src.startsWith('https://file.fishpi.cn')){ - ele.src = ele.src + '?imageView2/1/w/150/h/150/interlace/0/q/90' + ele.src = ele.src + '?imageView2/0/w/150/h/150/interlace/0/q/90' //} }) return dom.innerHTML; diff --git a/src/main/resources/js/channel.min.js b/src/main/resources/js/channel.min.js index 354db29f..42898feb 100644 --- a/src/main/resources/js/channel.min.js +++ b/src/main/resources/js/channel.min.js @@ -1 +1 @@ -var ArticleChannel={ws:void 0,init:function(e){ArticleChannel.ws=new WebSocket(e),ArticleChannel.ws.onopen=function(){console.log("Connected to article channel websocket.")},ArticleChannel.ws.onmessage=function(e){var n=JSON.parse(e.data);if(Label.articleOId===n.articleId)switch(n.type){case"comment":var t,a=parseInt($(".comments-header .article-cmt-cnt").text())+1;$(".comments-header .article-cmt-cnt").text(a+" "+Label.cmtLabel),0===$("#comments .list > ul > li").length&&($(".comment-header > .fn-none").show(),$(".comments-header > .fn-none").show(),$("#articleCommentsPanel").parent().show()),0===Label.userCommentViewMode?$("#comments > .list > ul").append(n.cmtTpl):$("#comments > .list > ul").prepend(n.cmtTpl),$("#"+n.commentId+" .cmt-via").text("via "+Util.getDeviceByUa(n.commentUA)),Label.currentUserName===n.commentAuthorName&&Comment._bgFade($("#"+n.commentId)),""!==n.commentOriginalCommentId&&(1===(t=(a=$("#"+n.commentOriginalCommentId)).find(".comment-action > .ft-fade > .fn-pointer")).length?(t.html(" "+(parseInt($.trim(t.text()))+1)+" "+Label.replyLabel+' '),"icon-chevron-up"===t.find("svg").attr("class")&&(t.find("svg").removeClass("icon-chevron-up").addClass("icon-chevron-down").find("use").attr("xlink:href","#chevron-down"),t.click())):a.find(".comment-action > .ft-fade").prepend(' 1 "+Label.replyLabel+' ')),Util.parseHljs(),Util.parseMarkdown();break;case"articleHeat":var o=$("#heatBar"),s=$(".heat");"+"===n.operation?(o.append(''),setTimeout(function(){s.width($(".heat").width()+3),o.find(".point").remove()},2e3)):(s.width($(".heat").width()-3),o.append(''),setTimeout(function(){o.find(".point-remove").remove()},2e3));break;default:console.error("Wrong data [type="+n.type+"]")}},ArticleChannel.ws.onclose=function(){console.log("Disconnected to article channel websocket.")},ArticleChannel.ws.onerror=function(e){console.log(e)}}},ArticleListChannel={ws:void 0,init:function(e){ArticleListChannel.ws=new WebSocket(e),ArticleListChannel.ws.onopen=function(){console.log("Connected to article list channel websocket.")},ArticleListChannel.ws.onmessage=function(e){var a=JSON.parse(e.data);$(".article-list h2 > a[rel=bookmark]").each(function(){var e,n,t=$(this).data("id").toString();a.articleId===t&&(e=$(this).closest("li"),n=e.find(".heat"),"+"===a.operation?(e.append(''),setTimeout(function(){n.width(n.width()+3),e.find(".point").remove()},2e3)):(n.width(n.width()-3),e.append(''),setTimeout(function(){e.find(".point-remove").remove()},2e3)))})},ArticleListChannel.ws.onclose=function(){console.log("Disconnected to article list channel websocket.")},ArticleListChannel.ws.onerror=function(e){console.log("ERROR",e)}}},IdleTalkChannel={ws:void 0,init:function(e){IdleTalkChannel.ws=new WebSocket(e),IdleTalkChannel.ws.onopen=function(){console.log("Connected to idle talk channel websocket.")},IdleTalkChannel.ws.onmessage=function(e){var n=JSON.parse(e.data),t=n.command;switch(n.youAre){case"sender":var a='
  • \n
    \n
    \n
    \n

    \n 发送给「'+t.toUserName+'」的私信\n \n

    \n \n '+timeTrans(parseFloat(n.mapId))+" · 主题:"+t.theme+"\n \n
    \n
    \n
  • ";$("#sent").prepend(a),void 0!==$("#sent").find(".nope")[0]&&$("#sent").find(".nope")[0].remove();break;case"receiver":a='
  • \n
    \n
    \n
    \n

    \n 来自「'+t.fromUserName+'」的私信\n \n

    \n \n '+timeTrans(parseFloat(n.mapId))+" · 主题:"+t.theme+"\n \n
    \n
    \n
  • ";$("#received").prepend(a),void 0!==$("#received").find(".nope")[0]&&$("#received").find(".nope")[0].remove();break;case"destroyIdleChatMessage":$("#"+t).remove(),void 0===$("#received").find("li")[0]&&void 0===$("#received").find(".nope")[0]&&$("#received").append('
    没有收到任何来信
    '),void 0===$("#sent").find("li")[0]&&void 0===$("#sent").find(".nope")[0]&&$("#sent").append('
    没有未读的发信
    ')}},IdleTalkChannel.ws.onclose=function(){console.log("Disconnected to idle talk channel websocket."),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)},IdleTalkChannel.ws.onerror=function(e){console.log("ERROR",e),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)}}};function timeTrans(e){return(e=new Date(e)).getFullYear()+"年"+((e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1)+"月")+((e.getDate()<10?"0"+e.getDate():e.getDate())+"日 ")+((e.getHours()<10?"0"+e.getHours():e.getHours())+":")+((e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes())+":")+(e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds())}var ChatRoomChannel={ws:void 0,init:function(e){ChatRoomChannel.ws=new WebSocket(e),ChatRoomChannel.ws.onopen=function(){console.log("Connected to chatroom channel websocket.")},ChatRoomChannel.ws.onmessage=function(e){var o=JSON.parse(e.data);switch(o.type){case"barrager":var s=o.barragerContent,r=o.barragerColor,l=o.userName,i=o.userAvatarURL,c=o.userNickname;let e="";i={img:i,info:e=""!=c&&null!=c?c+": "+s:l+": "+s,href:Label.servePath+"/member/"+l,close:!1,speed:Math.round(10*Math.random()+10),color:r};$("body").barrager(i);break;case"discussChanged":c=o.whoChanged,s=o.newDiscuss,l="";$("#chats").prepend(l),$(".newDiscussNotice").slideDown(500),$("#discuss-title").text(s);break;case"redPacketStatus":var r=o.whoGive,i=o.whoGot,c=o.got,l=o.count,s=o.oId,d=o.dice;let n;if(null==d)n=''+i+' 抢到了 '+r+'红包";else{let e;switch(d.bet){case"big":e="大";break;case"small":e="小";break;case"leopard":e="豹子"}var m=d.chips;n=''+i+''+r+'盘口 下注"+m+"积分买"+e}c===l?($("#chatroom"+o.oId).find(".hongbao__item").css("opacity",".36"),$("#chatroom"+s).find(".hongbao__item").hasClass("opened")||$("#chatroom"+s).find(".hongbao__item").addClass("opened"),$("#chatroom"+o.oId+" .hongbao__item").removeAttr("onclick").attr("onclick","ChatRoom.unpackRedPacket("+s+");"),$("#chatroom"+o.oId).find(".redPacketDesc").html("已经被抢光啦"),n+=null==d?",红包已被领完 ("+c+"/"+l+")":",已封盘 ("+c+"/"+l+")"):n+=" ("+c+"/"+l+")";i="";$("#chats").prepend(i),$(".redPacketNotice").slideDown(500);break;case"online":for(var h in $("#discuss-title").text(o.discussing),$("#onlineCnt").text(o.onlineChatCnt),$("#indexOnlineChatCnt").text(o.onlineChatCnt),Label.onlineAvatarData="",o.users){h=o.users[h];Label.onlineAvatarData+='\n\n'}Util.listenUserCard();break;case"revoke":$("#chatroom"+o.oId).remove(),$("#chatindex"+o.oId).remove();break;case"refresh":ChatRoom.flashScreen();break;case"customMessage":r="";$("#chats").prepend(r),$(".customNotice").slideDown(500);break;case"refreshBarrager":$("#barragerCost").text(o.cost),$("#barragerUnit").text(o.unit);break;case"msg":0===$("#chatRoomIndex").length&&$("#chatroom"+o.oId).length<=0&&(ChatRoom.renderMsg(o),ChatRoom.resetMoreBtnListen()),0!==$("#chatRoomIndex").has("#emptyChatRoom").length&&$("#emptyChatRoom").remove();let t=o.userNickname;m=o.userName;t=void 0!==t&&""!==t?t+" ( "+m+" )":m;let a=o.content;-1!==a.indexOf('"msgType":"redPacket"')&&(a="[收到红包,请在完整版聊天室查看]"),$("#chatRoomIndex").prepend('
  • \n \n
    \n
    \n
    \n \n
    \n '+ChatRoomChannel.filterContent(a)+"\n
    \n
    \n
  • "),11===$("#chatRoomIndex li.fn-flex").length&&$("#chatRoomIndex li.fn-flex:last").fadeOut(199,function(){$("#chatRoomIndex li.fn-flex:last").remove()}),$("#chatRoomIndex li:first").slideDown(200),Util.listenUserCard(),"object"==typeof ChatRoom&&ChatRoom.imageViewer()}},ChatRoomChannel.ws.onclose=function(){console.log("Disconnected to chat room channel websocket."),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)},ChatRoomChannel.ws.onerror=function(e){console.log("ERROR",e),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)}},filterContent:function(e){console.log(e);var n=document.createElement("div");return n.innerHTML=e,n.querySelectorAll("img").forEach(e=>{e.src=e.src+"?imageView2/1/w/150/h/150/interlace/0/q/90"}),n.innerHTML}},GobangChannel={ws:void 0,init:function(e){GobangChannel.ws=new WebSocket(e),GobangChannel.ws.onopen=function(){console.log("Connected to gobang channel websocket."),setInterval(function(){GobangChannel.ws.send("zephyr test")},55e3)},GobangChannel.ws.onmessage=function(e){switch(JSON.parse(e.data).type){case"gobangPlayer":console.log("data.type:>gobangPlayer");break;case"msg":console.log("data.type:>msg")}},GobangChannel.ws.onclose=function(){console.log("Disconnected to gobang channel websocket."),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)},GobangChannel.ws.onerror=function(e){console.log("ERROR",e),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)}}}; \ No newline at end of file +var ArticleChannel={ws:void 0,init:function(e){ArticleChannel.ws=new WebSocket(e),ArticleChannel.ws.onopen=function(){console.log("Connected to article channel websocket.")},ArticleChannel.ws.onmessage=function(e){var n=JSON.parse(e.data);if(Label.articleOId===n.articleId)switch(n.type){case"comment":var t,a=parseInt($(".comments-header .article-cmt-cnt").text())+1;$(".comments-header .article-cmt-cnt").text(a+" "+Label.cmtLabel),0===$("#comments .list > ul > li").length&&($(".comment-header > .fn-none").show(),$(".comments-header > .fn-none").show(),$("#articleCommentsPanel").parent().show()),0===Label.userCommentViewMode?$("#comments > .list > ul").append(n.cmtTpl):$("#comments > .list > ul").prepend(n.cmtTpl),$("#"+n.commentId+" .cmt-via").text("via "+Util.getDeviceByUa(n.commentUA)),Label.currentUserName===n.commentAuthorName&&Comment._bgFade($("#"+n.commentId)),""!==n.commentOriginalCommentId&&(1===(t=(a=$("#"+n.commentOriginalCommentId)).find(".comment-action > .ft-fade > .fn-pointer")).length?(t.html(" "+(parseInt($.trim(t.text()))+1)+" "+Label.replyLabel+' '),"icon-chevron-up"===t.find("svg").attr("class")&&(t.find("svg").removeClass("icon-chevron-up").addClass("icon-chevron-down").find("use").attr("xlink:href","#chevron-down"),t.click())):a.find(".comment-action > .ft-fade").prepend(' 1 "+Label.replyLabel+' ')),Util.parseHljs(),Util.parseMarkdown();break;case"articleHeat":var o=$("#heatBar"),s=$(".heat");"+"===n.operation?(o.append(''),setTimeout(function(){s.width($(".heat").width()+3),o.find(".point").remove()},2e3)):(s.width($(".heat").width()-3),o.append(''),setTimeout(function(){o.find(".point-remove").remove()},2e3));break;default:console.error("Wrong data [type="+n.type+"]")}},ArticleChannel.ws.onclose=function(){console.log("Disconnected to article channel websocket.")},ArticleChannel.ws.onerror=function(e){console.log(e)}}},ArticleListChannel={ws:void 0,init:function(e){ArticleListChannel.ws=new WebSocket(e),ArticleListChannel.ws.onopen=function(){console.log("Connected to article list channel websocket.")},ArticleListChannel.ws.onmessage=function(e){var a=JSON.parse(e.data);$(".article-list h2 > a[rel=bookmark]").each(function(){var e,n,t=$(this).data("id").toString();a.articleId===t&&(e=$(this).closest("li"),n=e.find(".heat"),"+"===a.operation?(e.append(''),setTimeout(function(){n.width(n.width()+3),e.find(".point").remove()},2e3)):(n.width(n.width()-3),e.append(''),setTimeout(function(){e.find(".point-remove").remove()},2e3)))})},ArticleListChannel.ws.onclose=function(){console.log("Disconnected to article list channel websocket.")},ArticleListChannel.ws.onerror=function(e){console.log("ERROR",e)}}},IdleTalkChannel={ws:void 0,init:function(e){IdleTalkChannel.ws=new WebSocket(e),IdleTalkChannel.ws.onopen=function(){console.log("Connected to idle talk channel websocket.")},IdleTalkChannel.ws.onmessage=function(e){var n=JSON.parse(e.data),t=n.command;switch(n.youAre){case"sender":var a='
  • \n
    \n
    \n
    \n

    \n 发送给「'+t.toUserName+'」的私信\n \n

    \n \n '+timeTrans(parseFloat(n.mapId))+" · 主题:"+t.theme+"\n \n
    \n
    \n
  • ";$("#sent").prepend(a),void 0!==$("#sent").find(".nope")[0]&&$("#sent").find(".nope")[0].remove();break;case"receiver":a='
  • \n
    \n
    \n
    \n

    \n 来自「'+t.fromUserName+'」的私信\n \n

    \n \n '+timeTrans(parseFloat(n.mapId))+" · 主题:"+t.theme+"\n \n
    \n
    \n
  • ";$("#received").prepend(a),void 0!==$("#received").find(".nope")[0]&&$("#received").find(".nope")[0].remove();break;case"destroyIdleChatMessage":$("#"+t).remove(),void 0===$("#received").find("li")[0]&&void 0===$("#received").find(".nope")[0]&&$("#received").append('
    没有收到任何来信
    '),void 0===$("#sent").find("li")[0]&&void 0===$("#sent").find(".nope")[0]&&$("#sent").append('
    没有未读的发信
    ')}},IdleTalkChannel.ws.onclose=function(){console.log("Disconnected to idle talk channel websocket."),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)},IdleTalkChannel.ws.onerror=function(e){console.log("ERROR",e),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)}}};function timeTrans(e){return(e=new Date(e)).getFullYear()+"年"+((e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1)+"月")+((e.getDate()<10?"0"+e.getDate():e.getDate())+"日 ")+((e.getHours()<10?"0"+e.getHours():e.getHours())+":")+((e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes())+":")+(e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds())}var ChatRoomChannel={ws:void 0,init:function(e){ChatRoomChannel.ws=new WebSocket(e),ChatRoomChannel.ws.onopen=function(){console.log("Connected to chatroom channel websocket.")},ChatRoomChannel.ws.onmessage=function(e){var o=JSON.parse(e.data);switch(o.type){case"barrager":var s=o.barragerContent,r=o.barragerColor,l=o.userName,i=o.userAvatarURL,c=o.userNickname;let e="";i={img:i,info:e=""!=c&&null!=c?c+": "+s:l+": "+s,href:Label.servePath+"/member/"+l,close:!1,speed:Math.round(10*Math.random()+10),color:r};$("body").barrager(i);break;case"discussChanged":c=o.whoChanged,s=o.newDiscuss,l="";$("#chats").prepend(l),$(".newDiscussNotice").slideDown(500),$("#discuss-title").text(s);break;case"redPacketStatus":var r=o.whoGive,i=o.whoGot,c=o.got,l=o.count,s=o.oId,d=o.dice;let n;if(null==d)n=''+i+' 抢到了 '+r+'红包";else{let e;switch(d.bet){case"big":e="大";break;case"small":e="小";break;case"leopard":e="豹子"}var m=d.chips;n=''+i+''+r+'盘口 下注"+m+"积分买"+e}c===l?($("#chatroom"+o.oId).find(".hongbao__item").css("opacity",".36"),$("#chatroom"+s).find(".hongbao__item").hasClass("opened")||$("#chatroom"+s).find(".hongbao__item").addClass("opened"),$("#chatroom"+o.oId+" .hongbao__item").removeAttr("onclick").attr("onclick","ChatRoom.unpackRedPacket("+s+");"),$("#chatroom"+o.oId).find(".redPacketDesc").html("已经被抢光啦"),n+=null==d?",红包已被领完 ("+c+"/"+l+")":",已封盘 ("+c+"/"+l+")"):n+=" ("+c+"/"+l+")";i="";$("#chats").prepend(i),$(".redPacketNotice").slideDown(500);break;case"online":for(var h in $("#discuss-title").text(o.discussing),$("#onlineCnt").text(o.onlineChatCnt),$("#indexOnlineChatCnt").text(o.onlineChatCnt),Label.onlineAvatarData="",o.users){h=o.users[h];Label.onlineAvatarData+='\n\n'}Util.listenUserCard();break;case"revoke":$("#chatroom"+o.oId).remove(),$("#chatindex"+o.oId).remove();break;case"refresh":ChatRoom.flashScreen();break;case"customMessage":r="";$("#chats").prepend(r),$(".customNotice").slideDown(500);break;case"refreshBarrager":$("#barragerCost").text(o.cost),$("#barragerUnit").text(o.unit);break;case"msg":0===$("#chatRoomIndex").length&&$("#chatroom"+o.oId).length<=0&&(ChatRoom.renderMsg(o),ChatRoom.resetMoreBtnListen()),0!==$("#chatRoomIndex").has("#emptyChatRoom").length&&$("#emptyChatRoom").remove();let t=o.userNickname;m=o.userName;t=void 0!==t&&""!==t?t+" ( "+m+" )":m;let a=o.content;-1!==a.indexOf('"msgType":"redPacket"')&&(a="[收到红包,请在完整版聊天室查看]"),$("#chatRoomIndex").prepend('
  • \n \n
    \n
    \n
    \n \n
    \n '+ChatRoomChannel.filterContent(a)+"\n
    \n
    \n
  • "),11===$("#chatRoomIndex li.fn-flex").length&&$("#chatRoomIndex li.fn-flex:last").fadeOut(199,function(){$("#chatRoomIndex li.fn-flex:last").remove()}),$("#chatRoomIndex li:first").slideDown(200),Util.listenUserCard(),"object"==typeof ChatRoom&&ChatRoom.imageViewer()}},ChatRoomChannel.ws.onclose=function(){console.log("Disconnected to chat room channel websocket."),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)},ChatRoomChannel.ws.onerror=function(e){console.log("ERROR",e),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)}},filterContent:function(e){console.log(e);var n=document.createElement("div");return n.innerHTML=e,n.querySelectorAll("img").forEach(e=>{e.src=e.src+"?imageView2/0/w/150/h/150/interlace/0/q/90"}),n.innerHTML}},GobangChannel={ws:void 0,init:function(e){GobangChannel.ws=new WebSocket(e),GobangChannel.ws.onopen=function(){console.log("Connected to gobang channel websocket."),setInterval(function(){GobangChannel.ws.send("zephyr test")},55e3)},GobangChannel.ws.onmessage=function(e){switch(JSON.parse(e.data).type){case"gobangPlayer":console.log("data.type:>gobangPlayer");break;case"msg":console.log("data.type:>msg")}},GobangChannel.ws.onclose=function(){console.log("Disconnected to gobang channel websocket."),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)},GobangChannel.ws.onerror=function(e){console.log("ERROR",e),setInterval(function(){$.ajax({url:Label.servePath+"/shop",method:"get",success:function(){location.reload()}})},1e4)}}}; \ No newline at end of file diff --git a/src/main/resources/js/chat-room.js b/src/main/resources/js/chat-room.js index 0b2a743f..a8384026 100644 --- a/src/main/resources/js/chat-room.js +++ b/src/main/resources/js/chat-room.js @@ -1436,7 +1436,7 @@ border-bottom: none; imgList.forEach(ele=>{ ele.setAttribute('originalsrc', ele.src); //if(ele.src.startsWith('https://file.fishpi.cn')){ - ele.src = ele.src + '?imageView2/1/w/150/h/150/interlace/0/q/90' + ele.src = ele.src + '?imageView2/0/w/150/h/150/interlace/0/q/90' //} }) return dom.innerHTML; diff --git a/src/main/resources/js/chat-room.min.js b/src/main/resources/js/chat-room.min.js index 995a4db8..c7fd2420 100644 --- a/src/main/resources/js/chat-room.min.js +++ b/src/main/resources/js/chat-room.min.js @@ -57,7 +57,7 @@ border-bottom: none; `;$("#emojis").html(a)},listenUploadEmojis:function(){$("#uploadEmoji").fileupload({acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i,maxFileSize:5242880,multipart:!0,pasteZone:null,dropZone:null,url:Label.servePath+"/upload",paramName:"file[]",add:function(e,a){var t;ext=a.files[0].type.split("/")[1],window.File&&window.FileReader&&window.FileList&&window.Blob?((t=new FileReader).readAsArrayBuffer(a.files[0]),t.onload=function(e){var t=new Uint8Array(e.target.result.slice(0,11));isImage(t)?5242880\n\n
    \n
    \n \n
    \n',"从URL导入表情包"),$("#fromURL").focus(),$("#fromURL").unbind(),$("#fromURL").bind("keypress",function(e){"13"==e.keyCode&&(ChatRoom.addEmoji($("#fromURL").val()),Util.closeAlert())})},addEmoji:function(){for(let e=0;e
  • "+e.msg+"
  • "),ChatRoom.editor.setValue(t))},error:function(e){$("#chatContentTip").addClass("error").html("
    • "+e.statusText+"
    "),ChatRoom.editor.setValue(t)},complete:function(e,t){ChatRoom.isSend=!1,$(".form button.red").removeAttr("disabled").css("opacity","1")}}))},more:function(){NProgress.start(),setTimeout(function(){let e;var t;1!==++page&&(t=(t=$(".chats__item"))[t.length-1],e=$(t).attr("id").replace("chatroom","")),Label.hasMore&&(1===page?$.ajax({url:Label.servePath+"/chat-room/more?page="+page,type:"GET",cache:!1,async:!1,success:function(e){if(0!==e.data.length){for(var t in e.data){t=e.data[t];0===$("#chatroom"+t.oId).length&&ChatRoom.renderMsg(t,"more"),ChatRoom.resetMoreBtnListen()}Util.listenUserCard(),ChatRoom.imageViewer()}else alert("没有更多聊天消息了!"),Label.hasMore=!1}}):$.ajax({url:Label.servePath+"/chat-room/getMessage?size=25&mode=1&oId="+e,type:"GET",cache:!1,async:!1,success:function(e){if(0!==e.data.length){for(var t in e.data){t=e.data[t];0===$("#chatroom"+t.oId).length&&ChatRoom.renderMsg(t,"more"),ChatRoom.resetMoreBtnListen()}Util.listenUserCard(),ChatRoom.imageViewer()}else alert("没有更多聊天消息了!"),Label.hasMore=!1}})),NProgress.done()},0)},resetMoreBtnListen:function(){$("body").unbind(),$("body").click(function(e){"aPersonListPanel"!==$(e.target).closest("a").attr("id")&&"personListPanel"!==$(e.target).closest(".module").attr("id")&&$("#personListPanel").hide()}),$("body").click(function(){$("details[open]").removeAttr("open")})},groupRevokeProcess:!1,startGroupRevoke:function(){$("#groupRevoke").attr("onclick","ChatRoom.stopGroupRevoke()"),$("#groupRevoke").html("关闭批量撤回"),Util.notice("warning",6e3,"批量撤回已启动,已在消息中添加便捷撤回按钮。
    使用完成后请记得关闭此功能。"),ChatRoom.groupRevokeProcess=!0;let e=setInterval(function(){ChatRoom.groupRevokeProcess||($("#chats").empty(),page=0,ChatRoom.more(),clearInterval(e)),$(".chats__item").each(function(){0===$(this).find(".button").length&&($(this).find(".date-bar").css("float","left"),$(this).find(".date-bar").html(""))})},500)},stopGroupRevoke:function(){$("#groupRevoke").attr("onclick","ChatRoom.startGroupRevoke()"),$("#groupRevoke").html("批量撤回"),Util.notice("success",1500,"批量撤回已关闭。"),ChatRoom.groupRevokeProcess=!1},adminRevoke:function(e){$.ajax({url:Label.servePath+"/chat-room/revoke/"+e,type:"DELETE",cache:!1,success:function(e){0!==e.code&&Util.notice("danger",1500,e.msg)}})},shileds:",",shiled:function(e){confirm("友好的交流是沟通的基础, 确定要屏蔽 Ta 吗?\n本次屏蔽仅针对当前页面有效, 刷新后需重新屏蔽!")&&(ChatRoom.shileds+=e+",")},revoke:function(e){confirm("确定要撤回吗?")&&$.ajax({url:Label.servePath+"/chat-room/revoke/"+e,type:"DELETE",cache:!1,success:function(e){0===e.code?Util.notice("success",1500,e.msg):Util.notice("danger",1500,e.msg)}})},repeat:function(e){let t="";$.ajax({url:Label.servePath+"/cr/raw/"+e,method:"get",async:!1,success:function(e){t=e.replace(/(