1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-01 18:23:32 +02:00

Replace removeDuplicateElement with use of util.Array.uniq.

This commit is contained in:
Doug Kearns
2009-03-17 16:03:31 +11:00
parent 789d98d31d
commit f293c4f212

View File

@@ -4,9 +4,17 @@ var artists = getArtistsArray();
function Player() // {{{ function Player() // {{{
{ {
////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
// Get the focus to the visible playlist first // Get the focus to the visible playlist first
//window._SBShowMainLibrary(); //window._SBShowMainLibrary();
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// MAPPINGS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["x"], "Play Track", ["x"], "Play Track",
function () function ()
@@ -80,6 +88,10 @@ function Player() // {{{
} }
}); });
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
commands.add(["playmedia"], commands.add(["playmedia"],
"Play Media", "Play Media",
function (args) function (args)
@@ -93,14 +105,17 @@ function Player() // {{{
.createInstance(Ci.sbIMutablePropertyArray); .createInstance(Ci.sbIMutablePropertyArray);
//args //args
if (args.length == 1){ if (args.length == 1)
{
customProps.appendProperty(SBProperties.artistName,args[0].toString()); customProps.appendProperty(SBProperties.artistName,args[0].toString());
} }
else if (args.length == 2){ else if (args.length == 2)
{
customProps.appendProperty(SBProperties.artistName,args[0].toString()); customProps.appendProperty(SBProperties.artistName,args[0].toString());
customProps.appendProperty(SBProperties.albumName,args[1].toString()); customProps.appendProperty(SBProperties.albumName,args[1].toString());
} }
else if (args.length == 3){ else if (args.length == 3)
{
customProps.appendProperty(SBProperties.artistName,args[0].toString()); customProps.appendProperty(SBProperties.artistName,args[0].toString());
customProps.appendProperty(SBProperties.albumName,args[1].toString()); customProps.appendProperty(SBProperties.albumName,args[1].toString());
customProps.appendProperty(SBProperties.trackName,args[2].toString()); customProps.appendProperty(SBProperties.trackName,args[2].toString());
@@ -111,6 +126,12 @@ function Player() // {{{
{ {
completer: function (context, args) completion.song(context, args) completer: function (context, args) completion.song(context, args)
}); });
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
//}}}
} // }}} } // }}}
function getArtists() function getArtists()
@@ -168,7 +189,7 @@ function getAlbums(artist)
i++; i++;
} }
return removeDuplicateElement(albumArray); return util.Array.uniq(albumArray);
} }
function getTracks(artist,album) function getTracks(artist,album)
@@ -192,20 +213,4 @@ function getTracks(artist,album)
return tracksArray; return tracksArray;
} }
function removeDuplicateElement(arrayName)
{
var newArray = new Array();
label:for (var i = 0; i < arrayName.length; i++)
{
for (var j = 0; j < newArray.length; j++)
{
if (newArray[j].toString() == arrayName[i].toString())
continue label;
}
newArray[newArray.length] = arrayName[i];
}
return newArray;
}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et: