-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathpermamail.html
157 lines (147 loc) · 4.33 KB
/
permamail.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<html>
<head>
<title>Weavemail</title>
<script src="https://unpkg.com/arweave/bundles/web.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="milligram.min.css">
<script src="crypto.js"></script>
<script src="login.js"></script>
<script src="inbox.js"></script>
<script src="view.js"></script>
<script src="compose.js"></script>
<script>
var arweave = Arweave.init({host: 'arweave.net', port: 443, protocol: 'https'});
var wallet = {};
var content = "";
function switch_to_page(page) {
let pages =
[
"home_page",
"inbox_page",
"view_page",
"compose_page",
"previous_page"
];
pages.forEach(function(p) {
var elem = document.getElementById(p);
elem.style.display = 'none';
});
var elem = document.getElementById(page);
elem.style.display = 'block';
}
</script>
<style>
header .container {
margin-top: 10em;
text-align: center;
max-width: 100rem;
width: 50%;
}
.file-input{
height: 200px;
border: 2px dashed #62666f;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
position: relative;
margin: auto;
max-width: 300px;
}
.file-input input[type=file]{
opacity: 0;
position: absolute;
background: none;
width: 100%;
height: 100%;
}
#view_subject {
margin-left: 1em;
}
#view_contents {
margin-left: 1em;
margin-bottom: 1em;
word-wrap: break-word;
max-width: 50em;
white-space: pre-wrap;
}
</style>
</head>
<body>
<div id="home_page" class="">
<header>
<div class="container">
<h1 class="">Weavemail</h1>
<div class="file-input">
<input type="file" id="file" onchange="login(this.files)" >
<div id="desc">Drop a keyfile to login.</div>
</div>
<div class="">
<p>
<br>
Weavemail is mail that <b>Google cannot read</b>.<br>
Mail that <b>cannot be censored</b>.<br>
Mail that <b>cannot be lost</b>.<br>
<span style="display: inline-block; margin-top: 0.5em; margin-bottom: 0.75em;">Weavemail is mail that <b>you own</b>.</span><br>
</p>
<button
class="button button-outline"
onclick=" window.open('https://tokens.arweave.org','_blank')">
Get a wallet with some tokens.
</button>
</div>
</div>
</header>
</div>
<div id="inbox_page" style="display: none;">
<h1 id="mail_address" style="display: inline-block; margin-right: 0.5em;">...</h1>
<button onclick="compose_mail()">Compose</button>
<table>
<thead>
<tr>
<td>Sender</td>
<td>ID</td>
<td>Fee</td>
<td>AR</td>
</tr>
</thead>
<tbody id="inbox_pane">
</tbody>
</table>
</div>
<div id="view_page" style="display: none;">
<fieldset>
<h1 id="view_title">View mail</h1>
<label for="view_subject">Mail subject</label>
<p id="view_subject">View mail</p>
<label for="view_contents">Mail contents</label>
<div id="view_contents">...</div>
<button id="reply">Reply</button>
<button onclick="switch_to_page('inbox_page')">Back to inbox</button>
</fieldset>
</div>
<div id="compose_page" style="display: none;">
<fieldset>
<h1>Write a new permamail</h1>
<label for="compose_address">Mail recipient</label>
<input type="text" placeholder="Arweave address" id="compose_address">
<label for="compose_subject">Mail subject</label>
<input type="text" placeholder="Subject" id="compose_subject">
<label for="compose_content">Mail contents</label>
<textarea id="compose_content"></textarea>
<label for="compose_address">AR tokens to send</label>
<input type="text" placeholder="0 AR" id="compose_tokens"><br>
<button onclick="send_mail()">Send</button>
<button onclick="switch_to_page('inbox_page')">Discard message</button>
</fieldset>
<fieldset id="previous_page" style="display: none;">
<h1>Previous Message</h1>
<div><span><strong>From: </strong></span><span id="previousSender"></span></div>
<div id="previousDateTag"><span><strong>Date: </strong></span><span id="previousDateMsg"></span></div>
<label for="previousSubject">Mail subject</label>
<p id="previousSubject">View mail</p>
<label for="previousMsg">Mail contents</label>
<p id="previousMsg"></p>
</fieldset>
</div>
</body>
</html>