mirror of
https://github.com/wassname/jupyter_contrib_nbextensions.git
synced 2026-06-27 16:10:24 +08:00
[toc2] remove more unused code
including redundant ol-based css rules & ids toc-level0 and navigate_menu-level0
This commit is contained in:
@@ -14,32 +14,32 @@ nbextension-configurator
|
||||
background-color: #DAA520;
|
||||
}
|
||||
|
||||
#toc-level0 a {
|
||||
color: #333333; /* default - alterable via nbextension-configurator */
|
||||
#toc a {
|
||||
color: #333333; /* default - alterable via nbextension-configurator */
|
||||
text-decoration: none;
|
||||
}
|
||||
#navigate_menu li > span:hover {background-color: #f1f1f1}
|
||||
|
||||
|
||||
/* Move menus and tooolbar to the left, following @Kevin-McIsaac suggestion
|
||||
/* Move menus and tooolbar to the left, following @Kevin-McIsaac suggestion
|
||||
This is now done in javascript, if the relevant option is selected
|
||||
div#menubar-container, div#header-container {
|
||||
width: auto;
|
||||
padding-left: 20px;
|
||||
}*/
|
||||
|
||||
#navigate_menu {
|
||||
/*display: block;*/
|
||||
list-style-type: none;
|
||||
max-width: 800px;
|
||||
min-width: 100px;
|
||||
width: 250px;
|
||||
max-width: 800px;
|
||||
min-width: 100px;
|
||||
width: 250px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
#navigate_menu a {
|
||||
list-style-type: none;
|
||||
color: #333333; /* default - alterable via nbextension-configurator */
|
||||
color: #333333; /* default - alterable via nbextension-configurator */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -49,29 +49,20 @@ padding-left: 20px;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#navigate_menu-level0 {padding-left: 0px;}
|
||||
#navigate_menu-level0 ul {padding-left: 0px;}
|
||||
|
||||
#navigate_menu > .toc-item,
|
||||
#navigate_menu ul {
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
.toc {
|
||||
max-height: 500px;
|
||||
padding: 0px;
|
||||
overflow-y: auto;
|
||||
font-weight: normal;
|
||||
color: #333333; /* default - alterable via nbextension-configurator */
|
||||
color: #333333; /* default - alterable via nbextension-configurator */
|
||||
white-space: nowrap;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.toc ol.toc-item {
|
||||
counter-reset: item;
|
||||
list-style: none;
|
||||
padding: 0.1em;
|
||||
}
|
||||
|
||||
.toc ol.toc-item li {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.toc ul.toc-item {
|
||||
list-style-type: none;
|
||||
@@ -79,14 +70,6 @@ padding-left: 20px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toc ol.toc-item li:before {
|
||||
font-size: 90%;
|
||||
font-family: Georgia, Times New Roman, Times, serif;
|
||||
counter-increment: item;
|
||||
content: counters(item, ".")" ";
|
||||
}
|
||||
|
||||
|
||||
.float-wrapper {
|
||||
position: fixed !important;
|
||||
top: 120px;
|
||||
@@ -95,7 +78,7 @@ padding-left: 20px;
|
||||
border: thin solid rgba(0, 0, 0, 0.38);
|
||||
border-radius: 5px;
|
||||
padding:10px;
|
||||
background-color: #fff; /* default - alterable via nbextension-configurator */
|
||||
background-color: #fff; /* default - alterable via nbextension-configurator */
|
||||
opacity: .8;
|
||||
z-index: 100;
|
||||
overflow: hidden;
|
||||
@@ -108,19 +91,13 @@ padding-left: 20px;
|
||||
position: fixed !important;
|
||||
width: 212px;
|
||||
max-width: 28%;
|
||||
background-color: #fff; /* default - alterable via nbextension-configurator */
|
||||
background-color: #fff; /* default - alterable via nbextension-configurator */
|
||||
border-style: solid;
|
||||
border-color: #eeeeee; /* default - alterable via nbextension-configurator */
|
||||
border-color: #eeeeee; /* default - alterable via nbextension-configurator */
|
||||
opacity: .99;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.col-md-9 {
|
||||
overflow:hidden;
|
||||
margin-left: 14%;
|
||||
width: 80%}
|
||||
|
||||
#toc-wrapper.closed {
|
||||
min-width: 100px;
|
||||
width: auto;
|
||||
@@ -176,14 +153,14 @@ padding-left: 20px;
|
||||
#toc-wrapper .toc-item-num {
|
||||
font-style: normal;
|
||||
font-family: Georgia, Times New Roman, Times, serif;
|
||||
color: black; /* default - alterable via nbextension-configurator */
|
||||
color: black; /* default - alterable via nbextension-configurator */
|
||||
}
|
||||
|
||||
/*
|
||||
These colors are now specified in js, after reading the extension's config stored in system
|
||||
and updated using the nbextension-configurator
|
||||
.toc-item-highlight-select {background-color: Gold}
|
||||
.toc-item-highlight-execute {background-color: red}
|
||||
.toc-item-highlight-select {background-color: Gold}
|
||||
.toc-item-highlight-execute {background-color: red}
|
||||
.toc-item-highlight-execute.toc-item-highlight-select {background-color: Gold} */
|
||||
|
||||
.toc-item .fa-fw:first-child {
|
||||
|
||||
@@ -146,7 +146,7 @@ define([
|
||||
|
||||
function create_additional_css() {
|
||||
var sheet = document.createElement('style')
|
||||
sheet.innerHTML = "#toc-level0 li > span:hover { background-color: " + cfg.colors.hover_highlight + " }\n" +
|
||||
sheet.innerHTML = "#toc li > span:hover { background-color: " + cfg.colors.hover_highlight + " }\n" +
|
||||
".toc-item-highlight-select {background-color: " + cfg.colors.selected_highlight + "}\n" +
|
||||
".toc-item-highlight-execute {background-color: " + cfg.colors.running_highlight + "}\n" +
|
||||
".toc-item-highlight-execute.toc-item-highlight-select {background-color: " + cfg.colors.selected_highlight + "}"
|
||||
@@ -157,7 +157,7 @@ define([
|
||||
}
|
||||
// Using custom colors
|
||||
sheet.innerHTML += ".float-wrapper, .sidebar-wrapper { background-color: " + cfg.colors.wrapper_background + "}";
|
||||
sheet.innerHTML += "#toc-level0 a, #navigate_menu a, .toc { color: " + cfg.colors.navigate_text + "}";
|
||||
sheet.innerHTML += "#toc a, #navigate_menu a, .toc { color: " + cfg.colors.navigate_text + "}";
|
||||
sheet.innerHTML += "#toc-wrapper .toc-item-num { color: " + cfg.colors.navigate_num + "}";
|
||||
sheet.innerHTML += ".sidebar-wrapper { border-color: " + cfg.colors.sidebar_border + "}";
|
||||
sheet.innerHTML += ".highlight_on_scroll { border-left: solid 4px " + cfg.colors.on_scroll + '}';
|
||||
@@ -208,10 +208,10 @@ define([
|
||||
}
|
||||
|
||||
var toc_init = function() {
|
||||
// read configuration, then call toc
|
||||
// read configuration, then call toc
|
||||
cfg = read_config(cfg, function() {
|
||||
table_of_contents(cfg, st);
|
||||
}); // called after config is stable
|
||||
}); // called after config is stable
|
||||
// event: render toc for each markdown cell modification
|
||||
$([IPython.events]).on("rendered.MarkdownCell",
|
||||
function(evt, data) {
|
||||
|
||||
@@ -575,7 +575,7 @@
|
||||
create_toc_div(cfg, st); // create it
|
||||
highlightTocItemOnScroll(cfg, st); // initialize highlighting on scroll
|
||||
}
|
||||
var ul = $("<ul/>").addClass("toc-item").attr('id', 'toc-level0');
|
||||
var ul = $('<ul/>').addClass('toc-item');
|
||||
|
||||
// update toc element
|
||||
$("#toc").empty().append(ul);
|
||||
@@ -661,7 +661,7 @@
|
||||
// update navigation menu
|
||||
if (cfg.navigate_menu) {
|
||||
var pop_nav = function() { //callback for create_nav_menu
|
||||
$('#navigate_menu').empty().append($('#toc-level0').clone().attr('id', 'navigate_menu-level0'))
|
||||
$('#navigate_menu').empty().append($('#toc > .toc-item').clone());
|
||||
}
|
||||
if ($('#Navigate_menu').length == 0) {
|
||||
create_navigate_menu(pop_nav);
|
||||
@@ -697,7 +697,6 @@
|
||||
events[cfg.collapse_to_match_collapsible_headings ? 'on' : 'off'](
|
||||
'collapse.CollapsibleHeading uncollapse.CollapsibleHeading', callback_toc2_collapsible_headings);
|
||||
|
||||
|
||||
$(window).resize(function() {
|
||||
$('#toc').css({
|
||||
maxHeight: $(window).height() - 30
|
||||
|
||||
Reference in New Issue
Block a user