Greasy Fork is available in English.

Hide VScode Live Server

12/28/2021, 9:44:59 AM

// ==UserScript==
// @name        Hide VScode Live Server
// @namespace   Violentmonkey Scripts
// @match       http://127.0.0.1:5500/*
// @run-at      document-idle
// @grant       none
// @version     1.2
// @author      Mikhail 'UniBreakfast' Ninin
// @license     MIT 
// @description 12/28/2021, 9:44:59 AM
// ==/UserScript==

hideLiveServer()

function hideLiveServer() {
  const {body} = document
  const script = findScriptByText('LiveServer')
  const comment = findCommentByText('live-server')
  
  if (script) script.remove()
  if (comment) comment.remove()
  
  setTimeout(() => {
    body.classList.remove('vsc-initialized')
    if (!body.className) body.removeAttribute('class')
  }, 500)
}

function findCommentByText(text) {
  return Array.from(document.body.childNodes).find(node => node.textContent.includes('live-server'))
}

function findScriptByText(text) {
  return Array.from(document.scripts).find(script => script.textContent.includes(text))
}