More reliable globe loading

This commit is contained in:
HelloZeroNet 2016-03-16 00:35:36 +01:00
parent 5a234745fc
commit 6f63303781

View file

@ -107,11 +107,15 @@ class Sidebar extends Class
@setSiteInfo(site_info)
@original_set_site_info.apply(wrapper, arguments)
setSiteInfo: (site_info) ->
RateLimit 1000, =>
@updateHtmlTag()
@displayGlobe()
# Preload world.jpg
img = new Image();
img.src = "/uimedia/globe/world.jpg";
setSiteInfo: (site_info) ->
RateLimit 3000, =>
@updateHtmlTag()
RateLimit 30000, =>
@displayGlobe()
# Create the sidebar html tag
createHtmltag: ->
@ -133,6 +137,7 @@ class Sidebar extends Class
@log "Creating content"
morphdom(@tag.find(".content")[0], '<div class="content">'+res+'</div>')
# @scrollable()
@when_loaded.resolve()
else # Not first update, patch the html to keep unchanged dom elements
@log "Patching content"
@ -143,7 +148,6 @@ class Sidebar extends Class
else
return true
}
@when_loaded.resolve()
animDrag: (e) =>
@ -342,7 +346,6 @@ class Sidebar extends Class
if typeof(DAT) == "undefined" # Globe script not loaded, do it first
$.getScript("/uimedia/globe/all.js", @displayGlobe)
else
RateLimit 5000, =>
@displayGlobe()
), 600