@@ -7,28 +7,27 @@ importance: 5
77یک function ` showPrompt(html, callback) ` ایجاد کنید که فرمی با پیام ` html ` ، یک input field و دکمههای ` OK/CANCEL ` داشته باشد.
88
99- یک کاربر باید چیزی را در tex field تایپ کند و ` key:Enter ` را فشار دهد، آنگاه ` callback(value) ` با مقداری که وارد شده است فراخوانی میشود.
10- - Otherwise if the user presses ` key:Esc ` or CANCEL, then ` callback(null) ` is called.
1110- در غیر این صورت اگر کاربر ` key:Esc ` یا CANCEL را فشار دهد، ` callback(null) ` فراخوانی میشود.
1211
13- In both cases that ends the input process and removes the form .
12+ در هر دو صورت،این فرآیند input را تمام میکند و فرم را پاک میکند .
1413
15- Requirements :
14+ ملزومات :
1615
17- - The form should be in the center of the window .
18- - The form is * modal* . In other words, no interaction with the rest of the page is possible until the user closes it .
19- - When the form is shown, the focus should be inside the ` <input> ` for the user .
20- - Keys ` key:Tab ` /` key:Shift+Tab ` should shift the focus between form fields, don't allow it to leave for other page elements .
16+ - فرم باید در وسط پنجره باشد .
17+ - فرم یک * modal* است. به عبارت دیگر، تا زمانی که کاربر آن را نبندد، هیچ تعاملی با بقیهی صفحه مجاز نیست .
18+ - وقتی فرم نمایش داده میشود، focus برای کاربر باید درون ` <input> ` باشد .
19+ - کلیدهای ` key:Tab ` /` key:Shift+Tab ` باید فوکوس را بین form fieldها جابهجا کنند و اجازه ندهند که به عناصر دیگر صفحه برود .
2120
22- Usage example :
21+ مثال از استفاده :
2322
2423``` js
2524showPrompt (" Enter something<br>...smart :)" , function (value ) {
2625 alert (value);
2726});
2827```
2928
30- A demo in the iframe:
29+ نسخهی نمایشی در iframe:
3130
3231[ iframe src="solution" height=160 border=1]
3332
34- P.S. The source document has HTML/CSS for the form with fixed positioning, but it's up to you to make it modal.
33+ پینوشت: کد source documentای که ارائه شده HTML/CSS برای فرم با fixed positioning را دارد، اما این بر عهدهی شماست که آن را به modal تبدیل کنید .
0 commit comments