-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout.html
244 lines (218 loc) · 7.65 KB
/
about.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html lang="en">
<head>
<link
href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
rel="stylesheet"
/>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.7.1/web3.min.js"
integrity="sha512-GKw4QT/RccGJIwQxY3MhyiQ5pHrhQ8SuKFEafV+WcpOvtz7iYFQuQGFCvmGlHLctJTe8KrWU1FqvF7VOkEAJtw=="
crossorigin="anonymous"
referrerpolicy="no-referrer">
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Anon Communicator</title>
<style>
body {
height: 100vh;
display: flex;
align-items: center;
background: linear-gradient(to top left, #28b487, #7dd56f);
}
h1 {
font-family: sans-serif;
font-size: 50px;
line-height: 1;
width: 100%;
padding: 10px;
text-align: center;
color: white;
}
.button {
background-color: #bb310e;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
/* The side navigation menu */
.sidenav {
height: 100%; /* 100% Full-height */
width: 0; /* 0 width - change this with JavaScript */
position: fixed; /* Stay in place */
z-index: 1; /* Stay on top */
top: 0; /* Stay at the top */
left: 0;
background-color: #30e2aa; /* Shade of green*/
overflow-x: hidden; /* Disable horizontal scroll */
padding-top: 60px; /* Place content 60px from the top */
transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
}
/* The navigation menu links */
.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
/* When you mouse over the navigation links, change their color */
.sidenav a:hover {
color: #f1f1f1;
}
/* Position and style the close button (top right corner) */
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
/* Style page content - use this if you want to push the page content to the right when you open the side navigation */
#main {
transition: margin-left .5s;
padding: 20px;
}
/* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
</style>
</head>
<body class="h-full">
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<br><br>
<a href="index.html">Home</a>
<a href="registerArt.html">Register Art</a>
<a href="mailBox.html">Mail Box</a>
<a href="about.html">About</a>
</div>
<span onclick="openNav()" class="text-blue-500 "> >click </span>
<div id="main"
class="
flex
w-full
h-full
justify-center
content-center
items-center
space-x-4
"
>
<div class="flex flex-col space-y-6">
<h1 class="text-center">About</h1>
<div class="flex flex-col space-y-2">
</div>
</div>
</div>
<p id="demo"></p>
<!-- <script src="./script.js"></script> -->
<script>
function buildJson() {
var y = document.getElementById("messageArea").value;
var x = document.getElementById("recepientAddress").value;
var f = '{"address" :"'+x +'", "message" :"' +y +' "}'
console.log(f)
//const myJSON= '{"address":"0x123456", "message":"I want to buy your NFT"}';
//const myObj = JSON.parse(myJSON);
const myObj = JSON.parse(f);
document.getElementById("demo").innerHTML = myObj.address;
//document.getElementById("demo").innerHTML = myObj.message;
}
window.userAddress = null;
const loginButton = document.getElementById('loginButton')
window.onload = async () => {
// Init Web3 connected to ETH network
if (window.ethereum) {
window.web3 = new Web3(window.ethereum);
} else {
alert("No ETH brower extension detected.");
}
// Load in Localstore key
window.userAddress = window.localStorage.getItem("userAddress");
showAddress();
};
// Use this function to turn a 42 character ETH address
// into an address like 0x345...12345
function truncateAddress(address) {
if (!address) {
return "";
}
return `${address}`;
}
// Display or remove the users know address on the frontend
function showAddress() {
if (!window.userAddress) {
document.getElementById("userAddress").innerText = "";
document.getElementById("logoutButton").classList.add("hidden");
return false;
}
document.getElementById(
"userAddress"
).innerText = `ETH Address: ${truncateAddress(window.userAddress)}`;
document.getElementById("logoutButton").classList.remove("hidden");
}
// remove stored user address and reset frontend
function logout() {
window.userAddress = null;
window.localStorage.removeItem("userAddress");
showAddress();
}
// Login with Web3 via Metamasks window.ethereum library
async function loginWithEth() {
if (window.web3) {
try {
// We use this since ethereum.enable() is deprecated. This method is not
// available in Web3JS - so we call it directly from metamasks' library
const selectedAccount = await window.ethereum
.request({
method: "eth_requestAccounts",
})
.then((accounts) => accounts[0])
.catch(() => {
throw Error("No account selected!");
});
window.userAddress = selectedAccount;
window.localStorage.setItem("userAddress", selectedAccount);
showAddress();
} catch (error) {
console.error(error);
}
} else {
alert("No ETH brower extension detected.");
}
}
/* Set the width of the side navigation to 250px */
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
}
/* Set the width of the side navigation to 0 */
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
/* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
document.body.style.backgroundColor = "white";
}
</script>
</body>
</html>