diff --git a/src/General/Header.coffee b/src/General/Header.coffee index f2f003cab6..366b1c6d28 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -1,5 +1,12 @@ Header = init: -> + $.onExists doc, 'body', => + return unless Main.isThisPageLegit() + $.add @bar, [@noticesRoot, @toggle] + $.prepend d.body, @bar + $.add d.body, Header.hover + @setBarPosition Conf['Bottom Header'] + @menu = new UI.Menu 'header' menuButton = $.el 'span', @@ -86,12 +93,6 @@ Header = @setBoardList() - $.onExists doc, 'body', => - return unless Main.isThisPageLegit() - $.prepend d.body, @bar - $.add d.body, Header.hover - @setBarPosition Conf['Bottom Header'] - $.onExists doc, "#{g.SITE.selectors.boardList} + *", Header.generateFullBoardList Main.ready -> @@ -154,7 +155,7 @@ Header = btn = $('.hide-board-list-button', boardList) $.on btn, 'click', Header.toggleBoardList - $.add Header.bar, [Header.boardList, Header.shortcuts, Header.noticesRoot, Header.toggle] + $.prepend Header.bar, [Header.boardList, Header.shortcuts] Header.setCustomNav Conf['Custom Board Navigation'] Header.generateBoardList Conf['boardnav'] @@ -392,7 +393,7 @@ Header = Header.previousOffset = offsetY setBarPosition: (bottom) -> - Header.barPositionToggler.checked = bottom + Header.barPositionToggler?.checked = bottom $.event 'CloseMenu' args = if bottom then [ 'bottom-header'