aboutsummaryrefslogtreecommitdiff
path: root/files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle
diff options
context:
space:
mode:
authorSphinxKnight <SphinxKnight@users.noreply.github.com>2021-11-15 19:39:07 +0100
committerGitHub <noreply@github.com>2021-11-15 19:39:07 +0100
commit34d315396ca29d7ef51ecc27eeeeeb275e9b0ba9 (patch)
tree21f671201b06ff6b0e507de867950b71fe1fddaf /files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle
parent3886d96643d8b7cc626f1dda0e11981ac85def86 (diff)
downloadtranslated-content-34d315396ca29d7ef51ecc27eeeeeb275e9b0ba9.tar.gz
translated-content-34d315396ca29d7ef51ecc27eeeeeb275e9b0ba9.tar.bz2
translated-content-34d315396ca29d7ef51ecc27eeeeeb275e9b0ba9.zip
Prepare Mozilla section for Markdown conversion (#2980)
* Remove summary * Remove hidden except for copyright notice * Remove spans * Remove font * Remove notranslate * Remove extra id, deleting an untranslated page doing so * Fix links, absolute links, rm internal, titles * Remove external classes * fix headings with name attr * fix some styles and classes * remove useless class reference-values * rm styles in links * Fix code blocks in pre * Remove ltr classes * remove fullwidth-table * Fix various conversion errors and some one offs * Remove nested code/pre/code * Fix notes * Fix warnings * fix dls * fix nested issues in dls * fix images
Diffstat (limited to 'files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle')
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle/index.html31
1 files changed, 15 insertions, 16 deletions
diff --git a/files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle/index.html b/files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle/index.html
index 60db5dbbd1..b18eb58a0b 100644
--- a/files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle/index.html
+++ b/files/fr/mozilla/add-ons/webextensions/api/browseraction/gettitle/index.html
@@ -23,7 +23,7 @@ translation_of: Mozilla/Add-ons/WebExtensions/API/browserAction/getTitle
<h2 id="Syntaxe">Syntaxe</h2>
-<pre class="syntaxbox brush:js">var gettingTitle = browser.browserAction.getTitle(
+<pre class="brush: js">var gettingTitle = browser.browserAction.getTitle(
details // object
)
</pre>
@@ -32,9 +32,8 @@ translation_of: Mozilla/Add-ons/WebExtensions/API/browserAction/getTitle
<dl>
<dt><code>details</code></dt>
- <dd><code>object</code>.</dd>
- <dd>
- <dl class="reference-values">
+ <dd><p><code>object</code><p>
+ <dl>
<dt><code>tabId</code>{{optional_inline}}</dt>
<dd><code>integer</code>. Spécifiez l'onglet pour obtenir le titre.</dd>
<dt><code>windowId</code>{{optional_inline}}</dt>
@@ -60,22 +59,22 @@ translation_of: Mozilla/Add-ons/WebExtensions/API/browserAction/getTitle
<p>Ce code change le titre entre "ceci" et "cela" chaque fois que l'utilisateur clique sur l'action du navigateur :</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">toggleTitle</span><span class="punctuation token">(</span>title<span class="punctuation token">)</span> <span class="punctuation token">{</span>
- <span class="keyword token">if</span> <span class="punctuation token">(</span>title <span class="operator token">==</span> <span class="string token">"this"</span><span class="punctuation token">)</span> <span class="punctuation token">{</span>
- browser<span class="punctuation token">.</span>browserAction<span class="punctuation token">.</span><span class="function token">setTitle</span><span class="punctuation token">(</span><span class="punctuation token">{</span>title<span class="punctuation token">:</span> <span class="string token">"that"</span><span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
- <span class="punctuation token">}</span> <span class="keyword token">else</span> <span class="punctuation token">{</span>
- browser<span class="punctuation token">.</span>browserAction<span class="punctuation token">.</span><span class="function token">setTitle</span><span class="punctuation token">(</span><span class="punctuation token">{</span>title<span class="punctuation token">:</span> <span class="string token">"this"</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>
+<pre class="brush: js">function toggleTitle(title) {
+ if (title == "this") {
+ browser.browserAction.setTitle({title: "that"});
+ } else {
+ browser.browserAction.setTitle({title: "this"});
+ }
+}
-browser<span class="punctuation token">.</span>browserAction<span class="punctuation token">.</span>onClicked<span class="punctuation token">.</span><span class="function token">addListener</span><span class="punctuation token">(</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="operator token">=</span><span class="operator token">&gt;</span> <span class="punctuation token">{</span>
- <span class="keyword token">var</span> gettingTitle <span class="operator token">=</span> browser<span class="punctuation token">.</span>browserAction<span class="punctuation token">.</span><span class="function token">getTitle</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>
- gettingTitle<span class="punctuation token">.</span><span class="function token">then</span><span class="punctuation token">(</span>toggleTitle<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>
+browser.browserAction.onClicked.addListener(() =&gt; {
+ var gettingTitle = browser.browserAction.getTitle({});
+ gettingTitle.then(toggleTitle);
+});</pre>
<p>{{WebExtExamples}}</p>
-<div class="note"><strong>Remerciements :</strong>
+<div class="note"><p><strong>Note :</strong></p>
<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/browserAction"><code>chrome.browserAction</code></a>. Cette documentation est dérivée de <a href="https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/api/browser_action.json"><code>browser_action.json</code></a> dans le code de Chromium code.</p>