From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../webextensions/api/cookies/cookie/index.html | 107 ++++++++++++ .../add-ons/webextensions/api/cookies/index.html | 156 +++++++++++++++++ .../add-ons/webextensions/api/downloads/index.html | 123 ++++++++++++++ .../mozilla/add-ons/webextensions/api/index.html | 53 ++++++ .../api/runtime/getmanifest/index.html | 88 ++++++++++ .../add-ons/webextensions/api/runtime/index.html | 168 ++++++++++++++++++ .../add-ons/webextensions/api/tabs/get/index.html | 74 ++++++++ .../add-ons/webextensions/api/tabs/hide/index.html | 79 +++++++++ .../add-ons/webextensions/api/tabs/index.html | 179 ++++++++++++++++++++ .../webextensions/api/webrequest/index.html | 188 +++++++++++++++++++++ .../api/windows/createtype/index.html | 65 +++++++ .../add-ons/webextensions/api/windows/index.html | 106 ++++++++++++ 12 files changed, 1386 insertions(+) create mode 100644 files/ru/mozilla/add-ons/webextensions/api/cookies/cookie/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/cookies/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/downloads/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/runtime/getmanifest/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/runtime/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/tabs/get/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/tabs/hide/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/tabs/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/webrequest/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/windows/createtype/index.html create mode 100644 files/ru/mozilla/add-ons/webextensions/api/windows/index.html (limited to 'files/ru/mozilla/add-ons/webextensions/api') diff --git a/files/ru/mozilla/add-ons/webextensions/api/cookies/cookie/index.html b/files/ru/mozilla/add-ons/webextensions/api/cookies/cookie/index.html new file mode 100644 index 0000000000..9191b3017a --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/cookies/cookie/index.html @@ -0,0 +1,107 @@ +--- +title: cookies.Cookie +slug: Mozilla/Add-ons/WebExtensions/API/cookies/Cookie +tags: + - API + - Cookies + - cookie + - Дополнения + - Расширения + - Справка + - данные +translation_of: Mozilla/Add-ons/WebExtensions/API/cookies/Cookie +--- +
{{AddonSidebar()}}
+ +

Тип Cookie из {{WebExtAPIRef("cookies")}} API представляет собой информацию о HTTP cookie.

+ +

Тип

+ +

Значения этого типа - объекты, которые могут содержать следующие свойства:

+ +
+
name
+
string - содержит имя cookie.
+
value
+
string - содержит значение cookie.
+
domain
+
string - содержит домен, которому принадлежит cookie (например, "www.google.com", "example.com").
+
hostOnly
+
boolean - true если cookie является host-only (то есть запрашивающий хост должен в точности совпадать с доменом cookie), в ином случае false.
+
path
+
string - содержит path cookie.
+
secure
+
boolean - true, если cookie помечен как secure (то есть его область действия ограничена безопасными каналами, обычно HTTPS), в ином случае false.
+
httpOnly
+
boolean - true если cookie помечен как HttpOnly (то есть он недоступен для клиентских скриптов), иначе false.
+
session
+
boolean - true если cookie является сессионным, false если cookie является постоянным с указанным временем жизни.
+
expirationDate{{optional_inline}}
+
number - содержит срок годности cookie, который представляется количеством секунд с начала UNIX-эры. Отсутствует для сессионных cookie.
+
storeId
+
string - представляет собой ID хранилища, в котором хранится данный cookie, как указано в соответствии с {{WebExtAPIRef("cookies.getAllCookieStores()")}}.
+
+ +

Совместимость с браузерами

+ + + +

{{Compat("webextensions.api.cookies.Cookie")}}

+ +

Примеры

+ +

В большинстве методов из cookies API объекты типа Cookie используются как входные параметры методов, либо же как возвращаемые значения. К примеру, вызов {{WebExtAPIRef("cookies.getAll()")}} возвращает массив объектов типа Cookie.

+ +

В примере ниже мы запрашиваем все cookie, а затем выводим в лог некоторые из полей полученных Cookie объектов:

+ +
function logCookies(cookies) {
+  for (cookie of cookies) {
+    console.log(`Domain: ${cookie.domain}`);
+    console.log(`Name: ${cookie.name}`);
+    console.log(`Value: ${cookie.value}`);
+    console.log(`Persistent: ${!cookie.session}`);
+  }
+}
+
+var gettingAll = browser.cookies.getAll({});
+gettingAll.then(logCookies);
+ +

{{WebExtExamples}}

+ +
Примечание + +

Это API основано на API Chromiumа chrome.cookies. Эта документация основана на cookies.json из кода Chromium.

+ +

Информация о совместимости Microsoft Edge предоставлена корпорацией Microsoft и включена здесь под лицензией Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/cookies/index.html b/files/ru/mozilla/add-ons/webextensions/api/cookies/index.html new file mode 100644 index 0000000000..a31f300edf --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/cookies/index.html @@ -0,0 +1,156 @@ +--- +title: cookies +slug: Mozilla/Add-ons/WebExtensions/API/cookies +tags: + - API + - Add-ons + - Cookies + - Extensions + - Interface + - NeedsTranslation + - Non-standard + - Reference + - TopicStub + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/API/cookies +--- +
{{AddonSidebar}}
+ +

Позволяет  WebExtensions получить и установить куки ,а также сообщить об их изменении.

+ +

Для использования этого API,вам нужно предоставить доступ  API permission в вашем файле manifest.json,а также  host permissions для тех сайтов чьи куки вам нужны для доступа.Смотрите cookie Permissions.

+ +

Types

