version 0.2.8, Namecoin domains using internal resolver site, --disable_zeromq option to skip backward compatiblity layer and save some memory, connectionserver firstchar error fixes, missing unpacker crash fix, sitemanager class to allow extensions, add loaded plugin list to websocket api, faster content publishing, mark updating file as bad, remove coppersurfer tracker add eddie4, internal server error with error displaying, allow site domains in UiRequest, better progress bar, wait for siteinfo before before using localstorage, csslater hide only if opacity is 0

This commit is contained in:
HelloZeroNet 2015-03-30 23:44:29 +02:00
parent 78f97dcbe8
commit b122f47100
26 changed files with 673 additions and 124 deletions

View file

@ -7,7 +7,8 @@ class Loading
$(".progressbar").css("width", percent*100+"%").css("opacity", "1").css("display", "block")
hideProgress: ->
$(".progressbar").css("width", "100%").css("opacity", "0").cssLater("display", "none", 1000)
console.log "hideProgress"
$(".progressbar").css("width", "100%").css("opacity", "0").hideLater(1000)
showScreen: ->

View file

@ -17,10 +17,12 @@ class Wrapper
@ws_error = null # Ws error message
@site_info = null # Hold latest site info
@event_site_info = $.Deferred() # Event when site_info received
@inner_loaded = false # If iframe loaded or not
@inner_ready = false # Inner frame ready to receive messages
@wrapperWsInited = false # Wrapper notified on websocket open
@site_error = null # Latest failed file download
@address = null
window.onload = @onLoad # On iframe loaded
$(window).on "hashchange", => # On hash change
@ -47,7 +49,7 @@ class Wrapper
@ws.response message.id, res
else if cmd == "setSiteInfo"
@sendInner message # Pass to inner frame
if message.params.address == window.address # Current page
if message.params.address == @address # Current page
@setSiteInfo message.params
else if cmd == "updating" # Close connection
@ws.ws.close()
@ -159,13 +161,14 @@ class Wrapper
actionGetLocalStorage: (message) ->
data = localStorage.getItem "site.#{window.address}"
if data then data = JSON.parse(data)
@sendInner {"cmd": "response", "to": message.id, "result": data}
$.when(@event_site_info).done =>
data = localStorage.getItem "site.#{@site_info.address}"
if data then data = JSON.parse(data)
@sendInner {"cmd": "response", "to": message.id, "result": data}
actionSetLocalStorage: (message) ->
back = localStorage.setItem "site.#{window.address}", JSON.stringify(message.params)
back = localStorage.setItem "site.#{@site_info.address}", JSON.stringify(message.params)
# EOF actions
@ -221,7 +224,9 @@ class Wrapper
# Get site info from UiServer
reloadSiteInfo: ->
@ws.cmd "siteInfo", {}, (site_info) =>
@address = site_info.address
@setSiteInfo site_info
window.document.title = site_info.content.title+" - ZeroNet"
@log "Setting title to", window.document.title
@ -282,6 +287,7 @@ class Wrapper
@loading.hideProgress()
@site_info = site_info
@event_site_info.resolve()
toHtmlSafe: (values) ->

View file

@ -214,7 +214,9 @@ jQuery.fx.step.scale = function(fx) {
}
elem = this;
setTimeout((function() {
return elem.css("display", "none");
if (elem.css("opacity") === 0) {
return elem.css("display", "none");
}
}), time);
return this;
};
@ -474,7 +476,8 @@ jQuery.extend( jQuery.easing,
};
Loading.prototype.hideProgress = function() {
return $(".progressbar").css("width", "100%").css("opacity", "0").cssLater("display", "none", 1000);
console.log("hideProgress");
return $(".progressbar").css("width", "100%").css("opacity", "0").hideLater(1000);
};
Loading.prototype.showScreen = function() {
@ -660,7 +663,6 @@ jQuery.extend( jQuery.easing,
}).call(this);
/* ---- src/Ui/media/Sidebar.coffee ---- */
@ -756,10 +758,12 @@ jQuery.extend( jQuery.easing,
this.ws.connect();
this.ws_error = null;
this.site_info = null;
this.event_site_info = $.Deferred();
this.inner_loaded = false;
this.inner_ready = false;
this.wrapperWsInited = false;
this.site_error = null;
this.address = null;
window.onload = this.onLoad;
$(window).on("hashchange", (function(_this) {
return function() {
@ -794,7 +798,7 @@ jQuery.extend( jQuery.easing,
})(this));
} else if (cmd === "setSiteInfo") {
this.sendInner(message);
if (message.params.address === window.address) {
if (message.params.address === this.address) {
return this.setSiteInfo(message.params);
}
} else if (cmd === "updating") {
@ -947,21 +951,25 @@ jQuery.extend( jQuery.easing,
};
Wrapper.prototype.actionGetLocalStorage = function(message) {
var data;
data = localStorage.getItem("site." + window.address);
if (data) {
data = JSON.parse(data);
}
return this.sendInner({
"cmd": "response",
"to": message.id,
"result": data
});
return $.when(this.event_site_info).done((function(_this) {
return function() {
var data;
data = localStorage.getItem("site." + _this.site_info.address);
if (data) {
data = JSON.parse(data);
}
return _this.sendInner({
"cmd": "response",
"to": message.id,
"result": data
});
};
})(this));
};
Wrapper.prototype.actionSetLocalStorage = function(message) {
var back;
return back = localStorage.setItem("site." + window.address, JSON.stringify(message.params));
return back = localStorage.setItem("site." + this.site_info.address, JSON.stringify(message.params));
};
Wrapper.prototype.onOpenWebsocket = function(e) {
@ -1032,6 +1040,7 @@ jQuery.extend( jQuery.easing,
Wrapper.prototype.reloadSiteInfo = function() {
return this.ws.cmd("siteInfo", {}, (function(_this) {
return function(site_info) {
_this.address = site_info.address;
_this.setSiteInfo(site_info);
window.document.title = site_info.content.title + " - ZeroNet";
return _this.log("Setting title to", window.document.title);
@ -1108,7 +1117,8 @@ jQuery.extend( jQuery.easing,
} else {
this.loading.hideProgress();
}
return this.site_info = site_info;
this.site_info = site_info;
return this.event_site_info.resolve();
};
Wrapper.prototype.toHtmlSafe = function(values) {
@ -1154,4 +1164,4 @@ jQuery.extend( jQuery.easing,
window.wrapper = new Wrapper(ws_url);
}).call(this);
}).call(this);

View file

@ -16,7 +16,8 @@ jQuery.fn.removeLater = (time = 500) ->
jQuery.fn.hideLater = (time = 500) ->
elem = @
setTimeout ( ->
elem.css("display", "none")
if elem.css("opacity") == 0
elem.css("display", "none")
), time
return @