Regenerate the QR threads list correctly after an index refresh.
This commit is contained in:
parent
553c475768
commit
72b38da3af
@ -39,11 +39,15 @@ QR =
|
|||||||
$.on d, 'dragover', QR.dragOver
|
$.on d, 'dragover', QR.dragOver
|
||||||
$.on d, 'drop', QR.dropFile
|
$.on d, 'drop', QR.dropFile
|
||||||
$.on d, 'dragstart dragend', QR.drag
|
$.on d, 'dragstart dragend', QR.drag
|
||||||
$.on d, 'ThreadUpdate', ->
|
switch g.VIEW
|
||||||
if g.DEAD
|
when 'index'
|
||||||
QR.abort()
|
$.on d, 'IndexRefresh', QR.generatePostableThreadsList
|
||||||
else
|
when 'thread'
|
||||||
QR.status()
|
$.on d, 'ThreadUpdate', ->
|
||||||
|
if g.DEAD
|
||||||
|
QR.abort()
|
||||||
|
else
|
||||||
|
QR.status()
|
||||||
|
|
||||||
QR.persist() if Conf['Persistent QR']
|
QR.persist() if Conf['Persistent QR']
|
||||||
|
|
||||||
@ -796,6 +800,24 @@ QR =
|
|||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
|
generatePostableThreadsList: ->
|
||||||
|
list = QR.nodes.thread
|
||||||
|
options = [list.firstChild]
|
||||||
|
for thread of g.BOARD.threads
|
||||||
|
options.push $.el 'option',
|
||||||
|
value: thread
|
||||||
|
textContent: "Thread No.#{thread}"
|
||||||
|
val = list.value
|
||||||
|
$.rmAll list
|
||||||
|
$.add list, options
|
||||||
|
list.value = val
|
||||||
|
return unless list.value
|
||||||
|
# Fix the value if the option disappeared.
|
||||||
|
list.value = if g.VIEW is 'thread'
|
||||||
|
g.THREADID
|
||||||
|
else
|
||||||
|
'new'
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
dialog = UI.dialog 'qr', 'top:0;right:0;', """
|
dialog = UI.dialog 'qr', 'top:0;right:0;', """
|
||||||
<%= grunt.file.read('html/Posting/QR.html').replace(/>\s+</g, '><').trim() %>
|
<%= grunt.file.read('html/Posting/QR.html').replace(/>\s+</g, '><').trim() %>
|
||||||
@ -867,12 +889,6 @@ QR =
|
|||||||
nodes.flag.dataset.default = '0'
|
nodes.flag.dataset.default = '0'
|
||||||
$.add nodes.form, nodes.flag
|
$.add nodes.form, nodes.flag
|
||||||
|
|
||||||
# Make a list of threads.
|
|
||||||
for thread of g.BOARD.threads
|
|
||||||
$.add nodes.thread, $.el 'option',
|
|
||||||
value: thread
|
|
||||||
textContent: "Thread No.#{thread}"
|
|
||||||
|
|
||||||
<% if (type === 'userscript') { %>
|
<% if (type === 'userscript') { %>
|
||||||
# XXX Firefox lacks focusin/focusout support.
|
# XXX Firefox lacks focusin/focusout support.
|
||||||
for elm in $$ '*', QR.nodes.el
|
for elm in $$ '*', QR.nodes.el
|
||||||
@ -906,6 +922,7 @@ QR =
|
|||||||
$.set 'QR Size', @style.cssText
|
$.set 'QR Size', @style.cssText
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
QR.generatePostableThreadsList()
|
||||||
QR.persona.init()
|
QR.persona.init()
|
||||||
new QR.post true
|
new QR.post true
|
||||||
QR.status()
|
QR.status()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user