Hide VScode Live Server

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

目前为 2022-01-07 提交的版本。查看 最新版本

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

hideLiveServer()

function hideLiveServer() {
  const {body} = document
  const script = body.lastElementChild
  const comment = script?.previousSibling?.previousSibling
  const line = ' Code injected by live-server '
  
  if (script.tagName != 'SCRIPT' || comment.textContent != line) return
  
  [comment.previousSibling, comment, comment.nextSibling, script]
    .forEach(node => node.remove())
  
  setTimeout(() => {
    body.classList.remove('vsc-initialized')
    if (!body.className) body.removeAttribute('class')
  }, 500)
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址