split methods
This commit is contained in:
parent
32c45ab150
commit
11080de1e8
@ -34,26 +34,32 @@ var TreeStyleTabBookmarksService = {
|
|||||||
this._observing = false;
|
this._observing = false;
|
||||||
|
|
||||||
this.BookmarksService.removeObserver(this);
|
this.BookmarksService.removeObserver(this);
|
||||||
|
this.handleNewBookmarksFromTabs(this._addingBookmarks, this._addingBookmarkTreeStructure);
|
||||||
|
this._addingBookmarks = [];
|
||||||
|
this._addingBookmarkTreeStructure = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
handleNewBookmarksFromTabs : function TSTBMService_handleNewBookmarksFromTabs(aBookarmks, aTreeStructure)
|
||||||
|
{
|
||||||
// this is adding bookmark folder from tabs, so ignroe the first item!
|
// this is adding bookmark folder from tabs, so ignroe the first item!
|
||||||
if (
|
if (
|
||||||
this._addingBookmarks.length == this._addingBookmarkTreeStructure.length+1 &&
|
aBookarmks.length == aTreeStructure.length+1 &&
|
||||||
this.BookmarksService.getItemType(this._addingBookmarks[0].id) == this.BookmarksService.TYPE_FOLDER
|
this.BookmarksService.getItemType(aBookarmks[0].id) == this.BookmarksService.TYPE_FOLDER
|
||||||
)
|
) {
|
||||||
this._addingBookmarks.shift();
|
aBookarmks.shift();
|
||||||
|
}
|
||||||
|
else if (aBookarmks.length != aTreeStructure.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this._addingBookmarks.length == this._addingBookmarkTreeStructure.length) {
|
aBookarmks.forEach(function(aItem, aIndex) {
|
||||||
this._addingBookmarks.forEach(function(aItem, aIndex) {
|
let index = aTreeStructure[aIndex];
|
||||||
let index = this._addingBookmarkTreeStructure[aIndex];
|
|
||||||
PlacesUtils.setAnnotationsForItem(aItem.id, [{
|
PlacesUtils.setAnnotationsForItem(aItem.id, [{
|
||||||
name : this.kPARENT,
|
name : this.kPARENT,
|
||||||
value : (index > -1 ? this._addingBookmarks[index].id : -1 ),
|
value : (index > -1 ? aBookarmks[index].id : -1 ),
|
||||||
expires : PlacesUtils.annotations.EXPIRE_NEVER
|
expires : PlacesUtils.annotations.EXPIRE_NEVER
|
||||||
}]);
|
}]);
|
||||||
}, this);
|
}, this);
|
||||||
}
|
|
||||||
this._addingBookmarks = [];
|
|
||||||
this._addingBookmarkTreeStructure = [];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkTabSubtree : function TSTBMService_bookmarkTabSubtree(aTabOrTabs)
|
bookmarkTabSubtree : function TSTBMService_bookmarkTabSubtree(aTabOrTabs)
|
||||||
|
Loading…
Reference in New Issue
Block a user