-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCollapserpent.js
35 lines (32 loc) · 1.08 KB
/
Collapserpent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ==UserScript==
=======
// @name Collapserpent
// @namespace https://duelingnexus.com/
// @version 1.0
// @description Toggle the navbar on and off with a button
// @author Yubelious!
// @grant none
// @include https://duelingnexus.com/*
// @updateURL https://raw.githubusercontent.com/Yubelious/future-slash/master/Collapserpent.js
// @downloadURL https://raw.githubusercontent.com/Yubelious/future-slash/master/Collapserpent.js
// ==/UserScript==
document.body.onload = addElement;
function addElement() {
var btn = document.createElement("BUTTON");
btn.outerHTML = "<button></button>";
btn.setAttribute("id", "togglenavbar");
btn.innerHTML = "Ξ";
btn.onclick = function() {togglenavbar()};
document.getElementById("app").appendChild(btn);
}
function togglenavbar() {
var x = document.getElementById("togglenavbar");
if (x.innerHTML === "◄") {
x.innerHTML = "►";
}
else if (x.innerHTML === "►") {
x.innerHTML = "◄";
}
var element = document.getElementById("app");
element.classList.toggle("app-navbar-hidden");
};