validation on dynamic mode settings
This commit is contained in:
parent
cf441952a3
commit
8ef84f2f08
2 changed files with 9 additions and 2 deletions
|
|
@ -188,7 +188,9 @@ renderSettings = ->
|
|||
"future-size": "dynamic_future"
|
||||
for html_id, server_key of stuff
|
||||
$text_box = $settings.find("#" + html_id)
|
||||
$text_box.val(server_status[server_key])
|
||||
serverStatusNumber = (n) -> if n is -1 then "Infinity" else n
|
||||
value = serverStatusNumber server_status[server_key]
|
||||
$text_box.val value
|
||||
$text_box.on 'keydown', (event) ->
|
||||
html_id = $(event.target).attr("id")
|
||||
server_key = stuff[html_id]
|
||||
|
|
@ -207,7 +209,7 @@ renderSettings = ->
|
|||
return false
|
||||
if cancel
|
||||
Util.wait 0, ->
|
||||
$(event.target).val(server_status[server_key])
|
||||
$(event.target).val(serverStatusNumber server_status[server_key])
|
||||
return false
|
||||
|
||||
scrollChatWindowToBottom = ->
|
||||
|
|
|
|||
|
|
@ -51,10 +51,13 @@ exports.Plugin = class DynamicMode extends Plugin
|
|||
when "dynamic_history"
|
||||
continue if @history_size is value
|
||||
did_anything = true
|
||||
if value < 0
|
||||
value = -1
|
||||
@history_size = value
|
||||
when "dynamic_future"
|
||||
continue if @future_size is value
|
||||
did_anything = true
|
||||
value = Math.min(1000, Math.max(1, value))
|
||||
@future_size = value
|
||||
if did_anything
|
||||
@checkDynamicMode()
|
||||
|
|
@ -89,6 +92,8 @@ exports.Plugin = class DynamicMode extends Plugin
|
|||
if @is_on
|
||||
commands = []
|
||||
delete_count = Math.max(current_index - @history_size, 0)
|
||||
if @history_size < 0
|
||||
delete_count = 0
|
||||
for i in [0...delete_count]
|
||||
commands.push "deleteid #{item_list[i].id}"
|
||||
add_count = Math.max(@future_size + 1 - (item_list.length - current_index), 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue