From e99aefb50ca63e2dbcc95841efbb53cea90151d8 Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sat, 23 Sep 2017 22:02:01 +0200 Subject: Add compile step that bundles and compresses JS files (#684) * Add compile step that bundles and compresses JS files Also, manage dependencies on third-party JS libraries using NPM. * Compile JS from TypeScript * Enable 'noImplicitAny' in TypeScript * QuickJump: use JSX syntax * Generate source maps from TypeScript for easier debugging * TypeScript: more accurate type * Separate quick jump css file from ocean theme --- haddock-api/resources/html/js-src/init.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 haddock-api/resources/html/js-src/init.ts (limited to 'haddock-api/resources/html/js-src/init.ts') diff --git a/haddock-api/resources/html/js-src/init.ts b/haddock-api/resources/html/js-src/init.ts new file mode 100644 index 00000000..0619dfc3 --- /dev/null +++ b/haddock-api/resources/html/js-src/init.ts @@ -0,0 +1,21 @@ +import * as util from "./haddock-util"; +import * as quickJump from "./quick-jump"; + +function onDomReady(callback: () => void) { + if (document.readyState === 'interactive') { + callback(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'interactive') { + callback(); + } + }); + } +} + +onDomReady(() => { + util.addStyleMenu(); + util.resetStyle(); + util.restoreCollapsed(); + quickJump.init(); +}); \ No newline at end of file -- cgit v1.2.3