From dd924f389f06b3b4f46b581f64acba781790c8b4 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Sat, 10 Mar 2018 02:01:49 +0100 Subject: [PATCH] Display and change per-site bigfile autodownload with sidebar --- plugins/Sidebar/media/Sidebar.coffee | 14 +++++++++----- plugins/Sidebar/media/Sidebar.css | 8 +++++++- plugins/Sidebar/media/all.css | 8 +++++++- plugins/Sidebar/media/all.js | 18 ++++++++++++------ 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/plugins/Sidebar/media/Sidebar.coffee b/plugins/Sidebar/media/Sidebar.coffee index 373b8d15..2f2b3747 100644 --- a/plugins/Sidebar/media/Sidebar.coffee +++ b/plugins/Sidebar/media/Sidebar.coffee @@ -249,7 +249,7 @@ class Sidebar extends Class @scrollable() # Re-calculate height when site admin opened or closed - @tag.find("#checkbox-owned").off("click touchend").on "click touchend", => + @tag.find("#checkbox-owned, #checkbox-autodownloadoptional").off("click touchend").on "click touchend", => setTimeout (=> @scrollable() ), 300 @@ -262,6 +262,14 @@ class Sidebar extends Class @updateHtmlTag() return false + # Site autodownload limit button + @tag.find("#button-autodownload_bigfile_size_limit").off("click touchend").on "click touchend", => + @wrapper.ws.cmd "siteSetAutodownloadBigfileLimit", $("#input-autodownload_bigfile_size_limit").val(), (res) => + if res == "ok" + @wrapper.notifications.add "done-bigfilelimit", "done", "Site bigfile auto download limit modified!", 5000 + @updateHtmlTag() + return false + # Database reload @tag.find("#button-dbreload").off("click touchend").on "click touchend", => @wrapper.ws.cmd "dbReload", [], => @@ -327,10 +335,6 @@ class Sidebar extends Class @wrapper.ws.cmd "certSelect" return false - # Owned checkbox - @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 touchend").on "click touchend", => @wrapper.ws.cmd "fileGet", "content.json", (res) => diff --git a/plugins/Sidebar/media/Sidebar.css b/plugins/Sidebar/media/Sidebar.css index 9f718b7c..895ba178 100644 --- a/plugins/Sidebar/media/Sidebar.css +++ b/plugins/Sidebar/media/Sidebar.css @@ -118,6 +118,12 @@ #checkbox-owned ~ .settings-owned { opacity: 0; max-height: 0px; transition: all 0.3s linear; overflow: hidden } #checkbox-owned:checked ~ .settings-owned { opacity: 1; max-height: 420px } +/* Settings autodownload */ + +.settings-autodownloadoptional { clear: both; box-sizing: border-box; padding-top: 0px; } +#checkbox-autodownloadoptional ~ .settings-autodownloadoptional { opacity: 0; max-height: 0px; transition: all 0.3s ease-in-out; overflow: hidden; } +#checkbox-autodownloadoptional:checked ~ .settings-autodownloadoptional { opacity: 1; max-height: 120px; padding-top: 30px; } + /* Globe */ .globe { width: 360px; height: 360px } .globe.loading { background: url(/uimedia/img/loading-circle.gif) center center no-repeat } @@ -154,4 +160,4 @@ /* Small screen */ @media screen and (max-width: 600px) { .sidebar .close { display: block } -} \ No newline at end of file +} diff --git a/plugins/Sidebar/media/all.css b/plugins/Sidebar/media/all.css index eab5f992..29398d36 100644 --- a/plugins/Sidebar/media/all.css +++ b/plugins/Sidebar/media/all.css @@ -197,6 +197,12 @@ #checkbox-owned ~ .settings-owned { opacity: 0; max-height: 0px; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s linear; -o-transition: all 0.3s linear; -ms-transition: all 0.3s linear; transition: all 0.3s linear ; overflow: hidden } #checkbox-owned:checked ~ .settings-owned { opacity: 1; max-height: 420px } +/* Settings autodownload */ + +.settings-autodownloadoptional { clear: both; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box ; padding-top: 0px; } +#checkbox-autodownloadoptional ~ .settings-autodownloadoptional { opacity: 0; max-height: 0px; -webkit-transition: all 0.3s ease-in-out; -moz-transition: all 0.3s ease-in-out; -o-transition: all 0.3s ease-in-out; -ms-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out ; overflow: hidden; } +#checkbox-autodownloadoptional:checked ~ .settings-autodownloadoptional { opacity: 1; max-height: 120px; padding-top: 30px; } + /* Globe */ .globe { width: 360px; height: 360px } .globe.loading { background: url(/uimedia/img/loading-circle.gif) center center no-repeat } @@ -233,4 +239,4 @@ /* Small screen */ @media screen and (max-width: 600px) { .sidebar .close { display: block } -} \ No newline at end of file +} diff --git a/plugins/Sidebar/media/all.js b/plugins/Sidebar/media/all.js index ceef0b25..391a0a1d 100644 --- a/plugins/Sidebar/media/all.js +++ b/plugins/Sidebar/media/all.js @@ -555,7 +555,7 @@ window.initScrollable = function () { var menu; this.log("Opened"); this.scrollable(); - this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) { + this.tag.find("#checkbox-owned, #checkbox-autodownloadoptional").off("click touchend").on("click touchend", (function(_this) { return function() { return setTimeout((function() { return _this.scrollable(); @@ -573,6 +573,17 @@ window.initScrollable = function () { return false; }; })(this)); + this.tag.find("#button-autodownload_bigfile_size_limit").off("click touchend").on("click touchend", (function(_this) { + return function() { + _this.wrapper.ws.cmd("siteSetAutodownloadBigfileLimit", $("#input-autodownload_bigfile_size_limit").val(), function(res) { + if (res === "ok") { + _this.wrapper.notifications.add("done-bigfilelimit", "done", "Site bigfile auto download limit modified!", 5000); + } + return _this.updateHtmlTag(); + }); + return false; + }; + })(this)); this.tag.find("#button-dbreload").off("click touchend").on("click touchend", (function(_this) { return function() { _this.wrapper.ws.cmd("dbReload", [], function() { @@ -653,11 +664,6 @@ window.initScrollable = function () { return false; }; })(this)); - this.tag.find("#checkbox-owned").off("click touchend").on("click touchend", (function(_this) { - return function() { - return _this.wrapper.ws.cmd("siteSetOwned", [_this.tag.find("#checkbox-owned").is(":checked")]); - }; - })(this)); this.tag.find("#button-settings").off("click touchend").on("click touchend", (function(_this) { return function() { _this.wrapper.ws.cmd("fileGet", "content.json", function(res) {