-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
56 lines (53 loc) · 1.53 KB
/
index.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
52
53
54
55
56
<!doctype html>
<meta charset=utf-8>
<title>ether.tube</title>
<style>
html { font: 22px/1.5 courier, monospace; color: ivory; }
body { height: 100vh; text-align: center; margin: 0; background: black; }
iframe { width: 95vw; height: calc(100vh - 4rem); margin-top: .5vh; }
b { opacity: .7; }
</style>
<div>
<iframe id=video width="854" height="480" frameborder="0" allowfullscreen>
</iframe>
<script>
var address = "0xfb77d479e82827b798c898531c89d9e73cda139f"
var data = "0x61540c69"
function youtube(id) {
return "https://www.youtube.com/embed/" + id +
"?autoplay=0&modestbranding=1&rel=0"
}
function decode(hex) {
return hex.match(/^0x(.{22})/)[1].match(/.{1,2}/g).map(function(x) {
return String.fromCharCode(parseInt(x, 16))
}).join('')
}
onload = function () {
if (typeof web3 !== "undefined") {
web3 = new Web3(web3.currentProvider)
console.info("Web3")
console.info(web3.eth.accounts[0])
web3.eth.call({
to: address,
data: data
}, function (err, data) {
console.info(data)
video.src = youtube(decode(data))
})
} else {
var req = new XMLHttpRequest()
req.onload = function() {
var result = JSON.parse(this.responseText).result
video.src = youtube(decode(result))
}
req.open(
"GET",
"https://testnet.etherscan.io/api?module=proxy&action=eth_call&to="
+ address + "&data=" + data + "&tag=latest"
)
req.send()
}
}
</script>
<p>Send <b>bid(bytes11)</b> with YouTube identifier
to Morden <b>0xfb77d479e82827b798c898531c89d9e73cda139f</b>.