Get eslinting working again
This commit is contained in:
parent
963baee25f
commit
ff1b767f0f
7 changed files with 55 additions and 53 deletions
|
@ -1,7 +1,9 @@
|
||||||
|
parserOptions:
|
||||||
|
sourceType: 'module'
|
||||||
|
extends: 'eslint:recommended'
|
||||||
env:
|
env:
|
||||||
browser: true
|
browser: true
|
||||||
es6: true
|
es6: true
|
||||||
extends: 'eslint:recommended'
|
|
||||||
rules:
|
rules:
|
||||||
indent:
|
indent:
|
||||||
- error
|
- error
|
||||||
|
|
|
@ -15,7 +15,7 @@ for (let note of notes) {
|
||||||
ytiframe.setAttribute('src', 'https://www.youtube.com/embed/' + ytid[1]);
|
ytiframe.setAttribute('src', 'https://www.youtube.com/embed/' + ytid[1]);
|
||||||
ytiframe.setAttribute('frameborder', 0);
|
ytiframe.setAttribute('frameborder', 0);
|
||||||
ytiframe.setAttribute('allowfullscreen', 'true');
|
ytiframe.setAttribute('allowfullscreen', 'true');
|
||||||
ytcontainer.appendChild(ytiframe)
|
ytcontainer.appendChild(ytiframe);
|
||||||
note.appendChild(ytcontainer);
|
note.appendChild(ytcontainer);
|
||||||
}
|
}
|
||||||
let spotifyid = note.textContent.match(spotifyRegex);
|
let spotifyid = note.textContent.match(spotifyRegex);
|
||||||
|
|
|
@ -7,7 +7,7 @@ mapboxgl.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiY2l2cDhjYW04MDAwcjJ0c
|
||||||
|
|
||||||
//define some functions to be used in the default function.
|
//define some functions to be used in the default function.
|
||||||
const titlecase = (string) => {
|
const titlecase = (string) => {
|
||||||
return string.split('-').map(([first,...rest]) => first.toUpperCase() + rest.join('').toLowerCase()).join(' ')
|
return string.split('-').map(([first,...rest]) => first.toUpperCase() + rest.join('').toLowerCase()).join(' ');
|
||||||
};
|
};
|
||||||
|
|
||||||
const addMapTypeOption = (map, menu, option, checked = false) => {
|
const addMapTypeOption = (map, menu, option, checked = false) => {
|
||||||
|
@ -27,7 +27,7 @@ const addMapTypeOption = (map, menu, option, checked = false) => {
|
||||||
label.appendChild(document.createTextNode(titlecase(option)));
|
label.appendChild(document.createTextNode(titlecase(option)));
|
||||||
menu.appendChild(input);
|
menu.appendChild(input);
|
||||||
menu.appendChild(label);
|
menu.appendChild(label);
|
||||||
}
|
};
|
||||||
|
|
||||||
const makeMapMenu = (map) => {
|
const makeMapMenu = (map) => {
|
||||||
let mapMenu = document.createElement('div');
|
let mapMenu = document.createElement('div');
|
||||||
|
@ -35,7 +35,7 @@ const makeMapMenu = (map) => {
|
||||||
addMapTypeOption(map, mapMenu, 'streets', true);
|
addMapTypeOption(map, mapMenu, 'streets', true);
|
||||||
addMapTypeOption(map, mapMenu, 'satellite-streets');
|
addMapTypeOption(map, mapMenu, 'satellite-streets');
|
||||||
return mapMenu;
|
return mapMenu;
|
||||||
}
|
};
|
||||||
|
|
||||||
//the main function
|
//the main function
|
||||||
export default function addMap(div, position = null, places = null) {
|
export default function addMap(div, position = null, places = null) {
|
||||||
|
@ -45,17 +45,17 @@ export default function addMap(div, position = null, places = null) {
|
||||||
let data = window['geojson'+dataId];
|
let data = window['geojson'+dataId];
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
data = {
|
data = {
|
||||||
"type": "FeatureCollection",
|
'type': 'FeatureCollection',
|
||||||
"features": [{
|
'features': [{
|
||||||
"type": "Feature",
|
'type': 'Feature',
|
||||||
"geometry": {
|
'geometry': {
|
||||||
"type": "Point",
|
'type': 'Point',
|
||||||
"coordinates": [dataLongitude, dataLatitude]
|
'coordinates': [dataLongitude, dataLatitude]
|
||||||
},
|
},
|
||||||
"properties": {
|
'properties': {
|
||||||
"title": "Current Location",
|
'title': 'Current Location',
|
||||||
"icon": "circle-stroked",
|
'icon': 'circle-stroked',
|
||||||
"uri": "current-location"
|
'uri': 'current-location'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
@ -65,22 +65,22 @@ export default function addMap(div, position = null, places = null) {
|
||||||
let placeLongitude = parseLocation(place.location).longitude;
|
let placeLongitude = parseLocation(place.location).longitude;
|
||||||
let placeLatitude = parseLocation(place.location).latitude;
|
let placeLatitude = parseLocation(place.location).latitude;
|
||||||
data.features.push({
|
data.features.push({
|
||||||
"type": "Feature",
|
'type': 'Feature',
|
||||||
"geometry": {
|
'geometry': {
|
||||||
"type": "Point",
|
'type': 'Point',
|
||||||
"coordinates": [placeLongitude, placeLatitude]
|
'coordinates': [placeLongitude, placeLatitude]
|
||||||
},
|
},
|
||||||
"properties": {
|
'properties': {
|
||||||
"title": place.name,
|
'title': place.name,
|
||||||
"icon": "circle",
|
'icon': 'circle',
|
||||||
"uri": place.slug
|
'uri': place.slug
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (position != null) {
|
if (position != null) {
|
||||||
let dataLongitude = position.coords.longitude;
|
dataLongitude = position.coords.longitude;
|
||||||
let dataLatitude = position.coords.latitude;
|
dataLatitude = position.coords.latitude;
|
||||||
}
|
}
|
||||||
let map = new mapboxgl.Map({
|
let map = new mapboxgl.Map({
|
||||||
container: div,
|
container: div,
|
||||||
|
@ -95,18 +95,18 @@ export default function addMap(div, position = null, places = null) {
|
||||||
div.appendChild(makeMapMenu(map));
|
div.appendChild(makeMapMenu(map));
|
||||||
map.on('load', function () {
|
map.on('load', function () {
|
||||||
map.addSource('points', {
|
map.addSource('points', {
|
||||||
"type": "geojson",
|
'type': 'geojson',
|
||||||
"data": data
|
'data': data
|
||||||
});
|
});
|
||||||
map.addLayer({
|
map.addLayer({
|
||||||
"id": "points",
|
'id': 'points',
|
||||||
"interactive": true,
|
'interactive': true,
|
||||||
"type": "symbol",
|
'type': 'symbol',
|
||||||
"source": "points",
|
'source': 'points',
|
||||||
"layout": {
|
'layout': {
|
||||||
"icon-image": "{icon}-15",
|
'icon-image': '{icon}-15',
|
||||||
"text-field": "{title}",
|
'text-field': '{title}',
|
||||||
"text-offset": [0, 1]
|
'text-offset': [0, 1]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,8 +41,8 @@ const makeOptionsForForm = (map, position, places = null) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return selectElement
|
return selectElement;
|
||||||
}
|
};
|
||||||
|
|
||||||
//position is output of navigator.geolocation call
|
//position is output of navigator.geolocation call
|
||||||
export default function addMapWithPlaces(div, position) {
|
export default function addMapWithPlaces(div, position) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ const loadData = () => {
|
||||||
replyTo.value = webStorage.getItem('replyTo');
|
replyTo.value = webStorage.getItem('replyTo');
|
||||||
let content = document.querySelector('#content');
|
let content = document.querySelector('#content');
|
||||||
content.value = webStorage.getItem('content');
|
content.value = webStorage.getItem('content');
|
||||||
}
|
};
|
||||||
|
|
||||||
const saveData = () => {
|
const saveData = () => {
|
||||||
let replyTo = document.querySelector('#in-reply-to');
|
let replyTo = document.querySelector('#in-reply-to');
|
||||||
|
@ -16,12 +16,12 @@ const saveData = () => {
|
||||||
webStorage.setItem('replyTo', replyTo.value);
|
webStorage.setItem('replyTo', replyTo.value);
|
||||||
webStorage.setItem('content', content.value);
|
webStorage.setItem('content', content.value);
|
||||||
alertify.success('Auto-saved data');
|
alertify.success('Auto-saved data');
|
||||||
}
|
};
|
||||||
|
|
||||||
const clearData = () => {
|
const clearData = () => {
|
||||||
webStorage.removeItem('replyTo');
|
webStorage.removeItem('replyTo');
|
||||||
webStorage.removeItem('content');
|
webStorage.removeItem('content');
|
||||||
}
|
};
|
||||||
|
|
||||||
export default function persistFormData()
|
export default function persistFormData()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
export default function selectPlaceInForm(uri) {
|
export default function selectPlaceInForm(uri) {
|
||||||
if (document.querySelector('select')) {
|
if (document.querySelector('select')) {
|
||||||
if (uri == 'current-location') {
|
if (uri == 'current-location') {
|
||||||
document.querySelector('select [id="option-coords"]').selected = true
|
document.querySelector('select [id="option-coords"]').selected = true;
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('select [value="' + uri + '"]').selected = true
|
document.querySelector('select [value="' + uri + '"]').selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,21 +39,21 @@ export default function submitNewPlace(map) {
|
||||||
});
|
});
|
||||||
//add new place to map
|
//add new place to map
|
||||||
newFeatures.push({
|
newFeatures.push({
|
||||||
"type": "Feature",
|
'type': 'Feature',
|
||||||
"geometry": {
|
'geometry': {
|
||||||
"type": "Point",
|
'type': 'Point',
|
||||||
"coordinates": [placeJson.longitude, placeJson.latitude]
|
'coordinates': [placeJson.longitude, placeJson.latitude]
|
||||||
},
|
},
|
||||||
"properties": {
|
'properties': {
|
||||||
"title": placeJson.name,
|
'title': placeJson.name,
|
||||||
"icon": "circle",
|
'icon': 'circle',
|
||||||
"uri": placeJson.uri
|
'uri': placeJson.uri
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let newSource = {
|
let newSource = {
|
||||||
"type": "FeatureCollection",
|
'type': 'FeatureCollection',
|
||||||
"features": newFeatures
|
'features': newFeatures
|
||||||
}
|
};
|
||||||
map.getSource('points').setData(newSource);
|
map.getSource('points').setData(newSource);
|
||||||
//add new place to select menu
|
//add new place to select menu
|
||||||
let selectElement = document.querySelector('select');
|
let selectElement = document.querySelector('select');
|
||||||
|
|
Loading…
Add table
Reference in a new issue