mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 06:07:59 +01:00
Use @returns rather than @return in API docs.
This commit is contained in:
@@ -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,10 +609,9 @@ 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) //{{{
|
||||||
{
|
{
|
||||||
@@ -636,9 +632,8 @@ 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) //{{{
|
||||||
@@ -657,9 +652,8 @@ function Hints() //{{{
|
|||||||
* @param {String} chars The characters to match
|
* @param {String} chars The characters to match
|
||||||
* @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)
|
||||||
{
|
{
|
||||||
@@ -717,9 +711,8 @@ function Hints() //{{{
|
|||||||
* @param {Array(String)} strings The strings to search for.
|
* @param {Array(String)} strings The strings to search for.
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user