// plein de requêtes pour séparer les scripts // mais osef c'est pour travailler en local const debug = true; const boldLogging = 'font-weight: bold;'; const jsFolder = 'user/themes/carnet-atterrissage/js'; const parsingScripts = [ 'parsing/tagsToClasses.js', 'parsing/increaseMomentNumber.js', 'parsing/nonBreakingSpaces.js', 'parsing/addInsertIcons.js', 'parsing/cleanBibliography.js', 'parsing/cleanParagraphsParsing.js', 'parsing/titlePages.js', 'parsing/footnotes.js' ]; function loadScripts(scripts, index, isPagedLoaded) { if (index < scripts.length) { $.getScript(`${jsFolder}/${scripts[index]}`, function() { loadScripts(scripts, index + 1, isPagedLoaded); }); } else if (!isPagedLoaded) { $.getScript(`${jsFolder}/paged.polyfill.js`, function() { if (debug) console.log('%cPagedPreviewer working', boldLogging); // https://pagedjs.org/documentation/10-handlers-hooks-and-custom-javascript/ class setLayout extends Paged.Handler { constructor(chunker, polisher, caller) { super(chunker, polisher, caller); } afterParsed(parsed) { $.getScript(`${jsFolder}/ui.js`, function() {}); } afterRendered(pages) { if (debug) console.log('%cAll pages render done', boldLogging); $.getScript(`${jsFolder}/layout.js`, function() {}); } } Paged.registerHandlers(setLayout); }); } } if (debug) console.log('%cStart parsing', boldLogging) loadScripts(parsingScripts, 0, false);