Chat Box Section

Creates a separated section for the chat box

目前為 2024-12-01 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Chat Box Section
// @namespace   Violentmonkey Scripts
// @match       https://web.simple-mmo.com/travel*
// @grant       none
// @license     GPL-v3
// @version     1.0.0
// @author      Freaky Fingers
// @description Creates a separated section for the chat box
// ==/UserScript==
let newHTML = document.createElement("section")
let smmoChat = document.querySelectorAll("[x-init]")[3]
let chatBox = document.getElementById("chatBox")
let chatButton = document.getElementById("show_hide_chat_btn")

newHTML.innerHTML = `
  <section id="chatSection"></section>
`;  //create new div

setTimeout(function() {
  let buttonAttrib = document.querySelectorAll("[x-show]")[1].getAttribute("style")
  if (buttonAttrib !== null) {
    chatButton.click();
  }
  chatButton.style.display = "none"
}, 1000);   //Automatically show the chat and then hide the show/hide chat button

newHTML.style = "background-color: #0000; height: 100vh; width: 20vw; float: right; position: sticky; z-index: 0"; //Style new div
document.getElementById("app").insertBefore(newHTML, document.getElementsByClassName("h-screen flex overflow-hidden bg-gray-100")[0]); //Insert new div into page at correct position

smmoChat.style = "position: fixed; height: 100vh; width: 20vw";
chatBox.style = "position: relative; height: 100%; width: 20vw; padding: 0rem";

newHTML.appendChild(smmoChat); //Add the chat to new div