-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
232 lines (180 loc) · 7.31 KB
/
index.html
File metadata and controls
232 lines (180 loc) · 7.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="assets/css/style.css"/>
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<title>XML Made Easy</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
var oldHTML14=$("#card14").html();
var oldHTML9=$("#card9").html();
var oldHTML6=$("#card6").html();
var lastScroll=0;
$(window).scroll(function() {
var scrollTop=$(window).scrollTop();
for (var cardIterator=0; cardIterator<16; cardIterator++) {
var fadeMax=$(window).height()/2;
var cardTopLocation=$(window).height()*cardIterator;
if (scrollTop<(cardTopLocation+(fadeMax*2)) && scrollTop>=(cardTopLocation-fadeMax)){
if(scrollTop>=cardTopLocation && scrollTop<(cardTopLocation+fadeMax)) {
$('#card'+ (cardIterator)).css('opacity', ((cardTopLocation+fadeMax)-scrollTop)/fadeMax);
}else {
if(scrollTop>(cardTopLocation+(fadeMax*1.5)) && scrollTop>lastScroll){
console.log(cardTopLocation+$(window).height+"scrolling");
$(document).scrollTop(cardTopLocation+$(window).height());
}
}
} else {
if ($('#card6').html()!=oldHTML6 && cardIterator==5){
$('#card6').html(oldHTML6);
}
if ($('#card9').html()!=oldHTML9 && cardIterator==8){
$('#card9').html(oldHTML9);
}
if ($('#card14').html()!=oldHTML14 && cardIterator==13){
$('#card14').html(oldHTML14);
}
}
}
lastScroll=scrollTop;
});
});
function getText(id) {
var txt = $("#card"+id+"_code").val();
txt = txt.replace(/\/\/.+(\n){1}/g, '');
txt = txt.replace(/\\*.*\*\//g, '');
txt = txt.replace(/\s/g, '');
$(".display").html("<p>"+txt+"</p>");
if(id==6) {
if(txt=="<square>") {
$("#card6").html("<img src='assets/square.png'>");
}
else {
$("#card6_tip").html("<span>Type in '<square>'</span>").fadeIn();
}
}
if(id==9) {
if(txt=="<square/>") {
$("#card9").html("<img src='assets/square.png'>");
}
else {
$("#card9_tip").html("<span>Type in '<square/>'</span>").fadeIn();
}
}
if(id==14) {
if(txt=="<square><circle/></square>") {
$("#card14").html("<img src='assets/square_circle.png'>");
}
else {
$("#card14_tip").html("<span>Type in '<square> <circle /> </square>'</span>").fadeIn();
}
}
}
function expand_contents() {
$(".contents_expand").slideToggle();
}
</script>
<body>
<div id="contentcontainer">
<div id="tablecontainer">
<div class="logo">
<img src="assets/logo.png" width="200px" style="opacity:.5">
</div>
<div class="contents" onclick="expand_contents()" style="text-align:center">
<img src="assets/hamburger.png" style="width: 32px;
padding: 9px;
opacity: 0.5;" />
</div>
<div class="contents_expand">
<a href="#card1">Card 1: Text</a>
<a href="#card5">Card 5: Square</a>
<a href="#card13">Card 13: Nesting</a>
</div>
<div class="card" id="card0">
XML Made Easy<br><br>
<span style="font-size:24px">(Adapted from <a href="https://drive.google.com/folderview?id=0B9ocvajeApo1fm9hSHY1d2RxOXFfM2FhdVlvT3UtT2xlbVRGb0hrVTFucUFGNDdRUlRoc1U">User Interface Development</a>)
</span>
</div>
<div class="card" id="card1">
<div class="code">
This is text <br />
<this is text> <br />
<this is still text> <text/>
</div>
</div>
<div class="card" id="card2">
Text is anything that can be written. Since markup languages markup text, markup languages can understand anything that can be written!
</div>
<div class="card" id="card3">
<div>
All the text in between the opening pointy bracket < and the first space is called the <b>element name</b>. The element name is underlined in the following:
</div>
</div>
<div class="card" id="card4">
<div class="code">
<<u>elementname</u>> <br>
<<u>thisisanelementname</u> thisisnotanelementname> <br/>
<<u>stilltheelementname</u> someattribute=\"value\">
</div>
</div>
<br>
<div class="card" id="card5">
Markup languages can convert elements into things on the screen.
</div>
<div class="card" id="card6">
Make an element with the name square:
<br>
<div class="tip" id="card6_tip"></div>
<textarea class="codebox" id="card6_code">/* Create a square below */</textarea>
<button type="button" onclick="getText(6)">Run</button>
</div>
<div class="card" id="card6_answer" style="display:none">
[Image of finished piece]
</div>
<div class="card" id="card7">
Markup languages require that most elements have a slash / before the end pointy bracket <.
</div>
<div class="card" id="card8">
<div class="code">
<elementname/>
<anotherelement/>
</div>
</div>
<div class="card" id="card9">
Improve the code for the square element you previously made by adding slash /:
<br>
<div class="tip" id="card9_tip"></div>
<textarea class="codebox" id="card9_code">/* Create a -correct- square below */</textarea>
<button type="button" onclick="getText(9)">Run</button>
</div>
<div class="card" id="card9_answer" style="display:none">
</div>
<div class="card" id="card10">
If you want to put things inside an element, you would use opening and closing tags.
</div>
<div class="card" id="card11">
Closing tags always start with a slash / after the beginning pointy bracket <.
</div>
<div class="card" id="card12">
The opening tag is <span style="color:#093"> green </span> and the closing tag is <span style="color:#09F"> blue </span> in the following:
</div>
<div class="card" id="card13">
<div class="code">
<<span style="color:#093">opening-tag</span>>
stuff you want to put in your element <maybeanelement/>
</<span style="color:#09F">closing-tag</span>>
</div>
</div>
<div class="card" id="card14">
Write the code to put an element of the name circle inside an element of the name of square:
<br />
<div class="tip" id="card14_tip"></div>
<textarea class="codebox" id="card14_code">/*How do you represent one thing inside of another in XML?*/</textarea>
<button type="button" onclick="getText(14)">Run</button>
</div>
</div>
</body>
</html>