(href: string, updateUrl = true)
| 63 | ) => (element.classList.toggle(toggle) ? added() : 0); |
| 64 | |
| 65 | export const go = (href: string, updateUrl = true): void => { |
| 66 | const nav = getNav(); |
| 67 | ['?', '#'].forEach((separator) => { |
| 68 | if (href.includes(separator)) { |
| 69 | href = href.substring(0, href.indexOf(separator)); |
| 70 | } |
| 71 | }); |
| 72 | fetch(`${href}nav.json`) |
| 73 | .then((response) => response.json()) |
| 74 | .then((navJson) => { |
| 75 | delClass(queryElement(nav, 'li.current'), 'current'); |
| 76 | updateNav(navJson, queryElement(nav, 'ul')); |
| 77 | }); |
| 78 | fetch(`${href}article.html`) |
| 79 | .then((response) => response.text()) |
| 80 | .then((html) => { |
| 81 | const article = getArticle(); |
| 82 | article.innerHTML = html; |
| 83 | article.scrollTo(0, 0); |
| 84 | addStackblitz(); |
| 85 | }); |
| 86 | |
| 87 | if (updateUrl) { |
| 88 | history.pushState(null, '', href); |
| 89 | } |
| 90 | }; |
| 91 | |
| 92 | type ExecutableProject = { |
| 93 | title: string; |
no test coverage detected