mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 23:47:58 +01:00
fix completion.alternateStylesheet
This commit is contained in:
@@ -1583,22 +1583,18 @@ function Completion() //{{{
|
|||||||
alternateStylesheet: function alternateStylesheet(context)
|
alternateStylesheet: function alternateStylesheet(context)
|
||||||
{
|
{
|
||||||
context.title = ["Stylesheet", "Location"];
|
context.title = ["Stylesheet", "Location"];
|
||||||
context.keys = { text: "title", description: function (item) item.href };
|
|
||||||
|
|
||||||
// unify split style sheets
|
// unify split style sheets
|
||||||
let completions = buffer.alternateStyleSheets;
|
let styles = {};
|
||||||
completions.forEach(function (stylesheet) {
|
|
||||||
stylesheet.href = stylesheet.href || "inline";
|
buffer.alternateStyleSheets.forEach(function (style) {
|
||||||
completions = completions.filter(function (sheet) {
|
if (style.title in styles)
|
||||||
if (stylesheet.title == sheet.title && stylesheet != sheet)
|
styles[style.title].push(style.href);
|
||||||
{
|
else
|
||||||
stylesheet.href += ", " + sheet.href;
|
styles[style.title] = [style.href];
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
context.completions = completions;
|
context.completions = [[s, styles[s].join(", ")] for (s in styles)];
|
||||||
},
|
},
|
||||||
|
|
||||||
// filter a list of urls
|
// filter a list of urls
|
||||||
|
|||||||
Reference in New Issue
Block a user