Skip to content

Commit 227b2fd

Browse files
fully working embedding
1 parent 7bb7c49 commit 227b2fd

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

embed-preview.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
params += "&hidelist=" + ($("#opt_list").prop("checked") ? 0 : 1);
7171
params += "&hidegraph=" + ($("#opt_graph").prop("checked") ? 0 : 1);
7272
params += "&expandgraph=" + ($("#opt_graph_open").prop("checked") ? 1 : 0);
73+
params += "&filter=" + encodeURIComponent($("#opt_filter").val());
7374

7475
console.log(params);
7576

@@ -88,6 +89,11 @@
8889

8990
// preview update methods
9091

92+
// filter
93+
$("#opt_filter").on('keyup', function() {
94+
updateCode();
95+
});
96+
9197
// vehicle list
9298
$("#opt_list").on('change', function() {
9399
var elm = $("#opt_list");
@@ -204,6 +210,9 @@
204210
<h1>Embed mobile tracker on your page</h1>
205211
<h2>1. Options</h1>
206212
<fieldset>
213+
<label for="opt_filter">Vehicle filter (;)</label>
214+
<input type="input" value="" id="opt_filter" size="40" />
215+
<br />
207216
<input type="checkbox" value="1" id="opt_list" />
208217
<label for="opt_list">Enable vehicle list</label>
209218
<br />

js/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ if(
1212
) is_mobile = true;
1313

1414
// embed detection
15+
var vfilter = "";
16+
var nyan_mode = false;
1517

1618
var embed = {
1719
enabled: false,
@@ -30,6 +32,8 @@ for(var idx in params) {
3032
case "hidelist": if(line[1] == "1") embed.vlist = false; break;
3133
case "hidegraph": if(line[1] == "1") embed.graph = false; break;
3234
case "expandgraph": if(line[1] == "1") embed.graph_expanded = true; break;
35+
case "filter": vfilter = line[1]; break;
36+
case "nyan": nyan_mode = true; break;
3337
}
3438
}
3539

js/tracker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var mission_id = 0;
22
var position_id = 0;
3-
var data_url = "http://spacenear.us/tracker/data.php?vehicles=";
3+
var data_url = "http://spacenear.us/tracker/data.php";
44
var receivers_url = "http://spacenear.us/tracker/receivers.php";
55
var predictions_url = "http://spacenear.us/tracker/get_predictions.php";
66
var host_url = "";
@@ -755,7 +755,7 @@ function addPosition(position) {
755755
if(plot) $.each($.extend(false, plot_options.yaxes, {}), function(k,v) { vehicle_info.graph_yaxes.push(v) });
756756

757757
// nyan mod
758-
if(window.location.search == "?nyan" && vehicle_info.vehicle_type == "balloon") {
758+
if(nyan_mode && vehicle_info.vehicle_type == "balloon") {
759759
// form a nyancat
760760
vehicle_info.marker.setMap(null);
761761
vehicle_info.marker.setMode = function(derp) {};
@@ -968,7 +968,7 @@ function refresh() {
968968
$.ajax({
969969
type: "GET",
970970
url: data_url,
971-
data: "format=json&position_id=" + position_id + "&max_positions=" + max_positions,
971+
data: "format=json&max_positions=" + max_positions + "&position_id=" + position_id + "&vehicles=" + encodeURIComponent(vfilter),
972972
dataType: "json",
973973
success: function(response, textStatus) {
974974
update(response);

0 commit comments

Comments
 (0)