Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tjcsl/ion
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f1f3452b44994579477ccfaba9effda2cd8c7d27
Choose a base ref
..
head repository: tjcsl/ion
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b74433cc93f6eded8f4b29075d199f66f4986edf
Choose a head ref
Showing with 28 additions and 28 deletions.
  1. +28 −28 intranet/static/js/bus-afternoon.js
56 changes: 28 additions & 28 deletions intranet/static/js/bus-afternoon.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { getSocket } from "./bus-shared.js";
/* globals Messenger */
var bus = {};

$(function() {
$(function () {
let base_url = window.location.host;

bus.sendUpdate = function (data) {
@@ -28,11 +28,11 @@ $(function() {
bus.StatusGroupModel = Backbone.Model.extend();

bus.PersonalStatusView = Backbone.View.extend({
initialize: function() {
initialize: function () {
_.bindAll(this, 'render');
this.template = _.template($('#personal-status').html());
},
render: function() {
render: function () {
var container = this.$el,
renderedContent = this.template(this.model.toJSON());
container.html(renderedContent);
@@ -84,7 +84,7 @@ $(function() {
'text': this.text
};
this.$el.html(this.buttonTemplate(data))
.removeClass('search-widget');
.removeClass('search-widget');
return this;
},
renderSearchView: function (routeList, action) {
@@ -95,8 +95,8 @@ $(function() {
let busList = [];
if (action === 'Search for a bus') {
busList = routeList.filter(bus => bus.attributes.status === 'a')
.filter(bus => bus.attributes.route_name.includes('JT'))
.map(bus => bus.attributes);
.filter(bus => bus.attributes.route_name.includes('JT'))
.map(bus => bus.attributes);
} else if (action === 'Mark a bus as arrived or on time') {
busList = routeList.map(bus => {
if ((bus.attributes.status === 'a' || bus.attributes.status === 'd') && !bus.attributes.route_name.includes('JT')) {
@@ -124,7 +124,7 @@ $(function() {
}).flat().filter((element) => element != null);
} else if (action === 'Assign a bus to this space') {
busList = routeList.filter(bus => bus.attributes.status !== 'a')
.map(bus => bus.attributes);
.map(bus => bus.attributes);
}
let selectField = container.find('select').selectize({
'options': busList,
@@ -172,7 +172,7 @@ $(function() {
if (!this.selected) {
return;
}
let route = this.model.findWhere({route_name: e.target.value}).attributes;
let route = this.model.findWhere({ route_name: e.target.value }).attributes;
route.space = this.selected.id;
route.status = 'a';
bus.sendUpdate(route);
@@ -193,7 +193,7 @@ $(function() {
route_name = e.target.value.split(' ')[1];
st = 'a';
}
let route = this.model.findWhere({route_name: route_name}).attributes;
let route = this.model.findWhere({ route_name: route_name }).attributes;
route.status = st;
bus.sendUpdate(route);
}
@@ -367,18 +367,18 @@ $(function() {
// fallbacks to avoid issues that have appeared in the past with the "sans-serif" default.
text.font("family", "Helvetica, Arial, 'Open Sans', 'Liberation Sans', sans-serif");

if(window.isSignage) {
if (window.isSignage) {
var tspan = $(text.node).find("tspan");
tspan.attr({"x": 0, "dy": 20.5});
tspan.attr({ "x": 0, "dy": 20.5 });

// If we run this directly, it hasn't rendered yet, so we have to run it after a timeout
setTimeout(function() {
setTimeout(function () {
var tbox = tspan.get(0).getBBox();
var sbox = space.getBBox();

var offset;
var dimenDiff;
if(tbox.width > tbox.height) {
if (tbox.width > tbox.height) {
dimenDiff = sbox.width - tbox.width;
offset = tbox.x - sbox.x;
}
@@ -387,9 +387,9 @@ $(function() {
offset = tbox.y - sbox.y;
}

if(dimenDiff < offset + 5) {
if (dimenDiff < offset + 5) {
text.node.classList.add("small");
if(route.attributes.route_name.length > 5) {
if (route.attributes.route_name.length > 5) {
text.node.classList.add("extra-small");
}
}
@@ -398,21 +398,21 @@ $(function() {
else {
var tspan = $(text.node).find("tspan");

setTimeout(function() {
setTimeout(function () {
var tbox = tspan.get(0).getBBox();
var sbox = space.getBBox();

var offset;
var dimenDiff;
if(tbox.width > tbox.height) {
if (tbox.width > tbox.height) {
dimenDiff = sbox.width - tbox.width;
offset = tbox.x - sbox.x;
}
else {
dimenDiff = sbox.height - tbox.height;
offset = tbox.y - sbox.y;
}
if(dimenDiff < offset + 5 || route.attributes.route_name.length > 5) {
if (dimenDiff < offset + 5 || route.attributes.route_name.length > 5) {
text.node.classList.add("extra-small");
}
}, 0);
@@ -577,7 +577,7 @@ $(function() {
// equatorial radius of Earth = 6,378.1370 km
// polar radius of Earth = 6,356.7523 km

// length of 1 deg equatorial longitude
// length of 1 deg equatorial longitude
let deg_lng_eq = 6378.1370 * 2 * Math.PI / 360;
// length of 1 deg equatorial latitude
let deg_lat_eq = 6356.7523 * 2 * Math.PI / 360;
@@ -604,7 +604,7 @@ $(function() {
}*/
let degrees = (direction) * (180 / Math.PI) - 49 + 90;
// let degrees = (direction) * (180 / Math.PI);
this.busDriverEl.css({'transform' : 'rotate('+ degrees +'deg)'});
this.busDriverEl.css({ 'transform': 'rotate(' + degrees + 'deg)' });
this.mapbox.setCenter(this.busDriverBus.point.coordinates);

this.busDriverBus.lastFrame = time;
@@ -651,7 +651,7 @@ $(function() {
container.empty();
container.append(this.template(this.model.toJSON()));
_.each(this.model.attributes.collection, function (route) {
container.append(new bus.RouteView({model: route}).render().el);
container.append(new bus.RouteView({ model: route }).render().el);
});
return this;
}
@@ -716,23 +716,23 @@ $(function() {
}
});

if(isAdmin) {
$(".bus-announcement-save").click(function() {
if (isAdmin) {
$(".bus-announcement-save").click(function () {
bus.sendUpdate({
announcement: $(".bus-announcement").text()
});
$(".bus-announcement-save").text("Saved!").css("color", "green");
setTimeout(function() {
setTimeout(function () {
$(".bus-announcement-save").text("Save").css("color", "");
}, 1500);
});
$(".bus-announcement-clear").click(function() {
$(".bus-announcement-clear").click(function () {
$(".bus-announcement").text("");
bus.sendUpdate({
announcement: "",
});
$(".bus-announcement-clear").text("Cleared!").css("color", "green");
setTimeout(function() {
setTimeout(function () {
$(".bus-announcement-clear").text("Clear").css("color", "");
}, 1500);
});
@@ -757,7 +757,7 @@ $(function() {
Backbone.trigger('recordScore', e);
});
}
// window.personalStatusView = new bus.personalStatusView();
// window.personalStatusView = new bus.personalStatusView();
});

/* TODO: flip bus map to be horizontal
@@ -771,4 +771,4 @@ $(function() {
});
}, 1000);
});
*/
*/