+ +
+
{{WebExtAPIRef("cookies.Cookie")}}
+
Предоставляет информацию о HTTP cookie
+
{{WebExtAPIRef("cookies.CookieStore")}}
+
Represents a cookie store in the browser.
+
{{WebExtAPIRef("cookies.OnChangedCause")}}
+
Represents the reason a cookie changed.
+
+ +

Methods

+ +
+
{{WebExtAPIRef("cookies.get()")}}
+
Запрашивает информацию об одном кукис.
+
{{WebExtAPIRef("cookies.getAll()")}}
+
Выдает все кукис которые подходят установленному фильтру.
+
{{WebExtAPIRef("cookies.set()")}}
+
Устанавливает кукис с заданной информацией;в том случае если подобный кукис был информация будет перезаписана.
+
{{WebExtAPIRef("cookies.remove()")}}
+
Удаляет кукис по имени.
+
{{WebExtAPIRef("cookies.getAllCookieStores()")}}
+
Список всех существующих куки
+
+ +

Event handlers

+ +
+
{{WebExtAPIRef("cookies.onChanged")}}
+
Происходит когда кукис задается или меняется.
+
+ +

Permissions

+ +

In order to use this API, an add-on must specify the "cookies" API permission in its manifest, along with host permissions for any sites for which it wishes to access cookies. The add-on may read or write any cookies which could be read or written by a URL matching the host permissions. For example:

+ +
+
http://*.example.com/
+
+

An add-on with this host permission may:

+ +
    +
  • Read a non-secure cookie for www.example.com, with any path.
  • +
  • Write a secure or non-secure cookie for www.example.com, with any path.
  • +
+ +

It may not:

+ +
    +
  • Read a secure cookie for www.example.com.
  • +
+
+
http://www.example.com/
+
+

An add-on with this host permission may:

+ +
    +
  • Read a non-secure cookie for www.example.com, with any path.
  • +
  • Read a non-secure cookie for .example.com, with any path.
  • +
  • Write a secure or non-secure cookie for www.example.com with any path.
  • +
  • Write a secure or non-secure cookie for .example.com with any path.
  • +
+ +

It may not:

+ +
    +
  • Read or write a cookie for foo.example.com.
  • +
  • Read or write a cookie for foo.www.example.com.
  • +
+
+
*://*.example.com/
+
+

An add-on with this host permission may:

+ +
    +
  • Read or write a secure or non-secure cookie for www.example.com with any path.
  • +
+
+
+ +

Browser compatibility

+ +

{{Compat("webextensions.api.cookies")}}

+ + + +

Edge incompatibilities

+ +

Promises are not supported in Edge. Use callbacks instead.

+ +

