mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 02:33:08 +02:00
Remove unused mixin
This commit is contained in:
parent
1817b3e6c3
commit
8b89a9eb22
2 changed files with 0 additions and 59 deletions
|
@ -39,6 +39,3 @@ module.exports = (me) ~>
|
||||||
|
|
||||||
riot.mixin \autocomplete do
|
riot.mixin \autocomplete do
|
||||||
Autocomplete: require './scripts/autocomplete'
|
Autocomplete: require './scripts/autocomplete'
|
||||||
|
|
||||||
riot.mixin \follow-scroll do
|
|
||||||
Follower: require './scripts/follow-scroll.ls'
|
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
class Follower
|
|
||||||
(el) ->
|
|
||||||
@follower = el
|
|
||||||
@last-scroll-top = window.scroll-y
|
|
||||||
@initial-follower-top = @follower.get-bounding-client-rect!.top
|
|
||||||
@page-top = 48
|
|
||||||
|
|
||||||
follow: ->
|
|
||||||
window-height = window.inner-height
|
|
||||||
follower-height = @follower.offset-height
|
|
||||||
|
|
||||||
scroll-top = window.scroll-y
|
|
||||||
scroll-bottom = scroll-top + window-height
|
|
||||||
|
|
||||||
follower-top = @follower.get-bounding-client-rect!.top + scroll-top
|
|
||||||
follower-bottom = follower-top + follower-height
|
|
||||||
|
|
||||||
height-delta = Math.abs window-height - follower-height
|
|
||||||
scroll-delta = @last-scroll-top - scroll-top
|
|
||||||
|
|
||||||
is-scrolling-down = (scroll-top > @last-scroll-top)
|
|
||||||
is-window-larger = (window-height > follower-height)
|
|
||||||
|
|
||||||
console.log @initial-follower-top
|
|
||||||
|
|
||||||
if (is-window-larger && scroll-top > @initial-follower-top) || (!is-window-larger && scroll-top > @initial-follower-top + height-delta)
|
|
||||||
@follower.class-list.add \fixed
|
|
||||||
else if !is-scrolling-down && scroll-top + @page-top <= @initial-follower-top
|
|
||||||
@follower.class-list.remove \fixed
|
|
||||||
@follower.style.top = 0
|
|
||||||
return
|
|
||||||
|
|
||||||
drag-bottom-down = (follower-bottom <= scroll-bottom && is-scrolling-down)
|
|
||||||
drag-top-up = (follower-top >= scroll-top + @page-top && !is-scrolling-down)
|
|
||||||
|
|
||||||
if drag-bottom-down
|
|
||||||
console.log \down
|
|
||||||
@follower.style.top = if is-window-larger then 0 else -height-delta + \px
|
|
||||||
else if drag-top-up
|
|
||||||
console.log \up
|
|
||||||
@follower.style.top = @page-top + \px
|
|
||||||
else if @follower.class-list.contains \fixed
|
|
||||||
console.log \-
|
|
||||||
current-top = parse-int @follower.style.top, 10
|
|
||||||
|
|
||||||
min-top = -height-delta
|
|
||||||
scrolled-top = current-top + scroll-delta
|
|
||||||
|
|
||||||
is-page-at-bottom = (scroll-top + window-height >= document.body.offset-height)
|
|
||||||
new-top = if is-page-at-bottom then min-top else scrolled-top
|
|
||||||
|
|
||||||
@follower.style.top = new-top + \px
|
|
||||||
|
|
||||||
@last-scroll-top = scroll-top
|
|
||||||
|
|
||||||
module.exports = Follower
|
|
Loading…
Reference in a new issue