From 7a0c4aeb086e06279e43286400ec1388db8464b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E9=9F=AC?= Date: Thu, 13 Jun 2019 17:03:17 +0100 Subject: [PATCH 1/2] Solve issue #3940 --- notebook/static/acc_overwrite.less | 60 ++++++++++++++++ notebook/static/notebook/js/main.js | 3 +- notebook/static/notebook/js/menubar.js | 15 ++++ notebook/static/notebook/less/menubar.less | 7 ++ notebook/templates/notebook.html | 84 +++++++++++----------- 5 files changed, 127 insertions(+), 42 deletions(-) create mode 100644 notebook/static/acc_overwrite.less diff --git a/notebook/static/acc_overwrite.less b/notebook/static/acc_overwrite.less new file mode 100644 index 0000000000..8d9c3e6431 --- /dev/null +++ b/notebook/static/acc_overwrite.less @@ -0,0 +1,60 @@ +//This is file created for overwriting some of bootstrap element color in order to satisfiy the color contrast greater than 4.5:1. + +.btn-danger{ + color: #ffffff; + background-color: #df0404; + border-color: #df0404; +} + +.btn-warning{ + color: #ffffff; + background-color:#b46102; + border-color: #b46102; +} + +@link-color: #296eaa; + +.close { + float: right; + font-size: (@font-size-base * 1.5); + font-weight: @close-font-weight; + line-height: 1; + color: @close-color; + text-shadow: @close-text-shadow; + .opacity(.6); + + &:hover, + &:focus { + color: @close-color; + text-decoration: none; + cursor: pointer; + .opacity(1.0); +} button& { + padding: 0; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; + appearance: none; + } +} + +.navbar-nav { + > li > a { + color: @navbar-default-link-color; + // To make keyboard focus clearly visible on the Controls(File,Edit,View,Insert,Cell...etc)present on the menubar. + //&:hover, //To use browser's hover default value + &:focus { + /* -webkit-focus-ring-color = '#5B9DD9' */ + outline: -webkit-focus-ring-color auto 5px; + // color: @navbar-default-link-hover-color; + // background-color: @navbar-default-link-hover-bg; + } + } +} + +.menu_focus_highlight{ + a:focus { + outline: -webkit-focus-ring-color auto 5px; +} +} \ No newline at end of file diff --git a/notebook/static/notebook/js/main.js b/notebook/static/notebook/js/main.js index 5a1eaf4a5c..641c40ad3f 100644 --- a/notebook/static/notebook/js/main.js +++ b/notebook/static/notebook/js/main.js @@ -45,7 +45,8 @@ requirejs([ 'notebook/js/about', 'notebook/js/searchandreplace', 'notebook/js/clipboard', - 'bidi/bidi' + 'bidi/bidi', + 'notebook/js/celltoolbarpresets/tags' ], function( $, contents_service, diff --git a/notebook/static/notebook/js/menubar.js b/notebook/static/notebook/js/menubar.js index 83ee61de69..b8c5778f0e 100644 --- a/notebook/static/notebook/js/menubar.js +++ b/notebook/static/notebook/js/menubar.js @@ -152,12 +152,27 @@ define([ this.events.trigger('resize-header.Page'); }; + (function($){ + $(document).ready(function(){ + $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) { + event.preventDefault(); + event.stopPropagation(); + $(this).parent().siblings().removeClass('open'); + $(this).parent().toggleClass('open'); + }); + }); + })(jQuery); + MenuBar.prototype.bind_events = function () { /** * File */ var that = this; + this.element.find("#new_notebook").click(function(){ + console.log("11"); + }) + this.element.find('#open_notebook').click(function () { var parent = utils.url_path_split(that.notebook.notebook_path)[0]; window.open( diff --git a/notebook/static/notebook/less/menubar.less b/notebook/static/notebook/less/menubar.less index 414557aee4..e5209f257b 100644 --- a/notebook/static/notebook/less/menubar.less +++ b/notebook/static/notebook/less/menubar.less @@ -1,4 +1,7 @@ + + #menubar { + .border-box-sizing(); margin-top: 1px; @@ -44,6 +47,8 @@ } } +ul.dropdown-menu:focus + [dir="rtl"] ul.dropdown-menu { text-align: right; left : auto; @@ -86,6 +91,8 @@ ul#help_menu li a{ } } + + // Make sub menus work in BS3. // Credit: http://www.bootply.com/86684 .dropdown-submenu { diff --git a/notebook/templates/notebook.html b/notebook/templates/notebook.html index 579cc45c52..b06ee4ac00 100644 --- a/notebook/templates/notebook.html +++ b/notebook/templates/notebook.html @@ -77,11 +77,12 @@