1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 12:17:59 +01:00

Whitespace and semicolon fixes.

This commit is contained in:
Doug Kearns
2009-08-10 02:15:23 +10:00
parent a8001baa03
commit 77458e5b8a
16 changed files with 66 additions and 61 deletions

4
common/content/bookmarks.js Normal file → Executable file
View File

@@ -970,7 +970,7 @@ function History() //{{{
completion.history = function _history(context, maxItems) {
context.format = history.format;
context.title = ["History"]
context.title = ["History"];
context.compare = CompletionContext.Sort.unsorted;
//context.background = true;
if (context.maxItems == null)
@@ -1027,7 +1027,7 @@ function History() //{{{
let sh = window.getWebNavigation().sessionHistory;
let obj = [];
obj.index = sh.index;
obj.__iterator__ = function() util.Array.iteritems(this)
obj.__iterator__ = function () util.Array.iteritems(this);
for (let i in util.range(0, sh.count))
{
obj[i] = { index: i, __proto__: sh.getEntryAtIndex(i, false) };

15
common/content/browser.js Normal file → Executable file
View File

@@ -71,7 +71,7 @@ function Browser() //{{{
// Stolen from browser.jar/content/browser/browser.js, more or less.
try
{
var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val
var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val;
PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val);
getWebNavigation().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
@@ -95,19 +95,24 @@ function Browser() //{{{
let services = modules.services; // Storage objects are global to all windows, 'modules' isn't.
storage.newObject("private-mode", function () {
({
init: function () {
init: function ()
{
services.get("observer").addObserver(this, "private-browsing", false);
services.get("observer").addObserver(this, "quit-application", false);
this.private = services.get("privateBrowsing").privateBrowsingEnabled;
},
observe: function (subject, topic, data) {
if (topic == "private-browsing") {
observe: function (subject, topic, data)
{
if (topic == "private-browsing")
{
if (data == "enter")
storage.privateMode = true;
else if (data == "exit")
storage.privateMode = false;
storage.fireEvent("private-mode", "change", storage.privateMode);
} else if (topic == "quit-application") {
}
else if (topic == "quit-application")
{
services.get("observer").removeObserver(this, "quit-application");
services.get("observer").removeObserver(this, "private-browsing");
}

2
common/content/commands.js Normal file → Executable file
View File

@@ -1171,7 +1171,7 @@ function Commands() //{{{
// then get completions of the command name
let [count, cmd, bang, args] = commands.parseCommand(context.filter);
let [, prefix, junk] = context.filter.match(/^(:*\d*)\w*(.?)/) || [];
context.advance(prefix.length)
context.advance(prefix.length);
if (!junk)
return context.fork("", 0, this, "command");

42
common/content/completion.js Normal file → Executable file
View File

@@ -128,7 +128,7 @@ function CompletionContext(editor, name, offset) //{{{
return this.filters.
reduce(function (res, filter) res.filter(function (item) filter.call(self, item)),
items);
}
};
/**
* @property {Array} An array of predicates on which to filter the
* results.
@@ -256,12 +256,12 @@ CompletionContext.prototype = {
let prefix = self.value.substring(minStart, context.offset);
return context.items.map(function makeItem(item) ({ text: prefix + item.text, item: item.item }));
});
return { start: minStart, items: util.Array.flatten(items), longestSubstring: this.longestAllSubstring }
return { start: minStart, items: util.Array.flatten(items), longestSubstring: this.longestAllSubstring };
}
catch (e)
{
liberator.reportError(e);
return { start: 0, items: [], longestAllSubstring: "" }
return { start: 0, items: [], longestAllSubstring: "" };
}
},
// Temporary
@@ -306,7 +306,7 @@ CompletionContext.prototype = {
this._completions = items;
let self = this;
if (this.updateAsync && !this.noUpdate)
liberator.callInMainThread(function () { self.onUpdate.call(self) });
liberator.callInMainThread(function () { self.onUpdate.call(self); });
},
get createRow() this._createRow || template.completionRow, // XXX
@@ -319,7 +319,7 @@ CompletionContext.prototype = {
set filter(val)
{
delete this._ignoreCase;
return this._filter = val
return this._filter = val;
},
get format() ({
@@ -347,7 +347,7 @@ CompletionContext.prototype = {
let [k, v] = i;
let _k = "_" + k;
if (typeof v == "string" && /^[.[]/.test(v))
v = eval("(function (i) i" + v + ")")
v = eval("(function (i) i" + v + ")");
if (typeof v == "function")
res.__defineGetter__(k, function () _k in this ? this[_k] : (this[_k] = v(this.item)));
else
@@ -358,7 +358,7 @@ CompletionContext.prototype = {
},
get regenerate() this._generate && (!this.completions || !this.itemCache[this.key] || this.cache.offset != this.offset),
set regenerate(val) { if (val) delete this.itemCache[this.key] },
set regenerate(val) { if (val) delete this.itemCache[this.key]; },
get generate() !this._generate ? null : function ()
{
@@ -438,7 +438,7 @@ CompletionContext.prototype = {
filtered.forEach(function (item) {
item.unquoted = item.text;
item.text = quote[0] + quote[1](item.text) + quote[2];
})
});
return this.cache.filtered = filtered;
},
@@ -573,7 +573,7 @@ CompletionContext.prototype = {
fork: function fork(name, offset, self, completer)
{
if (typeof completer == "string")
completer = self[completer]
completer = self[completer];
let context = new CompletionContext(this, name, offset);
this.contextList.push(context);
if (completer)
@@ -762,7 +762,7 @@ function Completion() //{{{
}
catch (e) {}
return iterator;
}
};
// Search the object for strings starting with @key.
// If @last is defined, key is a quoted string, it's
@@ -812,7 +812,7 @@ function Completion() //{{{
});
return compl;
}
};
this.eval = function eval(arg, key, tmp)
{
@@ -837,7 +837,7 @@ function Completion() //{{{
{
delete context[EVAL_TMP];
}
}
};
// Get an element from the stack. If @n is negative,
// count from the top of the stack, otherwise, the bottom.
@@ -851,7 +851,7 @@ function Completion() //{{{
if (m == null)
return a;
return a[a.length - m - 1];
}
};
function buildStack(filter)
{
@@ -862,7 +862,7 @@ function Completion() //{{{
top = [i, arg, [i], [], [], [], []];
last = top[CHAR];
stack.push(top);
}
};
let pop = function pop(arg)
{
if (top[CHAR] != arg)
@@ -882,7 +882,7 @@ function Completion() //{{{
last = top[CHAR];
let ret = stack.pop();
return ret;
}
};
let i = 0, c = ""; // Current index and character, respectively.
@@ -1056,7 +1056,7 @@ function Completion() //{{{
prev = dot + 1;
obj = self.eval(s, cacheKey, obj);
}
return [[obj, cacheKey]]
return [[obj, cacheKey]];
}
function getObjKey(frame)
@@ -1113,13 +1113,13 @@ function Completion() //{{{
if (!isnan(a.item.key) && !isnan(b.item.key))
return a.item.key - b.item.key;
return isnan(b.item.key) - isnan(a.item.key) || compare(a, b);
}
};
if (!context.anchored) // We've already listed anchored matches, so don't list them again here.
context.filters.push(function (item) util.compareIgnoreCase(item.text.substr(0, this.filter.length), this.filter));
if (obj == cache.evalContext)
context.regenerate = true;
context.generate = function () self.objectKeys(obj);
}
};
}
// TODO: Make this a generic completion helper function.
let filter = key + (string || "");
@@ -1226,7 +1226,7 @@ function Completion() //{{{
let res = completer.call(self, context, func, obj, args);
if (res)
context.completions = res;
}
};
obj[0][1] += "." + func + "(... [" + args.length + "]";
return complete.call(this, obj, key, compl, string, last);
@@ -1346,7 +1346,7 @@ function Completion() //{{{
let numLocationCompletions = 0; // how many async completions did we already return to the caller?
let start = 0;
let skip = 0;
if (options["urlseparator"])
skip = context.filter.match("^.*" + options["urlseparator"]); // start after the last 'urlseparator'
@@ -1372,7 +1372,7 @@ function Completion() //{{{
urls: function (context, tags)
{
let compare = String.localeCompare;
let contains = String.indexOf
let contains = String.indexOf;
if (context.ignoreCase)
{
compare = util.compareIgnoreCase;

18
common/content/events.js Normal file → Executable file
View File

@@ -97,7 +97,7 @@ function AutoCommands() //{{{
if (args.bang)
autocommands.remove(event, regex);
if (args["-javascript"])
cmd = eval("(function(args) { with(args) {" + cmd + "} })");
cmd = eval("(function (args) { with(args) {" + cmd + "} })");
autocommands.add(events, regex, cmd);
}
else
@@ -351,7 +351,7 @@ function Events() //{{{
pendingMotionMap: null, // e.g. "d{motion}" if we wait for a motion of the "d" command
pendingArgMap: null, // pending map storage for commands like m{a-z}
count: -1 // parsed count from the input buffer
}
};
var fullscreen = window.fullScreen;
@@ -471,9 +471,9 @@ function Events() //{{{
.replace(/^NUMPAD/, "k")];
if (k in keyTable)
names = keyTable[k];
code_key[v] = names[0]
code_key[v] = names[0];
for (let [,name] in Iterator(names))
key_code[name.toLowerCase()] = v
key_code[name.toLowerCase()] = v;
}
// HACK: as Gecko does not include an event for <, we must add this in manually.
@@ -1013,7 +1013,7 @@ function Events() //{{{
*/
fromString: function (input)
{
let out = []
let out = [];
let re = RegExp("<.*?>?>|[^<]|<(?!.*>)", "g");
let match;
@@ -1042,7 +1042,7 @@ function Events() //{{{
{
if (evt_obj.shiftKey)
{
keyname = keyname.toUpperCase()
keyname = keyname.toUpperCase();
if (keyname == keyname.toLowerCase())
evt_obj.liberatorShift = true;
}
@@ -1062,7 +1062,7 @@ function Events() //{{{
}
else // spaces, control characters, and <
{
evt_obj.keyCode = key_code[keyname]
evt_obj.keyCode = key_code[keyname];
evt_obj.charCode = 0;
}
}
@@ -1079,7 +1079,7 @@ function Events() //{{{
if (evt_obj.keyCode == 32 || evt_obj.charCode == 32)
evt_obj.charCode = evt_obj.keyCode = 32; // <Space>
if (evt_obj.keyCode == 60 || evt_obj.charCode == 60)
evt_obj.charCode = evt_obj.keyCode = 60 // <lt>
evt_obj.charCode = evt_obj.keyCode = 60; // <lt>
out.push(evt_obj);
}
@@ -1321,7 +1321,7 @@ function Events() //{{{
if (config.focusChange)
return void config.focusChange(win);
urlbar = document.getElementById("urlbar");
let urlbar = document.getElementById("urlbar");
if (elem == null && urlbar && urlbar.inputField == lastFocus)
liberator.threadYield(true);

2
common/content/hints.js Normal file → Executable file
View File

@@ -818,7 +818,7 @@ function Hints() //{{{
["contains", "The typed characters are split on whitespace. The resulting groups must all appear in the hint."],
["wordstartswith", "The typed characters are split on whitespace. The resulting groups must all match the beginings of words, in order."],
["firstletters", "Behaves like wordstartswith, but all groups much match a sequence of words."],
["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"],
["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"]
],
validator: Option.validateCompleter
});

2
common/content/io.js Normal file → Executable file
View File

@@ -478,7 +478,7 @@ function IO() //{{{
}
return util.Array.flatten(commands);
}
};
};
completion.addUrlCompleter("f", "Local files", completion.file);

