mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +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>
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<div class="comic" style="height: 530px; background-image: url(/img/tutorial/ch1pg8.png); background-size: 489px; margin-top:1em">
|
||||
<div class="dialogue" style="top: 50px; left: 0; width: 380px">
|
||||
Now add a link to one of your list items. If nested properly, it should look something like this:
|
||||
<br><strong><li><a href="http://yarn.com">Yarn</a></li></strong>
|
||||
Now add a link to one of your list items. If nested properly, it should look similar to this:
|
||||
<br>
|
||||
<div class="txt-Left">
|
||||
<strong><li><br> <a href="http://yarn.com">Yarn</a><br></li></strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -23,15 +26,23 @@
|
|||
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><a.+href=".+">.+</a></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/9')
|
||||
var a = preview().find('li a')
|
||||
if(a.length == 0) {
|
||||
notok("I don't see a link in your <li></li>, try adding one.")
|
||||
return
|
||||
}
|
||||
|
||||
if(a.attr('href') === undefined || a.attr('href') == '') {
|
||||
notok('You need to add an <strong>href</strong> to your <strong>a</strong> tag, like: <strong>href="//neocities.org"</strong>')
|
||||
return
|
||||
}
|
||||
|
||||
if(a.text() == '' || a.text().match(/\s+/)) {
|
||||
notok('You need to add a name for your link, which is the text between the <a> tag, and the closing tag </a>')
|
||||
return
|
||||
}
|
||||
|
||||
sessionStorage.setItem('tutorialHtml', html)
|
||||
ok('Great, you did it!', '/tutorial/html/9')
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue