From 0a7f399bf7658ca8a2bcc55ebb4af646162faa35 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 26 Jan 2011 03:36:34 -0500 Subject: Use table tags in :addons and :downloads to better support :yank. --- common/content/bookmarks.js | 10 +- common/content/browser.js | 12 +- common/content/buffer.js | 58 ++- common/content/commandline.js | 946 +++++++++++++----------------------------- common/content/dactyl.js | 6 + common/content/events.js | 17 +- common/content/hints.js | 87 ++-- common/content/mappings.js | 2 + common/content/modes.js | 46 +- common/content/mow.js | 352 ++++++++++++++++ common/content/tabs.js | 2 +- 11 files changed, 767 insertions(+), 771 deletions(-) create mode 100644 common/content/mow.js (limited to 'common/content') diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 8b741d9a..fb936e3b 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -115,9 +115,8 @@ var Bookmarks = Module("bookmarks", { if (charset != null && charset !== "UTF-8") options["-charset"] = charset; - commandline.open(":", - commands.commandToString({ command: "bmark", options: options, arguments: [url] }) + " -keyword ", - modes.EX); + CommandExMode().open( + commands.commandToString({ command: "bmark", options: options, arguments: [url] }) + " -keyword "); }, /** @@ -582,9 +581,8 @@ var Bookmarks = Module("bookmarks", { options["-charset"] = content.document.characterSet; } - commandline.open(":", - commands.commandToString({ command: "bmark", options: options, arguments: [buffer.uri.spec] }), - modes.EX); + CommandExMode().open( + commands.commandToString({ command: "bmark", options: options, arguments: [buffer.uri.spec] })); }); mappings.add(myModes, ["A"], diff --git a/common/content/browser.js b/common/content/browser.js index 1be4fcfb..fd00987e 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -71,27 +71,27 @@ var Browser = Module("browser", { // opening websites mappings.add([modes.NORMAL], ["o"], "Open one or more URLs", - function () { commandline.open(":", "open ", modes.EX); }); + function () { CommandExMode().open("open "); }); mappings.add([modes.NORMAL], ["O"], "Open one or more URLs, based on current location", - function () { commandline.open(":", "open " + buffer.uri.spec, modes.EX); }); + function () { CommandExMode().open("open " + buffer.uri.spec); }); mappings.add([modes.NORMAL], ["t"], "Open one or more URLs in a new tab", - function () { commandline.open(":", "tabopen ", modes.EX); }); + function () { CommandExMode().open("tabopen "); }); mappings.add([modes.NORMAL], ["T"], "Open one or more URLs in a new tab, based on current location", - function () { commandline.open(":", "tabopen " + buffer.uri.spec, modes.EX); }); + function () { CommandExMode().open("tabopen " + buffer.uri.spec); }); mappings.add([modes.NORMAL], ["w"], "Open one or more URLs in a new window", - function () { commandline.open(":", "winopen ", modes.EX); }); + function () { CommandExMode().open("winopen "); }); mappings.add([modes.NORMAL], ["W"], "Open one or more URLs in a new window, based on current location", - function () { commandline.open(":", "winopen " + buffer.uri.spec, modes.EX); }); + function () { CommandExMode().open("winopen " + buffer.uri.spec); }); mappings.add([modes.NORMAL], [""], "Increment last number in URL", diff --git a/common/content/buffer.js b/common/content/buffer.js index 999e1710..1bbaab99 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -766,25 +766,25 @@ var Buffer = Module("buffer", { try { window.urlSecurityCheck(uri.spec, doc.nodePrincipal); - commandline.input("Save link: ", function (path) { - let file = io.File(path); - if (file.exists() && file.isDirectory()) - file.append(buffer.getDefaultNames(elem)[0][0]); + io.CommandFileMode("Save link: ", { + onSubmit: function (path) { + let file = io.File(path); + if (file.exists() && file.isDirectory()) + file.append(buffer.getDefaultNames(elem)[0][0]); - try { - if (!file.exists()) - file.create(File.NORMAL_FILE_TYPE, octal(644)); - } - catch (e) { - util.assert(false, "Invalid destination: " + e.name); - } + try { + if (!file.exists()) + file.create(File.NORMAL_FILE_TYPE, octal(644)); + } + catch (e) { + util.assert(false, "Invalid destination: " + e.name); + } - buffer.saveURI(uri, file); - }, { - autocomplete: true, - completer: function (context) completion.savePage(context, elem), - history: "file" - }); + buffer.saveURI(uri, file); + }, + + completer: function (context) completion.savePage(context, elem) + }).open(); } catch (e) { dactyl.echoerr(e); @@ -1360,17 +1360,15 @@ var Buffer = Module("buffer", { }, openUploadPrompt: function openUploadPrompt(elem) { - commandline.input("Upload file: ", function (path) { - let file = io.File(path); - dactyl.assert(file.exists()); - - elem.value = file.path; - events.dispatch(elem, events.create(elem.ownerDocument, "change", {})); - }, { - completer: function (context) completion.file(context), - default: elem.value, - history: "file" - }); + io.CommandFileMode("Upload file: ", { + onSubmit: function (path) { + let file = io.File(path); + dactyl.assert(file.exists()); + + elem.value = file.path; + events.dispatch(elem, events.create(elem.ownerDocument, "change", {})); + } + }).open(elem.value); } }, { commands: function () { @@ -1530,7 +1528,8 @@ var Buffer = Module("buffer", { if (/^>>/.test(context.filter)) context.advance(/^>>\s*/.exec(context.filter)[0].length); - return completion.savePage(context, content.document); + completion.savePage(context, content.document); + context.fork("file", 0, completion, "file"); }, literal: 0 }); @@ -1642,7 +1641,6 @@ var Buffer = Module("buffer", { this, function (context) { context.completions = buffer.getDefaultNames(node); }); - return context.fork("files", 0, completion, "file"); }; }, events: function () { diff --git a/common/content/commandline.js b/common/content/commandline.js index 8b3bae08..77a11e4d 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -20,39 +20,12 @@ var CommandWidgets = Class("CommandWidgets", { eventTarget: commandline }, append: - - - - - - - - - - - - -