Rev949, Newsfeed allows items 2min from future, Switch sidebar content.json list to input for faster opening, Promise based sidebar rendering to make it more reliable on slow connections, RateLimit sidebar globe updating, Some PEP8 formatting

This commit is contained in:
HelloZeroNet 2016-03-06 19:28:22 +01:00
parent bfdccb809c
commit 2901f1e1ba
7 changed files with 77 additions and 27 deletions

View file

@ -114,6 +114,7 @@ class Sidebar extends Class
# Create the sidebar html tag
createHtmltag: ->
@when_loaded = $.Deferred()
if not @container
@container = $("""
<div class="sidebar-container"><div class="sidebar scrollable"><div class="content-wrapper"><div class="content">
@ -141,6 +142,7 @@ class Sidebar extends Class
else
return true
}
@when_loaded.resolve()
animDrag: (e) =>
@ -195,7 +197,8 @@ class Sidebar extends Class
# Opened
targetx = @width
if not @opened
@onOpened()
@when_loaded.done =>
@onOpened()
@opened = true
# Revent sidebar transitions
@ -265,7 +268,7 @@ class Sidebar extends Class
# Sign content.json
@tag.find("#button-sign").off("click").on "click", =>
inner_path = @tag.find("#select-contents").val()
inner_path = @tag.find("#input-contents").val()
if wrapper.site_info.privatekey
# Privatekey stored in users.json
@ -304,12 +307,14 @@ class Sidebar extends Class
loadGlobe: =>
console.log "loadGlobe", @tag.find(".globe").hasClass("loading")
if @tag.find(".globe").hasClass("loading")
setTimeout (=>
if typeof(DAT) == "undefined" # Globe script not loaded, do it first
$.getScript("/uimedia/globe/all.js", @displayGlobe)
else
@displayGlobe()
RateLimit 5000, =>
@displayGlobe()
), 600