Merged sidebar js

This commit is contained in:
HelloZeroNet 2016-03-16 00:40:37 +01:00
parent f372fe371a
commit 153de04659

View file

@ -294,6 +294,7 @@ window.initScrollable = function () {
}; };
Sidebar.prototype.moved = function() { Sidebar.prototype.moved = function() {
var img;
this.log("Moved"); this.log("Moved");
this.createHtmltag(); this.createHtmltag();
$(document.body).css("perspective", "1000px").addClass("body-sidebar"); $(document.body).css("perspective", "1000px").addClass("body-sidebar");
@ -306,21 +307,27 @@ window.initScrollable = function () {
}; };
})(this)); })(this));
$(window).trigger("resize"); $(window).trigger("resize");
return wrapper.setSiteInfo = (function(_this) { wrapper.setSiteInfo = (function(_this) {
return function(site_info) { return function(site_info) {
_this.setSiteInfo(site_info); _this.setSiteInfo(site_info);
return _this.original_set_site_info.apply(wrapper, arguments); return _this.original_set_site_info.apply(wrapper, arguments);
}; };
})(this); })(this);
img = new Image();
return img.src = "/uimedia/globe/world.jpg";
}; };
Sidebar.prototype.setSiteInfo = function(site_info) { Sidebar.prototype.setSiteInfo = function(site_info) {
RateLimit(1000, (function(_this) { RateLimit(3000, (function(_this) {
return function() { return function() {
return _this.updateHtmlTag(); return _this.updateHtmlTag();
}; };
})(this)); })(this));
return this.displayGlobe(); return RateLimit(30000, (function(_this) {
return function() {
return _this.displayGlobe();
};
})(this));
}; };
Sidebar.prototype.createHtmltag = function() { Sidebar.prototype.createHtmltag = function() {
@ -340,9 +347,10 @@ window.initScrollable = function () {
if (_this.tag.find(".content").children().length === 0) { if (_this.tag.find(".content").children().length === 0) {
_this.log("Creating content"); _this.log("Creating content");
morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>'); morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>');
return _this.when_loaded.resolve();
} else { } else {
_this.log("Patching content"); _this.log("Patching content");
morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>', { return morphdom(_this.tag.find(".content")[0], '<div class="content">' + res + '</div>', {
onBeforeMorphEl: function(from_el, to_el) { onBeforeMorphEl: function(from_el, to_el) {
if (from_el.className === "globe" || from_el.className.indexOf("noupdate") >= 0) { if (from_el.className === "globe" || from_el.className.indexOf("noupdate") >= 0) {
return false; return false;
@ -352,7 +360,6 @@ window.initScrollable = function () {
} }
}); });
} }
return _this.when_loaded.resolve();
}; };
})(this)); })(this));
}; };
@ -586,9 +593,7 @@ window.initScrollable = function () {
if (typeof DAT === "undefined") { if (typeof DAT === "undefined") {
return $.getScript("/uimedia/globe/all.js", _this.displayGlobe); return $.getScript("/uimedia/globe/all.js", _this.displayGlobe);
} else { } else {
return RateLimit(5000, function() { return _this.displayGlobe();
return _this.displayGlobe();
});
} }
}; };
})(this)), 600); })(this)), 600);