Informations transmises à l'écouteur d'événement menus.onClicked
lorsque vous cliquez sur un élément de menu.
Type
Les valeurs de ce type sont des objets. Ils contiennent les propriétés suivantes :
bookmarkId
Facultatifstring
. L'ID du signet dans lequel le menu contextuel a été cliqué.***button
Facultatifinteger
. Quel bouton de la souris a été enfoncé. Les valeurs sont les mêmes que pourMouseEvent.button
.checked
Facultatifboolean
. Un flag indiquant si une case à cocher ou un élément radio a été vérifié après avoir été cliqué.editable
boolean
. Un indicateur indiquant si l'élément est modifiable: par exemple, s'il s'agit d'un textarea.frameId
Facultatifinteger
. L'ID de l'image dans laquelle l'élément a été cliqué. L'ID de trame peut être utilisé dans d'autres API acceptant des ID de trame, tels quetabs.sendMessage()
. Si l'élément a été cliqué dans le document de niveau supérieur,par exemple, danstools_menu
outab
context),frameId
n'estpas défini
.frameUrl
Facultatifstring
. L'URL du cadre de l'élément sur lequel le menu contextuel a été cliqué, s'il était dans un cadrelinkText
Facultatifstring
. Si l'élément est un lien, le texte du lien. Si le lien ne contient aucun texte, l'URL elle-même est donnée ici.linkUrl
Facultatifstring
. Si l'élément est un lien, l'URL vers laquelle il pointe.mediaType
Facultatifstring
. Une de "image", "video", ou "audio" si le menu contextuel a été activé sur l'un de ces types d'éléments.menuItemId
ouinteger
. ID de l'élément de menu sur lequel vous avez cliqué.string
modifiers
deArray
. Un tableau contenant toutes les touches de modification qui ont été pressées lorsque l'élément a été cliqué. Les valeurs possibles sont : "Alt", "Command", "Ctrl", "MacCtrl", et "Shift". Sur un Mac, si l'utilisateur a la touche Ctrl enfoncée, alors "Ctrl" et "MacCtrl" sont inclus.string
pageUrl
Facultatifstring
. L'URL de la page sur laquelle l'élément de menu a été cliqué. Cette propriété n'est pas présente si le clic s'est produit dans un contexte où il n'y a pas de page en cours, comme dans le cas d'une action du navigateur.parentMenuItemId
Facultatif
ouinteger
. L'ID parent, le cas échéant, pour l'élément cliqué.string
selectionText
Facultatifstring
. Si du texte a été sélectionné dans la page, il contient le texte sélectionné.srcUrl
Facultatifstring
. Sera présent pour les éléments avec une URL "src".targetElementId
Facultatifinteger
. Un identificateur de l'élément, le cas échéant, sur lequel le menu contextuel a été créé. Utilisezmenus.getTargetElement()
dans le script de contenu pour localiser l'élément. Notez que ce n'est pas l'attribut id de l'élément page.viewType
FacultatifViewType
. Le type de vue de l'extension.wasChecked
Facultatifboolean
. Un indicateur indiquant si une case à cocher ou un élément radio a été vérifié avant d'avoir cliqué.
Compatibilité du navigateur
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Remerciements
Cette API est basée sur l'API chrome.contextMenus
de chromium. Cette documentation est dérivée de context_menus.json
dans le code Chromium.
// 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.