Created
November 19, 2017 09:30
-
-
Save r-plus/5c332505a3baa9aed343b5809cdd2ba5 to your computer and use it in GitHub Desktop.
Foxy Gestures user script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hrefs = window.getSelection().getRangeAt(0).cloneContents().querySelectorAll('a'); | |
const urls = Array.from(hrefs) | |
.map(link => link.href) | |
.filter(link => link.match(/^(http|file)/i)); | |
executeInBackground(urls => { | |
getActiveTab(tab => { | |
for (const [i, url] of urls.entries()) { | |
browser.tabs.create({ | |
url: url, | |
index: tab.index + 1 + i, | |
active: false | |
}); | |
} | |
}); | |
}, [urls]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment