diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 21cd50d69..3b7e756c6 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -197,6 +197,16 @@ define([ return hexArray.join(""); }; + var deduplicate = common.deduplicateString = function (array) { + var a = array.slice(); + for(var i=0; i').text(JSON.stringify(r)).appendTo($list); + }); + }; + // Display the selected directory into the content part (rightside) // NOTE: Elements in the trash are not using the same storage structure as the others // _WORKGROUP_ : do not change the lastOpenedFolder value in localStorage @@ -1433,6 +1441,7 @@ define([ } appStatus.ready(false); currentPath = path; + var s = $content.scrollTop() || 0; $content.html(""); if (!path || path.length === 0) { path = [ROOT]; @@ -1442,9 +1451,10 @@ define([ var isUnsorted = filesOp.comparePath(path, [UNSORTED]); var isTemplate = filesOp.comparePath(path, [TEMPLATE]); var isAllFiles = filesOp.comparePath(path, [FILES_DATA]); + var isSearch = path[0] === SEARCH; - var root = filesOp.findElement(files, path); - if (typeof(root) === "undefined") { + var root = isSearch ? undefined : filesOp.findElement(files, path); + if (!isSearch && typeof(root) === "undefined") { log(Messages.fm_unknownFolderError); debug("Unable to locate the selected directory: ", path); var parentPath = path.slice(); @@ -1517,6 +1527,8 @@ define([ displayAllFiles($list); } else if (isTrashRoot) { displayTrashRoot($list, $folderHeader, $fileHeader); + } else if (isSearch) { + displaySearch($list, path[1]); } else { $dirContent.contextmenu(openContentContextMenu); if (filesOp.hasSubfolder(root)) { $list.append($folderHeader); } @@ -1539,6 +1551,7 @@ define([ } //$content.append($toolbar).append($title).append($info).append($dirContent); $content.append($info).append($dirContent); + $content.scrollTop(s); appStatus.ready(true); }; @@ -1624,7 +1637,8 @@ define([ // Display root content var $list = $('