NanoUI updates.

* Simplified the code used in ui_interact procs and updated all current uses.
* Removed ununused jsviews JavaScript code (replaced it with vanilla jsrender).
* Added a message to the UI which shows if JavaScript is disabled (people with JavaScript disabled previously got blank UIs).
This commit is contained in:
Mark Aherne (Faerdan)
2014-01-06 02:49:25 +00:00
parent 909c873b2e
commit f25052fd4c
12 changed files with 1620 additions and 4763 deletions
+24 -1
View File
@@ -14,6 +14,29 @@
/datum/nanomanager/New()
return
/**
* Get an open /nanoui ui for the current user, src_object and ui_key and try to update it with data
*
* @param user /mob The mob who opened/owns the ui
* @param src_object /obj|/mob The obj or mob which the ui belongs to
* @param ui_key string A string key used for the ui
* @param ui /datum/nanoui An existing instance of the ui (can be null)
* @param data list The data to be passed to the ui, if it exists
*
* @return /nanoui Returns the found ui, for null if none exists
*/
/datum/nanomanager/proc/try_update_ui(var/mob/user, src_object, ui_key, var/datum/nanoui/ui, data)
if (!ui) // no ui has been passed, so we'll search for one
{
ui = get_open_ui(user, src, ui_key)
}
if (ui)
// The UI is already open so push the data to it
ui.push_data(data)
return ui
return null
/**
* Get an open /nanoui ui for the current user, src_object and ui_key
*
@@ -21,7 +44,7 @@
* @param src_object /obj|/mob The obj or mob which the ui belongs to
* @param ui_key string A string key used for the ui
*
* @return /nanoui Returns the found ui, for null if none exists
* @return /nanoui Returns the found ui, or null if none exists
*/
/datum/nanomanager/proc/get_open_ui(var/mob/user, src_object, ui_key)
var/src_object_key = "\ref[src_object]"
+1
View File
@@ -308,6 +308,7 @@ nanoui is used to open and update nano browser uis
<div id='uiWrapper'>
[title ? "<div id='uiTitleWrapper'><div id='uiStatusIcon' class='icon24 uiStatusGood'></div><div id='uiTitle'>[title]</div><div id='uiTitleFluff'></div></div>" : ""]
<div id='uiContent'>
<noscript><div id='uiNoJavaScript'>Your browser does not have JavaScript enabled. Please enable JavaScript restart SS13.</div></noscript>
"}
/**