mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-04 22:45:46 +01:00
Add support for regexp site-filters to :style.
This commit is contained in:
@@ -152,9 +152,9 @@
|
|||||||
<p>
|
<p>
|
||||||
Add CSS styles to the browser or to web pages. <a>filter</a> is a
|
Add CSS styles to the browser or to web pages. <a>filter</a> is a
|
||||||
comma-separated list of <t>site-filters</t> for which the style will
|
comma-separated list of <t>site-filters</t> for which the style will
|
||||||
apply. Regular expression filters may not be used and the <tt>!</tt>
|
apply. The <tt>!</tt> character may not be used to invert the sense
|
||||||
character may not be used to invert the sense of the match.
|
of the match. <oa>css</oa> is a full CSS rule set (e.g., <tt>body {
|
||||||
<oa>css</oa> is a full CSS rule set (e.g., <tt>body { color: blue; }</tt>).
|
color: blue; }</tt>).
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>The following options are available:</p>
|
<p>The following options are available:</p>
|
||||||
|
|||||||
@@ -68,17 +68,20 @@ update(Sheet.prototype, {
|
|||||||
get fullCSS() {
|
get fullCSS() {
|
||||||
let filter = this.sites;
|
let filter = this.sites;
|
||||||
let css = this.css;
|
let css = this.css;
|
||||||
|
|
||||||
|
let preamble = "/* " + this.uri + (this.agent ? " (agent)" : "") + " */\n\n" + namespace + "\n";
|
||||||
if (filter[0] == "*")
|
if (filter[0] == "*")
|
||||||
return namespace + css;
|
return preamble + css;
|
||||||
|
|
||||||
let selectors = filter.map(function (part)
|
let selectors = filter.map(function (part)
|
||||||
(/[*]$/.test(part) ? "url-prefix" :
|
!/^(?:[a-z-]+:|[a-z-.]+$)/.test(filter) ? "regexp(" + part.quote() + ")" :
|
||||||
/[\/:]/.test(part) ? "url"
|
(/[*]$/.test(part) ? "url-prefix" :
|
||||||
: "domain")
|
/[\/:]/.test(part) ? "url"
|
||||||
+ '("' + part.replace(/"/g, "%22").replace(/\*$/, "") + '")')
|
: "domain")
|
||||||
|
+ '("' + part.replace(/"/g, "%22").replace(/\*$/, "") + '")')
|
||||||
.join(",\n ");
|
.join(",\n ");
|
||||||
return "/* " + this.uri + (this.agent ? " (agent)" : "") + " */\n\n"
|
|
||||||
+ namespace + "\n@-moz-document " + selectors + " {\n\n" + css + "\n\n}\n";
|
return preamble + "@-moz-document " + selectors + " {\n\n" + css + "\n\n}\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
and linking to source code locations). [b4]
|
and linking to source code locations). [b4]
|
||||||
- :downloads now opens a download list in the multi-line output
|
- :downloads now opens a download list in the multi-line output
|
||||||
buffer. Added -sort flag. [b6][b7]
|
buffer. Added -sort flag. [b6][b7]
|
||||||
|
- :style now supports regexp site-filters on Firefox 6+. [b7]
|
||||||
- :qa closes only the current window, per Vim. [b7]
|
- :qa closes only the current window, per Vim. [b7]
|
||||||
- Added :exit command. [b7]
|
- Added :exit command. [b7]
|
||||||
- Added :dlclear command. [b7]
|
- Added :dlclear command. [b7]
|
||||||
|
|||||||
Reference in New Issue
Block a user