fix: converted single to triple backticks11 (#36238)
This commit is contained in:
@@ -13,11 +13,13 @@ localeTitle: أضف خصائص جديدة إلى كائن JavaScript
|
||||
|
||||
إليك كيفية استخدام تدرج قوس:
|
||||
|
||||
`myObject['bark'] = "woof-woof";
|
||||
`
|
||||
```javascript
|
||||
myObject['bark'] = "woof-woof";
|
||||
```
|
||||
|
||||
باستخدام تدرج القوس ، يمكننا استخدام المتغيرات كأسماء للممتلكات:
|
||||
|
||||
`var dynamicProperty = "bark";
|
||||
myObject[dynamicProperty] = "woof-woof";
|
||||
`
|
||||
```javascript
|
||||
var dynamicProperty = "bark";
|
||||
myObject[dynamicProperty] = "woof-woof";
|
||||
```
|
@@ -12,9 +12,10 @@ localeTitle: تعليق كود جافاسكريبت الخاص بك
|
||||
|
||||
* سيعلق تعليق slash-star-star-slash كل شيء بين `/*` و `*/` characters:
|
||||
|
||||
`/*
|
||||
This is
|
||||
a multi-line comment
|
||||
(comment block)
|
||||
*/
|
||||
`
|
||||
```javascript
|
||||
/*
|
||||
This is
|
||||
a multi-line comment
|
||||
(comment block)
|
||||
*/
|
||||
```
|
@@ -8,13 +8,15 @@ localeTitle: تصحيح ملفات عقدة باستخدام أوامر CLI
|
||||
|
||||
لنفترض أن لديك ملفًا باسم `contents.js` . يمكنك تشغيل الملف باستخدام أمر `node` .
|
||||
|
||||
`node contents.js
|
||||
`
|
||||
```bash
|
||||
node contents.js
|
||||
```
|
||||
|
||||
يجب أن يكون هذا معروفًا لك منذ كتابة رمز Node.js. والآن يجب تصحيح أي أخطاء تنبثق. لتشغيل الملف في وضع التصحيح إلحاق الكلمة `inspect` أثناء تشغيل الملف.
|
||||
|
||||
`node inspect contents.js
|
||||
`
|
||||
```bash
|
||||
node inspect contents.js
|
||||
```
|
||||
|
||||
الآن سيفتح هذا الأمر ملفك في وضع التصحيح. من الآن فصاعدًا ، يمكنك التنقل خلال سطر واحد من الكود في كل مرة بالضغط على المفتاح **N** في لوحة المفاتيح.
|
||||
|
||||
|
@@ -15,16 +15,19 @@ localeTitle: قم بتعريف كائنات JavaScript كمتغيرات
|
||||
|
||||
باستخدام ميزة التدوين النقطي:
|
||||
|
||||
`console.log(car.wheels); // 4
|
||||
`
|
||||
```javascript
|
||||
console.log(car.wheels); // 4
|
||||
```
|
||||
|
||||
باستخدام تدرج قوس:
|
||||
|
||||
`console.log(car["wheels"]); // 1
|
||||
`
|
||||
```javascript
|
||||
console.log(car["wheels"]); // 1
|
||||
```
|
||||
|
||||
استخدام تدرج قوس ديناميكي:
|
||||
|
||||
`var seatsProperty = "seats";
|
||||
console.log(car[seatsProperty]); // 5
|
||||
`
|
||||
```javascript
|
||||
var seatsProperty = "seats";
|
||||
console.log(car[seatsProperty]); // 5
|
||||
```
|
@@ -27,11 +27,12 @@ localeTitle: حذف الخصائص من كائن JavaScript
|
||||
|
||||
## مثال
|
||||
|
||||
`var person = {name:'Jay', age:'52'};
|
||||
delete person['age'];
|
||||
|
||||
console.log(person); //{name:'Jay'}
|
||||
`
|
||||
```js
|
||||
var person = {name:'Jay', age:'52'};
|
||||
delete person['age'];
|
||||
|
||||
console.log(person); //{name:'Jay'}
|
||||
```
|
||||
|
||||
## قيمة الإرجاع
|
||||
|
||||
|
@@ -10,16 +10,17 @@ localeTitle: اكتشاف أحداث النقرات الأصلية
|
||||
|
||||
#### هنا مثال على استخدام هذه الطريقة
|
||||
|
||||
`// Assume there is a button in the HTML
|
||||
const button = document.querySelector('button');
|
||||
|
||||
button.addEventListener('click', (e) => {
|
||||
if (e.isTrusted) {
|
||||
console.log('Button clicked by a real user');
|
||||
} else {
|
||||
console.log('Button click simulated by a script');
|
||||
}
|
||||
});
|
||||
|
||||
button.click() // Outputs "Button click simulated by a script"
|
||||
`
|
||||
```javascript
|
||||
// Assume there is a button in the HTML
|
||||
const button = document.querySelector('button');
|
||||
|
||||
button.addEventListener('click', (e) => {
|
||||
if (e.isTrusted) {
|
||||
console.log('Button clicked by a real user');
|
||||
} else {
|
||||
console.log('Button click simulated by a script');
|
||||
}
|
||||
});
|
||||
|
||||
button.click() // Outputs "Button click simulated by a script"
|
||||
```
|
@@ -12,10 +12,11 @@ localeTitle: كيف تصنع عرض الشرائح
|
||||
|
||||
\`\` \`أتش تي أم أل عرض الشرائح
|
||||
|
||||
`### Write styles to hide slides and show only one slide.
|
||||
|
||||
For hide the slides you have to give them a default style and only show one slide if this is active or you want to show it.
|
||||
`
|
||||
```
|
||||
### Write styles to hide slides and show only one slide.
|
||||
|
||||
For hide the slides you have to give them a default style and only show one slide if this is active or you want to show it.
|
||||
```
|
||||
|
||||
المغلق \[data-component = "slideshow"\] .slide { عرض لا شيء؛ }
|
||||
|
||||
|
@@ -22,9 +22,10 @@ localeTitle: كيفية إنشاء النوافذ المنبثقة
|
||||
|
||||
X
|
||||
|
||||
`### Step 2 CSS
|
||||
We will choose our own style for the popup window. Notice: the popup div should be hidden at first, so in the style I will select display: none;
|
||||
`
|
||||
```
|
||||
### Step 2 CSS
|
||||
We will choose our own style for the popup window. Notice: the popup div should be hidden at first, so in the style I will select display: none;
|
||||
```
|
||||
|
||||
المغلق .popup _main_ div { الموقع: ثابت العرض: 800 بكسل ؛ الارتفاع: 400 بكسل ؛ border: 2px solid black؛ border-radius: 5px؛ لون الخلفية: #fff؛ اليسار: 50 ٪. الهامش الأيسر: -400 بكسل ؛ أعلى: 50 ٪ ؛ الهامش العلوي: - 250 بكسل ؛ عرض لا شيء؛
|
||||
|
||||
@@ -34,8 +35,9 @@ X
|
||||
|
||||
}
|
||||
|
||||
`### Step 3 JavaScript
|
||||
`
|
||||
```
|
||||
### Step 3 JavaScript
|
||||
```
|
||||
|
||||
شبيبة // بادئ ذي بدء ، سوف أقوم بتهيئة متغيراتي // اختر العناصر التي سنستخدمها من DOM // أقوم بإضافة حدث en في الزر الذي سيؤدي إلى تشغيل وظيفة من شأنها تغيير نمط العرض المنبثق من لا شيء إلى حظر
|
||||
|
||||
|
@@ -10,10 +10,11 @@ localeTitle: صفحة يعيد التوجيه باستخدام جافا سكري
|
||||
|
||||
هناك عدة طرق مختلفة للقيام بذلك ، ولكن أبسط طريقة هي استخدام الكائن `window.location` لإرسال المستخدم إلى الصفحة التي ترغب في إعادة توجيههم إليها. يمكن أن يستخدم كائن `window.location` أي قيمة URL صالحة مثل `http://www.yoururl.com` ، `somepage.html` ، إلخ.
|
||||
|
||||
`window.location = 'http://www.yoururl.com';
|
||||
// window.location = 'somepage.html';
|
||||
// etc.
|
||||
`
|
||||
```javascript
|
||||
window.location = 'http://www.yoururl.com';
|
||||
// window.location = 'somepage.html';
|
||||
// etc.
|
||||
```
|
||||
|
||||
### حالة خاصة إعادة توجيه
|
||||
|
||||
@@ -21,23 +22,25 @@ localeTitle: صفحة يعيد التوجيه باستخدام جافا سكري
|
||||
|
||||
فيما يلي مثال على استخدام هذه الطريقة (ستظل تعمل بنفس طريقة استخدام `window.location` في المتصفحات الأخرى):
|
||||
|
||||
`window.location.replace('http://www.yoururl.com');
|
||||
// window.location.replace('somepage.html');
|
||||
// etc.
|
||||
`
|
||||
```javascript
|
||||
window.location.replace('http://www.yoururl.com');
|
||||
// window.location.replace('somepage.html');
|
||||
// etc.
|
||||
```
|
||||
|
||||
### A إعادة توجيه توقيت بسيط باستخدام JS
|
||||
|
||||
هنا مثال على إعادة توجيه بسيطة موقوتة باستخدام وظيفة `setTimeout()` . تُعد عمليات إعادة التوجيه المحددة التوقيت مفيدة حتى يمكنك شرحها للمستخدم ، عبر المحتوى الموجود على صفحة إعادة التوجيه ، والسبب في إعادة توجيهها إلى صفحة أخرى.
|
||||
|
||||
`// the 5000 below is 5000 milliseconds which equals 5 seconds until the redirect happens
|
||||
// keep in mind that 1 second = 1000 milliseconds
|
||||
setTimeout(function () {
|
||||
window.location = 'http://www.yoururl.com';
|
||||
// window.location = 'somepage.html';
|
||||
// etc.
|
||||
}, 5000);
|
||||
`
|
||||
```javascript
|
||||
// the 5000 below is 5000 milliseconds which equals 5 seconds until the redirect happens
|
||||
// keep in mind that 1 second = 1000 milliseconds
|
||||
setTimeout(function () {
|
||||
window.location = 'http://www.yoururl.com';
|
||||
// window.location = 'somepage.html';
|
||||
// etc.
|
||||
}, 5000);
|
||||
```
|
||||
|
||||
### تراجع
|
||||
|
||||
@@ -45,11 +48,11 @@ localeTitle: صفحة يعيد التوجيه باستخدام جافا سكري
|
||||
|
||||
ضع عنصر `<meta>` داخل `<head>` للمستند الخاص بك مثل:
|
||||
|
||||
`
|
||||
<head>
|
||||
<!-- Change the 6 below to however many seconds you wish to wait until redirection to the new page. Change the portion after "URL=" to the URL of your choice. This can be a local page: URL=somepage.html, a web address: URL=http://www.yoururl.com, or any other valid URL. It is important to note the semicolon between the number of seconds to refresh and the URL. -->
|
||||
<meta http-equiv="refresh" content="6;URL=http://www.yoururl.com">
|
||||
</head>
|
||||
`
|
||||
```html
|
||||
<head>
|
||||
<!-- Change the 6 below to however many seconds you wish to wait until redirection to the new page. Change the portion after "URL=" to the URL of your choice. This can be a local page: URL=somepage.html, a web address: URL=http://www.yoururl.com, or any other valid URL. It is important to note the semicolon between the number of seconds to refresh and the URL. -->
|
||||
<meta http-equiv="refresh" content="6;URL=http://www.yoururl.com">
|
||||
</head>
|
||||
```
|
||||
|
||||
ضع في اعتبارك أنه ليس كل المتصفحات تدعم العنصر `<meta>` (أنا أبحث عنك ، والإصدارات الأقدم من IE ، و Safari) ، ولكن معظم المتصفحات الحديثة تفعل (Microsoft Edge ، Google Chrome ، Mozilla Firefox ، Opera).
|
@@ -20,13 +20,13 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean
|
||||
|
||||
#### مثال 1 نموذج مع void Javascript (0):
|
||||
|
||||
`
|
||||
<html>
|
||||
<body>
|
||||
<a href="javascript:void(0);alert('Hello ! I am here')">Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
<a href="javascript:void(0);alert('Hello ! I am here')">Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### انتاج :
|
||||
|
||||
@@ -36,13 +36,13 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean
|
||||
|
||||
#### مثال 2 نموذج مع void Javascript (0):
|
||||
|
||||
`
|
||||
<html>
|
||||
<body>
|
||||
<a href="javascript:void(0)" ondblclick="alert('Hi,i didnt refresh the page')" )>Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
<a href="javascript:void(0)" ondblclick="alert('Hi,i didnt refresh the page')" )>Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### انتاج :
|
||||
|
||||
@@ -50,14 +50,14 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean
|
||||
|
||||
#### مثال 3 نموذج مع void Javascript (0):
|
||||
|
||||
`
|
||||
<html>
|
||||
<body>
|
||||
<a href="javascript:void(0);https://www.google.co.in/"
|
||||
ondblclick="alert('Hello !! You will see me and not get redirected to google.com ')">Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
<a href="javascript:void(0);https://www.google.co.in/"
|
||||
ondblclick="alert('Hello !! You will see me and not get redirected to google.com ')">Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### انتاج :
|
||||
|
||||
@@ -65,13 +65,13 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean
|
||||
|
||||
#### مثال نموذج دون void Javascript (0):
|
||||
|
||||
`
|
||||
<html>
|
||||
<body>
|
||||
<a href="https://www.google.co.in/" ondblclick="alert('Hello !! You will see me and then get redirected to google.com even if not needed')">Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
```html
|
||||
<html>
|
||||
<body>
|
||||
<a href="https://www.google.co.in/" ondblclick="alert('Hello !! You will see me and then get redirected to google.com even if not needed')">Click Me</a>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### انتاج :
|
||||
|
||||
|
Reference in New Issue
Block a user