Skip to content

Instantly share code, notes, and snippets.

@beber89

beber89/index.html

Created Sep 16, 2019
Embed
What would you like to do?
index.html
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
<script src="wasm_exec.js"></script>
<script>
const go = new Go();
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then((result) => {go.run(result.instance);});
</script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
</head>
<body>
<div class="w-3 container">
<div class="w-6">
<select onchange="changeUser(this.value)" class="w-9 color-lightblue">
<option value="0">User👨🏻‍💻:</option>
<option value="Alice">Alice🙍‍</option>
<option value="Bob">Bob👨‍💼</option>
</select>
</div>
<div class="w-6">
<input type="range" min="0" max="64" value="19" class="slider" id="diffRange">
</div>
<div class="clear"></div>
<button onClick="reward()" class="w-6 color-lightblue mg-top">Reward 💰</button>
<button disabled id="BuyBtn" onClick="buyCommodity()" class="w-6 color-lightblue mg-top mg-left">
Buy 🍎 🍌
</button>
<div class="clear"></div>
<label class="w-6 mg-top">Difficulty ⚙️:</label>
<label id="diffLabel" class="w-3 mg-top mg-left">
</label>
<div class="clear"></div>
<label class="w-6 mg-top">Networth 💵:</label>
<label id="networth" class="w-3 mg-top mg-left">
</label>
<div class="clear"></div>
</div>
<div id="blockchain-placeholder" class="w-9">
<!-- Blockchain schematic goes here -->
</div>
<script>
// Update the current slider value (each time you drag the slider handle)
sliderVal = function(val) {
$("#diffLabel").html(val);
sendSliderValToWasm(val);
}
$("#diffRange").on("change mousemove", function() {
sliderVal($(this).val());
});
sliderVal($("#diffRange").val());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment