Merge branch 'cryptDriveToolbar' into staging
This commit is contained in:
commit
f37bc78eaf
@ -22,7 +22,6 @@
|
|||||||
}
|
}
|
||||||
* {
|
* {
|
||||||
.tools_unselectable();
|
.tools_unselectable();
|
||||||
cursor: default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -909,9 +909,6 @@
|
|||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
position: relative;
|
position: relative;
|
||||||
&.fa-bell-o {
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
.cp-dropdown-button-title {
|
.cp-dropdown-button-title {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@ -998,7 +995,6 @@
|
|||||||
span {
|
span {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
cursor: default;
|
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@ -791,16 +791,23 @@ define([
|
|||||||
button = $('<span>');
|
button = $('<span>');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
var active = $(".cp-toolbar-history:visible").length !== 0;
|
||||||
button = $('<button>', {
|
button = $('<button>', {
|
||||||
title: Messages.historyButton,
|
title: active ? Messages.history_closeTitle : Messages.historyButton,
|
||||||
'class': "fa fa-history cp-toolbar-icon-history",
|
'class': "fa fa-history cp-toolbar-icon-history",
|
||||||
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.historyText));
|
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.historyText));
|
||||||
|
button.toggleClass("active", active);
|
||||||
if (data.histConfig) {
|
if (data.histConfig) {
|
||||||
button
|
if (active) {
|
||||||
.click(common.prepareFeedback(type))
|
button.click(function () { $(".cp-toolbar-history-close").trigger("click"); });
|
||||||
.on('click', function () {
|
}
|
||||||
common.getHistory(data.histConfig);
|
else {
|
||||||
});
|
button
|
||||||
|
.click(common.prepareFeedback(type))
|
||||||
|
.on('click', function () {
|
||||||
|
common.getHistory(data.histConfig);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'more':
|
case 'more':
|
||||||
|
|||||||
@ -770,6 +770,9 @@
|
|||||||
|
|
||||||
.cp-toolbar-icon-history {
|
.cp-toolbar-icon-history {
|
||||||
float: right;
|
float: right;
|
||||||
|
&.active {
|
||||||
|
background-color: rgba(0, 0, 255, 0.2);
|
||||||
|
}
|
||||||
.cp-toolbar-drawer-element {
|
.cp-toolbar-drawer-element {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -820,6 +823,7 @@
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
.cp-app-drive-toolbar-leftside {
|
.cp-app-drive-toolbar-leftside {
|
||||||
|
flex-shrink: 0;
|
||||||
& > span {
|
& > span {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -861,30 +865,58 @@
|
|||||||
width: auto;
|
width: auto;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
display: flex;
|
|
||||||
flex-flow: row-reverse;
|
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
.cp-app-drive-path-element {
|
display: flex;
|
||||||
display: inline-block;
|
flex-direction: row;
|
||||||
height: @variables_bar-height;
|
|
||||||
line-height: @variables_bar-height;
|
.cp-app-drive-path-inner {
|
||||||
font-size: @colortheme_app-font-size;
|
display: flex;
|
||||||
padding: 0 5px;
|
flex-flow: row-reverse;
|
||||||
border: 0;
|
flex-grow: 1;
|
||||||
background: darken(@colortheme_drive-bg, 10%);
|
|
||||||
color: @colortheme_drive-color;
|
.cp-app-drive-path-element {
|
||||||
box-sizing: border-box;
|
display: inline-block;
|
||||||
transition: all 0.15s;
|
flex-shrink: 0;
|
||||||
&.cp-app-drive-path-separator {
|
max-width: 100%;
|
||||||
color: #ccc;
|
height: @variables_bar-height;
|
||||||
}
|
line-height: @variables_bar-height;
|
||||||
&.cp-app-drive-path-lickable {
|
font-size: @colortheme_app-font-size;
|
||||||
cursor: pointer;
|
padding: 0 5px;
|
||||||
|
border: 0;
|
||||||
|
background: darken(@colortheme_drive-bg, 7%);
|
||||||
|
color: @colortheme_drive-color;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
transition: all 0.15s;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
flex-shrink: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.cp-app-drive-path-separator {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.cp-app-drive-path-collapse {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: darken(@colortheme_drive-bg, 15%);
|
&:not(.cp-app-drive-path-separator) {
|
||||||
|
background-color: darken(@colortheme_drive-bg, 15%);
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
& ~ .cp-app-drive-path-element {
|
||||||
|
background-color: darken(@colortheme_drive-bg, 15%);
|
||||||
|
}
|
||||||
|
& ~ .cp-app-drive-path-element:not(.cp-app-drive-path-separator) {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1611,6 +1611,7 @@ define([
|
|||||||
return title;
|
return title;
|
||||||
}; */
|
}; */
|
||||||
|
|
||||||
|
|
||||||
var getPrettyName = function (name) {
|
var getPrettyName = function (name) {
|
||||||
var pName;
|
var pName;
|
||||||
switch (name) {
|
switch (name) {
|
||||||
@ -1627,6 +1628,64 @@ define([
|
|||||||
}
|
}
|
||||||
return pName;
|
return pName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var drivePathOverflowing = function () {
|
||||||
|
var $container = $(".cp-app-drive-path");
|
||||||
|
if ($container.length) {
|
||||||
|
$container.css("overflow", "hidden");
|
||||||
|
var overflown = $container[0].scrollWidth > $container[0].clientWidth;
|
||||||
|
$container.css("overflow", "");
|
||||||
|
return overflown;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var collapseDrivePath = function () {
|
||||||
|
var $container = $(".cp-app-drive-path-inner");
|
||||||
|
var $spanCollapse = $(".cp-app-drive-path-collapse");
|
||||||
|
$spanCollapse.css("display", "none");
|
||||||
|
|
||||||
|
var $pathElements = $container.find(".cp-app-drive-path-element");
|
||||||
|
$pathElements.not($spanCollapse).css("display", "");
|
||||||
|
|
||||||
|
var oneFolder = currentPath.length > 1 + (currentPath[0] === SHARED_FOLDER);
|
||||||
|
if (oneFolder && drivePathOverflowing()) {
|
||||||
|
var collapseLevel = 0;
|
||||||
|
var removeOverflowElement = function () {
|
||||||
|
if (drivePathOverflowing()) {
|
||||||
|
if ($pathElements.length <= 3) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
collapseLevel++;
|
||||||
|
if ($($pathElements.get(-2)).is(".cp-app-drive-path-separator")) {
|
||||||
|
$($pathElements.get(-2)).css("display", "none");
|
||||||
|
$pathElements = $pathElements.not($pathElements.get(-2));
|
||||||
|
}
|
||||||
|
$($pathElements.get(-2)).css("display", "none");
|
||||||
|
$pathElements = $pathElements.not($pathElements.get(-2));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
currentPath.every(removeOverflowElement);
|
||||||
|
$spanCollapse.css("display", "");
|
||||||
|
removeOverflowElement();
|
||||||
|
|
||||||
|
var tipPath = currentPath.slice(0, collapseLevel);
|
||||||
|
tipPath[0] = getPrettyName(tipPath[0]);
|
||||||
|
$spanCollapse.attr("title", tipPath.join(" / "));
|
||||||
|
$spanCollapse[0].onclick = function () {
|
||||||
|
APP.displayDirectory(getLastOpenedFolder().slice(0, collapseLevel));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("resize", collapseDrivePath);
|
||||||
|
var treeResizeObserver = new MutationObserver(collapseDrivePath);
|
||||||
|
treeResizeObserver.observe($("#cp-app-drive-tree")[0], {"attributes": true});
|
||||||
|
var toolbarButtonAdditionObserver = new MutationObserver(collapseDrivePath);
|
||||||
|
$(function () { toolbarButtonAdditionObserver.observe($("#cp-app-drive-toolbar")[0], {"childList": true, "subtree": true}); });
|
||||||
|
|
||||||
|
|
||||||
// Create the title block with the "parent folder" button
|
// Create the title block with the "parent folder" button
|
||||||
var createTitle = function ($container, path, noStyle) {
|
var createTitle = function ($container, path, noStyle) {
|
||||||
@ -1639,6 +1698,9 @@ define([
|
|||||||
var el = isVirtual ? undefined : manager.find(path);
|
var el = isVirtual ? undefined : manager.find(path);
|
||||||
path = path[0] === SEARCH ? path.slice(0,1) : path;
|
path = path[0] === SEARCH ? path.slice(0,1) : path;
|
||||||
|
|
||||||
|
var $inner = $('<div>', {'class': 'cp-app-drive-path-inner'});
|
||||||
|
$container.prepend($inner);
|
||||||
|
|
||||||
var skipNext = false; // When encountering a shared folder, skip a key in the path
|
var skipNext = false; // When encountering a shared folder, skip a key in the path
|
||||||
path.forEach(function (p, idx) {
|
path.forEach(function (p, idx) {
|
||||||
if (skipNext) { skipNext = false; return; }
|
if (skipNext) { skipNext = false; return; }
|
||||||
@ -1671,13 +1733,21 @@ define([
|
|||||||
var $span2 = $('<span>', {
|
var $span2 = $('<span>', {
|
||||||
'class': 'cp-app-drive-path-element cp-app-drive-path-separator'
|
'class': 'cp-app-drive-path-element cp-app-drive-path-separator'
|
||||||
}).text(' / ');
|
}).text(' / ');
|
||||||
$container.prepend($span2);
|
$inner.prepend($span2);
|
||||||
}
|
}
|
||||||
|
$span.text(name).prependTo($inner);
|
||||||
$span.text(name).prependTo($container);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var $spanCollapse = $('<span>', {
|
||||||
|
'class': 'cp-app-drive-path-element cp-app-drive-path-collapse'
|
||||||
|
}).text(' ... ');
|
||||||
|
$inner.append($spanCollapse);
|
||||||
|
|
||||||
|
collapseDrivePath();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var createInfoBox = function (path) {
|
var createInfoBox = function (path) {
|
||||||
var $box = $('<div>', {'class': 'cp-app-drive-content-info-box'});
|
var $box = $('<div>', {'class': 'cp-app-drive-content-info-box'});
|
||||||
var msg;
|
var msg;
|
||||||
@ -2628,25 +2698,29 @@ define([
|
|||||||
// NOTE: Elements in the trash are not using the same storage structure as the others
|
// NOTE: Elements in the trash are not using the same storage structure as the others
|
||||||
var _displayDirectory = function (path, force) {
|
var _displayDirectory = function (path, force) {
|
||||||
APP.hideMenu();
|
APP.hideMenu();
|
||||||
|
|
||||||
if (!APP.editable) { debug("Read-only mode"); }
|
if (!APP.editable) { debug("Read-only mode"); }
|
||||||
if (!appStatus.isReady && !force) { return; }
|
if (!appStatus.isReady && !force) { return; }
|
||||||
|
|
||||||
// Only Trash and Root are available in not-owned files manager
|
if (!path || path.length === 0) {
|
||||||
if (!path || displayedCategories.indexOf(path[0]) === -1) {
|
// Only Trash and Root are available in not-owned files manager
|
||||||
log(Messages.fm_categoryError);
|
if (!path || displayedCategories.indexOf(path[0]) === -1) {
|
||||||
currentPath = [ROOT];
|
log(Messages.fm_categoryError);
|
||||||
_displayDirectory(currentPath);
|
}
|
||||||
return;
|
if (!APP.loggedIn && APP.newSharedFolder) {
|
||||||
|
// ANON_SHARED_FOLDER
|
||||||
|
path = [SHARED_FOLDER, ROOT];
|
||||||
|
} else {
|
||||||
|
path = [ROOT];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appStatus.ready(false);
|
appStatus.ready(false);
|
||||||
currentPath = path;
|
currentPath = path;
|
||||||
var s = $content.scrollTop() || 0;
|
var s = $content.scrollTop() || 0;
|
||||||
$content.html("");
|
$content.html("");
|
||||||
sel.$selectBox = $('<div>', {'class': 'cp-app-drive-content-select-box'})
|
sel.$selectBox = $('<div>', {'class': 'cp-app-drive-content-select-box'})
|
||||||
.appendTo($content);
|
.appendTo($content);
|
||||||
if (!path || path.length === 0) {
|
|
||||||
path = [ROOT];
|
|
||||||
}
|
|
||||||
var isInRoot = manager.isPathIn(path, [ROOT]);
|
var isInRoot = manager.isPathIn(path, [ROOT]);
|
||||||
var inTrash = manager.isPathIn(path, [TRASH]);
|
var inTrash = manager.isPathIn(path, [TRASH]);
|
||||||
var isTrashRoot = manager.comparePath(path, [TRASH]);
|
var isTrashRoot = manager.comparePath(path, [TRASH]);
|
||||||
@ -2657,6 +2731,10 @@ define([
|
|||||||
var isTags = path[0] === TAGS;
|
var isTags = path[0] === TAGS;
|
||||||
// ANON_SHARED_FOLDER
|
// ANON_SHARED_FOLDER
|
||||||
var isSharedFolder = path[0] === SHARED_FOLDER && APP.newSharedFolder;
|
var isSharedFolder = path[0] === SHARED_FOLDER && APP.newSharedFolder;
|
||||||
|
if (isSharedFolder && path.length < 2) {
|
||||||
|
path = [SHARED_FOLDER, 'root'];
|
||||||
|
currentPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
var root = isVirtual ? undefined : manager.find(path);
|
var root = isVirtual ? undefined : manager.find(path);
|
||||||
if (manager.isSharedFolder(root)) {
|
if (manager.isSharedFolder(root)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user