aboutsummaryrefslogtreecommitdiff
path: root/files/ru/mozilla/add-ons/webextensions/api/tabs
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/mozilla/add-ons/webextensions/api/tabs
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/mozilla/add-ons/webextensions/api/tabs')
-rw-r--r--files/ru/mozilla/add-ons/webextensions/api/tabs/get/index.html74
-rw-r--r--files/ru/mozilla/add-ons/webextensions/api/tabs/hide/index.html79
-rw-r--r--files/ru/mozilla/add-ons/webextensions/api/tabs/index.html179
3 files changed, 332 insertions, 0 deletions
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
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Получает сведения об указанной вкладке.</p>
+
+<h2 id="Синтаксис"><span class="short_text" id="result_box" lang="ru"><span>Синтаксис</span></span></h2>
+
+<pre class="brush: js">browser.tabs.get(
+ tabId, // integer
+ function(tab) {...} // function
+)
+</pre>
+
+<h3 id="Параметры">Параметры</h3>
+
+<dl>
+ <dt><code>tabId</code></dt>
+ <dd><code>integer</code>.</dd>
+ <dt><code>callback</code></dt>
+ <dd><code>function</code>. <span class="short_text" id="result_box" lang="ru"><span>Функция принимает</span> <span>следующие аргументы</span></span>:
+ <dl class="reference-values">
+ <dt><code>tab</code></dt>
+ <dd>{{WebExtAPIRef('tabs.Tab')}}.</dd>
+ </dl>
+ </dd>
+</dl>
+
+<h2 id="Совместимость_с_браузерами">Совместимость с браузерами</h2>
+
+<p>{{Compat("webextensions.api.tabs.get")}}</p>
+
+<h2 id="Примеры">Примеры</h2>
+
+<p>{{WebExtExamples}}</p>
+
+<div class="note"><strong>Благодарность</strong>
+
+<p>Этот API основан на Chromium <a href="https://developer.chrome.com/extensions/tabs#method-get"><code>chrome.tabs</code></a> API. Это документация получена из <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/tabs.json"><code>tabs.json</code></a> в коде Chromium.</p>
+</div>
+
+<div class="hidden">
+<pre>// Copyright 2015 The Chromium Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+</div>
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
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Hides one or more tabs.</p>
+
+<p>Hidden tabs are no longer visible in the browser's tabstrip. Hidden tabs are not automatically <a href="/en-US/Add-ons/WebExtensions/API/tabs/discard">discarded</a>: 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.</p>
+
+<p>This is an asynchronous function that returns a <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>.</p>
+
+<p>Not all tabs are eligible for being hidden:</p>
+
+<ul>
+ <li>Tabs that are pinned cannot be hidden.</li>
+ <li>Tabs that are sharing the screen, microphone or camera cannot be hidden.</li>
+ <li>The current active tab cannot be hidden.</li>
+ <li>Tabs that are in the process of being closed cannot be hidden.</li>
+</ul>
+
+<p>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.</p>
+
+<p>To use this API you must have the "tabHide" <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions">permission</a>.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox brush:js">var hiding = browser.tabs.hide(
+ tabIds // integer or integer array
+)
+</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>tabIds</code></dt>
+ <dd><code><code>integer</code></code> or <code><code>array</code></code> of <code><code>integer</code></code>. The IDs of the tab or tabs to hide.</dd>
+ <dd>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 <code>[1, 3]</code>, and <code>1</code> identifies the active tab, then only <code>3</code> will be hidden.</dd>
+ <dd>However, if any of the tab IDs are invalid, the call will fail and no tabs will be hidden.</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>A <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code> 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.</p>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("webextensions.api.tabs.hide")}}</p>
+
+<h2 id="Examples">Examples</h2>
+
+<p>Hide a single tab:</p>
+
+<pre class="brush: js">function onHidden() {
+ console.log(`Hidden`);
+}
+
+function onError(error) {
+ console.log(`Error: ${error}`);
+}
+
+browser.tabs.hide(2).then(onHidden, onError);</pre>
+
+<p>Hide multiple tabs:</p>
+
+<pre class="brush: js">function onHidden() {
+ console.log(`Hidden`);
+}
+
+function onError(error) {
+ console.log(`Error: ${error}`);
+}
+
+browser.tabs.hide([15, 14, 1]).then(onHidden, onError);</pre>
+
+<p>{{WebExtExamples}}</p>
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
+---
+<div>{{AddonSidebar}}</div>
+
+<p>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.</p>
+
+<p>You can use most of this API without any special permission. However, to access <code>Tab.url</code>, <code>Tab.title</code>, and <code>Tab.faviconUrl</code>, you need to have the "tabs" <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permission</a>. In Firefox this also means you need "tabs" to {{WebExtAPIRef("tabs.query", "query")}} by URL.</p>
+
+<h2 id="Types">Types</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("tabs.MutedInfoReason")}}</dt>
+ <dd>An event that caused a muted state change.</dd>
+ <dt>{{WebExtAPIRef("tabs.MutedInfo")}}</dt>
+ <dd>Tab muted state and the reason for the last state change.</dd>
+ <dt>{{WebExtAPIRef("tabs.Tab")}}</dt>
+ <dd>Contains various properties of a single tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.ZoomSettingsMode")}}</dt>
+ <dd>Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.</dd>
+ <dt>{{WebExtAPIRef("tabs.ZoomSettingsScope")}}</dt>
+ <dd>Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.</dd>
+ <dt>{{WebExtAPIRef("tabs.ZoomSettings")}}</dt>
+ <dd>Defines how zoom changes in a tab are handled and at what scope.</dd>
+ <dt>{{WebExtAPIRef("tabs.TabStatus")}}</dt>
+ <dd>Whether the tabs have completed loading.</dd>
+ <dt>{{WebExtAPIRef("tabs.WindowType")}}</dt>
+ <dd>The type of window.</dd>
+</dl>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("tabs.TAB_ID_NONE")}}</dt>
+ <dd>An ID which represents the absence of a browser tab.</dd>
+</dl>
+
+<h2 id="Functions">Functions</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("tabs.get()")}}</dt>
+ <dd>Retrieves details about the specified tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.getCurrent()")}}</dt>
+ <dd>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).</dd>
+ <dt>{{WebExtAPIRef("tabs.connect()")}}</dt>
+ <dd>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 <a href="/en-US/Add-ons/WebExtensions/Content_scripts">content script messaging</a>.</dd>
+ <dt>{{WebExtAPIRef("tabs.sendRequest()")}}</dt>
+ <dd>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.</dd>
+ <dt>{{WebExtAPIRef("tabs.sendMessage()")}}</dt>
+ <dd>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.</dd>
+ <dt>{{WebExtAPIRef("tabs.getSelected()")}}</dt>
+ <dd>Gets the tab that is selected in the specified window.</dd>
+ <dt>{{WebExtAPIRef("tabs.getAllInWindow()")}}</dt>
+ <dd>Gets details about all tabs in the specified window.</dd>
+ <dt>{{WebExtAPIRef("tabs.create()")}}</dt>
+ <dd>Creates a new tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.duplicate()")}}</dt>
+ <dd>Duplicates a tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.query()")}}</dt>
+ <dd>Gets all tabs that have the specified properties, or all tabs if no properties are specified.</dd>
+ <dt>{{WebExtAPIRef("tabs.highlight()")}}</dt>
+ <dd>Highlights the given tabs.</dd>
+ <dt>{{WebExtAPIRef("tabs.update()")}}</dt>
+ <dd>Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified.</dd>
+ <dt>{{WebExtAPIRef("tabs.move()")}}</dt>
+ <dd>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 (<code>window.type === "normal"</code>) windows.</dd>
+ <dt>{{WebExtAPIRef("tabs.reload()")}}</dt>
+ <dd>Reload a tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.remove()")}}</dt>
+ <dd>Closes one or more tabs.</dd>
+ <dt>{{WebExtAPIRef("tabs.detectLanguage()")}}</dt>
+ <dd>Detects the primary language of the content in a tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.captureVisibleTab()")}}</dt>
+ <dd>Captures the visible area of the currently active tab in the specified window. You must have <code>&lt;all_urls&gt;</code> permission to use this method.</dd>
+ <dt>{{WebExtAPIRef("tabs.executeScript()")}}</dt>
+ <dd>Injects JavaScript code into a page. For details, see the programmatic injection section of the <a href="/en-US/Add-ons/WebExtensions/Content_scripts">content scripts</a> doc.</dd>
+ <dt>{{WebExtAPIRef("tabs.insertCSS()")}}</dt>
+ <dd>Injects CSS into a page. For details, see the programmatic injection section of the <a href="/en-US/Add-ons/WebExtensions/Content_scripts">content scripts</a> doc.</dd>
+ <dt>{{WebExtAPIRef("tabs.setZoom()")}}</dt>
+ <dd>Zooms a specified tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.getZoom()")}}</dt>
+ <dd>Gets the current zoom factor of a specified tab.</dd>
+ <dt>{{WebExtAPIRef("tabs.setZoomSettings()")}}</dt>
+ <dd>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.</dd>
+ <dt>{{WebExtAPIRef("tabs.getZoomSettings()")}}</dt>
+ <dd>Gets the current zoom settings of a specified tab.</dd>
+</dl>
+
+<h2 id="Events">Events</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("tabs.onCreated")}}</dt>
+ <dd>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.</dd>
+ <dt>{{WebExtAPIRef("tabs.onUpdated")}}</dt>
+ <dd>Fired when a tab is updated.</dd>
+ <dt>{{WebExtAPIRef("tabs.onMoved")}}</dt>
+ <dd>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')}}.</dd>
+ <dt>{{WebExtAPIRef("tabs.onSelectionChanged")}}</dt>
+ <dd>Fires when the selected tab in a window changes.</dd>
+ <dt>{{WebExtAPIRef("tabs.onActiveChanged")}}</dt>
+ <dd>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.</dd>
+ <dt>{{WebExtAPIRef("tabs.onActivated")}}</dt>
+ <dd>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.</dd>
+ <dt>{{WebExtAPIRef("tabs.onHighlightChanged")}}</dt>
+ <dd>Fired when the highlighted or selected tabs in a window changes.</dd>
+ <dt>{{WebExtAPIRef("tabs.onHighlighted")}}</dt>
+ <dd>Fired when the highlighted or selected tabs in a window changes.</dd>
+ <dt>{{WebExtAPIRef("tabs.onDetached")}}</dt>
+ <dd>Fired when a tab is detached from a window, for example because it is being moved between windows.</dd>
+ <dt>{{WebExtAPIRef("tabs.onAttached")}}</dt>
+ <dd>Fired when a tab is attached to a window, for example because it was moved between windows.</dd>
+ <dt>{{WebExtAPIRef("tabs.onRemoved")}}</dt>
+ <dd>Fired when a tab is closed.</dd>
+ <dt>{{WebExtAPIRef("tabs.onReplaced")}}</dt>
+ <dd>Fired when a tab is replaced with another tab due to prerendering or instant.</dd>
+ <dt>{{WebExtAPIRef("tabs.onZoomChange")}}</dt>
+ <dd>Fired when a tab is zoomed.</dd>
+</dl>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("webextensions.api.tabs")}}</p>
+
+<div class="hidden note">
+<p>The "Chrome incompatibilities" section is included from <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities"> https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a> using the <a href="/en-US/docs/Template:WebExtChromeCompat">WebExtChromeCompat</a> macro.</p>
+
+<p>If you need to update this content, edit <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities">https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities</a>, then shift-refresh this page to see your changes.</p>
+</div>
+
+<p>{{WebExtExamples("h2")}}</p>
+
+<div class="note"><strong>Acknowledgements</strong>
+
+<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/tabs"><code>chrome.tabs</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/tabs.json"><code>tabs.json</code></a> in the Chromium code.</p>
+</div>
+
+<div class="hidden">
+<pre>// Copyright 2015 The Chromium Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+</div>