-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·482 lines (446 loc) · 22.4 KB
/
index.html
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/league-spartan.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<style type="text/css">
#background {
width: 100vw;
height: 100vh;
position: relative;
}
#background:before {
content: ' ';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(50, 0, 0, 0.5);
}
.wrapper {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
}
section {
text-align: left;
}
</style>
</head>
<body>
<div id="background">
</div>
<div class="wrapper">
<div class="reveal">
<div class="slides">
<section>
<h1 class="first-slide-title">Death to jQuery</h1>
</section>
<section>
<h2> Hi! I'm Daniel</h2>
<h3>Engineer on Bridge</h3>
</section>
<section>
<h2>Before we get to the killing part...</h2>
<h3>Let's talk about where we've been</h3>
</section>
<section>
<h2>In the beginning...</h2>
<h3>there was <html></h3>
</section>
<section data-background-image="lib/img/First_Web_Server.jpg">
<p class="attribution">By <a href="https://en.wikipedia.org/wiki/User:Coolcaesar" class="extiw" title="en:User:Coolcaesar">Coolcaesar</a> at the <a href="https://en.wikipedia.org/wiki/" class="extiw" title="w:">English language Wikipedia</a>, <a href="http://creativecommons.org/licenses/by-sa/3.0/" title="Creative Commons Attribution-Share Alike 3.0">CC BY-SA 3.0</a>, <a href="https://commons.wikimedia.org/w/index.php?curid=395096">Link</a></p>
</section>
<section>
<h2>The rise of styles and scripts: DHTML</h2>
<aside class="notes">
Still server request/response bound
</aside>
</section>
<section>
<h2>AJAX</h2>
<aside class="notes">
1998 - Microsoft makes first XMLHttp request in Outlook web app?
1999 - XMLHttp shipped in IE 5
XMLHttp implemented by everyone else as XMLHttpRequest
2005 - Jesse James Garret coins the term AJAX
2006 - First draft release of the Spec for XHR
</aside>
</section>
<section>
<h2>2006.</h2>
<h3>Let that sink in for a minute.</h3>
</section>
<section>
<h2>Web Applications</h2>
</section>
<section>
<h2>Frameworks and more!</h2>
</section>
<section>
<h2 class="force-top">So... jQuery <strike>is</strike> was amazing</h2>
<section>
<aside class="notes">
August 26, 2006 - first release
</aside>
</section>
<section>
<ul>
<li>Made AJAX simple cross browser</li>
</ul>
</section>
<section>
<ul>
<li class="secondary-item">Made AJAX simple cross browser</li>
<li>Made js and DOM easy cross browser</li>
</ul>
<aside class="notes">
<ul>
<li>document.querySelectorAll didn't land in IE until 8</li>
</ul>
</aside>
</section>
<section>
<ul>
<li class="secondary-item">Made AJAX simple cross browser</li>
<li class="secondary-item">Made js and DOM easy cross browser</li>
<li>Made dynamic applications approachable</li>
</ul>
</section>
<section>
<ul>
<li class="secondary-item">Made AJAX simple cross browser</li>
<li class="secondary-item">Made js and DOM easy cross browser</li>
<li class="secondary-item">Made dynamic applications approachable</li>
<li>Web standards were not a thing</li>
</ul>
<aside class="notes">
<ul>
<li>(designing with web standards 2003, jquery 2006).</li>
</ul>
</aside>
</section>
</section>
<section>
<h2>Web Standards won!</h2>
<h3>... well mostly</h3>
<aside class="notes">
<ul>
<li>XMLHttpRequest in all browsers post IE 7 October (>2006)</li>
<li>document.querySelectorAll didn't land in IE until 8 (2009)</li>
</ul>
</aside>
</section>
<section>
<h2>What did we use jQuery for anyway?</h2>
<section>
<aside class="notes">
August 26, 2006 - first release
</aside>
</section>
<section>
<ul>
<li>Animation</li>
</ul>
</section>
<section>
<ul>
<li class="secondary-item">Animation</li>
<li>AJAX</li>
</ul>
</section>
<section>
<ul>
<li class="secondary-item">Animation</li>
<li class="secondary-item">AJAX</li>
<li>Working with the DOM</li>
</ul>
</section>
</section>
<section>
<h2>Working With the DOM</h2>
<section></section>
<section>
<pre><code data-trim>
var elem = $('#myElementId');
// becomes
var elem = document.getElementByID('myElementId');
</code></pre>
</section>
<section>
<pre><code data-trim>
var elem = $('.my-class');
// becomes
var elem = document.querySelectorAll('.my-class');
// or
var elem = document.querySelector('.my-class');
</code></pre>
</section>
<section>
<h3>So... what's the difference between</h3>
<pre><code data-trim>
const elem = document.querySelectorAll('.my-class'); //returns array like object
// and
const elem = document.querySelector('.my-class'); //returns DOM node
</code></pre>
</section>
<section>
<pre><code data-trim>
const domQuery = (selector) => {
const isId = selector.match(/#/);
const Arr = Array.prototype;
if (isId) {
return document.querySelector(selector);
} else {
return Arr.slice.call(document.querySelectorAll(selector) || []);
}
};
</code></pre>
</section>
<section>
<h3>What about finding parent nodes?</h3>
<pre><code data-trim>
const elem = domQuery('#myId');
elem.parentNode.remove(elem);
// or...
elem.parentElement.remove(elem);
//or maybe the next sibling element
sibling = elem.nextSibling;
</code></pre>
<aside class="notes">
there are some edge cases where they act differently.
for instance: document.documentElement is null in .parentElement and the document node in .parentNode.
</aside>
</section>
</section>
<section>
<h2>Native AJAX</h2>
<section></section>
<section>
<pre><code data-trim>
$.get('http://instructure.bridgeapp.com/api/users', function (data) {
// do stuff!
});
</code></pre>
</section>
<section>
<h3>Streams!</h3>
<pre><code data-trim>
const req = new XMLHttpRequest();
//register eent listener before we don anything else
req.addEventListener('load', function () {
const response = JSON.parse(this.responseText);
//Cool! We have the datas.
});
// tell the request what to go get
req.open('GET', 'http://instructure.bridgeapp.com/api/users');
// tell the request to send
req.send();
</code></pre>
</section>
<section>
<h3>Streams!</h3>
<pre><code data-trim>
const req = new XMLHttpRequest();
//register eent listener before we don anything else
req.addEventListener('load', function () {
const response = JSON.parse(this.responseText);
//Cool! We have the datas.
});
// tell the request what to go get
req.open('POST', 'http://instructure.bridgeapp.com/api/users');
req.setRequestHeader('Content-Type', 'application/json');
// tell the request to send
req.send(JSON.stringify({
name: 'Luke Skyjogger',
role: 'admin'
}));
</code></pre>
</section>
<section>
<h3>Fetch!</h3>
<pre><code data-trim>
fetch('http://instructure.bridgeapp.com/api/users')
.then((response) => {
response.json().then((data) => {
// this is where we do stuff with the data
});
});
// or
fetch('http://instructure.bridgeapp.com/api/users')
.then((response) => {
return response.json();
}).then((data) => {
// this is where we do stuff with the data
});
</code></pre>
<aside class="notes">
point out the need for the then on the new json API in fetch
</aside>
</section>
<section>
<h3>Fetch!</h3>
<pre><code data-trim>
fetch('http://instructure.bridgeapp.com/api/users', {
method: 'POST',
body: JSON.stringify({
name: 'Luke Skyjogger',
role: 'admin'
})
}).then((response) => {
return response.json();
}).then((data) => {
// this is where we do stuff with the data
});
</code></pre>
</section>
</section>
<section>
<h2>Animations...</h2>
<section></section>
<section>
<pre><code data-trim>
$('#myElement').animate({
height: '200px',
width: '200px'
});
//or
$('#myElement').animate({
height: '200px',
width: '200px'
}, 400, 'easein', () => {
#('myElementTwo').animate({
height: '100px',
width: '100px'
}, 400, 'easin');
});
</code></pre>
<aside class="notes">
The first... can probably be a CSS transform/transition. The second... for that you need a framework.
</aside>
</section>
<section>
<h3>Web Animations API</h3>
<pre><code data-trim>
var player = document.getElementById('toAnimate').animate([
{ transform: 'scale(1)', opacity: 1, offset: 0 },
{ transform: 'scale(.5)', opacity: .5, offset: .3 },
{ transform: 'scale(.667)', opacity: .667, offset: .7875 },
{ transform: 'scale(.6)', opacity: .6, offset: 1 }
], {
duration: 700, //milliseconds
easing: 'ease-in-out', //'linear', a bezier curve, etc.
delay: 10, //milliseconds
iterations: Infinity, //or a number
direction: 'alternate', //'normal', 'reverse', etc.
fill: 'forwards' //'backwards', 'both', 'none', 'auto'
});
</code></pre>
<p>Courtesy of <a href="http://danielcwilson.com/blog/2015/07/animations-part-1/">Daniel C. Wilson</a></p>
<aside class="notes">
Timeline, animation groups, getAnimations, motion paths, and more!
</aside>
</section>
<section>
<h3>Web Animations API</h3>
<pre><code data-trim>
var elem = document.getElementById('toAnimate');
var elem2 = document.getElementById('toAnimate2');
var timings = {
duration: 1000
}
var keyframes = [
{ opacity: 1 }.
{ opacity: 0 }
];
var kEffects = [
new KeyframeEffect(elem, keyframes, timings),
new KeyframeEffect(elem2, keyframes, timings)
];
var group = new SequenceEffect(kEffects);
document.timeline.play(group);
</code></pre>
</section>
<section>
<h3>Green Sock Animation Platform</h3>
</section>
</section>
<section>
<h2>So... jQuery <strike>is</strike> was amazing</h2>
</section>
<section>
<h2>But now we have better tools</h2>
</section>
<section>
<h2>RIP jQuery</h2>
<h3>2006—2016</h3>
</section>
</div>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/1.0.1/trianglify.min.js"></script>
<script>
const randomInt = (max) => {
return parseInt(Math.random() * (max - 70) + 70);
}
const randomColor = () => '#'+(Math.random()*0xFFFFFF<<0).toString(16);
const generateBackground = (seed) => {
var pattern = Trianglify({
height: document.body.clientHeight,
width: document.body.clientWidth,
cell_size: randomInt(150),
variance: '0.' + randomInt(100),
x_colors: 'random',
y_colors: 'random',
seed: seed
});
[].slice.call(document.getElementById('background').getElementsByTagName('svg')).forEach((svg) => svg.remove());
document.getElementById('background').appendChild(pattern.svg());
}
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
progress: false,
controls: false,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
const backgroundListener = (event) => {
const seedElem = document.querySelector('.present h2') ||
document.querySelector('.present h1') ||
'The world is a cold dark place';
if (event.indexv > 0 && document.querySelector('.stack.present h2')) {
document.querySelector('.stack.present h2').style['margin-top'] = "60px";
} else if (document.querySelector('.stack.present h2')){
document.querySelector('.stack.present h2').style['margin-top'] = "282px";
}
generateBackground(seedElem.textContent);
};
Reveal.addEventListener( 'slidechanged', backgroundListener);
Reveal.addEventListener( 'ready', backgroundListener);
</script>
</body>
</html>