From 6f63303781d7495ef5a579e6a7a61263d380fc9d Mon Sep 17 00:00:00 2001 From: HelloZeroNet Date: Wed, 16 Mar 2016 00:35:36 +0100 Subject: [PATCH] More reliable globe loading --- plugins/Sidebar/media/Sidebar.coffee | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/Sidebar/media/Sidebar.coffee b/plugins/Sidebar/media/Sidebar.coffee index 45b4c3cf..1cf6e68a 100644 --- a/plugins/Sidebar/media/Sidebar.coffee +++ b/plugins/Sidebar/media/Sidebar.coffee @@ -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], '
'+res+'
') # @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,8 +346,7 @@ 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() + @displayGlobe() ), 600