|
@@ -16,7 +16,8 @@ import {
|
|
|
WidgetTracker,
|
|
|
ICommandPalette,
|
|
|
InputDialog,
|
|
|
- showErrorMessage
|
|
|
+ showErrorMessage,
|
|
|
+ DOMUtils
|
|
|
} from '@jupyterlab/apputils';
|
|
|
|
|
|
import { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';
|
|
@@ -122,6 +123,8 @@ namespace CommandIDs {
|
|
|
|
|
|
export const toggleNavigateToCurrentDirectory =
|
|
|
'filebrowser:toggle-navigate-to-current-directory';
|
|
|
+
|
|
|
+ export const toggleShowLastModified = 'filebrowser:toggle-show-last-modified';
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -817,6 +820,28 @@ function addCommands(
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ commands.addCommand(CommandIDs.toggleShowLastModified, {
|
|
|
+ label: 'Show Last Modified',
|
|
|
+ execute: () => {
|
|
|
+ const header = DOMUtils.findElement(document.body, 'jp-id-modified');
|
|
|
+ const column = DOMUtils.findElements(
|
|
|
+ document.body,
|
|
|
+ 'jp-DirListing-itemModified'
|
|
|
+ );
|
|
|
+ if (header.classList.contains('jp-LastModified-hidden')) {
|
|
|
+ header.classList.remove('jp-LastModified-hidden');
|
|
|
+ for (let i = 0; i < column.length; i++) {
|
|
|
+ column[i].classList.remove('jp-LastModified-hidden');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ header.classList.add('jp-LastModified-hidden');
|
|
|
+ for (let i = 0; i < column.length; i++) {
|
|
|
+ column[i].classList.add('jp-LastModified-hidden');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
if (mainMenu) {
|
|
|
mainMenu.settingsMenu.addGroup(
|
|
|
[{ command: CommandIDs.toggleNavigateToCurrentDirectory }],
|
|
@@ -1009,6 +1034,11 @@ function addCommands(
|
|
|
selector: selectorNotDir,
|
|
|
rank: 13
|
|
|
});
|
|
|
+ app.contextMenu.addItem({
|
|
|
+ command: CommandIDs.toggleShowLastModified,
|
|
|
+ selector: '.jp-DirListing-header',
|
|
|
+ rank: 14
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|