From 25ea72f09c2b4d305aac5d6b62687607ecf2b93d Mon Sep 17 00:00:00 2001 From: Aleksej Komarov Date: Thu, 16 Apr 2020 04:51:07 +0300 Subject: [PATCH] Build window options in a more compact way --- code/modules/tgui/tgui.dm | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index 333646719e8..fd3a5da5c58 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -98,19 +98,16 @@ if(status < UI_UPDATE) return // Bail if we're not supposed to open. + // Build window options + var/window_options = "can_minimize=0;auto_format=0;" // If we have a width and height, use them. - var/window_size if(width && height) - window_size = "size=[width]x[height];" - else - window_size = "" - + window_options += "size=[width]x[height];" // Remove titlebar and resize handles for a fancy window - var/have_title_bar if(user.client.prefs.tgui_fancy) - have_title_bar = "titlebar=0;can_resize=0;" + window_options += "titlebar=0;can_resize=0;" else - have_title_bar = "titlebar=1;can_resize=1;" + window_options += "titlebar=1;can_resize=1;" // Generate page html var/html @@ -123,7 +120,7 @@ html = replacetextEx(html, "\[tgui:ref]", "\ref[src]") // Open the window. - user << browse(html, "window=[window_id];can_minimize=0;auto_format=0;[window_size][have_title_bar]") + user << browse(html, "window=[window_id];[window_options]") // Instruct the client to signal UI when the window is closed. // NOTE: Intentional \ref usage; tgui datums can't/shouldn't @@ -138,9 +135,7 @@ if(!initial_static_data) { initial_static_data = src_object.ui_static_data(user) } - _initial_update = url_encode(get_json( - initial_data, - initial_static_data)) + _initial_update = url_encode(get_json(initial_data, initial_static_data)) SStgui.on_open(src)