Skip to content

Commit 41cf1f8

Browse files
authored
Update article.md
1 parent 95ea755 commit 41cf1f8

File tree

1 file changed

+40
-30
lines changed

1 file changed

+40
-30
lines changed

1-js/02-first-steps/01-hello-world/article.md

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,47 +38,52 @@
3838
تاگی `<script>` کۆدی جاڤاسکڕێپتی تێدایە کە بە شێوەیەکی ئۆتۆماتیکی جێبەجێ دەکرێت کاتێک وێبگەڕ تاگەکە پرۆسێس دەکات.
3939

4040

41-
## Modern markup
41+
## نووسینی مۆدێرن
4242

43-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
43+
تاگی `<script>` چەند تایبەتمەندییەکی هەیە کە ئەمڕۆ بە دەگمەن بەکاردەهێنرێن، بەڵام هێشتا لە کۆدی کۆنتردا دەبینرێن
4444

45-
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
46-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic, we'll talk about modules in another part of the tutorial.
45+
تایبەتمەندی `جۆر`: <code>&lt;script <u>type</u>=...&gt;</code>
4746

48-
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
49-
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
47+
: ستانداردە کۆنەکەی HTML، HTML4، پێویستی بە سکریپتێک هەبوو کە `جۆر`ی هەبێت. بەزۆری `type="text/javascript` بوو. ئیتر پێویست ناکات.هەروەها ستانداردی مۆدێرن HTML مانای ئەم تایبەتمەندییەی بەتەواوەتی گۆڕی. ئێستا دەتوانرێت بۆ مۆدیولەکانی جاڤاسکڕێپت بەکاربهێنرێت. بەڵام ئەمە بابەتێکی پێشکەوتووە، لە بەشێکی تری فێرکاریەکەدا باسی مۆدیولەکان دەکەین.
5048

51-
Comments before and after scripts.
52-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
49+
تایبەتمەندی `زمان`: <code>&lt;script <u>language</u>=...&gt;</code>
50+
51+
: ئەم تایبەتمەندییە بۆ پیشاندانی زمانی سکریپت بوو. ئەم تایبەتمەندییە چیتر مانای نییە چونکە جاڤاسکڕێپت زمانی پێشوەختەیە. پێویست بە بەکارهێنانی ناکات.
52+
53+
54+
کۆمێنتەکانی پێش و دوای سکڕێپتەکە.
55+
56+
57+
: لە کتێب و دەستنووسی بەڕاستی کۆنەکاندا، ڕەنگە کۆمێنتەکان لەناو تاگەکانی `<script>`دا بدۆزیتەوە، بەم شێوەیە:
5358

5459
```html no-beautify
5560
<script type="text/javascript"><!--
5661
...
5762
//--></script>
5863
```
5964

60-
This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
65+
ئەم فێڵە لە جاڤاسکڕێپتی مۆدێرن بەکارناهێنرێت. ئەم کۆمێنتانە کۆدی جاڤاسکڕێپت لە وێبگەڕە کۆنەکان دەشارنەوە کە نەیاندەزانی چۆن تاگی `<script> `پرۆسێس بکەن. بەو پێیەی ئەو وێبگەڕانەی لە ١٥ ساڵی ڕابردوودا بڵاوکراونەتەوە ئەم کێشەیەیان نییە، ئەم جۆرە کۆمێنتە دەتوانێت یارمەتیت بدات بۆ ناسینەوەی کۆدی بەڕاستی کۆن.
6166

6267

63-
## External scripts
68+
## سکریپتە دەرەکییەکان
6469

65-
If we have a lot of JavaScript code, we can put it into a separate file.
70+
ئەگەر کۆدی جاڤاسکڕێپتێکی زۆرمان هەبێت دەتوانین بیخەینە فایلێکی جیا.
6671

67-
Script files are attached to HTML with the `src` attribute:
72+
فایلەکانی سکریپت بە تایبەتمەندی `src` دەخرێنە پاڵ HTML:
6873

6974
```html
7075
<script src="/path/to/script.js"></script>
7176
```
7277

73-
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"`, just like `src="./script.js"`, would mean a file `"script.js"` in the current folder.
78+
لێرەدا، `/path/to/script.js` ڕێڕەوێکی ڕەهایە بۆ سکریپتەکە لە ڕەگی ماڵپەڕەکەوە. هەروەها دەتوانرێت ڕێڕەوێکی ڕێژەیی لە لاپەڕەی ئێستاوە دابین بکرێت. بۆ نموونە، `src="script.js"`، هەروەک چۆن `src="./script.js"`، بە واتای پەڕگەی `script.js` لە فۆلدری ئێستادا.
7479

