Reflow a ton of navigate and index shit to fix broken shit
Conflicts: builds/4chan-X.user.js builds/crx/script.js src/General/Index.coffee src/General/Navigate.coffee src/Posting/QR.coffee
This commit is contained in:
parent
1e682f9306
commit
298bed6336
@ -84,31 +84,26 @@ Navigate =
|
||||
error: err
|
||||
]
|
||||
Main.handleErrors error if error
|
||||
QR.generatePostableThreadsList()
|
||||
|
||||
updateContext: (view) ->
|
||||
g.DEAD = false
|
||||
g.DEAD = false
|
||||
g.THREADID = +window.location.pathname.split('/')[3] if view is 'thread'
|
||||
|
||||
unless view is g.VIEW
|
||||
$.rmClass doc, g.VIEW
|
||||
$.addClass doc, view
|
||||
return if view is g.VIEW
|
||||
|
||||
$.rmClass doc, g.VIEW
|
||||
$.addClass doc, view
|
||||
|
||||
oldView = g.VIEW
|
||||
g.VIEW = view
|
||||
{
|
||||
index: ->
|
||||
return if oldView is g.VIEW
|
||||
delete g.THREADID
|
||||
QR.link.textContent = 'Start a Thread'
|
||||
$.off d, 'ThreadUpdate', QR.statusCheck
|
||||
$.on d, 'IndexRefresh', QR.generatePostableThreadsList
|
||||
|
||||
thread: ->
|
||||
g.THREADID = +window.location.pathname.split('/')[3]
|
||||
return if oldView is g.VIEW
|
||||
QR.link.textContent = 'Reply to Thread'
|
||||
$.on d, 'ThreadUpdate', QR.statusCheck
|
||||
$.off d, 'IndexRefresh', QR.generatePostableThreadsList
|
||||
}[g.VIEW]()
|
||||
}[view]()
|
||||
|
||||
g.VIEW = view
|
||||
|
||||
updateBoard: (boardID) ->
|
||||
fullBoardList = $ '#full-board-list', Header.boardList
|
||||
@ -138,14 +133,16 @@ Navigate =
|
||||
Navigate.updateSFW !!board.ws_board
|
||||
|
||||
updateSFW: (sfw) ->
|
||||
# TODO: think of a better name for this. Changes style, too.
|
||||
Favicon.el.href = "//s.4cdn.org/image/favicon#{if sfw then '-ws' else ''}.ico"
|
||||
$.add d.head, Favicon.el # Changing the href alone doesn't update the icon on Firefox
|
||||
Favicon.el.href = Favicon.default = "//s.4cdn.org/image/favicon#{if sfw then '-ws' else ''}.ico"
|
||||
|
||||
# Changing the href alone doesn't update the icon on Firefox
|
||||
$.add d.head, Favicon.el
|
||||
|
||||
return if Favicon.SFW is sfw # Board SFW status hasn't changed
|
||||
|
||||
Favicon.SFW = sfw
|
||||
Favicon.update()
|
||||
|
||||
findStyle = (type, base) ->
|
||||
style = d.cookie.match new RegExp "\b#{type}\_style\=([^;]+);\b"
|
||||
return ["#{type}_style", (if style then style[1] else base)]
|
||||
@ -207,11 +204,12 @@ Navigate =
|
||||
g.BOARD = new Board boardID
|
||||
Navigate.title = -> Navigate.updateBoard boardID
|
||||
|
||||
Navigate.updateSFW Favicon.SFW
|
||||
|
||||
if view is 'index'
|
||||
return Index.update pageNum
|
||||
|
||||
|
||||
# Moving from index to thread or thread to thread
|
||||
Navigate.updateSFW Favicon.SFW
|
||||
{load} = Navigate
|
||||
Navigate.req = $.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
|
||||
onabort: load
|
||||
@ -283,6 +281,7 @@ Navigate =
|
||||
Navigate.ready 'Quote Threading', QuoteThreading.force, Conf['Quote Threading'] and not Conf['Unread Count']
|
||||
|
||||
Navigate.buildThread()
|
||||
QR.generatePostableThreadsList()
|
||||
Header.hashScroll.call window
|
||||
|
||||
buildThread: ->
|
||||
|
||||
@ -15,7 +15,6 @@ QR =
|
||||
href: 'javascript:;'
|
||||
$.on sc, 'click', ->
|
||||
if Conf['Persistent QR'] or !QR.nodes or QR.nodes.el.hidden
|
||||
$.event 'CloseMenu'
|
||||
QR.open()
|
||||
QR.nodes.com.focus()
|
||||
$.rmClass @, 'disabled'
|
||||
@ -70,15 +69,14 @@ QR =
|
||||
$.on d, 'dragover', QR.dragOver
|
||||
$.on d, 'drop', QR.dropFile
|
||||
$.on d, 'dragstart dragend', QR.drag
|
||||
{
|
||||
catalog: ->
|
||||
QR.open() if Conf["Persistent QR"]
|
||||
QR.hide() if Conf['Auto Hide QR']
|
||||
index: ->
|
||||
$.on d, 'IndexRefresh', QR.generatePostableThreadsList
|
||||
thread: ->
|
||||
$.on d, 'ThreadUpdate', QR.statusCheck
|
||||
}[g.VIEW]()
|
||||
|
||||
# We can thread update and index refresh without loading a new page, so...
|
||||
$.on d, 'IndexRefresh', QR.generatePostableThreadsList
|
||||
$.on d, 'ThreadUpdate', QR.statusCheck
|
||||
|
||||
return if !Conf['Persistent QR']
|
||||
QR.open()
|
||||
QR.hide() if Conf['Auto-Hide QR']
|
||||
|
||||
statusCheck: ->
|
||||
if g.DEAD
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user