Skip to content

Commit

Permalink
turns options button into a "tab" (cmss13-devs#4754)
Browse files Browse the repository at this point in the history
i think it just looks nicer aesthetically. if someone disagrees
particularly thats fine

:cl:
ui: the options button is now part of the statbrowser tabs proper
/:cl:
  • Loading branch information
harryob authored Nov 2, 2023
1 parent e12e140 commit e5939f4
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions html/statbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,21 @@ function createStatusTab(name) {
B.textContent = name;
B.className = "button";
//ORDERING ALPHABETICALLY
B.style.order = name.charCodeAt(0);
if (name == "Status" || name == "MC") {
B.style.order = name == "Status" ? 1 : 2;

switch (name) {
case "Status":
B.style.order = 1;
break;
case "MC":
B.style.order = 2;
break;
case "Panel Options":
B.style.order = 999;
break;
default:
B.style.order = name.charCodeAt(0);
}

//END ORDERING
menu.appendChild(B);
SendTabToByond(name);
Expand Down Expand Up @@ -247,6 +258,7 @@ function tab_change(tab, force) {
if (!force && tab == current_tab) return;
if (document.getElementById(current_tab))
document.getElementById(current_tab).className = "button"; // disable active on last button
var oldTab = current_tab;
current_tab = tab;
set_byond_tab(tab);
if (document.getElementById(tab))
Expand All @@ -270,6 +282,9 @@ function tab_change(tab, force) {
draw_sdql2();
} else if (tab == turfname) {
draw_listedturf();
} else if (tab == "Panel Options") {
openOptionsMenu();
tab_change(oldTab);
} else {
statcontentdiv.textContext = "Loading...";
}
Expand Down Expand Up @@ -1036,21 +1051,7 @@ Byond.subscribeTo("remove_mc", remove_mc);
Byond.subscribeTo("add_verb_list", add_verb_list);

function createOptionsButton() {
if (document.getElementById("options")) {
return;
}
var button = document.createElement("BUTTON");
button.onclick = function () {
openOptionsMenu();
this.blur();
};
button.id = "options";
button.textContent = "Options";
button.className = "options";
button.style.order = 999; // last please
button.style.marginLeft = "auto";
button.style.marginRight = "2%";
menu.appendChild(button);
addPermanentTab("Panel Options");
}

function openOptionsMenu() {
Expand Down

0 comments on commit e5939f4

Please sign in to comment.