So I got this code for a website using Tampermonkey, and I want it to open a window in the center of the screen after the button is pressed. How can I do that?
(function() {
'use strict';
//button
var button = document.createElement("button");
button.setAttribute("class", "mdl-button mdl-js-button geofs-f-standard-ui");
button.setAttribute("id", "Button-toggle");
button.setAttribute("style", "background:clear");
button.innerHTML = "test";
document.getElementsByClassName("geofs-ui-bottom")[0].appendChild(button);
var buttonToggle = document.getElementById("Button-toggle");
//Event Listener
buttonToggle.addEventListener("click", function() {
buttonToggle.setAttribute("style", "background:green");
console.log("Button Pressed");
});
})();