Format fixes for js with biome.

This commit is contained in:
Fredrik Jonsson 2024-12-20 15:25:18 +01:00
commit 2f6becec53
9 changed files with 28 additions and 36 deletions

View file

@ -17,15 +17,19 @@
form.classList.remove('hidden');
// Wait for a mouse to move, indicating they are human.
document.body.addEventListener('mousemove', activateForm, {once: true});
document.body.addEventListener('mousemove', activateForm, { once: true });
// Wait for a touch move event, indicating that they are human.
document.body.addEventListener('touchmove', activateForm, {once: true});
document.body.addEventListener('touchmove', activateForm, { once: true });
// A tab or enter key pressed can also indicate they are human.
document.body.addEventListener('keydown', function (e) {
if ((e.key === 'Tab') || (e.key === 'Enter')) {
activateForm();
}
}, {once: true});
document.body.addEventListener(
'keydown',
function (e) {
if (e.key === 'Tab' || e.key === 'Enter') {
activateForm();
}
},
{ once: true },
);
// Mark the form as submitted.
button.addEventListener('click', () => form.classList.add('js-submitted'));
@ -42,5 +46,4 @@
break;
}
}
})();

View file

@ -17,8 +17,7 @@
button.addEventListener('click', function () {
if (button.getAttribute('data-consent') === 'true') {
localStorage.setItem('cookieconsent', 'accept');
}
else {
} else {
localStorage.setItem('cookieconsent', 'decline');
}
cookiebanner.classList.remove('js-cookieconsent-open');
@ -37,5 +36,4 @@
}
});
});
})();

View file

@ -7,13 +7,12 @@
document.addEventListener('DOMContentLoaded', function () {
renderMathInElement(document.body, {
delimiters: [
{left: '\\[', right: '\\]', display: true}, // block
{left: '$$', right: '$$', display: true}, // block
{left: '\\(', right: '\\)', display: false}, // inline
{left: '$', right: '$', display: false} // inline
{ left: '\\[', right: '\\]', display: true }, // block
{ left: '$$', right: '$$', display: true }, // block
{ left: '\\(', right: '\\)', display: false }, // inline
{ left: '$', right: '$', display: false }, // inline
],
throwOnError: false
throwOnError: false,
});
});
})();

View file

@ -9,7 +9,7 @@
const toggle = document.querySelector('.mobile-nav__toggle');
function navopen() {
nav.dataset.navopen='true';
nav.dataset.navopen = 'true';
sheet.setAttribute('aria-hidden', 'false');
toggle.setAttribute('aria-expanded', 'true');
document.body.addEventListener('keydown', closeonesc);
@ -27,7 +27,7 @@
if (e.key === 'Escape') {
navclose();
}
};
}
// Toggle the mobile nav sheet.
const toggles = document.querySelectorAll('.mobile-nav__cover, .mobile-nav__toggle');
@ -36,8 +36,7 @@
e.preventDefault();
if (nav.dataset.navopen) {
navclose();
}
else {
} else {
navopen();
}
});
@ -56,5 +55,4 @@
const lastlink = [].slice.call(links).pop();
lastlink.addEventListener('blur', () => toggle.focus());
}
})();

View file

@ -6,5 +6,4 @@
(function () {
// Add a js class to the html-tag when JavsScript is active.
document.querySelector('html').classList.replace('nojs', 'js');
})();

View file

@ -4,7 +4,5 @@
*/
(function () {
// Place your code here.
})();

View file

@ -10,9 +10,9 @@ import * as params from '@params';
document: {
id: 'id',
index: ['title', 'tags', 'content', 'date'],
store: ['title', 'summary', 'date', 'permalink']
store: ['title', 'summary', 'date', 'permalink'],
},
tokenize: 'forward'
tokenize: 'forward',
});
function showResults(items) {
@ -42,7 +42,7 @@ import * as params from '@params';
const results = index.search({
query: query,
enrich: true,
limit: params.searchLimit
limit: params.searchLimit,
});
const items = {};
results.forEach(function (result) {

View file

@ -14,12 +14,11 @@
const cells = row.querySelectorAll('td');
cells.forEach(function (cell, i) {
cell.setAttribute('role','cell');
cell.setAttribute('role', 'cell');
if (headers[i].innerText) {
cell.setAttribute('aria-label', headers[i].innerText);
}
});
});
});
})();

View file

@ -3,7 +3,6 @@
* A JavaScript file for analytic tracking.
*/
import * as params from '@params';
const cookiebanner = params.cookieConsent;
@ -13,9 +12,8 @@ const matomoTrackingApiUrl = 'https://' + params.piwikTrackerUrl + '/matomo.php'
const googleAnalytics = params.GoogleAnalytics;
if (idSite) {
// biome-ignore lint/style/useConst: Google code.
// biome-ignore lint/suspicious/noAssignInExpressions: Google code.
let _paq = window._paq = window._paq || [];
// biome-ignore lint: Google code.
let _paq = (window._paq = window._paq || []);
if (cookiebanner) {
_paq.push(['requireConsent']);