1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 12:42:26 +01:00

only complete :pagestyle with style sheets of media type "all" or "screen"

This commit is contained in:
Doug Kearns
2008-07-30 02:13:04 +00:00
parent dbcf8c8b69
commit bc35f9368c
2 changed files with 15 additions and 1 deletions

View File

@@ -456,6 +456,12 @@ liberator.Buffer = function () //{{{
"Select the author style sheet to apply",
function (args)
{
if (!args)
{
liberator.echoerr("E471: Argument required");
return;
}
if (liberator.options["usermode"])
liberator.options["usermode"] = false;

View File

@@ -287,7 +287,15 @@ liberator.Completion = function () //{{{
stylesheet: function (filter)
{
var stylesheets = getAllStyleSheets(window.content).map(function (stylesheet) { return [stylesheet.title, ""]; });
var stylesheets = getAllStyleSheets(window.content);
// TODO: how should we handle duplicate titles?
stylesheets = stylesheets.filter(function(stylesheet) {
return !(!/^(screen|all|)$/i.test(stylesheet.media.mediaText) || /^\s*$/.test(stylesheet.title))
}).map(function (stylesheet) {
return [stylesheet.title, stylesheet.href || "inline"];
});
return [0, this.filter(stylesheets, filter)];
},