File: formfill.js

package info (click to toggle)
conkeror 1.0.3%2Bgit170123-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,988 kB
  • sloc: ansic: 280; sh: 255; xml: 173; makefile: 69
file content (53 lines) | stat: -rw-r--r-- 1,463 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
 * (C) Copyright 2010 John J. Foerch
 *
 * Use, modification, and distribution are subject to the terms specified in the
 * COPYING file.
**/

/*
This module manages formfill_keymap, the keymap for interacting with the
popup_autocomplete panel.

notes for future development:

http://mxr.mozilla.org/mozilla-central/source/xpfe/components/autocomplete/resources/content/autocomplete.xml
*/

interactive("formfill-next",
    "Select next item in the formfill popup.",
    function (I) {
        var p = I.window.document.getElementById("popup_autocomplete");
        var reverse = false, page = false;
        p.selectBy(reverse, page);
    });

interactive("formfill-previous",
    "Select previous item in the formfill popup.",
    function (I) {
        var p = I.window.document.getElementById("popup_autocomplete");
        var reverse = true, page = false;
        p.selectBy(reverse, page);
    });

function formfill_modality (buffer) {
    buffer.keymaps.push(formfill_keymap);
}

function formfill_mode (arg, panel) {
    var buffer = panel.buffer;
    if (buffer) {
        var i = buffer.modalities.indexOf(formfill_modality);
        if (i > -1)
            buffer.modalities.splice(i, 1);
        delete panel.buffer;
    }
    if (arg) {
        buffer = panel.ownerDocument.defaultView.buffers.current;
        buffer.modalities.push(formfill_modality);
        panel.buffer = buffer;
    }
    buffer.set_input_mode();
}

provide("formfill");