From 731417edd742deed499289d1e91a525021c72a10 Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Thu, 7 Oct 2021 18:57:34 +0200 Subject: [PATCH] feat: Initial commit --- README.md | 3 +++ background.js | 7 +++++++ manifest.json | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 README.md create mode 100644 background.js create mode 100644 manifest.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..b7ca9c1 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# twitter-switch + +Switch Twitter accounts without losing current page diff --git a/background.js b/background.js new file mode 100644 index 0000000..5f320ff --- /dev/null +++ b/background.js @@ -0,0 +1,7 @@ +browser.webRequest.onCompleted.addListener( + () => browser.tabs.reload(), + { + urls: [ "https://twitter.com/i/api/1.1/account/multi/switch.json" ], + types: [ "xmlhttprequest" ] + } +); diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..e220f52 --- /dev/null +++ b/manifest.json @@ -0,0 +1,16 @@ +{ + "description": "Twitter account switch fixer", + "manifest_version": 2, + "name": "twitter-switch", + "version": "1.0", + + "permissions": [ + "webRequest", + "webRequestBlocking", + "https://twitter.com/" + ], + + "background": { + "scripts": ["background.js"] + } +}