Skip to content

Commit

Permalink
Add a new expert option to open dropped links in background tabs with…
Browse files Browse the repository at this point in the history
… discarded state #3682
  • Loading branch information
piroor committed Dec 20, 2024
1 parent 0a70af3 commit 4983283
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions webextensions/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@
"config_dropLinksOnTabBehavior_load": { "message": "In diesem Tab öffnen" },
"config_dropLinksOnTabBehavior_newtab": { "message": "In einem neuen untergeordneten Tab öffnen" },
"config_simulateTabsLoadInBackgroundInverted_label": { "message": "When you open a dropped link in a new tab, switch to it immediately (*simulation of the browser's built-in option \"When you open a link, image or media in a new tab, switch to it immediately\" (\"browser.tabs.loadInBackground\"))" },
"config_tabsLoadInBackgroundDiscarded_label": { "message": "Tabs ausstehend lassen bis sie aktiv werden" },

"config_insertDroppedTabsAt_caption": { "message": "Einfügeposition von Tabs, die auf übergeordnete Tabs abgelegt werden" },
"config_insertDroppedTabsAt_inherit": { "message": "Wie neue untergeordnete Tab behandeln" },
Expand Down
1 change: 1 addition & 0 deletions webextensions/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@
"config_dropLinksOnTabBehavior_load": { "message": "Load to the tab" },
"config_dropLinksOnTabBehavior_newtab": { "message": "Open new child tab" },
"config_simulateTabsLoadInBackgroundInverted_label": { "message": "When you open a dropped link in a new tab, switch to it immediately (*simulation of the browser's built-in option \"When you open a link, image or media in a new tab, switch to it immediately\" (\"browser.tabs.loadInBackground\"))" },
"config_tabsLoadInBackgroundDiscarded_label": { "message": "Keep tabs pended until they become active" },

"config_insertDroppedTabsAt_caption": { "message": "Insertion position of children dropped onto a parent" },
"config_insertDroppedTabsAt_inherit": { "message": "Treat same as new children opened from the parent" },
Expand Down
1 change: 1 addition & 0 deletions webextensions/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@
"config_dropLinksOnTabBehavior_load": { "message": "そのタブに読み込む" },
"config_dropLinksOnTabBehavior_newtab": { "message": "新しい子タブで開く" },
"config_simulateTabsLoadInBackgroundInverted_label": { "message": "ドロップされたリンクを新しいタブで開いたとき、すぐにそのタブに切り替える(※ブラウザー組み込みの設定項目「リンク、画像、メディアを新しいタブで開いたとき、すぐにそのタブに切り替える」(\"browser.tabs.loadInBackground\")の再現)" },
"config_tabsLoadInBackgroundDiscarded_label": { "message": "読み込みを保留した状態でタブを開く" },

