My JS knowledge is shit but $(...).toggle() did cross my mind. I was just 
being lazy and copied toggle-header logic. Tonight I will properly do this 
for menu and editor files and see if it works after minifying JS. If it's a 
go, a PR will be forthcoming.

On Thursday, April 6, 2017 at 1:52:20 PM UTC-4, Matthias Bussonnier wrote:
>
> 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] <javascript:>> 
> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/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/09692859-f6cc-412e-9da2-dc3c339681f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to