Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[toc2] update for cells width ans sidebar height #994

Merged
merged 5 commits into from
May 25, 2017
Merged
Changes from 2 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
11 changes: 6 additions & 5 deletions src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ var make_link = function(h, num_lbl) {
callback && callback();
}

function setNotebookWidth(cfg, st) {
//cfg.widenNotebook = false;
function setNotebookWidth(cfg, st, sideBarIsToggling) {
//cfg.widenNotebook = true;
var sideBarIsToggling = typeof sideBarIsToggling !== 'undefined' ? sideBarIsToggling : false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sideBarIsToggling variable doesn't actually seem to get used anywhere - what is it intended for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing. Indeed it is a dead code from a previous attempt. I remove it.

if (cfg.sideBar) {
if ($('#toc-wrapper').is(':visible')) {
$('#notebook-container').css('margin-left', $('#toc-wrapper').width() + 30)
Expand All @@ -176,15 +177,15 @@ var make_link = function(h, num_lbl) {
$('#notebook-container').css('margin-left', 30);
$('#notebook-container').css('width', $('#notebook').width() - 30);
} else { // original width
$("#notebook-container").css({'width':"82%", 'margin-left':'auto'})
$("#notebook-container").css({'width':st.nbcontainer_width, 'margin-left':'auto'})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably set an empty string, to not set anything, otherwise it'll break when the window is resized.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. thanks

}
}
} else {
if (cfg.widenNotebook) {
$('#notebook-container').css('margin-left', 30);
$('#notebook-container').css('width', $('#notebook').width() - 30);
} else { // original width
$("#notebook-container").css({'width':"82%", 'margin-left':'auto'})
$("#notebook-container").css({'width':st.nbcontainer_width, 'margin-left':'auto'})
}
}
}
Expand Down Expand Up @@ -649,7 +650,7 @@ var table_of_contents = function (cfg,st) {
//$("#toc-wrapper").toggle({'complete':function(){
$("#toc-wrapper").toggle({
'progress':function(){
setNotebookWidth(cfg,st);
setNotebookWidth(cfg,st, true);
},
'complete': function(){
if(liveNotebook){
Expand Down