* change home page main id to main-ontent, update scroll, refresh and shortcut handlers * update articles by timeframe test with new main-content id * tidy up css * Trigger Travis CI * undo unneeded changes * small refactors
29 lines
872 B
JavaScript
29 lines
872 B
JavaScript
import { h, render, Fragment } from 'preact';
|
|
import { ListNavigation } from '../shared/components/useListNavigation';
|
|
import { KeyboardShortcuts } from '../shared/components/useKeyboardShortcuts';
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const root = document.getElementById('main-content');
|
|
|
|
render(
|
|
<Fragment>
|
|
<KeyboardShortcuts
|
|
shortcuts={{
|
|
b: (event) => {
|
|
const article = event.target?.closest('.crayons-story');
|
|
|
|
if (!article) return;
|
|
|
|
article.querySelector('button[id^=article-save-button-]')?.click();
|
|
},
|
|
}}
|
|
/>
|
|
<ListNavigation
|
|
itemSelector=".crayons-story"
|
|
focusableSelector="a.crayons-story__hidden-navigation-link"
|
|
waterfallItemContainerSelector="div.paged-stories,div.substories"
|
|
/>
|
|
</Fragment>,
|
|
root,
|
|
);
|
|
});
|