Show More
@@ -367,6 +367,11 b' class Javascript(DisplayObject):' | |||||
367 | display function, it will result in the data being displayed |
|
367 | display function, it will result in the data being displayed | |
368 | in the frontend. If the data is a URL, the data will first be |
|
368 | in the frontend. If the data is a URL, the data will first be | |
369 | downloaded and then displayed. |
|
369 | downloaded and then displayed. | |
|
370 | ||||
|
371 | In the Notebook, the containing element will be available as `element`, | |||
|
372 | and jQuery will be available. The output area starts hidden, so if | |||
|
373 | the js appends content to `element` that should be visible, then | |||
|
374 | it must call `container.show()` to unhide the area. | |||
370 |
|
375 | |||
371 | Parameters |
|
376 | Parameters | |
372 | ---------- |
|
377 | ---------- |
@@ -686,13 +686,14 b' var IPython = (function (IPython) {' | |||||
686 | }; |
|
686 | }; | |
687 |
|
687 | |||
688 |
|
688 | |||
689 | CodeCell.prototype.append_javascript = function (js, e) { |
|
689 | CodeCell.prototype.append_javascript = function (js, container) { | |
690 | // We just eval the JS code, element appears in the local scope. |
|
690 | // We just eval the JS code, element appears in the local scope. | |
691 | var element = $("<div/>").addClass("box_flex1 output_subarea"); |
|
691 | var element = $("<div/>").addClass("box_flex1 output_subarea"); | |
692 | e.append(element); |
|
692 | container.append(element); | |
693 | // Div for js shouldn't be drawn, as it will add empty height to the area. |
|
693 | // Div for js shouldn't be drawn, as it will add empty height to the area. | |
694 | e.hide(); |
|
694 | container.hide(); | |
695 |
|
695 | // If the Javascript appends content to `element` that should be drawn, then | ||
|
696 | // it must also call `container.show()`. | |||
696 | eval(js); |
|
697 | eval(js); | |
697 | } |
|
698 | } | |
698 |
|
699 |
General Comments 0
You need to be logged in to leave comments.
Login now