Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @document menus to Insert menu #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions content/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ var prefs = Services.prefs.getBranch("extensions.stylish.");

const CSSXULNS = "@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);";
const CSSHTMLNS = "@namespace url(http://www.w3.org/1999/xhtml);";
const MOZDOC_URL = "@-moz-document url(http://www.w3.org/) {\n\n};\n";
const MOZDOC_URL_PREFIX = "@-moz-document url-prefix(http://www.w3.org/Style/) {\n\n};\n";
const MOZDOC_DOMAIN = "@-moz-document domain(mozilla.org) {\n\n};\n";
const MOZDOC_REGEXP = "@-moz-document regexp(\"https:.*\") {\n\n};\n";

// Because the edit windows have different URL, we need to do this ourselves to persist the position for all edit windows.
// Only do this if we're opened with openDialog, in which case window.opener is set
Expand Down
5 changes: 5 additions & 0 deletions content/edit.xul
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
<menuitem id="insert-xul" label="&xulnamespace;" accesskey="&xulnamespace.ak;" oncommand="insertCodeAtStart(CSSXULNS);"/>
<menuitem id="insert-chrome-folder" label="&chromefolder;" accesskey="&chromefolder.ak;" oncommand="insertChromePath()"/>
<menuitem id="insert-data-uri" label="&dataURI;" accesskey="&dataURI.ak;" oncommand="insertDataURI()"/>
<menuseparator/>
<menuitem id="insert-document-url" label="&docURL;" accesskey="&docURL.ak;" oncommand="insertCodeAtStart(MOZDOC_URL);"/>
<menuitem id="insert-document-url-prefix" label="&docUrlPrefix;" accesskey="&docUrlPrefix.ak;" oncommand="insertCodeAtStart(MOZDOC_URL_PREFIX);"/>
<menuitem id="insert-document-domain" label="&docDomain;" accesskey="&docDomain.ak;" oncommand="insertCodeAtStart(MOZDOC_DOMAIN);"/>
<menuitem id="insert-document-regexp" label="&docRegexp;" accesskey="&docRegexp.ak;" oncommand="insertCodeAtStart(MOZDOC_REGEXP);"/>
</menupopup>
</button>
<button id="itsalltext" label="&openintexternaleditor;" accesskey="&openintexternaleditor.ak;" itsalltext-control="internal-code" itsalltext-extension=".css" style="display: none;"/>
Expand Down
8 changes: 8 additions & 0 deletions locale/en-US/edit.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
<!ENTITY chromefolder.ak "C">
<!ENTITY dataURI "Data URI…">
<!ENTITY dataURI.ak "D">
<!ENTITY docURL "URL rule">
<!ENTITY docURL.ak "U">
<!ENTITY docUrlPrefix "URL Prefix rule">
<!ENTITY docUrlPrefix.ak "P">
<!ENTITY docDomain "Domain rule">
<!ENTITY docDomain.ak "o">
<!ENTITY docRegexp "Regexp rule">
<!ENTITY docRegexp.ak "R">
<!ENTITY htmlnamespace "HTML namespace as default">
<!ENTITY htmlnamespace.ak "H">
<!ENTITY insert "Insert">
Expand Down