8
common/content/liberator.js Normal file → Executable file
View File

@@ -489,7 +489,7 @@ const liberator = (function () //{{{
bang: true,
completer: function (context)
{
completion.extension(context)
completion.extension(context);
if (command.filter)
context.filters.push(command.filter);
},
@@ -852,7 +852,7 @@ const liberator = (function () //{{{
function (elem) [elem.textContent, file]);
});
return util.Array.flatten(res);
}
};
};
completion.menuItem = function menuItem(context) {
@@ -866,7 +866,7 @@ const liberator = (function () //{{{
context.title = ["Toolbar"];
context.keys = { text: function (item) item.getAttribute("toolbarname"), description: function () "" };
context.completions = buffer.evaluateXPath("./*[@toolbarname]", document, toolbox);
}
};
});
/////////////////////////////////////////////////////////////////////////////}}}
@@ -913,7 +913,7 @@ const liberator = (function () //{{{
}
//const Extension = new Struct("id", "name", "description", "icon", "enabled", "version");
return extensions.map(function(e) ({
return extensions.map(function (e) ({
id: e.id,
name: e.name,
description: getRdfProperty(e, "description"),

2
common/content/mappings.js Normal file → Executable file
View File

@@ -266,7 +266,7 @@ function Mappings() //{{{
}
for (map in mappingsIterator(modes, user))
if (map.rhs && map.noremap == noremap)
]
];
}
};

2
common/content/modes.js Normal file → Executable file
View File

@@ -259,7 +259,7 @@ const modes = (function () //{{{
set main(value) { this.set(value); },
get extended() extended,
set extended(value) { this.set(null, value) }
set extended(value) { this.set(null, value); }
};

2
common/content/options.js Normal file → Executable file
View File

@@ -762,7 +762,7 @@ function Options() //{{{
return <tr>
<td style="width: 200px;">{i}</td>
<td>{prefix}{value}</td>
</tr>
</tr>;
})
}
</table>;

