remove metric

This commit is contained in:
Matt Walsh
2022-12-06 16:25:28 -06:00
parent 6933e7b7f1
commit 8e6fd04b3a
10 changed files with 39 additions and 143 deletions

View File

@@ -1,4 +1,3 @@
import { setUnits } from './modules/utils/units.mjs';
import { json } from './modules/utils/fetch.mjs';
import noSleep from './modules/utils/nosleep.mjs';
import {
@@ -114,7 +113,6 @@ const init = () => {
localStorage.removeItem('TwcAutoRefresh');
document.getElementById('radEnglish').checked = true;
localStorage.removeItem('TwcUnits');
localStorage.removeItem('TwcPlay');
postMessage('navButton', 'play');
@@ -122,29 +120,11 @@ const init = () => {
localStorage.removeItem('TwcQuery');
});
const TwcUnits = localStorage.getItem('TwcUnits');
if (!TwcUnits || TwcUnits === 'ENGLISH') {
document.getElementById('radEnglish').checked = true;
setUnits('english');
} else if (TwcUnits === 'METRIC') {
document.getElementById('radMetric').checked = true;
setUnits('metric');
}
document.getElementById('radEnglish').addEventListener('change', changeUnits);
document.getElementById('radMetric').addEventListener('change', changeUnits);
// swipe functionality
document.getElementById('container').addEventListener('swiped-left', () => swipeCallBack('left'));
document.getElementById('container').addEventListener('swiped-right', () => swipeCallBack('right'));
};
const changeUnits = (e) => {
const Units = e.target.value;
localStorage.setItem('TwcUnits', Units);
postMessage('units', Units);
};
const autocompleteOnSelect = async (suggestion, elem) => {
// Do not auto get the same city twice.
if (elem.previousSuggestionValue === suggestion.value) return;