1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-15 12:55:47 +01:00

Remove some duplication in the DTDs. Link to the mailing list web page rather than address.

This commit is contained in:
Kris Maglione
2010-10-02 18:08:41 -04:00
parent bc97c417d6
commit 8ab81562ba
19 changed files with 69 additions and 65 deletions

View File

@@ -26,6 +26,8 @@ const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPr
function dataURL(type, data) "data:" + (type || "application/xml;encoding=UTF-8") + "," + escape(data);
function makeChannel(url, orig) {
if (url == null)
return fakeChannel();
if (typeof url == "function")
url = dataURL.apply(null, url());
let uri = ioService.newURI(url, null, null);
@@ -83,12 +85,15 @@ ChromeData.prototype = {
};
function Dactyl() {
const self = this;
this.wrappedJSObject = this;
this.HELP_TAGS = {};
this.FILE_MAP = {};
this.OVERLAY_MAP = {};
this.addonID = this.name + "@dactyl.googlecode.com";
this.pages = {};
}
Dactyl.prototype = {
contractID: "@mozilla.org/network/protocol;1?name=dactyl",
@@ -106,9 +111,12 @@ Dactyl.prototype = {
},
appName: prefs.getComplexValue("appName", Ci.nsISupportsString).data,
name: prefs.getComplexValue("name", Ci.nsISupportsString).data,
idName: prefs.getComplexValue("idName", Ci.nsISupportsString).data,
fileExt: prefs.getComplexValue("fileExt", Ci.nsISupportsString).data,
host: prefs.getComplexValue("host", Ci.nsISupportsString).data,
hostbin: prefs.getComplexValue("hostbin", Ci.nsISupportsString).data,
idName: prefs.getComplexValue("idName", Ci.nsISupportsString).data,
name: prefs.getComplexValue("name", Ci.nsISupportsString).data,
get version() prefs.getComplexValue("version", Ci.nsISupportsString).data,
init: function (obj) {
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP"]) {
@@ -135,16 +143,17 @@ Dactyl.prototype = {
newChannel: function (uri) {
try {
if (!("all" in this.FILE_MAP))
if (uri.host != "content" && !("all" in this.FILE_MAP))
return redirect(uri.spec, uri, 1);
let path = decodeURIComponent(uri.path.replace(/^\/|#.*/g, ""));
switch(uri.host) {
case "content":
return makeChannel(this.pages[path], uri);
case "help":
let url = this.FILE_MAP[decodeURIComponent(uri.path.replace(/^\/|#.*/g, ""))];
return makeChannel(url, uri);
return makeChannel(this.FILE_MAP[path], uri);
case "help-overlay":
url = this.OVERLAY_MAP[decodeURIComponent(uri.path.replace(/^\/|#.*/g, ""))];
return makeChannel(url, uri);
return makeChannel(this.OVERLAY_MAP[path], uri);
case "help-tag":
let tag = decodeURIComponent(uri.path.substr(1));
if (tag in this.FILE_MAP)

View File

@@ -15,7 +15,7 @@
<div xmlns="&xmlns.html;" style="text-align: center" id="text-container">
<img src="chrome://&dactyl.name;/content/logo.png" alt="&dactyl.appName;" />
version @VERSION@
version &dactyl.version;
by Kris Maglione, Doug Kearns, et al.
&dactyl.appName; is open source and freely distributable

18
common/content/base.dtd Normal file
View File

@@ -0,0 +1,18 @@
<!ENTITY % dactylBranding SYSTEM "chrome://branding/locale/brand.dtd">
%dactylBranding;
<!ENTITY dactyl.version "@VERSION@">
<!ENTITY dactyl.host "&brandShortName;">
<!ENTITY dactyl.home "http://dactyl.sourceforge.net/">
<!ENTITY dactyl.apphome "&dactyl.home;&dactyl.name;">
<!ENTITY dactyl.code "http://code.google.com/p/dactyl/">
<!ENTITY dactyl.issues "&dactyl.home;bug/&dactyl.name;">
<!ENTITY dactyl.plugins "http://dactyl.sf.net/&dactyl.name;/plugins">
<!ENTITY dactyl.list.mailto "&dactyl.name;@googlegroups.com">
<!ENTITY dactyl.list.href "http://groups.google.com/group/&dactyl.name;">
<!ENTITY xmlns.dactyl "http://vimperator.org/namespaces/liberator">
<!ENTITY xmlns.html "http://www.w3.org/1999/xhtml">
<!ENTITY xmlns.xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

View File

@@ -39,6 +39,9 @@
let prefix = [BASE];
modules.load("services");
prefix.unshift("chrome://" + modules.services.get("dactyl:").name + "/content/");
["base",
"modules",
"storage",
@@ -63,13 +66,11 @@
"marks",
"modes",
"options",
"services",
"statusline",
"styles",
"template"
].forEach(modules.load);
prefix.unshift("chrome://" + modules.services.get("dactyl:").name + "/content/");
modules.Config.prototype.scripts.forEach(modules.load);
})();

View File

@@ -1929,6 +1929,7 @@ const Dactyl = Module("dactyl", {
AddonManager.getAddonByID(services.get("dactyl:").addonID, function (addon) {
// @DATE@ token replaced by the Makefile
// TODO: Find it automatically
options.setPref("extensions.dactyl.version", addon.version);
dactyl.version = addon.version + " (created: @DATE@)";
});