|
|
@ -51,6 +51,9 @@ class app.views.Content extends app.View
|
|
|
|
@addClass @constructor.loadingClass
|
|
|
|
@addClass @constructor.loadingClass
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isLoading: ->
|
|
|
|
|
|
|
|
@el.classList.contains @constructor.loadingClass
|
|
|
|
|
|
|
|
|
|
|
|
hideLoading: ->
|
|
|
|
hideLoading: ->
|
|
|
|
@removeClass @constructor.loadingClass
|
|
|
|
@removeClass @constructor.loadingClass
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -92,12 +95,14 @@ class app.views.Content extends app.View
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
scrollToTarget: ->
|
|
|
|
scrollToTarget: ->
|
|
|
|
|
|
|
|
return if @isLoading()
|
|
|
|
if @routeCtx.hash and el = @findTargetByHash @routeCtx.hash
|
|
|
|
if @routeCtx.hash and el = @findTargetByHash @routeCtx.hash
|
|
|
|
$.scrollToWithImageLock el, @scrollEl, 'top',
|
|
|
|
$.scrollToWithImageLock el, @scrollEl, 'top',
|
|
|
|
margin: 20 + if @scrollEl is @el then 0 else $.offset(@el).top
|
|
|
|
margin: 20 + if @scrollEl is @el then 0 else $.offset(@el).top
|
|
|
|
$.highlight el, className: '_highlight'
|
|
|
|
$.highlight el, className: '_highlight'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@scrollTo @scrollMap[@routeCtx.state.id]
|
|
|
|
@scrollTo @scrollMap[@routeCtx.state.id]
|
|
|
|
|
|
|
|
clearTimeout @scrollTimeout
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
onReady: =>
|
|
|
|
onReady: =>
|
|
|
@ -121,7 +126,7 @@ class app.views.Content extends app.View
|
|
|
|
beforeRoute: (context) =>
|
|
|
|
beforeRoute: (context) =>
|
|
|
|
@cacheScrollPosition()
|
|
|
|
@cacheScrollPosition()
|
|
|
|
@routeCtx = context
|
|
|
|
@routeCtx = context
|
|
|
|
@delay @scrollToTarget
|
|
|
|
@scrollTimeout = @delay @scrollToTarget
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
cacheScrollPosition: ->
|
|
|
|
cacheScrollPosition: ->
|
|
|
|