Fix Sidebar button for touch device & CHANGELOG-zh-cn & FreeBSD installation instructions (#916)

* Disallow change optional limit on public proxy

* Add Chinese for Mute plugins

* add FreeBSD installation instructions to README-zh-cn.md

* Fix Sidebar button for touch device

* Add CHANGELOG-zh-cn.md

* Why merging junk left? Remove it!
This commit is contained in:
lmath 2017-05-06 08:13:26 +08:00 committed by ZeroNet
parent e9b2c76a88
commit e42631932b
6 changed files with 178 additions and 38 deletions

View file

@ -42,7 +42,7 @@ class Sidebar extends Class
e.preventDefault()
# Disable previous listeners
@fixbutton.off "click touchstop touchcancel"
@fixbutton.off "click touchend touchcancel"
@fixbutton.off "mousemove touchmove"
# Make sure its not a click
@ -54,7 +54,7 @@ class Sidebar extends Class
@fixbutton_addx = @fixbutton.offset().left-mousex
@startDrag()
@fixbutton.parent().on "click touchstop touchcancel", (e) =>
@fixbutton.parent().on "click touchend touchcancel", (e) =>
@stopDrag()
@resized()
$(window).on "resize", @resized
@ -96,7 +96,7 @@ class Sidebar extends Class
@fixbutton.parents().on "mousemove touchmove" ,@waitMove
# Stop dragging listener
@fixbutton.parents().on "mouseup touchstop touchend touchcancel", (e) =>
@fixbutton.parents().on "mouseup touchend touchend touchcancel", (e) =>
e.preventDefault()
@stopDrag()
@ -253,13 +253,13 @@ class Sidebar extends Class
@scrollable()
# Re-calculate height when site admin opened or closed
@tag.find("#checkbox-owned").off("click").on "click", =>
@tag.find("#checkbox-owned").off("click touchend").on "click touchend", =>
setTimeout (=>
@scrollable()
), 300
# Site limit button
@tag.find("#button-sitelimit").off("click").on "click", =>
@tag.find("#button-sitelimit").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "siteSetLimit", $("#input-sitelimit").val(), (res) =>
if res == "ok"
wrapper.notifications.add "done-sitelimit", "done", "Site storage limit modified!", 5000
@ -267,14 +267,14 @@ class Sidebar extends Class
return false
# Database reload
@tag.find("#button-dbreload").off("click").on "click", =>
@tag.find("#button-dbreload").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "dbReload", [], =>
wrapper.notifications.add "done-dbreload", "done", "Database schema reloaded!", 5000
@updateHtmlTag()
return false
# Database rebuild
@tag.find("#button-dbrebuild").off("click").on "click", =>
@tag.find("#button-dbrebuild").off("click touchend").on "click touchend", =>
wrapper.notifications.add "done-dbrebuild", "info", "Database rebuilding...."
wrapper.ws.cmd "dbRebuild", [], =>
wrapper.notifications.add "done-dbrebuild", "done", "Database rebuilt!", 5000
@ -282,7 +282,7 @@ class Sidebar extends Class
return false
# Update site
@tag.find("#button-update").off("click").on "click", =>
@tag.find("#button-update").off("click touchend").on "click touchend", =>
@tag.find("#button-update").addClass("loading")
wrapper.ws.cmd "siteUpdate", wrapper.site_info.address, =>
wrapper.notifications.add "done-updated", "done", "Site updated!", 5000
@ -290,19 +290,19 @@ class Sidebar extends Class
return false
# Pause site
@tag.find("#button-pause").off("click").on "click", =>
@tag.find("#button-pause").off("click touchend").on "click touchend", =>
@tag.find("#button-pause").addClass("hidden")
wrapper.ws.cmd "sitePause", wrapper.site_info.address
return false
# Resume site
@tag.find("#button-resume").off("click").on "click", =>
@tag.find("#button-resume").off("click touchend").on "click touchend", =>
@tag.find("#button-resume").addClass("hidden")
wrapper.ws.cmd "siteResume", wrapper.site_info.address
return false
# Delete site
@tag.find("#button-delete").off("click").on "click", =>
@tag.find("#button-delete").off("click touchend").on "click touchend", =>
wrapper.displayConfirm "Are you sure?", "Delete this site", =>
@tag.find("#button-delete").addClass("loading")
wrapper.ws.cmd "siteDelete", wrapper.site_info.address, ->
@ -310,24 +310,24 @@ class Sidebar extends Class
return false
# Owned checkbox
@tag.find("#checkbox-owned").off("click").on "click", =>
@tag.find("#checkbox-owned").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "siteSetOwned", [@tag.find("#checkbox-owned").is(":checked")]
# Owned checkbox
@tag.find("#checkbox-autodownloadoptional").off("click").on "click", =>
@tag.find("#checkbox-autodownloadoptional").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "siteSetAutodownloadoptional", [@tag.find("#checkbox-autodownloadoptional").is(":checked")]
# Change identity button
@tag.find("#button-identity").off("click").on "click", =>
@tag.find("#button-identity").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "certSelect"
return false
# Owned checkbox
@tag.find("#checkbox-owned").off("click").on "click", =>
@tag.find("#checkbox-owned").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "siteSetOwned", [@tag.find("#checkbox-owned").is(":checked")]
# Save settings
@tag.find("#button-settings").off("click").on "click", =>
@tag.find("#button-settings").off("click touchend").on "click touchend", =>
wrapper.ws.cmd "fileGet", "content.json", (res) =>
data = JSON.parse(res)
data["title"] = $("#settings-title").val()
@ -342,7 +342,7 @@ class Sidebar extends Class
return false
# Sign content.json
@tag.find("#button-sign").off("click").on "click", =>
@tag.find("#button-sign").off("click touchend").on "click touchend", =>
inner_path = @tag.find("#input-contents").val()
if wrapper.site_info.privatekey
@ -360,7 +360,7 @@ class Sidebar extends Class
return false
# Publish content.json
@tag.find("#button-publish").off("click").on "click", =>
@tag.find("#button-publish").off("click touchend").on "click touchend", =>
inner_path = @tag.find("#input-contents").val()
@tag.find("#button-publish").addClass "loading"
wrapper.ws.cmd "sitePublish", {"inner_path": inner_path, "sign": false}, =>

View file

@ -241,7 +241,7 @@ window.initScrollable = function () {
return;
}
e.preventDefault();
_this.fixbutton.off("click touchstop touchcancel");
_this.fixbutton.off("click touchend touchcancel");
_this.fixbutton.off("mousemove touchmove");
_this.dragStarted = +(new Date);
return _this.fixbutton.one("mousemove touchmove", function(e) {
@ -255,7 +255,7 @@ window.initScrollable = function () {
});
};
})(this));
this.fixbutton.parent().on("click touchstop touchcancel", (function(_this) {
this.fixbutton.parent().on("click touchend touchcancel", (function(_this) {
return function(e) {
return _this.stopDrag();
};
@ -297,7 +297,7 @@ window.initScrollable = function () {
})(this));
this.fixbutton.parents().on("mousemove touchmove", this.animDrag);
this.fixbutton.parents().on("mousemove touchmove", this.waitMove);
return this.fixbutton.parents().on("mouseup touchstop touchend touchcancel", (function(_this) {
return this.fixbutton.parents().on("mouseup touchend touchend touchcancel", (function(_this) {
return function(e) {
e.preventDefault();
return _this.stopDrag();
@ -473,14 +473,14 @@ window.initScrollable = function () {
Sidebar.prototype.onOpened = function() {
this.log("Opened");
this.scrollable();
this.tag.find("#checkbox-owned").off("click").on("click", (function(_this) {
this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) {
return function() {
return setTimeout((function() {
return _this.scrollable();
}), 300);
};
})(this));
this.tag.find("#button-sitelimit").off("click").on("click", (function(_this) {
this.tag.find("#button-sitelimit").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("siteSetLimit", $("#input-sitelimit").val(), function(res) {
if (res === "ok") {
@ -491,7 +491,7 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-dbreload").off("click").on("click", (function(_this) {
this.tag.find("#button-dbreload").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("dbReload", [], function() {
wrapper.notifications.add("done-dbreload", "done", "Database schema reloaded!", 5000);
@ -500,7 +500,7 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-dbrebuild").off("click").on("click", (function(_this) {
this.tag.find("#button-dbrebuild").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.notifications.add("done-dbrebuild", "info", "Database rebuilding....");
wrapper.ws.cmd("dbRebuild", [], function() {
@ -510,7 +510,7 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-update").off("click").on("click", (function(_this) {
this.tag.find("#button-update").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.tag.find("#button-update").addClass("loading");
wrapper.ws.cmd("siteUpdate", wrapper.site_info.address, function() {
@ -520,21 +520,21 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-pause").off("click").on("click", (function(_this) {
this.tag.find("#button-pause").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.tag.find("#button-pause").addClass("hidden");
wrapper.ws.cmd("sitePause", wrapper.site_info.address);
return false;
};
})(this));
this.tag.find("#button-resume").off("click").on("click", (function(_this) {
this.tag.find("#button-resume").off("click touchend").on("click touchend", (function(_this) {
return function() {
_this.tag.find("#button-resume").addClass("hidden");
wrapper.ws.cmd("siteResume", wrapper.site_info.address);
return false;
};
})(this));
this.tag.find("#button-delete").off("click").on("click", (function(_this) {
this.tag.find("#button-delete").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.displayConfirm("Are you sure?", "Delete this site", function() {
_this.tag.find("#button-delete").addClass("loading");
@ -545,28 +545,28 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#checkbox-owned").off("click").on("click", (function(_this) {
this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);
};
})(this));
this.tag.find("#checkbox-autodownloadoptional").off("click").on("click", (function(_this) {
this.tag.find("#checkbox-autodownloadoptional").off("click touchend").on("click touchend", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetAutodownloadoptional", [_this.tag.find("#checkbox-autodownloadoptional").is(":checked")]);
};
})(this));
this.tag.find("#button-identity").off("click").on("click", (function(_this) {
this.tag.find("#button-identity").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("certSelect");
return false;
};
})(this));
this.tag.find("#checkbox-owned").off("click").on("click", (function(_this) {
this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) {
return function() {
return wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]);
};
})(this));
this.tag.find("#button-settings").off("click").on("click", (function(_this) {
this.tag.find("#button-settings").off("click touchend").on("click touchend", (function(_this) {
return function() {
wrapper.ws.cmd("fileGet", "content.json", function(res) {
var data, json_raw;
@ -586,7 +586,7 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-sign").off("click").on("click", (function(_this) {
this.tag.find("#button-sign").off("click touchend").on("click touchend", (function(_this) {
return function() {
var inner_path;
inner_path = _this.tag.find("#input-contents").val();
@ -614,7 +614,7 @@ window.initScrollable = function () {
return false;
};
})(this));
this.tag.find("#button-publish").off("click").on("click", (function(_this) {
this.tag.find("#button-publish").off("click touchend").on("click touchend", (function(_this) {
return function() {
var inner_path;
inner_path = _this.tag.find("#input-contents").val();