Minor optimizations to improve boot performance

pull/417/head
Thibaut Courouble 9 years ago
parent 2e915c135a
commit 18199101d7

@ -36,7 +36,8 @@ class app.views.Search extends app.View
return
focus: ->
@input.focus() unless document.activeElement is @input
@delay =>
@input.focus() unless document.activeElement is @input
return
autoFocus: =>

@ -23,7 +23,7 @@ class app.views.Sidebar extends app.View
@docList = new app.views.DocList
@docPicker = new app.views.DocPicker unless app.isSingleDoc()
app.on 'ready', @showDocList
app.on 'ready', @onReady
$.on document, 'click', @onGlobalClick if @docPicker
return
@ -32,13 +32,18 @@ class app.views.Sidebar extends app.View
@hover?.hide()
@saveScrollPosition()
@view?.deactivate()
@html @view = view
@append @tmpl('sidebarSettings') if @view is @docList and @docPicker
@view = view
@render()
@view.activate()
@restoreScrollPosition()
if view is @docPicker then @search.disable() else @search.enable()
return
render: ->
@html @view
@append @tmpl('sidebarSettings') if @view is @docList and @docPicker
return
showDocList: (reset) =>
@show @docList
if reset is true
@ -54,6 +59,11 @@ class app.views.Sidebar extends app.View
@show @results
return
onReady: =>
@view = @docList
@render()
@view.activate()
reset: ->
@showDocList true
return

@ -17,10 +17,6 @@ class app.views.SidebarHover extends app.View
delete @constructor.events.mouseover
super
init: ->
@offsetTop = @el.offsetTop
return
show: (el) ->
unless el is @cursor
@hide()
@ -28,6 +24,7 @@ class app.views.SidebarHover extends app.View
@cursor = el
@clone = @makeClone @cursor
$.append document.body, @clone
@offsetTop ?= @el.offsetTop
@position()
return

Loading…
Cancel
Save