mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 582400 - Move the Clear button in the Web Console to a context menu. r+a=dietrich ui-r=limi
This commit is contained in:
parent
341212e7f9
commit
b9fc007bda
@ -1852,11 +1852,6 @@ HeadsUpDisplay.prototype = {
|
||||
|
||||
this.outputNode = this.HUDBox.querySelectorAll(".hud-output-node")[0];
|
||||
|
||||
this.contextMenu = this.HUDBox.querySelector("#" + this.hudId +
|
||||
"-output-contextmenu");
|
||||
this.copyOutputMenuItem = this.HUDBox.
|
||||
querySelector("menuitem[command=cmd_copy]");
|
||||
|
||||
this.chromeWindow = HUDService.
|
||||
getChromeWindowFromContentWindow(this.contentWindow);
|
||||
this.chromeDocument = this.HUDBox.ownerDocument;
|
||||
@ -1951,23 +1946,7 @@ HeadsUpDisplay.prototype = {
|
||||
|
||||
this.setFilterTextBoxEvents();
|
||||
|
||||
this.consoleClearButton = this.makeXULNode("button");
|
||||
this.consoleClearButton.setAttribute("class", "hud-console-clear");
|
||||
this.consoleClearButton.setAttribute("label", this.getStr("btnClear"));
|
||||
this.consoleClearButton.setAttribute("buttonType", "clear");
|
||||
this.consoleClearButton.setAttribute("hudId", this.hudId);
|
||||
var command = "HUDConsoleUI.command(this)";
|
||||
this.consoleClearButton.setAttribute("oncommand", command);
|
||||
|
||||
this.copyOutputMenuItem = this.makeXULNode("menuitem");
|
||||
this.copyOutputMenuItem.setAttribute("label", this.getStr("copyCmd.label"));
|
||||
this.copyOutputMenuItem.setAttribute("accesskey", this.getStr("copyCmd.accesskey"));
|
||||
this.copyOutputMenuItem.setAttribute("key", "key_copy");
|
||||
this.copyOutputMenuItem.setAttribute("command", "cmd_copy");
|
||||
|
||||
this.contextMenu = this.makeXULNode("menupopup");
|
||||
this.contextMenu.setAttribute("id", this.hudId + "-output-contextmenu");
|
||||
this.contextMenu.appendChild(this.copyOutputMenuItem);
|
||||
this.createConsoleMenu(this.consoleWrap);
|
||||
|
||||
this.filterPrefs = HUDService.getDefaultFilterPrefs(this.hudId);
|
||||
|
||||
@ -1978,10 +1957,6 @@ HeadsUpDisplay.prototype = {
|
||||
|
||||
consoleWrap.appendChild(this.outputNode);
|
||||
|
||||
// We want the context menu inside the console wrapper, but outside the
|
||||
// outputNode.
|
||||
outerWrap.appendChild(this.contextMenu);
|
||||
|
||||
outerWrap.appendChild(consoleWrap);
|
||||
|
||||
this.HUDBox.lastTimestamp = 0;
|
||||
@ -2052,8 +2027,6 @@ HeadsUpDisplay.prototype = {
|
||||
toolbar.setAttribute("class", "hud-console-filter-toolbar");
|
||||
toolbar.setAttribute("mode", "text");
|
||||
|
||||
toolbar.appendChild(this.consoleClearButton);
|
||||
|
||||
let pageCategoryTitle = this.getStr("categoryPage");
|
||||
this.addButtonCategory(toolbar, pageCategoryTitle, pageButtons);
|
||||
|
||||
@ -2069,6 +2042,39 @@ HeadsUpDisplay.prototype = {
|
||||
return toolbar;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the context menu on the console, which contains the "clear
|
||||
* console" functionality.
|
||||
*
|
||||
* @param nsIDOMNode aOutputNode
|
||||
* The console output DOM node.
|
||||
* @returns void
|
||||
*/
|
||||
createConsoleMenu: function HUD_createConsoleMenu(aConsoleWrapper) {
|
||||
let menuPopup = this.makeXULNode("menupopup");
|
||||
let id = this.hudId + "-output-contextmenu";
|
||||
menuPopup.setAttribute("id", id);
|
||||
|
||||
let copyItem = this.makeXULNode("menuitem");
|
||||
copyItem.setAttribute("label", this.getStr("copyCmd.label"));
|
||||
copyItem.setAttribute("accesskey", this.getStr("copyCmd.accesskey"));
|
||||
copyItem.setAttribute("key", "key_copy");
|
||||
copyItem.setAttribute("command", "cmd_copy");
|
||||
menuPopup.appendChild(copyItem);
|
||||
|
||||
menuPopup.appendChild(this.makeXULNode("menuseparator"));
|
||||
|
||||
let clearItem = this.makeXULNode("menuitem");
|
||||
clearItem.setAttribute("label", this.getStr("itemClear"));
|
||||
clearItem.setAttribute("hudId", this.hudId);
|
||||
clearItem.setAttribute("buttonType", "clear");
|
||||
clearItem.setAttribute("oncommand", "HUDConsoleUI.command(this);");
|
||||
menuPopup.appendChild(clearItem);
|
||||
|
||||
aConsoleWrapper.appendChild(menuPopup);
|
||||
aConsoleWrapper.setAttribute("context", id);
|
||||
},
|
||||
|
||||
makeButton: function HUD_makeButton(aName, aPrefKey, aType)
|
||||
{
|
||||
var self = this;
|
||||
|
@ -33,8 +33,7 @@ tipConsoleLog=Log calls to console.log()
|
||||
btnGlobal=Global Messages
|
||||
tipGlobal=Toggle Global Message logging
|
||||
localConsole=Local Console
|
||||
btnClear=Clear Console
|
||||
tipClear=Clear the console output
|
||||
itemClear=Clear Console
|
||||
stringFilter=Filter
|
||||
close.button=Close
|
||||
close.accesskey=C
|
||||
|
Loading…
Reference in New Issue
Block a user