Skip to content

Commit

Permalink
feat: open new tab at next position to the current tab
Browse files Browse the repository at this point in the history
  • Loading branch information
xatier committed Oct 30, 2023
1 parent 680d13b commit 980fe90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
chrome.tabs.query({ currentWindow : true, highlighted : true }, (tab) => {
let {url, title} = tab[0];
chrome.tabs.query({ currentWindow: true, highlighted: true }, (tab) => {
let { url, title, index } = tab[0]

url = 'https://twitter.com/intent/tweet?'
+ `url=${encodeURIComponent(url)}`
+ `&text=${encodeURIComponent(title + "\n")}`
url =
"https://twitter.com/intent/tweet?" +
`url=${encodeURIComponent(url)}` +
`&text=${encodeURIComponent(title + "\n")}`

chrome.tabs.create({ url : url });
});
chrome.tabs.create({ url: url, index: index + 1 })
})
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "twitthat",
"description": "Share webpage to twitter easily.",
"version": "1.1",
"version": "1.2",

"permissions": [
"https://twitter.com/",
Expand Down

0 comments on commit 980fe90

Please sign in to comment.