@@ -4,6 +4,9 @@ let problemsData = {
44 vicutils : [ ]
55} ;
66
7+ const container = document . getElementById ( "container" )
8+
9+
710async function scanForProblems ( ) {
811 const platforms = [ 'leetcode' , 'kattis' , 'vicutils' ] ;
912
@@ -206,7 +209,7 @@ async function generatePage(platform, problem) {
206209async function renderProblemPage ( platform , problemName ) {
207210 const problem = problemsData [ platform ] ?. find ( p => p . name === problemName ) ;
208211 if ( ! problem ) {
209- document . body . innerHTML = '<div class="error">Item not found</div>' ;
212+ container . innerHTML = '<div class="error">Item not found</div>' ;
210213 return ;
211214 }
212215
@@ -283,7 +286,7 @@ async function renderProblemPage(platform, problemName) {
283286
284287 pageContent += `</div>` ;
285288
286- document . body . innerHTML = pageContent ;
289+ div . innerHTML = pageContent ;
287290 document . title = `${ pageTitle } - ${ platformTitle } ` ;
288291
289292 if ( ! document . querySelector ( 'link[rel="icon"]' ) ) {
@@ -354,7 +357,7 @@ function addNavigationToCurrentPage() {
354357 <a href="../../index.html#${ platform } " class="nav-btn">${ platform . charAt ( 0 ) . toUpperCase ( ) + platform . slice ( 1 ) } Problems</a>
355358 </div>
356359 ` ;
357- document . body . insertBefore ( backButton , document . body . firstChild ) ;
360+ container . insertBefore ( backButton , container . firstChild ) ;
358361 }
359362}
360363
@@ -399,9 +402,3 @@ window.addEventListener('hashchange', () => {
399402 location . reload ( ) ; // Reload to show main page
400403 }
401404} ) ;
402-
403- // Recharger le script Highlight.js
404- const script = document . createElement ( 'script' ) ;
405- script . src = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js' ;
406- script . onload = ( ) => hljs . highlightAll ( ) ;
407- document . body . appendChild ( script ) ;
0 commit comments