1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 15:34:12 +01:00

Added increase/decrease commands

This commit is contained in:
Prathyush Thota
2009-03-20 01:19:02 +05:30
parent d0cb38691e
commit 0d9c86a547
2 changed files with 42 additions and 4 deletions

View File

@@ -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;
},
};
//}}}
} // }}}

View File

@@ -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||