Registry code working well enough to demo (various checks not performed in either...
[robmyers:artworld-ethereum.git] / ui / custom_works.html
1 <html>
2 <head>
3   <script type="text/javascript"
4           src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
5   </script>
6   <script>
7     if (typeof(window.eth) === "undefined") {
8       document.write('Please run in AlethZero.<br/>');
9     }
10   </script>
11   <script type="text/javascript" src="BigInteger.js"></script>
12   <script type="text/javascript" src="ethString.js"></script>
13   <style>
14     body {
15       text-align: center;
16       font-family: sans;
17     }
18     h1 {
19       font-size: 72pt;
20     }
21     #toggle {
22       color: #B0C4DE;
23     }
24   </style>
25 <title>Custom Artwork</title>
26 </head>
27 <body>
28   <div id="artwork"></div>
29   <a id="create" href="javascript:void(0)" onclick="create();">create</a>
30   <script>
31     // The custom work contract
32     var contract = "0x79c333bb3bf567aa40c73db3cacb4a0637621309";
33
34     // Update the span with the data from the contact
35     var create = function() {
36       if (confirm("This costs gas to run.")) {
37           var result = eth.transact(eth.key, "0", contract, padStr("toggle"), "10000", eth.gasPrice);
38           var artwork = "";
39           foreach(var element in result) {
40               artwork += element.unbin();
41           }
42           document.getElementById("artwork").innerText = artwork;
43           $("#create").hide();
44       }
45     };
46   </script>
47 </body>
48 </html>