Skip to content

Instantly share code, notes, and snippets.

@sfentress
Created April 22, 2013 15:44
Show Gist options
  • Select an option

  • Save sfentress/5436162 to your computer and use it in GitHub Desktop.

Select an option

Save sfentress/5436162 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript">
document.onload = function() {
iframe = document.getElementById('iframe');
activity = {
"_id": "activity",
"title": "Sample JSON activity",
"show_oscilloscope": "true",
"showComponentDrawer": "true",
"circuit": [
{
"type": "function generator",
"UID": "source",
"frequencies": [
"logarithmic",
100,
100000,
1001
],
"amplitude": 10
},
{
"type": "inductor",
"draggable": true,
"UID": "L1",
"inductance": "0.001",
"connections": "c5,c11",
"label": "L1"
},
{
"type": "capacitor",
"draggable": true,
"UID": "C1",
"capacitance": 0.000001,
"connections": "b11,b17",
"label": "C1"
},
{
"type": "resistor",
"draggable": true,
"UID": "R1",
"resistance": "100",
"connections": "c17,c23",
"label": "L1"
},
{
"type": "wire",
"draggable": true,
"connections": "left_positive20,a23"
},
{
"type": "wire",
"draggable": true,
"connections": "left_negative8,a5"
}
]
}
iframe.contentWindow.postMessage(JSON.stringify(activity), '*');
}
</script>
</head>
<body>
<h1>Example embedded SPARKS circuit</h1>
<iframe src="http://sparks.portal.concord.org/sparks-content/embeddable.html#postMessage" width="800px" height="500px"></iframe>
<p>Check out this cool circuit from <a href="http://sparks.concord.org">http://sparks.concord.org</a>!</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment