diff --git a/common/content/commands.js b/common/content/commands.js index 26b5d949..8c1ee93e 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -403,52 +403,54 @@ function Commands() //{{{ // FIXME: remove later, when our option handler is better /** - * @property The option argument is unspecified. Any argument is - * accepted and caller is responsible for parsing the return value. + * @property {number} The option argument is unspecified. Any argument + * is accepted and caller is responsible for parsing the return + * value. * @final */ OPTION_ANY: 0, /** - * @property The option doesn't accept an argument. + * @property {number} The option doesn't accept an argument. * @final */ OPTION_NOARG: 1, /** - * @property The option accepts a boolean argument. + * @property {number} The option accepts a boolean argument. * @final */ OPTION_BOOL: 2, /** - * @property The option accepts a string argument. + * @property {number} The option accepts a string argument. * @final */ OPTION_STRING: 3, /** - * @property The option accepts an integer argument. + * @property {number} The option accepts an integer argument. * @final */ OPTION_INT: 4, /** - * @property The option accepts a float argument. + * @property {number} The option accepts a float argument. * @final */ OPTION_FLOAT: 5, /** - * @property The option accepts a string list argument. E.g. "foo,bar" + * @property {number} The option accepts a string list argument. + * E.g. "foo,bar" * @final */ OPTION_LIST: 6, /** - * @property Indicates that no count was specified for this command - * invocation. + * @property {number} Indicates that no count was specified for this + * command invocation. * @final */ COUNT_NONE: -1, /** - * @property Indicates that the full buffer range (1,$) was specified - * for this command invocation. + * @property {number} Indicates that the full buffer range (1,$) was + * specified for this command invocation. * @final */ // FIXME: this isn't a count at all diff --git a/common/content/events.js b/common/content/events.js index 578cf094..93d0f5fc 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -765,10 +765,17 @@ function Events() //{{{ const self = { + /** + * @property {boolean} Whether synthetic key events are currently being + * processed. + */ feedingKeys: false, wantsModeReset: true, // used in onFocusChange since Firefox is so buggy here + /** + * A destructor called when this module is destroyed. + */ destroy: function () { // removeEventListeners() to avoid mem leaks @@ -789,6 +796,11 @@ function Events() //{{{ window.removeEventListener("keydown", this.onKeyDown, true); }, + /** + * Initiates the recording of a key event macro. + * + * @param {string} macro The name for the macro. + */ startRecording: function (macro) { if (!/[a-zA-Z0-9]/.test(macro)) @@ -813,6 +825,12 @@ function Events() //{{{ } }, + /** + * Replays a macro. + * + * @param {string} The name of the macro to replay. + * @return {boolean} + */ playMacro: function (macro) { let res = false; @@ -863,6 +881,11 @@ function Events() //{{{ return res; }, + /** + * Returns all macros matching filter. + * + * @param {string} filter A regular expression filter. + */ getMacros: function (filter) { if (!filter) @@ -872,6 +895,11 @@ function Events() //{{{ return ([macro, keys] for ([macro, keys] in macros) if (re.test(macro))); }, + /** + * Deletes all macros matching filter. + * + * @param {string} filter A regular expression filter. + */ deleteMacros: function (filter) { let re = RegExp(filter); @@ -884,12 +912,13 @@ function Events() //{{{ }, /** - * Pushes keys into the event queue from liberator it is similar to + * Pushes keys onto the event queue from liberator. It is similar to * Vim's feedkeys() method, but cannot cope with 2 partially-fed * strings, you have to feed one parsable string. * - * @param {string} keys A string like "2" to pass if you want "<" - * to be taken literally, prepend it with a "\\". + * @param {string} keys A string like "2" to push onto the event + * queue. If you want "<" to be taken literally, prepend it with a + * "\\". * @param {boolean} noremap Allow recursive mappings. * @param {boolean} silent Whether the command should be echoed to the * command line. @@ -1012,10 +1041,15 @@ function Events() //{{{ return i == keys.length; }, - // this function converts the given event to - // a keycode which can be used in mappings - // e.g. pressing ctrl+n would result in the string "" - // null if unknown key + /** + * Converts the specified key event to a string in liberator key-code + * notation. Returns null for an unknown key event. + * + * E.g. pressing ctrl+n would result in the string "". + * + * @param {Event} event + * @returns {string} + */ toString: function (event) { if (!event) @@ -1125,16 +1159,34 @@ function Events() //{{{ return "<" + modifier + key + ">"; }, + /** + * Whether key is a key code defined to accept/execute input on + * the command line. + * + * @returns {boolean} + */ isAcceptKey: function (key) { return (key == "" || key == "" || key == ""); }, + /** + * Whether key is a key code defined to reject/cancel input on + * the command line. + * + * @returns {boolean} + */ isCancelKey: function (key) { return (key == "" || key == "" || key == ""); }, + /* + * Waits for the current buffer to successfully finish loading. Returns + * true for a successful page load otherwise false. + * + * @returns {boolean} + */ waitForPageLoad: function () { //liberator.dump("start waiting in loaded state: " + buffer.loaded); @@ -1181,6 +1233,7 @@ function Events() //{{{ // argument "event" is deliberately not used, as i don't seem to have // access to the real focus target + // Huh? --djk // // the ugly wantsModeReset is needed, because Firefox generates a massive // amount of focus changes for things like (focusing the search field) diff --git a/common/content/hints.js b/common/content/hints.js index 5d698827..1083ab3e 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -84,9 +84,9 @@ function Hints() //{{{ }; /** - * Used to open multiple hints + * Used to open multiple hints. * - * @param {node} elem the previously selected hint + * @param {node} elem The previously selected hint. */ function hintAction_F(elem) { @@ -131,14 +131,14 @@ function Hints() //{{{ * Get a hint for "input", "textarea" and "select". * * Tries to use