mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Merge pull request #2687 from Carreau/metaui-slideshow
[WIP] Metaui slideshow
This commit is contained in:
commit
eff5fa878d
@ -0,0 +1,58 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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
|
||||
//============================================================================
|
||||
|
||||
/**
|
||||
* $.getScript('/static/js/celltoolbarpresets/slideshow.js');
|
||||
* ```
|
||||
* 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" ],
|
||||
["Sub-Slide" ,"subslide" ],
|
||||
["Fragment" ,"fragment" ],
|
||||
["Skip" ,"skip" ],
|
||||
["Notes" ,"notes" ],
|
||||
],
|
||||
// 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');
|
||||
|
||||
CellToolbar.register_preset('Slideshow',slideshow_preset);
|
||||
console.log('Slideshow extension for metadata editing loaded.');
|
||||
|
||||
}(IPython));
|
@ -225,5 +225,6 @@ data-notebook-id={{notebook_id}}
|
||||
<script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script>
|
||||
|
||||
<script src="{{ static_url("js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="{{ static_url("js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user