-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTDXGimmeButton.user.js
54 lines (45 loc) · 2.71 KB
/
TDXGimmeButton.user.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// ==UserScript==
// @name TDX GimmeButton
// @description Adds a button to the TDX Ticket detail page to grab ticket. It literally only saves one click. I dunno why I made this, but I did and I use it. Shut up.
// @version 2.0
// @updateURL https://github.com/ccgthree/tamper-monkey-stuff/raw/main/TDXGimmeButton.user.js
// @downloadURL https://github.com/ccgthree/tamper-monkey-stuff/raw/main/TDXGimmeButton.user.js
// @author Coe Gwathney - https://github.com/ccgthree
// @match https://uah.teamdynamix.com/TDNext/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=teamdynamix.com
// @grant none
// ==/UserScript==
if ( document.location.href.includes("TicketDet") ) {
var nameString = "Gwathney";
var responsible = document.getElementById("upResponsibility").innerText;
let newNav = document.createElement("li");
newNav.id = "takeTicket";
newNav.class = "btn-group";
let buttonContent;
let gimmeButton = document.createElement("button");
gimmeButton.id = "btnTake";
gimmeButton.type = "button";
gimmeButton.className = "btn btn-danger btn-sm";
gimmeButton.onclick = "";
gimmeButton.style.setProperty('background-color','grey','important');
gimmeButton.title = "Take Ticket";
gimmeButton.innerHTML = '<span class="fa-solid fa-handshake fa-nopad" aria-hidden="true"></span><span class="padding-left-xs">Take Ticket</span>'
if ( !responsible.includes(nameString) ) {
gimmeButton.onclick = function() {
__doPostBack('btnTakeTicket','');
setTimeout(() => {
location.reload()
}, 1000);
}
gimmeButton.style.setProperty('background-color','#bf3935','important');
}
// if ( responsible.includes(nameString) ) {
// buttonContent = '<button id="btnTake" type="button" aria-label="Take" class="btn btn-danger btn-sm" aria-expanded="false" style="background-color:grey!important;" onclick="" title="Take Ticket"><span class="fa-solid fa-handshake fa-nopad" aria-hidden="true"></span><span class="padding-left-xs">Take Ticket</span></button>';
// } else {
// buttonContent = '<button id="btnTake" type="button" aria-label="Take" class="btn btn-danger btn-sm" aria-expanded="false" onclick="__doPostBack(\'btnTakeTicket\',\'\');" title="Take Ticket"><span class="fa-solid fa-handshake fa-nopad" aria-hidden="true"></span><span class="padding-left-xs">Take Ticket</span></button>';
// }
//newNav.innerHTML = buttonContent;
newNav.appendChild(gimmeButton);
document.getElementsByClassName("nav nav-pills pull-left padding-top-xs padding-left")[0].appendChild(newNav);
//document.getElementById("takeTicket").appendChild(newButtonInnards);
}