-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
210 lines (173 loc) · 6.79 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WSJT-Diff</title>
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="leaflet.css">
<!-- for the time being, externalize later -->
<style>
html, body, #container, .row {
height: 100%;
}
#map {
height: 100%;
box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#infocard{
margin:15px 0 15px 0;
}
#dropzone{
color: #ccc;
border-style: dashed;
border-color: #ccc;
line-height: 20px;
height:200px;
text-align: center;
border-radius: 5px;
padding-top: 60px;
}
#dropzone.active{
border-style: solid;
border-color: #35a2ff;
background-color: #bfe3ff;
}
#dropzone.active div{
color: #35a2ff;
}
#dropzone div{
height: 60px;
}
.comp-control-parent{
border-radius: 5px;
opacity: 1;
border: 10px solid rgba(255, 255, 255, .8);
}
.comp-control-parent>.btn{
opacity: 1;
}
.loglinToggle{
border-top: 10px solid rgba(255, 255, 255, .8);
width: 100%;
}
.toggleBtn{
width: 50%;
}
</style>
</head>
<body>
<div class="container-fluid" id="container">
<div class="row">
<div id="map" class="col-8 col-sm-8 col-md-8 col-lg-9 col-xl-9"></div>
<div id="sidebar" class="col-4 col-sm-4 col-md-4 col-lg-3 col-xl-3">
<div class="card" id="infocard">
<div class="card-body">
<h5 class="card-title">WSJT Diff</h5>
<h6 class="card-subtitle mb-2 text-muted">Geographical Diff of WSJT Logfiles</h6>
<div class="d-none d-md-block">
<p class="card-text">This is a small project that aims to provide a nice interface
to compare different WSJT logfiles.
All code is free and online on Github.
</p>
<p class="font-weight-light"> Created by MrCircuitmatt and HB3YMB</p>
</div>
<a href="https://github.com/mweyland/wsjt-diff" target="_blank" class="card-link">WSJT-Diff on Github</a>
</div>
</div>
<div id="dropzone" ondragend="dragEnd(event)" ondragleave="dragEnd(event)" ondragover="dragOver(event)" ondrop="drop(event)">
<div>
Drop your <br>WSJT ALL.TXT <br>here!
</div>
</div>
</div>
</div>
</div>
<!-- debug -->
<script src="jquery.js"></script>
<script src="leaflet.js"></script>
<script src="comparator-control.js"></script>
<script src="cake-marker.js"></script>
<script src="wsjt-parser.js"></script>
<script src="representations.js"></script>
<script src="vars.js"></script>
<!-- for the time being, externalize later -->
<script>
var map = L.map('map',{attributionControl:false}).setView([47.18926, 8.17503], 10);
var tileLayer = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiZm94dHJvdHQxMiIsImEiOiJjamMzamRmd3gwdDI5MzNyNmYyYzR3MXo2In0.zliegd2CbZ_LzzShoSQCvw', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: 18,
id: 'mapbox.streets',
accessToken: 'pk.eyJ1IjoiZm94dHJvdHQxMiIsImEiOiJjamMzamRmd3gwdDI5MzNyNmYyYzR3MXo2In0.zliegd2CbZ_LzzShoSQCvw'
});
var attribution = L.control.attribution({prefix: '<a href="https://github.com/mweyland/wsjt-diff" target="_blank" class="card-link">WSJT-Diff</a> | Leaflet'})
attribution.addTo(map)
tileLayer.addTo(map);
//needed if we use the LogRepresentation Class, so we can toggle layers...
//var controls = L.control.layers({"Mapbox Base": tileLayer},{},{collapsed: false});
//controls.addTo(map)
var compControl = L.control.comparatorControl();
compControl.addTo(map);
var logComparator = new LogComparator("Log comparison", compControl);
logComparator.addTo(map);
function dragOver(ev) {
ev.preventDefault();
addClass(document.getElementById("dropzone"), "active");
}
function dragEnd(ev) {
ev.preventDefault();
removeClass(document.getElementById("dropzone"), "active")
}
//handler for the drop and drag
function drop(ev) {
ev.preventDefault();
console.log("Dropped file");
// If dropped items aren't files, reject them
var dt = ev.dataTransfer;
if (dt.items) {
// Use DataTransferItemList interface to access the file(s)
for (var i=0; i < dt.items.length; i++) {
if (dt.items[i].kind == "file") {
var f = dt.items[i].getAsFile();
parseDroppedFile(f);
}
}
} else {
// Use DataTransfer interface to access the file(s)
for (var i=0; i < dt.files.length; i++) {
parseDroppedFile(f);
}
}
removeClass(document.getElementById("dropzone"), "active")
}
function parseDroppedFile(file){
console.log("Parsing dropped file");
console.log(file);
var reader = new FileReader();
reader.readAsText(file);
reader.onloadend = function(e){
console.log(e);
//console.log(reader.result)
parseText(reader.result, file.name);
}
}
function parseText(text, name){
var wsjt_timeHashmap = wsjt_partition_log(text);
//well, let us focus on the loc Comparator right now...
//var log = new LogRepresentation(wsjt_timeHashmap, name);
//log.addTo(map, controls)
logComparator.addLog(wsjt_timeHashmap, name, compControl);
//zoom map to bounds
//map.fitBounds(log.getBounds());
}
//marker testing:
//var testMarker = L.marker.cakeMarker([47.18926, 8.17503],{pieces: [[180,"#F00"],[30, "#0F0"],[40, "#00F"],[50,"#F0F"]]})
//var testMarker2 = L.marker.cakeMarker([47.59926, 8.17503],{pieces: [[180,"#00F"]]})
//testMarker.addTo(map);
//testMarker2.addTo(map);
// FOR YOUR PLEASURE
// COMMENT IN PRODUCTION
parseText(log1, "Demo Log 1");
parseText(log2, "Demo Log 2");
</script>
</body>
</html>