Created
August 10, 2016 17:15
-
-
Save ajp619/b7701917d8a6ac04222cee3dc7be3535 to your computer and use it in GitHub Desktop.
Put this in a beaker notebook cell to have a button to run cells of a given tag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<button onclick="evaluateTags(this.parentElement)" | |
style="background-color:lightgreen">Run cells with tag</button> | |
<!-- SET TAG NAME BELOW: value="tagName" --> | |
<input type=text value="tagName"> | |
</div> | |
<script> | |
function evaluateTags(divElement) { | |
d3.select(divElement).select("button").attr("style", "background-color:indianred") | |
d3.select(divElement).selectAll("p").remove() | |
var tagName = d3.select(divElement).select("input").property("value") | |
beaker.evaluate(tagName).then( | |
function(r) { | |
d3.select(divElement).append("p").html("Output: <br>" + r) | |
d3.select(divElement).select("button").attr("style", "background-color:lightgreen") | |
} | |
) | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment