Firefox 瀏覽器附加元件
  • 擴充套件
  • 佈景主題
    • 用於 Firefox
    • 字典與語言套件
    • 其他瀏覽器網站
    • Android 版的附加元件
登入
Open links quietly 預覽

Open links quietly 作者: martin

Open links in muted tabs from the right-click context menu. Also with "Quiet Mode".

0 (0 reviews)0 (0 reviews)
1 User1 User
必須使用 Firefox 才能使用此擴充套件
下載 Firefox 並安裝擴充套件
下載檔案

擴充套件後設資料

畫面擷圖
Open a link quietlyQuiet Mode
關於此擴充套件
This extension allows you to open links, bookmarks and bookmark folders in muted tabs, from the right-click context menu.

It adds a button on the tab bar that turns on/off the "Quiet Mode".
When Quiet Mode is ON all new tabs are automatically muted.

This add-on needs the permission to read your bookmarks. If you're worried about that, just read the source code. It will take you less than a minute.

BACKGROUND.JS

let quietMode = false;

function onCreatedItem() {
if (browser.runtime.lastError) {
console.log(`Error: ${browser.runtime.lastError}`);
}
}

function onError(error) {
console.log(`Error: ${error}`);
}

function onCreatedTab(tab) {
browser.tabs.update(tab.id, {muted: true});
}

function createTab(tabUrl) {
var creating = browser.tabs.create({
url:tabUrl,
active:false
});
creating.then(onCreatedTab, onError);
}

function getFolderChildren(bookmarkId) {
var gettingChildren = browser.bookmarks.getChildren(bookmarkId);
gettingChildren.then(onFulfilledFolder, onError);
}

function onFulfilledFolder(children) {
for (child of children) {
if (child.url){
createTab(child.url);
} else {
getFolderChildren(child.id);
}
}
}

function onFulfilled(bookmarks) {
if (bookmarks[0].url) {
createTab(bookmarks[0].url)
} else {
getFolderChildren(bookmarks[0].id);
}
}

function handleCreated(tab) {
if (quietMode) {
onCreatedTab(tab);
}
}

function toggleQuietMode(isEnabled){
if (!isEnabled) {
browser.browserAction.setTitle({title: "Back to normal"});
browser.browserAction.setIcon({path: "tab-audio-muted.svg"});
quietMode = true;
} else {
browser.browserAction.setTitle({title: null});
browser.browserAction.setIcon({path: null})
quietMode = false;
}
}

browser.menus.create({
id: "open-link-muted",
title: "Open link quietly",
contexts: ["link"]
}, onCreatedItem);

browser.menus.create({
id: "open-bookmark-muted",
title: "Open quietly",
contexts: ["bookmark"]
}, onCreatedItem);

browser.menus.onClicked.addListener((info, tab) => {
switch (info.menuItemId) {
case "open-link-muted":
createTab(info.linkUrl);
break;
case "open-bookmark-muted":
var gettingBookmarks = browser.bookmarks.get(info.bookmarkId);
gettingBookmarks.then(onFulfilled, onError);
break;
}
});

browser.browserAction.onClicked.addListener(() => {
toggleQuietMode(quietMode);
});

browser.tabs.onCreated.addListener((tab) => {
if (quietMode) {
handleCreated(tab);
}
});

MANIFEST.JSON

{
"manifest_version": 2,
"name":"Open link quietly",
"description":"Open links in muted tabs from the right-click context menu. Also with \"quiet mode\".",
"version":"0",
"developer": {
"name": "martin"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"menus",
"bookmarks"
],
"browser_action": {
"browser_style": true,
"default_icon": "tab-audio-playing.svg",
"default_title": "Open links/tabs quietly",
"default_area": "tabstrip"
}
}
由 1 位評論者給出 0 分
登入後即可幫此擴充套件評分
目前沒有評分

已儲存星等

5
0
4
0
3
0
2
0
1
0
還沒有評論
權限與資料了解更多

必要權限:

  • 讀取或修改書籤
更多資訊
版本
1
大小
9.83 KB
最近更新
4 年前 (2021年7月3日)
相關分類
  • 書籤
  • 分頁
授權條款
僅 GNU General Public License v3.0
版本紀錄
  • 瀏覽所有版本
新增至收藏集
檢舉此附加元件
martin 製作的更多擴充套件
  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

前往 Mozilla 官網

附加元件

  • 關於
  • Firefox 附加元件部落格
  • 擴充套件工作坊
  • 開發者交流中心
  • 開發者政策
  • 社群部落格
  • 討論區
  • 回報 Bug
  • 評論撰寫指南

瀏覽器

  • Desktop
  • Mobile
  • Enterprise

產品

  • Browsers
  • VPN
  • Relay
  • Monitor
  • Pocket
  • Bluesky (@firefox.com)
  • Instagram (Firefox)
  • YouTube (firefoxchannel)
  • 隱私權
  • Cookie
  • 法律資訊

除另有註明外,本站內容皆採用創用 CC 姓名標示—相同方式分享條款 3.0 或更新版本授權大眾使用。