"config_insertDroppedTabsAt_caption": { "message": "親タブにドロップされた子タブの挿入位置" },
"config_insertDroppedTabsAt_inherit": { "message": "親タブから新しい子タブを開いたときと同様に扱う" },
Expand Down
4 changes: 4 additions & 0 deletions webextensions/_locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,10 @@
"message": "트리의 마지막",
"hash": "fb8149b1acff1a3722270b8ba8d4f816"
},
"config_tabsLoadInBackgroundDiscarded_label": {
"message": "읽기를 보류하고 탭을 열기.",
"hash": "509c995c21ab51263ec0f69c24e360b5"
},
"config_groupTab_caption": {
"message": "탭을 자동으로 묶기",
"hash": "998c6484eb3eccfe367c727c71d482ae"
Expand Down
4 changes: 4 additions & 0 deletions webextensions/_locales/nl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,10 @@
"message": "Link naar een nieuw tabblad automatisch laden (*bootst het gedrag van “Als u een koppeling, afbeelding of media opent in een nieuw tabblad, er meteen naartoe gaan” / \"browser.tabs.loadInBackground\" na)",
"hash": "0b7a2bc33fc4d7d6ce76d76ecd24662e"
},
"config_tabsLoadInBackgroundDiscarded_label": {
"message": "Tabbladen pas activeren als ze worden aangeklikt",
"hash": "509c995c21ab51263ec0f69c24e360b5"
},
"config_insertDroppedTabsAt_caption": {
"message": "Invoeglocatie van onderliggende tabbladen die naar een bovenliggend tabblad worden gesleept",
"hash": "72bc7288abbf1e34dab8a4747b533f54"
Expand Down
1 change: 1 addition & 0 deletions webextensions/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@
"config_dropLinksOnTabBehavior_load": { "message": "Загрузить во вкладке" },
"config_dropLinksOnTabBehavior_newtab": { "message": "Открыть новую дочернюю вкладку" },
"config_simulateTabsLoadInBackgroundInverted_label": { "message": "При открытии ссылки в новой вкладке, переключатся на эту вкладку (* имитация параметра Firefox \"Переключаться на открываемую ссылку, изображение или медиа\" (\"browser.tabs.loadInBackground\"))" },
"config_tabsLoadInBackgroundDiscarded_label": { "message": "Открывать незагруженными" },

"config_insertDroppedTabsAt_caption": { "message": "Позиция вставки дочерних элементов, перетянутых на родителя" },
"config_insertDroppedTabsAt_inherit": { "message": "Рассматривать как новые дочерние, открытые из родителя" },
Expand Down
3 changes: 3 additions & 0 deletions webextensions/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,9 @@
"config_simulateTabsLoadInBackgroundInverted_label": {
"message": "当您用新标签页打开拖放的链接时,立即切换过去 (* 模拟 Firefox 的内置选项 \"新建标签页打开链接、图像、媒体时,立即切换过去\" (\"browser.tabs.loadInBackground\"))"
},
"config_tabsLoadInBackgroundDiscarded_label": {
"message": "让这些标签页在变为活动状态前始终保持休眠"
},
"config_insertDroppedTabsAt_caption": {
"message": "被拖放至父项上的子项的插入位置"
},
Expand Down
6 changes: 6 additions & 0 deletions webextensions/background/browser-action-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,12 @@ const mItems = [
key: 'simulateTabsLoadInBackgroundInverted',
expert: true,
},
{
title: indent(2) + browser.i18n.getMessage('config_tabsLoadInBackgroundDiscarded_label'),
type: 'checkbox',
key: 'tabsLoadInBackgroundDiscarded',
expert: true,
},
//{ type: 'separator', expert: true },
{
title: indent() + browser.i18n.getMessage('config_insertDroppedTabsAt_caption'),
Expand Down
2 changes: 2 additions & 0 deletions webextensions/background/tabs-open.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ function onMessage(message, openerTab) {
insertBefore: Tab.get(message.insertBeforeId),
insertAfter: Tab.get(message.insertAfterId),
active: !!message.active,
discarded: message.discarded,
});
});
break;
Expand All @@ -320,6 +321,7 @@ function onMessage(message, openerTab) {
insertBefore: Tab.get(message.insertBeforeId),
insertAfter: Tab.get(message.insertAfterId),
active: message.active,
discarded: message.discarded,
});
});
break;
Expand Down
1 change: 1 addition & 0 deletions webextensions/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export const configs = new Configs({
simulateLockTabSizing: true,
deferScrollingToOutOfViewportSuccessor: true,
simulateTabsLoadInBackgroundInverted: false,
tabsLoadInBackgroundDiscarded: false,
supportTabsMultiselect: typeof browser.menus.overrideContext == 'function',
warnOnCloseTabs: true,
warnOnCloseTabsNotificationTimeout: 20 * 1000,
Expand Down
5 changes: 5 additions & 0 deletions webextensions/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,11 @@ <h1>__MSG_config_drag_caption__</h1>
><input id="simulateTabsLoadInBackgroundInverted"
type="checkbox">
__MSG_config_simulateTabsLoadInBackgroundInverted_label__</label></p>
<p class="sub"
><label class="has-checkbox"
><input id="tabsLoadInBackgroundDiscarded"
type="checkbox">
__MSG_config_tabsLoadInBackgroundDiscarded_label__</label></p>
</fieldset>
<fieldset>
<legend>__MSG_config_insertDroppedTabsAt_caption__</legend>
Expand Down
4 changes: 3 additions & 1 deletion webextensions/sidebar/drag-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,16 @@ async function handleDroppedNonTabItems(event, dropActionInfo) {
});
}
}
const active = !!configs.simulateTabsLoadInBackgroundInverted;
BackgroundConnection.sendMessage({
type: Constants.kCOMMAND_NEW_TABS,
uris,
windowId: TabsStore.getCurrentWindowId(),
parentId: dropActionInfo.parent && dropActionInfo.parent.id,
insertBeforeId: dropActionInfo.insertBefore && dropActionInfo.insertBefore.id,
insertAfterId: dropActionInfo.insertAfter && dropActionInfo.insertAfter.id,
active: configs.simulateTabsLoadInBackgroundInverted,
active,
discarded: !active && configs.tabsLoadInBackgroundDiscarded,
});
}

Expand Down

0 comments on commit 4983283

Please sign in to comment.