Skip to content

Commit 6b94f14

Browse files
committed
Webpack demo site
1 parent 23937bd commit 6b94f14

16 files changed

+2216
-4
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["es2015", "stage-2", "stage-3"]
2+
"presets": ["env"]
33
}

.eslintignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tmp/**
2+
build/**
3+
node_modules/**
4+
contracts/**
5+
migrations/1_initial_migration.js
6+
migrations/2_deploy_contracts.js
7+
test/metacoin.js

.eslintrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": [
4+
"standard"
5+
],
6+
"plugins": [
7+
"babel"
8+
],
9+
"rules": {
10+
"key-spacing" : 0,
11+
"jsx-quotes" : [2, "prefer-single"],
12+
"max-len" : [2, 120, 2],
13+
"object-curly-spacing" : [2, "always"]
14+
}
15+
}

app/backup.sol

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
pragma solidity ^0.4.2;
2+
3+
import "./ConvertLib.sol";
4+
5+
// This is just a simple example of a coin-like contract.
6+
// It is not standards compatible and cannot be expected to talk to other
7+
// coin/token contracts. If you want to create a standards-compliant
8+
// token, see: https://github.com/ConsenSys/Tokens. Cheers!
9+
10+
contract MetaCoin {
11+
mapping (address => uint) balances;
12+
13+
event Transfer(address indexed _from, address indexed _to, uint256 _value);
14+
15+
function MetaCoin() {
16+
balances[tx.origin] = 10000;
17+
}
18+
19+
function sendCoin(address receiver, uint amount) returns(bool sufficient) {
20+
if (balances[msg.sender] < amount) return false;
21+
balances[msg.sender] -= amount;
22+
balances[receiver] += amount;
23+
Transfer(msg.sender, receiver, amount);
24+
return true;
25+
}
26+
27+
function getBalanceInEth(address addr) returns(uint){
28+
return ConvertLib.convert(getBalance(addr),2);
29+
}
30+
31+
function getBalance(address addr) returns(uint) {
32+
return balances[addr];
33+
}
34+
}

app/index.html

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>OpusCoin - Truffle Webpack Demo w/ Frontend</title>
5+
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
6+
<script src="./app.js"></script>
7+
</head>
8+
<body>
9+
<h1>OpusCoin</h1>
10+
<h2>Example Truffle Dapp</h2>
11+
<h3>You have <span class="black"><span id="balance"></span> OPUS</span></h3>
12+
13+
<br>
14+
<br><label for="account">Account:</label>
15+
<input type="text" id="account" placeholder="e.g., 0x93e66d9baea28c17d9fc393b53e3fbdd76899dae"></input>
16+
<br><br><button id="setAccount" onclick="App.setAccount()">
17+
set account
18+
</button>
19+
20+
<br>
21+
<h1>Send OpusCoin</h1>
22+
<br><label for="amount">Amount:</label><input type="text" id="amount" placeholder="e.g., 95"></input>
23+
<br><label for="receiver">To Address:</label><input type="text" id="receiver" placeholder="e.g., 0x93e66d9baea28c17d9fc393b53e3fbdd76899dae"></input>
24+
<br><br><button id="send" onclick="App.sendCoin()">Send OpusCoin</button>
25+
<br><br><button id="send" onclick="App.sendEther()">Send Ether</button>
26+
<br><br>
27+
<span id="status"></span>
28+
<br><button onclick="App.startCrowdsale()">Start crowdsale</button><br>
29+
<br><button onclick="App.getBlocks()">Get blocks</button><br>
30+
<br><button onclick="App.requestEther()">Get ether</button><br>
31+
<br><button onclick="window.location.href = 'http://www.baidu.com';">Jump</button><br>
32+
<br>
33+
34+
<span class="hint"><strong>Hint:</strong> open the browser developer console to view any errors and warnings.</span>
35+
36+
<br>
37+
<div id="uploadDivision">
38+
<h1>Upload Your Music!</h1><br>
39+
Name: <input type="text" id="name" placeholder="Name of your work"></input><br>
40+
Artist: <input type="text" id="artist" placeholder="Name of the artist"></input><br>
41+
Genre: <input type="text" id="genre" placeholder="genre yo"></input><br>
42+
Price: <input type="number" id="price" placeholder="Enter a number"></input><br>
43+
Select file: <input type = "file" id = "file"></input><br>
44+
Image Url(optional): <input type="text" id="imgUrl" ></input><br>
45+
<br>
46+
<button onclick="App.captureFile()">upload</button>
47+
<br>
48+
<a id="link">uploaded file</a>
49+
<br>
50+
<a id='downloadLink' download>download</a>
51+
<br>
52+
</div>
53+
54+
<div id="playerDivision">
55+
56+
<img id = "playing-pic" > </img>
57+
<audio id="audioplayer" controls autoplay></audio>
58+
<span id = "timeleft" ></span>
59+
<div id = "playing">
60+
<span id = "playing-name"></span><br>
61+
<span id = "playing-artist"></span>
62+
</div>
63+
<br>
64+
</div>
65+
<div id = "playList">
66+
<h1>Playlist</h1>
67+
68+
<ul id = "yourSongs">
69+
70+
</ul>
71+
<div id = "myCoins">
72+
My balance: <span id = "opusBalance"></span> opus <br>
73+
<span id="etherscan"><a id="etherscanUrl" target="_blank">
74+
Click here to see trasaction records on etherscan
75+
</a></span>
76+
</div>
77+
<br>
78+
<ul id = "buyMore">
79+
80+
</ul>
81+
82+
</div>
83+
84+
<div id = "search-div">
85+
<input type="text" id="search-bar" placeholder="Search for artist, title or genre"></input><br>
86+
<button onclick = "App.search();"></button>
87+
<div id = "search-results"></div>
88+
</div>
89+
</body>
90+
</html>

0 commit comments

Comments
 (0)