mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 08:27:59 +01:00
Minor cleanup.
This commit is contained in:
@@ -20,13 +20,6 @@ function Buffer() //{{{
|
|||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
// FIXME: This doesn't belong here.
|
|
||||||
let fontSize = util.computedStyle(document.getElementById(config.mainWindowId)).fontSize;
|
|
||||||
|
|
||||||
styles.registerSheet("chrome://liberator/skin/liberator.css");
|
|
||||||
let error = styles.addSheet(true, "font-size", "chrome://liberator/content/buffer.xhtml",
|
|
||||||
"body { font-size: " + fontSize + "; }");
|
|
||||||
|
|
||||||
if ("ZoomManager" in window)
|
if ("ZoomManager" in window)
|
||||||
{
|
{
|
||||||
const ZOOM_MIN = Math.round(ZoomManager.MIN * 100);
|
const ZOOM_MIN = Math.round(ZoomManager.MIN * 100);
|
||||||
@@ -187,13 +180,15 @@ function Buffer() //{{{
|
|||||||
{
|
{
|
||||||
commandline.input("Upload file: ", function (path) {
|
commandline.input("Upload file: ", function (path) {
|
||||||
let file = io.getFile(path);
|
let file = io.getFile(path);
|
||||||
|
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return liberator.beep();
|
return void liberator.beep();
|
||||||
|
|
||||||
elem.value = file.path;
|
elem.value = file.path;
|
||||||
},
|
},
|
||||||
{ completer: completion.file, default: elem.value });
|
{
|
||||||
|
completer: completion.file,
|
||||||
|
default: elem.value
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
@@ -780,13 +775,11 @@ function Buffer() //{{{
|
|||||||
var type = data.type && data.type.toLowerCase();
|
var type = data.type && data.type.toLowerCase();
|
||||||
type = type.replace(/^\s+|\s*(?:;.*)?$/g, "");
|
type = type.replace(/^\s+|\s*(?:;.*)?$/g, "");
|
||||||
|
|
||||||
isFeed = (type == "application/rss+xml" || type == "application/atom+xml");
|
isFeed = ["application/rss+xml", "application/atom+xml"].indexOf(type) >= 0;
|
||||||
if (!isFeed)
|
if (!isFeed)
|
||||||
{
|
{
|
||||||
// really slimy: general XML types with magic letters in the title
|
// really slimy: general XML types with magic letters in the title
|
||||||
const titleRegex = /(^|\s)rss($|\s)/i;
|
isFeed = type in feedTypes && /\brss\b/i.test(data.title);
|
||||||
isFeed = ((type == "text/xml" || type == "application/rdf+xml" || type == "application/xml")
|
|
||||||
&& titleRegex.test(data.title));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -824,7 +817,7 @@ function Buffer() //{{{
|
|||||||
if (isValidFeed(feed, doc.nodePrincipal, rel == "feed"))
|
if (isValidFeed(feed, doc.nodePrincipal, rel == "feed"))
|
||||||
{
|
{
|
||||||
nFeed++;
|
nFeed++;
|
||||||
let type = feedTypes[feed.type] || feedTypes["application/rss+xml"];
|
let type = feedTypes[feed.type] || "RSS";
|
||||||
if (verbose)
|
if (verbose)
|
||||||
yield [feed.title, template.highlightURL(feed.href, true) + <span class="extra-info"> ({type})</span>];
|
yield [feed.title, template.highlightURL(feed.href, true) + <span class="extra-info"> ({type})</span>];
|
||||||
}
|
}
|
||||||
@@ -971,45 +964,27 @@ function Buffer() //{{{
|
|||||||
/**
|
/**
|
||||||
* @property {number} The buffer's height in pixels.
|
* @property {number} The buffer's height in pixels.
|
||||||
*/
|
*/
|
||||||
get pageHeight()
|
get pageHeight() window.content.innerHeight,
|
||||||
{
|
|
||||||
return window.content.innerHeight;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {number} The current browser's text zoom level, as a
|
* @property {number} The current browser's text zoom level, as a
|
||||||
* percentage with 100 as 'normal'. Only affects text size.
|
* percentage with 100 as 'normal'. Only affects text size.
|
||||||
*/
|
*/
|
||||||
get textZoom()
|
get textZoom() getBrowser().markupDocumentViewer.textZoom * 100,
|
||||||
{
|
set textZoom(value) { setZoom(value, false); },
|
||||||
return getBrowser().markupDocumentViewer.textZoom * 100;
|
|
||||||
},
|
|
||||||
set textZoom(value)
|
|
||||||
{
|
|
||||||
setZoom(value, false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {number} The current browser's text zoom level, as a
|
* @property {number} The current browser's text zoom level, as a
|
||||||
* percentage with 100 as 'normal'. Affects text size, as well as
|
* percentage with 100 as 'normal'. Affects text size, as well as
|
||||||
* image size and block size.
|
* image size and block size.
|
||||||
*/
|
*/
|
||||||
get fullZoom()
|
get fullZoom() getBrowser().markupDocumentViewer.fullZoom * 100,
|
||||||
{
|
set fullZoom(value) { setZoom(value, true); },
|
||||||
return getBrowser().markupDocumentViewer.fullZoom * 100;
|
|
||||||
},
|
|
||||||
set fullZoom(value)
|
|
||||||
{
|
|
||||||
setZoom(value, true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {string} The current document's title.
|
* @property {string} The current document's title.
|
||||||
*/
|
*/
|
||||||
get title()
|
get title() window.content.document.title,
|
||||||
{
|
|
||||||
return window.content.document.title;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {number} The buffer's horizontal scroll percentile.
|
* @property {number} The buffer's horizontal scroll percentile.
|
||||||
@@ -2025,7 +2000,8 @@ function Marks() //{{{
|
|||||||
return void liberator.echoerr("E283: No marks matching " + filter.quote());
|
return void liberator.echoerr("E283: No marks matching " + filter.quote());
|
||||||
}
|
}
|
||||||
|
|
||||||
let list = template.tabular(["mark", "line", "col", "file"],
|
let list = template.tabular(
|
||||||
|
["Mark", "Line", "Column", "File"],
|
||||||
["", "text-align: right", "text-align: right", "color: green"],
|
["", "text-align: right", "text-align: right", "color: green"],
|
||||||
([mark[0],
|
([mark[0],
|
||||||
Math.round(mark[1].position.x * 100) + "%",
|
Math.round(mark[1].position.x * 100) + "%",
|
||||||
|
|||||||
@@ -679,7 +679,8 @@ liberator.registerObserver("load_commands", function () {
|
|||||||
{
|
{
|
||||||
// List matching keys
|
// List matching keys
|
||||||
let str = template.tabular(["Key", "Sample", "CSS"],
|
let str = template.tabular(["Key", "Sample", "CSS"],
|
||||||
["padding: 0 1em 0 0; vertical-align: top", "text-align: center"],
|
["padding: 0 1em 0 0; vertical-align: top",
|
||||||
|
"text-align: center"],
|
||||||
([h.class,
|
([h.class,
|
||||||
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
|
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
|
||||||
template.highlightRegexp(h.value, /\b[-\w]+(?=:)/g)]
|
template.highlightRegexp(h.value, /\b[-\w]+(?=:)/g)]
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
/** @scope modules */
|
/** @scope modules */
|
||||||
|
|
||||||
|
let fontSize = util.computedStyle(document.getElementById(config.mainWindowId)).fontSize;
|
||||||
|
|
||||||
|
styles.registerSheet("chrome://liberator/skin/liberator.css");
|
||||||
|
let error = styles.addSheet(true, "font-size", "chrome://liberator/content/buffer.xhtml",
|
||||||
|
"body { font-size: " + fontSize + "; }");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used for prompting of user input and echoing of messages.
|
* This class is used for prompting of user input and echoing of messages.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user