mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-08 05:45:45 +01:00
Make Melodactyl minimally functional. Closes issue #340.
--HG-- rename : pentadactyl/chrome.manifest => common/chrome.manifest
This commit is contained in:
22
common/chrome.manifest
Normal file
22
common/chrome.manifest
Normal file
@@ -0,0 +1,22 @@
|
||||
resource dactyl-local-content content/
|
||||
resource dactyl-local-skin skin/
|
||||
resource dactyl-local-locale locale/
|
||||
|
||||
resource dactyl ../common/modules/
|
||||
resource dactyl-content ../common/content/
|
||||
resource dactyl-skin ../common/skin/
|
||||
resource dactyl-locale ../common/locale/
|
||||
|
||||
content dactyl ../common/content/
|
||||
|
||||
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||
category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl
|
||||
|
||||
component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
||||
contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
||||
component {9c8f2530-51c8-4d41-b356-319e0b155c44} components/protocols.js
|
||||
contract @mozilla.org/network/protocol;1?name=dactyl {9c8f2530-51c8-4d41-b356-319e0b155c44}
|
||||
component {f4506a17-5b4d-4cd9-92d4-2eb4630dc388} components/protocols.js
|
||||
contract @dactyl.googlecode.com/base/xpc-interface-shim {f4506a17-5b4d-4cd9-92d4-2eb4630dc388}
|
||||
|
||||
@@ -263,63 +263,56 @@ var Bookmarks = Module("bookmarks", {
|
||||
* @returns {[string, string | null] | null}
|
||||
*/
|
||||
getSearchURL: function getSearchURL(text, useDefsearch) {
|
||||
let searchString = (useDefsearch ? options["defsearch"] + " " : "") + text;
|
||||
let query = (useDefsearch ? options["defsearch"] + " " : "") + text;
|
||||
|
||||
// ripped from Firefox
|
||||
function getShortcutOrURI(url) {
|
||||
var keyword = url;
|
||||
var param = "";
|
||||
var offset = url.indexOf(" ");
|
||||
if (offset > 0) {
|
||||
keyword = url.substr(0, offset);
|
||||
param = url.substr(offset + 1);
|
||||
}
|
||||
|
||||
var engine = bookmarks.searchEngines[keyword];
|
||||
if (engine) {
|
||||
if (engine.searchForm && !param)
|
||||
return [engine.searchForm, null];
|
||||
let submission = engine.getSubmission(param, null);
|
||||
return [submission.uri.spec, submission.postData];
|
||||
}
|
||||
|
||||
let [shortcutURL, postData] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
|
||||
if (!shortcutURL)
|
||||
return [url, null];
|
||||
let bmark = bookmarkcache.keywords[keyword];
|
||||
|
||||
let data = window.unescape(postData || "");
|
||||
if (/%s/i.test(shortcutURL) || /%s/i.test(data)) {
|
||||
var charset = "";
|
||||
var matches = shortcutURL.match(/^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/);
|
||||
if (matches)
|
||||
[, shortcutURL, charset] = matches;
|
||||
else
|
||||
try {
|
||||
charset = services.history.getCharsetForURI(util.newURI(shortcutURL));
|
||||
}
|
||||
catch (e) {}
|
||||
if (charset)
|
||||
var encodedParam = escape(window.convertFromUnicode(charset, param));
|
||||
else
|
||||
encodedParam = bmark.encodeURIComponent(param);
|
||||
|
||||
shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
|
||||
if (/%s/i.test(data))
|
||||
postData = window.getPostDataStream(data, param, encodedParam, "application/x-www-form-urlencoded");
|
||||
}
|
||||
else if (param)
|
||||
return [shortcutURL, null];
|
||||
return [shortcutURL, postData];
|
||||
var keyword = query;
|
||||
var param = "";
|
||||
var offset = query.indexOf(" ");
|
||||
if (offset > 0) {
|
||||
keyword = query.substr(0, offset);
|
||||
param = query.substr(offset + 1);
|
||||
}
|
||||
|
||||
let [url, postData] = getShortcutOrURI(searchString);
|
||||
var engine = bookmarks.searchEngines[keyword];
|
||||
if (engine) {
|
||||
if (engine.searchForm && !param)
|
||||
return engine.searchForm;
|
||||
let submission = engine.getSubmission(param, null);
|
||||
return [submission.uri.spec, submission.postData];
|
||||
}
|
||||
|
||||
if (url == searchString)
|
||||
let [url, postData] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
|
||||
if (!url)
|
||||
return null;
|
||||
|
||||
let data = window.unescape(postData || "");
|
||||
if (/%s/i.test(url) || /%s/i.test(data)) {
|
||||
var charset = "";
|
||||
var matches = url.match(/^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/);
|
||||
if (matches)
|
||||
[, url, charset] = matches;
|
||||
else
|
||||
try {
|
||||
charset = services.history.getCharsetForURI(util.newURI(url));
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
if (charset)
|
||||
var encodedParam = escape(window.convertFromUnicode(charset, param));
|
||||
else
|
||||
encodedParam = bookmarkcache.keywords[keyword].encodeURIComponent(param);
|
||||
|
||||
url = url.replace(/%s/g, encodedParam).replace(/%S/g, param);
|
||||
if (/%s/i.test(data))
|
||||
postData = window.getPostDataStream(data, param, encodedParam, "application/x-www-form-urlencoded");
|
||||
}
|
||||
else if (param)
|
||||
postData = null;
|
||||
|
||||
if (postData)
|
||||
return [url, postData];
|
||||
return url; // can be null
|
||||
return url;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("config", {
|
||||
exports: ["ConfigBase", "Config", "config"],
|
||||
require: ["services", "storage", "util", "template"],
|
||||
use: ["io"]
|
||||
use: ["io", "prefs"]
|
||||
}, this);
|
||||
|
||||
var ConfigBase = Class("ConfigBase", {
|
||||
|
||||
@@ -47,11 +47,13 @@ var Group = Class("Group", {
|
||||
get builtin() this.modules.contexts.builtinGroups.indexOf(this) >= 0,
|
||||
|
||||
}, {
|
||||
compileFilter: function (patterns) {
|
||||
compileFilter: function (patterns, default_) {
|
||||
if (arguments.length < 2)
|
||||
default_ = false;
|
||||
|
||||
function siteFilter(uri)
|
||||
let (match = array.nth(siteFilter.filters, function (f) f(uri), 0))
|
||||
match && match.result;
|
||||
match ? match.result : default_;
|
||||
|
||||
return update(siteFilter, {
|
||||
toString: function () this.filters.join(","),
|
||||
|
||||
@@ -166,6 +166,7 @@ var Overlay = Module("Overlay", {
|
||||
"options",
|
||||
"overlay",
|
||||
"prefs",
|
||||
"sanitizer",
|
||||
"services",
|
||||
"storage",
|
||||
"styles",
|
||||
@@ -276,7 +277,7 @@ var Overlay = Module("Overlay", {
|
||||
modules.config.scripts.forEach(modules.load);
|
||||
frobModules();
|
||||
|
||||
defineModule.modules.forEach(function ({ lazyInit, constructor: { className } }) {
|
||||
defineModule.modules.forEach(function defModule({ lazyInit, constructor: { className } }) {
|
||||
if (!lazyInit) {
|
||||
frob(className);
|
||||
modules[className] = modules[className];
|
||||
|
||||
Reference in New Issue
Block a user