-
Notifications
You must be signed in to change notification settings - Fork 2
/
map.php
212 lines (165 loc) · 6.67 KB
/
map.php
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
<?php
include "PHP/config.php";
$config = array();
$width = (int)abs($CONFIG["world"]["maxX"] - $CONFIG["world"]["minX"]);
$height = (int)abs($CONFIG["world"]["maxZ"] - $CONFIG["world"]["minZ"]);
$world = array(
"x" => (int)$CONFIG["world"]["minX"],
"z" => (int)$CONFIG["world"]["minZ"],
"width" => $width,
"height" => $height
);
$config["world"] = $world;
echo "<script>const Config = JSON.parse('" . json_encode($config) . "');</script>";
?>
<!DOCTYPE html>
<html>
<head>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0' name='viewport'/>
<link rel="stylesheet" type="text/css" href="css/main.css?antiCache=7">
<link rel="stylesheet" type="text/css" href="css/chat.css?antiCache=1">
<title><?php echo $CONFIG["server"]["name"] . " | World Map"; ?></title>
</head>
<body style="overflow: hidden;" class="noselect">
<div id="topBar">
<img src="images/homeIcon.svg" class="button" onclick="window.location.replace('index.php')">
<img src="images/menuIcon.png" class="button infoMenuIcon" style="display: none" onclick="InfoMenu.open()">
<div class="shadowBackground"></div>
</div>
<div id="chatHolder" class="hide" onclick="Chat.toggle();">
<div class="shadowHolder"></div>
</div>
<div id="mapHolder">
<?php
echo '<img src="PHP/renderMap.php?world=overworld' .
'&x=' . (int)$CONFIG["world"]["minX"] .
'&z=' . (int)$CONFIG["world"]["minZ"] .
'&width=' . $width .
'&height=' . $height . '" id="mapImage">' .
'<canvas id="mapCanvas" width="' . $width . '" height="' . $height . '"></canvas>';
?>
<div id="chatlog"></div>
</div>
<div class="coordinatesHolder" id="coordinatesHolder">
<span id="current_x">0</span>
<span id="current_z">0</span>
</div>
<?php
if (!$CONFIG["nether"]["disabled"])
{
echo '<div class="buttonHolder" id="dimensionButtonHolder">
<div class="text netherPortalButton" onclick="window.location.replace(\'nether.php\')">
NETHER
</div>
</div>';
} else {
echo '<style>.netherPortalButton {display: none !important}</style>';
}
?>
<!-- InfoMenu html includecode -->
<div id="infoMenu">
<div class="infoMenuPage">
<div class="headerText preventTextOverflow">PROJECTS</div>
<img class="icon" src="images/exitIcon.png" onclick="InfoMenu.close()">
<img class="icon searchIcon" src="images/searchIcon.png" onclick="InfoMenu.search.open()">
<img class="icon heatMapIcon" src="images/heatMapIcon_off.png" onclick="toggleHeatMap()">
<div id="projectListHolder"></div>
</div>
<div class="infoMenuPage hide">
<div class="headerText preventTextOverflow" id="projectPage_titleHolder">PROJECTS</div>
<img class="icon" src="images/exitIcon.png" onclick="InfoMenu.openPageByIndex(0)">
<div class="text" id="projectPage_coordHolder"></div>
<div class="text subHeader"><br>BUILDERS</div>
<div class="text" id="projectPage_builderNames"></div>
<div class="text subHeader"><br>DESCRIPTION</div>
<div class="text" id="projectPage_description"></div>
<br>
<div class="text netherPortalButton">TO THE NETHER</div>
<br>
<div class="text subHeader"><br>MINIMAP</div>
<div class="miniMapHolder">
<img class="miniMapImg">
</div>
<div class="text subHeader"><br>IMAGES</div>
<div id="projectPage_imageHolder"></div>
</div>
<div class="infoMenuPage hide">
<input class="headerText preventTextOverflow searchInput" placeholder="Search">
<img class="icon exitIcon" src="images/exitIcon.png" onclick="InfoMenu.openPageByIndex(0)">
<div id="projectSearchListHolder"></div>
</div>
</div>
<script type="text/javascript" src="https://florisweb.tk/JS/jQuery.js"></script>
<script type="text/javascript" src="https://florisweb.tk/JS/request2.js"></script>
<!-- <script type="text/javascript" src="js/main_min.js?ac=1"></script> -->
<script type="text/javascript" src="js/client.js?a=1"></script>
<script>
// temperarelly so things don't get cached
let antiCache = Math.random() * 100000000;
$.getScript("js/handyFunctions.js?antiCache=" + antiCache, function() {});
$.getScript("js/chat.js?antiCache=" + antiCache, function() {});
$.getScript("js/map.js?antiCache=" + antiCache, function() {});
$.getScript("js/server.js?antiCache=" + antiCache, function() {});
$.getScript("js/infomenu.js?antiCache=" + antiCache, function() {});
</script>
<!-- <script type="text/javascript" src="js/server.js?antiCache=4"></script> -->
<!-- <script type="text/javascript" src="js/infomenu.js?antiCache=2"></script> -->
</body>
</html>
<script>
function executeUrlCommands() {
<?php
$project = $_GET["project"];
$project = explode('"', $project);
$project = implode("", $project);
if (!empty($project))
{
echo "InfoMenu.openProjectPageByTitle(\"" . (string)$project . "\");";
echo "Map.panToItem(Server.getItemByTitle(\"" . (string)$project . "\"));";
}
?>
executeUrlCommands = null;
}
document.body.onload = function() {
setup();
}
var Server;
var Map;
var InfoMenu;
var Client;
function setup() {
Server = new _server();
Map = new _map();
InfoMenu = new _InfoMenu_mapJsExtender();
Client = new _client();
Map.init(1);
Map.onItemClick = function(_item) {InfoMenu.openProjectPageByTitle(_item.title)}
InfoMenu.onItemClick = function(_item) {Map.panToItem(_item)}
renderMap(heatMapEnabled);
}
let heatMapEnabled = false;
function toggleHeatMap() {
heatMapEnabled = !heatMapEnabled;
renderMap(heatMapEnabled);
$(".heatMapIcon")[0].src = "images/heatMapIcon_off.png";
document.body.classList.remove("heatMapMode");
if (!heatMapEnabled) return;
$(".heatMapIcon")[0].src = "images/heatMapIcon_on.png";
document.body.classList.add("heatMapMode");
}
function renderMap(_renderHeatMap = true) {
Map.clear();
if (!_renderHeatMap) renderProjects();
if (_renderHeatMap) Server.getHeatMaps().then(function (_data) {
Map.drawHeatMap(_data);
renderProjects();
});
function renderProjects() {
Server.getData("uploads/data.txt").then(function (_data) {
InfoMenu.createItemsByList(_data);
Map.drawPoints(_data);
if (executeUrlCommands) executeUrlCommands();
});
}
}
</script>