Fix single-doc mode detection

This commit is contained in:
Thibaut 2013-11-11 22:05:58 +01:00
parent 4217e79198
commit aed8f22c99
5 changed files with 7 additions and 4 deletions

View file

@ -145,6 +145,9 @@
getComputedStyle(document.querySelector('._header')).backgroundImage isnt 'none'
catch
isSingleDoc: ->
!!(@DOC or @doc)
isMobile: ->
# Need to sniff the user agent because some Android and Windows Phone devices don't take
# resolution (dpi) into account when reporting device width/height.

View file

@ -23,7 +23,7 @@ class app.views.RootPage extends app.View
return
isHidden: ->
app.doc or app.store.get 'hideIntro'
app.isSingleDoc() or app.store.get 'hideIntro'
onRoute: ->

View file

@ -23,7 +23,7 @@ class app.views.Document extends app.View
app.router.show '/help#shortcuts'
onEscape: ->
if app.doc then window.location = '/' else app.router.show '/'
if app.isSingleDoc() then window.location = '/' else app.router.show '/'
onBack: ->
history.back()

View file

@ -31,7 +31,7 @@ class app.views.DocList extends app.View
render: =>
@html @tmpl('sidebarDoc', app.docs.all())
unless app.doc or app.settings.hasDocs()
unless app.isSingleDoc() or app.settings.hasDocs()
@append @tmpl('sidebarDoc', app.disabledDocs.all(), disabled: true)
return

View file

@ -16,7 +16,7 @@ class app.views.Sidebar extends app.View
@results = new app.views.Results @search
@docList = new app.views.DocList
@docPicker = new app.views.DocPicker unless app.doc
@docPicker = new app.views.DocPicker unless app.isSingleDoc()
app.on 'ready', @showDocList
$.on document, 'click', @onGlobalClick if @docPicker