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