您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
【userChromeES】コンテナタブから新しいタブを開いたとき、コンテナを維持せずコンテナなしにします。
// ==UserScript== // @name 新しいタブでコンテナ解除 // @description 【userChromeES】コンテナタブから新しいタブを開いたとき、コンテナを維持せずコンテナなしにします。 // @namespace https://greasyfork.org/users/137 // @version 1.0.0 // @include background // @include options // @license MPL-2.0 // @incompatible Edge // @compatible Firefox userChromeES用スクリプトです (※GreasemonkeyスクリプトでもuserChromeJS用スクリプトでもありません)。 // @incompatible Opera // @incompatible Chrome // @author 100の人 // @homepage https://greasyfork.org/users/137 // ==/UserScript== (async function () { 'use strict'; /** * コンテナなしのときのcookieStoreId。 */ const DEFAULT_COOKIE_STORE_ID = 'firefox-default'; /** * スクリプトの実行に必要な権限。 * @constant {browser.permissions.Permissions} */ const PERMISSIONS = { permissions: [ 'tabs', 'cookies' ], }; function watchTabCreated() { browser.tabs.onCreated.addListener(function (tab) { if (!tab.openerTabId || tab.cookieStoreId === DEFAULT_COOKIE_STORE_ID) { return; } browser.tabs.onUpdated.addListener(function onUpdated(tabId, changeInfo, tab) { browser.tabs.onUpdated.removeListener(onUpdated); browser.tabs.create({ cookieStoreId: DEFAULT_COOKIE_STORE_ID, openerTabId: tab.openerTabId, url: changeInfo.url, }); browser.tabs.remove(tabId); }, { properties: [ 'url' ], tabId: tab.id }); }); } switch (location.pathname) { case '/background/background.xhtml': if (await browser.permissions.contains(PERMISSIONS)) { watchTabCreated(); } else { browser.permissions.onAdded.addListener(async function onAdded() { if (await browser.permissions.contains(PERMISSIONS)) { watchTabCreated(); browser.permissions.onAdded.removeListener(onAdded); } }); } break; case '/options/options.xhtml': { document.body.insertAdjacentHTML('beforeend', `<article> <h1>新しいタブでコンテナ解除</h1> <button type="button">ブラウザへ必要な許可を要求</button> </article>`); const section = document.body.lastElementChild; const button = section.getElementsByTagName('button')[0]; function disable() { button.textContent = '必要な許可を取得済み'; button.disabled = true; } if (await browser.permissions.contains(PERMISSIONS)) { disable(); } else { button.addEventListener('click', async function onClick() { if (await browser.permissions.request(PERMISSIONS)) { disable(); } }); } break; } } })();