Skip to content

Commit ccb77f6

Browse files
authored
Merge pull request #139 from msisaifu/browser-default-actions
Browser default actions
2 parents 225e982 + 18cac00 commit ccb77f6

File tree

8 files changed

+199
-197
lines changed

8 files changed

+199
-197
lines changed

Diff for: 2-ui/2-events/01-introduction-browser-events/01-hide-other/solution.view/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<div id="text">Text</div>
1313

1414
<script>
15-
// অনেকভাবেই আমরা এটিকে অদৃশ্য করতে পারি,
16-
// style.display ও কাজ করবে:
15+
// Here it doesn't matter how we hide the text,
16+
// could also use style.display:
1717
document.getElementById('hider').onclick = function() {
1818
document.getElementById('text').hidden = true;
1919
}

Diff for: 2-ui/2-events/01-introduction-browser-events/01-hide-other/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ importance: 5
22

33
---
44

5-
# ক্লিকের মাধ্যমে অদৃশ্য
5+
# Hide on click
66

7-
একটি বাটনে `button` ক্লিক হলে এটি `<div id="text">` কে অদৃশ্য করবে।
7+
Add JavaScript to the `button` to make `<div id="text">` disappear when we click it.
88

9-
ডেমো দেখুন:
9+
The demo:
1010

1111
[iframe border=1 src="solution" height=80]

Diff for: 2-ui/2-events/01-introduction-browser-events/02-hide-self-onclick/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
হ্যান্ডেলারে `this` ব্যবহারের মাধ্যমে করতে পারি "কেননা `this` দ্বারা ঐ এলিমেন্টকে নির্দেশ করে":
1+
Can use `this` in the handler to reference "the element itself" here:
22

33
```html run height=50
44
<input type="button" onclick="this.hidden=true" value="Click to hide">

Diff for: 2-ui/2-events/01-introduction-browser-events/02-hide-self-onclick/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# Hide self
66

7-
একটি বাটন লিখুন যেটি ক্লিক করলে বাটনটিই অদৃশ্য হয়ে যাবে।
7+
Create a button that hides itself on click.
88

99
```online
1010
Like this:
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
উত্তর হল: `1` এবং `2`
1+
The answer: `1` and `2`.
22

3-
প্রথম হ্যান্ডেলারটি রান হবে, কেননা এখানে `removeEventListener` এর মাধ্যমে হ্যান্ডেলারটি রিমুভ হবে না। কোন হ্যান্ডেলার রিমুভ করতে আমাদের সেম ভ্যারিয়েবল ফাংশন অথবা ফাংশন পাঠাতে হবে। কিন্তু এখানে একই লজিকের দুটি ফাংশন পাঠানো হচ্ছে, একই রেফারেন্সের না।
3+
The first handler triggers, because it's not removed by `removeEventListener`. To remove the handler we need to pass exactly the function that was assigned. And in the code a new function is passed, that looks the same, but is still another function.
44

5-
কোন হ্যান্ডেলার রিমুভ করতে আমাদের এভাবে লিখা লাগবে:
5+
To remove a function object, we need to store a reference to it, like this:
66

77
```js
88
function handler() {
@@ -13,4 +13,4 @@ button.addEventListener("click", handler);
1313
button.removeEventListener("click", handler);
1414
```
1515

16-
আবার `addEventListener` এর পাশাপাশি `button.onclick` ও কাজ করবে।
16+
The handler `button.onclick` works independently and in addition to `addEventListener`.

Diff for: 2-ui/2-events/01-introduction-browser-events/03-which-handlers-run/task.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ importance: 5
22

33
---
44

5-
# কোন হ্যান্ডেলারটি এক্সিকিউট হবে?
5+
# Which handlers run?
66

7-
বাটন ক্লিকে এখানে কোন হ্যান্ডেলারটি রান হবে, এবং কোন অ্যালার্টটি শো হবে?
7+
There's a button in the variable. There are no handlers on it.
8+
9+
Which handlers run on click after the following code? Which alerts show up?
810

911
```js no-beautify
1012
button.addEventListener("click", () => alert("1"));

Diff for: 2-ui/2-events/01-introduction-browser-events/article.md

+112-110
Large diffs are not rendered by default.

Diff for: 2-ui/2-events/04-default-browser-action/article.md

+72-74
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)