mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Makes browser datum use asset cache (#20847)
* Makes browser datum use asset cache This should shave one or two round trips off of the lag for player preferences window, since it was sending the css for browser datums every load. * Fix improper casing
This commit is contained in:
committed by
oranges
parent
1efebaf096
commit
06a826dd18
@@ -40,9 +40,11 @@
|
||||
|
||||
/datum/browser/proc/add_stylesheet(name, file)
|
||||
stylesheets[name] = file
|
||||
register_asset("[ckey(name)].css", file)
|
||||
|
||||
/datum/browser/proc/add_script(name, file)
|
||||
scripts[name] = file
|
||||
register_asset("[ckey(name)].js", file)
|
||||
|
||||
/datum/browser/proc/set_content(ncontent)
|
||||
content = ncontent
|
||||
@@ -54,13 +56,9 @@
|
||||
var/key
|
||||
var/filename
|
||||
for (key in stylesheets)
|
||||
filename = "[ckey(key)].css"
|
||||
user << browse_rsc(stylesheets[key], filename)
|
||||
head_content += "<link rel='stylesheet' type='text/css' href='[filename]'>"
|
||||
|
||||
for (key in scripts)
|
||||
filename = "[ckey(key)].js"
|
||||
user << browse_rsc(scripts[key], filename)
|
||||
head_content += "<script type='text/javascript' src='[filename]'></script>"
|
||||
|
||||
var/title_attributes = "class='uiTitle'"
|
||||
@@ -98,6 +96,10 @@
|
||||
var/window_size = ""
|
||||
if (width && height)
|
||||
window_size = "size=[width]x[height];"
|
||||
if (stylesheets.len)
|
||||
send_asset_list(user, stylesheets, verify=FALSE)
|
||||
if (scripts.len)
|
||||
send_asset_list(user, scripts, verify=FALSE)
|
||||
user << browse(get_content(), "window=[window_id];[window_size][window_options]")
|
||||
if (use_onclose)
|
||||
spawn(0)
|
||||
@@ -275,4 +277,4 @@
|
||||
if(src && src.mob)
|
||||
//world << "[src] was [src.mob.machine], setting to null"
|
||||
src.mob.unset_machine()
|
||||
return
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user