1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 05:04:12 +01:00

Restore most of :style list filtering and clarify docs.

Closes issue #540.
This commit is contained in:
Doug Kearns
2011-07-14 22:01:44 +10:00
parent d734bf42af
commit 328b992969
2 changed files with 12 additions and 5 deletions

View File

@@ -282,7 +282,11 @@
<item>
<tags>:sty :style</tags>
<spec>:sty<oa>le</oa> <oa>-name=<a>name</a></oa> <oa>-append</oa> <a>filter</a> <oa>css</oa></spec>
<strut/>
<spec>:sty<oa>le</oa> <oa>-name=<a>name</a></oa> <oa>-group=<a>name</a></oa> <oa>-agent</oa> <a>filter</a> <a>css</a></spec>
<spec>:sty<oa>le</oa> -name=<a>name</a> -append <a>filter</a> <a>css</a></spec>
<spec>:sty<oa>le</oa> <oa>-name=<a>name</a></oa> <oa>-group=<a>name</a></oa> <oa>filter</oa></spec>
<strut/>
<description>
<p>
Add CSS styles to the browser or to web pages. <a>filter</a> is a
@@ -295,8 +299,9 @@
<p>The following options are available:</p>
<dl>
<dt>-append</dt>
<dd>If provided along with <em>-name</em>, <oa>css</oa> and
<a>filter</a> are appended to its current value. (short name <em>-a</em>)</dd>
<dd>If provided along with <em>-name</em>, <a>css</a> and
<a>filter</a> are appended to its current value. (short name
<em>-a</em>)</dd>
<dt>-agent</dt>
<dd>If provided, the style is installed as an Agent sheet, which

View File

@@ -299,13 +299,15 @@ var Styles = Module("Styles", {
systemNames: Class.Property({ get: deprecated("Styles#system.names", function systemNames() this.system.names) }),
sites: Class.Property({ get: deprecated("Styles#user.sites", function sites() this.user.sites) }),
list: function list(content, filter, name, hives) {
list: function list(content, sites, name, hives) {
const { commandline, dactyl } = this.modules;
hives = hives || styles.hives.filter(function (h) h.modifiable && h.sheets.length);
function sheets(group)
group.sheets.slice()
.filter(function (sheet) (!name || sheet.name === name) &&
(!sites || sites.every(function (s) sheet.sites.indexOf(s) >= 0)))
.sort(function (a, b) a.name && b.name ? String.localeCompare(a.name, b.name)
: !!b.name - !!a.name || a.id - b.id);
@@ -560,7 +562,7 @@ var Styles = Module("Styles", {
let [filter, css] = args;
if (!css)
styles.list(window.content, filter, args["-name"], args.explicitOpts["-group"] ? [args["-group"]] : null);
styles.list(window.content, filter ? filter.split(",") : null, args["-name"], args.explicitOpts["-group"] ? [args["-group"]] : null);
else {
util.assert(args["-group"].modifiable && args["-group"].hive.modifiable,
_("group.cantChangeBuiltin", _("style.styles")));