Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50654 views
1
//----------------------------------------------------------------------------
2
// Copyright (C) 2012 The IPython Development Team
3
//
4
// Distributed under the terms of the BSD License. The full license is in
5
// the file COPYING, distributed as part of this software.
6
//----------------------------------------------------------------------------
7
8
//============================================================================
9
//CellToolbar Example
10
//============================================================================
11
12
// IIFE without asignement, we don't modifiy the IPython namespace
13
(function (IPython) {
14
"use strict";
15
16
var CellToolbar = IPython.CellToolbar;
17
var slideshow_preset = [];
18
19
var select_type = CellToolbar.utils.select_ui_generator([
20
["-" ,"-" ],
21
["Slide" ,"slide" ],
22
["Sub-Slide" ,"subslide" ],
23
["Fragment" ,"fragment" ],
24
["Skip" ,"skip" ],
25
["Notes" ,"notes" ],
26
],
27
// setter
28
function(cell, value){
29
// we check that the slideshow namespace exist and create it if needed
30
if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
31
// set the value
32
cell.metadata.slideshow.slide_type = value
33
},
34
//geter
35
function(cell){ var ns = cell.metadata.slideshow;
36
// if the slideshow namespace does not exist return `undefined`
37
// (will be interpreted as `false` by checkbox) otherwise
38
// return the value
39
return (ns == undefined)? undefined: ns.slide_type
40
},
41
"Slide Type");
42
43
CellToolbar.register_callback('slideshow.select',select_type);
44
45
slideshow_preset.push('slideshow.select');
46
47
CellToolbar.register_preset('Slideshow',slideshow_preset);
48
console.log('Slideshow extension for metadata editing loaded.');
49
50
}(IPython));
51
52