1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-04 16:55:51 +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

@@ -19,9 +19,10 @@ function Player() // {{{
let min = 0; let min = 0;
let max = gMM.playbackControl.duration; let max = gMM.playbackControl.duration;
let position = gMM.playbackControl.position + (direction ? interval : -interval); 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);
} }
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
@@ -76,6 +77,14 @@ function Player() // {{{
["L"], "Seek +1m", ["L"], "Seek +1m",
function () { player.seekForward(60); }); 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 //////////////////////////////////////////////// ////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
@@ -195,14 +204,29 @@ function Player() // {{{
seekForward: function seekForward(interval) seekForward: function seekForward(interval)
{ {
seek(interval, true); if (gMM.playbackControl)
seek(interval, true);
}, },
seekBackward: function seekBackward(interval) 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| |:f| |:filter|
||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + ||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| +
||f|| ||f||