Skip to content
This repository has been archived by the owner on Jul 28, 2018. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyo Nagashima committed Mar 31, 2009
0 parents commit 1580a59
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chrome.manifest
@@ -0,0 +1,2 @@
overlay chrome://browser/content/browser.xul chrome://context-style-switcher/content/context-style-switcher_overlay.xul
content context-style-switcher chrome/content/
23 changes: 23 additions & 0 deletions chrome/content/contents.rdf
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<RDF:Seq RDF:about="urn:mozilla:package:root">
<RDF:li RDF:resource="urn:mozilla:package:context-style-switcher"/>
</RDF:Seq>

<RDF:Seq RDF:about="urn:mozilla:overlays">
<RDF:li RDF:resource="chrome://browser/content/browser.xul"/>
</RDF:Seq>

<RDF:Seq RDF:about="chrome://browser/content/browser.xul">
<RDF:li>chrome://context-style-switcher/content/context-style-switcher_overlay.xul</RDF:li>
</RDF:Seq>

<RDF:Description RDF:about="urn:mozilla:package:context-style-switcher"
chrome:name="context-style-switcher"
chrome:displayName="Context Style Switcher"
chrome:description="Change Page Style via context menu."
chrome:author="Kyo Nagashima"
chrome:authorURL="http://hail2u.net/archives/fxexts.html"
chrome:extension="true"/>
</RDF:RDF>
21 changes: 21 additions & 0 deletions chrome/content/context_style_switcher_overlay.js
@@ -0,0 +1,21 @@
var contextStyleSwitcher = {
init: function() {
var contextMenu = document.getElementById("contentAreaContextMenu");
contextMenu.addEventListener("popupshowing", contextStyleSwitcher.toggleVisibility, false);
},

toggleVisibility: function() {
if (gContextMenu.onTextInput
|| gContextMenu.onImage
|| gContextMenu.onLink
|| gContextMenu.isTextSelected) {
document.getElementById("context-style-switcher_sep").hidden = true;
document.getElementById("context-style-switcher_menu").hidden = true;
} else {
document.getElementById("context-style-switcher_sep").hidden = false;
document.getElementById("context-style-switcher_menu").hidden = false;
}
}
}

window.addEventListener("load", contextStyleSwitcher.init, false);
33 changes: 33 additions & 0 deletions chrome/content/context_style_switcher_overlay.xul
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!DOCTYPE window [
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
]>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="context-style-switcher_overlay">
<script type="application/x-javascript"
src="chrome://context-style-switcher/content/context-style-switcher_overlay.js"/>

<popup id="contentAreaContextMenu">
<menuseparator id="context-style-switcher_sep"
insertbefore="context-sep-properties"/>

<menu id="context-style-switcher_menu"
label="&pageStyleMenu.label;"
accesskey="&pageStyleMenu.accesskey;"
insertbefore="context-sep-properties">
<menupopup onpopupshowing="stylesheetFillPopup(this);"
oncommand="stylesheetSwitchAll(window._content, event.target.getAttribute('data')); setStyleDisabled(false);">
<menuitem label="&pageStyleNoStyle.label;"
accesskey="&pageStyleNoStyle.accesskey;"
oncommand="setStyleDisabled(true); event.stopPropagation();"
type="radio"/>
<menuitem label="&pageStylePersistentOnly.label;"
accesskey="&pageStylePersistentOnly.accesskey;"
type="radio"
checked="true"/>
<menuseparator/>
</menupopup>
</menu>
</popup>
</overlay>
27 changes: 27 additions & 0 deletions install.rdf
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<RDF:Description about="urn:mozilla:install-manifest">
<em:id>{a9f1b95d-50c5-464d-a54b-fd53c5a3fe3c}</em:id>
<em:version>1.0.7</em:version>

<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.0</em:minVersion>
<em:maxVersion>3.0.*</em:maxVersion>
</RDF:Description>
</em:targetApplication>

<em:name>Context Style Switcher</em:name>
<em:description>Change Page Style via context menu.</em:description>
<em:creator>Kyo Nagashima</em:creator>
<em:homepageURL>http://hail2u.net/archives/fxexts.html#context-style-switcher</em:homepageURL>

<em:file>
<RDF:Description about="urn:mozilla:extension:file:context-style-switcher.jar">
<em:package>content/context-style-switcher/</em:package>
</RDF:Description>
</em:file>
</RDF:Description>
</RDF:RDF>

0 comments on commit 1580a59

Please sign in to comment.