diff options
author | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-09-26 13:11:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 13:11:47 +0200 |
commit | 6772831200d14c2436aea2d0c837f40dbf12156f (patch) | |
tree | e41b587ce1834baf8c737454c0ae110ebc8208ca /files/fr/web/api/event/timestamp/index.html | |
parent | 707941dbecfb0cc1e75dd32d2dacac4d1845bf2c (diff) | |
download | translated-content-6772831200d14c2436aea2d0c837f40dbf12156f.tar.gz translated-content-6772831200d14c2436aea2d0c837f40dbf12156f.tar.bz2 translated-content-6772831200d14c2436aea2d0c837f40dbf12156f.zip |
Prepare Web API section for Markdown conversion (#2464)
* Remove summary classes and ids
* Remove unecessary hidden
* Remove useless span filled with useless attributes / ids
* Remove useless font
* Remove notranslate
* Remove id in other elements than headings
* Remove name attributes
* Remove <pre><code> for JS w/ language-js class
* Remove <pre><code> for HTML w/ language-html class
* Remove <pre><code> for other lang w/ language-* class
* Rm highlighted line in code samples
* fix links, internal, external, absolute URLs
* missing file from last commit
* Fix styles errors apart from table + some classes
* Fix notes and warnings (+ some other :x)
* fix typo during merge which broke a doc
* aand forgot a conflict
* fix remaining classes of errors except dls and images
* Fix dls
* Fix images (deki/mozillademos) and remaining style issues
* Remove script tag from svg file
* Remove script tag from svg fileS
* Compress SVG files for CI
Diffstat (limited to 'files/fr/web/api/event/timestamp/index.html')
-rw-r--r-- | files/fr/web/api/event/timestamp/index.html | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/files/fr/web/api/event/timestamp/index.html b/files/fr/web/api/event/timestamp/index.html index b3e2333120..c4bc3ffe6a 100644 --- a/files/fr/web/api/event/timestamp/index.html +++ b/files/fr/web/api/event/timestamp/index.html @@ -14,65 +14,65 @@ translation_of: Web/API/Event/timeStamp <p>Retourne le temps (en millisecondes) à partir duquel l'événement a été créé.</p> <div class="note"> -<p>Note : Cette propriété fonctionne seulement si le système d'évènements le prend en charge pour des évènements particuliers.</p> +<p><strong>Note :</strong> Cette propriété fonctionne seulement si le système d'évènements le prend en charge pour des évènements particuliers.</p> </div> -<h2 id="Syntax" name="Syntax">Syntaxe</h2> +<h2 id="Syntax">Syntaxe</h2> <pre class="syntaxbox">event.timeStamp </pre> -<h3 id="Examples" name="Examples">Valeur</h3> +<h3 id="Examples">Valeur</h3> <p>Cette valeur est un nombre de millisecondes écoulées depuis le début du temps de vie du document courant jusqu'à la création de l'évènement.</p> <p>Dans les nouvelles implémentations, la valeur est un {{domxref("DOMHighResTimeStamp")}} dont la précision est de 5 microsecondes (0,005 ms). Dans les implémentations plus anciennes, la valeur est un {{domxref("DOMTimeStamp")}} de précision d'une milliseconde.</p> -<h2 id="Examples" name="Examples">Exemple</h2> +<h2 id="Examples">Exemple</h2> <h3 id="HTML">HTML</h3> -<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token"><</span>p</span><span class="punctuation token">></span></span> +<pre class="brush: html"><p> Focus this iframe and press any key to get the current timestamp for the keypress event. -<span class="tag token"><span class="tag token"><span class="punctuation token"></</span>p</span><span class="punctuation token">></span></span> -<span class="tag token"><span class="tag token"><span class="punctuation token"><</span>p</span><span class="punctuation token">></span></span>timeStamp: <span class="tag token"><span class="tag token"><span class="punctuation token"><</span>span</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span><span class="punctuation token">></span></span>-<span class="tag token"><span class="tag token"><span class="punctuation token"></</span>span</span><span class="punctuation token">></span></span><span class="tag token"><span class="tag token"><span class="punctuation token"></</span>p</span><span class="punctuation token">></span></span></code></pre> +</p> +<p>timeStamp: <span id="time">-</span></p></pre> <h3 id="JavaScript">JavaScript</h3> -<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">getTime</span><span class="punctuation token">(</span>event<span class="punctuation token">)</span> <span class="punctuation token">{</span> - <span class="keyword token">var</span> time <span class="operator token">=</span> document<span class="punctuation token">.</span><span class="function token">getElementById</span><span class="punctuation token">(</span><span class="string token">"time"</span><span class="punctuation token">)</span><span class="punctuation token">;</span> - time<span class="punctuation token">.</span>firstChild<span class="punctuation token">.</span>nodeValue <span class="operator token">=</span> event<span class="punctuation token">.</span>timeStamp<span class="punctuation token">;</span> -<span class="punctuation token">}</span> -document<span class="punctuation token">.</span>body<span class="punctuation token">.</span><span class="function token">addEventListener</span><span class="punctuation token">(</span><span class="string token">"keypress"</span><span class="punctuation token">,</span> getTime<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre> +<pre class="brush: js">function getTime(event) { + var time = document.getElementById("time"); + time.firstChild.nodeValue = event.timeStamp; +} +document.body.addEventListener("keypress", getTime);</pre> <h3 id="Résultat">Résultat</h3> <p>{{EmbedLiveSample("Example", "100%", 100)}}</p> -<h2 id="Notes" name="Notes">Précision du temps réduite</h2> +<h2 id="Notes">Précision du temps réduite</h2> <p>Pour offrir une protection contre les attaques de synchronisation et les empreintes digitales, la précision de <code>event.timeStamp</code> peut être arrondie en fonction des paramètres du navigateur.<br> Dans Firefox, la préférence <code>privacy.reduceTimerPrecision</code> est activée et à 20 us par défaut dans Firefox 59 ; en version 60 ce sera 2 ms.</p> -<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="comment token">// Précision du temps réduite (2ms) dans Firefox 60</span> -event<span class="punctuation token">.</span>timeStamp<span class="punctuation token">;</span> -<span class="comment token">// 1519211809934</span> -<span class="comment token">// 1519211810362</span> -<span class="comment token">// 1519211811670</span> -<span class="comment token">// ...</span> +<pre class="brush: js">// Précision du temps réduite (2ms) dans Firefox 60 +event.timeStamp; +// 1519211809934 +// 1519211810362 +// 1519211811670 +// ... -<span class="comment token">// Précision du temps réduite avec `privacy.resistFingerprinting` activé</span> -event<span class="punctuation token">.</span>timeStamp<span class="punctuation token">;</span> -<span class="comment token">// 1519129853500</span> -<span class="comment token">// 1519129858900</span> -<span class="comment token">// 1519129864400</span> -<span class="comment token">// ...</span></code></pre> +// Précision du temps réduite avec `privacy.resistFingerprinting` activé +event.timeStamp; +// 1519129853500 +// 1519129858900 +// 1519129864400 +// ...</pre> <p>Dans Firefox, vous pouvez aussi activer <code>privacy.resistFingerprinting</code>, la précision sera de 100 ms ou la valeur de <code>privacy.resistFingerprinting.reduceTimerPrecision.microseconds</code>, selon la valeur la plus grande.</p> -<h2 id="Specifications" name="Specifications">Spécifications</h2> +<h2 id="Specifications">Spécifications</h2> <table class="standard-table"> <thead> |