Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created October 12, 2018 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gozala/ac6d778e49547af676b16de4b2a15a79 to your computer and use it in GitHub Desktop.
Save Gozala/ac6d778e49547af676b16de4b2a15a79 to your computer and use it in GitHub Desktop.
narrate hack
var extension = {id:"7cc71529-5b04-d84b-8473-aca5e6791051"}
var panel = document.createXULElement("panel")
panel.classList.add("popup-notification-panel");
panel.setAttribute("followanchor", true)
panel.setAttribute("type", "arrow")
popupnotification = document.createXULElement("popupnotification")
popupnotification.setAttribute("label", "");
popupnotification.setAttribute("name", "label name");
popupnotification.setAttribute("endlabel", "An end label");
popupnotification.setAttribute("id", "narrate-experiment-notification");
popupnotification.setAttribute("popupid", "narrate-experiment-popup");
popupnotification.setAttribute("buttonlabel", "main action label");
popupnotification.setAttribute("buttonhighlight", true);
// popupnotification.setAttribute("buttoncommand", "PopupNotifications._onButtonEvent(event, 'buttoncommand');");
// popupnotification.setAttribute("dropmarkerpopupshown", "PopupNotifications._onButtonEvent(event, 'dropmarkerpopupshown');");
// popupnotification.setAttribute("learnmoreclick", "PopupNotifications._onButtonEvent(event, 'learnmoreclick');");
// popupnotification.setAttribute("menucommand", "PopupNotifications._onMenuCommand(event);");
popupnotification.setAttribute("icon", `moz-extension://${extension.id}/listen-without-label.svg`);
popupnotification.setAttribute("closebuttonhidden", "true");
popupnotification.setAttribute("checkboxhidden", "true");
popupnotification.setAttribute("secondarybuttonlabel", "secondary button label");
popupnotification.setAttribute("dropmarkerhidden", "true")
// popupnotification.setAttribute("secondarybuttoncommand", "PopupNotifications._onButtonEvent(event, 'secondarybuttoncommand');");
content = document.createXULElement("popupnotificationcontent")
description = document.createXULElement("description")
description.textContent = "Some actual message"
content.appendChild(description)
popupnotification.appendChild(description)
panel.appendChild(popupnotification)
document.querySelector("#mainPopupSet").appendChild(panel)
var anchor = document.querySelector("#reader-mode-button")
PanelMultiView.openPopup(panel, anchor, "bottomcenter topleft")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment