Fix QR remembering the spoiler state.

This commit is contained in:
Nicolas Stepien 2013-04-13 19:04:56 +02:00
parent 25b37552f1
commit 7f949af905
2 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,6 @@
- Fix QR remembering the file spoiler state when it shouldn't.
- Fix QR cooldown in Opera.
### 3.0.4 - *2013-04-11* ### 3.0.4 - *2013-04-11*
- More minor fixes. - More minor fixes.

View File

@ -367,8 +367,6 @@ QR =
spoiler: $ 'input', el spoiler: $ 'input', el
span: el.lastChild span: el.lastChild
@nodes.spoiler.checked = @spoiler
$.on el, 'click', @select.bind @ $.on el, 'click', @select.bind @
$.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm() $.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm()
$.on @nodes.label, 'click', (e) => e.stopPropagation() $.on @nodes.label, 'click', (e) => e.stopPropagation()
@ -382,7 +380,7 @@ QR =
prev = QR.posts[QR.posts.length - 1] prev = QR.posts[QR.posts.length - 1]
QR.posts.push @ QR.posts.push @
@spoiler = if prev and Conf['Remember Spoiler'] @nodes.spoiler.checked = @spoiler = if prev and Conf['Remember Spoiler']
prev.spoiler prev.spoiler
else else
false false
@ -442,6 +440,9 @@ QR =
@showFileData() @showFileData()
QR.characterCount() QR.characterCount()
save: (input) -> save: (input) ->
if input.type is 'checkbox'
@spoiler = input.checked
return
{value} = input {value} = input
@[input.dataset.name] = value @[input.dataset.name] = value
return if input.nodeName isnt 'TEXTAREA' return if input.nodeName isnt 'TEXTAREA'
@ -455,7 +456,7 @@ QR =
return unless @ is QR.selected return unless @ is QR.selected
# Do this in case people use extensions # Do this in case people use extensions
# that do not trigger the `input` event. # that do not trigger the `input` event.
for name in ['name', 'email', 'sub', 'com'] for name in ['name', 'email', 'sub', 'com', 'spoiler']
@save QR.nodes[name] @save QR.nodes[name]
return return
setFile: (@file) -> setFile: (@file) ->
@ -536,7 +537,7 @@ QR =
@showFileData() @showFileData()
return unless window.URL return unless window.URL
URL.revokeObjectURL @URL URL.revokeObjectURL @URL
showFileData: (hide) -> showFileData: ->
if @file if @file
QR.nodes.filename.textContent = @filename QR.nodes.filename.textContent = @filename
QR.nodes.filename.title = @filename QR.nodes.filename.title = @filename