-
Notifications
You must be signed in to change notification settings - Fork 0
/
05-javascript.html
242 lines (211 loc) · 10.4 KB
/
05-javascript.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JavaScript » Alexander Bogomolov</title>
<meta name="description" content="impress.js is a presentation tool based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prezi.com.">
<meta name="author" content="Alexander Bogomolov" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic" rel="stylesheet" />
<link href="lib/css/impress-js.css" rel="stylesheet" />
<link href="lib/css/style.css" rel="stylesheet" />
<link href="lib/plugins/highlight/styles/default.css" rel="stylesheet" />
</head>
<body>
<section id="presentation">
<header>
<progress id="presentation-progress" max="10" value="1"></progress>
</header>
<div id="impress" class="impress-not-supported">
<article id="intro" class="step" data-x="0" data-y="0" data-scale="1">
<h1>JavaScript</h1>
<p>Struktur ist alles!</p>
</article>
<article id="allgemeines" class="step" data-x="1500" data-y="0" data-z="0" data-scale="1" data-rotate="-90" data-rotate-x="0" data-rotate-y="0">
<h1>Dateien richtig strukturieren</h1>
<ul class="clear" style="font-size: .8em; padding: 0;">
<li>
js
<ul style="margin-left: 2.5em;">
<li>plugins<ul style="margin-left: 2.5em;"><li>...</li></ul></li>
<li>partials/init<ul style="margin-left: 2.5em;"><li>colorbox.init.js</li><li>...</li></ul></li>
<li>application.js</li>
</ul>
</li>
<li>
third-party
<ul style="margin-left: 2.5em;">
<li>colorbox<ul style="margin-left: 2.5em;"><li>colorbox.css</li><li>colorbox.js</li></ul></li>
<li>...</li>
</ul>
</li>
</ul>
</article>
<article id="init" class="step" data-x="0" data-y="1300" data-z="0" data-scale="1" data-rotate="0" data-rotate-x="0" data-rotate-y="0">
<h1>colorbox.init.js</h1>
<pre><code class="language-javascript">$(document).ready(function() {
var links = $('a.modal');
if(links.length) {
Modernizr.load([{
test: (typeof colorbox == 'function'),
nope: [
'/third-party/colorbox/colorbox.css',
'/third-party/colorbox/colorbox.js'
],
complete: function() {
links.colorbox();
}
}]);
}
});</code></pre>
</article>
<article id="app" class="step" data-x="0" data-y="-1300" data-z="0" data-scale="1" data-rotate="90" data-rotate-x="0" data-rotate-y="0">
<h1>application.js</h1>
<pre><code class="language-javascript">$(document).ready(function() {
Modernizr.load([
'/js/partials/colorbox.init.js',
]);</code></pre>
</article>
<article id="oop" class="step" data-x="-1500" data-y="0" data-z="0" data-scale="1" data-rotate="0" data-rotate-x="0" data-rotate-y="0">
<h1>OOP</h1>
<pre><code class="language-javascript">
var Person = function() {
this.firstname = null;
this.lastname = null;
this.age = null;
}
Person.prototype.getFirstname = function() { return this.firstname; };
Person.prototype.getLastname = function() { return this.lastname; };
Person.prototype.getAge = function() { return this.age; };
Person.prototype.setFirstname = function(value) { this.firstname = value; };
Person.prototype.setLastname = function(value) { this.lastname = value; };
Person.prototype.setAge = function(value) { this.age = value; };
Person.prototype.sayHello = function() { return 'Hello, ' + this.getFirstname; };
</code></pre>
<pre><code class="language-javascript">var person = new Person();
person.setFirstname('Alex');
alert(person.sayHello()); // Hello Alex</code></pre>
</article>
<article id="plugins-1" class="step" data-x="-1500" data-y="800" data-z="0" data-scale="1" data-rotate="180" data-rotate-x="0" data-rotate-y="0">
<h1>Weniger Funktionen, mehr Plugins</h1>
<pre><code class="language-javascript">$('#select-all').click(function(e) {
if($(this).is(':checked')) {
$(this).parents('table').find('.select-item').attr('checked', 'checked');
}
else {
$(this).parents('table').find('.select-item').removeAttr('checked');
}
});</code></pre>
</article>
<article id="plugins-1" class="step" data-x="3000" data-y="0" data-z="0" data-scale="1" data-rotate="5" data-rotate-x="10" data-rotate-y="5">
<h1>Weniger Funktionen, mehr Plugins <a href="https://github.com/alexander-bogomolov/checkboxToggleizr/blob/master/jquery.checkboxToggleizr.js">GitHub</a></h1>
<img src="images/05/jquery-plugin.png" title="" alt="" />
</article>
<!--
<article id="on-off-2" class="step" data-x="3000" data-y="800" data-z="0" data-scale="1" data-rotate="-5" data-rotate-x="5" data-rotate-y="10">
<ul>
<li>
<pre><code class="language-javascript">$('.comment').delegate('a.add', 'click', addNew);</code></pre>
<pre><code class="language-javascript">$('.comment').on('click', 'a.add', addNew);</code></pre>
</li>
<li>
<pre><code class="language-javascript">$('.dialog').undelegate('a', 'click.myDlg');</code></pre>
<pre><code class="language-javascript">$('.dialog').off('click.myDlg', 'a');</code></pre>
</li>
<li>
<pre><code class="language-javascript">$('a').live('click', fn);</code></pre>
<pre><code class="language-javascript">$(document).on('click', 'a', fn);</code></pre>
</li>
<li>
<pre><code class="language-javascript">$('a').die('click');</code></pre>
<pre><code class="language-javascript">$(document).off('click', 'a');</code></pre>
</li>
</ul>
</article>
<article id="on-off-3" class="step" data-x="3000" data-y="1800" data-z="0" data-scale="1" data-rotate="5" data-rotate-x="0" data-rotate-y="0">
<img src="images/04/jquery-performance-on-event-api.png" title="" alt="" />
<aside>
<ol>
<li><a href="http://blog.jquery.com/2011/11/03/jquery-1-7-released/" title="">JQUERY 1.7 RELEASED</a></li>
</ol>
</aside>
</article>
<article id="wissenswertes-1" class="step" data-x="3000" data-y="2800" data-z="0" data-scale="1" data-rotate="180" data-rotate-x="0" data-rotate-y="0">
<h1>Wissenswertes</h1>
<ul>
<li><var>jQuery.isNumeric()</var></li>
<li>
<var>.find()</var> ist schneller als komplexe Selektoren
<pre><code class="language-javascript">var e = $('#id p');
var v = $('#id').find('p'); // bis zu 2x schneller</code></pre>
</li>
<li>
Event delegation:
<pre><code class="language-javascript">$('table').on('click','td',function() {
$(this).toggleClass('active');
});</code></pre>
</li>
</ul>
</article>
<article id="wissenswertes-2" class="step" data-x="5000" data-y="0" data-z="0" data-scale="1" data-rotate="-10" data-rotate-x="0" data-rotate-y="0">
<ul>
<li>
Die meisten Methoden haben bereits eine Schleife in der Implementierung:
<pre><code class="language-javascript">var links = $('a');
links.each(function() {
$(this).css('color', 'red');
})</code></pre>
<pre><code class="language-javascript">var links = $('a');
links.css('color', 'red');</code></pre>
</li>
</ul>
<h2>Grund</h2>
</article>
<article id="ausblick" class="step" data-x="5000" data-y="800" data-z="0" data-scale="1" data-rotate="5" data-rotate-x="0" data-rotate-y="0">
<h1>jQuery 1.9 & 2.0</h1>
<ul>
<li>jQuery 2.0 - Kein Support für IE 6/7/8</li>
<li>Modular</li>
<li>Schlanker & Schneller</li>
</ul>
</article>
<article id="sprites" class="step" data-x="5000" data-y="1600" data-z="0" data-scale="1" data-rotate="180" data-rotate-x="0" data-rotate-y="0">
<h1>Sprites</h1>
<h2>SCSS</h2>
<pre><code class="language-css">@import "icon/*.png";
@import all-icon-sprites($dimensions:true);</code></pre>
<h2>CSS</h2>
<pre><code class="language-css">.icon-sprite, .icon-minus { background: url('images/icon-sd6115b5d.png') no-repeat; }
.icon-minus {
background-position: 15px 255px;
width: 16px;
height: 16px;
}</code></pre>
</article>
<article id="links" class="step" data-x="-3000" data-y="0" data-z="0" data-scale="1" data-rotate="90" data-rotate-x="0" data-rotate-y="0">
<h1>Links</h1>
<ul>
<li><a href="http://oscarotero.com/jquery/">jQuery Quick API Reference</a></li>
<li><a href="http://jqfundamentals.com/">jQuery Fundamentals </a></li>
<li><a href="http://www.developerdrive.com/2011/12/switch-on-with-jquerys-new-event-methods/">Switch on With jQuery’s New Event Methods</a></li>
<li><a href="http://blog.jquery.com/2012/07/01/jquery-1-9-and-2-0-tldr-edition/">jQuery 1.9 and 2.0 — TL;DR Edition</a></li>
</ul>
</article>
-->
<article id="danke" class="step" data-x="0" data-y="-2500" data-z="0" data-scale="1" data-rotate="180" data-rotate-x="0" data-rotate-y="0">
<h1>Vielen Dank!</h1>
<img id="me" src="lib/images/me.jpg" alt="Alexander Bogomolov" />
<ul class="clear">
<li><a href="http://www.twitter.de/abogomolov" title="Alexander auf Twitter">@abogomolov</a></li>
<li><a href="http://www.bogomolov.de/+" title="Alexander auf Google Plus">+Alexander Bogomolov</a></li>
</ul>
</article>
<article id="overview" class="step" data-x="500" data-y="500" data-scale="10"></article>
</div>
<footer>Alexander Bogomolov - <span class="eos-color">EOS</span> UPTRADE GmbH</footer>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="lib/js/impress.js"></script>
<script src="lib/plugins/highlight/highlight.pack.js"></script>
<script src="lib/js/scripts.js"></script>
</body>
</html>