-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #7
- Loading branch information
Showing
6 changed files
with
72 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import WebPlugin from './WebPlugin.js'; | ||
import { executeScriptInActiveTab } from './../utils/tabs.js'; | ||
|
||
/** | ||
* TODO Integrate this as part of a UI change? | ||
* Maybe we can auto-detect all mp3s and other streams and then | ||
* add them to a new tab in the extension pop-up. Or we could | ||
* add found links to the "Play"-button drop-down menu. | ||
* Adding this as a part of the normal plugins-logic makes | ||
* existing things way too complicated. (I tried it...) | ||
*/ | ||
class EmbeddedMediaLink extends WebPlugin { | ||
constructor() { | ||
super(); | ||
|
||
this.domains = ['.*']; | ||
} | ||
|
||
async getPluginPath({ url }) { | ||
const links = await this.searchMediaLinks(); | ||
console.debug(links); | ||
return links; | ||
} | ||
|
||
async searchMediaLinks() { | ||
return await executeScriptInActiveTab( | ||
`try { document.querySelector('a[href$=".mp3"]').getAttribute('href'); } catch (e) {}` | ||
); | ||
} | ||
} | ||
|
||
export default EmbeddedMediaLink; |
This file contains 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
This file contains 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