mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Update JavaScript Notebook Extensions.ipynb
This commit is contained in:
parent
9b514b1406
commit
2090c0b000
@ -72,7 +72,7 @@
|
||||
"You might see here and there people modifying css and injecting js into the notebook by reading file(s) and publishing them into the notebook.\n",
|
||||
"Not only does this often break the flow of the notebook and make the re-execution of the notebook broken, but it also means that you need to execute those cells in the entire notebook every time you need to update the code.\n",
|
||||
"\n",
|
||||
"This can still be useful in some cases, like the `%autosave` magic that allows to control the time between each save. But this can be replaced by a JavaScript dropdown menu to select the save interval."
|
||||
"This can still be useful in some cases, like the `%autosave` magic that allows you to control the time between each save. But this can be replaced by a JavaScript dropdown menu to select the save interval."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -213,7 +213,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"We've seen above that you can change the autosave rate by using a magic. This is typically something I don't want to type everytime, and that I don't like to embed into my workflow and documents. (readers don't care what my autosave time is). Let's build an extension that allows us to do it. "
|
||||
"We've seen above that you can change the autosave rate by using a magic. This is typically something I don't want to type every time, and that I don't like to embed into my workflow and documents. (readers don't care what my autosave time is). Let's build an extension that allows us to do it. "
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -340,7 +340,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"By browsing the documentation you will see that we have some convenience methods that allows us to avoid re-inventing the UI everytime :\n",
|
||||
"By browsing the documentation you will see that we have some convenience methods that allows us to avoid re-inventing the UI every time :\n",
|
||||
"```javascript\n",
|
||||
"Jupyter.toolbar.add_buttons_group([\n",
|
||||
" {\n",
|
||||
@ -387,14 +387,14 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"You can see some example of what can be done by toggling the `Cell Toolbar` selector in the toolbar on top of the notebook. It provide two default `presets` that are `Default` and `slideshow`. Default allow edit the metadata attached to each cell manually."
|
||||
"You can see some example of what can be done by toggling the `Cell Toolbar` selector in the toolbar on top of the notebook. It provides two default `presets` that are `Default` and `slideshow`. Default allows the user to edit the metadata attached to each cell manually."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"First we define a function that takes at first parameter an element on the DOM in which to inject UI element. Second element will be the cell this element will be registered with. Then we will need to register that function and give it a name.\n"
|
||||
"First we define a function that takes at first parameter an element on the DOM in which to inject UI element. The second element is the cell this element wis registered with. Then we will need to register that function and give it a name.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -417,7 +417,7 @@
|
||||
"var toggle = function(div, cell) {\n",
|
||||
" var button_container = $(div)\n",
|
||||
"\n",
|
||||
" // let's create a button that show the current value of the metadata\n",
|
||||
" // let's create a button that shows the current value of the metadata\n",
|
||||
" var button = $('<button/>').addClass('btn btn-mini').text(String(cell.metadata.foo));\n",
|
||||
"\n",
|
||||
" // On click, change the metadata value and update the button label\n",
|
||||
|
Loading…
Reference in New Issue
Block a user