diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 9711de3fa..dbcb089f3 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -1434,13 +1434,13 @@ define([ */ UI.createDrawer = function ($button, $content) { $button.click(function () { + var topPos = $button[0].getBoundingClientRect().bottom; $content.toggle(); $button.removeClass('cp-toolbar-button-active'); if ($content.is(':visible')) { $button.addClass('cp-toolbar-button-active'); $content.focus(); var wh = $(window).height(); - var topPos = $button[0].getBoundingClientRect().bottom; $content.css('max-height', Math.floor(wh - topPos - 1)+'px'); } }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 471bd5011..5cac87c97 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -788,6 +788,30 @@ define([ h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_savetodrive) ])).click(common.prepareFeedback(type)); break; + case 'storeindrive': + Messages.toolbar_storeInDrive = "Store in CryptDrive"; // XXX + button = $(h('button.cp-toolbar-storeindrive', { + style: 'display:none;' + }, [ + h('i.fa.fa-hdd-o'), + h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_storeInDrive) + ])).click(common.prepareFeedback(type)).click(function () { + $(button).hide(); + common.getSframeChannel().query("Q_AUTOSTORE_STORE", null, function (err, obj) { + waitingForStoringCb = false; + var error = err || (obj && obj.error); + if (error) { + $(button).show(); + if (error === 'E_OVER_LIMIT') { + return void UI.warn(Messages.pinLimitReached); + } + return void UI.warn(Messages.autostore_error); + } + $(document).trigger('cpPadStored'); + UI.log(Messages.autostore_saved); + }); + }); + break; case 'hashtag': button = $('