mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
readd_quotes() for TGUI Text Input
This commit is contained in:
@@ -481,20 +481,23 @@
|
||||
/// 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
|
||||
|
||||
var/user_input = input(user, message, title, default) as text|null
|
||||
if(isnull(user_input))
|
||||
return
|
||||
if(no_trim)
|
||||
return copytext(html_encode(name), 1, max_length)
|
||||
return copytext(html_encode(user_input), 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 <)
|
||||
return trim(html_encode(user_input), 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
|
||||
var/user_input = input(user, message, title, default) as message|null
|
||||
if(isnull(user_input))
|
||||
return
|
||||
if(no_trim)
|
||||
return copytext(html_encode(name), 1, max_length)
|
||||
return copytext(html_encode(user_input), 1, max_length)
|
||||
else
|
||||
return trim(html_encode(name), max_length)
|
||||
return trim(html_encode(user_input), max_length)
|
||||
|
||||
//Adds 'char' ahead of 'text' until there are 'count' characters total
|
||||
/proc/add_leading(text, count, char = " ")
|
||||
|
||||
Reference in New Issue
Block a user