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

Zenmode Optional Header and Menubar #1062

Merged
merged 15 commits into from
Sep 10, 2017
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
23 changes: 21 additions & 2 deletions src/jupyter_contrib_nbextensions/nbextensions/zenmode/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ define([
'back3.jpg', 'ipynblogo0.png', 'ipynblogo1.png'
];

var hide_header = true;
var hide_menubar = true

var getZenModeActive = function() {
return ($('link#zenmodecss')[0] !== undefined);
Expand Down Expand Up @@ -62,6 +64,7 @@ define([
var oldBg = $('body').attr(oldBgAttrName) || "#ffffff";
$('body').css({"background": oldBg});

// This should be changed at some point in the future to preserve non-zenmode visibility settings
$(menu_pattern).toggle(true);
$(header_pattern).toggle(true);
}
Expand Down Expand Up @@ -91,8 +94,10 @@ define([
'background-size': 'cover'
});

$(menu_pattern).toggle(false);
$(header_pattern).toggle(false);
if (hide_menubar)
{$(menu_pattern).toggle(false);}
if (hide_header)
{$(header_pattern).toggle(false);}
}

// Lastly get notebook to do a resize
Expand All @@ -113,6 +118,20 @@ define([

var initialize = function () {
var config = IPython.notebook.config;
if (config.data.hasOwnProperty('zenmode_hide_header')) {
if (!config.data.zenmode_hide_header) {
console.log("not hiding notebook header");
hide_header = false;
}
}

if (config.data.hasOwnProperty('zenmode_hide_menubar')) {
if (!config.data.zenmode_hide_menubar) {
console.log("not hiding notebook menubar");
hide_menubar = 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 bit (new lines 124-137) is still fine :)

if (config.data.hasOwnProperty('zenmode_use_builtin_backgrounds')) {
if (!config.data.zenmode_use_builtin_backgrounds) {
console.log("not using builtin zenmode_backgrounds");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Name: zenmode
Link: README.md
Description: A little extension to give Zenmode functionality to the IPython notebook
Main: main.js
Compatibility: 4.x
Compatibility: 4.x, 5.x
Parameters:
- name: zenmode_set_zenmode_on_load
description: Set zenmode on when a notebook opens
Expand All @@ -13,6 +13,14 @@ Parameters:
description: Use builtin backgrounds in addition to any specified by URL
input_type: checkbox
default: true
- name: zenmode_hide_header
description: Hide the header in zenmode
input_type: checkbox
default: true
- name: zenmode_hide_menubar
description: Hide the menubar in zenmode
input_type: checkbox
default: true
- name: zenmode_backgrounds
description: "Urls to use as backgrounds. Any beginning with # are ignored."
input_type: list
Expand Down