fix: firefox fix bottom bar
This commit is contained in:
		
				
					committed by
					
						 gaelle morin
						gaelle morin
					
				
			
			
				
	
			
			
			
						parent
						
							5ec1bc5c13
						
					
				
				
					commit
					9b1acbbf7d
				
			| @ -1,23 +1,55 @@ | ||||
| document.addEventListener("DOMContentLoaded", () => { | ||||
|   window.scrollTo(0, 1); | ||||
|   let scrollTop = 1; | ||||
|   let fromTop = () => { | ||||
|     return window.pageYOffset || document.compatMode === "CSS1Compat" && document.documentElement.scrollTop || document.body.scrollTop || 0; | ||||
|   const resizeChat = () => { | ||||
|     let chatBox = Array.from(document.querySelectorAll("solid-xmpp-chat")) | ||||
|       .map((el) => el.shadowRoot ? el.shadowRoot.getElementById("conversejs") : false) | ||||
|       .filter((el) => el) | ||||
|       .pop(); | ||||
|     if (chatBox) { | ||||
|       let chatTextArea = chatBox.querySelector(".message-form-container"); | ||||
|       let ischatTextArea = setInterval(() => { | ||||
|         chatTextArea = chatBox.querySelector(".message-form-container"); | ||||
|         if (chatTextArea) { | ||||
|           clearInterval(ischatTextArea); | ||||
|           if ( | ||||
|             chatBox.getBoundingClientRect().height - | ||||
|             chatTextArea.getBoundingClientRect().height != | ||||
|             chatTextArea.offsetTop | ||||
|           ) { | ||||
|             let viewportChat = Array.from( | ||||
|               document.querySelectorAll("#viewport .chat-view") | ||||
|             ); | ||||
|             viewportChat.forEach( | ||||
|               (c) => (c.style.height = "calc(100vh - 106px - 57px - 4px)") | ||||
|             ); | ||||
|           } | ||||
|         } | ||||
|       }, 15); | ||||
|     } | ||||
|   }; | ||||
|   resizeChat(); | ||||
|  | ||||
|   let isbody = setInterval(() => { | ||||
|     if (document.body) { | ||||
|       clearInterval(isbody); | ||||
|       scrollTop = fromTop(); | ||||
|       window.scrollTo(0, scrollTop === 1 ? 0 : 1); | ||||
|       resizeChat(); | ||||
|     } | ||||
|   }, 15); | ||||
|  | ||||
|   window.addEventListener("load", () => { | ||||
|     setTimeout(() => { | ||||
|       if (fromTop() < 20) { | ||||
|         window.scrollTo(0, scrollTop === 1 ? 0 : 1); | ||||
|       } | ||||
|       resizeChat(); | ||||
|     }, 0); | ||||
|   }); | ||||
|  | ||||
|   window.addEventListener("resize", () => { | ||||
|     setTimeout(() => { | ||||
|       resizeChat(); | ||||
|     }, 0); | ||||
|   }); | ||||
|  | ||||
|   document.addEventListener("navigate", () => { | ||||
|     setTimeout(() => { | ||||
|       resizeChat(); | ||||
|     }, 0); | ||||
|   }); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user