mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
TGUI GPS & Mining Vendor & Ore Processing Console
This commit is contained in:
@@ -453,4 +453,22 @@ proc/TextPreview(var/string,var/len=40)
|
||||
. += .(rest)
|
||||
|
||||
|
||||
#define gender2text(gender) capitalize(gender)
|
||||
#define gender2text(gender) capitalize(gender)
|
||||
|
||||
/// Used to get a properly sanitized input, of max_length
|
||||
/// no_trim is self explanatory but it prevents the input from being trimed if you intend to parse newlines or whitespace.
|
||||
/proc/stripped_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE)
|
||||
var/name = input(user, message, title, default) as text|null
|
||||
|
||||
if(no_trim)
|
||||
return copytext(html_encode(name), 1, max_length)
|
||||
else
|
||||
return trim(html_encode(name), max_length) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <)
|
||||
|
||||
// Used to get a properly sanitized multiline input, of max_length
|
||||
/proc/stripped_multiline_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE)
|
||||
var/name = input(user, message, title, default) as message|null
|
||||
if(no_trim)
|
||||
return copytext(html_encode(name), 1, max_length)
|
||||
else
|
||||
return trim(html_encode(name), max_length)
|
||||
|
||||
Reference in New Issue
Block a user