Sidebar optimization and dummy static page for uncoming internal page

This commit is contained in:
shortcutme 2018-09-17 15:33:45 +02:00
parent 53a40fa914
commit d44a4e8ae2
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
6 changed files with 464 additions and 114 deletions

View file

@ -0,0 +1,60 @@
class Internals extends Class
constructor: (@sidebar) ->
@tag = null
@opened = false
if window.top.location.hash == "#internals"
setTimeout (=> @open()), 10
createHtmltag: ->
@when_loaded = $.Deferred()
if not @container
@container = $("""
<div class="internals-container">
<div class="internals"><div class="internals-middle">
<div class="mynode"></div>
<div class="peers">
<div class="peer"><div class="line"></div><a href="#" class="icon">\u25BD</div></div>
</div>
</div></div>
</div>
""")
@container.appendTo(document.body)
@tag = @container.find(".internals")
open: =>
@createHtmltag()
@sidebar.fixbutton_targety = @sidebar.page_height
@stopDragY()
onOpened: =>
@sidebar.onClosed()
@log "onOpened"
onClosed: =>
$(document.body).removeClass("body-internals")
stopDragY: =>
# Animate sidebar and iframe
if @sidebar.fixbutton_targety == @sidebar.fixbutton_inity
# Closed
targety = 0
@opened = false
else
# Opened
targety = @sidebar.fixbutton_targety - @sidebar.fixbutton_inity
@onOpened()
@opened = true
# Revent sidebar transitions
if @tag
@tag.css("transition", "0.5s ease-out")
@tag.css("transform", "translateY(#{targety}px)").one transitionEnd, =>
@tag.css("transition", "")
if not @opened
@log "cleanup"
# Revert body transformations
@log "stopdrag", "opened:", @opened, targety
if not @opened
@onClosed()
window.Internals = Internals