/datum/browser var/mob/user var/title /// window_id is used as the window name for browse and onclose calls var/window_id var/width = 0 var/height = 0 /// UID of the host atom var/atom_uid = null /// Various options to control elements such as titlebar buttons for the window var/list/window_options = list("focus=0;can_close=1;can_minimize=1;can_maximize=0;can_resize=1;titlebar=1;") // window option is set using window_id /// Assoc list of stylesheets for use by the datum var/stylesheets[0] /// Assoc list of script files for use by the datum var/scripts[0] /// Should default stylesheets be loaded var/include_default_stylesheet = TRUE /// Header HTML content of the browser datum var/list/head_content = list() /// HTML content of the browser datum var/list/content = list() /datum/browser/New(nuser, nwindow_id, ntitle = 0, nwidth = 0, nheight = 0, atom/atom = null) user = nuser RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(user_deleted)) window_id = nwindow_id if(ntitle) title = format_text(ntitle) if(nwidth) width = nwidth if(nheight) height = nheight if(atom) atom_uid = atom.UID() /datum/browser/proc/user_deleted(datum/source) SIGNAL_HANDLER user = null /datum/browser/proc/set_title(ntitle) title = islist(ntitle) ? ntitle : list(ntitle) /datum/browser/proc/add_head_content(nhead_content) head_content = islist(nhead_content) ? nhead_content : list(nhead_content) /datum/browser/proc/set_window_options(nwindow_options) window_options = islist(nwindow_options) ? nwindow_options : list(nwindow_options) /datum/browser/proc/add_stylesheet(name, file) if(istype(name, /datum/asset/spritesheet)) var/datum/asset/spritesheet/sheet = name stylesheets["spritesheet_[sheet.name].css"] = "data/spritesheets/[sheet.name]" else var/asset_name = "[name].css" stylesheets[asset_name] = file if(!SSassets.cache[asset_name]) SSassets.transport.register_asset(asset_name, file) /datum/browser/proc/add_scss_stylesheet(name, file) var/asset_name = "[name].scss" stylesheets[asset_name] = file if(!SSassets.cache[asset_name]) SSassets.transport.register_asset(asset_name, file) /datum/browser/proc/add_script(name, file) scripts["[ckey(name)].js"] = file SSassets.transport.register_asset("[ckey(name)].js", file) /datum/browser/proc/set_content(ncontent) content = islist(ncontent) ? ncontent : list(ncontent) /datum/browser/proc/add_content(ncontent) content += ncontent /datum/browser/proc/get_header() if(include_default_stylesheet) head_content += "" for(var/file in stylesheets) head_content += "" for(var/file in scripts) head_content += "" return {"
[head_content.Join("")]