这篇翻译不完整。请帮忙从英语翻译这篇文章

WebExtensions bookmarks API允许一个附加组件和浏览器的书签系统交互和操作。您可以用它给页面加书签,获取已有的书签,以及编辑,移除和管理书签。

欲使用此API,一个附件组件必须请求"bookmarks" permission在它的manifest.json文件当中。

类型

bookmarks.BookmarkTreeNodeUnmodifiable
A String enum which specifies why a bookmark or folder is unmodifiable.
bookmarks.BookmarkTreeNode
Represents a bookmark or folder in the bookmarks tree.
bookmarks.CreateDetails
Contains information which is passed to the bookmarks.create() function when creating a new bookmark.

方法

bookmarks.create()
创建一个书签或文件夹。
bookmarks.get()
获得一个或者多个BookmarkTreeNode,提供一个书签的编号或者一个书签编号的数组。
bookmarks.getChildren()
获取指定BookmarkTreeNode节点的所有子节点。
bookmarks.getRecent()
获取最近添加的几个书签。
bookmarks.getSubTree()
获取从指定节点开始的部分书签树。
bookmarks.getTree()
获取整个书签树。
bookmarks.search()
搜索书签树节点,找出匹配的结果。如果以对象方式指定查询,得到的 BookmarkTreeNodes 匹配所有指定的属性。
bookmarks.create()
在指定的上一级文件夹下创建新的书签或文件夹。如果 url 为 null 或者省略,则创建文件夹。
bookmarks.move()
将指定的书签树节点移到指定位置
bookmarks.update()
更新书签或文件夹的属性。只需要指定您需要更改的属性,未指定的属性不会更改。注意:目前只支持“title”和“url”属性。
bookmarks.remove()
删除书签或者空文件夹。
bookmarks.removeTree()
删除整个书签文件夹。
bookmarks.import()
从一个html书签文件导入书签
bookmarks.export()
导出书签为一个html书签文件

事件

bookmarks.onCreated
当书签或文件夹创建时产生。
bookmarks.onRemoved
当删除书签或文件夹时产生。当删除整个文件夹(包括其中所有内容)时,仅为该文件夹发送通知,不为其中任何内容发送通知。
bookmarks.onChanged
一个书签或文件夹更改时发生。注意:目前只有标题和URL更改时会触发这一事件。
bookmarks.onMoved
当书签或文件夹移动到另一个父文件夹中时产生。
bookmarks.onChildrenReordered
文件夹中的子节点在用户界面中调整顺序时产生。调用 move() 不会触发该事件。
bookmarks.onImportBegan
开始导入书签时产生。复杂的事件处理函数在这一事件产生后不应该再处理 onCreated 事件,直到 onImportEnded 事件产生,在此过程中其他事件仍然应该立即处理。
bookmarks.onImportEnded
书签导入结束时产生。

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
BookmarkTreeNodeChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android No support No
BookmarkTreeNodeTypeChrome No support NoEdge No support NoFirefox Full support 57Opera No support NoFirefox Android No support No
BookmarkTreeNodeUnmodifiableChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android No support No
CreateDetailsChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android No support No
createChrome Full support YesEdge Full support 15Firefox Full support 45Opera Full support YesFirefox Android No support No
getChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android No support No
getChildrenChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android No support No
getRecentChrome Full support YesEdge No support NoFirefox Full support 47Opera Full support YesFirefox Android No support No
getSubTreeChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android No support No
getTreeChrome Full support YesEdge Full support 15Firefox Full support 45Opera Full support YesFirefox Android No support No
moveChrome Full support YesEdge Full support 15Firefox Full support 45Opera Full support YesFirefox Android No support No
onChangedChrome Full support YesEdge No support NoFirefox Full support 52Opera Full support YesFirefox Android No support No
onChildrenReorderedChrome Full support YesEdge No support NoFirefox No support NoOpera Full support YesFirefox Android No support No
onCreatedChrome Full support YesEdge No support NoFirefox Full support 52Opera Full support YesFirefox Android No support No
onImportBeganChrome Full support YesEdge No support NoFirefox No support NoOpera Full support YesFirefox Android No support No
onImportEndedChrome Full support YesEdge No support NoFirefox No support NoOpera Full support YesFirefox Android No support No
onMovedChrome Full support YesEdge No support NoFirefox Full support 52Opera Full support YesFirefox Android No support No
onRemovedChrome Full support YesEdge No support NoFirefox Full support 52Opera Full support YesFirefox Android No support No
removeChrome Full support YesEdge Full support 15Firefox Full support 45Opera Full support YesFirefox Android No support No
removeTreeChrome Full support YesEdge Full support 15Firefox Full support 47Opera Full support YesFirefox Android No support No
searchChrome Full support YesEdge No support NoFirefox Full support 47Opera Full support YesFirefox Android No support No
updateChrome Full support YesEdge Full support 15Firefox Full support 45Opera Full support YesFirefox Android No support No

Legend

Full support  
Full support
No support  
No support

Chrome incompatibilities

None.

Example extensions

Acknowledgements

This API is based on Chromium's chrome.bookmarks API. This documentation is derived from bookmarks.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

文档标签和贡献者

此页面的贡献者: popcorner, looch5
最后编辑者: popcorner,