mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 14:11:23 -04:00
Fix ui.coffee debug mode message log
This commit is contained in:
parent
889b3fee98
commit
e0081ea954
3 changed files with 10 additions and 9 deletions
|
@ -13,8 +13,8 @@ class UI
|
|||
|
||||
constructor: ->
|
||||
@$badge = document.getElementById('badge')
|
||||
debug = !@$badge
|
||||
return if !debug
|
||||
@debug = null == @$badge
|
||||
return if !@debug
|
||||
|
||||
# Setup other DOM handlers if it's debug mode.
|
||||
@$status = document.getElementById('status')
|
||||
|
@ -26,15 +26,16 @@ class UI
|
|||
|
||||
@$input = document.getElementById('input')
|
||||
@$input.focus()
|
||||
@$input.onkeydown = (e) -> @$send.onclick() if 13 == e.keyCode # enter
|
||||
@$input.onkeydown = (e) =>
|
||||
@$send.onclick() if 13 == e.keyCode # enter
|
||||
|
||||
# Status bar
|
||||
setStatus: (msg) =>
|
||||
return if !debug
|
||||
return if !@debug
|
||||
@$status.innerHTML = 'Status: ' + msg
|
||||
|
||||
setActive: (connected) =>
|
||||
if debug
|
||||
if @debug
|
||||
@$msglog.className = if connected then 'active' else ''
|
||||
else
|
||||
@$badge.className = if connected then 'active' else ''
|
||||
|
@ -55,7 +56,7 @@ class UI
|
|||
@$input.focus()
|
||||
|
||||
log: (msg) =>
|
||||
return if !debug
|
||||
return if !@debug
|
||||
# Scroll to latest
|
||||
@$msglog.value += msg + '\n'
|
||||
@$msglog.scrollTop = @$msglog.scrollHeight
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue