Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 20 additions & 43 deletions src/jupyter_contrib_nbextensions/nbextensions/toc2/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -49,44 +49,27 @@ 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;
padding: 0;
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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 4 additions & 6 deletions src/jupyter_contrib_nbextensions/nbextensions/toc2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "}"
Expand All @@ -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 + '}';
Expand All @@ -171,7 +171,6 @@ define([

var previous_get_callbacks = CodeCell.prototype.get_callbacks;
CodeCell.prototype.get_callbacks = function() {
var that = this;
var callbacks = previous_get_callbacks.apply(this, arguments);
var prev_reply_callback = callbacks.shell.reply;
callbacks.shell.reply = function(msg) {
Expand All @@ -195,7 +194,6 @@ define([


function excute_codecell_callback(evt, data) {
var cell = data.cell;
highlight_toc_item(evt, data);
}

Expand All @@ -210,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) {
Expand Down
Loading