Ports the Chem Master choose your pill PR plus post-improvements

This commit is contained in:
Ghommie
2019-07-12 07:39:17 +02:00
parent c76f6b8a54
commit d36bae06a7
45 changed files with 171 additions and 31 deletions
+14
View File
@@ -49,6 +49,20 @@
if(!ui || ui.status != UI_INTERACTIVE)
return 1 // If UI is not interactive or usr calling Topic is not the UI user, bail.
/**
* public
*
* Called on an object when a tgui object is being created, allowing you to customise the html
* For example: inserting a custom stylesheet that you need in the head
*
* For this purpose, some tags are available in the html, to be parsed out with replacetext
* (customheadhtml) - Additions to the head tag
*
* required html the html base text
*
**/
/datum/proc/ui_base_html(html)
return html
/**
* private
+11 -3
View File
@@ -198,11 +198,19 @@
**/
/datum/tgui/proc/get_html(var/inline)
var/html
html = SStgui.basehtml
//Allow the src object to override the html if needed
html = src_object.ui_base_html(html)
//Strip out any remaining custom tags that are used in ui_base_html
html = replacetext(html, "<!--customheadhtml-->", "")
// Poplate HTML with JSON if we're supposed to inline.
if(inline)
html = replacetextEx(SStgui.basehtml, "{}", get_json(initial_data))
else
html = SStgui.basehtml
html = replacetextEx(html, "{}", get_json(initial_data))
//Setup for tgui stuff, including styles
html = replacetextEx(html, "\[ref]", "[REF(src)]")
html = replacetextEx(html, "\[style]", style)
return html