made buttons only icons and fixed that infinite loading thingy

This commit is contained in:
Paul Ritter
2019-05-12 23:01:58 +02:00
parent c839baa044
commit a06c13c701
2 changed files with 18 additions and 22 deletions

View File

@@ -516,33 +516,31 @@ Crew Monitor by Paul, based on the holomaps by Deity
var/uid = "\ref[usr]"
if(href_list["close"])
closeTextview(usr)
return
if(href_list["toggle"])
else if(href_list["toggle"])
textview_updatequeued[uid] = !textview_updatequeued[uid]
var/datum/nanoui/ui = nanomanager.get_open_ui(usr, src, "textview")
if(ui)
ui.send_message("toggleUpdatebtn")
ui.send_message("toggleUpdatebtn", list2params(list(json_encode(textview_updatequeued[uid])))) //using the actual setting sorts out any btn icon sync issues
updateTextView(usr)
return
if(href_list["holo"])
else if(href_list["holo"])
holomap[uid] = !holomap[uid]
var/datum/nanoui/ui = nanomanager.get_open_ui(usr, src, "textview")
if(ui)
ui.send_message("toggleHolobtn")
processUser(usr) //to remove/add the holomap and update the textview
return
if(href_list["setZ"])
else if(href_list["setZ"])
var/num = href_list["setZ"]
if(!isnum(num))
num = text2num(num)
if(!num)
return //something fucked up
return 1//something fucked up
holomap_z[uid] = num
var/datum/nanoui/ui = nanomanager.get_open_ui(usr, src, "textview")
if(ui)
ui.send_message("levelSet", list2params(list(num))) //feedback
processUser(usr) //we need to update both the holomap AND the textview
return 1
//updates the textview, called every process() when enabled
/obj/machinery/computer/crew/proc/updateTextView(var/mob/user)
@@ -607,7 +605,6 @@ Crew Monitor by Paul, based on the holomaps by Deity
ui.add_stylesheet("cmc.css")
var/list/i_data = list()
i_data["update"] = textview_updatequeued[uid]
i_data["holo"] = holomap[uid]
i_data["levels"] = sortList(holomap_z_levels_mapped | holomap_z_levels_unmapped, cmp=/proc/cmp_numeric_asc)
ui.set_initial_data(i_data)
ui.open()

View File

@@ -9,16 +9,9 @@ Used In File(s): \code\modules\cmc\crew.dm
</head>
<body>
<kbd>
{{if data.update}}
{{:helper.link('Disable Updating', '', { 'toggle' : 1 }, null, 'cmc_btn', 'update_btn')}}
{{else}}
{{:helper.link('Enable Updating', '', { 'toggle' : 1 }, null, 'cmc_btn', 'update_btn')}}
{{/if}}
{{if data.holo}}
{{:helper.link('Disable Holomap', '', { 'holo' : 1 }, null, 'cmc_btn', 'holo_btn')}}
{{else}}
{{:helper.link('Enable Holomap', '', { 'holo' : 1 }, null, 'cmc_btn', 'holo_btn')}}
{{/if}}
{{:helper.link('', 'refresh', { 'toggle' : 1 }, null, 'cmc_btn', 'update_btn_sync')}}
{{:helper.link('', 'stop', { 'toggle' : 1 }, null, 'cmc_btn', 'update_btn_freeze')}}
{{:helper.link('', 'image', { 'holo' : 1 }, null, 'cmc_btn', 'holo_btn')}}
{{for data.levels}}
{{:helper.link(value, '', { 'setZ' : value }, null, 'cmc_btn', value)}}
{{/for}}
@@ -61,9 +54,14 @@ Used In File(s): \code\modules\cmc\crew.dm
btn.text((btn.text() == "Disable Holomap") ? "Enable Holomap" : "Disable Holomap");
}
function toggleUpdatebtn(){
var btn = $("#update_btn");
btn.text((btn.text() == "Disable Updating") ? "Enable Updating" : "Disable Updating");
function toggleUpdatebtn(num){
if(num){
$("#update_btn_sync").show();
$("#update_btn_freeze").hide();
}else{
$("#update_btn_sync").hide();
$("#update_btn_freeze").show();
}
}
function levelSet(level){
@@ -77,6 +75,7 @@ Used In File(s): \code\modules\cmc\crew.dm
}
levelSet(prevlevel);
toggleUpdatebtn({{:data.update}});
</script>
</body>
</html>