1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-17 01:23:33 +01:00

Add -agent flag to :style.

This commit is contained in:
Kris Maglione
2010-09-26 10:10:55 -04:00
parent 27ff23146e
commit b201a266f2
3 changed files with 24 additions and 11 deletions

View File

@@ -154,12 +154,22 @@
CSS rule set (e.g., <tt>body { color: blue; }</tt>). CSS rule set (e.g., <tt>body { color: blue; }</tt>).
</p> </p>
<p> <p>The following options are available:</p>
If <a>name</a> (short option: <em>-n</em>) is provided, any existing style with the same <dl>
name is overridden, and the style may later be deleted using <a>name</a>. If <dt>-append</dt>
<em>-append</em> (short option: <em>-a</em>) is provided along with <em>-name</em>, <oa>css</oa> and <dd>If provided along with <em>-name</em>, <oa>css</oa> and
<a>filter</a> are appended to its current value. <a>filter</a> are appended to its current value. (short name: <em>-a</em>)</dd>
</p>
<dt>-agent</dt>
<dd>If provided, the style is installed as an Agent sheet, which
applies to contents user interface widgets as well as normal
elements. (short name <em>-A</em>)</dd>
<dt>-name=<a>name</a></dt>
<dd>If provided, any existing style with the same name is overridden, and the style may later be deleted using <a>name</a>.
(short name <em>-n</em>)</dd>
</dl>
<p>If <oa>css</oa> isn't provided, matching styles are listed.</p> <p>If <oa>css</oa> isn't provided, matching styles are listed.</p>
</description> </description>

View File

@@ -104,8 +104,9 @@ const Styles = Module("Styles", {
filter = filter.split(","); filter = filter.split(",");
if (name && name in names) { if (name && name in names) {
var sheet = names[name]; var sheet = names[name];
sheet.sites = filter; sheet.agent = agent;
sheet.css = String(css); sheet.css = String(css);
sheet.sites = filter;
} }
else { else {
sheet = Sheet(name, this._id++, filter.filter(util.identity), String(css), system, agent); sheet = Sheet(name, this._id++, filter.filter(util.identity), String(css), system, agent);
@@ -127,7 +128,7 @@ const Styles = Module("Styles", {
* @param {string or number} sheet The sheet to retrieve. Strings indicate * @param {string or number} sheet The sheet to retrieve. Strings indicate
* sheet names, while numbers indicate indices. * sheet names, while numbers indicate indices.
*/ */
get: function getget(system, sheet) { get: function get(system, sheet) {
let sheets = system ? this.systemSheets : this.userSheets; let sheets = system ? this.systemSheets : this.userSheets;
let names = system ? this.systemNames : this.userNames; let names = system ? this.systemNames : this.userNames;
if (typeof sheet === "number") if (typeof sheet === "number")
@@ -288,7 +289,7 @@ const Styles = Module("Styles", {
css = sheet.css + " " + css; css = sheet.css + " " + css;
} }
} }
styles.addSheet(false, name, filter, css); styles.addSheet(false, name, filter, css, args["-agent"]);
} }
}, },
{ {
@@ -307,13 +308,14 @@ const Styles = Module("Styles", {
hereDoc: true, hereDoc: true,
literal: 1, literal: 1,
options: [ options: [
{ names: ["-agent", "-A"], description: "Apply style as an Agent sheet" },
{ names: ["-append", "-a"], description: "Append site filter and css to an existing, matching sheet" },
{ {
names: ["-name", "-n"], names: ["-name", "-n"],
description: "The name of this stylesheet", description: "The name of this stylesheet",
completer: function () [[k, v.css] for ([k, v] in Iterator(styles.userNames))], completer: function () [[k, v.css] for ([k, v] in Iterator(styles.userNames))],
type: modules.CommandOption.STRING type: modules.CommandOption.STRING
}, }
{ names: ["-append", "-a"], description: "Append site filter and css to an existing, matching sheet" }
], ],
serialize: function () [ serialize: function () [
{ {

View File

@@ -44,6 +44,7 @@
* Added "transliterated" option to 'hintmatching'. * Added "transliterated" option to 'hintmatching'.
* Added -javascript option to :abbrev and :map. * Added -javascript option to :abbrev and :map.
* Added several new options to :map. * Added several new options to :map.
* Added -agent flag to :style
* Removed the :source line at the end of files generated by * Removed the :source line at the end of files generated by
:mkpentadactylrc. :mkpentadactylrc.
* gf now toggles between source and content view. * gf now toggles between source and content view.