Greasy Fork is available in English.
Quality of life improvements for Skribbl.io
当前为
// ==UserScript==
// @name Skribbl / Skribbl.io QOL
// @version 0.3
// @description Quality of life improvements for Skribbl.io
// @author 4TSOS
// @match http*://skribbl.io/*
// @run-at document-idle
// @icon https://www.google.com/s2/favicons?sz=64&domain=skribbl.io
// @namespace http://greasyfork.icu/users/784494
// ==/UserScript==
(function() {
'use strict';
qol_setup();
qol_info();
qol_buttons();
const inputChat = document.querySelector("#inputChat");
const inputName = document.querySelector("#inputName");
const header = document.querySelector("body > div.container-fluid > div.header");
const timer = document.querySelector("#timer");
const _currentWord = document.querySelector("#currentWord");
var currentWord = null;
function qol_setup() {
document.body.addEventListener('keydown', function() {
inputChat.focus();
inputName.focus();
});
};
function qol_info() {
setInterval(function() {
document.title = `(${timer.innerHTML}s) Skribbl.io`;
}, 500);
};
function qol_buttons() {
const qolButtonsList = document.createElement("div");
const qolWordToggle = document.createElement("button");
const qolClearChat = document.createElement("button");
qolButtonsList.id = "qol-buttons-list";
qolButtonsList.style.display = "flex";
qolButtonsList.style.justifyContent = "center";
qolButtonsList.style.flexDirection = "row";
qolWordToggle.id = "qol-word-toggle";
qolWordToggle.innerHTML = "Hide Word";
qolWordToggle.onclick = function() {
if (!document.querySelector("#currentWord").style.visibility) {
document.querySelector("#currentWord").style.visibility = "hidden";
document.querySelector("#qol-word-toggle").innerHTML = "Show Word";
return
};
if (document.querySelector("#currentWord").style.visibility) {
document.querySelector("#currentWord").removeAttribute("style");
document.querySelector("#qol-word-toggle").innerHTML = "Hide Word";
return
};
};
qolClearChat.id = "qol-clear-chat";
qolClearChat.innerHTML = "Clear Chat";
qolClearChat.onclick = function() {
var chatMessages = document.querySelectorAll("#boxMessages > *");
chatMessages.forEach(function(message) {
message.remove();
});
};
qolButtonsList.appendChild(qolWordToggle);
qolButtonsList.appendChild(qolClearChat);
document.querySelector("body > div.container-fluid > div.header").appendChild(qolButtonsList);
};
})();