Site Notice

hello, world

超星弹幕助手

From Project-EPB Commons
Revision as of 01:01, 22 February 2020 by 机智的小鱼君 (talk | contribs) ([InPageEdit] 没有编辑摘要)

<html> <script src="https://common.wjghj.cn/js/ChaoXingDanMuZhuShou"></script> 这是一个超星网课直播平台弹幕刷屏助手的演示页面,我在这简单做了一个类似于评论区的东西。 <pre id="msgArea" style="padding: 4px; height: 200px; overflow: auto; border: 1px solid #aaa;"><p class="comment">[<span style="color:#f48">管理员消息</span>]<b>老师:</b>同学们怎么想呢?</p></pre> <textarea id="RKLBChat_sendText"></textarea> <button id="RKLBChat_sendMsg" onclick="sendCommentByMe()">发送评论</button> <script> function sendComment(user, comment) {

 if (comment === '' || user === '') return;
 $('#msgArea').append('<p class="comment"><b>' + user + ':</b>' + comment + '<span style="color:#999">' + new Date().toTimeString() + '</span></p>');
 var msgArea = document.getElementById('msgArea');
 msgArea.scrollTop = msgArea.scrollHeight;

} function sendCommentByMe(){

 var toSent = $('#RKLBChat_sendText').val();
 $('#RKLBChat_sendText').val('');
 sendComment('您', toSent);

} setInterval(function(){

 var randomMsg = [
   '我认为老师说的对',
   '我认为还有另外一种解法……',
   '送出🚀x1000<br/>&nbsp;&nbsp;[<span style="color:red">该用户已被禁言</span>]',
 ],
 finalMsg = randomMsg[Math.floor(Math.random() * randomMsg.length)];
 sendComment('其他人',finalMsg);

},5000); </script> </html>