mirror of
https://github.com/neocities/neocities.git
synced 2025-07-21 18:16:07 +02:00
improved flow for 7 and 8
This commit is contained in:
parent
8c5b9a803d
commit
1f6ef958dc
2 changed files with 44 additions and 20 deletions
|
@ -33,15 +33,28 @@
|
|||
function checkHomework() {
|
||||
var html = editor.getValue()
|
||||
|
||||
/* TODO: Make .+ ignore any spaces or newlines or whatever. </a> lol </p> is fine too. */
|
||||
var match = '<html.+>.+<body>.+<ul>.+<li>.+</li>.+</ul>.+</body>.+</html>'
|
||||
var re = new XRegExp(match, 'gis')
|
||||
|
||||
if(html.match(re) === null) {
|
||||
notok("That's not right! Try again.")
|
||||
} else {
|
||||
sessionStorage.setItem('tutorialHtml', html)
|
||||
ok('Great, you did it!', '/tutorial/html/8')
|
||||
if(!html.match(new XRegExp('<ul>.+</ul>', 'gis'))) {
|
||||
notok("I don't see the <ul> and </ul> tag!")
|
||||
return
|
||||
}
|
||||
|
||||
var ul = preview().find('ul')
|
||||
|
||||
if(ul.find('li').length == 0) {
|
||||
notok("Okay, I see the <strong>ul</strong>, but no <strong>li</strong>. Try adding a list item to it: <li>Yarn</li>")
|
||||
return
|
||||
}
|
||||
|
||||
var liText = ul.find('li').first().text()
|
||||
|
||||
if(liText == '' || liText.match(/\s+/)) {
|
||||
notok("I don't see any text in the <strong>li</strong>. Try using it like this: <strong><li>Yarn</li></strong>")
|
||||
return
|
||||
}
|
||||
|
||||
if(ul.find('li'))
|
||||
|
||||
sessionStorage.setItem('tutorialHtml', html)
|
||||
ok('Awesome list!', '/tutorial/html/8')
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue