mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 16:47:59 +01:00
Add some more rough source documentation.
This commit is contained in:
@@ -41,6 +41,7 @@ function Buffer() //{{{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
/* FIXME: This doesn't belong here. */
|
||||
let mainWindowID = config.mainWindowID || "main-window";
|
||||
let fontSize = util.computedStyle(document.getElementById(mainWindowID)).fontSize;
|
||||
@@ -813,8 +814,8 @@ function Buffer() //{{{
|
||||
return {
|
||||
|
||||
/**
|
||||
* The alternative stylesheets for the current buffer. Only
|
||||
* returns stylesheets for the 'screen' media type.
|
||||
* @property {Array} The alternative stylesheets for the current
|
||||
* buffer. Only returns stylesheets for the 'screen' media type.
|
||||
*/
|
||||
get alternateStyleSheets()
|
||||
{
|
||||
@@ -832,10 +833,11 @@ function Buffer() //{{{
|
||||
get pageInfo() pageInfo,
|
||||
|
||||
/**
|
||||
* Returns whether the buffer is loaded. Values may be:
|
||||
* 0 - Loading.
|
||||
* 1 - Fully loaded.
|
||||
* 2 - Load failed.
|
||||
* @property {number} A value indicating whether the buffer is loaded.
|
||||
* Values may be:
|
||||
* 0 - Loading.
|
||||
* 1 - Fully loaded.
|
||||
* 2 - Load failed.
|
||||
*/
|
||||
get loaded()
|
||||
{
|
||||
@@ -850,8 +852,8 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* The last focused input field in the buffer. Used by the
|
||||
* "gi" key binding.
|
||||
* @property {Object} The last focused input field in the buffer. Used
|
||||
* by the "gi" key binding.
|
||||
*/
|
||||
get lastInputField()
|
||||
{
|
||||
@@ -866,21 +868,24 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* The current top-level document's URL.
|
||||
* @property {string} The current top-level document's URL.
|
||||
*/
|
||||
get URL()
|
||||
{
|
||||
return window.content.document.location.href;
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {number} The buffer's height in pixels.
|
||||
*/
|
||||
get pageHeight()
|
||||
{
|
||||
return window.content.innerHeight;
|
||||
},
|
||||
|
||||
/**
|
||||
* The current browser's text zoom level, as a percentage with
|
||||
* 100 as 'normal'. Only affects text size.
|
||||
* @property {number} The current browser's text zoom level, as a
|
||||
* percentage with 100 as 'normal'. Only affects text size.
|
||||
*/
|
||||
get textZoom()
|
||||
{
|
||||
@@ -892,9 +897,9 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* The current browser's text zoom level, as a percentage with
|
||||
* 100 as 'normal'. Affects text size, as well as image size
|
||||
* and block size.
|
||||
* @property {number} The current browser's text zoom level, as a
|
||||
* percentage with 100 as 'normal'. Affects text size, as well as
|
||||
* image size and block size.
|
||||
*/
|
||||
get fullZoom()
|
||||
{
|
||||
@@ -906,7 +911,7 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* The current document's title.
|
||||
* @property {string} The current document's title.
|
||||
*/
|
||||
get title()
|
||||
{
|
||||
@@ -914,6 +919,7 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a new section to the page information output.
|
||||
*
|
||||
* @param {string} option The section's value in 'pageinfo'.
|
||||
* @param {string} title The heading for this section's
|
||||
@@ -968,6 +974,8 @@ function Buffer() //{{{
|
||||
* positioned in.
|
||||
*
|
||||
* NOTE: might change the selection
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
// FIXME: getSelection() doesn't always preserve line endings, see:
|
||||
// https://www.mozdev.org/bugs/show_bug.cgi?id=19303
|
||||
@@ -1022,9 +1030,8 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* Try to guess links the like of "next" and "prev". Though it
|
||||
* has a singularly horrendous name, it turns out to be quite
|
||||
* useful.
|
||||
* Tries to guess links the like of "next" and "prev". Though it has a
|
||||
* singularly horrendous name, it turns out to be quite useful.
|
||||
*
|
||||
* @param {string} rel The relationship to look for. Looks for
|
||||
* links with matching @rel or @rev attributes, and,
|
||||
@@ -1143,13 +1150,19 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* The current document's selection controller.
|
||||
* @property {Object} The current document's selection controller.
|
||||
*/
|
||||
get selectionController() getBrowser().docShell
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsISelectionDisplay)
|
||||
.QueryInterface(Ci.nsISelectionController),
|
||||
|
||||
/**
|
||||
* Saves a page link to disk.
|
||||
*
|
||||
* @param {Object} elem The page link to save.
|
||||
* @param {boolean} skipPrompt Whether to open the "Save Link As..." dialog
|
||||
*/
|
||||
saveLink: function (elem, skipPrompt)
|
||||
{
|
||||
let doc = elem.ownerDocument;
|
||||
@@ -1225,7 +1238,13 @@ function Buffer() //{{{
|
||||
win.scrollByPages(pages);
|
||||
},
|
||||
|
||||
scrollByScrollSize: function (count, direction)
|
||||
/**
|
||||
* Scrolls the buffer vertically <b>count</b> * 'scroll' rows.
|
||||
*
|
||||
* @param {number} count The multiple of 'scroll' lines to scroll.
|
||||
* @param {number} direction The direction to scroll, down if 1 and up if -1.
|
||||
*/
|
||||
scrollByScrollSize: function (count, direction) // XXX: boolean
|
||||
{
|
||||
if (count > 0)
|
||||
options["scroll"] = count;
|
||||
@@ -1240,7 +1259,9 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
/**
|
||||
* Scrolls the current buffer vertically to <b>percentage</b>
|
||||
* Scrolls the current buffer vertically to <b>percentage</b>.
|
||||
*
|
||||
* @param {number} percentage The page percentile to scroll the buffer to.
|
||||
*/
|
||||
scrollToPercentile: function (percentage)
|
||||
{
|
||||
@@ -1264,6 +1285,13 @@ function Buffer() //{{{
|
||||
},
|
||||
|
||||
// TODO: allow callback for filtering out unwanted frames? User defined?
|
||||
/**
|
||||
* Shifts the focus to another frame within the buffer. Each buffer
|
||||
* contains at least one frame.
|
||||
*
|
||||
* @param {number} count The number of frames to skip through.
|
||||
* @param {boolean} forward The direction of motion.
|
||||
*/
|
||||
shiftFrameFocus: function (count, forward)
|
||||
{
|
||||
if (!window.content.document instanceof HTMLDocument)
|
||||
@@ -1342,11 +1370,23 @@ function Buffer() //{{{
|
||||
|
||||
// similar to pageInfo
|
||||
// TODO: print more useful information, just like the DOM inspector
|
||||
/**
|
||||
* Displays information about the specified element.
|
||||
*
|
||||
* @param {Object} elem
|
||||
*/
|
||||
showElementInfo: function (elem)
|
||||
{
|
||||
liberator.echo(<>Element:<br/>{util.objectToString(elem, true)}</>, commandline.FORCE_MULTILINE);
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays information about the current buffer.
|
||||
*
|
||||
* @param {boolean} verbose Display more verbose information.
|
||||
* @param {string} sections A string limiting the displayed sections.
|
||||
* @default The value of 'pageinfo'.
|
||||
*/
|
||||
showPageInfo: function (verbose, sections)
|
||||
{
|
||||
// Ctrl-g single line output
|
||||
@@ -1376,6 +1416,9 @@ function Buffer() //{{{
|
||||
liberator.echo(list, commandline.FORCE_MULTILINE);
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens a viewer to inspect the source of the currently selected range.
|
||||
*/
|
||||
viewSelectionSource: function ()
|
||||
{
|
||||
// copied (and tuned somebit) from browser.jar -> nsContextMenu.js
|
||||
@@ -1396,6 +1439,15 @@ function Buffer() //{{{
|
||||
docUrl, docCharset, reference, "selection");
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens a viewer to inspect the source of the current buffer or the
|
||||
* specified <b>url</b>. Either the default viewer or the configured
|
||||
* external editor is used.
|
||||
*
|
||||
* @param {string} url The URL of the source.
|
||||
* @default The current buffer.
|
||||
* @param {boolean} useExternalEditor View the source in the external editor.
|
||||
*/
|
||||
viewSource: function (url, useExternalEditor)
|
||||
{
|
||||
url = url || buffer.URL;
|
||||
@@ -1406,11 +1458,23 @@ function Buffer() //{{{
|
||||
liberator.open("view-source:" + url);
|
||||
},
|
||||
|
||||
/**
|
||||
* Increases the zoom level of the current buffer.
|
||||
*
|
||||
* @param {number} steps The number of zoom levels to jump.
|
||||
* @param {boolean} fullZoom Whether to use full zoom or text zoom.
|
||||
*/
|
||||
zoomIn: function (steps, fullZoom)
|
||||
{
|
||||
bumpZoomLevel(steps, fullZoom);
|
||||
},
|
||||
|
||||
/**
|
||||
* Decreases the zoom level of the current buffer.
|
||||
*
|
||||
* @param {number} steps The number of zoom levels to jump.
|
||||
* @param {boolean} fullZoom Whether to use full zoom or text zoom.
|
||||
*/
|
||||
zoomOut: function (steps, fullZoom)
|
||||
{
|
||||
bumpZoomLevel(-steps, fullZoom);
|
||||
|
||||
Reference in New Issue
Block a user