mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 14:32:27 +01:00
unify the presentation of split style sheets when completing :pagestyle
This commit is contained in:
@@ -571,9 +571,8 @@ liberator.Buffer = function () //{{{
|
||||
{
|
||||
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));
|
||||
return /^(screen|all|)$/i.test(stylesheet.media.mediaText) && !/^\s*$/.test(stylesheet.title);
|
||||
});
|
||||
|
||||
return stylesheets;
|
||||
|
||||
@@ -402,13 +402,22 @@ liberator.Completion = function () //{{{
|
||||
|
||||
stylesheet: function (filter)
|
||||
{
|
||||
var stylesheets = getAllStyleSheets(window.content);
|
||||
|
||||
stylesheets = liberator.buffer.alternateStyleSheets.map(function (stylesheet) {
|
||||
var completions = liberator.buffer.alternateStyleSheets.map(function (stylesheet) {
|
||||
return [stylesheet.title, stylesheet.href || "inline"];
|
||||
});
|
||||
|
||||
return [0, this.filter(stylesheets, filter)];
|
||||
// unify split style sheets
|
||||
completions.forEach(function (stylesheet) {
|
||||
for (let i = 0; i < completions.length; i++) {
|
||||
if (stylesheet[0] == completions[i][0] && stylesheet[1] != completions[i][1])
|
||||
{
|
||||
stylesheet[1] += ", " + completions[i][1];
|
||||
completions.splice(i, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return [0, this.filter(completions, filter)];
|
||||
},
|
||||
|
||||
// filter a list of urls
|
||||
|
||||
Reference in New Issue
Block a user