Protox Block Tooltip+

Adds more details to the tooltip

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Protox Block Tooltip+
// @namespace    https://restrictedword.github.io/
// @version      1.0
// @description  Adds more details to the tooltip
// @author       Word
// @match        *://*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=protox.io
// @grant        none
// ==/UserScript==

(()=>{"use strict";const t="[ProtoxTooltip]",o="https://restrictedword.github.io/protox/data/block_info.json";let e=null,n=!1,r=null;function c(){return document.getElementById("global-tooltip")}function a(t,o){const e=document.createElement("div");e.dataset.extraProp="true",e.textContent=o,t.appendChild(e)}async function fetchJSON(){if(e)return e;try{const n=await fetch(o);e=await n.json()}catch(o){}return e}async function init(){await fetchJSON();const l=c();if(!l)return;new MutationObserver((()=>{const o=l.textContent.match(/id:\s*(\d+)/i);if(!o)return;const i=o[1];i!==r&&(r=i,async function(o){if(!o||!e||n)return;const r=c();if(!r)return;const l=e[String(o)];l&&(n=!0,function(t){t.querySelectorAll("[data-extra-prop]").forEach((t=>t.remove()))}(r),!0===l.transparent&&a(r,"transparent: true"),!0===l.penetrable&&a(r,"penetrable: true"),"number"==typeof l.impactResistance&&a(r,`impactResistance: ${l.impactResistance}`),!0===l.climbable&&a(r,"climbable: true"),requestAnimationFrame((()=>{n=!1})))})(i)})).observe(l,{childList:!0,subtree:!0,characterData:!0})}init()})()