Skip to content

Commit 7fdd25c

Browse files
committed
Chapter bezier-curves and hello-world translated
TODO added
1 parent ce93be2 commit 7fdd25c

File tree

4 files changed

+127
-147
lines changed

4 files changed

+127
-147
lines changed
+43-53
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,87 @@
11
# Hello, world!
22

3-
The tutorial that you're reading is about core JavaScript, which is platform-independent. Further on, you will learn Node.JS and other platforms that use it.
3+
Dieses Tutorial behandelt Java-Script, im Kern eine plattformunabhängige Technik. Später wenden wir uns Node.js und anderen Plattformen zu die JavaScript verwenden.
44

5-
But, we need a working environment to run our scripts, and, just because this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum, so that you don't spend time on them if you plan to concentrate on another environment like Node.JS. On the other hand, browser details are explained in detail in the [next part](/ui) of the tutorial.
5+
Doch zunächst benötigen wir eine Umgebung in der wir unsere Scripte ausführen können. Da dies ein Online-Buch ist, liegt es nahe, den Browser zu verwenden. Wir vermeiden so weit als möglich browserspezifische Anweisungen (wie `alert`) so dass Sie keine Zeit darauf verlieren, wenn ihr späteres Augenmerk eigentlich Node.js sein soll. Interessieren Sie sich aber für die Browserdetails, so behandeln wir diese ausführlich im [nächsten Teil](/ui) des Tutorials.
66

7-
So first, let's see how to attach a script to a webpage. For server-side environments, you can just execute it with a command like `"node my.js"` for Node.JS.
7+
Fangen wir aber damit an, wie man ein Script in eine Webseite einbettet. Befinden Sie sich in einer serverseitigen Umgebung können Sie ein Script mit einem Kommando wie `"node my.js"` mit Node.js ausführen.
88

99

10-
## The "script" tag
10+
## Das "script"-Tag
1111

12-
JavaScript programs can be inserted in any part of an HTML document with the help of the `<script>` tag.
12+
JavaScript-Programme können überall innerhalb eines HTML-Dokuments mit Hilfe des `<script>`-Tags platziert werden.
1313

14-
For instance:
14+
Zum Beispiel:
1515

1616
```html run height=100
1717
<!DOCTYPE HTML>
1818
<html>
1919

2020
<body>
2121

22-
<p>Before the script...</p>
22+
<p>Vor dem Script...</p>
2323

2424
*!*
2525
<script>
2626
alert( 'Hello, world!' );
2727
</script>
2828
*/!*
2929

30-
<p>...After the script.</p>
30+
<p>...Nach dem Script.</p>
3131

3232
</body>
3333

3434
</html>
3535
```
3636

3737
```online
38-
You can run the example by clicking on the "Play" button in its right-top corner.
38+
Sie können die Beispiele in diesem Tutorial laufen lassen, indem Sie den "Play"-Knopf in der oberen rechten Ecke anklicken.
3939
```
4040

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser meets the tag.
41+
Das `<script>`-Tag beinhaltet JavaScript-Code der automatisch ausgeführt wird, wenn der Browser den Tag erreicht.
4242

43+
## Der moderne Dialekt
4344

44-
## The modern markup
45+
Das `<script>`-Tag besitzt einige Attribute die heute nicht mehr eingesetzt werden, die man aber in älterem Code finden kann:
4546

46-
The `<script>` tag has a few attributes that are rarely used nowadays, but we can find them in old code:
47+
**Das `type`-Attribut: <code>&lt;script <u>type</u>=...&gt;</code>**
4748

48-
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
49+
Der alte HTML4-Standard sah vor, dass Scripte einen Typ haben müssen, typischerweise `type="text/javascript"`. Der aktuelle HTML-Standard nimmt diesen Typ als Standardwert an; eine Angabe des Attributes ist nicht notwendig.
4950

50-
: The old standard HTML4 required a script to have a type. Usually it was `type="text/javascript"`. The modern HTML standard assumes this `type` by default. No attribute is required.
51+
**Das `language`-Attribut: <code>&lt;script <u>language</u>=...&gt;</code>**
5152

52-
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
53-
: This attribute was meant to show the language of the script. As of now, this attribute makes no sense, the language is JavaScript by default. No need to use it.
53+
Dieses Attribut sollte die Programmiersprache des Scripts anzeigen. Da diese standardmäßig JavaScript ist, gibt es keine Notwendigkeit das Attribut zu verwenden.
5454

55-
Comments before and after scripts.
56-
: In really ancient books and guides, one may find comments inside `<script>`, like this:
57-
58-
```html no-beautify
59-
<script type="text/javascript"><!--
60-
...
61-
//--></script>
62-
```
63-
64-
These comments were supposed to hide the code from an old browser that didn't know about a `<script>` tag. But all browsers born in the past 15+ years don't have any issues. We mention it here, because such comments serve as a sign. If you see that somewhere -- that code is probably really old and not worth looking into.
55+
**Kommentare vor und nach Scripten**
6556

57+
In sehr alten Anleitungen, Büchern und Codes findet man Kommentare innerhalb von `<script>`, so wie diesen:
58+
```html no-beautify
59+
<script type="text/javascript"><!--
60+
...
61+
//--></script>
62+
```
6663

67-
## External scripts
64+
Solche Kommentare sollten den Script-Code vor älteren Browsern verstecken, die mit dem `<script>`-Tag noch nichts anfangen konnten. Aber alle Browser aus mindestens den letzten 15 Jahren haben dieses Problem nicht. Wir zeigen dieses Idiom hier als ein Warnzeichen. Wenn Sie es irgendwo entdecken, können Sie davon ausgehen, dass der Code wirklich sehr alt ist und es sich nicht lohnt, sich näher damit zu befassen.
6865

69-
If we have a lot of JavaScript code, we can put it into a separate file.
66+
## Externe Scripte
7067

71-
The script file is attached to HTML with the `src` attribute:
68+
Wenn wir sehr viel JavaScript-Code auf unserer Seite haben, können wir diesen in einer separaten Datei platzieren. Die Datei wird mit dem `src`-Attribute zur HTML-Webseite hinzugefügt:
7269

7370
```html
74-
<script src="/path/to/script.js"></script>
71+
<script src="/pfad/zum/script.js"></script>
7572
```
7673

77-
Here `/path/to/script.js` is an absolute path to the file with the script (from the site root).
74+
`/fad/zum/script.js` ist eine absolute Pfadangabe zur Script-Datei, ausgehend vom Wurzelverzeichnis der Seite.
7875

79-
It is also possible to provide a path relative to the current page. For instance, `src="http://github.com/script.js"` would mean a file `"script.js"` in the current folder.
76+
Alternativ können auch relative Pfade angegeben werden. Zum Beispiel heißt `src="http://github.com/script.js"` das eine Datei `"script.js"` im aktuellen Ordner verwendet werden soll.
8077

81-
We can give a full URL as well, for instance:
78+
Auch eine vollständige URL kann angegeben werden:
8279

8380
```html
8481
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.2.0/lodash.js"></script>
8582
```
8683

87-
To attach several scripts, use multiple tags:
84+
Mehrere Scripte können mit mehreren `script`-Tags geladen werden:
8885

8986
```html
9087
<script src="/js/script1.js"></script>
@@ -93,29 +90,23 @@ To attach several scripts, use multiple tags:
9390
```
9491

9592
```smart
96-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
97-
98-
The benefit of a separate file is that the browser will download it and then store in its [cache](https://en.wikipedia.org/wiki/Web_cache).
93+
Nur die aller einfachsten Scripte sollten direkt in eine HTML-Datei geschrieben werden. Komplexere Dinge landen in einer eigenen Datei.
9994
100-
After this, other pages that want the same script will take it from the cache instead of downloading it. So the file is actually downloaded only once.
101-
102-
That saves traffic and makes pages faster.
95+
Ein Vorteil davon ist, dass Browser diese Dateien in ihrem [Cache](https://de.wikipedia.org/wiki/Cache) vorhalten, nachdem sie einmal geladen wurden. Verwendet eine andere Seite das selbe Script, kann dieses aus dem Cache genommen werden und muss nicht nochmal aus dem Web geladen werden. Das spart Web-Traffic und beschleunigt Seiten.
10396
```
10497

105-
````warn header="If `src` is set, the script content is ignored."
106-
A single `<script>` tag can't have both the `src` attribute and the code inside.
98+
````warn header="Wenn `src` gesetzt wurde, wird der Inhalt von `<script>` ignoriert."
99+
Ein einzelner `<script>`-Tag kann kein `src`-Attribute und JavaScript-Code beinhalten.
107100

108-
This won't work:
101+
Das hier würde nicht funktionieren:
109102

110103
```html
111104
<script *!*src*/!*="file.js">
112-
alert(1); // the content is ignored, because src is set
105+
alert(1); // Der Inhalt wird ignoriert, das src verwendet wird
113106
</script>
114107
```
115108

116-
We must choose: either it's an external `<script src="…">` or a regular `<script>` with code.
117-
118-
The example above can be split into two scripts to work:
109+
Wir können das Beispiel in zwei Scripte aufteilen um es lauffähig zu machen:
119110

120111
```html
121112
<script src="file.js"></script>
@@ -125,11 +116,10 @@ The example above can be split into two scripts to work:
125116
```
126117
````
127118
128-
## Summary
129-
130-
- We can use a `<script>` tag to add JavaScript code to the page.
131-
- The `type` and `language` attributes are not required.
132-
- A script in an external file can be inserted with `<script src="path/to/script.js"></script>`.
119+
## Zusammenfassung
133120
121+
- Wir können das `<script>`-Tag verwenden um JavaScript-Code zu einer Webseite hinzuzufügen.
122+
- Die Attribute `type` und `language` werden nicht länger benötigt.
123+
- Ein Script aus einer anderen Datei kann mit `<script src="pfad/zum/script.js"></script>` geladen werden.
134124
135-
There is much more to learn about browser scripts and their interaction with the web-page. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves from it. We'll be using a browser as a way to run JavaScript, which is very convenient for online reading, but yet one of many.
125+
Es gibt noch viel mehr über Scripte im Browser und deren Interaktion mit Webseiten zu sagen. In diesem Teil des Tutorials soll es aber nur um die Sprache JavaScript gehen und wir wollen uns davon zunächst nicht ablenken. Wir nutzen den Browser zunächst als eine bequeme Möglichkeit um JavaScript-Code ablaufen zu lassen.

0 commit comments

Comments
 (0)