Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) m Polygnotus moved page User:Polygnotus/test3.js to User:Polygnotus/Scripts/GetAPIBatch.js |
||
(3 intermediate revisions by the same user not shown) | |||
Line 37:
margin-top: 0.5rem;
font-style: italic;
}▼
#article-content {▼
}
`;
Line 57 ⟶ 50:
<div id="article-name"></div>
<button id="next-button">Next Word</button>
<div id="debug-info"></div>
`;
Line 72 ⟶ 64:
this.debugElement = document.getElementById('debug-info');
this.articleNameElement = document.getElementById('article-name');
this.nextButton.addEventListener('click', () => this.
this.fetchWords();
Line 102 ⟶ 93:
}
async
if (this.currentIndex >= this.words.length) {
await this.fetchWords();
Line 112 ⟶ 103:
this.typoDisplayElement.textContent = `Typo: ${currentWord.typo}`;
this.articleNameElement.textContent = `Article: ${currentWord.articleName}`;
this.currentIndex++;
▲ await this.loadArticle(currentWord.articleName);
if (this.currentIndex >= this.words.length) {
Line 125 ⟶ 117:
this.typoDisplayElement.textContent = '';
this.articleNameElement.textContent = '';
}
Line 131 ⟶ 122:
}
const encodedArticleName = encodeURIComponent(articleName.replace(/ /g, '_'));
const articleUrl = `https://en.wikipedia.org/wiki/${encodedArticleName}`;
window.open(articleUrl, '_blank');
}
|