Greasy Fork 支持简体中文。

Production & Dev instance warning

Warns you if you are on the dev or prod instance of your web app (not on localhost)

  1. // ==UserScript==
  2. // @name Production & Dev instance warning
  3. // @namespace ahappyviking
  4. // @version 1.0.0
  5. // @description Warns you if you are on the dev or prod instance of your web app (not on localhost)
  6. // @match https://*.[APP NAME HERE].com/*
  7. // @icon https://i.kym-cdn.com/entries/icons/original/000/027/475/Screen_Shot_2018-10-25_at_11.02.15_AM.png
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. const main = () => {
  12. const elem = document.createElement('div')
  13. elem.style.position = "fixed"
  14. elem.style.left = 0
  15. elem.style.right = 0
  16. elem.style.top = 0
  17. elem.style.height = "14px"
  18. elem.style.fontSize = "10px"
  19. elem.style.cursor = "pointer"
  20. elem.style.zIndex = 99999
  21. elem.style.fontWeight = "bold"
  22. elem.style.textAlign = "center"
  23. elem.addEventListener("click", () => (elem.style.display = "none"))
  24. document.body.appendChild(elem)
  25. if (window.location.hostname.startsWith("dev")){
  26. elem.style.backgroundColor = "#04d9ff"
  27. elem.innerText = "NOT ON LOCALHOST - DEV"
  28. }else{
  29. elem.style.backgroundColor = "yellow"
  30. elem.innerText = "NOT ON LOCALHOST - PRODUCTION"
  31. }
  32. }
  33. main()