|
|
@ -1610,6 +1610,60 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return title;
|
|
|
|
return title;
|
|
|
|
}; */
|
|
|
|
}; */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (removeOverflowElement()) {}
|
|
|
|
|
|
|
|
$spanCollapse.css("display", "");
|
|
|
|
|
|
|
|
removeOverflowElement();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$spanCollapse.attr("title", getLastOpenedFolder().slice(0, collapseLevel).join(" / ").replace("root", ROOT_NAME));
|
|
|
|
|
|
|
|
$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}); });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getPrettyName = function (name) {
|
|
|
|
var getPrettyName = function (name) {
|
|
|
|
var pName;
|
|
|
|
var pName;
|
|
|
@ -1639,6 +1693,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 +1728,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;
|
|
|
|