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

whitespace/formatting fixes

This commit is contained in:
Doug Kearns
2008-11-28 13:01:20 +00:00
parent d25867e7b5
commit 5a3a35ea26
10 changed files with 30 additions and 26 deletions

View File

@@ -222,7 +222,7 @@ function Bookmarks() //{{{
{ {
// Forces a load, if not already loaded but wait 10sec // Forces a load, if not already loaded but wait 10sec
// so most tabs should be restored and the CPU should be idle again usually // so most tabs should be restored and the CPU should be idle again usually
setTimeout(function() { liberator.callFunctionInThread(null, function () cache.load()); }, 10000); setTimeout(function () { liberator.callFunctionInThread(null, function () cache.load()); }, 10000);
} }
}); });

View File

@@ -850,7 +850,7 @@ function Commands() //{{{
// Yeah, this is a bit scary. Perhaps I'll fix it when I'm // Yeah, this is a bit scary. Perhaps I'll fix it when I'm
// awake. // awake.
options: util.Array.assocToObj( options: util.Array.assocToObj(
util.map({argCount: "-nargs", bang: "-bang", count: "-count"}, util.map({ argCount: "-nargs", bang: "-bang", count: "-count" },
function ([k, v]) k in cmd && cmd[k] != "0" && [v, typeof cmd[k] == "boolean" ? null : cmd[k]]) function ([k, v]) k in cmd && cmd[k] != "0" && [v, typeof cmd[k] == "boolean" ? null : cmd[k]])
.filter(util.identity)), .filter(util.identity)),
arguments: [cmd.name], arguments: [cmd.name],

View File

@@ -183,7 +183,7 @@ CompletionContext.prototype = {
set filterFunc(val) this._filterFunc = val, set filterFunc(val) this._filterFunc = val,
get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret), get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret),
set filter(val) set filter(val)
{ {
delete this._ignoreCase; delete this._ignoreCase;
return this._filter = val return this._filter = val
@@ -270,7 +270,7 @@ CompletionContext.prototype = {
let self = this; let self = this;
delete this._substrings; delete this._substrings;
let filtered = this.filterFunc(items.map(function (item) ({ text: self.getKey({item: item}, "text"), item: item }))); let filtered = this.filterFunc(items.map(function (item) ({ text: self.getKey({ item: item }, "text"), item: item })));
let quote = this.quote; let quote = this.quote;
if (quote) if (quote)
@@ -846,7 +846,7 @@ function Completion() //{{{
context.process = [null, function highlight(item, v) template.highlight(v, true)]; context.process = [null, function highlight(item, v) template.highlight(v, true)];
if (!context.anchored) if (!context.anchored)
context.filters.push(function (item) util.compareIgnoreCase(item.text.substr(0, key.length), key)); context.filters.push(function (item) util.compareIgnoreCase(item.text.substr(0, key.length), key));
context.compare = function ({item: {key: a}}, {item: {key: b}}) context.compare = function ({ item: { key: a } }, { item: { key: b } })
{ {
if (!isNaN(a) && !isNaN(b)) if (!isNaN(a) && !isNaN(b))
return a - b; return a - b;
@@ -857,10 +857,12 @@ function Completion() //{{{
let filter = key + (string || ""); let filter = key + (string || "");
for (let [,obj] in Iterator(objects)) for (let [,obj] in Iterator(objects))
{ {
try { try
this.context.fork(obj[1], top[OFFSET], this, fill, {
obj[0], obj[1], compl, compl != orig, filter, last, key.length); this.context.fork(obj[1], top[OFFSET], this, fill,
} catch(e) { liberator.reportError(e) } obj[0], obj[1], compl, compl != orig, filter, last, key.length);
}
catch (e) { liberator.reportError(e) }
} }
if (orig) if (orig)
return; return;
@@ -1031,7 +1033,7 @@ function Completion() //{{{
}, },
// discard all entries in the 'urls' array, which don't match 'filter // discard all entries in the 'urls' array, which don't match 'filter
// urls must be of type [{url: "..", title: "..", tags: [...], keyword: ".."}, ...] // urls must be of type [{ url: "..", title: "..", tags: [...], keyword: ".." }, ...]
filterURLArray: function filterURLArray(urls, filter, filterTags) filterURLArray: function filterURLArray(urls, filter, filterTags)
{ {
var filtered = []; var filtered = [];
@@ -1141,7 +1143,7 @@ function Completion() //{{{
context.completions = bookmarks.get(context.filter) context.completions = bookmarks.get(context.filter)
context.filters = []; context.filters = [];
if (tags) if (tags)
context.filters.push(function ({item: item}) tags.every(function (tag) item.tags.indexOf(tag) > -1)); context.filters.push(function ({ item: item }) tags.every(function (tag) item.tags.indexOf(tag) > -1));
}, },
buffer: function buffer(context) buffer: function buffer(context)
@@ -1379,7 +1381,7 @@ function Completion() //{{{
context.keys = { text: "names", description: "description" }; context.keys = { text: "names", description: "description" };
context.completions = options; context.completions = options;
if (scope) if (scope)
context.filters.push(function ({item: opt}) opt.scope & scope); context.filters.push(function ({ item: opt }) opt.scope & scope);
}, },
optionValue: function (context, name, op, curValue) optionValue: function (context, name, op, curValue)
@@ -1494,7 +1496,7 @@ function Completion() //{{{
let engine = ss.getEngineByAlias(name); let engine = ss.getEngineByAlias(name);
if (!engine) if (!engine)
return; return;
let [, word] = /^\s*(\S+)/.exec(context.filter) || []; let [,word] = /^\s*(\S+)/.exec(context.filter) || [];
if (!kludge && word == name) // FIXME: Check for matching keywords if (!kludge && word == name) // FIXME: Check for matching keywords
return; return;
let ctxt = context.fork(name, 0); let ctxt = context.fork(name, 0);

View File

@@ -333,7 +333,7 @@ function Hints() //{{{
if ((options["followhints"] == 2) && validHints.length > 1 && !hintNumber) if ((options["followhints"] == 2) && validHints.length > 1 && !hintNumber)
return liberator.beep(); return liberator.beep();
} }
if (!followFirst) if (!followFirst)
{ {
var firstHref = validHints[0].getAttribute("href") || null; var firstHref = validHints[0].getAttribute("href") || null;

View File

@@ -92,7 +92,7 @@ function Mail() //{{{
function getFolderCompletions(filter) function getFolderCompletions(filter)
{ {
let folders = mail.getFolders(filter); let folders = mail.getFolders(filter);
context.completions = folders.map(function (folder) context.completions = folders.map(function (folder)
[folder.server.prettyName + ": " + folder.name, [folder.server.prettyName + ": " + folder.name,
"Unread: " + folder.getNumUnread(false)]); "Unread: " + folder.getNumUnread(false)]);
} }

View File

@@ -195,7 +195,7 @@ function Mappings() //{{{
return [ return [
{ {
command: this.name, command: this.name,
options: map.silent ? {"<silent>": null} : {}, options: map.silent ? { "<silent>": null } : {},
arguments: [map.names[0]], arguments: [map.names[0]],
literalArg: map.rhs literalArg: map.rhs
} }

View File

@@ -123,7 +123,7 @@ const modes = (function () //{{{
let focus = document.commandDispatcher.focusedElement; let focus = document.commandDispatcher.focusedElement;
if (focus != document.getElementById("urlbar").inputField) if (focus != document.getElementById("urlbar").inputField)
liberator.focusContent(false); liberator.focusContent(false);
}, 100); }, 100);
} }
} }

