/** **- * JavaScript providing functions for * generating the HTML elements * required for the Japanese pages on * the site * * Author - Philip Osztromok * * 2 March 2024 *+ */ const addTitle = function (header1, header2) { const newTitle = document.createElement("div") newTitle.classList.add("title") newTitle.innerHTML =`

${header1}

${header2}

` return newTitle } function addLessonHeader(lesson) { const newLessonHeader = document.createElement("h2") newLessonHeader.classList.add("lessonHeader") const id = "Lesson_" + lesson newLessonHeader.setAttribute("id", id) newLessonHeader.innerHTML = id console.log("Lesson header is ", newLessonHeader) return newLessonHeader } const addLessonLink = function (lesson) { const newLesson = document.createElement("h2") const id = "lesson_" + lesson newLesson.setAttribute("id", id) newLesson.innerHTML =`

Lesson ${lesson}

` console.log("Lesson link is ", newLesson) return newLesson } function homework_menu() { const new_menu = ["Lesson 1", "Lesson 2", "Lesson 3", "Lesson 4"]; const new_menu_links = ["lesson1.html", "lesson2.html"]; const new_homework_menu = document.createElement("div"); for (let index=0; index < new_menu.length; index++) { var link = document.createElement("a"); link.innerHTML = new_menu[index]; link.setAttribute("href", new_menu_links[index]); console.log("The link is", link); new_homework_menu.append(link); } return new_homework_menu; } function althomework_menu(lessons) { const new_homework_menu = document.createElement("div"); for (let index=1; index <= lessons; index++) { var link = document.createElement("a"); link.innerHTML = `Lesson ${index}`; link.setAttribute("href", "lesson"+index+".html"); console.log("The link is", link); new_homework_menu.append(link); } return new_homework_menu; } function udemy_menu() { const new_menu = ["Section 1", "Section 2", "Section 3", "Section 4", "Section 5", "Section 6", "Section 7", "Section 8", "Section 9", "Section 10", "Section 11", "Section 12", "Section 13", "Section 14", "Section 15"]; const new_menu_links = ["section1.html", "section2.html", "section3.html", "section4.html", "section5.html", "section6.html", "section7.html", "section8.html", "section9.html", "section10.html", "section11.html", "section12.html", "section13.html", "section14.html", "section15.html"]; const new_udemy_menu = document.createElement("div"); for (let index=0; index < new_menu.length; index++) { var link = document.createElement("a"); link.innerHTML = new_menu[index]; link.setAttribute("href", new_menu_links[index]); console.log("The link is", link); new_udemy_menu.append(link); } return new_udemy_menu; } export { addTitle, addLessonHeader, addLessonLink, homework_menu, althomework_menu, udemy_menu } /* * * helper functions * */