Labs/Jetpack/Reboot/JEP/112: Difference between revisions

Jump to navigation Jump to search
→‎Example Usage: Removed |new| usage, per discussion with Myk on IRC and mailing list
(→‎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 = new contextMenu.Item({
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 = new contextMenu.Menu({
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: [
     new contextMenu.Item({
     contextMenu.Item({
       label: "Google",
       label: "Google",
       data: "http://www.google.com/search?q="
       data: "http://www.google.com/search?q="
     }),
     }),
     new contextMenu.Item({
     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 = new contextMenu.Item({
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 = new contextMenu.Item({
var editImagesItem = contextMenu.Item({
   label: "Edit Page Images",
   label: "Edit Page Images",
   onCommand: function (context) {
   onCommand: function (context) {
Confirmed users
764

edits

Navigation menu