This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
addLocation.html
178 lines (155 loc) · 5.32 KB
/
addLocation.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
<!--
// addLocation.html
//
// Created by Darlingnotin in 2019.
// Copyright 2019 Darlingnotin
//
// Distributed under the ISC license.
// See the accompanying file LICENSE or https://opensource.org/licenses/ISC
-->
<!DOCTYPE html>
<html>
<head>
<title>Explore</title>
<link href="bootstrap.min.css" rel="stylesheet">
<style>
.myButton {
box-shadow: 3px 4px 0px 0px #899599;
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
background-color: #ededed;
border-radius: 15px;
border: 1px solid #d6bcd6;
display: inline-block;
cursor: pointer;
color: #3a8a9e;
font-family: Arial;
font-size: 17px;
padding: 2px 19px;
text-decoration: none;
text-shadow: 0px 1px 0px #e1e2ed;
}
.myButton:hover {
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
background-color: #bab1ba;
}
.myButton:active {
position: relative;
top: 1px;
}
.myButtonB {
box-shadow: 3px 4px 0px 0px #899599;
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
background-color: #ededed;
border-radius: 15px;
border: 1px solid #d6bcd6;
display: inline-block;
cursor: pointer;
color: #3a8a9e;
font-family: Arial;
font-size: 17px;
padding: 2px 19px;
text-decoration: none;
text-shadow: 0px 1px 0px #e1e2ed;
position: absolute;
right: 0;
}
.myButtonB:hover {
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
background-color: #bab1ba;
}
.myButtonB:active {
position: relative;
top: 1px;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td,
th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #EFEFEF;
}
input[type=text],
select {
width: 450px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #dddddd;
border-radius: 4px;
box-sizing: border-box;
}
</style>
</head>
<body onload="retrieveInformation()">
<h1>Add Location</h1><br>
<h3>Location List Provider URL</h3>
<select id="javascriptURL">
</select>
<h3>Domain Name</h3>
<input type="text" id="domainName" placeholder="Enter Domain Name here">
<h3>Owner</h3>
<input type="text" id="owner" placeholder="Enter Owner here">
<h3>Port</h3>
<input type="text" id="port" placeholder="Enter Port here (default 40102)"><br><br>
<button class="myButton" onclick="addLocation()">Add</button>
<script>
var retrievePortInformationResponse;
var metaverseProviderList = [];
function retrieveInformation() {
var readyEvent = {
"action": "retrievePortInformation",
};
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
}
function addToSelect() {
for (let i = 0; i < metaverseProviderList.length; i++) {
var x = document.getElementById("javascriptURL");
var option = document.createElement("option");
option.text = metaverseProviderList[i];
x.add(option);
}
}
function addLocation() {
var domainName = document.getElementById("domainName").value;
if (domainName == "") {
domainName = "Enter domain name";
}
var owner = document.getElementById("owner").value;
if (owner == "") {
owner = "Enter owner of domain";
}
var port = document.getElementById("port").value;
var javascriptURL = document.getElementById("javascriptURL").value;
if (port == "") {
port = 40102;
}
var readyEvent = {
"action": "addLocation",
"domainName": domainName,
"owner": owner,
"Port": port,
"script": javascriptURL
};
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
}
EventBridge.scriptEventReceived.connect(function (message) {
var messageData = JSON.parse(message);
if (messageData.action == "retrievePortInformationResponse") {
retrievePortInformationResponse = messageData.goToAddresses;
for (let i = 0; i < retrievePortInformationResponse.length; i++) {
metaverseProvider = retrievePortInformationResponse[i].split("/")[2].split(":")[0];
metaverseProviderList[metaverseProviderList.length] = "https://" + metaverseProvider + "/interim/d-goto/app/decentralizedGoToServerScript.js";
}
addToSelect();
}
});
</script>
</body onload="retrieveAddressList()">
</html>