scratch block palate horizontal style

none

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         scratch block palate horizontal style
// @version      3
// @description  none
// @run-at       document-start
// @author       rssaromeo
// @license      GPLv3
// @tag          style
// @match        *://scratch.mit.edu/*
// @match        *://turbowarp.org/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAABetJREFUeJy1lv1TVGUUx7Hph8xfqmkmf+S/aNKwrExUfMEXVEQSxVVTRxlT0lHkBx0VrQkzTUPDcTIXUBTWBEaE8QVNECRDRF4UFRKSF2kX7n3uvfvtnOdh97Iusk6z3ZkzD9zdfc7nOed7znMiIl7hMfu7IsXdXyBqDsCod8Lq737rVX73nx+z9wHEnWPQKzOg39oPrXAOtNxPoOVMUKtrAYzOP/G/ONeupkE7NY7sg5Ht9OfhBbAGuiK1khUvd5j3KbSiRHI8afDdeIjaI+GD4Pz6T87OSr+EXrEd4nIqNGcU9LL1sAZ6oF/eOAgwDqIiPTwAVt+Ts9qFxWpj54fkZDNYB5buhrf/GfSG0/K0XsuAuL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FbL6l5oC4bgk4u7jmh13wvI+F3njuRKuI3GUoZ1vnzgaYmoLdX0DsG0LFo0eOQN6HSwHh/WVlaH4wG58jjGDtvzJc5xMaNdTKn8+YBDQ2qDFeuFPJdfLwnNIDsA5PszYu+UHl/mfPzC2G2XQuYA6SzuXOBu3dVJ+Q+oAD6QgP805atla17iUOqjjNTSHQEdGkNxIPiYQeQEQA8pIsxISGMp1UkqOVqFpSj90S6E+ZCtFeGnHgoBS4/QH29DcC64LSUlnrg8YSGsNx/pXOpCRKbqDsBs7txROckuFE4eNAlxcdVwGtjYyCAbw7Ytk1Ql9weEuJVH1RWjqLO5pEn9w0XDNDcrAC4MvgC8n3O65Yt4RvhqZHU+DePjVWTTkoK0NYGaBrw88/Arl3Ajh2qP/D3eBK6eXN0eAD46uVTJ1Pjun4daG/n+ldDyIsDyr59diQKC18LDwC3UwZYs0YJr6NDjVt8HVdVKajqauDKFWD1agXLHbOs7J3wADgcrX6Rce6X0GCSkKBmAk4Jj1y+1acRhyOMGigqGk3OtJATsc8Yrrz87eH2+he5vTXCXG+XXQAAAABJRU5ErkJggg==
// @grant        none
// @namespace https://greasyfork.org/users/1184528
// ==/UserScript==
// fix when entering editor call setup
;(async () => {
  var a = loadlib("newallfuncs")
  var lastob
  var isvisible = loadlib("isvisible")
  // var int
  // var last
  await a.waitforelem([
    ".blocklyToolboxDiv > div:nth-child(1)",
    ".blocklyToolboxDiv > div.scratchCategorySecondMenu.scratchCategoryMenu",
  ])
  await a.wait(1000)
  setup()
  ob()
  a.qs("head").appendChild(
    a.newelem("style", {
      innerHTML: `
  .blocklyToolboxDiv{
    width: 100% !important;
    }
    .scratchCategoryMenu{
      display: flex;
      flex-wrap: wrap;
      display:flex;
      justify-content:center;
      align-items:center;
      width:100%;
      }
      `,
    })
  )
  setInterval(test, 400)
  var visible = false
  function test() {
    var elem
    if (
      !(elem = document.querySelector(
        ".blocklyToolboxDiv > div.scratchCategorySecondMenu.scratchCategoryMenu"
      ))
    )
      return (visible = false)
    if (!visible && elem && isvisible(elem)) setup()
    visible = isvisible(elem)
  }
  function setup() {
    if (lastob) {
      lastob.disconnect()
      lastob = null
    }
    document.querySelector(
      ".blocklyToolboxDiv"
    ).style.backgroundColor = "#00000033"
    document.querySelector(
      ".blocklyToolboxDiv > div:nth-child(1)"
    ).style.backgroundColor = "#00000033"
    document.querySelector(
      ".blocklyToolboxDiv > div.scratchCategorySecondMenu.scratchCategoryMenu"
    ).style.backgroundColor = "#00000033"
    var oldParent = document.querySelector(
      ".blocklyToolboxDiv > div.scratchCategorySecondMenu.scratchCategoryMenu"
    )
    var newParent = document.querySelector(
      ".blocklyToolboxDiv > div:nth-child(1)"
    )
    newParent.appendChild(a.newelem("div", {
      backgroundColor: "transparent",
      minWidth: "100%",
      width: "100%",
    }))
    while (oldParent.childNodes.length > 0) {
      newParent.appendChild(oldParent.childNodes[0])
    }
    // if (int) {
    //   if (Date.now() - last < 1000) return
    //   clearInterval(int)
    //   int = null
    // }
    // Trigger a window resize event
    window.dispatchEvent(new Event("resize"))

    setTimeout(() => {
      ob()
    }, 1200)
  }

  function ob() {
    if (lastob) {
      lastob.disconnect()
      lastob = null
    }
    if (
      !document.querySelector(".blocklyToolboxDiv > div:nth-child(1)")
    )
      return
    lastob = new MutationObserver((e) => {
      // console.warn(123312, lastob)
      if (lastob) {
        lastob.disconnect()
        lastob = null
      }
      if (
        !document.querySelector(
          ".blocklyToolboxDiv > div.scratchCategorySecondMenu.scratchCategoryMenu"
        )?.childElementCount
      )
        return
      // console.warn("started")
      setup()
      var int = setInterval(setup, 0)
      setTimeout(() => clearInterval(int), 1000)
    }).observe(
      document.querySelector(".blocklyToolboxDiv > div:nth-child(1)"),
      {
        subtree: 1,
        childList: 1,
      }
    )
    // console.error(lastob)
  }
})()