forked from kazuhikoarase/simcirjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_and_set.html
51 lines (46 loc) · 1.51 KB
/
get_and_set.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script type="text/javascript" src="simcir.js"></script>
<link rel="stylesheet" type="text/css" href="simcir.css" />
<script type="text/javascript" src="simcir-basicset.js"></script>
<link rel="stylesheet" type="text/css" href="simcir-basicset.css" />
<script type="text/javascript" src="simcir-library.js"></script>
<script type="text/javascript">
$(function() {
var $s = simcir;
var $simcir = $('#mySimcir');
var getCircuitData = function() {
return $s.controller(
$simcir.find('.simcir-workspace') ).text();
};
var setCircuitData = function(data) {
$s.setupSimcir($simcir, JSON.parse(data) );
};
// button click events
$('#getDataBtn').click(function() {
$('#dataArea').val(getCircuitData() );
});
$('#setDataBtn').click(function() {
setCircuitData($('#dataArea').val() );
});
// load default (just specifies circuit size).
setCircuitData('{ "width":600, "height":200 }');
});
</script>
<title></title>
</head>
<body>
<div id="mySimcir"></div>
<div>
<button id="getDataBtn">v get data v</button>
<button id="setDataBtn">^ set data ^</button>
</div>
<textarea id="dataArea" style="width:600px; height:200px;"></textarea>
</body>
</html>