Skip to content

Commit

Permalink
doc: add assets JS to the linting list
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Mar 2, 2022
1 parent d3fcc59 commit 4aa204e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -7,4 +7,5 @@ tools/icu
tools/lint-md/lint-md.mjs
benchmark/tmp
doc/**/*.js
!doc/api_assets/*.js
!.eslintrc.js
16 changes: 8 additions & 8 deletions doc/api_assets/api.js
@@ -1,6 +1,6 @@
'use strict';
// Check if we have Javascript support

// Check if we have JavaScript support
document.querySelector(':root').classList.add('has-js');

// Restore user mode preferences
Expand Down Expand Up @@ -38,8 +38,8 @@ if (themeToggleButton) {

// Handle pickers with click/taps rather than hovers
const pickers = document.querySelectorAll('.picker-header');
for(const picker of pickers) {
picker.addEventListener('click', e => {
for (const picker of pickers) {
picker.addEventListener('click', (e) => {
if (!e.target.closest('.picker')) {
e.preventDefault();
}
Expand All @@ -57,17 +57,17 @@ for(const picker of pickers) {
}

// Track when the header is in sticky position
const header = document.querySelector(".header");
const header = document.querySelector('.header');
let ignoreNextIntersection = false;
new IntersectionObserver(
([e]) => {
const currentStatus = header.classList.contains('is-pinned');
const newStatus = e.intersectionRatio < 1;

// Same status, do nothing
if(currentStatus === newStatus) {
if (currentStatus === newStatus) {
return;
} else if(ignoreNextIntersection) {
} else if (ignoreNextIntersection) {
ignoreNextIntersection = false;
return;
}
Expand All @@ -84,4 +84,4 @@ new IntersectionObserver(
header.classList.toggle('is-pinned', newStatus);
},
{ threshold: [1] }
).observe(header);
).observe(header);

0 comments on commit 4aa204e

Please sign in to comment.