From 611762b255713ba5b5d3873bcb9fef731c601f64 Mon Sep 17 00:00:00 2001 From: Peter Parente Date: Tue, 30 Jan 2018 21:01:33 -0500 Subject: [PATCH 1/2] Fix modified clicking of dirs, crumbs All the default browser behavior when the user is holding any modifier key while clicking on a folder or breadcrumb in the fileview. --- notebook/static/tree/js/notebooklist.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index e38925c9fa..bb36dd6f70 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -365,6 +365,10 @@ define([ breadcrumb.empty(); var list_item = $('
  • '); var root = $('
  • ').append('').click(function(e) { + // Allow the default browser action when the user holds a modifier (e.g., Ctrl-Click) + if(e.altKey || e.metaKey || e.shiftKey) { + return true; + } var path = ''; window.history.pushState({ path: path @@ -383,6 +387,10 @@ define([ utils.encode_uri_components(path) ); var crumb = $('
  • ').append('' + path_part + '').click(function(e) { + // Allow the default browser action when the user holds a modifier (e.g., Ctrl-Click) + if(e.altKey || e.metaKey || e.shiftKey) { + return true; + } window.history.pushState({ path: path }, path, url); @@ -810,8 +818,12 @@ define([ link.attr('target', IPython._target); } else { // Replace with a click handler that will use the History API to - // push a new route without reloading the page + // push a new route without reloading the page if the click is + // not modified (e.g., Ctrl-Click) link.click(function (e) { + if(e.altKey || e.metaKey || e.shiftKey) { + return true; + } window.history.pushState({ path: model.path }, model.path, utils.url_path_join( From 386b3a248a7d36a864f8189a3640525d230f9b08 Mon Sep 17 00:00:00 2001 From: Peter Parente Date: Tue, 30 Jan 2018 21:21:41 -0500 Subject: [PATCH 2/2] Update page / tab title when navigating --- notebook/static/tree/js/notebooklist.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index bb36dd6f70..6bd969b850 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -412,6 +412,10 @@ define([ $('body').attr('data-notebook-path', path); // Update the file tree list without reloading the page this.load_list(); + // Update the page title so the browser tab reflects it + // Match how the title appears with a trailing slash or + // "Home" if the page loads from the server. + $('title').text(path ? path+'/' : i18n.msg._("Home")); }; /**