aboutsummaryrefslogtreecommitdiff
path: root/files/fr/mozilla/add-ons/webextensions/api/commands
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/mozilla/add-ons/webextensions/api/commands')
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/commands/command/index.html46
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html61
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/commands/index.html91
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/commands/oncommand/index.html98
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/commands/reset/index.html59
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html70
6 files changed, 425 insertions, 0 deletions
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/command/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/command/index.html
new file mode 100644
index 0000000000..cd84951bfb
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/commands/command/index.html
@@ -0,0 +1,46 @@
+---
+title: Command
+slug: Mozilla/Add-ons/WebExtensions/API/commands/Command
+tags:
+ - API
+ - Add-ons
+ - Command
+ - Extensions
+ - Non-standard
+ - Reference
+ - Type
+ - WebExtensions
+ - commands
+translation_of: Mozilla/Add-ons/WebExtensions/API/commands/Command
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Information sur une commande. Cela contient les informations spécifiées pour la commande dans la  <a href="/fr/Add-ons/WebExtensions/manifest.json/commands"><code>commande</code> clef manifest.json</a>.</p>
+
+<p>Un tableau de ces objets est renvoyé par {{WebExtAPIRef('commands.getAll()')}}.</p>
+
+<h2 id="Type">Type</h2>
+
+<p>Les valeurs de ce type  sont des objets. Ils contiennent les propriétés suivantes :</p>
+
+<dl class="reference-values">
+ <dt><code>name</code>{{optional_inline}}</dt>
+ <dd><code>string</code>. Nom de la commande. Cela sera passé dans l'écouteur de l'événement  {{WebExtAPIRef('commands.onCommand')}}.</dd>
+ <dt><code>description</code>{{optional_inline}}</dt>
+ <dd><code>string</code>. Description de cette commande. Ceci est principalement utilisé pour expliquer à l'utilisateur ce que cette commande fait.</dd>
+ <dt><code>shortcut</code>{{optional_inline}}</dt>
+ <dd><code>string</code>. clef(s) utilisée pour exécuter cette commande , spécifiée comme une chaîne comme "Ctrl+Shift+Y".</dd>
+</dl>
+
+<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</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.commands.Command")}}</p>
+
+<p>{{WebExtExamples}}</p>
+
+<div class="note"><strong>Remerciements :</strong>
+
+<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/commands"><code>chrome.commands</code></a>.</p>
+</div>
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html
new file mode 100644
index 0000000000..76c2f8a5e6
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/commands/getall/index.html
@@ -0,0 +1,61 @@
+---
+title: getAll()
+slug: Mozilla/Add-ons/WebExtensions/API/commands/getAll
+tags:
+ - API
+ - Add-ons
+ - Extensions
+ - Method
+ - Non-standard
+ - Reference
+ - WebExtensions
+ - commands
+ - getAll
+translation_of: Mozilla/Add-ons/WebExtensions/API/commands/getAll
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Obient toutes les commandes pour l'exécution que vous avez enregistré à l'aide d'une des <a href="/fr/Add-ons/WebExtensions/manifest.json/commands"><code>commandes</code> clef du manifest.json</a>.</p>
+
+<p>Les commandes sont renvoyées sous la forme d'un tableau d'objets   {{WebExtAPIRef('commands.Command')}}. Altenativement, si vous utilisez la version de base promise de l'API, <code>browser.commands.getAll()</code>,  les commandes sont passées dans l'argument <code>onFulfilled</code> à <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise/then">Promise.then()</a></code>.</p>
+
+<p>C'est une fonction asynchrone qui renvoie une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code>.</p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox brush:js">var getCommands = browser.commands.getAll();
+</pre>
+
+<h3 id="Paramètres">Paramètres</h3>
+
+<p>Aucun.</p>
+
+<h3 id="Valeur_retournée">Valeur retournée</h3>
+
+<p>Une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code> qui sera accompli avec un tableau  d'objets <code>{{WebExtAPIRef('commands.Command')}}</code>, un pour  chaque commande enregistrée pour l'extension. Si aucune n'a été enregistrée, le tableau  sera vide.</p>
+
+<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</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.commands.getAll")}}</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<pre class="brush: js">function logCommands(commands) {
+  commands.forEach(function(command) {
+    console.log(command);
+  });
+}
+
+var getCommands = browser.commands.getAll();
+getCommands.then(logCommands);</pre>
+
+<p>{{WebExtExamples}}</p>
+
+<div class="note"><strong>Remerciements :</strong>
+
+<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/commands"><code>chrome.commands</code></a>.</p>
+
+<p>Les données de compatibilité relatives à Microsoft Edge sont fournies par Microsoft Corporation et incluses ici sous la licence Creative Commons Attribution 3.0 pour les États-Unis.</p>
+</div>
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/index.html
new file mode 100644
index 0000000000..9e9beb6cd3
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/commands/index.html
@@ -0,0 +1,91 @@
+---
+title: commands
+slug: Mozilla/Add-ons/WebExtensions/API/commands
+tags:
+ - API
+ - Add-ons
+ - Extensions
+ - Non-standard
+ - Reference
+ - WebExtensions
+ - commands
+translation_of: Mozilla/Add-ons/WebExtensions/API/commands
+---
+<div>{{AddonSidebar}}</div>
+
+<p>Écoutez l'utilisateur exécutant les commandes que vous avez enregistrées à l'aide des <a href="/fr/Add-ons/WebExtensions/manifest.json/commands">clés <code>commandes</code> du fichier manifest.json</a>.</p>
+
+<h2 id="Types">Types</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("commands.Command")}}</dt>
+ <dd>Objet représentant une commande. Il contient les informations spécifiées pour la commande dans les <a href="/fr/Add-ons/WebExtensions/manifest.json/commands">clés <code>commands</code> du fichier manifest.json</a>.</dd>
+</dl>
+
+<h2 id="Fonctions">Fonctions</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("commands.getAll")}}</dt>
+ <dd>
+ <p>Obtient toutes les commandes enregistrées pour cette extension.</p>
+ </dd>
+ <dt>{{WebExtAPIRef("commands.reset")}}</dt>
+ <dd>
+ <p>Réinitialiser la description de la commande donnée et le raccourci vers les valeurs données dans la clé “manifest”.</p>
+ </dd>
+ <dt>{{WebExtAPIRef("commands.update")}}</dt>
+ <dd>
+ <p>Modifiez la description ou le raccourci de la commande donnée.</p>
+ </dd>
+</dl>
+
+<h2 id="Événements">Événements</h2>
+
+<dl>
+ <dt>{{WebExtAPIRef("commands.onCommand")}}</dt>
+ <dd>
+ <div>Activé lorsqu'une commande est exécutée à l'aide du raccourci clavier associé.</div>
+ </dd>
+</dl>
+
+<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
+
+<p>{{Compat("webextensions.api.commands")}} {{WebExtExamples("h2")}}</p>
+
+<div class="note"><strong>Remerciements :</strong>
+
+<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/commands"><code>chrome.commands</code></a>.</p>
+
+<p>Les données de compatibilité relatives à Microsoft Edge sont fournies par Microsoft Corporation et incluses ici sous la licence Creative Commons Attribution 3.0 pour les États-Unis.</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/fr/mozilla/add-ons/webextensions/api/commands/oncommand/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/oncommand/index.html
new file mode 100644
index 0000000000..85c98b3207
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/commands/oncommand/index.html
@@ -0,0 +1,98 @@
+---
+title: onCommand
+slug: Mozilla/Add-ons/WebExtensions/API/commands/onCommand
+tags:
+ - API
+ - Add-ons
+ - Event
+ - Extensions
+ - Non-standard
+ - Reference
+ - WebExtensions
+ - commands
+ - onCommand
+translation_of: Mozilla/Add-ons/WebExtensions/API/commands/onCommand
+---
+<div>{{AddonSidebar()}}</div>
+
+<div>Lancer quand une commande est exécutée à l'aide de son raccourci clavier associé.</div>
+
+<div></div>
+
+<div>L'écouteur reçoit  le nom de la commande. Cela correspond au nom donnée à la commande dans une  <a href="/fr/Add-ons/WebExtensions/manifest.json/commands">entrée manifest.json</a>.</div>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox brush:js">browser.commands.onCommand.addListener(listener)
+browser.commands.onCommand.removeListener(listener)
+browser.commands.onCommand.hasListener(listener)
+</pre>
+
+<p>Les événements ont trois fonctions :</p>
+
+<dl>
+ <dt><code>addListener(callback)</code></dt>
+ <dd>Ajoute un écouteur à un événement.</dd>
+ <dt><code>removeListener(listener)</code></dt>
+ <dd>Arrêter d'écouter un événement. L'arguement <code>listener</code> est l'écouteur à supprimer.</dd>
+ <dt><code>hasListener(listener)</code></dt>
+ <dd>Vérifiez si <code>listener</code> est enregistré pour cet événement . Renvoie <code>true</code> s'il écoute, <code>false</code> sinon.</dd>
+</dl>
+
+<h2 id="Syntaxe_addListener">Syntaxe addListener</h2>
+
+<h3 id="Paramètre">Paramètre</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>
+ <p>Fonction qui sera appelée lorsqu'un utilisateur entre dans le raccourci de la commande. La fonction recevra les arguments suivants :</p>
+
+ <dl class="reference-values">
+ <dt><code>name</code></dt>
+ <dd><code>string</code>. Nom de la commande. Cela correspond au nom donné à la commande dans son <a href="/fr/Add-ons/WebExtensions/manifest.json/commands">entrée manifest.json</a>.</dd>
+ </dl>
+ </dd>
+</dl>
+
+<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</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.commands.onCommand")}}</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<div>Etant donnée une entrée manifest.json comme ceci :</div>
+
+<div></div>
+
+<div>
+<pre class="brush: json line-numbers language-json"><code class="language-json"><span class="key token">"commands":</span> <span class="punctuation token">{</span>
+ <span class="key token">"toggle-feature":</span> <span class="punctuation token">{</span>
+ <span class="key token">"suggested_key":</span> <span class="punctuation token">{</span>
+ <span class="key token">"default":</span> <span class="string token">"Ctrl+Shift+Y"</span>
+ <span class="punctuation token">}</span><span class="punctuation token">,</span>
+ <span class="key token">"description":</span> <span class="string token">"Send a 'toggle-feature' event"</span>
+ <span class="punctuation token">}</span>
+<span class="punctuation token">}</span></code></pre>
+</div>
+
+<div>Vous pouvez écouter cette commande particulière comme ceci :</div>
+
+<div></div>
+
+<div>
+<pre class="brush: js line-numbers language-js"><code class="language-js">browser<span class="punctuation token">.</span>commands<span class="punctuation token">.</span>onCommand<span class="punctuation token">.</span><span class="function token">addListener</span><span class="punctuation token">(</span><span class="keyword token">function</span><span class="punctuation token">(</span>command<span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ <span class="keyword token">if</span> <span class="punctuation token">(</span>command <span class="operator token">==</span> <span class="string token">"toggle-feature"</span><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><span class="string token">"toggling the feature!"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+ <span class="punctuation token">}</span>
+<span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+</div>
+
+<p>{{WebExtExamples}}</p>
+
+<div class="note"><strong>Remerciements :</strong>
+
+<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/commands"><code>chrome.commands</code></a>.</p>
+</div>
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/reset/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/reset/index.html
new file mode 100644
index 0000000000..136a24cc18
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/commands/reset/index.html
@@ -0,0 +1,59 @@
+---
+title: commands.reset()
+slug: Mozilla/Add-ons/WebExtensions/API/commands/reset
+tags:
+ - API
+ - Add-ons
+ - Extensions
+ - Method
+ - Reference
+ - WebExtensions
+ - commands
+ - reset
+translation_of: Mozilla/Add-ons/WebExtensions/API/commands/reset
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Réinitialise la description de la commande donnée et le raccourci clavier aux valeurs indiquées dans <a href="/fr/Add-ons/WebExtensions/manifest.json/commands"><code>commands</code> de la clé du manifest.json</a> de l'extension.</p>
+
+<p>Cela annule efficacement les modifications apportées à la commande à l'aide de la fonction {{WEbExtAPIRef("commands.update()")}}.</p>
+
+<p>C'est une fonction asynchrone qui renvoie une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code>.</p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox brush:js">browser.commands.reset(
+ name // string
+);
+</pre>
+
+<h3 id="Paramètres">Paramètres</h3>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd><code>string</code>. Nom de la commande à réinitialiser, comme indiqué par la propriété <code>name</code> de l'objet {{WebExtAPIRef("commands.Command")}}.</dd>
+</dl>
+
+<h3 id="Valeur_retournée">Valeur retournée</h3>
+
+<p>Une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code> qui sera remplie sans arguments lorsque le raccourci a été réinitialisé.</p>
+
+<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</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.commands.reset")}}</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<p>Réinitialise la commande "my-command" lorsque l'utilisateur clique sur le bouton "reset" :</p>
+
+<pre class="brush: js">const commandName = 'my-command';
+
+function resetShortcut() {
+ browser.commands.reset(commandName);
+}
+
+document.querySelector('#reset').addEventListener('click', resetShortcut);</pre>
+
+<p>{{WebExtExamples}}</p>
diff --git a/files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html b/files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html
new file mode 100644
index 0000000000..35365ccb34
--- /dev/null
+++ b/files/fr/mozilla/add-ons/webextensions/api/commands/update/index.html
@@ -0,0 +1,70 @@
+---
+title: commands.update()
+slug: Mozilla/Add-ons/WebExtensions/API/commands/update
+tags:
+ - API
+ - Add-ons
+ - Extensions
+ - Method
+ - Reference
+ - Update
+ - WebExtensions
+ - commands
+translation_of: Mozilla/Add-ons/WebExtensions/API/commands/update
+---
+<div>{{AddonSidebar()}}</div>
+
+<p>Changez la description ou le raccourci clavier pour la commande donnée.</p>
+
+<p>C'est une fonction asynchrone qui renvoie une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code>.</p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox brush:js">browser.commands.update(
+ details // object
+);
+</pre>
+
+<h3 id="Paramètres">Paramètres</h3>
+
+<dl>
+ <dt><code>details</code></dt>
+ <dd><code>object</code>. Un objet avec les propriétés suivantes:</dd>
+ <dd>
+ <dl class="reference-values">
+ <dt><code>name</code></dt>
+ <dd><code>string</code>. e nom de la commande à mettre à jour. Cela doit correspondre au nom d'une commande existante, comme indiqué par exemple dans la propriété <code>name</code> de l'objet {{WebExtAPIRef("commands.Command")}}.</dd>
+ <dt><code>description</code>{{optional_inline}}</dt>
+ <dd><code>string</code>. Une nouvelle description à définir pour la commande.</dd>
+ <dt><code>shortcut</code>{{optional_inline}}</dt>
+ <dd><code>string</code>. Un nouveau raccourci à définir pour la commande. Cela doit correspondre au format donné dans la documentation pour les <a href="/fr/Add-ons/WebExtensions/manifest.json/commands"><code>commands</code> de la clé manifest.json</a>. S'il ne correspond pas à ce format, la fonction va générer une erreur.</dd>
+ </dl>
+ </dd>
+</dl>
+
+<h3 id="Valeur_retournée">Valeur retournée</h3>
+
+<p>Une <code><a href="/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise">Promise</a></code> qui sera remplie sans arguments lorsque le raccourci a été réinitialisé. La promesse sera rejetée avec une erreur si la commande n'a pas pu être trouvée.</p>
+
+<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</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.commands.update")}}</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<p>Met à jour la commande "my-command" avec la valeur de raccourci donnée, lorsque l'utilisateur clique sur "update" :</p>
+
+<pre class="brush: js">const commandName = 'my-command';
+
+function updateShortcut() {
+ browser.commands.update({
+ name: commandName,
+ shortcut: document.querySelector('#shortcut').value
+ });
+}
+
+document.querySelector('#update').addEventListener('click', updateShortcut);</pre>
+
+<p>{{WebExtExamples}}</p>