##// END OF EJS Templates
Uppercase and update path
Matthias BUSSONNIER -
Show More
@@ -1,63 +1,58 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2012 The IPython Development Team
2 // Copyright (C) 2012 The IPython Development Team
3 //
3 //
4 // Distributed under the terms of the BSD License. The full license is in
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7
7
8 //============================================================================
8 //============================================================================
9 //CellToolbar Example
9 //CellToolbar Example
10 //============================================================================
10 //============================================================================
11
11
12 /**
12 /**
13 * Example Use for the CellToolbar library
13 * $.getScript('/static/js/celltoolbarpresets/slideshow.js');
14 * add the following to your custom.js to load
15 * metadata UI for slideshow
16 *
17 * ```
18 * $.getScript('/static/js/examples/metaui.slideshow.js');
19 * ```
14 * ```
20 * or more generally
15 * or more generally
21 * ```
16 * ```
22 * $.getScript('url to this file');
17 * $.getScript('url to this file');
23 * ```
18 * ```
24 */
19 */
25 // IIFE without asignement, we don't modifiy the IPython namespace
20 // IIFE without asignement, we don't modifiy the IPython namespace
26 (function (IPython) {
21 (function (IPython) {
27 "use strict";
22 "use strict";
28
23
29 var CellToolbar = IPython.CellToolbar;
24 var CellToolbar = IPython.CellToolbar;
30 var slideshow_preset = [];
25 var slideshow_preset = [];
31
26
32 var select_type = CellToolbar.utils.select_ui_generator([
27 var select_type = CellToolbar.utils.select_ui_generator([
33 ["-" ,undefined ],
28 ["-" ,undefined ],
34 ["Slide" ,"slide" ],
29 ["Slide" ,"slide" ],
35 ["Sub-Slide" ,"subslide" ],
30 ["Sub-Slide" ,"subslide" ],
36 ["Fragment" ,"fragment" ],
31 ["Fragment" ,"fragment" ],
37 ["Skip" ,"skip" ],
32 ["Skip" ,"skip" ],
38 ["Notes" ,"notes" ],
33 ["Notes" ,"notes" ],
39 ],
34 ],
40 // setter
35 // setter
41 function(cell, value){
36 function(cell, value){
42 // we check that the slideshow namespace exist and create it if needed
37 // we check that the slideshow namespace exist and create it if needed
43 if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
38 if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
44 // set the value
39 // set the value
45 cell.metadata.slideshow.slide_type = value
40 cell.metadata.slideshow.slide_type = value
46 },
41 },
47 //geter
42 //geter
48 function(cell){ var ns = cell.metadata.slideshow;
43 function(cell){ var ns = cell.metadata.slideshow;
49 // if the slideshow namespace does not exist return `undefined`
44 // if the slideshow namespace does not exist return `undefined`
50 // (will be interpreted as `false` by checkbox) otherwise
45 // (will be interpreted as `false` by checkbox) otherwise
51 // return the value
46 // return the value
52 return (ns == undefined)? undefined: ns.slide_type
47 return (ns == undefined)? undefined: ns.slide_type
53 },
48 },
54 "Slide Type");
49 "Slide Type");
55
50
56 CellToolbar.register_callback('slideshow.select',select_type);
51 CellToolbar.register_callback('slideshow.select',select_type);
57
52
58 slideshow_preset.push('slideshow.select');
53 slideshow_preset.push('slideshow.select');
59
54
60 CellToolbar.register_preset('slideshow',slideshow_preset);
55 CellToolbar.register_preset('Slideshow',slideshow_preset);
61 console.log('Slideshow extension for metadata editting loaded.');
56 console.log('Slideshow extension for metadata editing loaded.');
62
57
63 }(IPython));
58 }(IPython));
General Comments 0
You need to be logged in to leave comments. Login now