Skip to content
Snippets Groups Projects
Commit 56e2a92c authored by echicken's avatar echicken :chicken:
Browse files

It'd be difficult to make this script less horrible, but I can

make it look a bit more almost okay.
No functional change - unless I broke something, then there's a
HUGE functional change.
parent a7d2acc7
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -9,12 +9,12 @@ load("uifcdefs.js"); ...@@ -9,12 +9,12 @@ load("uifcdefs.js");
load("menu-commands.js"); load("menu-commands.js");
var help = { var help = {
'main' : [ main: [
"Main menu", "Main menu",
"Select a menu to edit, and hit <enter>.", "Select a menu to edit, and hit <enter>.",
"Hit <enter> on a blank line to create a new menu." "Hit <enter> on a blank line to create a new menu."
], ],
'editMenu' : [ editMenu: [
"Edit a menu", "Edit a menu",
" Title: String shown at top if header graphic unspecified.", " Title: String shown at top if header graphic unspecified.",
" Header: File to be displayed at the top of the menu.", " Header: File to be displayed at the top of the menu.",
...@@ -25,13 +25,13 @@ var help = { ...@@ -25,13 +25,13 @@ var help = {
"", "",
"CTRL-A and @-codes are supported in Title and Prompt." "CTRL-A and @-codes are supported in Title and Prompt."
], ],
'editCommands' : [ editCommands: [
"Menu commands", "Menu commands",
"A list of menu commands/items.", "A list of menu commands/items.",
"Format is:", "Format is:",
"Hotkey, Text, Area->Command" "Hotkey, Text, Area->Command"
], ],
'editCommand' : [ editCommand: [
"Edit a command", "Edit a command",
" Hotkey: The hotkey for this menu item.", " Hotkey: The hotkey for this menu item.",
" Text: The text displayed for this item. CTRL-A and @ codes supported.", " Text: The text displayed for this item. CTRL-A and @ codes supported.",
...@@ -41,7 +41,7 @@ var help = { ...@@ -41,7 +41,7 @@ var help = {
" Command: If 'Area' is not 'Menus', the command to be executed.", " Command: If 'Area' is not 'Menus', the command to be executed.",
" Menu: If 'Area' is 'Menus', the menu to be loaded." " Menu: If 'Area' is 'Menus', the menu to be loaded."
], ],
'chooseCommandArea' : [ chooseCommandArea: [
"Choose a command area", "Choose a command area",
" User: User information and configuration commands.", " User: User information and configuration commands.",
" System: System areas & commands that don't fit elsewhere.", " System: System areas & commands that don't fit elsewhere.",
...@@ -50,7 +50,7 @@ var help = { ...@@ -50,7 +50,7 @@ var help = {
"Externals: External programs.", "Externals: External programs.",
" Menus: Other menus." " Menus: Other menus."
], ],
'editLightbarOptions' : [ editLightbarOptions: [
"Lightbar Options", "Lightbar Options",
"Position: Centered, Left, Right, or Fixed", "Position: Centered, Left, Right, or Fixed",
"x: X-coordinate of top left corner of menu box (fixed only)", "x: X-coordinate of top left corner of menu box (fixed only)",
...@@ -66,17 +66,17 @@ var help = { ...@@ -66,17 +66,17 @@ var help = {
"BorderColor: CTRL-A code, menu box border color", "BorderColor: CTRL-A code, menu box border color",
"Hotkeys: Whether or not to use hotkeys" "Hotkeys: Whether or not to use hotkeys"
], ],
'commands' : [] commands: []
}; };
var log = function(msg) { var flog = function(msg) {
var f = new File(system.mods_dir + "uifc.log"); var f = new File(system.mods_dir + "uifc.log");
f.open("a"); f.open("a");
f.writeln(system.timestr() + ": " + msg); f.writeln(system.timestr() + ": " + msg);
f.close(); f.close();
} }
var saveMenus = function() { function saveMenus() {
file_backup(menuFile); file_backup(menuFile);
var f = new File(menuFile); var f = new File(menuFile);
f.open("w"); f.open("w");
...@@ -84,27 +84,25 @@ var saveMenus = function() { ...@@ -84,27 +84,25 @@ var saveMenus = function() {
f.close(); f.close();
} }
var init = function() { function init() {
uifc.init("Synchronet Menu Editor"); uifc.init("Synchronet Menu Editor");
js.on_exit("uifc.bail()"); js.on_exit("uifc.bail()");
} }
var uifcYesNo = function(question) { function uifcYesNo(question) {
while (1) { while (1) {
var ret = uifc.list(WIN_MID, question + "?", ["Yes", "No"]); var ret = uifc.list(WIN_MID, question + "?", ["Yes", "No"]);
if(ret >= 0) if (ret >= 0) break;
break;
} }
return (ret == 0); return (ret == 0);
} }
var uifcHelp = function(section) { function uifcHelp(section) {
uifc.help_text = word_wrap(help[section].join("\r\n\r\n")); uifc.help_text = word_wrap(help[section].join("\r\n\r\n"));
} }
var fileBrowser = function(dir) { function fileBrowser(dir) {
if(!file_isdir(dir)) if (!file_isdir(dir)) return;
return;
while (1) { while (1) {
var file; var file;
var files = directory(dir + "*", GLOB_MARK); var files = directory(dir + "*", GLOB_MARK);
...@@ -118,19 +116,19 @@ var fileBrowser = function(dir) { ...@@ -118,19 +116,19 @@ var fileBrowser = function(dir) {
} }
} }
var selection = uifc.list(WIN_ORG|WIN_MID, "Browsing " + dir, displayFiles); var selection = uifc.list(WIN_ORG|WIN_MID, "Browsing " + dir, displayFiles);
if(selection < 0) if (selection < 0) {
break; break;
else if(file_isdir(files[selection])) } else if (file_isdir(files[selection])) {
var file = fileBrowser(files[selection]); var file = fileBrowser(files[selection]);
else } else {
var file = files[selection]; var file = files[selection];
if(typeof file != "undefined") }
break; if (file !== undefined) break;
} }
return file; return file;
} }
var main = function() { function main() {
var last = 0; var last = 0;
while (1) { while (1) {
...@@ -138,13 +136,12 @@ var main = function() { ...@@ -138,13 +136,12 @@ var main = function() {
uifcHelp("main"); uifcHelp("main");
var menus = Object.keys(Commands.Menus); var menus = Object.keys(Commands.Menus);
var menuTitles = []; var menuTitles = [];
for(var m in Commands.Menus) for (var m in Commands.Menus) {
menuTitles.push(Commands.Menus[m].Title); menuTitles.push(Commands.Menus[m].Title);
}
var selection = uifc.list( var selection = uifc.list(
WIN_ORG|WIN_MID|WIN_XTR|WIN_DEL|WIN_ACT|WIN_ESC, WIN_ORG|WIN_MID|WIN_XTR|WIN_DEL|WIN_ACT|WIN_ESC,
0, 0, 0, last, last, 0, 0, 0, last, last, "Menus", menuTitles
"Menus",
menuTitles
); );
if (selection < 0) { if (selection < 0) {
break; break;
...@@ -158,37 +155,37 @@ var main = function() { ...@@ -158,37 +155,37 @@ var main = function() {
editMenu(selection); editMenu(selection);
} }
last = Math.max(selection, 0); last = Math.max(selection, 0);
if(uifcYesNo("Save changes")) if (uifcYesNo("Save changes")) saveMenus();
saveMenus();
} }
} }
var editMenu = function(menu) { function editMenu(menu) {
if(typeof menu == "undefined") { if (menu === undefined) {
while(typeof ID == "undefined" || typeof Commands.Menus[ID] != "undefined") while (ID === undefined || Commands.Menus[ID] !== undefined) {
var ID = time(); var ID = time(); // whafuck?
}
Commands.Menus[ID] = { Commands.Menus[ID] = {
'Title' : "Title", Title: "Title",
'Header' : "head.asc", Header: "head.asc",
'List' : true, List: true,
'Prompt' : "Your choice:", Prompt: "Your choice:",
'Commands' : [], Commands: [],
'Lightbar' : { Lightbar: {
'Position' : "Centered", Position: "Centered",
'x' : 1, x: 1,
'y' : 1, y: 1,
'Width' : 1, Width: 1,
'Height' : 1, Height: 1,
'Background' : "", Background: "",
'ActiveForeground' : "\\1h\\1w", ActiveForeground: "\\1h\\1w",
'ActiveBackground' : "\\16", ActiveBackground: "\\16",
'InactiveForeground' : "\\1n\\1w", InactiveForeground: "\\1n\\1w",
'InactiveBackground' : "\\10", InactiveBackground: "\\10",
'HotkeyColor' : "\\1h\\1c", HotkeyColor: "\\1h\\1c",
'BorderColor' : "\\1h\\1w", BorderColor: "\\1h\\1w",
'Hotkeys' : true Hotkeys: true
} }
}; };
var keys = Object.keys(Commands.Menus); var keys = Object.keys(Commands.Menus);
...@@ -203,22 +200,16 @@ var editMenu = function(menu) { ...@@ -203,22 +200,16 @@ var editMenu = function(menu) {
var selections = Object.keys(Commands.Menus[menu]); var selections = Object.keys(Commands.Menus[menu]);
var items = []; var items = [];
for (var item in Commands.Menus[menu]) { for (var item in Commands.Menus[menu]) {
items.push( items.push(format(
format( "%8s %s", item,
"%8s %s",
item,
(typeof Commands.Menus[menu][item] != "object") ? Commands.Menus[menu][item] : "..." (typeof Commands.Menus[menu][item] != "object") ? Commands.Menus[menu][item] : "..."
) ));
);
} }
var selection = uifc.list( var selection = uifc.list(
WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC, WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,
0, 0, 0, last, last, 0, 0, 0, last, last, Commands.Menus[menu].Title + ": Items", items
Commands.Menus[menu].Title + ": Items",
items
); );
if(selection < 0) if (selection < 0) break;
break;
switch (selections[selection]) { switch (selections[selection]) {
case "Header": case "Header":
var selection2 = uifc.list( var selection2 = uifc.list(
...@@ -241,8 +232,7 @@ var editMenu = function(menu) { ...@@ -241,8 +232,7 @@ var editMenu = function(menu) {
break; break;
case "List": case "List":
var yes = uifcYesNo("List menu items"); var yes = uifcYesNo("List menu items");
if(yes == -1) if (yes == -1) break;
break;
Commands.Menus[menu].List = yes; Commands.Menus[menu].List = yes;
break; break;
case "Commands": case "Commands":
...@@ -254,11 +244,9 @@ var editMenu = function(menu) { ...@@ -254,11 +244,9 @@ var editMenu = function(menu) {
case "Default": case "Default":
var yes = uifcYesNo("Default menu"); var yes = uifcYesNo("Default menu");
Commands.Menus[menu].Default = (yes); Commands.Menus[menu].Default = (yes);
if(!yes) if (!yes) break;
break;
for (var m in Commands.Menus) { for (var m in Commands.Menus) {
if(m == menu) if (m == menu) continue;
continue;
Commands.Menus[m].Default = false; Commands.Menus[m].Default = false;
} }
break; break;
...@@ -271,38 +259,33 @@ var editMenu = function(menu) { ...@@ -271,38 +259,33 @@ var editMenu = function(menu) {
} }
var editItem = function(menu, item) { function editItem(menu, item) {
var text = uifc.input(WIN_MID, item, Commands.Menus[menu][item], 0, K_EDIT); var text = uifc.input(WIN_MID, item, Commands.Menus[menu][item], 0, K_EDIT);
if(typeof text != "undefined") if (typeof text != "undefined") Commands.Menus[menu][item] = text;
Commands.Menus[menu][item] = text;
} }
var editCommands = function(menu) { function editCommands(menu) {
var last = 0; var last = 0;
while (1) { while (1) {
uifcHelp("editCommands"); uifcHelp("editCommands");
var menuCommands = []; var menuCommands = [];
for (var c in Commands.Menus[menu].Commands) { for (var c in Commands.Menus[menu].Commands) {
if (Commands.Menus[menu].Commands[c].command.split(".")[1] == "Menus") { if (Commands.Menus[menu].Commands[c].command.split(".")[1] == "Menus") {
menuCommands.push( menuCommands.push(format(
format(
"%s %-30s Menus->%s", "%s %-30s Menus->%s",
Commands.Menus[menu].Commands[c].hotkey, Commands.Menus[menu].Commands[c].hotkey,
Commands.Menus[menu].Commands[c].text.substr(0, 30), Commands.Menus[menu].Commands[c].text.substr(0, 30),
Commands.Menus[Commands.Menus[menu].Commands[c].menu].Title.substr(0, uifc.screen_width - 35) Commands.Menus[Commands.Menus[menu].Commands[c].menu].Title.substr(0, uifc.screen_width - 35)
) ));
);
} else { } else {
var path = Commands.Menus[menu].Commands[c].command.split("."); var path = Commands.Menus[menu].Commands[c].command.split(".");
menuCommands.push( menuCommands.push(format(
format(
"%s %-30s %s->%s", "%s %-30s %s->%s",
Commands.Menus[menu].Commands[c].hotkey, Commands.Menus[menu].Commands[c].hotkey,
Commands.Menus[menu].Commands[c].text.substr(0, 30), Commands.Menus[menu].Commands[c].text.substr(0, 30),
path[1], path[1],
path[2] path[2]
) ));
);
} }
} }
var selection = uifc.list( var selection = uifc.list(
...@@ -324,16 +307,15 @@ var editCommands = function(menu) { ...@@ -324,16 +307,15 @@ var editCommands = function(menu) {
} }
} }
var editCommand = function(menu, selection) { function editCommand(menu, selection) {
if(typeof selection == "undefined") { if (selection === undefined) {
Commands.Menus[menu].Commands.push( Commands.Menus[menu].Commands.push({
{ 'hotkey' : '', hotkey: '',
'text' : '', text: '',
'ARS' : '', ARS: '',
'command' : 'Commands.Messages.Find' command: 'Commands.Messages.Find'
} });
);
selection = Commands.Menus[menu].Commands.length - 1; selection = Commands.Menus[menu].Commands.length - 1;
} }
...@@ -347,13 +329,13 @@ var editCommand = function(menu, selection) { ...@@ -347,13 +329,13 @@ var editCommand = function(menu, selection) {
"Position: " + selection, "Position: " + selection,
" Area: " + path[1] " Area: " + path[1]
]; ];
if(path.length > 2) if (path.length > 2) {
options.push(" Command: " + path[2]); options.push(" Command: " + path[2]);
else } else {
options.push(" Menu: " + Commands.Menus[Commands.Menus[menu].Commands[selection].menu].Title); options.push(" Menu: " + Commands.Menus[Commands.Menus[menu].Commands[selection].menu].Title);
}
var selection2 = uifc.list(WIN_ORG|WIN_MID, "Edit command", options); var selection2 = uifc.list(WIN_ORG|WIN_MID, "Edit command", options);
if(selection2 < 0) if (selection2 < 0) break;
break;
if (selection2 == 0) { if (selection2 == 0) {
Commands.Menus[menu].Commands[selection].hotkey = uifc.input( Commands.Menus[menu].Commands[selection].hotkey = uifc.input(
WIN_MID, WIN_MID,
...@@ -370,11 +352,9 @@ var editCommand = function(menu, selection) { ...@@ -370,11 +352,9 @@ var editCommand = function(menu, selection) {
0, 0,
K_EDIT K_EDIT
); );
if(typeof text != "undefined") if (text !== undefined) Commands.Menus[menu].Commands[selection].text = text;
Commands.Menus[menu].Commands[selection].text = text;
} else if (selection2 == 2) { } else if (selection2 == 2) {
if(Commands.Menus[menu].Commands[selection].command.split(".")[1] == "Externals") if (Commands.Menus[menu].Commands[selection].command.split(".")[1] == "Externals") continue;
continue;
var ars = uifc.input( var ars = uifc.input(
WIN_MID, WIN_MID,
"Access Requirements", "Access Requirements",
...@@ -382,8 +362,7 @@ var editCommand = function(menu, selection) { ...@@ -382,8 +362,7 @@ var editCommand = function(menu, selection) {
0, 0,
K_EDIT K_EDIT
); );
if(typeof ars != "undefined") if (ars !== undefined) Commands.Menus[menu].Commands[selection].ARS = ars;
Commands.Menus[menu].Commands[selection].ARS = ars;
} else if (selection2 == 3) { } else if (selection2 == 3) {
var position = uifc.input( var position = uifc.input(
WIN_MID, WIN_MID,
...@@ -392,18 +371,15 @@ var editCommand = function(menu, selection) { ...@@ -392,18 +371,15 @@ var editCommand = function(menu, selection) {
0, 0,
K_NUMBER|K_EDIT K_NUMBER|K_EDIT
); );
if(typeof position == "undefined" || parseInt(position) >= Commands.Menus[menu].Commands.length) if (position === undefined || parseInt(position) >= Commands.Menus[menu].Commands.length) continue;
continue;
var cut = Commands.Menus[menu].Commands.splice(selection, 1)[0]; var cut = Commands.Menus[menu].Commands.splice(selection, 1)[0];
Commands.Menus[menu].Commands.splice(position, 0, cut); Commands.Menus[menu].Commands.splice(position, 0, cut);
selection = parseInt(position); selection = parseInt(position);
} else { } else {
var area = chooseCommandArea(); var area = chooseCommandArea();
if(typeof area == "undefined") if (area === undefined) break;
break;
var command = chooseCommand(area); var command = chooseCommand(area);
if(typeof command == "undefined") if (command === undefined) break;
break;
var areas = Object.keys(Commands); var areas = Object.keys(Commands);
if (areas[area] == "Menus") { if (areas[area] == "Menus") {
var menus = Object.keys(Commands.Menus); var menus = Object.keys(Commands.Menus);
...@@ -421,40 +397,40 @@ var editCommand = function(menu, selection) { ...@@ -421,40 +397,40 @@ var editCommand = function(menu, selection) {
return selection; return selection;
} }
var chooseCommandArea = function() { function chooseCommandArea() {
uifcHelp("chooseCommandArea"); uifcHelp("chooseCommandArea");
var areas = Object.keys(Commands); var areas = Object.keys(Commands);
var selection = uifc.list(WIN_MID, "Command Areas", areas); var selection = uifc.list(WIN_MID, "Command Areas", areas);
if(selection >= 0) if (selection >= 0) return selection;
return selection;
} }
var chooseCommand = function(area) { function chooseCommand(area) {
var areas = Object.keys(Commands); var areas = Object.keys(Commands);
if (areas[area] == "Menus") { if (areas[area] == "Menus") {
var commands = []; var commands = [];
for(var m in Commands.Menus) for (var m in Commands.Menus) {
commands.push(Commands.Menus[m].Title); commands.push(Commands.Menus[m].Title);
}
} else if (areas[area] == "Externals") { } else if (areas[area] == "Externals") {
var sec = chooseXtrnSec(); var sec = chooseXtrnSec();
return chooseXtrn(sec); return chooseXtrn(sec);
} else { } else {
var commands = Object.keys(Commands[areas[area]]); var commands = Object.keys(Commands[areas[area]]);
help.commands = [areas[area] + " commands"]; help.commands = [areas[area] + " commands"];
for(var c = 0; c < commands.length; c++) for (var c = 0; c < commands.length; c++) {
help.commands.push(commands[c] + ": " + Commands[areas[area]][commands[c]].Description); help.commands.push(commands[c] + ": " + Commands[areas[area]][commands[c]].Description);
} }
}
uifcHelp("commands"); uifcHelp("commands");
while (1) { while (1) {
var selection = uifc.list(WIN_MID, "Commands", commands); var selection = uifc.list(WIN_MID, "Commands", commands);
if(selection < 0) if (selection < 0) break;
break;
return selection; return selection;
} }
help.commands = []; help.commands = [];
} }
var chooseXtrnSec = function() { function chooseXtrnSec() {
var sex = []; var sex = [];
var codes = []; var codes = [];
for (var sec in xtrn_area.sec) { for (var sec in xtrn_area.sec) {
...@@ -462,13 +438,11 @@ var chooseXtrnSec = function() { ...@@ -462,13 +438,11 @@ var chooseXtrnSec = function() {
codes.push(sec); codes.push(sec);
} }
var selection = uifc.list(WIN_MID, "External Program Areas", sex); var selection = uifc.list(WIN_MID, "External Program Areas", sex);
if(selection >= 0) if (selection >= 0) return codes[selection];
return codes[selection];
} }
var chooseXtrn = function(area) { function chooseXtrn(area) {
if(typeof area == "undefined") if (area === undefined) return;
return;
var xtrns = []; var xtrns = [];
var codes = []; var codes = [];
for (var prog in xtrn_area.sec[area].prog_list) { for (var prog in xtrn_area.sec[area].prog_list) {
...@@ -476,21 +450,15 @@ var chooseXtrn = function(area) { ...@@ -476,21 +450,15 @@ var chooseXtrn = function(area) {
codes.push(xtrn_area.sec[area].prog_list[prog].code); codes.push(xtrn_area.sec[area].prog_list[prog].code);
} }
var selection = uifc.list(WIN_MID, "External Programs", xtrns); var selection = uifc.list(WIN_MID, "External Programs", xtrns);
if(selection >=0 ) if (selection >= 0) return codes[selection];
return codes[selection];
} }
var editLightbarOptions = function(menu) { function editLightbarOptions(menu) {
var last = 0; var last = 0;
while (1) { while (1) {
var options = []; var options = [];
for (var property in Commands.Menus[menu].Lightbar) { for (var property in Commands.Menus[menu].Lightbar) {
options.push( options.push(format("%22s %s", property, Commands.Menus[menu].Lightbar[property]));
format(
"%22s %s",
property, Commands.Menus[menu].Lightbar[property]
)
);
} }
var selection = uifc.list( var selection = uifc.list(
WIN_ORG|WIN_MID|WIN_ACT, WIN_ORG|WIN_MID|WIN_ACT,
...@@ -499,18 +467,15 @@ var editLightbarOptions = function(menu) { ...@@ -499,18 +467,15 @@ var editLightbarOptions = function(menu) {
options options
); );
last = selection; last = selection;
if(selection < 0) if (selection < 0) return;
return;
switch (selection) { switch (selection) {
case 0: case 0:
var opts = ["Centered", "Left", "Right", "Fixed"]; var opts = ["Centered", "Left", "Right", "Fixed"];
var pos = uifc.list(WIN_MID, "Lightbar menu position", opts); var pos = uifc.list(WIN_MID, "Lightbar menu position", opts);
if(pos >= 0) if (pos >= 0) Commands.Menus[menu].Lightbar.Position = opts[pos];
Commands.Menus[menu].Lightbar.Position = opts[pos];
break; break;
case 1: case 1:
if(Commands.Menus[menu].Lightbar.Position != "Fixed") if (Commands.Menus[menu].Lightbar.Position != "Fixed") break;
break;
var x = parseInt( var x = parseInt(
uifc.input( uifc.input(
WIN_MID, WIN_MID,
...@@ -520,12 +485,10 @@ var editLightbarOptions = function(menu) { ...@@ -520,12 +485,10 @@ var editLightbarOptions = function(menu) {
K_EDIT K_EDIT
) )
); );
if(!isNaN(x) && x > 0) if (!isNaN(x) && x > 0) Commands.Menus[menu].Lightbar.x = x;
Commands.Menus[menu].Lightbar.x = x;
break; break;
case 2: case 2:
if(Commands.Menus[menu].Lightbar.Position != "Fixed") if (Commands.Menus[menu].Lightbar.Position != "Fixed") break;
break;
var y = parseInt( var y = parseInt(
uifc.input( uifc.input(
WIN_MID, WIN_MID,
...@@ -535,12 +498,10 @@ var editLightbarOptions = function(menu) { ...@@ -535,12 +498,10 @@ var editLightbarOptions = function(menu) {
K_EDIT K_EDIT
) )
); );
if(!isNaN(y) && y > 0) if (!isNaN(y) && y > 0) Commands.Menus[menu].Lightbar.y = y;
Commands.Menus[menu].Lightbar.y = y;
break; break;
case 3: case 3:
if(Commands.Menus[menu].Lightbar.Position != "Fixed") if (Commands.Menus[menu].Lightbar.Position != "Fixed") break;
break;
var w = parseInt( var w = parseInt(
uifc.input( uifc.input(
WIN_MID, WIN_MID,
...@@ -550,12 +511,10 @@ var editLightbarOptions = function(menu) { ...@@ -550,12 +511,10 @@ var editLightbarOptions = function(menu) {
K_EDIT K_EDIT
) )
); );
if(!isNaN(w) && w > 0) if (!isNaN(w) && w > 0) Commands.Menus[menu].Lightbar.Width = w;
Commands.Menus[menu].Lightbar.Width = w;
break; break;
case 4: case 4:
if(Commands.Menus[menu].Lightbar.Position != "Fixed") if (Commands.Menus[menu].Lightbar.Position != "Fixed") break;
break;
var h = parseInt( var h = parseInt(
uifc.input( uifc.input(
WIN_MID, WIN_MID,
...@@ -565,8 +524,7 @@ var editLightbarOptions = function(menu) { ...@@ -565,8 +524,7 @@ var editLightbarOptions = function(menu) {
K_EDIT K_EDIT
) )
); );
if(!isNaN(h) && h > 0) if (!isNaN(h) && h > 0) Commands.Menus[menu].Lightbar.Height = h;
Commands.Menus[menu].Lightbar.Height = h;
break; break;
case 5: case 5:
var b = uifc.list( var b = uifc.list(
...@@ -584,8 +542,9 @@ var editLightbarOptions = function(menu) { ...@@ -584,8 +542,9 @@ var editLightbarOptions = function(menu) {
} else if (b == 1) { } else if (b == 1) {
var bg = fileBrowser(system.text_dir + "menu/"); var bg = fileBrowser(system.text_dir + "menu/");
} }
if(typeof bg == "string") if (typeof bg == "string") {
Commands.Menus[menu].Lightbar.Background = bg.replace(system.text_dir + "menu/", ""); Commands.Menus[menu].Lightbar.Background = bg.replace(system.text_dir + "menu/", "");
}
break; break;
case 6: case 6:
var fg = uifc.input( var fg = uifc.input(
...@@ -595,8 +554,7 @@ var editLightbarOptions = function(menu) { ...@@ -595,8 +554,7 @@ var editLightbarOptions = function(menu) {
12, 12,
K_EDIT K_EDIT
); );
if(typeof fg != "undefined" && fg != "") if (fg !== undefined && fg != "") Commands.Menus[menu].Lightbar.ActiveForeground = fg;
Commands.Menus[menu].Lightbar.ActiveForeground = fg;
break; break;
case 7: case 7:
var bg = uifc.input( var bg = uifc.input(
...@@ -606,8 +564,7 @@ var editLightbarOptions = function(menu) { ...@@ -606,8 +564,7 @@ var editLightbarOptions = function(menu) {
6, 6,
K_EDIT K_EDIT
); );
if(typeof bg != "undefined" && bg != "") if (bg !== undefined && bg != "") Commands.Menus[menu].Lightbar.ActiveBackground = bg;
Commands.Menus[menu].Lightbar.ActiveBackground = bg;
break; break;
case 8: case 8:
var fg = uifc.input( var fg = uifc.input(
...@@ -617,8 +574,7 @@ var editLightbarOptions = function(menu) { ...@@ -617,8 +574,7 @@ var editLightbarOptions = function(menu) {
12, 12,
K_EDIT K_EDIT
); );
if(typeof fg != "undefined" && fg != "") if (fg !== undefined && fg != "") Commands.Menus[menu].Lightbar.InactiveForeground = fg;
Commands.Menus[menu].Lightbar.InactiveForeground = fg;
break; break;
case 9: case 9:
var bg = uifc.input( var bg = uifc.input(
...@@ -628,8 +584,7 @@ var editLightbarOptions = function(menu) { ...@@ -628,8 +584,7 @@ var editLightbarOptions = function(menu) {
6, 6,
K_EDIT K_EDIT
); );
if(typeof bg != "undefined" && bg != "") if (bg !== undefined && bg != "") Commands.Menus[menu].Lightbar.InactiveBackground = bg;
Commands.Menus[menu].Lightbar.InactiveBackground = bg;
break; break;
case 10: case 10:
var h = uifc.input( var h = uifc.input(
...@@ -639,8 +594,7 @@ var editLightbarOptions = function(menu) { ...@@ -639,8 +594,7 @@ var editLightbarOptions = function(menu) {
12, 12,
K_EDIT K_EDIT
); );
if(typeof h != "undefined" && h != "") if (h !== undefined && h != "") Commands.Menus[menu].Lightbar.InactiveForeground = h;
Commands.Menus[menu].Lightbar.InactiveForeground = h;
break; break;
case 11: case 11:
var b = uifc.input( var b = uifc.input(
...@@ -650,8 +604,7 @@ var editLightbarOptions = function(menu) { ...@@ -650,8 +604,7 @@ var editLightbarOptions = function(menu) {
12, 12,
K_EDIT K_EDIT
); );
if(typeof b != "undefined" && b != "") if (b !== undefined && b != "") Commands.Menus[menu].Lightbar.BorderColor = b;
Commands.Menus[menu].Lightbar.BorderColor = b;
break; break;
case 12: case 12:
Commands.Menus[menu].Lightbar.Hotkeys = uifcYesNo("Hotkeys"); Commands.Menus[menu].Lightbar.Hotkeys = uifcYesNo("Hotkeys");
...@@ -666,5 +619,5 @@ try { ...@@ -666,5 +619,5 @@ try {
init(); init();
main(); main();
} catch(err) { } catch(err) {
log(err); flog(err);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment