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

Commandline completion for hinted file inputs

When an <input type="file"> is selected with hints, it will cause an
"Upload file: " prompt in the commandline. (Selection with tab and mouse
is left unchanged and will cause the firefox dialog to display)
This commit is contained in:
Conrad Irwin
2009-03-16 12:28:34 +00:00
parent c8a405cec5
commit 924aba8f54
3 changed files with 14 additions and 0 deletions

View File

@@ -1019,6 +1019,11 @@ function Buffer() //{{{
elem.contentWindow.focus(); elem.contentWindow.focus();
return; return;
} }
else if (elemTagName == "input" && elem.getAttribute('type').toLowerCase() == "file")
{
commandline.input("Upload file: ", function (file) elem.value = file, {completer: completion.file, default: elem.value});
return;
}
elem.focus(); elem.focus();
@@ -1124,6 +1129,11 @@ function Buffer() //{{{
offsetX = Number(coords[0]) + 1; offsetX = Number(coords[0]) + 1;
offsetY = Number(coords[1]) + 1; offsetY = Number(coords[1]) + 1;
} }
else if (localName == "input" && elem.getAttribute('type').toLowerCase() == "file")
{
commandline.input("Upload file: ", function (file) elem.value = file, {completer: completion.file, default: elem.value});
return;
}
let ctrlKey = false, shiftKey = false; let ctrlKey = false, shiftKey = false;
switch (where) switch (where)

View File

@@ -1201,6 +1201,8 @@ function CommandLine() //{{{
* for the user's input. * for the user's input.
* @... {string} promptHighlight - The HighlightGroup used for the * @... {string} promptHighlight - The HighlightGroup used for the
* prompt. @default "Question" * prompt. @default "Question"
* @... {string} default - The initial value that will be returned
* if the user presses <CR> straightaway. @default ""
*/ */
input: function _input(prompt, callback, extra) input: function _input(prompt, callback, extra)
{ {

View File

@@ -21,6 +21,8 @@
* IMPORTANT: 'verbose' is now by default at 1, set to 0 to not show any status messages. * IMPORTANT: 'verbose' is now by default at 1, set to 0 to not show any status messages.
* IMPORTANT: $VIMPERATOR_HOME is no longer used. * IMPORTANT: $VIMPERATOR_HOME is no longer used.
* Selecting an <input type="file"> with hints now causes the commandline to prompt
for file input (instead of doing nothing).
* [count]<C-n> now goes to the [count]th next tab rather than the [count]th tab. * [count]<C-n> now goes to the [count]th next tab rather than the [count]th tab.
* add ~/.vimperator/info/{profile}/, similar to viminfo * add ~/.vimperator/info/{profile}/, similar to viminfo
* add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT * add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT