[MIRROR] tgui default background color port (#11210)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-07-20 06:33:22 -07:00
committed by GitHub
parent 66b765887f
commit e864bbefd8
5 changed files with 278 additions and 277 deletions

View File

@@ -37,7 +37,7 @@ SUBSYSTEM_DEF(tgui)
ntos_error = "<style type='text/css'>\n[ntos_error]\n</style>" ntos_error = "<style type='text/css'>\n[ntos_error]\n</style>"
basehtml = replacetextEx(basehtml, "<!-- tgui:ntos-error -->", ntos_error) basehtml = replacetextEx(basehtml, "<!-- tgui:ntos-error -->", ntos_error)
basehtml = replacetextEx(basehtml, "<!-- tgui:nt-copyright -->", "Nanotrasen (c) 2284-[CURRENT_STATION_YEAR]") basehtml = replacetextEx(basehtml, "<!-- tgui:nt-copyright -->", "Nanotrasen (c) 2284-[text2num(time2text(world.realtime,"YYYY")) + STATION_YEAR_OFFSET]")
/datum/controller/subsystem/tgui/Shutdown() /datum/controller/subsystem/tgui/Shutdown()
close_all_uis() close_all_uis()

View File

@@ -92,7 +92,7 @@
if (tgui_alert(usr, "Are you sure you want to empty that?", "Empty Bottle:", list("Yes", "No")) != "Yes") if (tgui_alert(usr, "Are you sure you want to empty that?", "Empty Bottle:", list("Yes", "No")) != "Yes")
return return
if(isturf(usr.loc)) if(isturf(usr.loc))
balloon_alert(usr, "empted \the [src] onto the floor.") balloon_alert(usr, "emptied \the [src] onto the floor.")
reagents.splash(usr.loc, reagents.total_volume) reagents.splash(usr.loc, reagents.total_volume)
//space cleaner //space cleaner

View File

@@ -1,240 +1,256 @@
.light:root {
--color-base: #ffffff;
--scrollbar-base: #f2f2f2;
--scrollbar-thumb: #a7a7a7;
}
html,
body { body {
font-family: Verdana, Geneva, Tahoma, sans-serif; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-base);
font-size: 12px; }
margin: 0 !important;
padding: 0 !important; body {
overflow: hidden; font-family: Verdana, Geneva, Tahoma, sans-serif;
font-size: 12px;
margin: 0 !important;
padding: 0 !important;
overflow: hidden;
} }
a { a {
color: #003399; color: #003399;
text-decoration: none; text-decoration: none;
} }
a:hover { a:hover {
color: #007fff; color: #007fff;
} }
h3 { h3 {
margin: 0 -0.5em 0.5em; margin: 0 -0.5em 0.5em;
padding: 1em 0.66em 0.5em; padding: 1em 0.66em 0.5em;
border-bottom: 0.1667em solid; border-bottom: 0.1667em solid;
} }
img { img {
image-rendering: pixelated; image-rendering: pixelated;
} }
.stat-container { .stat-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh; height: 100vh;
} }
#menu { #menu {
display: flex; display: flex;
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
padding: 0.25em 0.25em 0; padding: 0.25em 0.25em 0;
background-color: #ffffff; background-color: #ffffff;
} }
.menu-wrap { .menu-wrap {
flex-wrap: wrap-reverse; flex-wrap: wrap-reverse;
} }
#menu.tabs-classic { #menu.tabs-classic {
padding: 0.15em; padding: 0.15em;
} }
#menu.tabs-classic .button { #menu.tabs-classic .button {
min-width: 2em; min-width: 2em;
margin: 0.1em; margin: 0.1em;
padding: 0.25em 0.4em; padding: 0.25em 0.4em;
border: 0; border: 0;
border-radius: 0.25em; border-radius: 0.25em;
} }
#menu.tabs-classic .button.active { #menu.tabs-classic .button.active {
background-color: #0668b8; background-color: #0668b8;
color: white; color: white;
} }
.button { .button {
display: inline-table; display: inline-table;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
text-align: center; text-align: center;
font-size: 1em; font-size: 1em;
min-width: 2.9em; min-width: 2.9em;
padding: 0.5em 0.5em 0.4em; padding: 0.5em 0.5em 0.4em;
background-color: transparent; background-color: transparent;
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
border: 0; border: 0;
border-bottom: 0.1667em solid transparent; border-bottom: 0.1667em solid transparent;
border-radius: 0.25em 0.25em 0 0; border-radius: 0.25em 0.25em 0 0;
} }
.button:hover { .button:hover {
background-color: #ececec; background-color: #ececec;
} }
.button.active { .button.active {
cursor: default; cursor: default;
background-color: #dfdfdf; background-color: #dfdfdf;
color: black; color: black;
border-bottom-color: #000000; border-bottom-color: #000000;
} }
#under-menu { #under-menu {
height: 0.5em; height: 0.5em;
background-color: #eeeeee; background-color: #eeeeee;
}
#under-content {
height: calc(0.5em - 4px);
background-color: #eeeeee;
} }
#statcontent { #statcontent {
flex: 1; flex: 1;
padding: 0.75em 0.5em; padding: 0.75em 0.5em;
overflow-y: scroll; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
} }
.grid-container { .grid-container {
margin: -0.25em; margin: -0.25em;
} }
.grid-item { .grid-item {
display: inline-flex; display: inline-flex;
position: relative; position: relative;
user-select: none; user-select: none;
width: 100%; width: 100%;
max-height: 1.85em; max-height: 1.85em;
text-decoration: none; text-decoration: none;
background-color: transparent; background-color: transparent;
color: black; color: black;
} }
.grid-item:hover, .grid-item:hover,
.grid-item:active { .grid-item:active {
color: #003399; color: #003399;
z-index: 1; z-index: 1;
} }
.grid-item-text { .grid-item-text {
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
pointer-events: none; pointer-events: none;
width: 100%; width: 100%;
padding: 0.33em 0.5em; padding: 0.33em 0.5em;
border-radius: 0.25em; border-radius: 0.25em;
} }
.grid-item:hover .grid-item-text { .grid-item:hover .grid-item-text {
overflow: visible; height: 100%;
white-space: normal; overflow: visible;
background-color: #ececec; white-space: normal;
background-color: #ececec;
} }
.grid-item:active .grid-item-text { .grid-item:active .grid-item-text {
background-color: #dfdfdf; background-color: #dfdfdf;
} }
@media only screen and (min-width: 300px) { @media only screen and (min-width: 300px) {
.grid-item { .grid-item {
width: 50%; width: 50%;
} }
} }
@media only screen and (min-width: 430px) { @media only screen and (min-width: 430px) {
.grid-item { .grid-item {
width: 33%; width: 33%;
} }
} }
@media only screen and (min-width: 560px) { @media only screen and (min-width: 560px) {
.grid-item { .grid-item {
width: 25%; width: 25%;
} }
} }
@media only screen and (min-width: 770px) { @media only screen and (min-width: 770px) {
.grid-item { .grid-item {
width: 20%; width: 20%;
} }
} }
.status-info { .status-info {
margin: 0 0.33em 0.25em; margin: 0 0.33em 0.25em;
} }
.interview_panel_stats, .interview_panel_stats,
.interview_panel_controls { .interview_panel_controls {
margin-bottom: 1em; margin-bottom: 1em;
}
/**
* MARK: Dark theme colors
*/
.dark:root {
--color-base: #151515;
--scrollbar-base: #151515;
--scrollbar-thumb: #363636;
} }
/* Dark theme colors */
body.dark { body.dark {
background-color: #131313; background-color: #151515;
color: #b2c4dd; color: #b2c4dd;
scrollbar-base-color: #1c1c1c;
scrollbar-face-color: #3b3b3b;
scrollbar-3dlight-color: #252525;
scrollbar-highlight-color: #252525;
scrollbar-track-color: #1c1c1c;
scrollbar-arrow-color: #929292;
scrollbar-shadow-color: #3b3b3b;
/* Edge */
scrollbar-color: #3b3b3b #1c1c1c;
} }
.dark a { .dark a {
color: #6699ff; color: #6699ff;
} }
.dark a:hover, .dark a:hover,
.dark .grid-item:hover, .dark .grid-item:hover,
.dark .grid-item:active { .dark .grid-item:active {
color: #80bfff; color: #80bfff;
} }
.dark #menu { .dark #menu {
background-color: #131313; background-color: #151515;
} }
.dark #menu.tabs-classic .button.active { .dark #menu.tabs-classic .button.active {
background-color: #20b142; background-color: #20b142;
} }
.dark .button { .dark .button {
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
} }
.dark .button:hover { .dark .button:hover {
background-color: #252525; background-color: #252525;
} }
.dark .button.active { .dark .button.active {
background-color: #313131; background-color: #313131;
color: #d4dfec; color: #d4dfec;
border-bottom-color: #d4dfec; border-bottom-color: #d4dfec;
} }
.dark #under-menu { .dark #under-menu,
background-color: #202020; .dark #under-content {
background-color: #202020;
} }
.dark .grid-item{ .dark .grid-item {
color: #b2c4dd; color: #b2c4dd;
} }
.dark .grid-item:hover .grid-item-text { .dark .grid-item:hover .grid-item-text {
background-color: #252525; background-color: #252525;
} }
.dark .grid-item:active .grid-item-text { .dark .grid-item:active .grid-item-text {
background-color: #313131; background-color: #313131;
} }
/* required for alt click menu */ /* required for alt click menu */

View File

@@ -6,11 +6,11 @@ if (!Array.prototype.includes) {
if (this[i] == thing) return true; if (this[i] == thing) return true;
} }
return false; return false;
} };
} }
if (!String.prototype.trim) { if (!String.prototype.trim) {
String.prototype.trim = function () { String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
}; };
} }
@@ -32,8 +32,8 @@ var turfcontents = [];
var turfname = ""; var turfname = "";
var imageRetryDelay = 500; var imageRetryDelay = 500;
var imageRetryLimit = 50; var imageRetryLimit = 50;
var menu = document.getElementById('menu'); var menu = document.getElementById("menu");
var statcontentdiv = document.getElementById('statcontent'); var statcontentdiv = document.getElementById("statcontent");
var storedimages = []; var storedimages = [];
var split_admin_tabs = false; var split_admin_tabs = false;
@@ -47,10 +47,8 @@ function run_after_focus(callback) {
function createStatusTab(name) { function createStatusTab(name) {
if (name.indexOf(".") != -1) { if (name.indexOf(".") != -1) {
var splitName = name.split("."); var splitName = name.split(".");
if (split_admin_tabs && splitName[0] === "Admin") if (split_admin_tabs && splitName[0] === "Admin") name = splitName[1];
name = splitName[1]; else name = splitName[0];
else
name = splitName[0];
} }
if (document.getElementById(name) || name.trim() == "") { if (document.getElementById(name) || name.trim() == "") {
return; return;
@@ -89,7 +87,7 @@ function removeStatusTab(name) {
verb_tabs.splice(i, 1); verb_tabs.splice(i, 1);
} }
} }
if(current_tab == name) { if (current_tab == name) {
tab_change("Status"); tab_change("Status");
} }
menu.removeChild(document.getElementById(name)); menu.removeChild(document.getElementById(name));
@@ -101,12 +99,11 @@ function sortVerbs() {
var selector = a[0] == b[0] ? 1 : 0; var selector = a[0] == b[0] ? 1 : 0;
if (a[selector].toUpperCase() < b[selector].toUpperCase()) { if (a[selector].toUpperCase() < b[selector].toUpperCase()) {
return 1; return 1;
} } else if (a[selector].toUpperCase() > b[selector].toUpperCase()) {
else if (a[selector].toUpperCase() > b[selector].toUpperCase()) {
return -1; return -1;
} }
return 0; return 0;
}) });
} }
function addPermanentTab(name) { function addPermanentTab(name) {
@@ -127,7 +124,10 @@ function removePermanentTab(name) {
function checkStatusTab() { function checkStatusTab() {
for (var i = 0; i < menu.children.length; i++) { for (var i = 0; i < menu.children.length; i++) {
if (!verb_tabs.includes(menu.children[i].id) && !permanent_tabs.includes(menu.children[i].id)) { if (
!verb_tabs.includes(menu.children[i].id) &&
!permanent_tabs.includes(menu.children[i].id)
) {
menu.removeChild(menu.children[i]); menu.removeChild(menu.children[i]);
} }
} }
@@ -153,10 +153,8 @@ function verbs_cat_check(cat) {
var tabCat = cat; var tabCat = cat;
if (cat.indexOf(".") != -1) { if (cat.indexOf(".") != -1) {
var splitName = cat.split("."); var splitName = cat.split(".");
if (split_admin_tabs && splitName[0] === "Admin") if (split_admin_tabs && splitName[0] === "Admin") tabCat = splitName[1];
tabCat = splitName[1]; else tabCat = splitName[0];
else
tabCat = splitName[0];
} }
var verbs_in_cat = 0; var verbs_in_cat = 0;
var verbcat = ""; var verbcat = "";
@@ -169,31 +167,26 @@ function verbs_cat_check(cat) {
verbcat = part[0]; verbcat = part[0];
if (verbcat.indexOf(".") != -1) { if (verbcat.indexOf(".") != -1) {
var splitName = verbcat.split("."); var splitName = verbcat.split(".");
if (split_admin_tabs && splitName[0] === "Admin") if (split_admin_tabs && splitName[0] === "Admin") verbcat = splitName[1];
verbcat = splitName[1]; else verbcat = splitName[0];
else
verbcat = splitName[0];
} }
if (verbcat != tabCat || verbcat.trim() == "") { if (verbcat != tabCat || verbcat.trim() == "") {
continue; continue;
} } else {
else {
verbs_in_cat = 1; verbs_in_cat = 1;
break; // we only need one break; // we only need one
} }
} }
if (verbs_in_cat != 1) { if (verbs_in_cat != 1) {
removeStatusTab(tabCat); removeStatusTab(tabCat);
if (current_tab == tabCat) if (current_tab == tabCat) tab_change("Status");
tab_change("Status");
} }
} }
function findVerbindex(name, verblist) { function findVerbindex(name, verblist) {
for (var i = 0; i < verblist.length; i++) { for (var i = 0; i < verblist.length; i++) {
var part = verblist[i]; var part = verblist[i];
if (part[1] == name) if (part[1] == name) return i;
return i;
} }
} }
function wipe_verbs() { function wipe_verbs() {
@@ -216,12 +209,12 @@ function SendTabsToByond() {
} }
function SendTabToByond(tab) { function SendTabToByond(tab) {
Byond.sendMessage("Send-Tabs", {tab: tab}); Byond.sendMessage("Send-Tabs", { tab: tab });
} }
//Byond can't have this tab anymore since we're removing it //Byond can't have this tab anymore since we're removing it
function TakeTabFromByond(tab) { function TakeTabFromByond(tab) {
Byond.sendMessage("Remove-Tabs", {tab: tab}); Byond.sendMessage("Remove-Tabs", { tab: tab });
} }
function spell_cat_check(cat) { function spell_cat_check(cat) {
@@ -247,8 +240,8 @@ function tab_change(tab) {
set_byond_tab(tab); set_byond_tab(tab);
if (document.getElementById(tab)) if (document.getElementById(tab))
document.getElementById(tab).className = "button active"; // make current button active document.getElementById(tab).className = "button active"; // make current button active
var spell_tabs_thingy = (spell_tabs.includes(tab)); var spell_tabs_thingy = spell_tabs.includes(tab);
var verb_tabs_thingy = (verb_tabs.includes(tab)); var verb_tabs_thingy = verb_tabs.includes(tab);
if (tab == "Status") { if (tab == "Status") {
draw_status(); draw_status();
} else if (tab == "MC") { } else if (tab == "MC") {
@@ -273,24 +266,24 @@ function tab_change(tab) {
statcontentdiv.textContext = "Loading..."; statcontentdiv.textContext = "Loading...";
} }
Byond.winset(Byond.windowId, { Byond.winset(Byond.windowId, {
'is-visible': true, "is-visible": true,
}); });
} }
function set_byond_tab(tab) { function set_byond_tab(tab) {
Byond.sendMessage("Set-Tab", {tab: tab}); Byond.sendMessage("Set-Tab", { tab: tab });
} }
function draw_examine() { function draw_examine() {
statcontentdiv.textContent = ""; statcontentdiv.textContent = "";
var div_content = document.createElement("div"); var div_content = document.createElement("div");
for (var i = 0; i < examine.length; i++) { for (var i = 0; i < examine.length; i++) {
var parameter = document.createElement('p'); var parameter = document.createElement("p");
var textList = examine[i].split("||"); var textList = examine[i].split("||");
if(textList.length > 1) { if (textList.length > 1) {
for(var j = 0; j < textList.length; j++) { for (var j = 0; j < textList.length; j++) {
var spoilerText = document.createElement('span'); var spoilerText = document.createElement("span");
if(j % 2) { if (j % 2) {
spoilerText.className = "spoiler"; spoilerText.className = "spoiler";
} }
spoilerText.innerHTML = textList[j]; spoilerText.innerHTML = textList[j];
@@ -312,13 +305,17 @@ function draw_debug() {
statcontentdiv.textContent = ""; statcontentdiv.textContent = "";
var wipeverbstabs = document.createElement("div"); var wipeverbstabs = document.createElement("div");
var link = document.createElement("a"); var link = document.createElement("a");
link.onclick = function () { wipe_verbs() }; link.onclick = function () {
wipe_verbs();
};
link.textContent = "Wipe All Verbs"; link.textContent = "Wipe All Verbs";
wipeverbstabs.appendChild(link); wipeverbstabs.appendChild(link);
document.getElementById("statcontent").appendChild(wipeverbstabs); document.getElementById("statcontent").appendChild(wipeverbstabs);
var wipeUpdateVerbsTabs = document.createElement("div"); var wipeUpdateVerbsTabs = document.createElement("div");
var updateLink = document.createElement("a"); var updateLink = document.createElement("a");
updateLink.onclick = function () { update_verbs() }; updateLink.onclick = function () {
update_verbs();
};
updateLink.textContent = "Wipe and Update All Verbs"; updateLink.textContent = "Wipe and Update All Verbs";
wipeUpdateVerbsTabs.appendChild(updateLink); wipeUpdateVerbsTabs.appendChild(updateLink);
document.getElementById("statcontent").appendChild(wipeUpdateVerbsTabs); document.getElementById("statcontent").appendChild(wipeUpdateVerbsTabs);
@@ -331,18 +328,18 @@ function draw_debug() {
// Hide subgroups except admin subgroups if they are split // Hide subgroups except admin subgroups if they are split
if (verb_tabs[i].lastIndexOf(".") != -1) { if (verb_tabs[i].lastIndexOf(".") != -1) {
var splitName = verb_tabs[i].split("."); var splitName = verb_tabs[i].split(".");
if (split_admin_tabs && splitName[0] === "Admin") if (split_admin_tabs && splitName[0] === "Admin") part = splitName[1];
part = splitName[1]; else continue;
else
continue;
} }
var tr = document.createElement("tr"); var tr = document.createElement("tr");
var td1 = document.createElement("td"); var td1 = document.createElement("td");
td1.textContent = part; td1.textContent = part;
var a = document.createElement("a"); var a = document.createElement("a");
a.onclick = function (part) { a.onclick = (function (part) {
return function () { removeStatusTab(part) }; return function () {
}(part); removeStatusTab(part);
};
})(part);
a.textContent = " Delete Tab " + part; a.textContent = " Delete Tab " + part;
td1.appendChild(a); td1.appendChild(a);
tr.appendChild(td1); tr.appendChild(td1);
@@ -378,17 +375,18 @@ function draw_debug() {
table3.appendChild(trrr); table3.appendChild(trrr);
} }
document.getElementById("statcontent").appendChild(table3); document.getElementById("statcontent").appendChild(table3);
} }
function draw_status() { function draw_status() {
if (!document.getElementById("Status")) { if (!document.getElementById("Status")) {
createStatusTab("Status"); createStatusTab("Status");
current_tab = "Status"; current_tab = "Status";
} }
statcontentdiv.textContent = ''; statcontentdiv.textContent = "";
for (var i = 0; i < status_tab_parts.length; i++) { for (var i = 0; i < status_tab_parts.length; i++) {
if (status_tab_parts[i].trim() == "") { if (status_tab_parts[i].trim() == "") {
document.getElementById("statcontent").appendChild(document.createElement("br")); document
.getElementById("statcontent")
.appendChild(document.createElement("br"));
} else { } else {
var div = document.createElement("div"); var div = document.createElement("div");
div.textContent = status_tab_parts[i]; div.textContent = status_tab_parts[i];
@@ -412,7 +410,8 @@ function draw_mc() {
var td2 = document.createElement("td"); var td2 = document.createElement("td");
if (part[2]) { if (part[2]) {
var a = document.createElement("a"); var a = document.createElement("a");
a.href = "byond://?_src_=vars;admin_token=" + href_token + ";Vars=" + part[2]; a.href =
"byond://?_src_=vars;admin_token=" + href_token + ";Vars=" + part[2];
a.textContent = part[1]; a.textContent = part[1];
td2.appendChild(a); td2.appendChild(a);
} else { } else {
@@ -429,8 +428,7 @@ function remove_tickets() {
if (tickets) { if (tickets) {
tickets = []; tickets = [];
removePermanentTab("Tickets"); removePermanentTab("Tickets");
if (current_tab == "Tickets") if (current_tab == "Tickets") tab_change("Status");
tab_change("Status");
} }
checkStatusTab(); checkStatusTab();
} }
@@ -439,15 +437,14 @@ function remove_sdql2() {
if (sdql2) { if (sdql2) {
sdql2 = []; sdql2 = [];
removePermanentTab("SDQL2"); removePermanentTab("SDQL2");
if (current_tab == "SDQL2") if (current_tab == "SDQL2") tab_change("Status");
tab_change("Status");
} }
checkStatusTab(); checkStatusTab();
} }
function iconError(e) { function iconError(e) {
setTimeout(function () { setTimeout(function () {
if(current_tab != turfname && current_tab != "Examine") { if (current_tab != turfname && current_tab != "Examine") {
return; return;
} }
var node = e.target; var node = e.target;
@@ -457,7 +454,7 @@ function iconError(e) {
} }
var src = node.src; var src = node.src;
node.src = null; node.src = null;
node.src = src + '#' + current_attempts; node.src = src + "#" + current_attempts;
node.setAttribute("data-attempts", current_attempts + 1); node.setAttribute("data-attempts", current_attempts + 1);
}, imageRetryDelay); }, imageRetryDelay);
} }
@@ -483,12 +480,12 @@ function draw_listedturf() {
} }
var b = document.createElement("div"); var b = document.createElement("div");
b.className = "link"; b.className = "link";
b.onmousedown = function (part) { b.onmousedown = (function (part) {
// The outer function is used to close over a fresh "part" variable, // The outer function is used to close over a fresh "part" variable,
// rather than every onmousedown getting the "part" of the last entry. // rather than every onmousedown getting the "part" of the last entry.
return function (e) { return function (e) {
e.preventDefault(); e.preventDefault();
var params = {"src": part[1]}; var params = { src: part[1] };
switch (e.button) { switch (e.button) {
case 1: case 1:
params["statpanel_item_click"] = "middle"; params["statpanel_item_click"] = "middle";
@@ -508,9 +505,9 @@ function draw_listedturf() {
if (e.altKey) { if (e.altKey) {
params["statpanel_item_altclick"] = 1; params["statpanel_item_altclick"] = 1;
} }
Byond.topic(params) Byond.topic(params);
} };
}(part); })(part);
b.textContent = part[0]; b.textContent = part[0];
table.appendChild(b); table.appendChild(b);
table.appendChild(document.createElement("br")); table.appendChild(document.createElement("br"));
@@ -531,7 +528,7 @@ function remove_mc() {
if (current_tab == "MC") { if (current_tab == "MC") {
tab_change("Status"); tab_change("Status");
} }
}; }
function draw_sdql2() { function draw_sdql2() {
statcontentdiv.textContent = ""; statcontentdiv.textContent = "";
@@ -571,7 +568,12 @@ function draw_tickets() {
var td2 = document.createElement("td"); var td2 = document.createElement("td");
if (part[2]) { if (part[2]) {
var a = document.createElement("a"); var a = document.createElement("a");
a.href = "byond://?_src_=holder;admin_token=" + href_token + ";ahelp=" + part[2] + ";ahelp_action=ticket;statpanel_item_click=left;action=ticket"; a.href =
"byond://?_src_=holder;admin_token=" +
href_token +
";ahelp=" +
part[2] +
";ahelp_action=ticket;statpanel_item_click=left;action=ticket";
a.textContent = part[1]; a.textContent = part[1];
td2.appendChild(a); td2.appendChild(a);
} else if (part[3]) { } else if (part[3]) {
@@ -602,7 +604,7 @@ function draw_misc(tab) {
var part = data[i]; var part = data[i];
var td1 = document.createElement("td"); var td1 = document.createElement("td");
if(part[0]) { if (part[0]) {
td1.className = "elem"; td1.className = "elem";
td1.textContent = part[0]; td1.textContent = part[0];
} }
@@ -615,7 +617,7 @@ function draw_misc(tab) {
img.id = part[1]; img.id = part[1];
storedimages[part[1]] = part[2]; storedimages[part[1]] = part[2];
td2.appendChild(img); td2.appendChild(img);
} else if(part[1]) { } else if (part[1]) {
td2 = document.createElement("td"); td2 = document.createElement("td");
var img = document.createElement("img"); var img = document.createElement("img");
img.src = storedimages[part[1]]; img.src = storedimages[part[1]];
@@ -626,12 +628,12 @@ function draw_misc(tab) {
var b = document.createElement("div"); var b = document.createElement("div");
if (part[4]) { if (part[4]) {
b.className = "linkelem"; b.className = "linkelem";
b.onmousedown = function (part) { b.onmousedown = (function (part) {
// The outer function is used to close over a fresh "part" variable, // The outer function is used to close over a fresh "part" variable,
// rather than every onmousedown getting the "part" of the last entry. // rather than every onmousedown getting the "part" of the last entry.
return function (e) { return function (e) {
e.preventDefault(); e.preventDefault();
var params = { "src": part[4] }; var params = { src: part[4] };
switch (e.button) { switch (e.button) {
case 1: case 1:
params["statpanel_item_click"] = "middle"; params["statpanel_item_click"] = "middle";
@@ -652,29 +654,28 @@ function draw_misc(tab) {
params["statpanel_item_altclick"] = 1; params["statpanel_item_altclick"] = 1;
} }
Byond.topic(params); Byond.topic(params);
} };
}(part); })(part);
} }
if(part[3]) { if (part[3]) {
td3 = document.createElement("td"); td3 = document.createElement("td");
b.textContent = part[3]; b.textContent = part[3];
td3.appendChild(b); td3.appendChild(b);
} }
if(!td2 && !td3) { if (!td2 && !td3) {
td1.className = "elem_span3"; td1.className = "elem_span3";
td1.colSpan += 2; td1.colSpan += 2;
} } else if (!td2) {
else if (!td2) {
td1.className = "elem_span2"; td1.className = "elem_span2";
td1.colSpan += 1; td1.colSpan += 1;
} else if (!td3) { } else if (!td3) {
td2.colSpan += 1; td2.colSpan += 1;
} }
tr.appendChild(td1); tr.appendChild(td1);
if(td2) { if (td2) {
tr.appendChild(td2); tr.appendChild(td2);
} }
if(td3) { if (td3) {
tr.appendChild(td3); tr.appendChild(td3);
} }
table.appendChild(tr); table.appendChild(tr);
@@ -723,8 +724,7 @@ function draw_verbs(cat) {
sortVerbs(); sortVerbs();
if (split_admin_tabs && cat.lastIndexOf(".") != -1) { if (split_admin_tabs && cat.lastIndexOf(".") != -1) {
var splitName = cat.split("."); var splitName = cat.split(".");
if (splitName[0] === "Admin") if (splitName[0] === "Admin") cat = splitName[1];
cat = splitName[1];
} }
verbs.reverse(); // sort verbs backwards before we draw verbs.reverse(); // sort verbs backwards before we draw
for (var i = 0; i < verbs.length; ++i) { for (var i = 0; i < verbs.length; ++i) {
@@ -732,13 +732,16 @@ function draw_verbs(cat) {
var name = part[0]; var name = part[0];
if (split_admin_tabs && name.lastIndexOf(".") != -1) { if (split_admin_tabs && name.lastIndexOf(".") != -1) {
var splitName = name.split("."); var splitName = name.split(".");
if (splitName[0] === "Admin") if (splitName[0] === "Admin") name = splitName[1];
name = splitName[1];
} }
var command = part[1]; var command = part[1];
var desc = part[2]; var desc = part[2];
if (command && name.lastIndexOf(cat, 0) != -1 && (name.length == cat.length || name.charAt(cat.length) == ".")) { if (
command &&
name.lastIndexOf(cat, 0) != -1 &&
(name.length == cat.length || name.charAt(cat.length) == ".")
) {
var subCat = name.lastIndexOf(".") != -1 ? name.split(".")[1] : null; var subCat = name.lastIndexOf(".") != -1 ? name.split(".")[1] : null;
if (subCat && !additions[subCat]) { if (subCat && !additions[subCat]) {
var newTable = document.createElement("div"); var newTable = document.createElement("div");
@@ -778,64 +781,49 @@ function draw_verbs(cat) {
function set_theme(which) { function set_theme(which) {
if (which == "light" || which == "vchatlight") { if (which == "light" || which == "vchatlight") {
document.body.className = ""; document.body.className = "";
set_style_sheet("browserOutput_white"); document.documentElement.className = "light";
} else if (which == "dark" || which == "vchatdark") { } else if (which == "dark" || which == "vchatdark") {
document.body.className = "dark"; document.body.className = "dark";
set_style_sheet("browserOutput"); document.documentElement.className = "dark";
} }
} }
function set_font_size(size) { function set_font_size(size) {
document.body.style.setProperty('font-size', size); document.body.style.setProperty("font-size", size);
} }
function set_tabs_style(style) { function set_tabs_style(style) {
if (style == "default") { if (style == "default") {
menu.classList.add('menu-wrap'); menu.classList.add("menu-wrap");
menu.classList.remove('tabs-classic'); menu.classList.remove("tabs-classic");
} else if (style == "classic") { } else if (style == "classic") {
menu.classList.add('menu-wrap'); menu.classList.add("menu-wrap");
menu.classList.add('tabs-classic'); menu.classList.add("tabs-classic");
} else if (style == "scrollable") { } else if (style == "scrollable") {
menu.classList.remove('menu-wrap'); menu.classList.remove("menu-wrap");
menu.classList.remove('tabs-classic'); menu.classList.remove("tabs-classic");
} }
} }
function set_style_sheet(sheet) {
if (document.getElementById("goonStyle")) {
var currentSheet = document.getElementById("goonStyle");
currentSheet.parentElement.removeChild(currentSheet);
}
var head = document.getElementsByTagName('head')[0];
var sheetElement = document.createElement("link");
sheetElement.id = "goonStyle";
sheetElement.rel = "stylesheet";
sheetElement.type = "text/css";
sheetElement.href = sheet + ".css";
sheetElement.media = 'all';
head.appendChild(sheetElement);
}
function restoreFocus() { function restoreFocus() {
run_after_focus(function () { run_after_focus(function () {
Byond.winset('map', { Byond.winset("map", {
focus: true, focus: true,
}); });
}); });
} }
function getCookie(cname) { function getCookie(cname) {
var name = cname + '='; var name = cname + "=";
var ca = document.cookie.split(';'); var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) { for (var i = 0; i < ca.length; i++) {
var c = ca[i]; var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1); while (c.charAt(0) == " ") c = c.substring(1);
if (c.indexOf(name) === 0) { if (c.indexOf(name) === 0) {
return decoder(c.substring(name.length, c.length)); return decoder(c.substring(name.length, c.length));
} }
} }
return ''; return "";
} }
function add_verb_list(payload) { function add_verb_list(payload) {
@@ -843,18 +831,14 @@ function add_verb_list(payload) {
to_add.sort(); // sort what we're adding to_add.sort(); // sort what we're adding
for (var i = 0; i < to_add.length; i++) { for (var i = 0; i < to_add.length; i++) {
var part = to_add[i]; var part = to_add[i];
if (!part[0]) if (!part[0]) continue;
continue;
var category = part[0]; var category = part[0];
if (category.indexOf(".") != -1) { if (category.indexOf(".") != -1) {
var splitName = category.split("."); var splitName = category.split(".");
if (split_admin_tabs && splitName[0] === "Admin") if (split_admin_tabs && splitName[0] === "Admin") category = splitName[1];
category = splitName[1]; else category = splitName[0];
else
category = splitName[0];
} }
if (findVerbindex(part[1], verbs)) if (findVerbindex(part[1], verbs)) continue;
continue;
if (verb_tabs.includes(category)) { if (verb_tabs.includes(category)) {
verbs.push(part); verbs.push(part);
if (current_tab == category) { if (current_tab == category) {
@@ -866,7 +850,7 @@ function add_verb_list(payload) {
createStatusTab(category); createStatusTab(category);
} }
} }
}; }
function init_spells() { function init_spells() {
var cat = ""; var cat = "";
@@ -891,7 +875,7 @@ window.onload = function () {
Byond.sendMessage("Update-Verbs"); Byond.sendMessage("Update-Verbs");
}; };
Byond.subscribeTo('update_spells', function (payload) { Byond.subscribeTo("update_spells", function (payload) {
spell_tabs = payload.spell_tabs; spell_tabs = payload.spell_tabs;
var do_update = false; var do_update = false;
if (spell_tabs.includes(current_tab)) { if (spell_tabs.includes(current_tab)) {
@@ -908,20 +892,19 @@ Byond.subscribeTo('update_spells', function (payload) {
} }
}); });
Byond.subscribeTo('remove_verb_list', function (v) { Byond.subscribeTo("remove_verb_list", function (v) {
var to_remove = v; var to_remove = v;
for (var i = 0; i < to_remove.length; i++) { for (var i = 0; i < to_remove.length; i++) {
remove_verb(to_remove[i]); remove_verb(to_remove[i]);
} }
check_verbs(); check_verbs();
sortVerbs(); sortVerbs();
if (verb_tabs.includes(current_tab)) if (verb_tabs.includes(current_tab)) draw_verbs(current_tab);
draw_verbs(current_tab);
}); });
// passes a 2D list of (verbcategory, verbname) creates tabs and adds verbs to respective list // passes a 2D list of (verbcategory, verbname) creates tabs and adds verbs to respective list
// example (IC, Say) // example (IC, Say)
Byond.subscribeTo('init_verbs', function (payload) { Byond.subscribeTo("init_verbs", function (payload) {
wipe_verbs(); // remove all verb categories so we can replace them wipe_verbs(); // remove all verb categories so we can replace them
checkStatusTab(); // remove all status tabs checkStatusTab(); // remove all status tabs
verb_tabs = payload.panel_tabs; verb_tabs = payload.panel_tabs;
@@ -945,15 +928,17 @@ Byond.subscribeTo('init_verbs', function (payload) {
SendTabsToByond(); SendTabsToByond();
}); });
Byond.subscribeTo('update_stat', function (payload) { Byond.subscribeTo("update_stat", function (payload) {
status_tab_parts = [payload.ping_str]; status_tab_parts = [payload.ping_str];
var parsed = payload.global_data; var parsed = payload.global_data;
for (var i = 0; i < parsed.length; i++) if (parsed[i] != null) status_tab_parts.push(parsed[i]); for (var i = 0; i < parsed.length; i++)
if (parsed[i] != null) status_tab_parts.push(parsed[i]);
parsed = payload.other_str; parsed = payload.other_str;
for (var i = 0; i < parsed.length; i++) if (parsed[i] != null) status_tab_parts.push(parsed[i]); for (var i = 0; i < parsed.length; i++)
if (parsed[i] != null) status_tab_parts.push(parsed[i]);
if (current_tab == "Status") { if (current_tab == "Status") {
draw_status(); draw_status();
@@ -962,7 +947,7 @@ Byond.subscribeTo('update_stat', function (payload) {
} }
}); });
Byond.subscribeTo('update_mc', function (payload) { Byond.subscribeTo("update_mc", function (payload) {
mc_tab_parts = payload.mc_data; mc_tab_parts = payload.mc_data;
mc_tab_parts.splice(0, 0, ["Location:", payload.coord_entry]); mc_tab_parts.splice(0, 0, ["Location:", payload.coord_entry]);
@@ -977,13 +962,13 @@ Byond.subscribeTo('update_mc', function (payload) {
} }
}); });
Byond.subscribeTo('remove_spells', function () { Byond.subscribeTo("remove_spells", function () {
for (var s = 0; s < spell_tabs.length; s++) { for (var s = 0; s < spell_tabs.length; s++) {
removeStatusTab(spell_tabs[s]); removeStatusTab(spell_tabs[s]);
} }
}); });
Byond.subscribeTo('init_spells', function () { Byond.subscribeTo("init_spells", function () {
var cat = ""; var cat = "";
for (var i = 0; i < spell_tabs.length; i++) { for (var i = 0; i < spell_tabs.length; i++) {
cat = spell_tabs[i]; cat = spell_tabs[i];
@@ -994,13 +979,13 @@ Byond.subscribeTo('init_spells', function () {
} }
}); });
Byond.subscribeTo('check_spells', function () { Byond.subscribeTo("check_spells", function () {
for (var v = 0; v < spell_tabs.length; v++) { for (var v = 0; v < spell_tabs.length; v++) {
spell_cat_check(spell_tabs[v]); spell_cat_check(spell_tabs[v]);
} }
}); });
Byond.subscribeTo('create_debug', function () { Byond.subscribeTo("create_debug", function () {
if (!document.getElementById("Debug Stat Panel")) { if (!document.getElementById("Debug Stat Panel")) {
addPermanentTab("Debug Stat Panel"); addPermanentTab("Debug Stat Panel");
} else { } else {
@@ -1008,46 +993,46 @@ Byond.subscribeTo('create_debug', function () {
} }
}); });
Byond.subscribeTo('create_listedturf', function (TN) { Byond.subscribeTo("create_listedturf", function (TN) {
remove_listedturf(); // remove the last one if we had one remove_listedturf(); // remove the last one if we had one
turfname = TN; turfname = TN;
addPermanentTab(turfname); addPermanentTab(turfname);
tab_change(turfname); tab_change(turfname);
}); });
Byond.subscribeTo('create_misc', function (TN) { Byond.subscribeTo("create_misc", function (TN) {
addPermanentTab(TN); addPermanentTab(TN);
}); });
Byond.subscribeTo('remove_misc', function (TN) { Byond.subscribeTo("remove_misc", function (TN) {
removePermanentTab(TN); removePermanentTab(TN);
}); });
Byond.subscribeTo('remove_admin_tabs', function () { Byond.subscribeTo("remove_admin_tabs", function () {
href_token = null; href_token = null;
remove_mc(); remove_mc();
remove_tickets(); remove_tickets();
remove_sdql2(); remove_sdql2();
}); });
Byond.subscribeTo('update_listedturf', function (TC) { Byond.subscribeTo("update_listedturf", function (TC) {
turfcontents = TC; turfcontents = TC;
if (current_tab == turfname) { if (current_tab == turfname) {
draw_listedturf(); draw_listedturf();
} }
}); });
Byond.subscribeTo('update_misc', function (payload) { Byond.subscribeTo("update_misc", function (payload) {
let TN = payload.TN let TN = payload.TN;
let TC = payload.TC let TC = payload.TC;
misc.set(TN,TC); misc.set(TN, TC);
if (current_tab == TN) { if (current_tab == TN) {
draw_misc(TN); draw_misc(TN);
} }
}); });
Byond.subscribeTo('update_split_admin_tabs', function (status) { Byond.subscribeTo("update_split_admin_tabs", function (status) {
status = (status == true); status = status == true;
if (split_admin_tabs !== status) { if (split_admin_tabs !== status) {
if (split_admin_tabs === true) { if (split_admin_tabs === true) {
@@ -1060,32 +1045,32 @@ Byond.subscribeTo('update_split_admin_tabs', function (status) {
split_admin_tabs = status; split_admin_tabs = status;
}); });
Byond.subscribeTo('add_admin_tabs', function (ht) { Byond.subscribeTo("add_admin_tabs", function (ht) {
href_token = ht; href_token = ht;
addPermanentTab("MC"); addPermanentTab("MC");
addPermanentTab("Tickets"); addPermanentTab("Tickets");
}); });
Byond.subscribeTo('add_tickets_tabs', function (ht) { Byond.subscribeTo("add_tickets_tabs", function (ht) {
href_token = ht; href_token = ht;
addPermanentTab("Tickets"); addPermanentTab("Tickets");
}); });
Byond.subscribeTo('update_examine', function (payload) { Byond.subscribeTo("update_examine", function (payload) {
examine = payload.EX; examine = payload.EX;
if (examine.length > 0 && !verb_tabs.includes("Examine")) { if (examine.length > 0 && !verb_tabs.includes("Examine")) {
verb_tabs.push("Examine"); verb_tabs.push("Examine");
addPermanentTab("Examine") addPermanentTab("Examine");
} }
if (current_tab == "Examine") { if (current_tab == "Examine") {
draw_examine(); draw_examine();
} }
if(payload.UPD) { if (payload.UPD) {
tab_change("Examine"); tab_change("Examine");
} }
}) });
Byond.subscribeTo('update_sdql2', function (S) { Byond.subscribeTo("update_sdql2", function (S) {
sdql2 = S; sdql2 = S;
if (sdql2.length > 0 && !verb_tabs.includes("SDQL2")) { if (sdql2.length > 0 && !verb_tabs.includes("SDQL2")) {
verb_tabs.push("SDQL2"); verb_tabs.push("SDQL2");
@@ -1096,7 +1081,7 @@ Byond.subscribeTo('update_sdql2', function (S) {
} }
}); });
Byond.subscribeTo('update_tickets', function (T) { Byond.subscribeTo("update_tickets", function (T) {
tickets = T; tickets = T;
if (!verb_tabs.includes("Tickets")) { if (!verb_tabs.includes("Tickets")) {
verb_tabs.push("Tickets"); verb_tabs.push("Tickets");
@@ -1107,10 +1092,10 @@ Byond.subscribeTo('update_tickets', function (T) {
} }
}); });
Byond.subscribeTo('remove_listedturf', remove_listedturf); Byond.subscribeTo("remove_listedturf", remove_listedturf);
Byond.subscribeTo('remove_sdql2', remove_sdql2); Byond.subscribeTo("remove_sdql2", remove_sdql2);
Byond.subscribeTo('remove_mc', remove_mc); Byond.subscribeTo("remove_mc", remove_mc);
Byond.subscribeTo('add_verb_list', add_verb_list); Byond.subscribeTo("add_verb_list", add_verb_list);

View File

@@ -12,7 +12,7 @@
<!-- tgui:ntos-error --> <!-- tgui:ntos-error -->
<!-- tgui:inline-css --> <!-- tgui:inline-css -->
</head> </head>
<body> <body style="background-color: var(--color-base)">
<!-- tgui:assets --> <!-- tgui:assets -->
<!-- tgui:inline-html-start --> <!-- tgui:inline-html-start -->
<!-- tgui:inline-html --> <!-- tgui:inline-html -->