-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathlitewebchatinput.min.js
2 lines (2 loc) · 2.43 KB
/
litewebchatinput.min.js
1
2
/*! LiteWebChat_Frame v2.1.0 | MorFans Lab(c) 2017, BY:SuperPaxxs,Haswikr,YubaC | https://lab.morfans.cn / Released under the LGPL License */
var upperChild=document.querySelector(".lite-chatbox"),oLine=document.querySelector(".lite-chatinput hr"),downChild=document.querySelector(".lite-chatinput"),emojiBtn=document.getElementById("emojiBtn"),editFullScreen=document.getElementById("editFullScreen"),exitFullScreen=document.getElementById("exitFullScreen"),emojiMart=document.getElementById("emojiMart"),toolMusk=document.getElementById("toolMusk"),pickerOptions={locale:"zh",onEmojiSelect:function(e){emojiMart.style.display="none",toolMusk.style.display="none",insertAtCursor(document.querySelector(".lite-chatinput textarea"),e.native)}},picker=new EmojiMart.Picker(pickerOptions);function insertAtCursor(e,t){if(document.selection)e.focus(),(sel=document.selection.createRange()).text=t;else if(e.selectionStart||"0"==e.selectionStart){var l=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,l)+t+e.value.substring(i,e.value.length),e.selectionStart=l+t.length,e.selectionEnd=l+t.length}else e.value+=t}emojiMart.appendChild(picker),oLine.onmousedown=function(e){var t=(e||event).clientY,l=upperChild.offsetHeight,i=downChild.offsetHeight;return document.onmousemove=function(e){var n=(e||event).clientY-t;100<l+n&&100<i-n&&(upperChild.style.height=`calc(100% - ${i-n}px)`,downChild.style.height=i-n+"px")},document.onmouseup=function(){document.onmousedown=null,document.onmousemove=null},!1},emojiBtn.onclick=function(){emojiMart.style.display="block",toolMusk.style.display="block";let e=emojiMart.offsetHeight;var t=downChild.clientHeight;e<upperChild.clientHeight?(emojiMart.style.bottom=`${t+3}px`,emojiMart.style.top=""):(emojiMart.style.bottom="",emojiMart.style.top="10px")},editFullScreen.onclick=function(){downHeight=downChild.clientHeight,upperHeight=upperChild.clientHeight,downChild.style.height="100%",upperChild.style.height="0px",editFullScreen.style.display="none",exitFullScreen.style.display="block",oLine.style.display="none"},exitFullScreen.onclick=function(){0!=upperHeight?(downChild.style.height=`${downHeight}px`,upperChild.style.height=`calc(100% - ${downHeight}px)`):(upperChild.style.height="calc(100% - 150px)",downChild.style.height="150px"),exitFullScreen.style.display="none",editFullScreen.style.display="block",oLine.style.display="block"},toolMusk.onclick=function(){emojiMart.style.display="none",toolMusk.style.display="none"};