diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 7c428a3de..0eb400587 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -716,6 +716,9 @@ } } } + .cp-app-drive-element-state { + display: none !important; + } } } .cp-app-drive-element { @@ -729,6 +732,9 @@ .cp-app-drive-element-type, .cp-app-drive-element-filler { display: none !important; } + .cp-app-drive-element-sort { + display: block !important; + } } @media screen and (max-width: 740px) { @@ -744,9 +750,6 @@ .cp-app-drive-element-header .cp-app-drive-element-state { display: none !important; } - .cp-app-drive-element-sort { - display: block !important; - } } } @@ -902,126 +905,6 @@ } } - /* Toolbar */ - - // XXX remove, preserve drive path? - #cp-app-drive-toolbar { - background: @colortheme_drive-bg-light; - color: @colortheme_drive-color; - //height: 30px; - //display: flex; - //flex-flow: row; - z-index: 100; - box-sizing: border-box; - height: @variables_bar-height; - padding: 0; - display: flex; - flex-flow: row; - - * { - outline-width: 0; - &:focus { - outline-width: 0; - } - } - - .cp-toolbar-icon-history { - float: right; - &.active { - background-color: rgba(0, 0, 255, 0.2); - } - .cp-toolbar-drawer-element { - display: none; - } - } - - .cp-app-drive-toolbar-rightside, .cp-app-drive-toolbar-leftside { - display: inline-block; - margin: 0; - padding: 0; - .fa, .cptools { - margin: 0; - vertical-align: top; - } - button { - height: @variables_bar-height !important; - padding: 0 10px; - border: none; - border-radius: 0; - box-sizing: border-box; - background: transparent; - font-size: @colortheme_app-font-size; - color: @colortheme_drive-color; - transition: all 0.15s; - display: inline-flex; - align-items: center; - .drawer { - display: none; - } - .fa, .cptools, span { - font-size: @colortheme_app-font-size; - } - &:hover { - background: @colortheme_drive-bg-active; - } - &.cp-app-drive-toolbar-active { - display: none; - } - } - } - .cp-app-drive-toolbar-rightside { - float: right; - flex-shrink: 0; - & > * { - float: right; - } - #cp-app-drive-toolbar-contextbuttons { - display: inline-block; - height: 100%; - } - padding-left: 10px; - } - .cp-app-drive-toolbar-leftside { - flex-shrink: 0; - & > span { - height: 100%; - margin: 0; - } - button { - padding: 0 10px; - .fa, .cptools { - margin-right: 5px; - } - .cp-dropdown-button-title { - display: inline-flex; - height: @variables_bar-height; - align-items: center; - span:not(.fa):not(.cptools) { - line-height: 23px; - } - } - } - } - - button { - font: @colortheme_app-font; - span { - font: @colortheme_app-font; - } - .fa, &.fa { - font-family: FontAwesome; - } - .cptools, &.cptools { - font-family: cptools; - } - } - - - .cp-app-drive-toolbar-filler { - flex: 1; - } - } - #cp-app-drive-edition-state { height: @variables_bar-height; display: flex; diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 0c26c0e3b..985f6bd83 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -949,10 +949,6 @@ } } - .cp-dropdown-content { - margin-top: -1px; - } - & > span { height: @toolbar_line-height; } diff --git a/www/code/markers.js b/www/code/markers.js index fb67736a6..b070e68fc 100644 --- a/www/code/markers.js +++ b/www/code/markers.js @@ -622,30 +622,9 @@ define([ }); }; - var authorUid = function (existing) { - if (!Array.isArray(existing)) { existing = []; } - var n; - var i = 0; - while (!n || existing.indexOf(n) !== -1 && i++ < 1000) { - n = Math.floor(Math.random() * 1000000); - } - // If we can't find a valid number in 1000 iterations, use 0... - if (existing.indexOf(n) !== -1) { n = 0; } - return n; - }; var getAuthorId = function (Env) { - var existing = Object.keys(Env.authormarks.authors || {}).map(Number); - if (!Env.common.isLoggedIn()) { return authorUid(existing); } - var userData = Env.common.getMetadataMgr().getUserData(); - var uid; - existing.some(function (id) { - var author = Env.authormarks.authors[id] || {}; - if (author.curvePublic !== userData.curvePublic) { return; } - uid = Number(id); - return true; - }); - return uid || authorUid(existing); + return Env.common.getAuthorId(Env.authormarks.authors, userData.curvePublic); }; var ready = function (Env) { Env.ready = true; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5d9f38077..ef1f13ca2 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2141,8 +2141,17 @@ define([ var show = function () { var wh = $(window).height(); - var topPos = $container[0].getBoundingClientRect().bottom; - $innerblock.css('max-height', Math.floor(wh - topPos - 1)+'px'); + var button = $button[0].getBoundingClientRect(); + var topPos = button.bottom; + $innerblock.css('bottom', ''); + if (config.noscroll) { + var h = $innerblock.outerHeight(); + if ((topPos + h) > wh) { + $innerblock.css('bottom', button.height+'px'); + } + } else { + $innerblock.css('max-height', Math.floor(wh - topPos - 1)+'px'); + } $innerblock.show(); $innerblock.find('.cp-dropdown-element-active').removeClass('cp-dropdown-element-active'); if (config.isSelect && value) { @@ -2157,6 +2166,11 @@ define([ e.stopPropagation(); var state = $innerblock.is(':visible'); $('.cp-dropdown-content').hide(); + + var $c = $container.closest('.cp-toolbar-drawer-content'); + $c.removeClass('cp-dropdown-visible'); + if (!state) { $c.addClass('cp-dropdown-visible'); } + try { $('iframe').each(function (idx, ifrw) { $(ifrw).contents().find('.cp-dropdown-content').hide(); diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 991fe5cc4..a92e383d1 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1207,9 +1207,6 @@ define([ if ($element.is('.cp-app-drive-element-notrash')) { // We can't delete elements in virtual categories hide.push('delete'); - } else { - // We can only open parent in virtual categories - hide.push('openparent'); } if (!$element.is('.cp-border-color-file')) { //hide.push('download'); @@ -1310,6 +1307,10 @@ define([ hide.push('open'); } + if (!APP.loggedIn) { + hide.push('openparent'); + } + filter = function ($el, className) { if (hide.indexOf(className) !== -1) { return true; } }; @@ -1325,7 +1326,7 @@ define([ 'deleteowned', 'removesf', 'access', 'properties', 'hashtag']; break; case 'default': - show = ['open', 'openro', 'preview', 'share', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy']; + show = ['open', 'openro', 'preview', 'openincode', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename']; break; case 'trashtree': { show = ['empty']; @@ -2117,7 +2118,7 @@ define([ onElementClick(e, $element); }); if (!isTrash) { - $element.contextmenu(openContextMenu('tree')); + $element.on('contextmenu', openContextMenu('tree')); $element.data('context', 'tree'); } else { $element.contextmenu(openContextMenu('trash')); @@ -2747,21 +2748,22 @@ define([ var options = [{ tag: 'a', attributes: {'class': 'cp-app-drive-element-type'}, - content: Messages.fm_type + content: '' + Messages.fm_type },{ tag: 'a', attributes: {'class': 'cp-app-drive-element-atime'}, - content: Messages.fm_lastAccess + content: '' + Messages.fm_lastAccess },{ tag: 'a', attributes: {'class': 'cp-app-drive-element-ctime'}, - content: Messages.fm_creation + content: '' + Messages.fm_creation }]; var dropdownConfig = { text: '', // Button initial text options: options, // Entries displayed in the menu container: $fhSort, left: true, + noscroll: true, common: common }; var $sortBlock = UIElements.createDropdown(dropdownConfig); @@ -2804,7 +2806,7 @@ define([ if (APP.store[SORT_FILE_BY] === '') { classSorted = 'cp-app-drive-sort-filename'; } else if (APP.store[SORT_FILE_BY]) { classSorted = 'cp-app-drive-element-' + APP.store[SORT_FILE_BY]; } if (classSorted) { - $list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon); + $list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon).find('i').hide(); } }; var getFileListHeader = function (clickable) { @@ -3312,6 +3314,7 @@ define([ } // Display the pad + /* var $icon = getFileIcon(id); var ro = manager.isReadOnlyFile(id); // ro undefined means it's an old hash which doesn't support read-only @@ -3319,21 +3322,13 @@ define([ ro ? ' cp-app-drive-element-readonly' : ''; var $element = $('