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

Remove more unused vars.

This commit is contained in:
Doug Kearns
2015-04-25 23:57:57 +10:00
parent cd48d1b90b
commit 52993ec781
22 changed files with 29 additions and 50 deletions

View File

@@ -216,7 +216,6 @@ var Bookmarks = Module("bookmarks", {
* use in completion functions. * use in completion functions.
*/ */
get searchEngines() { get searchEngines() {
let searchEngines = [];
let aliases = {}; let aliases = {};
return iter(services.browserSearch.getVisibleEngines({})).map(function ([, engine]) { return iter(services.browserSearch.getVisibleEngines({})).map(function ([, engine]) {
let alias = engine.alias; let alias = engine.alias;
@@ -430,7 +429,7 @@ var Bookmarks = Module("bookmarks", {
const tags = { const tags = {
names: ["-tags", "-T"], names: ["-tags", "-T"],
description: "A comma-separated list of tags", description: "A comma-separated list of tags",
completer: function tags(context, args) { completer: function tags(context) {
context.generate = function () Ary(b.tags context.generate = function () Ary(b.tags
for (b of bookmarkcache) for (b of bookmarkcache)
if (b.tags)) if (b.tags))

View File

@@ -1351,7 +1351,6 @@ var CommandLine = Module("commandline", {
return; return;
} }
let value = this.editor.selection.focusNode.textContent;
this.saveInput(); this.saveInput();
if (this.itemList.visible) if (this.itemList.visible)
@@ -1788,8 +1787,6 @@ var CommandLine = Module("commandline", {
if (self.completions) if (self.completions)
self.completions.tabTimer.flush(); self.completions.tabTimer.flush();
let command = commandline.command;
self.accepted = true; self.accepted = true;
return function () { modes.pop(); }; return function () { modes.pop(); };
}); });

View File

@@ -846,7 +846,6 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
count = count || 1; count = count || 1;
let caret = !dactyl.focusedElement; let caret = !dactyl.focusedElement;
let controller = buffer.selectionController;
while (count-- && modes.main == modes.VISUAL) { while (count-- && modes.main == modes.VISUAL) {
if (caret) if (caret)

View File

@@ -374,7 +374,6 @@ var Events = Module("events", {
commandline.quiet = quiet; commandline.quiet = quiet;
for (let evt_obj of DOM.Event.parse(keys)) { for (let evt_obj of DOM.Event.parse(keys)) {
let now = Date.now();
let key = DOM.Event.stringify(evt_obj); let key = DOM.Event.stringify(evt_obj);
for (let type of values(["keydown", "keypress", "keyup"])) { for (let type of values(["keydown", "keypress", "keyup"])) {
let evt = update({}, evt_obj, { type: type }); let evt = update({}, evt_obj, { type: type });
@@ -1109,7 +1108,6 @@ var Events = Module("events", {
mappings.add([modes.COMMAND], mappings.add([modes.COMMAND],
["<A-m>s", "<sleep>"], "Sleep for {count} milliseconds before continuing macro playback", ["<A-m>s", "<sleep>"], "Sleep for {count} milliseconds before continuing macro playback",
function ({ command, count }) { function ({ command, count }) {
let now = Date.now();
dactyl.assert(count, _("error.countRequired", command)); dactyl.assert(count, _("error.countRequired", command));
if (events.feedingKeys) if (events.feedingKeys)
util.sleep(count); util.sleep(count);

View File

@@ -274,7 +274,7 @@ var History = Module("history", {
names: ["-sort", "-s"], names: ["-sort", "-s"],
type: CommandOption.STRING, type: CommandOption.STRING,
description: "The sort order of the results", description: "The sort order of the results",
completer: function (context, args) { completer: function (context) {
context.compare = CompletionContext.Sort.unsorted; context.compare = CompletionContext.Sort.unsorted;
return Ary.flatten([ return Ary.flatten([
"annotation", "annotation",

View File

@@ -68,7 +68,6 @@ var ProcessorStack = Class("ProcessorStack", {
events.dbg("EXECUTE(" + this._result(result) + ", " + force + ") events:" + this.events.length events.dbg("EXECUTE(" + this._result(result) + ", " + force + ") events:" + this.events.length
+ " processors:" + this.processors.length + " actions:" + this.actions.length); + " processors:" + this.processors.length + " actions:" + this.actions.length);
let processors = this.processors;
let length = 1; let length = 1;
if (force) if (force)

View File

@@ -35,7 +35,7 @@ var MOW = Module("mow", {
events.listen(window, this, "windowEvents"); events.listen(window, this, "windowEvents");
modules.mow = this; modules.mow = this;
let fontSize = DOM(document.documentElement).style.fontSize; //let fontSize = DOM(document.documentElement).style.fontSize;
styles.system.add("font-size", "dactyl://content/buffer.xhtml", styles.system.add("font-size", "dactyl://content/buffer.xhtml",
// "body { font-size: " + fontSize + "; } \ // "body { font-size: " + fontSize + "; } \
"html|html > xul|scrollbar { visibility: collapse !important; }", "html|html > xul|scrollbar { visibility: collapse !important; }",

View File

@@ -75,7 +75,6 @@ var StatusLine = Module("statusline", {
*/$)); */$));
} }
let _commandline = "if (window.dactyl) return dactyl.modules.commandline";
let prepend = [ let prepend = [
["button", { id: "appmenu-button", label: "", image: "chrome://branding/content/icon16.png", highlight: "AppmenuButton", xmlns: "xul" }], ["button", { id: "appmenu-button", label: "", image: "chrome://branding/content/icon16.png", highlight: "AppmenuButton", xmlns: "xul" }],
["toolbarbutton", { id: "appmenu-toolbar-button", label: "", image: "chrome://branding/content/icon16.png" }], ["toolbarbutton", { id: "appmenu-toolbar-button", label: "", image: "chrome://branding/content/icon16.png" }],

View File

@@ -666,7 +666,7 @@ var Tabs = Module("tabs", {
{ {
argCount: "?", argCount: "?",
count: true, count: true,
completer: function (context, args) { completer: function (context) {
context.filters.push(({ item }) => item.tab.pinned); context.filters.push(({ item }) => item.tab.pinned);
completion.buffer(context); completion.buffer(context);
} }
@@ -819,7 +819,7 @@ var Tabs = Module("tabs", {
commands.add(["quita[ll]", "qa[ll]"], commands.add(["quita[ll]", "qa[ll]"],
"Quit this " + config.appName + " window", "Quit this " + config.appName + " window",
function (args) { window.close(); }, function () { window.close(); },
{ argCount: "0" }); { argCount: "0" });
commands.add(["reloada[ll]"], commands.add(["reloada[ll]"],
@@ -850,7 +850,7 @@ var Tabs = Module("tabs", {
}, { }, {
argCount: "1", argCount: "1",
bang: true, bang: true,
completer: function (context, args) completion.buffer(context, true), completer: function (context) completion.buffer(context, true),
literal: 0 literal: 0
}); });
@@ -1008,10 +1008,9 @@ var Tabs = Module("tabs", {
commands.add(["undoa[ll]"], commands.add(["undoa[ll]"],
"Undo closing of all closed tabs", "Undo closing of all closed tabs",
function (args) { function () {
for (let i of iter(tabs.closedTabs)) for (let i of iter(tabs.closedTabs))
window.undoCloseTab(0); window.undoCloseTab(0);
}, },
{ argCount: "0" }); { argCount: "0" });

View File

@@ -371,7 +371,7 @@ var Addons = Module("addons", {
names: ["-types", "-type", "-t"], names: ["-types", "-type", "-t"],
description: "The add-on types to list", description: "The add-on types to list",
default: ["extension"], default: ["extension"],
completer: function (context, args) completion.addonType(context), completer: function (context) completion.addonType(context),
type: CommandOption.LIST type: CommandOption.LIST
} }
] ]
@@ -446,7 +446,7 @@ var Addons = Module("addons", {
names: ["-types", "-type", "-t"], names: ["-types", "-type", "-t"],
description: "The add-on types to operate on", description: "The add-on types to operate on",
default: ["extension"], default: ["extension"],
completer: function (context, args) completion.addonType(context), completer: function (context) completion.addonType(context),
type: CommandOption.LIST type: CommandOption.LIST
} }
] ]

View File

@@ -48,7 +48,7 @@ update(Bookmark.prototype, {
let res = []; let res = [];
res.toString = function () this.join("/"); res.toString = function () this.join("/");
let id = this.id, parent, title; let id = this.id, title;
while ((id = services.bookmarks.getFolderIdForItem(id)) && while ((id = services.bookmarks.getFolderIdForItem(id)) &&
(title = services.bookmarks.getItemTitle(id))) (title = services.bookmarks.getItemTitle(id)))
res.push(title); res.push(title);

View File

@@ -772,7 +772,6 @@ var Buffer = Module("Buffer", {
let self = this; let self = this;
let doc = elem.ownerDocument; let doc = elem.ownerDocument;
let uri = util.newURI(elem.href || elem.src, null, util.newURI(elem.baseURI)); let uri = util.newURI(elem.href || elem.src, null, util.newURI(elem.baseURI));
let referrer = util.newURI(doc.documentURI, doc.characterSet);
try { try {
services.security.checkLoadURIWithPrincipal(doc.nodePrincipal, uri, services.security.checkLoadURIWithPrincipal(doc.nodePrincipal, uri,
@@ -1186,7 +1185,7 @@ var Buffer = Module("Buffer", {
* @param {boolean} useExternalEditor View the source in the external editor. * @param {boolean} useExternalEditor View the source in the external editor.
*/ */
viewSource: function viewSource(loc, useExternalEditor) { viewSource: function viewSource(loc, useExternalEditor) {
let { dactyl, editor, history, options } = this.modules; let { dactyl, history, options } = this.modules;
let window = this.topWindow; let window = this.topWindow;
@@ -1315,7 +1314,7 @@ var Buffer = Module("Buffer", {
* closed range [Buffer.ZOOM_MIN, Buffer.ZOOM_MAX]. * closed range [Buffer.ZOOM_MIN, Buffer.ZOOM_MAX].
*/ */
setZoom: function setZoom(value, fullZoom) { setZoom: function setZoom(value, fullZoom) {
let { dactyl, statusline, storage } = this.modules; let { dactyl, statusline } = this.modules;
let { ZoomManager } = this; let { ZoomManager } = this;
if (fullZoom === undefined) if (fullZoom === undefined)
@@ -1333,7 +1332,6 @@ var Buffer = Module("Buffer", {
} }
if (prefs.get("browser.zoom.siteSpecific")) { if (prefs.get("browser.zoom.siteSpecific")) {
var privacy = sanitizer.getContext(this.win);
if (value == 1) { if (value == 1) {
this.prefs.clear("browser.content.full-zoom"); this.prefs.clear("browser.content.full-zoom");
this.prefs.clear("dactyl.content.full-zoom"); this.prefs.clear("dactyl.content.full-zoom");
@@ -1829,7 +1827,7 @@ var Buffer = Module("Buffer", {
commands.add(["frameo[nly]"], commands.add(["frameo[nly]"],
"Show only the current frame's page", "Show only the current frame's page",
function (args) { function () {
dactyl.open(buffer.focusedFrame.location.href); dactyl.open(buffer.focusedFrame.location.href);
}, },
{ argCount: "0" }); { argCount: "0" });
@@ -2041,7 +2039,7 @@ var Buffer = Module("Buffer", {
}); });
}, },
completion: function initCompletion(dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
let { CompletionContext, buffer, completion } = modules; let { buffer, completion } = modules;
completion.alternateStyleSheet = function alternateStylesheet(context) { completion.alternateStyleSheet = function alternateStylesheet(context) {
context.title = ["Stylesheet", "Location"]; context.title = ["Stylesheet", "Location"];
@@ -2100,7 +2098,7 @@ var Buffer = Module("Buffer", {
mappings.add([modes.NORMAL], mappings.add([modes.NORMAL],
["y", "<yank-location>"], "Yank current location to the clipboard", ["y", "<yank-location>"], "Yank current location to the clipboard",
function () { function () {
let { doc, uri } = buffer; let { uri } = buffer;
if (uri instanceof Ci.nsIURL) if (uri instanceof Ci.nsIURL)
uri.query = uri.query.replace(/(?:^|&)utm_[^&]+/g, "") uri.query = uri.query.replace(/(?:^|&)utm_[^&]+/g, "")
.replace(/^&/, ""); .replace(/^&/, "");
@@ -2438,7 +2436,7 @@ var Buffer = Module("Buffer", {
function () { buffer.showPageInfo(true); }); function () { buffer.showPageInfo(true); });
}, },
options: function initOptions(dactyl, modules, window) { options: function initOptions(dactyl, modules, window) {
let { Option, buffer, completion, config, options } = modules; let { Option, buffer, completion, options } = modules;
options.add(["encoding", "enc"], options.add(["encoding", "enc"],
"The current buffer's character encoding", "The current buffer's character encoding",

View File

@@ -660,7 +660,7 @@ var Commands = Module("commands", {
lazyDepends: true, lazyDepends: true,
Local: function Local(dactyl, modules, window) { Local: function Local(dactyl, modules, window) {
let { Group, contexts } = modules; let { contexts } = modules;
return { return {
init: function init() { init: function init() {
this.Command = Class("Command", Command, { modules: modules }); this.Command = Class("Command", Command, { modules: modules });
@@ -1550,10 +1550,10 @@ var Commands = Module("commands", {
const { commands, contexts } = modules; const { commands, contexts } = modules;
commands.add(["(", "-("], "", commands.add(["(", "-("], "",
function (args) { dactyl.echoerr(_("dactyl.cheerUp")); }, function () { dactyl.echoerr(_("dactyl.cheerUp")); },
{ hidden: true }); { hidden: true });
commands.add([")", "-)"], "", commands.add([")", "-)"], "",
function (args) { dactyl.echoerr(_("dactyl.somberDown")); }, function () { dactyl.echoerr(_("dactyl.somberDown")); },
{ hidden: true }); { hidden: true });
commands.add(["com[mand]"], commands.add(["com[mand]"],
@@ -1769,7 +1769,7 @@ var Commands = Module("commands", {
}); });
}, },
javascript: function initJavascript(dactyl, modules, window) { javascript: function initJavascript(dactyl, modules, window) {
const { JavaScript, commands } = modules; const { JavaScript } = modules;
JavaScript.setCompleter([CommandHive.prototype.get, CommandHive.prototype.remove], JavaScript.setCompleter([CommandHive.prototype.get, CommandHive.prototype.remove],
[function () [[c.names, c.description] for (c of this)]]); [function () [[c.names, c.description] for (c of this)]]);

View File

@@ -1123,7 +1123,7 @@ var Completion = Module("completion", {
const { commands, completion } = modules; const { commands, completion } = modules;
commands.add(["contexts"], commands.add(["contexts"],
"List the completion contexts used during completion of an Ex command", "List the completion contexts used during completion of an Ex command",
function (args) { function () {
modules.commandline.commandOutput( modules.commandline.commandOutput(
["div", { highlight: "Completions" }, ["div", { highlight: "Completions" },
template.completionRow(["Context", "Title"], "CompTitle"), template.completionRow(["Context", "Title"], "CompTitle"),

View File

@@ -769,7 +769,7 @@ var Contexts = Module("contexts", {
}); });
commands.add(["elsei[f]", "elif"], commands.add(["elsei[f]", "elif"],
"Execute commands until the next :elseif, :else, or :endif only if the argument returns true", "Execute commands until the next :elseif, :else, or :endif only if the argument returns true",
function (args) {}, function () {},
{ {
always: function (args) { always: function (args) {
checkStack("if"); checkStack("if");
@@ -781,7 +781,7 @@ var Contexts = Module("contexts", {
}); });
commands.add(["el[se]"], commands.add(["el[se]"],
"Execute commands until the next :endif only if the previous conditionals were not executed", "Execute commands until the next :endif only if the previous conditionals were not executed",
function (args) {}, function () {},
{ {
always: function (args) { always: function (args) {
checkStack("if"); checkStack("if");
@@ -792,7 +792,7 @@ var Contexts = Module("contexts", {
}); });
commands.add(["en[dif]", "fi"], commands.add(["en[dif]", "fi"],
"End a string of :if/:elseif/:else conditionals", "End a string of :if/:elseif/:else conditionals",
function (args) {}, function () {},
{ {
always: function (args) { args.context.noExecute = pop("if"); }, always: function (args) { args.context.noExecute = pop("if"); },
argCount: "0" argCount: "0"

View File

@@ -133,7 +133,7 @@ var Help = Module("Help", {
function rec(text, level, li) { function rec(text, level, li) {
let res = []; let res = [];
let list, space, i = 0; let list, i = 0;
for (let match of re.iterate(text)) { for (let match of re.iterate(text)) {
if (match.comment) if (match.comment)

View File

@@ -154,8 +154,6 @@ var Highlights = Module("Highlight", {
get: function get(k) this.highlight[k], get: function get(k) this.highlight[k],
set: function set(key, newStyle, force, append, extend) { set: function set(key, newStyle, force, append, extend) {
let [, class_, selectors] = key.match(/^([a-zA-Z_-]+)(.*)/);
let highlight = this.highlight[key] || this._create(false, [key]); let highlight = this.highlight[key] || this._create(false, [key]);
let bases = extend || highlight.extends; let bases = extend || highlight.extends;
@@ -316,7 +314,7 @@ var Highlights = Module("Highlight", {
if (scheme == "default") if (scheme == "default")
highlight.clear(); highlight.clear();
else { else {
lastScheme = modules.io.sourceFromRuntimePath(["colors/" + scheme + "." + config.fileExtension]); lastScheme = io.sourceFromRuntimePath(["colors/" + scheme + "." + config.fileExtension]);
dactyl.assert(lastScheme, _("command.colorscheme.notFound", scheme)); dactyl.assert(lastScheme, _("command.colorscheme.notFound", scheme));
} }
autocommands.trigger("ColorScheme", { name: scheme }); autocommands.trigger("ColorScheme", { name: scheme });

View File

@@ -34,7 +34,7 @@ var IO = Module("io", {
}, },
Local: function Local(dactyl, modules, window) { Local: function Local(dactyl, modules, window) {
let { io, plugins } = modules; let { io } = modules;
return { return {
init: function init() { init: function init() {

View File

@@ -4,8 +4,6 @@
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
"use strict"; "use strict";
let { getOwnPropertyNames } = Object;
try { try {
defineModule("javascript", { defineModule("javascript", {
@@ -694,7 +692,6 @@ var JavaScript = Module("javascript", {
modules.JavaScript = Class("JavaScript", JavaScript, { modules: modules, window: window }); modules.JavaScript = Class("JavaScript", JavaScript, { modules: modules, window: window });
}, },
completion: function (dactyl, modules, window) { completion: function (dactyl, modules, window) {
const { completion } = modules;
update(modules.completion, { update(modules.completion, {
get javascript() modules.javascript.bound.complete, get javascript() modules.javascript.bound.complete,
javascriptCompleter: JavaScript // Backwards compatibility javascriptCompleter: JavaScript // Backwards compatibility

View File

@@ -209,7 +209,7 @@ overlay.overlayWindow(Object.keys(config.overlays),
load: function onLoad(document) { load: function onLoad(document) {
let self = this; let self = this;
var { modules, Module } = this.modules; var { modules } = this.modules;
delete window.dactyl; delete window.dactyl;
this.startTime = Date.now(); this.startTime = Date.now();

View File

@@ -12,7 +12,6 @@ defineModule("styles", {
lazyRequire("contexts", ["Contexts"]); lazyRequire("contexts", ["Contexts"]);
lazyRequire("template", ["template"]); lazyRequire("template", ["template"]);
function cssUri(css) "chrome-data:text/css," + encodeURI(css);
var namespace = "@namespace html " + JSON.stringify(XHTML) + ";\n" + var namespace = "@namespace html " + JSON.stringify(XHTML) + ";\n" +
"@namespace xul " + JSON.stringify(XUL) + ";\n" + "@namespace xul " + JSON.stringify(XUL) + ";\n" +
"@namespace dactyl " + JSON.stringify(NS) + ";\n"; "@namespace dactyl " + JSON.stringify(NS) + ";\n";
@@ -608,7 +607,6 @@ var Styles = Module("Styles", {
}, },
{ {
completer: function (context, args) { completer: function (context, args) {
let compl = [];
let sheet = args["-group"].get(args["-name"]); let sheet = args["-group"].get(args["-name"]);
if (args.completeArg == 0) { if (args.completeArg == 0) {
if (sheet) if (sheet)
@@ -685,8 +683,6 @@ var Styles = Module("Styles", {
}, { }, {
bang: true, bang: true,
completer: function (context, args) { completer: function (context, args) {
let uris = util.visibleURIs(window.content);
Styles.completeSite(context, window.content, args["-group"]); Styles.completeSite(context, window.content, args["-group"]);
if (cmd.filter) if (cmd.filter)
context.filters.push(({ sheets }) => sheets.some(cmd.filter)); context.filters.push(({ sheets }) => sheets.some(cmd.filter));

View File

@@ -351,7 +351,7 @@ var Template = Module("Template", {
let s = [""]; let s = [""];
let start = 0; let start = 0;
let n = 0, _i; let _i; // XXX
for (let [i, length, args] of iter_) { for (let [i, length, args] of iter_) {
if (i == _i || i < _i) if (i == _i || i < _i)
break; break;