diff options
author | Prathyush Thota <prathyushthota@gmail.com> | 2009-03-20 01:19:02 +0530 |
---|---|---|
committer | Prathyush Thota <prathyushthota@gmail.com> | 2009-03-20 01:19:02 +0530 |
commit | 0d9c86a547727f52a752e2ca359f557d74cfc6f0 (patch) | |
tree | 360a8c6d946be2cae004ea4f32b3a67a33ceba1a | |
parent | d0cb38691ee6081b0070019c0eea0b0276bfdd4d (diff) | |
download | pentadactyl-0d9c86a547727f52a752e2ca359f557d74cfc6f0.tar.gz |
Added increase/decrease commands
-rwxr-xr-x | xulmus/content/player.js | 32 | ||||
-rw-r--r-- | xulmus/locale/en-US/player.txt | 14 |
2 files changed, 42 insertions, 4 deletions
diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 30e3b29f..f54b39ea 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -16,12 +16,13 @@ function Player() // {{{ function seek(interval, direction) { interval = interval * 1000; - + let min = 0; let max = gMM.playbackControl.duration; + let position = gMM.playbackControl.position + (direction ? interval : -interval); - gMM.playbackControl.position = Math.min(Math.max(position, min), max) + gMM.playbackControl.position = Math.min(Math.max(position, min), max); } /////////////////////////////////////////////////////////////////////////////}}} @@ -75,6 +76,14 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["L"], "Seek +1m", function () { player.seekForward(60); }); + + mappings.add([modes.PLAYER], + ["=","+"], "Increase Volume by 10%", + function () { player.increaseVolume(); }); + + mappings.add([modes.PLAYER], + ["-"], "Decrease Volume by 10%", + function () { player.decreaseVolume(); }); ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// @@ -195,14 +204,29 @@ function Player() // {{{ seekForward: function seekForward(interval) { - seek(interval, true); + if (gMM.playbackControl) + seek(interval, true); }, seekBackward: function seekBackward(interval) { - seek(interval, false); + if (gMM.playbackControl) + seek(interval, false); }, + //FIXME: 10% ? + increaseVolume: function increaseVolume() + { + gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1; + }, + + decreaseVolume: function decreaseVolume() + { + if (gMM.volumeControl.volume == 0) + gMM.volumeControl.volume = 0.1; + else + gMM.volumeControl.volume = gMM.volumeControl.volume * 0.9; + }, }; //}}} } // }}} diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 57b9f43e..8afaf1cc 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -86,6 +86,20 @@ Seek -1m. ________________________________________________________________________________ +|+| |=| +||+|| + +||=|| +________________________________________________________________________________ +Increase volume by 10%. +________________________________________________________________________________ + +|-| +||-|| +________________________________________________________________________________ +Decrease volume by 10%. +________________________________________________________________________________ + + |f| |:f| |:filter| ||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + ||f|| |