diff --git a/client/core/defaultCV.js b/client/core/defaultCV.js index f70fbd6..0b5d990 100644 --- a/client/core/defaultCV.js +++ b/client/core/defaultCV.js @@ -7,4 +7,10 @@ import gateway from '../utility/gateways.js'; let iFrame = document.getElementById("template"); iFrame.src = `../themes/themeElon_1/index.html`; iFrame.style.display = 'block'; + console.log(window.location.pathname) + if (window.location.pathname === '/download') { + iFrame.onload = function () { + window.document.getElementById("print").click() + } + } })(); \ No newline at end of file diff --git a/client/router.js b/client/router.js index fa43161..7f6cdfa 100644 --- a/client/router.js +++ b/client/router.js @@ -17,6 +17,11 @@ template('defaultCV', () => { template('editorResume', () => { scriptLoader('core/resumeEditor.js'); }); + +// Register the templates. +template('download', () => { + scriptLoader('core/defaultCV.js'); +}); // Define the routes. Each route is described with a route path & a template to render // when entering that path. A template can be a string (file name), or a function that // will directly create the DOM objects. @@ -35,14 +40,15 @@ let route = (path, template) => { // Define the mappings route->template. route('/', 'defaultCV'); route('/secretEditor', 'editorResume'); +route('/download', 'download'); // Give the correspondent route (template) or fail let resolveRoute = (route) => { try { - return routes[route]; + return routes[route]; } catch (error) { - throw new Error("The route is not defined"); + throw new Error("The route is not defined"); } }; @@ -59,7 +65,7 @@ const scriptLoader = path => { let router = (evt) => { const url = window.location.pathname || "/"; const routeResolved = resolveRoute(url); - + routeResolved(); }; // For first load or when routes are changed in browser url box.