-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from feedbee/shared2
Refactoring of shared.js: plugin-api.js proposal
- Loading branch information
Showing
68 changed files
with
885 additions
and
1,033 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
function onKeyPress(key) { | ||
if (key === NEXT) { | ||
var nextButton = document.querySelector('.m-playbar .nxt'); | ||
simulateClick(nextButton); | ||
} else if (key === PLAY) { | ||
var playPauseButton = document.querySelector('.m-playbar .ply'); | ||
simulateClick(playPauseButton); | ||
} else if (key === PREV) { | ||
var backButton = document.querySelector('.m-playbar .prv'); | ||
simulateClick(backButton); | ||
keySocket.init( | ||
"163", | ||
{ | ||
"play-pause": ".m-playbar .ply", | ||
"prev": ".m-playbar .prv", | ||
"next": ".m-playbar .nxt" | ||
// stop is omitted | ||
} | ||
} | ||
); |
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
function onKeyPress(key) { | ||
if (key === NEXT) { | ||
var nextButton = document.querySelector('.button.icon-fastForward'); | ||
simulateClick(nextButton); | ||
} else if (key === PLAY) { | ||
var playPauseButton = document.querySelector(".button.playButton"); | ||
simulateClick(playPauseButton); | ||
} else if (key === PREV) { | ||
var backButton = document.querySelector('.button.icon-fastBackward'); | ||
simulateClick(backButton); | ||
keySocket.init( | ||
"amazon-cloud-player", | ||
{ | ||
"play-pause": ".button.playButton", | ||
"prev": ".button.icon-fastBackward", | ||
"next": ".button.icon-fastForward" | ||
// stop is omitted | ||
} | ||
} | ||
); |
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 |
---|---|---|
@@ -1,13 +1,9 @@ | ||
var playTarget = '.inline_player .playbutton'; | ||
var nextTarget = '.inline_player .nextbutton'; | ||
var prevTarget = '.inline_player .prevbutton'; | ||
|
||
function onKeyPress(key) { | ||
if (key === PREV) { | ||
simulateClick(document.querySelector(prevTarget)); | ||
} else if (key === NEXT) { | ||
simulateClick(document.querySelector(nextTarget)); | ||
} else if (key === PLAY) { | ||
simulateClick(document.querySelector(playTarget)); | ||
keySocket.init( | ||
"bandcamp", | ||
{ | ||
"play-pause": ".inline_player .playbutton", | ||
"prev": ".inline_player .prevbutton", | ||
"next": ".inline_player .nextbutton" | ||
// stop is omitted | ||
} | ||
} | ||
); |
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
function onKeyPress(key) { | ||
if (key === NEXT) { | ||
var nextButton = document.getElementById('fap-next'); | ||
simulateClick(nextButton); | ||
} else if (key === PLAY) { | ||
var playPauseButton = document.getElementById('fap-play-pause'); | ||
simulateClick(playPauseButton); | ||
} else if (key === PREV) { | ||
var backButton = document.getElementById('fap-previous'); | ||
simulateClick(backButton); | ||
keySocket.init( | ||
"birp", | ||
{ | ||
"play-pause": "#playbtn", | ||
"prev": ".fa-fast-backward", | ||
"next": ".fa-fast-forward" | ||
// stop is omitted | ||
} | ||
} | ||
); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
function onKeyPress(key) { | ||
if (key === NEXT) { | ||
var nextButton = document.getElementsByTagName('button')[4]; | ||
simulateClick(nextButton); | ||
} else if (key === PLAY) { | ||
var playPauseButton = document.getElementsByTagName('button')[3]; | ||
simulateClick(playPauseButton); | ||
} else if (key === PREV) { | ||
var backButton = document.getElementsByTagName('button')[2]; | ||
simulateClick(backButton); | ||
keySocket.init( | ||
"bugs", | ||
{ | ||
"play-pause": ".btnPlay > button, .btnStop > button", | ||
"prev": ".btnPrev > button", | ||
"next": ".btnNext > button" | ||
// stop is omitted | ||
} | ||
} | ||
); |
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
function onKeyPress(key) { | ||
var videoElement = document.getElementsByTagName("video")[0]; | ||
|
||
if (key === PLAY) { | ||
if (videoElement.paused) { | ||
videoElement.play(); | ||
} | ||
else { | ||
videoElement.pause(); | ||
keySocket.init( | ||
"builtin-player", | ||
{ | ||
"play-pause": function () { | ||
var videoElement = document.getElementsByTagName("video")[0]; | ||
|
||
if (videoElement.paused) { | ||
videoElement.play(); | ||
} | ||
else { | ||
videoElement.pause(); | ||
} | ||
} | ||
// prev is skipped | ||
// next is skipped | ||
// stop is omitted | ||
} | ||
} | ||
); |
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 |
---|---|---|
@@ -1,37 +1,9 @@ | ||
function onKeyPress(key) { | ||
if (document.getElementById('player_control_play')) { // old deezer style | ||
if (key === NEXT) { | ||
var nextButton = document.getElementById('player_control_next'); | ||
simulateClick(nextButton); | ||
} else if (key === PLAY) { | ||
var isPlaying = document.getElementById('player_control_play').style.display === 'none'; | ||
var playPauseButton = null; | ||
if (isPlaying) { | ||
playPauseButton = document.getElementById('player_control_pause'); | ||
} else { | ||
playPauseButton = document.getElementById('player_control_play'); | ||
} | ||
simulateClick(playPauseButton); | ||
} else if (key === PREV) { | ||
var backButton = document.getElementById('player_control_prev'); | ||
simulateClick(backButton); | ||
} | ||
} else { // new deezer style | ||
if (key === NEXT) { | ||
var nextButton = document.getElementsByClassName('control-next')[0]; | ||
simulateClick(nextButton); | ||
} else if (key === PLAY) { | ||
var isPlaying = document.getElementsByClassName('control-play')[0] ? false : true; | ||
var playPauseButton = null; | ||
if (isPlaying) { | ||
playPauseButton = document.getElementsByClassName('control-pause')[0]; | ||
} else { | ||
playPauseButton = document.getElementsByClassName('control-play')[0]; | ||
} | ||
simulateClick(playPauseButton); | ||
} else if (key === PREV) { | ||
var backButton = document.getElementsByClassName('control-prev')[0]; | ||
simulateClick(backButton); | ||
} | ||
keySocket.init( | ||
"deezer", | ||
{ | ||
"play-pause": ".control-play, .control-pause", | ||
"prev": ".control-prev", | ||
"next": ".control-next" | ||
// stop is omitted | ||
} | ||
} | ||
); |
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
function onKeyPress(key) { | ||
if (key === PLAY) { | ||
var playPauseButton = document.querySelector('#webplayer-region .controls a:first-child'); | ||
simulateClick(playPauseButton); | ||
keySocket.init( | ||
"digitallyimported", | ||
{ | ||
"play-pause": "#webplayer-region .controls a:first-child" | ||
// prev is skipped | ||
// next is skipped | ||
// stop is omitted | ||
} | ||
} | ||
); |
Oops, something went wrong.