mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Fix single-doc mode detection
This commit is contained in:
parent
4217e79198
commit
aed8f22c99
5 changed files with 7 additions and 4 deletions
|
@ -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.
|
||||
|
|
|
@ -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: ->
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue