Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: add assets JS to the linting list
  • Loading branch information
ShogunPanda committed Mar 22, 2022
commit e94673a376d18ecd1780175a7736965b1b4ba057
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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);