mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Remove unnecessary utilities to enable/disable ui elements. fix by neil@parkwaycc.co.uk, b=144955, r=cmanske, sr=hewitt
This commit is contained in:
parent
099a01e28d
commit
60d424d184
@ -39,7 +39,7 @@ function EditorFillContextMenu(event, contextMenuNode)
|
||||
InitRemoveStylesMenuitems("removeStylesMenuitem_cm", "removeLinksMenuitem_cm", "removeNamedAnchorsMenuitem_cm");
|
||||
|
||||
// This item is present only in context menu:
|
||||
DisableItem("editLink_cm", objectName != "href");
|
||||
SetElementEnabledById("editLink_cm", objectName == "href");
|
||||
|
||||
var inCell = IsInTableCell();
|
||||
// Set appropriate text for join cells command
|
||||
|
@ -1768,7 +1768,7 @@ function BuildRecentMenu(savePrefs)
|
||||
}
|
||||
|
||||
// Disable menu item if no entries
|
||||
DisableItem("menu_RecentFiles", disableMenu);
|
||||
SetElementEnabledById("menu_RecentFiles", !disableMenu);
|
||||
}
|
||||
|
||||
function AppendRecentMenuitem(menupopup, title, url, menuIndex)
|
||||
@ -2010,8 +2010,8 @@ function EditorInitToolbars()
|
||||
//Hide the edit mode toolbar
|
||||
gEditModeBar.setAttribute("hidden", "true");
|
||||
|
||||
DisableItem("cmd_viewFormatToolbar", true);
|
||||
DisableItem("cmd_viewEditModeToolbar", true);
|
||||
SetElementEnabledById("cmd_viewFormatToolbar", false);
|
||||
SetElementEnabledById("cmd_viewEditModeToolbar", false);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2429,7 +2429,6 @@ function InitRemoveStylesMenuitems(removeStylesId, removeLinksId, removeNamedAnc
|
||||
// Change wording of menuitems depending on selection
|
||||
var stylesItem = document.getElementById(removeStylesId);
|
||||
var linkItem = document.getElementById(removeLinksId);
|
||||
var namedAnchorsItem = document.getElementById(removeNamedAnchorsId);
|
||||
|
||||
var isCollapsed = editorShell.editorSelection.isCollapsed;
|
||||
if (stylesItem)
|
||||
@ -2445,13 +2444,10 @@ function InitRemoveStylesMenuitems(removeStylesId, removeLinksId, removeNamedAnc
|
||||
|
||||
// Disable if not in a link, but always allow "Remove"
|
||||
// if selection isn't collapsed since we only look at anchor node
|
||||
DisableItem(removeLinksId, isCollapsed && !window.editorShell.GetElementOrParentByTagName("href", null));
|
||||
}
|
||||
if (namedAnchorsItem)
|
||||
{
|
||||
// Disable if selection is collapsed
|
||||
DisableItem(removeNamedAnchorsId, isCollapsed);
|
||||
SetElementEnabled(linkItem, !isCollapsed || window.editorShell.GetElementOrParentByTagName("href", null));
|
||||
}
|
||||
// Disable if selection is collapsed
|
||||
SetElementEnabledById(removeNamedAnchorsId, !isCollapsed);
|
||||
}
|
||||
|
||||
function goUpdateTableMenuItems(commandset)
|
||||
|
@ -205,28 +205,6 @@ function SetElementEnabled(element, doEnable)
|
||||
}
|
||||
}
|
||||
|
||||
function SetElementHidden(element, hide)
|
||||
{
|
||||
if (element)
|
||||
{
|
||||
if (hide)
|
||||
element.setAttribute("hidden", "true");
|
||||
else
|
||||
element.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
function DisableItem(id, disable)
|
||||
{
|
||||
var item = document.getElementById(id);
|
||||
if (item)
|
||||
{
|
||||
if (disable != (item.getAttribute("disabled") == "true"))
|
||||
item.setAttribute("disabled", disable ? "true" : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************* Services / Prefs ***************/
|
||||
|
||||
function GetIOService()
|
||||
|
Loading…
Reference in New Issue
Block a user