75-
We can give a full URL as well. For instance:
80+
هەروەها دەتوانین URL ێکی تەواو بدەین. بۆ نموونە:
7681

7782
```html
7883
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
7984
```
8085

81-
To attach several scripts, use multiple tags:
86+
بۆ هاوپێچکردنی چەندین سکریپت، چەندین تاگ بەکاربهێنە:
8287

8388
```html
8489
<script src="/js/script1.js"></script>
@@ -87,29 +92,31 @@ To attach several scripts, use multiple tags:
8792
```
8893

8994
```smart
90-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
95+
وەک یاسایەک تەنها سادەترین سکریپتەکان لە HTML دادەنرێت. ئەوانەی ئاڵۆزترن لە فایلە جیاوازەکاندان.
9196
92-
The benefit of a separate file is that the browser will download it and store it in its [cache](https://en.wikipedia.org/wiki/Web_cache).
97+
سوودی فایلێکی جیا ئەوەیە کە وێبگەڕەکە دایبەزێنێت و لە کەشی خۆیدا هەڵیدەگرێت.
9398
94-
Other pages that reference the same script will take it from the cache instead of downloading it, so the file is actually downloaded only once.
99+
لاپەڕەکانی تر کە ئاماژە بە هەمان سکریپت دەکەن لەبری دابەزاندنی لە کاشەوە دەیهێنن، بۆیە لە ڕاستیدا فایلەکە تەنها یەکجار دابەزێنرێت.
100+
101+
کە ترافیکی کەم دەکاتەوە و پەیجەکان خێراتر دەکات.
95102
96-
That reduces traffic and makes pages faster.
97103
```
98104

99-
````warn header="If `src` is set, the script content is ignored."
100-
A single `<script>` tag can't have both the `src` attribute and code inside.
105+
````نوکتە:warn header="ئەگەر `src` دانرابێت، ناوەڕۆکی سکریپت پشتگوێ دەخرێت."
106+
107+
تاگی `<script>` ناتوانێت هەم تایبەتمەندی "src" و هەم کۆدی ناوەوەی هەبێت.
101108

102-
This won't work:
109+
ئەمەش کار ناکات:
103110

104111
```html
105112
<script *!*src*/!*="file.js">
106-
alert(1); // the content is ignored, because src is set
113+
alert(1); // ناوەڕۆک پشتگوێ دەخرێت چونکە src دانراوە
107114
</script>
108115
```
109116

110-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
117+
دەبێت `<script src="...”>` دەرەکی یان `<script>` ی ئاسایی بە کۆدەوە هەڵبژێرین.
111118

112-
The example above can be split into two scripts to work:
119+
نموونەی سەرەوە دەتوانرێت دابەش بکرێت بۆ دوو سکریپت بۆ کارکردن لەگەڵی:
113120

114121
```html
115122
<script src="file.js"></script>
@@ -119,11 +126,14 @@ The example above can be split into two scripts to work:
119126
```
120127
````
121128
122-
## Summary
129+
## پوختە
130+
131+
- دەتوانین تاگی "<script>" بەکاربهێنین بۆ زیادکردنی کۆدی جاڤاسکڕێپت بۆ لاپەڕەکە.
132+
133+
- سیفاتەکانی `جۆر` و `زمان` پێویست نین.
134+
135+
- دەتوانرێت سکریپتێک لە پەڕگەیەکی دەرەکیدا لەگەڵ "<script src="path/to/script.js"></script>"دا جێگیر بکرێت.
123136
124-
- We can use a `<script>` tag to add JavaScript code to a page.
125-
- The `type` and `language` attributes are not required.
126-
- A script in an external file can be inserted with `<script src="path/to/script.js"></script>`.
127137
138+
زۆر شتی تر هەیە بۆ فێربوون دەربارەی سکریپتەکانی وێبگەڕ و کارلێککردنیان لەگەڵ وێب پەیجێک. بەڵام با ئەوەمان لەبەرچاو بێت کە ئەم بەشەی فێرکارییەکە تایبەتە بە زمانی جاڤاسکڕێپت، بۆیە نابێت گیرۆدەی جێبەجێکردنی تایبەت بە وێبگەڕ بین. ئێمە وێبگەڕەکە وەک ڕێگەیەک بۆ بەڕێوەبردنی جاڤاسکڕێپت بەکاردەهێنین کە فێربوونی ئاسانە، بەڵام تەنها یەکێکە لە چەندین ڕێگا.
128139
129-
There is much more to learn about browser scripts and their interaction with the webpage. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves with browser-specific implementations of it. We'll be using the browser as a way to run JavaScript, which is very convenient for online reading, but only one of many.

0 commit comments

Comments
 (0)