feat: add TypeScript lessons and learning panel
- Introduced a new script to check TypeScript lesson files for errors. - Created a main TypeScript file to render lessons and their details. - Added lesson definitions with starter and answer codes. - Implemented a user interface for navigating and running lessons. - Styled the application with CSS for a better user experience. - Updated README to reflect the new TypeScript section and usage instructions.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const prependButton = document.getElementById("prepend-btn");
|
||||
const clearActiveButton = document.getElementById("clear-active-btn");
|
||||
const helpLink = document.getElementById("help-link");
|
||||
const hintText = document.getElementById("hint-text");
|
||||
const messageList = document.getElementById("message-list");
|
||||
|
||||
let messageIndex = 1;
|
||||
|
||||
prependButton.addEventListener("click", function () {
|
||||
const item = document.createElement("li");
|
||||
item.className = "item active";
|
||||
item.textContent = `新插入的提醒 ${messageIndex}`;
|
||||
messageList.prepend(item);
|
||||
hintText.textContent = "已把一条消息插入到最前面";
|
||||
messageIndex += 1;
|
||||
});
|
||||
|
||||
clearActiveButton.addEventListener("click", function () {
|
||||
const items = document.querySelectorAll(".item");
|
||||
|
||||
items.forEach(function (item) {
|
||||
item.classList.remove("active");
|
||||
});
|
||||
|
||||
hintText.textContent = "已移除全部高亮状态";
|
||||
});
|
||||
|
||||
helpLink.addEventListener("click", function (event) {
|
||||
event.preventDefault();
|
||||
hintText.textContent = "已阻止默认跳转";
|
||||
});
|
||||
Reference in New Issue
Block a user