Switch from jshint to eslint
parent
50fdc96d4b
commit
a0635a4c9c
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"jquery": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"curly": [
|
||||||
|
"error",
|
||||||
|
"all"
|
||||||
|
],
|
||||||
|
"one-var-declaration-per-line": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"new-cap": "error"
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,11 +4,11 @@ python:
|
||||||
- "2.7"
|
- "2.7"
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements/dev.txt
|
- pip install -r requirements/dev.txt
|
||||||
- npm install -g jshint stylelint
|
- npm install -g eslint stylelint
|
||||||
script:
|
script:
|
||||||
- flake8 .
|
- flake8 .
|
||||||
- jshint .
|
|
||||||
- pytest
|
- pytest
|
||||||
|
- eslint 'network/static/js/*.js'
|
||||||
- stylelint 'network/static/css/*.css'
|
- stylelint 'network/static/css/*.css'
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
|
|
|
@ -1,45 +1,58 @@
|
||||||
/* This script calculates the grid locator based on the Maidenhead
|
/* This script calculates the grid locator based on the Maidenhead
|
||||||
* Locator System. It references the longitude and latitude fields
|
* Locator System. It references the longitude and latitude fields
|
||||||
* in the Station Add/Edit view, calculating the grid square and adding
|
* in the Station Add/Edit view, calculating the grid square and adding
|
||||||
* that to the location field iff both lat/lon values exist and are
|
* that to the location field if both lat/lon values exist and are
|
||||||
* valid. -cshields
|
* valid.
|
||||||
*/
|
*/
|
||||||
function gridsquare() {
|
|
||||||
var FIELD_IDENTIFIERS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
|
||||||
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
|
||||||
|
|
||||||
// starting points, the fields from the Station form
|
$(document).ready(function() {
|
||||||
var latitude = $('#lat').val();
|
'use strict';
|
||||||
var longitude = $('#lng').val();
|
|
||||||
|
|
||||||
// this gets called any time one of the two lat/long fields
|
function gridsquare() {
|
||||||
// have been changed. We only need to do the work if both
|
var FIELD_IDENTIFIERS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
||||||
// fields have been entered with a proper entry, otherwise
|
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
||||||
// skip the cycles
|
|
||||||
if ((latitude !== '') &&
|
|
||||||
(latitude <= 90) &&
|
|
||||||
(latitude >= -90) &&
|
|
||||||
(longitude !== '') &&
|
|
||||||
(longitude <= 180) &&
|
|
||||||
(longitude >= -180)) {
|
|
||||||
|
|
||||||
// to figure out the individual grid identifiers we make a mess
|
// starting points, the fields from the Station form
|
||||||
// of the longitude and latitude
|
var latitude = $('#lat').val();
|
||||||
var working_lon = ((+longitude + 180) % 20);
|
var longitude = $('#lng').val();
|
||||||
var lon_field = FIELD_IDENTIFIERS[Math.floor((+longitude + 180) / 20)];
|
|
||||||
var lon_square = Math.floor(working_lon / 2);
|
|
||||||
working_lon = Math.floor((working_lon % 2) * 12);
|
|
||||||
var lon_subsquare = FIELD_IDENTIFIERS[working_lon];
|
|
||||||
|
|
||||||
var working_lat = ((+latitude + 90) % 10);
|
// this gets called any time one of the two lat/long fields
|
||||||
var lat_field = FIELD_IDENTIFIERS[Math.floor((+latitude + 90) / 10)];
|
// have been changed. We only need to do the work if both
|
||||||
var lat_square = Math.floor(working_lat);
|
// fields have been entered with a proper entry, otherwise
|
||||||
working_lat = Math.floor((working_lat - Math.floor(working_lat)) * 24);
|
// skip the cycles
|
||||||
var lat_subsquare = FIELD_IDENTIFIERS[working_lat];
|
if ((latitude !== '') &&
|
||||||
|
(latitude <= 90) &&
|
||||||
|
(latitude >= -90) &&
|
||||||
|
(longitude !== '') &&
|
||||||
|
(longitude <= 180) &&
|
||||||
|
(longitude >= -180)) {
|
||||||
|
|
||||||
// write the result, like EM69uf, to qthlocator field
|
// to figure out the individual grid identifiers we make a mess
|
||||||
var qthlocator = $('#qthlocator');
|
// of the longitude and latitude
|
||||||
qthlocator.val('' + lon_field + lat_field + lon_square + lat_square +
|
var working_lon = ((+longitude + 180) % 20);
|
||||||
lon_subsquare.toLowerCase() + lat_subsquare.toLowerCase());
|
var lon_field = FIELD_IDENTIFIERS[Math.floor((+longitude + 180) / 20)];
|
||||||
|
var lon_square = Math.floor(working_lon / 2);
|
||||||
|
working_lon = Math.floor((working_lon % 2) * 12);
|
||||||
|
var lon_subsquare = FIELD_IDENTIFIERS[working_lon];
|
||||||
|
|
||||||
|
var working_lat = ((+latitude + 90) % 10);
|
||||||
|
var lat_field = FIELD_IDENTIFIERS[Math.floor((+latitude + 90) / 10)];
|
||||||
|
var lat_square = Math.floor(working_lat);
|
||||||
|
working_lat = Math.floor((working_lat - Math.floor(working_lat)) * 24);
|
||||||
|
var lat_subsquare = FIELD_IDENTIFIERS[working_lat];
|
||||||
|
|
||||||
|
// write the result, like EM69uf, to qthlocator field
|
||||||
|
var qthlocator = $('#qthlocator');
|
||||||
|
qthlocator.val('' + lon_field + lat_field + lon_square + lat_square +
|
||||||
|
lon_subsquare.toLowerCase() + lat_subsquare.toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$('input#lat').change(function() {
|
||||||
|
gridsquare();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input#lng').change(function() {
|
||||||
|
gridsquare();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*global L*/
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -10,8 +12,8 @@ $(document).ready(function() {
|
||||||
var map = L.mapbox.map('map', mapboxid, {
|
var map = L.mapbox.map('map', mapboxid, {
|
||||||
zoomControl: false
|
zoomControl: false
|
||||||
}).setView([40, 0], 3);
|
}).setView([40, 0], 3);
|
||||||
var LocLayer = L.mapbox.featureLayer().addTo(map);
|
L.mapbox.featureLayer().addTo(map);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: stations
|
url: stations
|
||||||
}).done(function(data) {
|
}).done(function(data) {
|
||||||
|
@ -21,8 +23,8 @@ $(document).ready(function() {
|
||||||
geometry: {
|
geometry: {
|
||||||
type: 'Point',
|
type: 'Point',
|
||||||
coordinates: [
|
coordinates: [
|
||||||
parseFloat(m.lng),
|
parseFloat(m.lng),
|
||||||
parseFloat(m.lat)
|
parseFloat(m.lat)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* global moment, d3 */
|
||||||
|
|
||||||
$(document).ready( function(){
|
$(document).ready( function(){
|
||||||
function select_proper_transmitters(satellite) {
|
function select_proper_transmitters(satellite) {
|
||||||
$('#transmitter-selection').prop('disabled', false);
|
$('#transmitter-selection').prop('disabled', false);
|
||||||
|
@ -16,7 +18,7 @@ $(document).ready( function(){
|
||||||
|
|
||||||
if (obs_filter) {
|
if (obs_filter) {
|
||||||
satellite = $('input[name="satellite"]').val();
|
satellite = $('input[name="satellite"]').val();
|
||||||
ground_station = $('input[name="ground_station"]').val();
|
var ground_station = $('input[name="ground_station"]').val();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obs_filter_dates) {
|
if (!obs_filter_dates) {
|
||||||
|
@ -27,7 +29,7 @@ $(document).ready( function(){
|
||||||
$('#datetimepicker-start').data('DateTimePicker').minDate(moment.utc().add(minstart, 'm'));
|
$('#datetimepicker-start').data('DateTimePicker').minDate(moment.utc().add(minstart, 'm'));
|
||||||
$('#datetimepicker-end').datetimepicker();
|
$('#datetimepicker-end').datetimepicker();
|
||||||
$('#datetimepicker-end').data('DateTimePicker').minDate(moment.utc().add(minend, 'm'));
|
$('#datetimepicker-end').data('DateTimePicker').minDate(moment.utc().add(minend, 'm'));
|
||||||
$("#datetimepicker-start").on('dp.change',function (e) {
|
$('#datetimepicker-start').on('dp.change',function (e) {
|
||||||
// Setting default, minimum and maximum for end
|
// Setting default, minimum and maximum for end
|
||||||
$('#datetimepicker-end').data('DateTimePicker').defaultDate(moment.utc(e.date).add(60, 'm'));
|
$('#datetimepicker-end').data('DateTimePicker').defaultDate(moment.utc(e.date).add(60, 'm'));
|
||||||
$('#datetimepicker-end').data('DateTimePicker').minDate(e.date);
|
$('#datetimepicker-end').data('DateTimePicker').minDate(e.date);
|
||||||
|
@ -63,11 +65,11 @@ $(document).ready( function(){
|
||||||
$('#loading').hide();
|
$('#loading').hide();
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
var error_msg = data.error;
|
var error_msg = data.error;
|
||||||
console.log(data.error);
|
|
||||||
$('#windows-data').html('<span class="text-danger">' + error_msg + '</span>');
|
$('#windows-data').html('<span class="text-danger">' + error_msg + '</span>');
|
||||||
} else {
|
} else {
|
||||||
var dc = 0; // Data counter
|
var dc = 0; // Data counter
|
||||||
var suggested_data = [];
|
var suggested_data = [];
|
||||||
|
var label = '';
|
||||||
$('#windows-data').empty();
|
$('#windows-data').empty();
|
||||||
$.each(data, function(i, k){
|
$.each(data, function(i, k){
|
||||||
label = k.id + ' - ' + k.name;
|
label = k.id + ' - ' + k.name;
|
||||||
|
@ -120,8 +122,8 @@ $(document).ready( function(){
|
||||||
if (screen.width < 1200) { svg_width = 940; }
|
if (screen.width < 1200) { svg_width = 940; }
|
||||||
if (screen.width < 992) { svg_width = 720; }
|
if (screen.width < 992) { svg_width = 720; }
|
||||||
if (screen.width < 768) { svg_width = screen.width - 30; }
|
if (screen.width < 768) { svg_width = screen.width - 30; }
|
||||||
var svg = d3.select('#timeline').append('svg').attr('width', svg_width)
|
d3.select('#timeline').append('svg').attr('width', svg_width)
|
||||||
.datum(payload).call(chart);
|
.datum(payload).call(chart);
|
||||||
|
|
||||||
$('#hoverRes').show();
|
$('#hoverRes').show();
|
||||||
$('#schedule-observation').removeAttr('disabled');
|
$('#schedule-observation').removeAttr('disabled');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* global d3 WaveSurfer URI */
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -14,7 +16,7 @@ $(document).ready(function() {
|
||||||
return String(minute + ':' + second); // combine minute and second in string
|
return String(minute + ':' + second); // combine minute and second in string
|
||||||
};
|
};
|
||||||
|
|
||||||
$('.observation-data').each(function( index ){
|
$('.observation-data').each(function(){
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var data_groundstation = $this.data('groundstation');
|
var data_groundstation = $this.data('groundstation');
|
||||||
var data_time_start = 1000 * $this.data('start');
|
var data_time_start = 1000 * $this.data('start');
|
||||||
|
@ -33,17 +35,17 @@ $(document).ready(function() {
|
||||||
div.find('#name').text(datum.label);
|
div.find('#name').text(datum.label);
|
||||||
})
|
})
|
||||||
.margin({left:140, right:10, top:0, bottom:50})
|
.margin({left:140, right:10, top:0, bottom:50})
|
||||||
.tickFormat({format: d3.time.format.utc("%H:%M"), tickTime: d3.time.minutes, tickInterval: 30, tickSize: 6});
|
.tickFormat({format: d3.time.format.utc('%H:%M'), tickTime: d3.time.minutes, tickInterval: 30, tickSize: 6});
|
||||||
|
|
||||||
var svg_width = 1140;
|
var svg_width = 1140;
|
||||||
if (screen.width < 1200) { svg_width = 940; }
|
if (screen.width < 1200) { svg_width = 940; }
|
||||||
if (screen.width < 992) { svg_width = 720; }
|
if (screen.width < 992) { svg_width = 720; }
|
||||||
if (screen.width < 768) { svg_width = screen.width - 30; }
|
if (screen.width < 768) { svg_width = screen.width - 30; }
|
||||||
var svg = d3.select("#timeline").append("svg").attr("width", svg_width)
|
d3.select('#timeline').append('svg').attr('width', svg_width)
|
||||||
.datum(observation_data).call(chart);
|
.datum(observation_data).call(chart);
|
||||||
|
|
||||||
// Waveform loading
|
// Waveform loading
|
||||||
$('.wave').each(function( index ){
|
$('.wave').each(function(){
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var wid = $this.data('id');
|
var wid = $this.data('id');
|
||||||
var wavesurfer = Object.create(WaveSurfer);
|
var wavesurfer = Object.create(WaveSurfer);
|
||||||
|
@ -53,9 +55,9 @@ $(document).ready(function() {
|
||||||
var $playbackTime = $('#playback-time-' + wid);
|
var $playbackTime = $('#playback-time-' + wid);
|
||||||
|
|
||||||
wavesurfer.init({
|
wavesurfer.init({
|
||||||
container: container_el,
|
container: container_el,
|
||||||
waveColor: '#bf7fbf',
|
waveColor: '#bf7fbf',
|
||||||
progressColor: 'purple'
|
progressColor: 'purple'
|
||||||
});
|
});
|
||||||
|
|
||||||
wavesurfer.on('loading', function() {
|
wavesurfer.on('loading', function() {
|
||||||
|
@ -82,16 +84,16 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hightlight Data block
|
// Hightlight Data block
|
||||||
var uri = URI(location.href);
|
var uri = new URI(location.href);
|
||||||
var data_id = uri.hash();
|
var data_id = uri.hash();
|
||||||
$(data_id).addClass('panel-info');
|
$(data_id).addClass('panel-info');
|
||||||
|
|
||||||
|
|
||||||
// Delete confirmation
|
// Delete confirmation
|
||||||
var message = "Do you really want to delete this Observation?";
|
var message = 'Do you really want to delete this Observation?';
|
||||||
var actions = $('#obs-delete');
|
var actions = $('#obs-delete');
|
||||||
if (actions.length) {
|
if (actions.length) {
|
||||||
actions[0].addEventListener("click", function(e) {
|
actions[0].addEventListener('click', function(e) {
|
||||||
if (! confirm(message)) {
|
if (! confirm(message)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$("#satellite-filter").submit(function () {
|
$('#satellite-filter').submit(function () {
|
||||||
var the_form = $(this);
|
var the_form = $(this);
|
||||||
|
|
||||||
the_form.find('input[type="checkbox"]').each( function () {
|
the_form.find('input[type="checkbox"]').each( function () {
|
||||||
var the_checkbox = $(this);
|
var the_checkbox = $(this);
|
||||||
|
|
||||||
|
|
||||||
if( the_checkbox.is(":checked") === true ) {
|
if( the_checkbox.is(':checked') === true ) {
|
||||||
the_checkbox.attr('value','1');
|
the_checkbox.attr('value','1');
|
||||||
} else {
|
} else {
|
||||||
the_checkbox.prop('checked',true);
|
the_checkbox.prop('checked',true);
|
||||||
|
|
|
@ -12,14 +12,14 @@ $(document).ready(function() {
|
||||||
modal.find('.satellite-title').text(data.name);
|
modal.find('.satellite-title').text(data.name);
|
||||||
modal.find('.satellite-names').text(data.names);
|
modal.find('.satellite-names').text(data.names);
|
||||||
modal.find('#SatelliteModalTitle').text(data.name);
|
modal.find('#SatelliteModalTitle').text(data.name);
|
||||||
modal.find('.satellite-id').text("Norad ID " + satlink.data('id'));
|
modal.find('.satellite-id').text('Norad ID ' + satlink.data('id'));
|
||||||
modal.find('#db-link').attr('href', "https://db.satnogs.org/satellite/" + satlink.data('id'));
|
modal.find('#db-link').attr('href', 'https://db.satnogs.org/satellite/' + satlink.data('id'));
|
||||||
modal.find('#new-obs-link').attr('href', '/observations/new/?norad=' + satlink.data('id'));
|
modal.find('#new-obs-link').attr('href', '/observations/new/?norad=' + satlink.data('id'));
|
||||||
modal.find('#old-obs-link').attr('href', '/observations/?norad=' + satlink.data('id'));
|
modal.find('#old-obs-link').attr('href', '/observations/?norad=' + satlink.data('id'));
|
||||||
if (data.image) {
|
if (data.image) {
|
||||||
modal.find('.satellite-img-full').attr('src', data.image);
|
modal.find('.satellite-img-full').attr('src', data.image);
|
||||||
} else {
|
} else {
|
||||||
modal.find('.satellite-img-full').attr('src', "/static/img/sat.png");
|
modal.find('.satellite-img-full').attr('src', '/static/img/sat.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* global L */
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -20,8 +22,8 @@ $(document).ready(function() {
|
||||||
geometry: {
|
geometry: {
|
||||||
type: 'Point',
|
type: 'Point',
|
||||||
coordinates: [
|
coordinates: [
|
||||||
parseFloat(station_info.lng),
|
parseFloat(station_info.lng),
|
||||||
parseFloat(station_info.lat)
|
parseFloat(station_info.lat)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
/* global moment */
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$('#UTCModal').on('show.bs.modal', function (event) {
|
$('#UTCModal').on('show.bs.modal', function () {
|
||||||
var local = moment().format('HH:mm:ss');
|
var local = moment().format('HH:mm:ss');
|
||||||
var utc = moment().utc().format('HH:mm:ss');
|
var utc = moment().utc().format('HH:mm:ss');
|
||||||
$('#timezone-utc').text(utc);
|
$('#timezone-utc').text(utc);
|
||||||
|
|
|
@ -39,13 +39,13 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="lat" class="col-sm-2 control-label">Latitude</label>
|
<label for="lat" class="col-sm-2 control-label">Latitude</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input value="{{ form.lat.value|default_if_none:"" }}" id="lat" type="text" class="form-control" name="lat" placeholder="Latitude" required onchange="gridsquare()">
|
<input value="{{ form.lat.value|default_if_none:"" }}" id="lat" type="text" class="form-control" name="lat" placeholder="Latitude" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="lng" class="col-sm-2 control-label">Longtitude</label>
|
<label for="lng" class="col-sm-2 control-label">Longtitude</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input value="{{ form.lng.value|default_if_none:"" }}" id="lng" type="text" class="form-control" name="lng" placeholder="Longtitude" required onchange="gridsquare()">
|
<input value="{{ form.lng.value|default_if_none:"" }}" id="lng" type="text" class="form-control" name="lng" placeholder="Longtitude" required">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Reference in New Issue