diff options
Diffstat (limited to 'files/de/mozilla/add-ons/webextensions/api')
6 files changed, 649 insertions, 0 deletions
diff --git a/files/de/mozilla/add-ons/webextensions/api/browseraction/index.html b/files/de/mozilla/add-ons/webextensions/api/browseraction/index.html new file mode 100644 index 0000000000..184dccf3d6 --- /dev/null +++ b/files/de/mozilla/add-ons/webextensions/api/browseraction/index.html @@ -0,0 +1,135 @@ +--- +title: browserAction +slug: Mozilla/Add-ons/WebExtensions/API/browserAction +tags: + - API + - Add-ons + - Extensions + - Interface + - NeedsTranslation + - Non-standard + - Reference + - TopicStub + - WebExtensions + - browserAction +translation_of: Mozilla/Add-ons/WebExtensions/API/browserAction +--- +<div>{{AddonSidebar}}</div> + +<p>Adds a button to the browser's toolbar.</p> + +<p>A <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a> is a button in the browser's toolbar.</p> + +<p>You can associate a popup with the button. The popup is specified using HTML, CSS and JavaScript, just like a normal web page. JavaScript running in the popup gets access to all the same WebExtension APIs as your background scripts, but its global context is the popup, not the current page displayed in the browser. To affect web pages you need to communicate with them via <a href="/en-US/Add-ons/WebExtensions/Modify_a_web_page#Messaging">messages</a>.</p> + +<p>If you specify a popup, it will be shown — and the content will be loaded — when the user clicks the icon. If you do not specify a popup, then when the user clicks the icon an event is dispatched to your extension.</p> + +<p>You can define most of a browser action's properties declaratively using the <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action">browser_action</a></code> key in the manifest.json.</p> + +<p>With the <code>browserAction</code> API, you can:</p> + +<ul> + <li>use {{WebExtAPIRef("browserAction.onClicked")}} to listen for clicks on the icon.</li> + <li>get and set the icon's properties — icon, title, popup, and so on. You can get and set these globally across all tabs, or for a specific tab by passing the tab ID as an additional argument.</li> +</ul> + +<h2 id="Types">Types</h2> + +<dl> + <dt>{{WebExtAPIRef("browserAction.ColorArray")}}</dt> + <dd>An array of four integers in the range 0-255 defining an RGBA color.</dd> + <dt>{{WebExtAPIRef("browserAction.ImageDataType")}}</dt> + <dd>Pixel data for an image. Must be an <code><a href="/en-US/docs/Web/API/ImageData">ImageData</a></code> object (for example, from a {{htmlelement("canvas")}} element).</dd> +</dl> + +<h2 id="Functions">Functions</h2> + +<dl> + <dt>{{WebExtAPIRef("browserAction.setTitle()")}}</dt> + <dd>Sets the browser action's title. This will be displayed in a tooltip.</dd> + <dt>{{WebExtAPIRef("browserAction.getTitle()")}}</dt> + <dd>Gets the browser action's title.</dd> + <dt>{{WebExtAPIRef("browserAction.setIcon()")}}</dt> + <dd>Sets the browser action's icon.</dd> + <dt>{{WebExtAPIRef("browserAction.setPopup()")}}</dt> + <dd>Sets the HTML document to be opened as a popup when the user clicks on the browser action's icon.</dd> + <dt>{{WebExtAPIRef("browserAction.getPopup()")}}</dt> + <dd>Gets the HTML document set as the browser action's popup.</dd> + <dt>{{WebExtAPIRef("browserAction.openPopup()")}}</dt> + <dd>Open the browser action's popup.</dd> + <dt>{{WebExtAPIRef("browserAction.setBadgeText()")}}</dt> + <dd>Sets the browser action's badge text. The badge is displayed on top of the icon.</dd> + <dt>{{WebExtAPIRef("browserAction.getBadgeText()")}}</dt> + <dd>Gets the browser action's badge text.</dd> + <dt>{{WebExtAPIRef("browserAction.setBadgeBackgroundColor()")}}</dt> + <dd>Sets the badge's background color.</dd> + <dt>{{WebExtAPIRef("browserAction.getBadgeBackgroundColor()")}}</dt> + <dd>Gets the badge's background color.</dd> + <dt>{{WebExtAPIRef("browserAction.setBadgeTextColor()")}}</dt> + <dd>Sets the badge's text color.</dd> + <dt>{{WebExtAPIRef("browserAction.getBadgeTextColor()")}}</dt> + <dd>Gets the badge's text color.</dd> + <dt>{{WebExtAPIRef("browserAction.enable()")}}</dt> + <dd>Enables the browser action for a tab. By default, browser actions are enabled for all tabs.</dd> + <dt>{{WebExtAPIRef("browserAction.disable()")}}</dt> + <dd>Disables the browser action for a tab, meaning that it cannot be clicked when that tab is active.</dd> + <dt>{{WebExtAPIRef("browserAction.isEnabled()")}}</dt> + <dd>Checks whether the browser action is enabled or not.</dd> +</dl> + +<h2 id="Events">Events</h2> + +<dl> + <dt>{{WebExtAPIRef("browserAction.onClicked")}}</dt> + <dd>Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.</dd> +</dl> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{Compat("webextensions.api.browserAction")}}</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/browserAction"><code>chrome.browserAction</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/browser_action.json"><code>browser_action.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</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/de/mozilla/add-ons/webextensions/api/browseraction/setpopup/index.html b/files/de/mozilla/add-ons/webextensions/api/browseraction/setpopup/index.html new file mode 100644 index 0000000000..2a4a40e794 --- /dev/null +++ b/files/de/mozilla/add-ons/webextensions/api/browseraction/setpopup/index.html @@ -0,0 +1,136 @@ +--- +title: browserAction.setPopup() +slug: Mozilla/Add-ons/WebExtensions/API/browserAction/setPopup +translation_of: Mozilla/Add-ons/WebExtensions/API/browserAction/setPopup +--- +<div>{{AddonSidebar()}}</div> + +<p>Sets the HTML document that will be opened as a popup when the user clicks on the browser action's icon. Tabs without a specific popup will inherit the global popup, which defaults to the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action"><code>default_popup</code></a> specified in the manifest.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox brush:js">browser.browserAction.setPopup( + details // object +) +</pre> + +<h3 id="Parameters">Parameters</h3> + +<dl> + <dt><code>details</code></dt> + <dd><code>object</code>.</dd> + <dd> + <dl class="reference-values"> + <dt><code>tabId</code>{{optional_inline}}</dt> + <dd><code>integer</code>. Sets the popup only for a specific tab. The popup is reset when the user navigates this tab to a new page.</dd> + <dt><code>windowId</code>{{optional_inline}}</dt> + <dd><code>integer</code>. Sets the popup only for the specified window.</dd> + </dl> + + <dl class="reference-values"> + <dt><code>popup</code></dt> + <dd> + <p><code>string</code> or <code>null</code>. The HTML file to show in a popup, specified as a URL.</p> + + <p>This can point to a file packaged within the extension (for example, created using {{WebExtAPIRef("extension.getURL")}}), or a remote document (e.g. <code>https://example.org/</code>).</p> + + <p>If an empty string (<code>""</code>) is passed here, the popup is disabled, and the extension will receive {{WebExtAPIRef("browserAction.onClicked")}} events.</p> + + <p>If <code>popup</code> is <code>null</code>:</p> + + <p>If <code>tabId</code> is specified, removes the tab-specific popup so that the tab inherits the global popup.</p> + + <p>If <code>windowId</code> is specified, removes the window-specific popup so that the window inherits the global popup.</p> + + <p>Otherwise it reverts the global popup to the default value.</p> + </dd> + </dl> + </dd> +</dl> + +<ul> + <li>If <code>windowId</code> and <code>tabId</code> are both supplied, the function fails and the popup is not set.</li> + <li>If <code>windowId</code> and <code>tabId</code> are both omitted, the global popup is set.</li> +</ul> + +<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.browserAction.setPopup",2)}}</p> + +<h2 id="Examples">Examples</h2> + +<p>This code adds a pair of context menu items that you can use to switch between two popups. Note that you'll need the "contextMenus" <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">permission</a> set in the extension's manifest to create context menu items.</p> + +<pre class="brush: js">function onCreated() { + if (browser.runtime.lastError) { + console.log("error creating item:" + browser.runtime.lastError); + } else { + console.log("item created successfully"); + } +} + +browser.contextMenus.create({ + id: "popup-1", + type: "radio", + title: "Popup 1", + contexts: ["all"], + checked: true +}, onCreated); + +browser.contextMenus.create({ + id: "popup-2", + type: "radio", + title: "Popup 2", + contexts: ["all"], + checked: false +}, onCreated); + +browser.contextMenus.onClicked.addListener(function(info, tab) { + if (info.menuItemId == "popup-1") { + browser.browserAction.setPopup({popup: "/popup/popup1.html"}) + } else if (info.menuItemId == "popup-2") { + browser.browserAction.setPopup({popup: "/popup/popup2.html"}) + } +});</pre> + +<p>{{WebExtExamples}}</p> + +<div class="note"><strong>Acknowledgements</strong> + +<p>This API is based on Chromium's <a href="https://developer.chrome.com/extensions/browserAction#method-setPopup"><code>chrome.browserAction</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/browser_action.json"><code>browser_action.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</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/de/mozilla/add-ons/webextensions/api/commands/index.html b/files/de/mozilla/add-ons/webextensions/api/commands/index.html new file mode 100644 index 0000000000..af45cea002 --- /dev/null +++ b/files/de/mozilla/add-ons/webextensions/api/commands/index.html @@ -0,0 +1,83 @@ +--- +title: commands +slug: Mozilla/Add-ons/WebExtensions/API/commands +translation_of: Mozilla/Add-ons/WebExtensions/API/commands +--- +<div>{{AddonSidebar}}</div> + +<p>Verwenden Sie die Ausführungsbefehle der Benutzer, die Sie mit Hilfe des <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands"><code>Schlüssels commands</code> der manifest.json</a> registriert haben.</p> + +<h2 id="Typen">Typen</h2> + +<dl> + <dt>{{WebExtAPIRef("commands.Command")}}</dt> + <dd>Objekt, das einen Befehl repräsentiert. Es enthält die für den Befehl im <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands"><code>Schlüssel commands der </code>manifest.json</a> festgelegten Informationen.</dd> +</dl> + +<h2 id="Funktionen">Funktionen</h2> + +<dl> + <dt>{{WebExtAPIRef("commands.getAll")}}</dt> + <dd> + <p>Stellt alle registrierten Befehle für diese Erweiterung zur Verfügung.</p> + </dd> + <dt>{{WebExtAPIRef("commands.reset")}}</dt> + <dd> + <p>Angegebene Befehlsbeschreibung und das Tastaturkürzel auf die im Manifest-Schlüssel angegebenen Werte zurücksetzen.</p> + </dd> + <dt>{{WebExtAPIRef("commands.update")}}</dt> + <dd> + <p>Beschreibung oder Tastenkürzel des angegebenen Befehls ändern.</p> + </dd> +</dl> + +<h2 id="Ereignisse">Ereignisse</h2> + +<dl> + <dt>{{WebExtAPIRef("commands.onCommand")}}</dt> + <dd> + <div>Wird ausgelöst, wenn ein Befehl mit Hilfe seines zugewiesenen Tastenkürzels ausgeführt wird.</div> + </dd> +</dl> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<p>{{Compat("webextensions.api.commands")}} {{WebExtExamples("h2")}}</p> + +<div class="note"><strong>Danksagungen</strong> + +<p>Diese API basiert auf der API <a href="https://developer.chrome.com/extensions/commands"><code>chrome.commands</code></a> von Chromium.</p> + +<p>Die Kompatibilitätsdaten von Microsoft Edge werden von der Microsoft Corporation bereitgestellt und stehen hier unter der Lizenz Creative Commons Attribution 3.0 United States.</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/de/mozilla/add-ons/webextensions/api/downloads/index.html b/files/de/mozilla/add-ons/webextensions/api/downloads/index.html new file mode 100644 index 0000000000..7363cde811 --- /dev/null +++ b/files/de/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 +--- +<div>0ü</div> + +<p>Enables extensions to interact with the browser's download manager. You can use this API module to download files, cancel, pause, resume downloads, and show downloaded files in the file manager.</p> + +<p>To use this API you need to have the "downloads" <a href="/en-US/Add-ons/WebExtensions/manifest.json/permissions#API_permissions">API permission</a> specified in your <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a> file.</p> + +<h2 id="Types">Types</h2> + +<dl> + <dt>{{WebExtAPIRef("downloads.FilenameConflictAction")}}</dt> + <dd>Defines options for what to do if the name of a downloaded file conflicts with an existing file.</dd> + <dt>{{WebExtAPIRef("downloads.InterruptReason")}}</dt> + <dd>Defines a set of possible reasons why a download was interrupted.</dd> + <dt>{{WebExtAPIRef("downloads.DangerType")}}</dt> + <dd>Defines a set of common warnings of possible dangers associated with downloadable files.</dd> + <dt>{{WebExtAPIRef("downloads.State")}}</dt> + <dd>Defines different states that a current download can be in.</dd> + <dt>{{WebExtAPIRef("downloads.DownloadItem")}}</dt> + <dd>Represents a downloaded file.</dd> + <dt>{{WebExtAPIRef("downloads.StringDelta")}}</dt> + <dd>Represents the difference between two strings.</dd> + <dt>{{WebExtAPIRef("downloads.DoubleDelta")}}</dt> + <dd>Represents the difference between two doubles.</dd> + <dt>{{WebExtAPIRef("downloads.BooleanDelta")}}</dt> + <dd>Represents the difference between two booleans.</dd> + <dt>{{WebExtAPIRef("downloads.DownloadTime")}}</dt> + <dd>Represents the time a download took to complete.</dd> + <dt>{{WebExtAPIRef("downloads.DownloadQuery")}}</dt> + <dd>Defines a set of parameters that can be used to search the downloads manager for a specific set of downloads.</dd> +</dl> + +<h2 id="Functions">Functions</h2> + +<dl> + <dt>{{WebExtAPIRef("downloads.download()")}}</dt> + <dd>Downloads a file, given its URL and other optional preferences.</dd> + <dt>{{WebExtAPIRef("downloads.search()")}}</dt> + <dd>Queries the {{WebExtAPIRef("downloads.DownloadItem", "DownloadItems")}} available in the browser's downloads manager, and returns those that match the specified search criteria.</dd> + <dt>{{WebExtAPIRef("downloads.pause()")}}</dt> + <dd>Pauses a download.</dd> + <dt>{{WebExtAPIRef("downloads.resume()")}}</dt> + <dd>Resumes a paused download.</dd> + <dt>{{WebExtAPIRef("downloads.cancel()")}}</dt> + <dd>Cancels a download.</dd> + <dt>{{WebExtAPIRef("downloads.getFileIcon()")}}</dt> + <dd>Retrieves an icon for the specified download.</dd> + <dt>{{WebExtAPIRef("downloads.open()")}}</dt> + <dd>Opens the downloaded file with its associated application.</dd> + <dt>{{WebExtAPIRef("downloads.show()")}}</dt> + <dd>Opens the platform's file manager application to show the downloaded file in its containing folder.</dd> + <dt>{{WebExtAPIRef("downloads.showDefaultFolder()")}}</dt> + <dd>Opens the platform's file manager application to show the default downloads folder.</dd> + <dt>{{WebExtAPIRef("downloads.erase()")}}</dt> + <dd>Erases matching {{WebExtAPIRef("downloads.DownloadItem", "DownloadItems")}} from the browser's download history, without deleting the downloaded files from disk.</dd> + <dt>{{WebExtAPIRef("downloads.removeFile()")}}</dt> + <dd>Removes a downloaded file from disk, but not from the browser's download history.</dd> + <dt>{{WebExtAPIRef("downloads.acceptDanger()")}}</dt> + <dd>Prompts the user to accept or cancel a dangerous download.</dd> + <dt>{{WebExtAPIRef("downloads.drag()")}}</dt> + <dd>Initiates dragging the downloaded file to another application.</dd> + <dt>{{WebExtAPIRef("downloads.setShelfEnabled()")}}</dt> + <dd>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.</dd> +</dl> + +<h2 id="Events">Events</h2> + +<dl> + <dt>{{WebExtAPIRef("downloads.onCreated")}}</dt> + <dd>Fires with the {{WebExtAPIRef("downloads.DownloadItem", "DownloadItem")}} object when a download begins.</dd> + <dt>{{WebExtAPIRef("downloads.onErased")}}</dt> + <dd>Fires with the <code>downloadId</code> when a download is erased from history.</dd> + <dt>{{WebExtAPIRef("downloads.onChanged")}}</dt> + <dd>When any of a {{WebExtAPIRef("downloads.DownloadItem", "DownloadItem")}}'s properties except <code>bytesReceived</code> changes, this event fires with the <code>downloadId</code> and an object containing the properties that changed.</dd> +</dl> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{Compat("webextensions.api.downloads")}}</p> + +<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/downloads"><code>chrome.downloads</code></a> API.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</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/de/mozilla/add-ons/webextensions/api/index.html b/files/de/mozilla/add-ons/webextensions/api/index.html new file mode 100644 index 0000000000..1a500cdc0c --- /dev/null +++ b/files/de/mozilla/add-ons/webextensions/api/index.html @@ -0,0 +1,51 @@ +--- +title: JavaScript APIs +slug: Mozilla/Add-ons/WebExtensions/API +tags: + - NeedsTranslation + - TopicStub + - WebExtensions +translation_of: Mozilla/Add-ons/WebExtensions/API +--- +<div>{{AddonSidebar}}</div> + +<div> +<p>JavaScript APIs for WebExtensions can be used inside the extension's <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Background_scripts">background scripts</a> and in any other documents bundled with the extension, including <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_action">browser action</a> or <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Page_actions">page action</a> popups, <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Sidebars">sidebars</a>, <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Options_pages">options pages</a>, or <a href="/en-US/Add-ons/WebExtensions/manifest.json/chrome_url_overrides">new tab pages</a>. A few of these APIs can also be accessed by an extension's <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Anatomy_of_a_WebExtension#Content_scripts">content scripts</a> (see the <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#WebExtension_APIs">list in the content script guide</a>).</p> + +<p>To use the more powerful APIs you need to <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions">request permission</a> in your extension's manifest.json.</p> + +<p>You can access the APIs using the <code>browser</code> namespace:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">logTabs</span><span class="punctuation token">(</span>tabs<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span>tabs<span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> + +browser<span class="punctuation token">.</span>tabs<span class="punctuation token">.</span><span class="function token">query</span><span class="punctuation token">(</span><span class="punctuation token">{</span>currentWindow<span class="punctuation token">:</span> <span class="keyword token">true</span><span class="punctuation token">}</span><span class="punctuation token">,</span> logTabs<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> +</div> + +<div> +<p>Many of the APIs are asynchronous, returning a <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code>:</p> + +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">logCookie</span><span class="punctuation token">(</span>c<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span>c<span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> + +<span class="keyword token">function</span> <span class="function token">logError</span><span class="punctuation token">(</span>e<span class="punctuation token">)</span> <span class="punctuation token">{</span> + console<span class="punctuation token">.</span><span class="function token">error</span><span class="punctuation token">(</span>e<span class="punctuation token">)</span><span class="punctuation token">;</span> +<span class="punctuation token">}</span> + +<span class="keyword token">var</span> setCookie <span class="operator token">=</span> browser<span class="punctuation token">.</span>cookies<span class="punctuation token">.</span><span class="keyword token">set</span><span class="punctuation token">(</span> + <span class="punctuation token">{</span>url<span class="punctuation token">:</span> <span class="string token">"https://developer.mozilla.org/"</span><span class="punctuation token">}</span> +<span class="punctuation token">)</span><span class="punctuation token">;</span> +setCookie<span class="punctuation token">.</span><span class="function token">then</span><span class="punctuation token">(</span>logCookie<span class="punctuation token">,</span> logError<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> +</div> + +<div> +<p>Note that this is different from Google Chrome's extension system, which uses the <code>chrome</code> namespace instead of <code>browser</code>, and which uses callbacks instead of promises for asynchronous functions. As a porting aid, the Firefox implementation of WebExtensions APIs supports <code>chrome</code> and callbacks as well as <code>browser</code> and promises. Mozilla has also written a polyfill which enables code that uses <code>browser</code> and promises to work unchanged in Chrome: <a class="external external-icon" href="https://github.com/mozilla/webextension-polyfill">https://github.com/mozilla/webextension-polyfill</a>.</p> + +<p>Microsoft Edge uses the <code>browser</code> namespace, but doesn't yet support promise-based asynchronous APIs. In Edge, for the time being, asynchronous APIs must use callbacks.</p> + +<p>Not all browsers support all the APIs: for the details, see <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs">Browser support for JavaScript APIs</a>.</p> +</div> + +<div>{{SubpagesWithSummaries}}</div> diff --git a/files/de/mozilla/add-ons/webextensions/api/lesezeich/index.html b/files/de/mozilla/add-ons/webextensions/api/lesezeich/index.html new file mode 100644 index 0000000000..7c43bda2af --- /dev/null +++ b/files/de/mozilla/add-ons/webextensions/api/lesezeich/index.html @@ -0,0 +1,121 @@ +--- +title: Lesezeichen +slug: Mozilla/Add-ons/WebExtensions/API/Lesezeich. +translation_of: Mozilla/Add-ons/WebExtensions/API/bookmarks +--- +<div>{{AddonSidebar}}</div> + +<p>Die <a href="/en-US/docs/Mozilla/Add-ons/WebExtensions">WebExtensions</a> {{WebExtAPIRef("bookmarks")}} API erlaubt es einer Erweiterung mit dem Lesezeichensystem des Browsers interagieren und dieses zu manipulieren. Sie können die API verwenden, um für Seiten Lesezeichen zu setzen, vorhandene Lesezeichen abzurufen und Lesezeichen zu bearbeiten, zu entfernen und zu organisieren.</p> + +<p>Um diese API zu verwenden, muss die Erweiterung die <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions">Berechtigung</a> "Lesezeichen" in der <code><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json">manifest.json</a></code> Datei besitzen.</p> + +<h2 id="Types">Types</h2> + +<dl> + <dt>{{WebExtAPIRef("bookmarks.BookmarkTreeNodeUnmodifiable")}}</dt> + <dd>Ein {{jsxref("String")}} enum, das angibt, warum ein Lesezeichen oder ein Ordner unmodifizierbar ist.</dd> + <dt>{{WebExtAPIRef("bookmarks.BookmarkTreeNode")}}</dt> + <dd>Stellt ein Lesezeichen oder einen Ordner im Lesezeichenbaum dar.</dd> + <dt>{{WebExtAPIRef("bookmarks.CreateDetails")}}</dt> + <dd>Enthält Informationen, die bei der Erstellung eines neuen Lesezeichens an die {{WebExtAPIRef("bookmarks.create()")}} Funktion übergeben werden.</dd> +</dl> + +<h2 id="Functions">Functions</h2> + +<dl> + <dt>{{WebExtAPIRef("bookmarks.create()")}}</dt> + <dd>Erstellt ein Lesezeichen oder Ordner.</dd> + <dt>{{WebExtAPIRef("bookmarks.get()")}}</dt> + <dd>Ruft eine oder mehrere {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}} ab und übergibt eine Lesezeichen-ID oder ein Array von Lesezeichen ID.</dd> + <dt>{{WebExtAPIRef("bookmarks.getChildren()")}}</dt> + <dd>Ruft die Kinder des angegebenen {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}} ab.</dd> + <dt>{{WebExtAPIRef("bookmarks.getRecent()")}}</dt> + <dd>Ruft eine angeforderte Anzahl von zuletzt hinzugefügten Lesezeichen ab.</dd> + <dt>{{WebExtAPIRef("bookmarks.getSubTree()")}}</dt> + <dd>Ruft einen Teil des Lesezeichenbaums ab und beginnt am angegebenen Knoten.</dd> + <dt>{{WebExtAPIRef("bookmarks.getTree()")}}</dt> + <dd>Ruft den gesamten Lesezeichenbaum in ein Array von {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}} Objekte auf.</dd> + <dt>{{WebExtAPIRef("bookmarks.move()")}}</dt> + <dd>Moves the specified {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}} to a new location in the bookmark tree.</dd> + <dt>{{WebExtAPIRef("bookmarks.remove()")}}</dt> + <dd>Removes a bookmark or an empty bookmark folder, given the node's ID.</dd> + <dt>{{WebExtAPIRef("bookmarks.removeTree()")}}</dt> + <dd>Recursively removes a bookmark folder; that is, given the ID of a folder node, removes that node and all its descendants.</dd> + <dt>{{WebExtAPIRef("bookmarks.search()")}}</dt> + <dd>Searches for {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}}s matching a specified set of criteria.</dd> + <dt>{{WebExtAPIRef("bookmarks.update()")}}</dt> + <dd>Updates the title and/or URL of a bookmark, or the name of a bookmark folder, given the bookmark's ID.</dd> +</dl> + +<h2 id="Events">Events</h2> + +<dl> + <dt>{{WebExtAPIRef("bookmarks.onCreated")}}</dt> + <dd>Fired when a bookmark or folder is created.</dd> + <dt>{{WebExtAPIRef("bookmarks.onRemoved")}}</dt> + <dd>Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.</dd> + <dt>{{WebExtAPIRef("bookmarks.onChanged")}}</dt> + <dd>Fired when a bookmark or folder changes. Currently, only <code>title</code> and <code>url</code> changes trigger this.</dd> + <dt>{{WebExtAPIRef("bookmarks.onMoved")}}</dt> + <dd>Fired when a bookmark or folder is moved to a different parent folder or to a new offset within its folder.</dd> + <dt>{{WebExtAPIRef("bookmarks.onChildrenReordered")}}</dt> + <dd>Fired when the user has sorted the children of a folder in the browser's UI. This is not called as a result of a {{WebExtAPIRef("bookmarks.move", "move()")}}.</dd> + <dt>{{WebExtAPIRef("bookmarks.onImportBegan")}}</dt> + <dd>Fired when a bookmark import session is begun. Expensive observers should ignore {{WebExtAPIRef("bookmarks.onCreated")}} updates until {{WebExtAPIRef("bookmarks.onImportEnded")}} is fired. Observers should still handle other notifications immediately.</dd> + <dt>{{WebExtAPIRef("bookmarks.onImportEnded")}}</dt> + <dd>Fired when a bookmark import session has finished.</dd> +</dl> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{Compat("webextensions.api.bookmarks")}}</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> + +<h3 id="Edge_incompatibilities">Edge incompatibilities</h3> + +<p>Promises are not supported in Edge. Use callbacks instead.</p> + +<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/bookmarks"><code>chrome.bookmarks</code></a> API. This documentation is derived from <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/bookmarks.json"><code>bookmarks.json</code></a> in the Chromium code.</p> + +<p>Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.</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> |