summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/components/protocols.js6
-rw-r--r--common/content/liberator.js40
-rw-r--r--common/content/style.js4
3 files changed, 38 insertions, 12 deletions
diff --git a/common/components/protocols.js b/common/components/protocols.js
index 7a7a0090..c906d031 100644
--- a/common/components/protocols.js
+++ b/common/components/protocols.js
@@ -29,8 +29,12 @@ const systemPrincipal = channel.owner;
channel.cancel(NS_BINDING_ABORTED);
delete channel;
+function dataURL(type, data)
+ "data:" + (type || "application/xml;encoding=UTF-8") + "," + escape(data);
function makeChannel(url, orig)
{
+ if (typeof url == "function")
+ url = dataURL.apply(null, url());
let uri = ioService.newURI(url, null, null);
let channel = ioService.newChannelFromURI(uri);
channel.owner = systemPrincipal;
@@ -42,7 +46,7 @@ function fakeChannel(orig)
function redirect(to, orig)
{
let html = <html><head><meta http-equiv="Refresh" content={"0;" + to}/></head></html>.toXMLString();
- return makeChannel('data:text/html,' + escape(html), orig);
+ return makeChannel(dataURL('text/html', html), orig);
}
function ChromeData() {}
diff --git a/common/content/liberator.js b/common/content/liberator.js
index c07cef75..6d67de29 100644
--- a/common/content/liberator.js
+++ b/common/content/liberator.js
@@ -1167,6 +1167,8 @@ const liberator = (function () //{{{
*/
loadScript: function (uri, context)
{
+ XML.ignoreWhiteSpace = false;
+ XML.prettyPrinting = false;
services.get("subscriptLoader").loadSubScript(uri, context);
},
@@ -1383,9 +1385,6 @@ const liberator = (function () //{{{
*/
initHelp: function ()
{
- if (services.get("liberator:").NAMESPACES.length)
- return;
-
let namespaces = [config.name.toLowerCase(), "liberator"];
let tagMap = {};
let fileMap = {};
@@ -1415,6 +1414,13 @@ const liberator = (function () //{{{
}
return result;
}
+ function addTags(file, doc)
+ {
+ doc = XSLT.transformToDocument(doc);
+ for (let elem in util.evaluateXPath("//liberator:tag/text()", doc))
+ tagMap[elem.textContent] = file;
+ }
+
const XSLT = XSLTProcessor("chrome://liberator/content/help.xsl");
tagMap.all = "all";
@@ -1423,14 +1429,30 @@ const liberator = (function () //{{{
"//liberator:include/@href", doc))]);
util.Array.flatten(files).map(function (file) {
- liberator.dump("file:", file);
findHelpFile(file).forEach(function (doc) {
- doc = XSLT.transformToDocument(doc);
- for (let elem in util.evaluateXPath("//liberator:tag/text()", doc))
- tagMap[elem.textContent] = file;
+ addTags(file, doc);
});
});
+ XML.ignoreWhiteSpace = false;
+ XML.prettyPrinting = false;
+ let body = XML();
+ for (let [, context] in Iterator(plugins.contexts))
+ if (context.INFO instanceof XML)
+ body += context.INFO;
+ let help = '<?xml version="1.0"?>\n' +
+ '<?xml-stylesheet type="text/xsl" href="chrome://liberator/content/overlay.xsl"?>\n' +
+ '<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">' +
+ <document
+ name="plugins"
+ title={config.name + " Plugins"}
+ xmlns="http://vimperator.org/namespaces/liberator">
+ <h2 tag="using-plugins">Using Plugins</h2>
+
+ {body}
+ </document>.toXMLString();
+ fileMap['plugins'] = function () ['application/xml;charset=UTF-8', help];
+
services.get("liberator:").init({
HELP_TAGS: tagMap, FILE_MAP: fileMap,
OVERLAY_MAP: overlayMap, NAMESPACES: namespaces
@@ -1796,8 +1818,6 @@ const liberator = (function () //{{{
let start = Date.now();
liberator.log("Initializing liberator object...", 0);
- liberator.initHelp();
-
config.features.push(getPlatformFeature());
try
@@ -1911,6 +1931,8 @@ const liberator = (function () //{{{
if (options["loadplugins"])
liberator.loadPlugins();
+ liberator.initHelp();
+
// after sourcing the initialization files, this function will set
// all gui options to their default values, if they have not been
// set before by any RC file
diff --git a/common/content/style.js b/common/content/style.js
index a28afc2f..4cddd827 100644
--- a/common/content/style.js
+++ b/common/content/style.js
@@ -826,11 +826,11 @@ liberator.registerObserver("load_completion", function () {
completion.colorScheme = function colorScheme(context) {
context.title = ["Color Scheme", "Runtime Path"];
- context.keys = { text: function (f) f.leafName.replace(/\.vimp$/, ""), description: "parent.path" };
+ context.keys = { text: function (f) f.leafName.replace(/\.vimp$/, ""), description: ".parent.path" };
context.completions = util.Array.flatten(
io.getRuntimeDirectories("colors").map(
function (dir) dir.readDirectory().filter(
- function (file) /\.vimp$/.test(file.leafName) && !colors.some(function (c) c.leafName == file.leafName))))
+ function (file) /\.vimp$/.test(file.leafName))))
};