-2

Im trying to make a tampermonkey script with a html menu. Below is the current script, I tried just creating element but It doesnt show up. So I wrote the element and it removes everything else on the page.

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://mtsl.dk/csgo/
// @icon         https://www.google.com/s2/favicons?domain=freefrontend.com
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  var elem = document.createElement('div')
  elem.innerHTML = '<div id="menu"><style>div{background-color: #fec5bb; color: #3A7CA5; border: 0px solid red; border-radius: 5px; margin: 10px; padding: 5px;}</style> <div>Inventory Editor:<button>Edit Inventory</button></div><div>Autoclicker: <button>Auto Click</button></div></div>'
  document.write(elem.innerHTML)
})();
<!-- This is what elem.innerHTML looks like (see function above) -->

<!-- <div id="menu">
  <style>
    div {
      background-color: #fec5bb;
      color: #3A7CA5;
      border: 0px solid red;
      border-radius: 5px;
      margin: 10px;
      padding: 5px;
    }
  </style>
  <div>Inventory Editor:<button>Edit Inventory</button></div>
  <div>Autoclicker: <button>Auto Click</button></div>
</div> -->
genpfault
  • 51,148
  • 11
  • 85
  • 139
Thornily
  • 533
  • 3
  • 15
  • 1
    Does this answer your question? [Adding div element to body or document in JavaScript](https://stackoverflow.com/questions/15741006/adding-div-element-to-body-or-document-in-javascript) – T.Trassoudaine Sep 01 '21 at 18:26

1 Answers1

1

Try doing:

overlay html

for css stuff you can try doing this:

// @grant GM_addStyle

Then do

css

Sorry I had to put links I don't have enough reputation to put actual pictures.

LightLord
  • 61
  • 4