Bug 779616 Switch from DOMAttrModified to MutationObserver r=IanN
This commit is contained in:
Родитель
facabacef7
Коммит
05a0346d0c
|
@ -966,20 +966,18 @@ function InitializeDataSources()
|
||||||
SetupMoveCopyMenus('goMenu', accountManagerDataSource, folderDataSource);
|
SetupMoveCopyMenus('goMenu', accountManagerDataSource, folderDataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnFolderUnreadColAttrModified(event)
|
function AddMutationObserver(callback)
|
||||||
{
|
{
|
||||||
if (event.attrName == "hidden")
|
new MutationObserver(callback).observe(callback(), {attributes: true, attributeFilter: ["hidden"]});
|
||||||
{
|
|
||||||
var folderNameCell = document.getElementById("folderNameCell");
|
|
||||||
var label = {"true": "?folderTreeName", "false": "?folderTreeSimpleName"};
|
|
||||||
folderNameCell.setAttribute("label", label[event.newValue]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnAttachmentColAttrModified(event)
|
function UpdateFolderUnreadCol()
|
||||||
{
|
{
|
||||||
if (event.attrName == "hidden")
|
var folderUnreadCol = document.getElementById("folderUnreadCol");
|
||||||
UpdateAttachmentCol(false);
|
var folderNameCell = document.getElementById("folderNameCell");
|
||||||
|
var label = {true: "?folderTreeName", false: "?folderTreeSimpleName"};
|
||||||
|
folderNameCell.setAttribute("label", label[folderUnreadCol.hidden]);
|
||||||
|
return folderUnreadCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpgradeFolderPaneUI()
|
function UpgradeFolderPaneUI()
|
||||||
|
@ -992,15 +990,7 @@ function UpgradeFolderPaneUI()
|
||||||
function OnLoadFolderPane()
|
function OnLoadFolderPane()
|
||||||
{
|
{
|
||||||
UpgradeFolderPaneUI();
|
UpgradeFolderPaneUI();
|
||||||
|
AddMutationObserver(UpdateFolderUnreadCol);
|
||||||
var folderUnreadCol = document.getElementById("folderUnreadCol");
|
|
||||||
var hidden = folderUnreadCol.getAttribute("hidden");
|
|
||||||
if (hidden != "true")
|
|
||||||
{
|
|
||||||
var folderNameCell = document.getElementById("folderNameCell");
|
|
||||||
folderNameCell.setAttribute("label", "?folderTreeSimpleName");
|
|
||||||
}
|
|
||||||
folderUnreadCol.addEventListener("DOMAttrModified", OnFolderUnreadColAttrModified, false);
|
|
||||||
|
|
||||||
//Add folderDataSource and accountManagerDataSource to folderPane
|
//Add folderDataSource and accountManagerDataSource to folderPane
|
||||||
var database = GetFolderDatasource();
|
var database = GetFolderDatasource();
|
||||||
|
@ -1032,18 +1022,16 @@ function UpgradeThreadPaneUI()
|
||||||
function OnLoadThreadPane()
|
function OnLoadThreadPane()
|
||||||
{
|
{
|
||||||
UpgradeThreadPaneUI();
|
UpgradeThreadPaneUI();
|
||||||
UpdateAttachmentCol(true);
|
AddMutationObserver(UpdateAttachmentCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateAttachmentCol(aFirstTimeFlag)
|
function UpdateAttachmentCol()
|
||||||
{
|
{
|
||||||
var attachmentCol = document.getElementById("attachmentCol");
|
var attachmentCol = document.getElementById("attachmentCol");
|
||||||
var threadTree = GetThreadTree();
|
var threadTree = GetThreadTree();
|
||||||
threadTree.setAttribute("noattachcol", attachmentCol.getAttribute("hidden"));
|
threadTree.setAttribute("noattachcol", attachmentCol.getAttribute("hidden"));
|
||||||
if (aFirstTimeFlag)
|
threadTree.treeBoxObject.clearStyleAndImageCaches();
|
||||||
attachmentCol.addEventListener("DOMAttrModified", OnAttachmentColAttrModified, false);
|
return attachmentCol;
|
||||||
else
|
|
||||||
threadTree.treeBoxObject.clearStyleAndImageCaches();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnLoadLocationTree()
|
function OnLoadLocationTree()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче