summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-06 13:49:54 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-06 13:49:54 -0400
commitea2385432817dcf5ad47396d83932f564aa76e4b (patch)
treeeffc5c5489cf385ee79c73a4bea59605f53240f9 /apps/files/js
parentba0cf9817526e1206a25a5fe6d70255ab3c9e3bc (diff)
parentfe6450002d6059260c743f48b6f40378454fa1dc (diff)
downloadnextcloud-server-ea2385432817dcf5ad47396d83932f564aa76e4b.tar.gz
nextcloud-server-ea2385432817dcf5ad47396d83932f564aa76e4b.zip
Merge branch 'master' into share_api
Conflicts: apps/contacts/lib/app.php apps/contacts/templates/part.chooseaddressbook.rowfields.php
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/files.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index daa250c9bd4..c980ba003d0 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -542,6 +542,65 @@ $(document).ready(function() {
scanFiles();
}
}, "json");
+
+ var lastWidth = 0;
+ var breadcrumbs = [];
+ var breadcrumbsWidth = $('#navigation').get(0).offsetWidth + $('#controls .actions').get(0).offsetWidth;
+ var hiddenBreadcrumbs = 0;
+
+ $.each($('.crumb'), function(index, breadcrumb) {
+ breadcrumbs[index] = breadcrumb;
+ breadcrumbsWidth += $(breadcrumb).get(0).offsetWidth;
+ });
+
+ function resizeBreadcrumbs(firstRun) {
+ var width = $(this).width();
+ if (width != lastWidth) {
+ if ((width < lastWidth || firstRun) && width < breadcrumbsWidth) {
+ if (hiddenBreadcrumbs == 0) {
+ breadcrumbsWidth -= $(breadcrumbs[1]).get(0).offsetWidth;
+ $(breadcrumbs[1]).find('a').hide();
+ $(breadcrumbs[1]).append('<span>...</span>');
+ breadcrumbsWidth += $(breadcrumbs[1]).get(0).offsetWidth;
+ hiddenBreadcrumbs = 2;
+ }
+ var i = hiddenBreadcrumbs;
+ while (width < breadcrumbsWidth && i > 1 && i < breadcrumbs.length - 1) {
+ breadcrumbsWidth -= $(breadcrumbs[i]).get(0).offsetWidth;
+ $(breadcrumbs[i]).hide();
+ hiddenBreadcrumbs = i;
+ i++
+ }
+ } else if (width > lastWidth && hiddenBreadcrumbs > 0) {
+ var i = hiddenBreadcrumbs;
+ while (width > breadcrumbsWidth && i > 0) {
+ if (hiddenBreadcrumbs == 1) {
+ breadcrumbsWidth -= $(breadcrumbs[1]).get(0).offsetWidth;
+ $(breadcrumbs[1]).find('span').remove();
+ $(breadcrumbs[1]).find('a').show();
+ breadcrumbsWidth += $(breadcrumbs[1]).get(0).offsetWidth;
+ } else {
+ $(breadcrumbs[i]).show();
+ breadcrumbsWidth += $(breadcrumbs[i]).get(0).offsetWidth;
+ if (breadcrumbsWidth > width) {
+ breadcrumbsWidth -= $(breadcrumbs[i]).get(0).offsetWidth;
+ $(breadcrumbs[i]).hide();
+ break;
+ }
+ }
+ i--;
+ hiddenBreadcrumbs = i;
+ }
+ }
+ lastWidth = width;
+ }
+ }
+
+ $(window).resize(function() {
+ resizeBreadcrumbs(false);
+ });
+
+ resizeBreadcrumbs(true);
});
function scanFiles(force,dir){