That should work, you can even use $(...).toggle() to simplify the logic
:-) PR welcomed.
-- 
M

On Apr 5, 2017 14:39, "Milos Miljkovic" <[email protected]> wrote:

> Hi,
>
> If I wanted to add a custom notebook action for showing/hiding/toggling
> menu bar, would including the code below into 
> /notebook/static/notebook/js/actions.js
> work and correctly add entry to /.jupyter/nbconfig/notebook.json if a
> custom keyboard shortcut was created?
>
>
> 'toggle-menubar':{
>     help: 'hide/show the menu bar',
>     handler : function(env) {
>         var value = !env.notebook.menubar;
>         if (value === true) {
>             $('#menubar-container').show();
>         } else if (value === false) {
>             $('#menubar-container').hide();
>         }
>         events.trigger('resize-header.Page');
>         env.notebook.menubar = value;
>     }
> },
> 'show-menubar':{
>     help: 'show the menu bar',
>     handler : function(env) {
>         $('#menubar-container').show();
>         events.trigger('resize-header.Page');
>         env.notebook.menubar = true;
>     }
> },
> 'hide-menubar':{
>     help: 'hide the menu bar',
>     handler : function(env) {
>         $('#menubar-container').hide();
>         events.trigger('resize-header.Page');
>         env.notebook.menubar = false;
>     }
> },
>
>
> Cheers,
>
> Milos.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/jupyter/0acf4c0d-183d-460e-a13d-9273be1581b4%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/0acf4c0d-183d-460e-a13d-9273be1581b4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CANJQusXYopa57zf0%3DWRWqUP%3Diz_2bjAeHe70TZrCTzMjrMvOEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to