Confirmed users
764
edits
(→Example Usage: Removed |new| usage, per discussion with Myk on IRC and mailing list) |
|||
Line 227: | Line 227: | ||
// Add "Edit Image" on images. | // Add "Edit Image" on images. | ||
var imgCssSelector = "img"; | var imgCssSelector = "img"; | ||
var editImageItem = | var editImageItem = contextMenu.Item({ | ||
label: "Edit Image", | label: "Edit Image", | ||
onCommand: function (context) { | onCommand: function (context) { | ||
Line 244: | Line 244: | ||
return !!selection.text; | return !!selection.text; | ||
} | } | ||
var searchMenu = | var searchMenu = contextMenu.Menu({ | ||
label: "Search", | label: "Search", | ||
onCommand: function (context, data) { | onCommand: function (context, data) { | ||
Line 251: | Line 251: | ||
context: selectionExists, | context: selectionExists, | ||
items: [ | items: [ | ||
contextMenu.Item({ | |||
label: "Google", | label: "Google", | ||
data: "http://www.google.com/search?q=" | data: "http://www.google.com/search?q=" | ||
}), | }), | ||
contextMenu.Item({ | |||
label: "Wikipedia", | label: "Wikipedia", | ||
data: "http://en.wikipedia.org/wiki/" | data: "http://en.wikipedia.org/wiki/" | ||
Line 265: | Line 265: | ||
// Add "Edit Page Source" when the menu is invoked on a | // Add "Edit Page Source" when the menu is invoked on a | ||
// non-interactive portion of the page. | // non-interactive portion of the page. | ||
var pageSourceItem = | var pageSourceItem = contextMenu.Item({ | ||
label: "Edit Page Source", | label: "Edit Page Source", | ||
onCommand: function (context) { | onCommand: function (context) { | ||
Line 278: | Line 278: | ||
return !!context.document.querySelector("img"); | return !!context.document.querySelector("img"); | ||
} | } | ||
var editImagesItem = | var editImagesItem = contextMenu.Item({ | ||
label: "Edit Page Images", | label: "Edit Page Images", | ||
onCommand: function (context) { | onCommand: function (context) { |