-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zh-cn]: create the translation of
browserSettings.newTabPosition
p…
…roperty (#21235) Co-authored-by: A1lo <[email protected]>
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...zh-cn/mozilla/add-ons/webextensions/api/browsersettings/newtabposition/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: browserSettings.newTabPosition | ||
slug: Mozilla/Add-ons/WebExtensions/API/browserSettings/newTabPosition | ||
l10n: | ||
sourceCommit: 43e3ff826b7b755b05986c99ada75635c01c187c | ||
--- | ||
|
||
{{AddonSidebar}} | ||
|
||
一个 {{WebExtAPIRef("types.BrowserSetting", "BrowserSetting")}} 对象,可用于控制新打开标签页相对于已打开标签页的位置。 | ||
|
||
其底层值是一个字符串,可以取三个值中的一个: | ||
|
||
- “afterCurrent”:在当前标签页旁边打开所有新标签页。 | ||
- “relatedAfterCurrent”:默认值。如果新标签页与当前标签页相关联(例如,通过当前标签页中的链接打开),则在当前标签页旁边打开新标签页。否则,在标签栏的末尾打开新标签页。 | ||
- “atEnd”:在标签栏的末尾打开所有新标签页。 | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} | ||
|
||
## 示例 | ||
|
||
以下代码将值设置为“afterCurrent”,然后记录新值: | ||
|
||
```js | ||
async function setAfterCurrent() { | ||
let result = await browser.browserSettings.newTabPosition.set({ | ||
value: "afterCurrent", | ||
}); | ||
console.log(`结果:${result}`); | ||
let newValue = await browser.browserSettings.newTabPosition.get({}); | ||
console.log(`新值:${newValue.value}`); | ||
} | ||
``` | ||
|
||
{{WebExtExamples}} |