親にできない項目はグレイアウトするように

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4839 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-30 17:18:14 +00:00
parent 84d2cf484a
commit 6259357bda

View File

@ -65,11 +65,13 @@ var TreeStyleTabBookmarksProperty = {
var siblings = this._getItemsInFolder(PlacesUtils.bookmarks.getFolderIdForItem(id));
var fragment = document.createDocumentFragment();
var afterCurrent = false;
siblings.forEach(function(aId) {
let item = document.createElement('menuitem');
item.setAttribute('label', PlacesUtils.bookmarks.getItemTitle(aId));
item.setAttribute('value', aId);
if (aId == id) item.setAttribute('disabled', true);
if (!afterCurrent && aId == id) afterCurrent = true;
if (afterCurrent) item.setAttribute('disabled', true);
fragment.appendChild(item);
});
range.insertNode(fragment);
@ -84,7 +86,9 @@ var TreeStyleTabBookmarksProperty = {
break;
}
if (siblings.indexOf(parent) < 0)
var index = siblings.indexOf(parent);
var current = siblings.indexOf(id);
if (index < 0 || index >= current)
this.menulist.selectedItem = this.blankItem;
else
this.menulist.value = parent;