Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![LICENSE](https://img.shields.io/badge/license-Apache_2.0-lightgrey.svg)](https://github.com/borismus/keysocket/blob/master/COPYING)
[![LICENSE](https://img.shields.io/badge/license-Apache_2.0-lightgrey.svg)](https://github.com/borismus/keysocket/blob/master/COPYING)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/users/fphfgdknbpakeedbaenojjdcdoajihik.svg)](https://chrome.google.com/webstore/detail/key-socket-media-keys/fphfgdknbpakeedbaenojjdcdoajihik)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/rating-count/fphfgdknbpakeedbaenojjdcdoajihik.svg)](https://chrome.google.com/webstore/detail/key-socket-media-keys/fphfgdknbpakeedbaenojjdcdoajihik)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/stars/fphfgdknbpakeedbaenojjdcdoajihik.svg)](https://chrome.google.com/webstore/detail/key-socket-media-keys/fphfgdknbpakeedbaenojjdcdoajihik)
Expand All @@ -13,6 +13,7 @@ when you're listening to music on various streaming websites.
* 163 Music
* 8tracks
* Amazon Cloud Player
* Apple Music
* Bandcamp
* Birp
* Bop
Expand Down
21 changes: 21 additions & 0 deletions extension/keysocket-apple-music.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
keySocket.init(
"apple-music",
{
"play-pause": function () {
var playButton = document.querySelector('button[aria-label="Play"]');
var pauseButton = document.querySelector('button[aria-label="Pause"]');
if (pauseButton) {
keySocket.simulateClick(pauseButton);
} else {
keySocket.simulateClick(playButton);
}
},
"prev": function(){
keySocket.simulateClick(document.querySelector('button[aria-label="Previous"]'));
},
"next": function(){
keySocket.simulateClick(document.querySelector('button[aria-label="Next"]'));
}
// stop is omitted
}
);
4 changes: 4 additions & 0 deletions extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@
{
"matches": ["*://www.jamendo.com/*"],
"js": ["plugin-api.js", "keysocket-jamendo.js"]
},
{
"matches": ["*://beta.music.apple.com/*"],
"js": ["plugin-api.js", "keysocket-apple-music.js"]
}
]
}