Firefox75時点での内容
resource://gre/modules/Bookmarks.jsm
jsmを直接importするより、PlacesUtils.bookmarksでアクセスする方が良い?
ファイル冒頭の説明文の翻訳
※ほぼ機械翻訳
* This module provides an asynchronous API for managing bookmarks.
このモジュールは、ブックマークを管理するための非同期APIを提供します。
* Bookmarks are organized in a tree structure, and include URLs, folders and
* separators. Multiple bookmarks for the same URL are allowed.
ブックマークはツリー構造で編成されており、URL、フォルダ、セパレータが含まれています。
同じURLの複数のブックマークが許可されます。
* Note that if you are handling bookmarks operations in the UI, you should
* not use this API directly, but rather use PlacesTransactions.jsm, so that
* any operation is undo/redo-able.
* Each bookmark-item is represented by an object having the following
* properties:
*
* - guid (string)
* The globally unique identifier of the item.
* - parentGuid (string)
* The globally unique identifier of the folder containing the item.
* This will be an empty string for the Places root folder.
* - index (number)
* The 0-based position of the item in the parent folder.
* - dateAdded (Date)
* The time at which the item was added.
* - lastModified (Date)
* The time at which the item was last modified.
* - type (number)
* The item's type, either TYPE_BOOKMARK, TYPE_FOLDER or TYPE_SEPARATOR.
各ブックマークアイテムは、次のプロパティを持つオブジェクトによって表されます。
- guid (文字列):アイテムのグローバル一意識別子。
- parentGuid (文字列):アイテムを含むフォルダーのグローバル一意識別子。Placesルートフォルダは空の文字列になる。
- index (数字):親フォルダー内のアイテムの0から始まる位置。
- dateAdded (Date):アイテムが追加された時刻。
- lastModified (Date):アイテムが最後に変更された時刻。
- type (数字):アイテムのタイプ。TYPE_BOOKMARK、TYPE_FOLDER、またはTYPE_SEPARATOR。
* The following properties are only valid for URLs or folders.
*
* - title (string)
* The item's title, if any. Empty titles and null titles are considered
* the same. Titles longer than DB_TITLE_LENGTH_MAX will be truncated.
次のプロパティは、URLまたはフォルダに対してのみ有効です。
- title (文字列):アイテムのタイトル(ある場合)。空のタイトルとnullタイトルは同じと見なされる。DB_TITLE_LENGTH_MAX より長いタイトルは切り捨てられる。
* The following properties are only valid for URLs:
*
* - url (URL, href or nsIURI)
* The item's URL. Note that while input objects can contains either
* an URL object, an href string, or an nsIURI, output objects will always
* contain an URL object.
* An URL cannot be longer than DB_URL_LENGTH_MAX, methods will throw if a
* longer value is provided.
次のプロパティは、URLに対してのみ有効です。
- url (URL, href or nsIURI): アイテムのURL。入力オブジェクトにはURLオブジェクト、href文字列、またはnsIURIのいずれかを含めることができるが、出力オブジェクトには常にURLオブジェクトが含まれることに注意。URLは DB_URL_LENGTH_MAX より長くすることはできない。長い値を指定すると、メソッドがスローする。
* Each successful operation notifies through the nsINavBookmarksObserver
* interface. To listen to such notifications you must register using
* nsINavBookmarksService addObserver and removeObserver methods.
* Note that bookmark addition or order changes won't notify onItemMoved for
* items that have their indexes changed.
* Similarly, lastModified changes not done explicitly (like changing another
* property) won't fire an onItemChanged notification for the lastModified
* property.
* @see nsINavBookmarkObserver
成功した各操作は、nsINavBookmarksObserver インターフェースを通じて通知します。
そのような通知を聞くには、nsINavBookmarksService の addObserver および removeObserver メソッドを使用して登録する必要があります。
ブックマークの追加や順序の変更は、インデックスが変更されたアイテムの onItemMoved に通知されないことに注意してください。
同様に、明示的に行われていない lastModified の変更(別のプロパティの変更など)は、lastModified プロパティの onItemChanged 通知をトリガーしません。
@参照:
nsINavBookmarkObserver
メソッド
- isVirtualRootItem(guid)
- 返り値:真偽値
- 4つの仮想ルートフォルダかどうか
- getLocalizedTitle(info)
- 返り値:文字列
- 4つのユーザーコンテンツルートフォルダのローカライズ名を取得
- insert(info)
- 返り値:promise
- ブックマークアイテムを既存のブックマークツリーに挿入
- insertTree(tree, options)
- 返り値:promise
- ブックマークツリーを既存のブックマークツリーに挿入
- update(info)
- 返り値:promise
- ブックマークアイテムを更新
- moveToFolder(guids, parentGuid, index, source)
- 返り値:promise
- 複数のブックマークアイテムを特定のフォルダに移動
- remove(guidOrInfo, options = {})
- 返り値:promise
- ブックマークアイテムを削除
- eraseEverything(options = {})
- 返り値:promise
- すべてのブックマークを削除し、ブックマークストレージを空のツリーにリセットする。
- getRecent(numberOfItems)
- 返り値:promise
- 最近ブックマークしたアイテムのリストを返す。
- 実際のブックマークのみが含まれ、フォルダ、セパレーター、およびクエリを除外する。
- fetch(guidOrInfo, onResult = null, options = {})
- 返り値:promise(resolve値:ブックマークアイテム)
- ブックマークアイテムの情報を取得する。
- fetchTree(guid = "", options = {})
- 返り値:promise
- ブックマークアイテムのオブジェクト表現を、その子孫がある場合はその全てと共に取得する。
- async fetchTags()
- 返り値:promise
- アルファベット順にソートされたすべての既存のタグを取得する。
- reorder(parentGuid, orderedChildrenGuids, options = {})
- 返り値:promise
- GUIDの配列に基づいてフォルダの内容を並べ替える。
- search(query)
- 返り値:promise(resolve値:見つかったブックマークアイテムの配列)
- ブックマークをURLまたはタイトルで検索する。
プロパティ
プロパティ |
値 |
TYPE_BOOKMARK |
1 |
TYPE_FOLDER |
2 |
TYPE_SEPARATOR |
3 |
|
SYNC_STATUS |
|
|
DEFAULT_INDEX |
-1 |
MAX_TAG_LENGTH |
100 |
|
SOURCES |
|
|
rootGuid |
"root________" |
menuGuid |
"menu________" |
toolbarGuid |
"toolbar_____" |
unfiledGuid |
"unfiled_____" |
mobileGuid |
"mobile______" |
tagsGuid |
"tags________" |
|
userContentRoots |
4つのユーザーコンテンツルートフォルダのGUIDの配列 |
|
virtualMenuGuid |
"menu_______v" |
virtualToolbarGuid |
"toolbar____v" |
virtualUnfiledGuid |
"unfiled____v" |
virtualMobileGuid |
"mobile_____v" |
最終更新:2020年05月02日 19:59