1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 23:58:00 +01:00

Formatting fixes.

This commit is contained in:
Doug Kearns
2009-03-16 16:24:09 +11:00
parent 80beaa41df
commit 1ca0bc0de4
10 changed files with 205 additions and 213 deletions

View File

@@ -42,7 +42,7 @@ function Buffer() //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
// FIXME: This doesn't belong here.
// FIXME: This doesn't belong here.
let mainWindowID = config.mainWindowID || "mainplayer";
let fontSize = util.computedStyle(document.getElementById(mainWindowID)).fontSize;
@@ -215,12 +215,12 @@ function Buffer() //{{{
mappings.add(myModes, ["<C-c>"],
"Stop loading",
function ()
function ()
{
if(config.name == "Xulmus")
getBrowser().mCurrentBrowser.stop();
else
window.BrowserStop();
window.BrowserStop();
});
// scrolling
@@ -603,12 +603,12 @@ function Buffer() //{{{
commands.add(["st[op]"],
"Stop loading",
function ()
{
if(config.name == "Xulmus")
function ()
{
if (config.name == "Xulmus")
getBrowser().mCurrentBrowser.stop();
else
window.BrowserStop();
window.BrowserStop();
},
{ argCount: "0" });

View File

@@ -1381,7 +1381,7 @@ function Completion() //{{{
completion.urls(context, tags);
},
songCompletion: function songCompletion(context, args)
songCompletion: function songCompletion(context, args)
{
if (args.completeArg == 0)
context.completions = getArtists();

View File

@@ -628,7 +628,7 @@ function Events() //{{{
// return true when load successful, or false otherwise
function waitForPageLoaded() events.waitForPageLoad();
// load all macros inside ~/.xulmus/macros/
// load all macros
// setTimeout needed since io. is loaded after events.
setTimeout(function () {
try
@@ -1037,8 +1037,8 @@ function Events() //{{{
// (i.e., cntrl codes 27--31)
// ---
// For more information, see:
// [*] Vimp FAQ: http://xulmus.org/trac/wiki/Xulmus/FAQ#WhydoesntC-workforEscMacOSX
// [*] Referenced mailing list msg: http://www.mozdev.org/pipermail/xulmus/2008-May/001548.html
// [*] Vimp FAQ: http://vimperator.org/trac/wiki/Vimperator/FAQ#WhydoesntC-workforEscMacOSX
// [*] Referenced mailing list msg: http://www.mozdev.org/pipermail/vimperator/2008-May/001548.html
// [*] Mozilla bug 416227: event.charCode in keypress handler has unexpected values on Mac for Ctrl with chars in "[ ] _ \"
// https://bugzilla.mozilla.org/show_bug.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&id=416227
// [*] Mozilla bug 432951: Ctrl+'foo' doesn't seem same charCode as Meta+'foo' on Cocoa
@@ -1226,10 +1226,10 @@ function Events() //{{{
}
}
if(config.name == "Xulmus")
if (config.name == "Xulmus")
{
// Switch to -- PLAYER -- mode for Songbird Media Player.
if(config.isPlayerWindow)
if (config.isPlayerWindow)
{
liberator.mode = modes.PLAYER;
}
@@ -1437,7 +1437,6 @@ function Events() //{{{
// also fixes key navigation in combo boxes, submitting forms, etc.
// FIXME: breaks iabbr for now --mst
if (((config.name == "Xulmus" || config.name == "Vimperator") && liberator.mode == modes.NORMAL || liberator.mode == modes.INSERT))
{
if (key == "<Return>")
return false;

View File

@@ -71,7 +71,7 @@ const liberator = (function () //{{{
let nError = 0;
function loadModule(name, func)
{
let message = "Loading module " + name + "...";
let message = "Loading module " + name + "...";
try
{
liberator.log(message, 0);
@@ -82,10 +82,10 @@ const liberator = (function () //{{{
catch (e)
{
if (nError++ == 0)
liberator.dump("Error loading module - "+ name + "..");
liberator.dump(e);
liberator.dump(e.stack);
window.toJavaScriptConsole();
window.toJavaScriptConsole();
liberator.dump("Error loading module - "+ name + "..");
liberator.dump(e);
liberator.dump(e.stack);
liberator.reportError(e);
}
}
@@ -1219,6 +1219,8 @@ const liberator = (function () //{{{
startup: function ()
{
let start = Date.now();
liberator.log("Initializing liberator object...", 0);
config.features = config.features || [];
config.features.push(getPlatformFeature());
config.defaults = config.defaults || {};
@@ -1227,7 +1229,7 @@ const liberator = (function () //{{{
config.mailModes = config.mailModes || [modes.NORMAL];
// TODO: suitable defaults?
//config.mainWidget
//config.mainWindowID
//config.mainWindowID
//config.visualbellWindow
//config.styleableChrome
config.autocommands = config.autocommands || [];

View File

@@ -66,7 +66,7 @@ function Services()
self.add("windowMediator", "@mozilla.org/appshell/window-mediator;1", Ci.nsIWindowMediator);
self.add("windowWatcher", "@mozilla.org/embedcomp/window-watcher;1", Ci.nsIWindowWatcher);
self.add("bookmarks", "@mozilla.org/browser/nav-bookmarks-service;1", Ci.nsINavBookmarksService);
self.addClass("file", "@mozilla.org/file/local;1", Ci.nsILocalFile);
self.addClass("find", "@mozilla.org/embedcomp/rangefind;1", Ci.nsIFind);
self.addClass("process", "@mozilla.org/process/util;1", Ci.nsIProcess);

View File

@@ -112,7 +112,7 @@ function Tabs() //{{{
/*
if (config.name == "Xulmus")
getBrowser()._strip.getElementsByClassName(
*/
*/
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{

View File

@@ -568,7 +568,7 @@ function CommandLine() //{{{
var startHints = false; // whether we're waiting to start hints mode
var lastSubstring = "";
// the containing box for the promptWidget and commandWidget
const commandlineWidget = document.getElementById("liberator-commandline");
// the prompt for the current command, for example : or /. Can be blank
@@ -577,7 +577,7 @@ function CommandLine() //{{{
const commandWidget = document.getElementById("liberator-commandline-command");
const messageBox = document.getElementById("liberator-message");
commandWidget.inputField.QueryInterface(Ci.nsIDOMNSEditableElement);
messageBox.inputField.QueryInterface(Ci.nsIDOMNSEditableElement);

View File

@@ -170,7 +170,7 @@ const util = { //{{{
*/
computedStyle: function computedStyle(node)
{
while (node instanceof Text && node.parentNode)
while (node instanceof Text && node.parentNode)
node = node.parentNode;
return node.ownerDocument.defaultView.getComputedStyle(node, null);
},

View File

@@ -1,7 +1,6 @@
#!/bin/dash
set -e
top=$(pwd)
jar=$1
bases=$2
@@ -15,7 +14,7 @@ stage="$top/${jar%.*}"
mkdir -p $stage
getfiles () {
filter="\.($(echo $1 | tr ' ' '|'))$"; shift
filter="\.($(echo $1 | tr ' ' '|'))$"; shift
find "$@" -not -path '*CVS*' 2>/dev/null | grep -E "$filter" || true
}
copytext () {
@@ -31,12 +30,12 @@ do
(
set -e
cd $base
[ ${jar##*.} = jar ] && stage="$stage/${base##*/}"
[ ${jar##*.} = jar ] && stage="$stage/${base##*/}"
for dir in $dirs
do
for f in $(getfiles "$bin" "$dir")
for f in $(getfiles "$bin" "$dir")
do
mkdir -p "$stage/${f%/*}"
mkdir -p "$stage/${f%/*}"
cp $f "$stage/$f"
done
for f in $(getfiles "$text" "$dir")
@@ -52,7 +51,7 @@ do
)
done
cd $stage
cd $stage
zip -r "$top/$jar" *
cd -
rm -rf "$stage"

View File

@@ -2,218 +2,210 @@
var artists = getArtistsArray();
function Player()
function Player() // {{{
{
// Get the focus to the visible playlist first
//window._SBShowMainLibrary();
mappings.add([modes.PLAYER],
["x"], "Play Track",
function ()
{
gMM.sequencer.play();
});
mappings.add([modes.PLAYER],
["z"], "Previous Track",
function ()
{
gSongbirdWindowController.doCommand("cmd_control_previous");
});
// Get the focus to the visible playlist first
//window._SBShowMainLibrary();
mappings.add([modes.PLAYER],
["c"], "Pause/Unpause Track",
function ()
{
gSongbirdWindowController.doCommand("cmd_control_playpause");
});
mappings.add([modes.PLAYER],
["b"], "Next Track",
function ()
{
gSongbirdWindowController.doCommand("cmd_control_next");
});
mappings.add([modes.PLAYER],
["v"], "Stop Track",
function ()
{
gMM.sequencer.stop();
});
mappings.add([modes.PLAYER],
["x"], "Play Track",
function ()
{
gMM.sequencer.play();
});
mappings.add([modes.PLAYER],
["z"], "Previous Track",
function ()
{
gSongbirdWindowController.doCommand("cmd_control_previous");
});
mappings.add([modes.PLAYER],
["l"], "Play Media",
function ()
{
commandline.open(":","playmedia ", modes.EX);
});
mappings.add([modes.PLAYER],
["c"], "Pause/Unpause Track",
function ()
{
gSongbirdWindowController.doCommand("cmd_control_playpause");
});
mappings.add([modes.PLAYER],
["s"], "Toggle Shuffle",
function ()
{
if (gMM.sequencer.mode != gMM.sequencer.MODE_SHUFFLE)
gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE;
else
gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD;
});
mappings.add([modes.PLAYER],
["b"], "Next Track",
function ()
{
gSongbirdWindowController.doCommand("cmd_control_next");
});
mappings.add([modes.PLAYER],
["r"], "Toggle Repeat",
function ()
{
switch(gMM.sequencer.repeatMode)
{
case gMM.sequencer.MODE_REPEAT_NONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ONE;
break;
case gMM.sequencer.MODE_REPEAT_ONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ALL;
break;
case gMM.sequencer.MODE_REPEAT_ALL:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
default:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
}
});
mappings.add([modes.PLAYER],
["v"], "Stop Track",
function ()
{
gMM.sequencer.stop();
});
commands.add(["playmedia"],
"PLay Media",
function(args)
{
//Store the old view
//var prev_view = gMM.status.view;
var library = LibraryUtils.mainLibrary;
var mainView = library.createView();
var sqncr = gMM.sequencer;
var customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
.createInstance(Ci.sbIMutablePropertyArray);
//args
if (args.length == 1){
customProps.appendProperty(SBProperties.artistName,args[0].toString());
}
else if (args.length == 2){
customProps.appendProperty(SBProperties.artistName,args[0].toString());
customProps.appendProperty(SBProperties.albumName,args[1].toString());
}
else if (args.length == 3){
customProps.appendProperty(SBProperties.artistName,args[0].toString());
customProps.appendProperty(SBProperties.albumName,args[1].toString());
customProps.appendProperty(SBProperties.trackName,args[2].toString());
}
mappings.add([modes.PLAYER],
["l"], "Play Media",
function ()
{
commandline.open(":","playmedia ", modes.EX);
});
sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0,Ci.sbIMediaItem)));
},
{
completer: function(context, args) completion.songCompletion(context, args)
});
mappings.add([modes.PLAYER],
["s"], "Toggle Shuffle",
function ()
{
if (gMM.sequencer.mode != gMM.sequencer.MODE_SHUFFLE)
gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE;
else
gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD;
});
}
mappings.add([modes.PLAYER],
["r"], "Toggle Repeat",
function ()
{
switch (gMM.sequencer.repeatMode)
{
case gMM.sequencer.MODE_REPEAT_NONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ONE;
break;
case gMM.sequencer.MODE_REPEAT_ONE:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ALL;
break;
case gMM.sequencer.MODE_REPEAT_ALL:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
default:
gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE;
break;
}
});
commands.add(["playmedia"],
"Play Media",
function (args)
{
//Store the old view
//var prev_view = gMM.status.view;
var library = LibraryUtils.mainLibrary;
var mainView = library.createView();
var sqncr = gMM.sequencer;
var customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
.createInstance(Ci.sbIMutablePropertyArray);
//args
if (args.length == 1){
customProps.appendProperty(SBProperties.artistName,args[0].toString());
}
else if (args.length == 2){
customProps.appendProperty(SBProperties.artistName,args[0].toString());
customProps.appendProperty(SBProperties.albumName,args[1].toString());
}
else if (args.length == 3){
customProps.appendProperty(SBProperties.artistName,args[0].toString());
customProps.appendProperty(SBProperties.albumName,args[1].toString());
customProps.appendProperty(SBProperties.trackName,args[2].toString());
}
sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0,Ci.sbIMediaItem)));
},
{
completer: function (context, args) completion.songCompletion(context, args)
});
} // }}}
function getArtists()
{
return this.artists;
return this.artists;
}
function getArtistsArray()
{
var list = LibraryUtils.mainLibrary;
// Create an enumeration listener to count each item
var listener = {
count: 0,
onEnumerationBegin: function(aMediaList) {
this.count = 0;
},
onEnumeratedItem: function(aMediaList, aMediaItem) {
this.count++;
},
onEnumerationEnd: function(aMediaList, aStatusCode) {}
};
var artistCounts = {};
var artists = list.getDistinctValuesForProperty(SBProperties.artistName);
var artist;
var artistArray = [];
var i=0;
// Count the number of media items for each distinct artist
while (artists.hasMore()) {
artist = artists.getNext();
artistArray[i] = [artist,artist];
list.enumerateItemsByProperty(SBProperties.artistName,
artist,
listener,
Ci.sbIMediaList.ENUMERATIONTYPE_LOCKING);
artistCounts[artist] = listener.count;
i++;
}
//liberator.dump("Count : "+artistCounts.toSource());
return artistArray;
var list = LibraryUtils.mainLibrary;
// Create an enumeration listener to count each item
var listener = {
count: 0,
onEnumerationBegin: function (aMediaList) {
this.count = 0;
},
onEnumeratedItem: function (aMediaList, aMediaItem) {
this.count++;
},
onEnumerationEnd: function (aMediaList, aStatusCode) {}
};
var artistCounts = {};
var artists = list.getDistinctValuesForProperty(SBProperties.artistName);
var artist;
var artistArray = [];
var i = 0;
// Count the number of media items for each distinct artist
while (artists.hasMore()) {
artist = artists.getNext();
artistArray[i] = [artist,artist];
list.enumerateItemsByProperty(SBProperties.artistName,
artist,
listener,
Ci.sbIMediaList.ENUMERATIONTYPE_LOCKING);
artistCounts[artist] = listener.count;
i++;
}
//liberator.dump("Count : "+artistCounts.toSource());
return artistArray;
}
function getAlbums(artist)
{
var list = LibraryUtils.mainLibrary;
var albumArray = [];
var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate();
var i = 0;
var list = LibraryUtils.mainLibrary;
var albumArray = [];
var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate();
var i = 0;
while(items.hasMoreElements()) {
album = items.getNext().getProperty(SBProperties.albumName);
albumArray[i] = [album, album];
i++;
}
return removeDuplicateElement(albumArray);
while (items.hasMoreElements()) {
album = items.getNext().getProperty(SBProperties.albumName);
albumArray[i] = [album, album];
i++;
}
return removeDuplicateElement(albumArray);
}
function getTracks(artist,album)
{
var list = LibraryUtils.mainLibrary;
var tracksArray = [];
var pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
.createInstance(Ci.sbIMutablePropertyArray);
var i = 0;
pa.appendProperty(SBProperties.artistName,artist.toString());
pa.appendProperty(SBProperties.albumName,album.toString());
var items = list.getItemsByProperties(pa).enumerate();
var list = LibraryUtils.mainLibrary;
var tracksArray = [];
var pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
.createInstance(Ci.sbIMutablePropertyArray);
var i = 0;
while(items.hasMoreElements()) {
track = items.getNext().getProperty(SBProperties.trackName);
tracksArray[i] = [track, track];
i++;
}
pa.appendProperty(SBProperties.artistName,artist.toString());
pa.appendProperty(SBProperties.albumName,album.toString());
var items = list.getItemsByProperties(pa).enumerate();
return tracksArray;
while (items.hasMoreElements()) {
track = items.getNext().getProperty(SBProperties.trackName);
tracksArray[i] = [track, track];
i++;
}
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;
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: