diff --git a/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md b/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md index afed6a91d..63866a3fe 100644 --- a/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md +++ b/1-js/02-first-steps/01-hello-world/1-hello-alert/task.md @@ -1,12 +1,12 @@ -importance: 5 +важност: 5 --- -# Show an alert +# Покажи извсестие -Create a page that shows a message "I'm JavaScript!". +Създайте страница, която показва съобщение "I'm JavaScript!". -Do it in a sandbox, or on your hard drive, doesn't matter, just ensure that it works. +Направете го в sandbox или на вашият твърд диск, няма значение, просто се уверете че работи. [demo src="solution"] diff --git a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md index f42c41e6d..8bec54fcb 100644 --- a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md +++ b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/solution.md @@ -1,8 +1,8 @@ -The HTML code: +HTML кодът: [html src="index.html"] -For the file `alert.js` in the same folder: +За файла `alert.js`, намиращ се в същата директория: [js src="alert.js"] diff --git a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md index 26168d6a7..4790ffd34 100644 --- a/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md +++ b/1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md @@ -1,9 +1,9 @@ -importance: 5 +важност: 5 --- -# Show an alert with an external script +# Покажи нотификация чрез външен скрипт -Take the solution of the previous task . Modify it by extracting the script content into an external file `alert.js`, residing in the same folder. +Вземете решението от предходната задача . Модифицирайте го, като извлечете скрипта от съдържанието и го поставите в отделен, външен файл `alert.js`, намиращ се в същата директория. -Open the page, ensure that the alert works. +Отворете страницата и се уверете че работи. diff --git a/1-js/02-first-steps/01-hello-world/article.md b/1-js/02-first-steps/01-hello-world/article.md index f5487b915..ab68a3ebf 100644 --- a/1-js/02-first-steps/01-hello-world/article.md +++ b/1-js/02-first-steps/01-hello-world/article.md @@ -1,17 +1,17 @@ # Hello, world! -This part of the tutorial is about core JavaScript, the language itself. +В тази част от урока ще разглеждаме езика JavaScript в неговия чист вид. -But we need a working environment to run our scripts and, since 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). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial. +За целта ще ни е необходима среда, в която да изпълняваме нашите скриптове, тъй като това е онлайн книга, браузъра е добър избор като среда. Ще се стремим да използваме минимално количество браузър-специфични команди (като `alert`), за да не губите време, ако сте планувате да се занимавате с разработка в друга среда (като Node.js). Ще се фокусираме върху разработката на JavaScript за браузър в [друга част](/ui) от уроците. -So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`. +Първо нека видим как можем да закачим скрипт към уеб страница. За разработка в сървърна среда (като Node.js), може да изпълни скрипта с командата `"node my.js"`. -## The "script" tag +## "script" таг -JavaScript programs can be inserted into any part of an HTML document with the help of the ` */!* -

...After the script.

+

... След script.

@@ -35,24 +35,25 @@ For instance: ``` ```online -You can run the example by clicking the "Play" button in the right-top corner of the box above. +Можете да изпълните този примерен код като натиснете бутона "Play" (пусни) в горният десен ъгъл, на горната кутия. ``` -The ` ``` - This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the ` ``` -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"` would mean a file `"script.js"` in the current folder. +Тук `/path/to/script.js` е абсолютният път до скрипта започващ от нивото от което се зарежда и сайта в файловата система. Също така може да се използва и релативен път, от текущата страница, пример за това е `src="script.js"`, което означава че ще бъде достъпен файла `"script.js"` от текущата директория. -We can give a full URL as well. For instance: +Може да предоставим и пълен URL адрес. Пример за това е: ```html ``` -To attach several scripts, use multiple tags: +За да закачим няколко скрипта, трабва да използваме и няколко тага: ```html @@ -90,29 +92,30 @@ To attach several scripts, use multiple tags: ``` ```smart -As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files. +Като правило е прието, че само най-простите скриптове, се поставят в HTML файловете, като по сложните се поставят в отделни файлове. -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). +Ползата от отделянето на файлове е, че браузъра ще свали този файл и ще го съхрани в своя [кеш](https://bg.wikipedia.org/wiki/%D0%9A%D0%B5%D1%88-%D0%BF%D0%B0%D0%BC%D0%B5%D1%82) -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. +Други страници, които реферират същият скрипт, ще могат да го заредят от кеша вместо да правят нова заявка, което означава че файла ще бъде изтеглен само веднъж. -That reduces traffic and makes pages faster. +Това намалява трафикът и прави страниците по-бързи. ``` -````warn header="If `src` is set, the script content is ignored." -A single ` ``` -We must choose either an external ` @@ -122,11 +125,12 @@ The example above can be split into two scripts to work: ``` ```` -## Summary +## Обобщение + +- Може да използваме ``. -- We can use a ``. +Има още много, което може да се научи за скриптовете изпълнявани в браузъра и техите интеракции с уеб страниците, но нека незабравяме че тази част от урока е посветена на езика JavaScript, за това не трябва да се разсейваме, с браузър-специфични имплементации. Ние ще използваме браузъра, като средство да изпълняваме JavaScript код, което е много удобно, за това онлайн четиво. -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.