//----------------------------------------------------------------------------1// Copyright (C) 2012 The IPython Development Team2//3// Distributed under the terms of the BSD License. The full license is in4// the file COPYING, distributed as part of this software.5//----------------------------------------------------------------------------67//============================================================================8//CellToolbar Example9//============================================================================1011// IIFE without asignement, we don't modifiy the IPython namespace12(function (IPython) {13"use strict";1415var CellToolbar = IPython.CellToolbar;16var slideshow_preset = [];1718var select_type = CellToolbar.utils.select_ui_generator([19["-" ,"-" ],20["Slide" ,"slide" ],21["Sub-Slide" ,"subslide" ],22["Fragment" ,"fragment" ],23["Skip" ,"skip" ],24["Notes" ,"notes" ],25],26// setter27function(cell, value){28// we check that the slideshow namespace exist and create it if needed29if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}30// set the value31cell.metadata.slideshow.slide_type = value32},33//geter34function(cell){ var ns = cell.metadata.slideshow;35// if the slideshow namespace does not exist return `undefined`36// (will be interpreted as `false` by checkbox) otherwise37// return the value38return (ns == undefined)? undefined: ns.slide_type39},40"Slide Type");4142CellToolbar.register_callback('slideshow.select',select_type);4344slideshow_preset.push('slideshow.select');4546CellToolbar.register_preset('Slideshow',slideshow_preset);47console.log('Slideshow extension for metadata editing loaded.');4849}(IPython));505152