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"
|
||||
install:
|
||||
- pip install -r requirements/dev.txt
|
||||
- npm install -g jshint stylelint
|
||||
- npm install -g eslint stylelint
|
||||
script:
|
||||
- flake8 .
|
||||
- jshint .
|
||||
- pytest
|
||||
- eslint 'network/static/js/*.js'
|
||||
- stylelint 'network/static/css/*.css'
|
||||
after_success:
|
||||
- coveralls
|
||||
|
|
|
@ -1,45 +1,58 @@
|
|||
/* This script calculates the grid locator based on the Maidenhead
|
||||
* Locator System. It references the longitude and latitude fields
|
||||
* 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
|
||||
* valid. -cshields
|
||||
*/
|
||||
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'];
|
||||
* that to the location field if both lat/lon values exist and are
|
||||
* valid.
|
||||
*/
|
||||
|
||||
// starting points, the fields from the Station form
|
||||
var latitude = $('#lat').val();
|
||||
var longitude = $('#lng').val();
|
||||
$(document).ready(function() {
|
||||
'use strict';
|
||||
|
||||
// this gets called any time one of the two lat/long fields
|
||||
// have been changed. We only need to do the work if both
|
||||
// fields have been entered with a proper entry, otherwise
|
||||
// skip the cycles
|
||||
if ((latitude !== '') &&
|
||||
(latitude <= 90) &&
|
||||
(latitude >= -90) &&
|
||||
(longitude !== '') &&
|
||||
(longitude <= 180) &&
|
||||
(longitude >= -180)) {
|
||||
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'];
|
||||
|
||||
// to figure out the individual grid identifiers we make a mess
|
||||
// of the longitude and latitude
|
||||
var working_lon = ((+longitude + 180) % 20);
|
||||
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];
|
||||
// starting points, the fields from the Station form
|
||||
var latitude = $('#lat').val();
|
||||
var longitude = $('#lng').val();
|
||||
|
||||
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];
|
||||
// this gets called any time one of the two lat/long fields
|
||||
// have been changed. We only need to do the work if both
|
||||
// fields have been entered with a proper entry, otherwise
|
||||
// skip the cycles
|
||||
if ((latitude !== '') &&
|
||||
(latitude <= 90) &&
|
||||
(latitude >= -90) &&
|
||||
(longitude !== '') &&
|
||||
(longitude <= 180) &&
|
||||
(longitude >= -180)) {
|
||||
|
||||
// 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());
|
||||
// to figure out the individual grid identifiers we make a mess
|
||||
// of the longitude and latitude
|
||||
var working_lon = ((+longitude + 180) % 20);
|
||||
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() {
|
||||
'use strict';
|
||||
|
||||
|
@ -10,7 +12,7 @@ $(document).ready(function() {
|
|||
var map = L.mapbox.map('map', mapboxid, {
|
||||
zoomControl: false
|
||||
}).setView([40, 0], 3);
|
||||
var LocLayer = L.mapbox.featureLayer().addTo(map);
|
||||
L.mapbox.featureLayer().addTo(map);
|
||||
|
||||
$.ajax({
|
||||
url: stations
|
||||
|
@ -21,8 +23,8 @@ $(document).ready(function() {
|
|||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [
|
||||
parseFloat(m.lng),
|
||||
parseFloat(m.lat)
|
||||
parseFloat(m.lng),
|
||||
parseFloat(m.lat)
|
||||
]
|
||||
},
|
||||
properties: {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global moment, d3 */
|
||||
|
||||
$(document).ready( function(){
|
||||
function select_proper_transmitters(satellite) {
|
||||
$('#transmitter-selection').prop('disabled', false);
|
||||
|
@ -16,7 +18,7 @@ $(document).ready( function(){
|
|||
|
||||
if (obs_filter) {
|
||||
satellite = $('input[name="satellite"]').val();
|
||||
ground_station = $('input[name="ground_station"]').val();
|
||||
var ground_station = $('input[name="ground_station"]').val();
|
||||
}
|
||||
|
||||
if (!obs_filter_dates) {
|
||||
|
@ -27,7 +29,7 @@ $(document).ready( function(){
|
|||
$('#datetimepicker-start').data('DateTimePicker').minDate(moment.utc().add(minstart, 'm'));
|
||||
$('#datetimepicker-end').datetimepicker();
|
||||
$('#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
|
||||
$('#datetimepicker-end').data('DateTimePicker').defaultDate(moment.utc(e.date).add(60, 'm'));
|
||||
$('#datetimepicker-end').data('DateTimePicker').minDate(e.date);
|
||||
|
@ -63,11 +65,11 @@ $(document).ready( function(){
|
|||
$('#loading').hide();
|
||||
if (data.error) {
|
||||
var error_msg = data.error;
|
||||
console.log(data.error);
|
||||
$('#windows-data').html('<span class="text-danger">' + error_msg + '</span>');
|
||||
} else {
|
||||
var dc = 0; // Data counter
|
||||
var suggested_data = [];
|
||||
var label = '';
|
||||
$('#windows-data').empty();
|
||||
$.each(data, function(i, k){
|
||||
label = k.id + ' - ' + k.name;
|
||||
|
@ -120,8 +122,8 @@ $(document).ready( function(){
|
|||
if (screen.width < 1200) { svg_width = 940; }
|
||||
if (screen.width < 992) { svg_width = 720; }
|
||||
if (screen.width < 768) { svg_width = screen.width - 30; }
|
||||
var svg = d3.select('#timeline').append('svg').attr('width', svg_width)
|
||||
.datum(payload).call(chart);
|
||||
d3.select('#timeline').append('svg').attr('width', svg_width)
|
||||
.datum(payload).call(chart);
|
||||
|
||||
$('#hoverRes').show();
|
||||
$('#schedule-observation').removeAttr('disabled');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global d3 WaveSurfer URI */
|
||||
|
||||
$(document).ready(function() {
|
||||
'use strict';
|
||||
|
||||
|
@ -14,7 +16,7 @@ $(document).ready(function() {
|
|||
return String(minute + ':' + second); // combine minute and second in string
|
||||
};
|
||||
|
||||
$('.observation-data').each(function( index ){
|
||||
$('.observation-data').each(function(){
|
||||
var $this = $(this);
|
||||
var data_groundstation = $this.data('groundstation');
|
||||
var data_time_start = 1000 * $this.data('start');
|
||||
|
@ -33,17 +35,17 @@ $(document).ready(function() {
|
|||
div.find('#name').text(datum.label);
|
||||
})
|
||||
.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;
|
||||
if (screen.width < 1200) { svg_width = 940; }
|
||||
if (screen.width < 992) { svg_width = 720; }
|
||||
if (screen.width < 768) { svg_width = screen.width - 30; }
|
||||
var svg = d3.select("#timeline").append("svg").attr("width", svg_width)
|
||||
.datum(observation_data).call(chart);
|
||||
d3.select('#timeline').append('svg').attr('width', svg_width)
|
||||
.datum(observation_data).call(chart);
|
||||
|
||||
// Waveform loading
|
||||
$('.wave').each(function( index ){
|
||||
$('.wave').each(function(){
|
||||
var $this = $(this);
|
||||
var wid = $this.data('id');
|
||||
var wavesurfer = Object.create(WaveSurfer);
|
||||
|
@ -53,9 +55,9 @@ $(document).ready(function() {
|
|||
var $playbackTime = $('#playback-time-' + wid);
|
||||
|
||||
wavesurfer.init({
|
||||
container: container_el,
|
||||
waveColor: '#bf7fbf',
|
||||
progressColor: 'purple'
|
||||
container: container_el,
|
||||
waveColor: '#bf7fbf',
|
||||
progressColor: 'purple'
|
||||
});
|
||||
|
||||
wavesurfer.on('loading', function() {
|
||||
|
@ -82,16 +84,16 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
// Hightlight Data block
|
||||
var uri = URI(location.href);
|
||||
var uri = new URI(location.href);
|
||||
var data_id = uri.hash();
|
||||
$(data_id).addClass('panel-info');
|
||||
|
||||
|
||||
// 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');
|
||||
if (actions.length) {
|
||||
actions[0].addEventListener("click", function(e) {
|
||||
actions[0].addEventListener('click', function(e) {
|
||||
if (! confirm(message)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
$(document).ready(function() {
|
||||
'use strict';
|
||||
|
||||
$("#satellite-filter").submit(function () {
|
||||
$('#satellite-filter').submit(function () {
|
||||
var the_form = $(this);
|
||||
|
||||
the_form.find('input[type="checkbox"]').each( function () {
|
||||
var the_checkbox = $(this);
|
||||
|
||||
|
||||
if( the_checkbox.is(":checked") === true ) {
|
||||
if( the_checkbox.is(':checked') === true ) {
|
||||
the_checkbox.attr('value','1');
|
||||
} else {
|
||||
the_checkbox.prop('checked',true);
|
||||
|
|
|
@ -12,14 +12,14 @@ $(document).ready(function() {
|
|||
modal.find('.satellite-title').text(data.name);
|
||||
modal.find('.satellite-names').text(data.names);
|
||||
modal.find('#SatelliteModalTitle').text(data.name);
|
||||
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('.satellite-id').text('Norad ID ' + 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('#old-obs-link').attr('href', '/observations/?norad=' + satlink.data('id'));
|
||||
if (data.image) {
|
||||
modal.find('.satellite-img-full').attr('src', data.image);
|
||||
} 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() {
|
||||
'use strict';
|
||||
|
||||
|
@ -20,8 +22,8 @@ $(document).ready(function() {
|
|||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [
|
||||
parseFloat(station_info.lng),
|
||||
parseFloat(station_info.lat)
|
||||
parseFloat(station_info.lng),
|
||||
parseFloat(station_info.lat)
|
||||
]
|
||||
},
|
||||
properties: {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/* global moment */
|
||||
|
||||
$(document).ready(function() {
|
||||
'use strict';
|
||||
|
||||
$('#UTCModal').on('show.bs.modal', function (event) {
|
||||
$('#UTCModal').on('show.bs.modal', function () {
|
||||
var local = moment().format('HH:mm:ss');
|
||||
var utc = moment().utc().format('HH:mm:ss');
|
||||
$('#timezone-utc').text(utc);
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
<div class="form-group">
|
||||
<label for="lat" class="col-sm-2 control-label">Latitude</label>
|
||||
<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 class="form-group">
|
||||
<label for="lng" class="col-sm-2 control-label">Longtitude</label>
|
||||
<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 class="form-group">
|
||||
|
|
Loading…
Reference in New Issue