mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Fix flavor text encoding issues
This commit is contained in:
@@ -339,4 +339,19 @@ proc/checkhtml(var/t)
|
||||
|
||||
/proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN)
|
||||
return trim(strip_html_properly(input, max_length))
|
||||
|
||||
//Used in preferences' SetFlavorText and human's set_flavor verb
|
||||
//Previews a string of len or less length
|
||||
/proc/TextPreview(var/string,var/len=40)
|
||||
if(lentext(string) <= len)
|
||||
if(!lentext(string))
|
||||
return "\[...\]"
|
||||
else
|
||||
return string
|
||||
else
|
||||
return "[copytext_preserve_html(string, 1, 37)]..."
|
||||
|
||||
//alternative copytext() for encoded text, doesn't break html entities (" and other)
|
||||
/proc/copytext_preserve_html(var/text, var/first, var/last)
|
||||
return html_encode(copytext(html_decode(text), first, last))
|
||||
|
||||
@@ -337,7 +337,7 @@ datum/preferences
|
||||
else
|
||||
dat += "[flavor_text]"
|
||||
else
|
||||
dat += "[copytext(flavor_text, 1, 37)]...<br>"
|
||||
dat += "[TextPreview(flavor_text, 1, 37)]...<br>"
|
||||
dat += "<br>"
|
||||
|
||||
var/hairname = "Hair"
|
||||
|
||||
@@ -848,4 +848,4 @@
|
||||
set desc = "Sets an extended description of your character's features."
|
||||
set category = "IC"
|
||||
|
||||
flavor_text = sanitize(copytext(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1))
|
||||
flavor_text = TextPreview((input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1))
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
set desc = "Sets an extended description of your character's features."
|
||||
set category = "IC"
|
||||
|
||||
flavor_text = sanitize(copytext(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1))
|
||||
flavor_text = sanitize(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text)
|
||||
|
||||
/mob/living/silicon/binarycheck()
|
||||
return 1
|
||||
|
||||
@@ -605,7 +605,7 @@ var/list/slot_equipment_priority = list( \
|
||||
if(lentext(msg) <= 40)
|
||||
return "\blue [msg]"
|
||||
else
|
||||
return "\blue [copytext(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a>"
|
||||
return "\blue [copytext_preserve_html(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a>"
|
||||
|
||||
/mob/proc/is_dead()
|
||||
return stat == DEAD
|
||||
|
||||
Reference in New Issue
Block a user