Skip to content

Commit 091cdc4

Browse files
authored
Translate 'Interaction: alert, prompt, confirm' page (#35)
Originally translated by @Verthon
1 parent 59f86ea commit 091cdc4

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

1-js/02-first-steps/09-alert-prompt-confirm/1-simple-page/solution.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
JavaScript-code:
1+
Kod JavaScript:
22

33
```js demo run
4-
let name = prompt("What is your name?", "");
4+
let name = prompt("Jak masz na imię?", "");
55
alert(name);
66
```
77

8-
The full page:
8+
Cała strona:
99

1010
```html
1111
<!DOCTYPE html>
@@ -15,7 +15,7 @@ The full page:
1515
<script>
1616
'use strict';
1717
18-
let name = prompt("What is your name?", "");
18+
let name = prompt("Jak masz na imię?", "");
1919
alert(name);
2020
</script>
2121

1-js/02-first-steps/09-alert-prompt-confirm/1-simple-page/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ importance: 4
22

33
---
44

5-
# A simple page
5+
# Prost strona
66

7-
Create a web-page that asks for a name and outputs it.
7+
Stwórz prostą stronę, która zapyta użytkownika o imię, a następnie wyświeli je.
88

99
[demo]
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
1-
# Interaction: alert, prompt, confirm
1+
# Interakcje: alert, prompt, confirm
22

3-
In this part of the tutorial we cover JavaScript language "as is", without environment-specific tweaks.
3+
W tej części poradnika przedstawimy język JavaScript w podstawowej formie, bez żadnych ulepszeń dla danego środowiska.
44

5-
But we'll still be using the browser as our demo environment, so we should know at least a few of its user-interface functions. In this chapter, we'll get familiar with the browser functions `alert`, `prompt` and `confirm`.
5+
Nadal będziemy używać przeglądarki jako domyślnego środowiska, więc powinniśmy znać przynajmniej kilka funkcji interfejsu przeglądarki. W tym rozdziale, zaznajomimy się z funkcjami dostępnymi w przeglądarce: `alert`, `prompt` and `confirm`.
66

77
## alert
88

9-
Syntax:
9+
Składnia:
1010

1111
```js
1212
alert(message);
1313
```
1414

15-
This shows a message and pauses script execution until the user presses "OK".
15+
Funkcja `alert` wyświetla zawartość zmiennej `message` i wstrzymuje wykonywanie skryptu do czasu, kiedy użytkownik kliknie "OK".
1616

17-
For example:
17+
Na przykład:
1818

1919
```js run
20-
alert("Hello");
20+
alert("Witaj");
2121
```
2222

23-
The mini-window with the message is called a *modal window*. The word "modal" means that the visitor can't interact with the rest of the page, press other buttons, etc. until they have dealt with the window. In this case -- until they press "OK".
23+
Pojawi się niewielkie okno z wiadomością, które nazywamy *oknem modalnym*. Słowo "modalny" oznacza, że użytkownik nie może wejść w interakcję z pozostałą treścią strony czy też z innymi przyciskami i tak dalej, dopóki nie zakończy interakcji z oknem. W tym przypadku -- do czasu kliknięcia *OK*.
2424

2525
## prompt
2626

27-
The function `prompt` accepts two arguments:
27+
Funkcja `prompt` przyjmuje dwa argumenty:
2828

2929
```js no-beautify
3030
result = prompt(title, [default]);
3131
```
3232

33-
It shows a modal window with a text message, an input field for the visitor, and the buttons OK/Cancel.
33+
Funkcja `prompt` wyświetla okno z wiadomością, pole tekstowe do uzupełnienia przez użytkownika oraz przyciski *OK/Anuluj*.
3434

3535
`title`
36-
: The text to show the visitor.
36+
: Tekst, który zostanie wyświetlony użytkownikowi.
3737

3838
`default`
39-
: An optional second parameter, the initial value for the input field.
39+
: Opcjonalny drugi parametr, wartość początkowa dla pola tekstowego.
4040

41-
The visitor may type something in the prompt input field and press OK. Or they can cancel the input by pressing Cancel or hitting the `key:Esc` key.
41+
Użytkownik może wpisać tekst do pola tekstowego i zatwierdzić przyciskiem *OK*. Może także anulować operację, klikając przycisk *Anuluj* lub wciskając klawisz `key:Esc`.
4242

43-
The call to `prompt` returns the text from the input field or `null` if the input was canceled.
43+
Wywołanie funkcji `prompt` zwraca tekst wpisany do pola tekstowego lub wartość `null`, w przypadku gdy użytkownik anulował akcję.
4444

45-
For instance:
45+
Na przykład:
4646

4747
```js run
48-
let age = prompt('How old are you?', 100);
48+
let age = prompt('Ile masz lat?', 100);
4949

50-
alert(`You are ${age} years old!`); // You are 100 years old!
50+
alert(`Masz ${age} lat!`); // Masz 100 lat!
5151
```
5252

53-
````warn header="In IE: always supply a `default`"
54-
The second parameter is optional, but if we don't supply it, Internet Explorer will insert the text `"undefined"` into the prompt.
53+
````warn header="W IE: zawsze dodawaj parametr `default`"
54+
Drugi parametr jest, co prawda, opcjonalny, lecz w przypadku braku dostarczenia go w przeglądarce Internet Explorer, do pola tekstowego zostanie wstawiony napis `"undefined"`.
5555

56-
Run this code in Internet Explorer to see:
56+
Aby się o tym przekonać, uruchom poniższy kod w Internet Explorerze:
5757

5858
```js run
5959
let test = prompt("Test");
6060
```
6161

62-
So, for prompts to look good in IE, we recommend always providing the second argument:
62+
Dlatego do poprawnego działania funkcji `prompt` w IE radzimy zawsze dodawać drugi argument:
6363

6464
```js run
65-
let test = prompt("Test", ''); // <-- for IE
65+
let test = prompt("Test", ''); // <-- dla IE
6666
```
6767
````
6868
6969
## confirm
7070
71-
The syntax:
71+
Składnia:
7272
7373
```js
7474
result = confirm(question);
7575
```
7676
77-
The function `confirm` shows a modal window with a `question` and two buttons: OK and Cancel.
77+
Funkcja `confirm` wyświetla okno modalne z pytaniem zawartym w `question` i dwoma przyciskami: *OK* i *Anuluj*.
7878
79-
The result is `true` if OK is pressed and `false` otherwise.
79+
Po naciśnięciu *OK* otrzymujemy wartość `true`, w przeciwnym wypadku `false`.
8080
81-
For example:
81+
Na przykład:
8282
8383
```js run
84-
let isBoss = confirm("Are you the boss?");
84+
let isBoss = confirm("Czy jesteś szefem?");
8585
86-
alert( isBoss ); // true if OK is pressed
86+
alert( isBoss ); // true, jeżeli kliknięto na "OK"
8787
```
8888
89-
## Summary
89+
## Podsumowanie
9090
91-
We covered 3 browser-specific functions to interact with visitors:
91+
Omówiliśmy 3 funkcje dostępne w przeglądarkach, służące do interakcji z użytkownikami:
9292
9393
`alert`
94-
: shows a message.
94+
: wyświetla wiadomość.
9595
9696
`prompt`
97-
: shows a message asking the user to input text. It returns the text or, if Cancel button or `key:Esc` is clicked, `null`.
97+
: wyświetla wiadomość z polem tekstowym. Zwraca wprowadzony przez użytkownika tekst lub wartość `null` w przypadku anulowania poprzez kliknięcie przycisku *Anuluj* albo użycie klawisza `key:Esc`.
9898
9999
`confirm`
100-
: shows a message and waits for the user to press "OK" or "Cancel". It returns `true` for OK and `false` for Cancel/`key:Esc`.
100+
: wyświetla wiadomość i oczekuje na użytkownika, który może użyć przycisku *OK* lub *Anuluj*. Zwraca `true` dla *OK* albo `false` *Anuluj*/`key:Esc`.
101101
102-
All these methods are modal: they pause script execution and don't allow the visitor to interact with the rest of the page until the window has been dismissed.
102+
Wszystkie metody wyświetlają okna: wstrzymują wykonywanie skryptu i nie pozwalają użytkownikowi na dalszą interakcję ze stroną do czasu zamknięcia okna.
103103
104-
There are two limitations shared by all the methods above:
104+
Istnieją dwa ograniczenia związane z powyższymi metodami:
105105
106-
1. The exact location of the modal window is determined by the browser. Usually, it's in the center.
107-
2. The exact look of the window also depends on the browser. We can't modify it.
106+
1. Dokładna lokalizacja okna jest ustalana przez przeglądarkę. Zazwyczaj pojawia się pośrodku okna przeglądarki.
107+
2. Wygląd okna także zależy od przeglądarki. Nie możemy go zmodyfikować.
108108
109-
That is the price for simplicity. There are other ways to show nicer windows and richer interaction with the visitor, but if "bells and whistles" do not matter much, these methods work just fine.
109+
Taka jest cena dla tego typu ułatwień. Istnieją inne możliwości na wyświetlanie lepszych okien i rozszerzenie interakcji z użytkownikiem, lecz jeżeli nie zależy nam na "wodotryskach", te metody w zupełności wystarczą.

0 commit comments

Comments
 (0)