Skip to content

Commit 4b946a8

Browse files
committed
nyan mode is back!
1 parent c9d8c3a commit 4b946a8

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

js/app.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function lhash_update(history_step) {
3535
$("header .search input[type='text']").val(wvar.query);
3636
}
3737

38+
// other vars
39+
if(wvar.nyan) {
40+
hash += "&nyan=1";
41+
}
42+
3843
hash = encodeURI(hash);
3944
// set state
4045
if(history_supported) {
@@ -80,6 +85,7 @@ function load_hash(no_refresh) {
8085
zoom: true,
8186
focus: "",
8287
query: "",
88+
nyan: false,
8389
};
8490

8591
parms.forEach(function(v) {
@@ -124,7 +130,7 @@ function load_hash(no_refresh) {
124130
});
125131

126132
// check if we should force refresh
127-
['mode','query'].forEach(function(k) {
133+
['mode','query','nyan'].forEach(function(k) {
128134
if(wvar[k] != def[k]) refresh = true;
129135
});
130136

js/tracker.js

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,18 @@ var balloon_index = 0;
3636
var balloon_colors_name = ["red", "blue", "green", "yellow", "purple", "orange", "cyan"];
3737
var balloon_colors = ["#f00", "blue", "green", "#FDFC30", "#c700e6", "#ff8a0f", "#0fffca"];
3838

39+
var nyan_color_index = 0;
40+
var nyan_colors = ['nyan', 'nyan-coin', 'nyan-mon', 'nyan-pirate', 'nyan-cool', 'nyan-tothemax', 'nyan-pumpkin', 'nyan-afro', 'nyan-coin', 'nyan-mummy'];
41+
var rainbow = ["#ff0000", "#fc9a00", "#f6ff00", "#38ff01", "#009aff","#0000ff"];
42+
3943
var map = null;
4044
var overlay = null;
4145
var layer_clouds = null;
4246

4347
var notamOverlay = null;
4448

49+
var svgRenderer = L.svg();
50+
4551
var modeList = [
4652
// "Position",
4753
"1 hour",
@@ -353,6 +359,7 @@ function clean_refresh(text, force, history_step) {
353359

354360
car_index = 0;
355361
balloon_index = 0;
362+
nyan_color_index = 0;
356363
stopFollow(force);
357364

358365
// add loading spinner in the vehicle list
@@ -385,8 +392,6 @@ function load() {
385392
preferCanvas: true,
386393
});
387394

388-
var svgRenderer = L.svg();
389-
390395
map.addControl(new L.Control.Fullscreen({ position: 'bottomleft' }));
391396

392397
new L.Control.Zoom({ position: 'bottomright' }).addTo(map);
@@ -1906,7 +1911,7 @@ function addPosition(position) {
19061911
});
19071912
}
19081913
}
1909-
this.setIcon(img);
1914+
if (!wvar.nyan) {this.setIcon(img);};
19101915
};
19111916
marker.setAltitude = function(alt) {
19121917
//var pos = overlay.getProjection().fromLatLngToDivPixel(this.shadow.getLatLng());
@@ -2075,6 +2080,41 @@ function addPosition(position) {
20752080

20762081
// deep copy yaxes config for graph
20772082
plot_options.yaxes.forEach(function(v) { vehicle_info.graph_yaxes.push($.extend({}, v)); });
2083+
2084+
//nyan cat (very important feature)
2085+
if(wvar.nyan && vehicle_info.vehicle_type == "balloon") {
2086+
var nyan = nyan_colors[nyan_color_index] + ".gif";
2087+
nyan_color_index = (nyan_color_index + 1) % nyan_colors.length;
2088+
var nyanw = (nyan_color_index == 4) ? 104 : 55;
2089+
2090+
nyanIcon = new L.icon ({
2091+
iconUrl: host_url + markers_url + nyan,
2092+
iconSize: [nyanw,39],
2093+
iconAnchor: [26,20],
2094+
});
2095+
2096+
vehicle_info.marker.setIcon(nyanIcon);
2097+
2098+
vehicle_info.image_src = host_url + markers_url + "hab_nyan.gif";
2099+
vehicle_info.image_src_offset = [-34,-70];
2100+
2101+
var k;
2102+
for(k in vehicle_info.polyline) {
2103+
map.removeLayer(vehicle_info.polyline[k]);
2104+
}
2105+
2106+
vehicle_info.polyline = [];
2107+
2108+
for(k in rainbow) {
2109+
vehicle_info.polyline.push(new L.Polyline(point, {
2110+
zIndexOffset: (Z_PATH - (k * 1)),
2111+
color: rainbow[k],
2112+
opacity: 1,
2113+
weight: (k*4) + 2,
2114+
}).addTo(map));
2115+
vehicle_info.polyline[k].bringToBack();
2116+
}
2117+
}
20782118

20792119
vehicle_info.kill = function() {
20802120
$(".vehicle"+vehicle_info.uuid).remove();

0 commit comments

Comments
 (0)