View File

@@ -83,7 +83,7 @@ Option.prototype = {
return Array.slice(value); return Array.slice(value);
return value; return value;
}, },
joinValues: function (values) joinValues: function (values)
{ {
if (this.type == "stringlist") if (this.type == "stringlist")
@@ -689,7 +689,7 @@ function Options() //{{{
if (context.filter.indexOf("=") == -1) if (context.filter.indexOf("=") == -1)
{ {
if (prefix) if (prefix)
context.filters.push(function ({item: opt}) opt.type == "boolean" || prefix == "inv" && opt.values instanceof Array); context.filters.push(function ({ item: opt }) opt.type == "boolean" || prefix == "inv" && opt.values instanceof Array);
return completion.option(context, opt.scope); return completion.option(context, opt.scope);
} }
else if (prefix == "no") else if (prefix == "no")

View File

@@ -395,9 +395,11 @@ let (array = util.Array)
} }
const styles = storage.newObject("styles", Styles, false); const styles = storage.newObject("styles", Styles, false);
try { try
const highlight = storage.newObject("highlight", Highlights, false); {
} catch(e) { liberator.reportError(e) } const highlight = storage.newObject("highlight", Highlights, false);
}
catch (e) { liberator.reportError(e) }
liberator.registerObserver("load_commands", function () liberator.registerObserver("load_commands", function ()
{ {
@@ -481,7 +483,7 @@ liberator.registerObserver("load_commands", function ()
{ {
command: this.name, command: this.name,
bang: true, bang: true,
options: sty.name ? {"-name": sty.name} : {}, options: sty.name ? { "-name": sty.name } : {},
arguments: [sty.sites.join(",")], arguments: [sty.sites.join(",")],
literalArg: sty.css literalArg: sty.css
} for ([k, sty] in styles.userSheets) } for ([k, sty] in styles.userSheets)

View File

@@ -33,7 +33,7 @@ default xml namespace = XHTML;
const util = { //{{{ const util = { //{{{
Array: { Array: {
// [["a", "b"], ["c", "d"]] -> {a: "b", c: "d"} // [["a", "b"], ["c", "d"]] -> { a: "b", c: "d" }
// From Common Lisp, more or less // From Common Lisp, more or less
assocToObj: function assocToObj(assoc) assocToObj: function assocToObj(assoc)
{ {
@@ -64,7 +64,7 @@ const util = { //{{{
let ret = []; let ret = [];
if (unsorted) if (unsorted)
{ {
for (let [, item] in Iterator(ary)) for (let [,item] in Iterator(ary))
if (ret.indexOf(item) == -1) if (ret.indexOf(item) == -1)
ret.push(item); ret.push(item);
} }
@@ -352,7 +352,7 @@ const util = { //{{{
catch (e) {} catch (e) {}
if (!hasValue) if (!hasValue)
{ {
if(i instanceof Array && i.length == 2) if (i instanceof Array && i.length == 2)
[i, value] = i; [i, value] = i;
else else
var noVal = true; var noVal = true;