##// END OF EJS Templates
add mising semicolon
add mising semicolon

File last commit:

r11033:fa36e98f
r11528:29698db9
Show More
slideshow.js
58 lines | 2.2 KiB | application/javascript | JavascriptLexer
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 //----------------------------------------------------------------------------
// Copyright (C) 2012 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
//CellToolbar Example
//============================================================================
/**
Matthias BUSSONNIER
Uppercase and update path
r9089 * $.getScript('/static/js/celltoolbarpresets/slideshow.js');
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 * ```
* or more generally
* ```
* $.getScript('url to this file');
* ```
*/
// IIFE without asignement, we don't modifiy the IPython namespace
(function (IPython) {
"use strict";
var CellToolbar = IPython.CellToolbar;
var slideshow_preset = [];
var select_type = CellToolbar.utils.select_ui_generator([
["-" ,undefined ],
["Slide" ,"slide" ],
Matthias BUSSONNIER
Change Slide denomination...
r9088 ["Sub-Slide" ,"subslide" ],
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 ["Fragment" ,"fragment" ],
["Skip" ,"skip" ],
Matthias BUSSONNIER
Change Slide denomination...
r9088 ["Notes" ,"notes" ],
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 ],
// setter
function(cell, value){
// we check that the slideshow namespace exist and create it if needed
if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
// set the value
cell.metadata.slideshow.slide_type = value
},
//geter
function(cell){ var ns = cell.metadata.slideshow;
// if the slideshow namespace does not exist return `undefined`
// (will be interpreted as `false` by checkbox) otherwise
// return the value
return (ns == undefined)? undefined: ns.slide_type
},
"Slide Type");
CellToolbar.register_callback('slideshow.select',select_type);
slideshow_preset.push('slideshow.select');
Matthias BUSSONNIER
Uppercase and update path
r9089 CellToolbar.register_preset('Slideshow',slideshow_preset);
console.log('Slideshow extension for metadata editing loaded.');
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087
}(IPython));