{{WebExtExamples("h2")}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.cookies API. This documentation is derived from cookies.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/downloads/index.html b/files/ru/mozilla/add-ons/webextensions/api/downloads/index.html new file mode 100644 index 0000000000..735dab43d5 --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/downloads/index.html @@ -0,0 +1,123 @@ +--- +title: downloads +slug: Mozilla/Add-ons/WebExtensions/API/downloads +translation_of: Mozilla/Add-ons/WebExtensions/API/downloads +--- +
{{AddonSidebar}}
+ +

Позволяет расширениям взаимодействовать с менеджером загрузки браузера. Этот модуль API можно использовать для загрузки, отмены, приостановки, возобновления загрузки файлов и отображения загруженных файлов в файловом менеджере.

+ +

Для использования этого API вам необходимо указать "downloads" API permission в вашем manifest.json файле.

+ +

Types

+ +
+
{{WebExtAPIRef("downloads.FilenameConflictAction")}}
+
Определяет действия в случае, если имя загружаемого файла конфликтует с именем существующего файла.
+
{{WebExtAPIRef("downloads.InterruptReason")}}
+
Defines a set of possible reasons why a download was interrupted.
+
{{WebExtAPIRef("downloads.DangerType")}}
+
Defines a set of common warnings of possible dangers associated with downloadable files.
+
{{WebExtAPIRef("downloads.State")}}
+
Defines different states that a current download can be in.
+
{{WebExtAPIRef("downloads.DownloadItem")}}
+
Represents a downloaded file.
+
{{WebExtAPIRef("downloads.StringDelta")}}
+
Represents the difference between two strings.
+
{{WebExtAPIRef("downloads.DoubleDelta")}}
+
Represents the difference between two doubles.
+
{{WebExtAPIRef("downloads.BooleanDelta")}}
+
Represents the difference between two booleans.
+
{{WebExtAPIRef("downloads.DownloadTime")}}
+
Represents the time a download took to complete.
+
{{WebExtAPIRef("downloads.DownloadQuery")}}
+
Defines a set of parameters that can be used to search the downloads manager for a specific set of downloads.
+
+ +

Functions

+ +
+
{{WebExtAPIRef("downloads.download()")}}
+
Downloads a file, given its URL and other optional preferences.
+
{{WebExtAPIRef("downloads.search()")}}
+
Queries the {{WebExtAPIRef("downloads.DownloadItem", "DownloadItems")}} available in the browser's downloads manager, and returns those that match the specified search criteria.
+
{{WebExtAPIRef("downloads.pause()")}}
+
Pauses a download.
+
{{WebExtAPIRef("downloads.resume()")}}
+
Resumes a paused download.
+
{{WebExtAPIRef("downloads.cancel()")}}
+
Cancels a download.
+
{{WebExtAPIRef("downloads.getFileIcon()")}}
+
Retrieves an icon for the specified download.
+
{{WebExtAPIRef("downloads.open()")}}
+
Opens the downloaded file with its associated application.
+
{{WebExtAPIRef("downloads.show()")}}
+
Opens the platform's file manager application to show the downloaded file in its containing folder.
+
{{WebExtAPIRef("downloads.showDefaultFolder()")}}
+
Opens the platform's file manager application to show the default downloads folder.
+
{{WebExtAPIRef("downloads.erase()")}}
+
Erases matching {{WebExtAPIRef("downloads.DownloadItem", "DownloadItems")}} from the browser's download history, without deleting the downloaded files from disk.
+
{{WebExtAPIRef("downloads.removeFile()")}}
+
Removes a downloaded file from disk, but not from the browser's download history.
+
{{WebExtAPIRef("downloads.acceptDanger()")}}
+
Prompts the user to accept or cancel a dangerous download.
+
{{WebExtAPIRef("downloads.drag()")}}
+
Initiates dragging the downloaded file to another application.
+
{{WebExtAPIRef("downloads.setShelfEnabled()")}}
+
Enables or disables the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it.
+
+ +

Events

+ +
+
{{WebExtAPIRef("downloads.onCreated")}}
+
Fires with the {{WebExtAPIRef("downloads.DownloadItem", "DownloadItem")}} object when a download begins.
+
{{WebExtAPIRef("downloads.onErased")}}
+
Fires with the downloadId when a download is erased from history.
+
{{WebExtAPIRef("downloads.onChanged")}}
+
When any of a {{WebExtAPIRef("downloads.DownloadItem", "DownloadItem")}}'s properties except bytesReceived changes, this event fires with the downloadId and an object containing the properties that changed.
+
+ +

Browser compatibility

+ +

{{Compat("webextensions.api.downloads")}}

+ +

{{WebExtExamples("h2")}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.downloads API.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/index.html b/files/ru/mozilla/add-ons/webextensions/api/index.html new file mode 100644 index 0000000000..6fcf34ce28 --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/index.html @@ -0,0 +1,53 @@ +--- +title: JavaScript APIs +slug: Mozilla/Add-ons/WebExtensions/API +tags: + - Web-расширение + - Расширение +translation_of: Mozilla/Add-ons/WebExtensions/API +--- +
{{AddonSidebar}}
+ +
+

WebExtension JavaScript API может быть использован в фоновых скриптах расширения, а так же в любых других документах, поставляемых вместе с расширением, таких как  документы во всплывающих окнах после нажатия кнопок активации расширения browser action на панели инструментов или page action в строке адреса, боковой панели, страницах настроек или новых открытых вкладках. Некоторые из этих API могут быть доступны на встраиваемых в страницу скриптах (см. список в руководстве по встраиваемым скриптам).

+ +

Для использования отдельных более продвинутых API, необходимо запросить разрешения в manifest.json вашего дополнения.

+ +

Вы можете получить доступ к API, используя пространство имён browser:

+ +
function logTabs(tabs) {
+  console.log(tabs);
+}
+
+browser.tabs.query({currentWindow: true}, logTabs);
+
+ +
+

Многие API выполняются асинхронно, возвращая Promise:

+ +
function logCookie(c) {
+  console.log(c);
+}
+
+function logError(e) {
+  console.error(e);
+}
+
+var setCookie = browser.cookies.set(
+  {url: "/"}
+);
+setCookie.then(logCookie, logError);
+
+ +
Обратите внимание, что это отличается от расширений Google Chrome, которые используют пространство имён chrome вместо browser и колбэки для асинхронных функций вместо промисов. + +

Для поддержки портирования, реализация Firefox WebExtensions API так же поддерживает пространство имён chrome и использование колбэков. Это позволяет в большинстве случаев не изменять код, изначально написанный для Chrome.

+ +

Mozilla так же предоставляет полифилл, который позволяет коду, использующему browser и промисы, работать без изменений в Chrome: https://github.com/mozilla/webextension-polyfill.

+ +

Microsoft Edge использует пространство имен browser, но ещё не поддерживает, основанный на промисах асинхронный API. В Edge на данный момент асинхронные вызовы API должны использовать колбэки.

+ +

Не все браузеры поддерживают все API: детали см. Browser support for JavaScript APIs.

+
+ +
{{SubpagesWithSummaries}}
diff --git a/files/ru/mozilla/add-ons/webextensions/api/runtime/getmanifest/index.html b/files/ru/mozilla/add-ons/webextensions/api/runtime/getmanifest/index.html new file mode 100644 index 0000000000..f506e54335 --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/runtime/getmanifest/index.html @@ -0,0 +1,88 @@ +--- +title: runtime.getManifest() +slug: Mozilla/Add-ons/WebExtensions/API/runtime/getManifest +tags: + - API + - Reference + - WebExtensions + - getManifest + - runtime + - Веб-расширения + - Дополнения + - Нестандартный + - Расширения + - Ссылка + - метод +translation_of: Mozilla/Add-ons/WebExtensions/API/runtime/getManifest +--- +
{{AddonSidebar()}}
+ +
Получить весь файл manifest.json в виде объекта JavaScript, совместимого с JSON.
+ +
+ +

Синтаксис

+ +
browser.runtime.getManifest()
+
+ +

Параметры

+ +

Нет.

+ +

Возвращаемое значение

+ +

object - объект JSON, представляющий манифест.

+ +

Совместимость с браузерами

+ + + +

{{Compat("webextensions.api.runtime.getManifest")}}

+ +

Примеры

+ +

Получить манифест и вывести его свойство "name":

+ +
var manifest = browser.runtime.getManifest();
+console.log(manifest.name);
+ +

{{WebExtExamples}}

+ +
Справка + +

Этот API основан на API Chromium chrome.runtime. Настоящая документация унаследована от  runtime.json в коде Chromium.

+ +

Данные о совместимости Microsoft Edge предоставлены Корпорацией Microsoft и включены сюда под лицензией Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/runtime/index.html b/files/ru/mozilla/add-ons/webextensions/api/runtime/index.html new file mode 100644 index 0000000000..62478e3457 --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/runtime/index.html @@ -0,0 +1,168 @@ +--- +title: runtime +slug: Mozilla/Add-ons/WebExtensions/API/runtime +tags: + - API + - Add-ons + - Extensions + - Interface + - NeedsTranslation + - Reference + - TopicStub + - WebExtensions + - runtime +translation_of: Mozilla/Add-ons/WebExtensions/API/runtime +--- +
{{AddonSidebar}}
+ +

This module provides information about your extension and the environment it's running in.

+ +

It also provides messaging APIs enabling you to:

+ + + +

Types

+ +
+
{{WebExtAPIRef("runtime.Port")}}
+
Represents one end of a connection between two specific contexts, which can be used to exchange messages.
+
{{WebExtAPIRef("runtime.MessageSender")}}
+
+

Contains information about the sender of a message or connection request.

+
+
{{WebExtAPIRef("runtime.PlatformOs")}}
+
Identifies the browser's operating system.
+
{{WebExtAPIRef("runtime.PlatformArch")}}
+
Identifies the browser's processor architecture.
+
{{WebExtAPIRef("runtime.PlatformInfo")}}
+
Contains information about the platform the browser is running on.
+
{{WebExtAPIRef("runtime.RequestUpdateCheckStatus")}}
+
Result of a call to {{WebExtAPIRef("runtime.requestUpdateCheck()")}}.
+
{{WebExtAPIRef("runtime.OnInstalledReason")}}
+
The reason that the {{WebExtAPIRef("runtime.onInstalled")}} event is being dispatched.
+
{{WebExtAPIRef("runtime.OnRestartRequiredReason")}}
+
The reason that the {{WebExtAPIRef("runtime.onRestartRequired")}} event is being dispatched.
+
+ +

Properties

+ +
+
{{WebExtAPIRef("runtime.lastError")}}
+
This value is set when an asynchronous function has an error condition that it needs to report to its caller.
+
{{WebExtAPIRef("runtime.id")}}
+
The ID of the extension.
+
+ +

Functions

+ +
+
{{WebExtAPIRef("runtime.getBackgroundPage()")}}
+
Retrieves the Window object for the background page running inside the current extension.
+
{{WebExtAPIRef("runtime.openOptionsPage()")}}
+
+

Opens your extension's options page.

+
+
{{WebExtAPIRef("runtime.getManifest()")}}
+
Gets the complete manifest.json file, serialized as an object.
+
{{WebExtAPIRef("runtime.getURL()")}}
+
Given a relative path from the manifest.json to a resource packaged with the extension, returns a fully-qualified URL.
+
{{WebExtAPIRef("runtime.setUninstallURL()")}}
+
Sets a URL to be visited when the extension is uninstalled.
+
{{WebExtAPIRef("runtime.reload()")}}
+
Reloads the extension.
+
{{WebExtAPIRef("runtime.requestUpdateCheck()")}}
+
Checks for updates to this extension.
+
{{WebExtAPIRef("runtime.connect()")}}
+
Establishes a connection from a content script to the main extension process, or from one extension to a different extension.
+
{{WebExtAPIRef("runtime.connectNative()")}}
+
+
Connects the extension to a native application on the user's computer.
+
+
{{WebExtAPIRef("runtime.sendMessage()")}}
+
Sends a single message to event listeners within your extension or a different extension. Similar to {{WebExtAPIRef('runtime.connect')}} but only sends a single message, with an optional response.
+
{{WebExtAPIRef("runtime.sendNativeMessage()")}}
+
Sends a single message from an extension to a native application.
+
{{WebExtAPIRef("runtime.getPlatformInfo()")}}
+
Returns information about the current platform.
+
{{WebExtAPIRef("runtime.getBrowserInfo()")}}
+
Returns information about the browser in which this extension is installed.
+
{{WebExtAPIRef("runtime.getPackageDirectoryEntry()")}}
+
Returns a DirectoryEntry for the package directory.
+
+ +

Events

+ +
+
{{WebExtAPIRef("runtime.onStartup")}}
+
Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started.
+
{{WebExtAPIRef("runtime.onInstalled")}}
+
Fired when the extension is first installed, when the extension is updated to a new version, and when the browser is updated to a new version.
+
{{WebExtAPIRef("runtime.onSuspend")}}
+
Sent to the event page just before the extension is unloaded. This gives the extension an opportunity to do some cleanup.
+
{{WebExtAPIRef("runtime.onSuspendCanceled")}}
+
Sent after {{WebExtAPIRef("runtime.onSuspend")}} to indicate that the extension won't be unloaded after all.
+
{{WebExtAPIRef("runtime.onUpdateAvailable")}}
+
Fired when an update is available, but isn't installed immediately because the extension is currently running.
+
{{WebExtAPIRef("runtime.onBrowserUpdateAvailable")}} {{deprecated_inline}}
+
Fired when an update for the browser is available, but isn't installed immediately because a browser restart is required.
+
{{WebExtAPIRef("runtime.onConnect")}}
+
Fired when a connection is made with either an extension process or a content script.
+
{{WebExtAPIRef("runtime.onConnectExternal")}}
+
Fired when a connection is made with another extension.
+
{{WebExtAPIRef("runtime.onMessage")}}
+
Fired when a message is sent from either an extension process or a content script.
+
{{WebExtAPIRef("runtime.onMessageExternal")}}
+
Fired when a message is sent from another extension. Cannot be used in a content script.
+
{{WebExtAPIRef("runtime.onRestartRequired")}}
+
Fired when the device needs to be restarted.
+
+ +

Browser compatibility

+ + + +

{{Compat("webextensions.api.runtime")}}

+ +
{{WebExtExamples("h2")}}
+ +
Acknowledgements + +

This API is based on Chromium's chrome.runtime API. This documentation is derived from runtime.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/tabs/get/index.html b/files/ru/mozilla/add-ons/webextensions/api/tabs/get/index.html new file mode 100644 index 0000000000..25a2126d65 --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/tabs/get/index.html @@ -0,0 +1,74 @@ +--- +title: tabs.get() +slug: Mozilla/Add-ons/WebExtensions/API/tabs/get +translation_of: Mozilla/Add-ons/WebExtensions/API/tabs/get +--- +
{{AddonSidebar()}}
+ +

Получает сведения об указанной вкладке.

+ +

Синтаксис

+ +
browser.tabs.get(
+  tabId,              // integer
+  function(tab) {...} // function
+)
+
+ +

Параметры

+ +
+
tabId
+
integer.
+
callback
+
function. Функция принимает следующие аргументы: +
+
tab
+
{{WebExtAPIRef('tabs.Tab')}}.
+
+
+
+ +

Совместимость с браузерами

+ +

{{Compat("webextensions.api.tabs.get")}}

+ +

Примеры

+ +

{{WebExtExamples}}

+ +
Благодарность + +

Этот API основан на Chromium chrome.tabs API. Это документация получена из tabs.json в коде Chromium.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/tabs/hide/index.html b/files/ru/mozilla/add-ons/webextensions/api/tabs/hide/index.html new file mode 100644 index 0000000000..a91d67f008 --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/tabs/hide/index.html @@ -0,0 +1,79 @@ +--- +title: tabs.hide() +slug: Mozilla/Add-ons/WebExtensions/API/tabs/hide +translation_of: Mozilla/Add-ons/WebExtensions/API/tabs/hide +--- +
{{AddonSidebar()}}
+ +

Hides one or more tabs.

+ +

Hidden tabs are no longer visible in the browser's tabstrip. Hidden tabs are not automatically discarded: the code running in them continues to run. You can explicitly discard tabs whenever you hide them: although this is not appropriate in all situations, it will help to reduce the resources used by the browser.

+ +

This is an asynchronous function that returns a Promise.

+ +

Not all tabs are eligible for being hidden:

+ + + +

The first time an extension hides a tab, the browser will tell the user that the tab is being hidden, show them how they can access the hidden tab, and give them the option of disabling the extension instead.

+ +

To use this API you must have the "tabHide" permission.

+ +

Syntax

+ +
var hiding = browser.tabs.hide(
+  tabIds          // integer or integer array
+)
+
+ +

Parameters

+ +
+
tabIds
+
integer or array of integer. The IDs of the tab or tabs to hide.
+
If any of these tabs are not eligible for being hidden, they will not be hidden, but the call will still succeed and eligible tabs will still be hidden. For example, if you pass [1, 3], and 1 identifies the active tab, then only 3 will be hidden.
+
However, if any of the tab IDs are invalid, the call will fail and no tabs will be hidden.
+
+ +

Return value

+ +

A Promise that will be fulfilled with an array containing the IDs of the tabs that were hidden. If any error occurs, the promise will be rejected with an error message.

+ +

Browser compatibility

+ + + +

{{Compat("webextensions.api.tabs.hide")}}

+ +

Examples

+ +

Hide a single tab:

+ +
function onHidden() {
+  console.log(`Hidden`);
+}
+
+function onError(error) {
+  console.log(`Error: ${error}`);
+}
+
+browser.tabs.hide(2).then(onHidden, onError);
+ +

Hide multiple tabs:

+ +
function onHidden() {
+  console.log(`Hidden`);
+}
+
+function onError(error) {
+  console.log(`Error: ${error}`);
+}
+
+browser.tabs.hide([15, 14, 1]).then(onHidden, onError);
+ +

{{WebExtExamples}}

diff --git a/files/ru/mozilla/add-ons/webextensions/api/tabs/index.html b/files/ru/mozilla/add-ons/webextensions/api/tabs/index.html new file mode 100644 index 0000000000..696329aa4f --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/tabs/index.html @@ -0,0 +1,179 @@ +--- +title: tabs +slug: Mozilla/Add-ons/WebExtensions/API/tabs +tags: + - API + - Add-ons + - Extensions + - Interface + - NeedsTranslation + - Non-standard + - Reference + - TopicStub + - WebExtensions + - tabs +translation_of: Mozilla/Add-ons/WebExtensions/API/tabs +--- +
{{AddonSidebar}}
+ +

Interact with the browser's tab system. You can use this API to get a list of opened tabs and to create, modify, and rearrange tabs in the browser.

+ +

You can use most of this API without any special permission. However, to access Tab.url, Tab.title, and Tab.faviconUrl, you need to have the "tabs" permission. In Firefox this also means you need "tabs" to {{WebExtAPIRef("tabs.query", "query")}} by URL.

+ +

Types

+ +
+
{{WebExtAPIRef("tabs.MutedInfoReason")}}
+
An event that caused a muted state change.
+
{{WebExtAPIRef("tabs.MutedInfo")}}
+
Tab muted state and the reason for the last state change.
+
{{WebExtAPIRef("tabs.Tab")}}
+
Contains various properties of a single tab.
+
{{WebExtAPIRef("tabs.ZoomSettingsMode")}}
+
Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to automatic.
+
{{WebExtAPIRef("tabs.ZoomSettingsScope")}}
+
Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise.
+
{{WebExtAPIRef("tabs.ZoomSettings")}}
+
Defines how zoom changes in a tab are handled and at what scope.
+
{{WebExtAPIRef("tabs.TabStatus")}}
+
Whether the tabs have completed loading.
+
{{WebExtAPIRef("tabs.WindowType")}}
+
The type of window.
+
+ +

Properties

+ +
+
{{WebExtAPIRef("tabs.TAB_ID_NONE")}}
+
An ID which represents the absence of a browser tab.
+
+ +

Functions

+ +
+
{{WebExtAPIRef("tabs.get()")}}
+
Retrieves details about the specified tab.
+
{{WebExtAPIRef("tabs.getCurrent()")}}
+
Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).
+
{{WebExtAPIRef("tabs.connect()")}}
+
Connects to the content script(s) in the specified tab. The {{WebExtAPIRef('runtime.onConnect')}} event is fired in each content script running in the specified tab for the current extension. For more details, see content script messaging.
+
{{WebExtAPIRef("tabs.sendRequest()")}}
+
Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The {{WebExtAPIRef('extension.onRequest')}} event is fired in each content script running in the specified tab for the current extension.
+
{{WebExtAPIRef("tabs.sendMessage()")}}
+
Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The {{WebExtAPIRef('runtime.onMessage')}} event is fired in each content script running in the specified tab for the current extension.
+
{{WebExtAPIRef("tabs.getSelected()")}}
+
Gets the tab that is selected in the specified window.
+
{{WebExtAPIRef("tabs.getAllInWindow()")}}
+
Gets details about all tabs in the specified window.
+
{{WebExtAPIRef("tabs.create()")}}
+
Creates a new tab.
+
{{WebExtAPIRef("tabs.duplicate()")}}
+
Duplicates a tab.
+
{{WebExtAPIRef("tabs.query()")}}
+
Gets all tabs that have the specified properties, or all tabs if no properties are specified.
+
{{WebExtAPIRef("tabs.highlight()")}}
+
Highlights the given tabs.
+
{{WebExtAPIRef("tabs.update()")}}
+
Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified.
+
{{WebExtAPIRef("tabs.move()")}}
+
Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows.
+
{{WebExtAPIRef("tabs.reload()")}}
+
Reload a tab.
+
{{WebExtAPIRef("tabs.remove()")}}
+
Closes one or more tabs.
+
{{WebExtAPIRef("tabs.detectLanguage()")}}
+
Detects the primary language of the content in a tab.
+
{{WebExtAPIRef("tabs.captureVisibleTab()")}}
+
Captures the visible area of the currently active tab in the specified window. You must have <all_urls> permission to use this method.
+
{{WebExtAPIRef("tabs.executeScript()")}}
+
Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc.
+
{{WebExtAPIRef("tabs.insertCSS()")}}
+
Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc.
+
{{WebExtAPIRef("tabs.setZoom()")}}
+
Zooms a specified tab.
+
{{WebExtAPIRef("tabs.getZoom()")}}
+
Gets the current zoom factor of a specified tab.
+
{{WebExtAPIRef("tabs.setZoomSettings()")}}
+
Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.
+
{{WebExtAPIRef("tabs.getZoomSettings()")}}
+
Gets the current zoom settings of a specified tab.
+
+ +

Events

+ +
+
{{WebExtAPIRef("tabs.onCreated")}}
+
Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.
+
{{WebExtAPIRef("tabs.onUpdated")}}
+
Fired when a tab is updated.
+
{{WebExtAPIRef("tabs.onMoved")}}
+
Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see {{WebExtAPIRef('tabs.onDetached')}}.
+
{{WebExtAPIRef("tabs.onSelectionChanged")}}
+
Fires when the selected tab in a window changes.
+
{{WebExtAPIRef("tabs.onActiveChanged")}}
+
Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to {{WebExtAPIRef('tabs.onUpdated')}} events to be notified when a URL is set.
+
{{WebExtAPIRef("tabs.onActivated")}}
+
Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.
+
{{WebExtAPIRef("tabs.onHighlightChanged")}}
+
Fired when the highlighted or selected tabs in a window changes.
+
{{WebExtAPIRef("tabs.onHighlighted")}}
+
Fired when the highlighted or selected tabs in a window changes.
+
{{WebExtAPIRef("tabs.onDetached")}}
+
Fired when a tab is detached from a window, for example because it is being moved between windows.
+
{{WebExtAPIRef("tabs.onAttached")}}
+
Fired when a tab is attached to a window, for example because it was moved between windows.
+
{{WebExtAPIRef("tabs.onRemoved")}}
+
Fired when a tab is closed.
+
{{WebExtAPIRef("tabs.onReplaced")}}
+
Fired when a tab is replaced with another tab due to prerendering or instant.
+
{{WebExtAPIRef("tabs.onZoomChange")}}
+
Fired when a tab is zoomed.
+
+ +

Browser compatibility

+ +

{{Compat("webextensions.api.tabs")}}

+ + + +

{{WebExtExamples("h2")}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/webrequest/index.html b/files/ru/mozilla/add-ons/webextensions/api/webrequest/index.html new file mode 100644 index 0000000000..3f0da7eada --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/webrequest/index.html @@ -0,0 +1,188 @@ +--- +title: ВебЗапрос +slug: Mozilla/Add-ons/WebExtensions/API/webRequest +translation_of: Mozilla/Add-ons/WebExtensions/API/webRequest +--- +
{{AddonSidebar}}
+ +

Добавляет обработчики событий на различных стадиях HTTP запроса. Обработчик получет детальную информацию о запросе и способен изменить или отменить запрос.

+ +

Каждое событие запущено на определённой стадии запроса. Типичный порядок событий такой:

+ +

{{WebExtAPIRef("webRequest.onErrorOccurred", "onErrorOccurred")}} Может быть запущен в любой момент во время запроса. Чреда событий может отличаться от приведенной выше: например, в Firefox, после HSTS обновления, событие onBeforeRedirect будет запущено сразу же после onBeforeRequest.

+ +

Все события, кроме onErrorOccurred, могут принимать три аргумента в  addListener():

+ + + +

Функции - обработчику передается обьект details который содержит информацию о запросе. Она содержит ID запроса, который обеспечен для включения надстройки, которая позволяет соотносить события, ассоциируемые с одним запросом. Это уникально в пределах сессии и контекста надстройки. Информация остается одинаковой везде на протяжении запроса, даже при перенаправлениях и обменах аутентификации.

+ +

Для использования webRequest API для определённого хоста, расширение должно иметь "webRequest" API permission и host permission для этого хоста. Для использования возможности "блокирования" расширение должно также иметь "webRequestBlocking" API разрешение.

+ +

Для перехвата ресурсов, загруженных страницей (таких как картинки, скрипты или таблицы стилей), расширение должно иметь разрешение хоста для ресурса также как и для главной страницы, запрашивающей ресурс. К примеру, если страница на "https://developer.mozilla.org" загружает картинку из "https://mdn.mozillademos.org", тогда расширение должно иметь разрешения обоих хостов чтобы перехватить запрос картинки.

+ +

Модифицирование заголовков

+ +

Используя некоторые из этих событий, вы можете модифицировать запрос. Конкретно, вы можете:

+ + + +

Чтобы сделать это, вам необходимо передать оцпию со значением "blocking" в аргументе extraInfoSpec к  addListener(). Это делает обработчик синхронным. В обработчике, вы можете тогда возвратить обьект {{WebExtAPIRef("webRequest.BlockingResponse", "BlockingResponse")}} который индикует модификацию, какую вам нужно сделать: например, модифицированный заголовок запроса который вы хотите отправить.

+ +

Доступ к информации о безопасности

+ +

В обработчике {{WebExtAPIRef("webRequest.onHeadersReceived", "onHeadersReceived")}} вы имеете доступ к TLS свойствам запроса через вызов {{WebExtAPIRef("webRequest.getSecurityInfo()", "getSecurityInfo()")}}. Чтоды сделать это, вы должны также передать "blocking" в  extraInfoSpec аргументе к  addListener() события.

+ +

Вы можете прочитать детали TLS хэндшейка, но не можете модифицировать их или перезаписать решения доверы браузера.

+ +

Modifying responses

+ +

Для того, чтобы модифицировать тело HTTP ответа на запрос, вызовите {{WebExtAPIRef("webRequest.filterResponseData")}}, и передайте ID запроса. Это возвратит обьект {{WebExtAPIRef("webRequest.StreamFilter")}} который вы сможете использовать чтобы исследовать и изменять данные когда они получены браузером.

+ +

Чтобы сделать это, у вас дожно быть "webRequestBlocking" API разрешение, а также "webRequest" API permission и host permission от соответствующего хоста.

+ +

Types

+ +
+
{{WebExtAPIRef("webRequest.BlockingResponse")}}
+
+

An object of this type is returned by event listeners that have set "blocking" in their extraInfoSpec argument. By setting particular properties in BlockingResponse, the listener can modify network requests.

+
+
{{WebExtAPIRef("webRequest.CertificateInfo")}}
+
An object describing a single X.509 certificate.
+
{{WebExtAPIRef("webRequest.HttpHeaders")}}
+
An array of HTTP headers. Each header is represented as an object with two properties: name and either value or binaryValue.
+
{{WebExtAPIRef("webRequest.RequestFilter")}}
+
An object describing filters to apply to webRequest events.
+
{{WebExtAPIRef("webRequest.ResourceType")}}
+
Represents a particular kind of resource fetched in a web request.
+
{{WebExtAPIRef("webRequest.SecurityInfo")}}
+
An object describing the security properties of a particular web request.
+
{{WebExtAPIRef("webRequest.StreamFilter")}}
+
An object that can be used to monitor and modify HTTP responses while they are being received.
+
{{WebExtAPIRef("webRequest.UploadData")}}
+
Contains data uploaded in a URL request.
+
+ +

Properties

+ +
+
{{WebExtAPIRef("webRequest.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES")}}
+
The maximum number of times that handlerBehaviorChanged() can be called in a 10 minute period.
+
+ +

Functions

+ +
+
{{WebExtAPIRef("webRequest.handlerBehaviorChanged()")}}
+
This function can be used to ensure that event listeners are applied correctly when pages are in the browser's in-memory cache.
+
{{WebExtAPIRef("webRequest.filterResponseData()")}}
+
Returns a {{WebExtAPIRef("webRequest.StreamFilter")}} object for a given request.
+
{{WebExtAPIRef("webRequest.getSecurityInfo()")}}
+
Gets detailed information about the TLS connection associated with a given request.
+
+ +

Events

+ +
+
{{WebExtAPIRef("webRequest.onBeforeRequest")}}
+
Fired when a request is about to be made, and before headers are available. This is a good place to listen if you want to cancel or redirect the request.
+
{{WebExtAPIRef("webRequest.onBeforeSendHeaders")}}
+
Fired before sending any HTTP data, but after HTTP headers are available. This is a good place to listen if you want to modify HTTP request headers.
+
{{WebExtAPIRef("webRequest.onSendHeaders")}}
+
Fired just before sending headers. If your add-on or some other add-on modified headers in {{WebExtAPIRef("webRequest.onBeforeSendHeaders", "onBeforeSendHeaders")}}, you'll see the modified version here.
+
{{WebExtAPIRef("webRequest.onHeadersReceived")}}
+
Fired when the HTTP response headers associated with a request have been received. You can use this event to modify HTTP response headers.
+
{{WebExtAPIRef("webRequest.onAuthRequired")}}
+
Fired when the server asks the client to provide authentication credentials. The listener can do nothing, cancel the request, or supply authentication credentials.
+
{{WebExtAPIRef("webRequest.onResponseStarted")}}
+
Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.
+
{{WebExtAPIRef("webRequest.onBeforeRedirect")}}
+
Fired when a server-initiated redirect is about to occur.
+
{{WebExtAPIRef("webRequest.onCompleted")}}
+
Fired when a request is completed.
+
{{WebExtAPIRef("webRequest.onErrorOccurred")}}
+
Fired when an error occurs.
+
+ +

Browser compatibility

+ +

{{Compat("webextensions.api.webRequest")}}

+ +

Extra notes on Chrome incompatibilities.

+ +

{{WebExtExamples("h2")}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.webRequest API. This documentation is derived from web_request.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/windows/createtype/index.html b/files/ru/mozilla/add-ons/webextensions/api/windows/createtype/index.html new file mode 100644 index 0000000000..efc9821f8c --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/windows/createtype/index.html @@ -0,0 +1,65 @@ +--- +title: windows.CreateType +slug: Mozilla/Add-ons/WebExtensions/API/windows/CreateType +translation_of: Mozilla/Add-ons/WebExtensions/API/windows/CreateType +--- +
{{AddonSidebar()}}
+ +

Определение типа окна браузера для создания.

+ +

Тип

+ +

Значение данного типа strings. Возможные значения:

+ + + +

Совместимость с браузерами

+ + + +

{{Compat("webextensions.api.windows.CreateType")}}

+ +

{{WebExtExamples}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.windows API. This documentation is derived from windows.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + diff --git a/files/ru/mozilla/add-ons/webextensions/api/windows/index.html b/files/ru/mozilla/add-ons/webextensions/api/windows/index.html new file mode 100644 index 0000000000..889210561b --- /dev/null +++ b/files/ru/mozilla/add-ons/webextensions/api/windows/index.html @@ -0,0 +1,106 @@ +--- +title: windows +slug: Mozilla/Add-ons/WebExtensions/API/windows +translation_of: Mozilla/Add-ons/WebExtensions/API/windows +--- +
{{AddonSidebar}}
+ +

Взаимодействие с окнами браузера. Вы можете использовать этот API, чтобы получить информацию об открытых окнах, а также открывать, изменять и закрывать окна. Вы также можете слушать события открытия, закрытия окна, и активировать события.

+ +

Types

+ +
+
{{WebExtAPIRef("windows.WindowType")}}
+
Тип окна браузера.
+
{{WebExtAPIRef("windows.WindowState")}}
+
Состояние окна браузера.
+
{{WebExtAPIRef("windows.Window")}}
+
Информация об окне браузера.
+
{{WebExtAPIRef("windows.CreateType")}}
+
Specifies the type of browser window to create.
+
+ +

Properties

+ +
+
{{WebExtAPIRef("windows.WINDOW_ID_NONE")}}
+
The windowId value that represents the absence of a browser window.
+
{{WebExtAPIRef("windows.WINDOW_ID_CURRENT")}}
+
The windowId value that represents the current window.
+
+ +

Functions

+ +
+
{{WebExtAPIRef("windows.get()")}}
+
Gets details about a window, given its ID.
+
{{WebExtAPIRef("windows.getCurrent()")}}
+
Gets the current window.
+
{{WebExtAPIRef("windows.getLastFocused()")}}
+
Gets the window that was most recently focused — typically the window 'on top'.
+
{{WebExtAPIRef("windows.getAll()")}}
+
Gets all windows.
+
{{WebExtAPIRef("windows.create()")}}
+
+

Creates a new window.

+
+
{{WebExtAPIRef("windows.update()")}}
+
Updates the properties of a window. Use this to move, resize, and (un)focus a window, etc.
+
{{WebExtAPIRef("windows.remove()")}}
+
Closes a window, and all its tabs.
+
+ +

Events

+ +
+
{{WebExtAPIRef("windows.onCreated")}}
+
Fired when a window is created.
+
{{WebExtAPIRef("windows.onRemoved")}}
+
Fired when a window is closed.
+
{{WebExtAPIRef("windows.onFocusChanged")}}
+
Fired when the currently focused window changes.
+
+ +

Browser compatibility

+ +

{{Compat("webextensions.api.windows")}}

+ +

{{WebExtExamples("h2")}}

+ +
Acknowledgements + +

This API is based on Chromium's chrome.windows API. This documentation is derived from windows.json in the Chromium code.

+ +

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

+
+ + -- cgit v1.2.3-54-g00ecf