1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 10:17:59 +01:00

Use @returns rather than @return in API docs.

This commit is contained in:
Doug Kearns
2009-05-16 02:20:12 +10:00
parent cb0a352454
commit bd1798726f
3 changed files with 26 additions and 32 deletions

View File

@@ -140,7 +140,7 @@ function Hints() //{{{
* @param {string} tagname Its tagname. * @param {string} tagname Its tagname.
* @param {doc} The document it is in. * @param {doc} The document it is in.
* *
* @return [text, showtext] * @returns [text, showtext]
*/ */
function getInputHint(elem, tagname, doc) function getInputHint(elem, tagname, doc)
{ {
@@ -184,9 +184,9 @@ function Hints() //{{{
if (elem.id) if (elem.id)
{ {
//TODO: (possibly) do some guess work for label-like objects //TODO: (possibly) do some guess work for label-like objects
let label = buffer.evaluateXPath("//label[@for='"+elem.id+"']", doc).snapshotItem(0); let label = buffer.evaluateXPath("//label[@for='" + elem.id + "']", doc).snapshotItem(0);
if (label) if (label)
return [label.textContent.toLowerCase(),true] return [label.textContent.toLowerCase(), true]
} }
} }
else if (option == "name") else if (option == "name")
@@ -204,8 +204,7 @@ function Hints() //{{{
* @param {object} elem The <area> element. * @param {object} elem The <area> element.
* @param {Number} leftpos The left offset of the image. * @param {Number} leftpos The left offset of the image.
* @param {Number} toppos The top offset of the image. * @param {Number} toppos The top offset of the image.
* * @returns [leftpos, toppos] The updated offsets.
* @return [leftpos, toppos] The updated offsets.
*/ */
function getAreaOffset(elem, leftpos, toppos) function getAreaOffset(elem, leftpos, toppos)
{ {
@@ -238,7 +237,7 @@ function Hints() //{{{
for (let i = 0; i < coords.length; i += 2) for (let i = 0; i < coords.length; i += 2)
{ {
leftbound = Math.min(coords[i], leftbound); leftbound = Math.min(coords[i], leftbound);
topbound = Math.min(coords[i+1], topbound); topbound = Math.min(coords[i + 1], topbound);
} }
let curtop = null; let curtop = null;
@@ -249,13 +248,13 @@ function Hints() //{{{
for (let i = 0; i < coords.length; i += 2) for (let i = 0; i < coords.length; i += 2)
{ {
let leftoffset = coords[i] - leftbound; let leftoffset = coords[i] - leftbound;
let topoffset = coords[i+1] - topbound; let topoffset = coords[i + 1] - topbound;
let dist = Math.sqrt(leftoffset * leftoffset + topoffset * topoffset); let dist = Math.sqrt(leftoffset * leftoffset + topoffset * topoffset);
if (dist < curdist) if (dist < curdist)
{ {
curdist = dist; curdist = dist;
curleft = coords[i]; curleft = coords[i];
curtop = coords[i+1]; curtop = coords[i + 1];
} }
} }
@@ -589,8 +588,7 @@ function Hints() //{{{
* Get the hintMatcher according to user preference. * Get the hintMatcher according to user preference.
* *
* @param {string} hintString The currently typed hint. * @param {string} hintString The currently typed hint.
* * @returns {hintMatcher}
* @return {hintMatcher}
*/ */
function hintMatcher(hintString) //{{{ function hintMatcher(hintString) //{{{
{ {
@@ -599,8 +597,7 @@ function Hints() //{{{
* *
* @param {RegExp|String} pat The pattern to split on * @param {RegExp|String} pat The pattern to split on
* @param {String} string The string to split * @param {String} string The string to split
* * @returns {Array(string)} The lowercased splits of the stting.
* @return {Array(string)} The lowercased splits of the stting.
*/ */
function tokenize(pat, string) string.split(pat).map(String.toLowerCase); function tokenize(pat, string) string.split(pat).map(String.toLowerCase);
@@ -612,9 +609,8 @@ function Hints() //{{{
* order, in the link. * order, in the link.
* *
* @param {String} hintString The string typed by the user. * @param {String} hintString The string typed by the user.
* * @returns {function(String):boolean} A function that takes the text
* @return {function(String):bool} A function that takes the text of a * of a hint and returns true if all the (space-delimited) sets of
* hint and returns true if all the (space-delimited) sets of
* characters typed by the user can be found in it. * characters typed by the user can be found in it.
*/ */
function containsMatcher(hintString) //{{{ function containsMatcher(hintString) //{{{
@@ -637,8 +633,7 @@ function Hints() //{{{
* @param {String} hintString The string typed by the user. * @param {String} hintString The string typed by the user.
* @param {boolean} allowWordOverleaping Whether to allow non-contiguous * @param {boolean} allowWordOverleaping Whether to allow non-contiguous
* words to match. * words to match.
* * @returns {function(String):boolean} A function that will filter only
* @return {function(String):boolean} A function that will filter only
* hints that match as above. * hints that match as above.
*/ */
function wordStartsWithMatcher(hintString, allowWordOverleaping) //{{{ function wordStartsWithMatcher(hintString, allowWordOverleaping) //{{{
@@ -658,8 +653,7 @@ function Hints() //{{{
* @param {Array(String)} words The words to match them against * @param {Array(String)} words The words to match them against
* @param {boolean} allowWordOverleaping Whether words may be * @param {boolean} allowWordOverleaping Whether words may be
* skipped during matching. * skipped during matching.
* * @returns {boolean} Whether a match can be found.
* @return {boolean} Whether a match can be found.
*/ */
function charsAtBeginningOfWords(chars, words, allowWordOverleaping) function charsAtBeginningOfWords(chars, words, allowWordOverleaping)
{ {
@@ -718,8 +712,7 @@ function Hints() //{{{
* @param {Array(String)} words The words to search in. * @param {Array(String)} words The words to search in.
* @param {boolean} allowWordOverleaping Whether matches may be * @param {boolean} allowWordOverleaping Whether matches may be
* non-contiguous. * non-contiguous.
* * @returns boolean Whether all the strings matched.
* @return boolean Whether all the strings matched.
*/ */
function stringsAtBeginningOfWords(strings, words, allowWordOverleaping) function stringsAtBeginningOfWords(strings, words, allowWordOverleaping)
{ {
@@ -779,7 +772,8 @@ function Hints() //{{{
"//input[not(@type='hidden')] | //a | //area | //iframe | //textarea | //button | //select | " + "//input[not(@type='hidden')] | //a | //area | //iframe | //textarea | //button | //select | " +
"//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select"; "//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select";
function checkXPath(val) { function checkXPath(val)
{
try try
{ {
buffer.evaluateXPath(val, document.implementation.createDocument("", "", null)); buffer.evaluateXPath(val, document.implementation.createDocument("", "", null));
@@ -899,12 +893,12 @@ function Hints() //{{{
/** /**
* Creates a new hint mode. * Creates a new hint mode.
* *
* @param {String} mode The letter that identifies this mode. * @param {string} mode The letter that identifies this mode.
* @param {String} description The description to display to the user * @param {string} description The description to display to the user
* about this mode. * about this mode.
* @param {function(Node)} callback The function to be called with the * @param {function(Node)} callback The function to be called with the
* element that matches. * element that matches.
* @param {function():String} selector The function that returns an * @param {function():string} selector The function that returns an
* XPath selector to decide which elements can be hinted (the * XPath selector to decide which elements can be hinted (the
* default returns options.hinttags). * default returns options.hinttags).
*/ */
@@ -970,7 +964,7 @@ function Hints() //{{{
}, },
/** /**
* Handle an event. * Handle a hint mode event.
* *
* @param {Event} event The event to handle. * @param {Event} event The event to handle.
*/ */

View File

@@ -1120,7 +1120,7 @@ lookup:
* *
* @param {function} fn The function to execute. * @param {function} fn The function to execute.
* @param {Object} self The 'this' object used when executing fn. * @param {Object} self The 'this' object used when executing fn.
* @return {boolean} false if temp files couldn't be created, * @returns {boolean} false if temp files couldn't be created,
* otherwise, the return value of <b>fn</b>. * otherwise, the return value of <b>fn</b>.
*/ */
withTempFiles: function (fn, self) withTempFiles: function (fn, self)

View File

@@ -620,7 +620,7 @@ function CommandLine() //{{{
/** /**
* Determines whether the command line should be visible. * Determines whether the command line should be visible.
* *
* @return {boolean} * @returns {boolean}
*/ */
function commandShown() modes.main == modes.COMMAND_LINE && function commandShown() modes.main == modes.COMMAND_LINE &&
!(modes.extended & (modes.INPUT_MULTILINE | modes.OUTPUT_MULTILINE)); !(modes.extended & (modes.INPUT_MULTILINE | modes.OUTPUT_MULTILINE));