4
common/content/style.js Normal file → Executable file
View File

@@ -306,7 +306,7 @@ function Styles(name, store)
{
this.registerSheet(cssUri(wrapCSS(sheet)));
if (sheet.agent)
this.registerAgentSheet(cssUri(wrapCSS(sheet)))
this.registerAgentSheet(cssUri(wrapCSS(sheet)));
}
catch (e)
{
@@ -335,7 +335,7 @@ function Styles(name, store)
let names = system ? systemNames : userNames;
if (typeof sheet === "number")
return sheets[sheet];
return names[sheet]
return names[sheet];
};
/**

4
common/content/ui.js Normal file → Executable file
View File

@@ -363,7 +363,7 @@ function CommandLine() //{{{
{
case this.UP:
if (this.selected == null)
idx = -2
idx = -2;
else
idx = this.selected - 1;
break;
@@ -2126,7 +2126,7 @@ function StatusLine() //{{{
value = value.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
encodeURIComponent);
return value;
}
};
if (url == null)
// TODO: this probably needs a more general solution.

8
common/content/util.js Normal file → Executable file
View File

@@ -524,7 +524,7 @@ const util = { //{{{
value = template.highlight(value, true, 150);
// FIXME: Inline style.
key = <span style="font-weight: bold;">{i}</span>;
let key = <span style="font-weight: bold;">{i}</span>;
if (!isNaN(i))
i = parseInt(i);
else if (/^[A-Z_]+$/.test(i))
@@ -649,7 +649,7 @@ const util = { //{{{
if (options["urlseparator"])
urls = util.splitLiteral(str, RegExp("\\s*" + options["urlseparator"] + "\\s*"));
else
urls = [str]
urls = [str];
return urls.map(function (url) {
try
@@ -741,8 +741,8 @@ util.Array = function Array_(ary) {
return util.Array(res);
return res;
},
concat: function() [].concat.apply(this.__proto__, arguments),
map: function() this.__noSuchMethod__("map", Array.slice(arguments)),
concat: function () [].concat.apply(this.__proto__, arguments),
map: function () this.__noSuchMethod__("map", Array.slice(arguments)),
};
return obj;
}

6
muttator/content/mail.js Normal file → Executable file
View File

@@ -251,7 +251,7 @@ function Mail() //{{{
function ()
{
if (gDBView && gDBView.selection.count < 1)
return liberator.beep();
return void liberator.beep();
MsgOpenNewTabForMessage();
});
@@ -558,7 +558,7 @@ function Mail() //{{{
function (arg)
{
if (!GetSelectedMessages())
return liberator.beep();
return void liberator.beep();
switch (arg)
{
@@ -664,7 +664,7 @@ function Mail() //{{{
"Select a folder",
function (args)
{
let count = Math.max(0, args.count - 1)
let count = Math.max(0, args.count - 1);
let arg = args.literalArg || "Inbox";
let folder = mail.getFolders(arg, true, true)[count];

6
xulmus/content/player.js Normal file → Executable file
View File

@@ -193,7 +193,7 @@ function Player() // {{{
mappings.add([modes.PLAYER],
["<C-" + rating + ">"], "Rate the current media item " + rating,
function () { player.rateMediaItem(rating); });
}
};
}
////////////////// ///////////////////////////////////////////////////////////}}}
@@ -306,9 +306,9 @@ function Player() // {{{
}
if (/^[-+]/.test(arg))
arg[0] == "-" ? player.seekBackward(value) : player.seekForward(value)
arg[0] == "-" ? player.seekBackward(value) : player.seekForward(value);
else
player.seekTo(value)
player.seekTo(value);
},
{ argCount: "1" });