1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 12:42:26 +01:00

Allow muttator's compose overlay to use liberator.xul. Not removing muttatorcompose.xul until chrome.manifest is updated, so as not to break muttator

This commit is contained in:
Kris Maglione
2008-10-10 15:43:17 +00:00
parent 16164154ba
commit a2bab3f62d
4 changed files with 98 additions and 47 deletions

View File

@@ -204,7 +204,7 @@ liberator.Completion = function () //{{{
* If @m is provided, return the @mth value of element @o * If @m is provided, return the @mth value of element @o
* of the stack entey at @n. * of the stack entey at @n.
*/ */
let get = function (n, m, o) let get = function get(n, m, o)
{ {
let a = stack[n >= 0 ? n : stack.length + n]; let a = stack[n >= 0 ? n : stack.length + n];
if (m == undefined) if (m == undefined)
@@ -215,13 +215,13 @@ liberator.Completion = function () //{{{
function buildStack(start) function buildStack(start)
{ {
/* Push and pop the stack, maintaining references to 'top' and 'last'. */ /* Push and pop the stack, maintaining references to 'top' and 'last'. */
let push = function (arg) let push = function push(arg)
{ {
top = [i, arg, [i], [], [], []]; top = [i, arg, [i], [], [], []];
last = top[CHAR]; last = top[CHAR];
stack.push(top); stack.push(top);
} }
let pop = function (arg) let pop = function pop(arg)
{ {
if (top[CHAR] != arg) if (top[CHAR] != arg)
throw new Error("Invalid JS"); throw new Error("Invalid JS");
@@ -329,7 +329,7 @@ liberator.Completion = function () //{{{
lastIdx = i; lastIdx = i;
} }
this.complete = function (string) this.complete = function complete(string)
{ {
try try
{ {
@@ -583,7 +583,7 @@ liberator.Completion = function () //{{{
// returns the longest common substring // returns the longest common substring
// used for the 'longest' setting for wildmode // used for the 'longest' setting for wildmode
getLongestSubstring: function () getLongestSubstring: function getLongestSubstring()
{ {
if (substrings.length == 0) if (substrings.length == 0)
return ""; return "";
@@ -599,7 +599,7 @@ liberator.Completion = function () //{{{
// generic filter function, also builds substrings needed // generic filter function, also builds substrings needed
// for :set wildmode=list:longest, if necessary // for :set wildmode=list:longest, if necessary
filter: function (array, filter, matchFromBeginning, favicon) filter: function filter(array, filter, matchFromBeginning, favicon)
{ {
if (!filter) if (!filter)
return [[a[0], a[1], favicon ? a[2] : null] for each (a in array)]; return [[a[0], a[1], favicon ? a[2] : null] for each (a in array)];
@@ -612,7 +612,7 @@ liberator.Completion = function () //{{{
return result; return result;
}, },
cached: function (key, filter, generate, method) cached: function cached(key, filter, generate, method)
{ {
if (!filter && cacheFilter[key] || filter.indexOf(cacheFilter[key]) != 0) if (!filter && cacheFilter[key] || filter.indexOf(cacheFilter[key]) != 0)
cacheResults[key] = generate(filter); cacheResults[key] = generate(filter);
@@ -625,7 +625,7 @@ liberator.Completion = function () //{{{
// discard all entries in the 'urls' array, which don't match 'filter // discard all entries in the 'urls' array, which don't match 'filter
// urls must be of type [["url", "title"], [...]] or optionally // urls must be of type [["url", "title"], [...]] or optionally
// [["url", "title", keyword, [tags]], [...]] // [["url", "title", keyword, [tags]], [...]]
filterURLArray: function (urls, filter, filterTags) filterURLArray: function filterURLArray(urls, filter, filterTags)
{ {
var filtered = []; var filtered = [];
// completions which don't match the url but just the description // completions which don't match the url but just the description
@@ -698,7 +698,7 @@ liberator.Completion = function () //{{{
// generic helper function which checks if the given "items" array pass "filter" // generic helper function which checks if the given "items" array pass "filter"
// items must be an array of strings // items must be an array of strings
match: function (items, filter, caseSensitive) match: function match(items, filter, caseSensitive)
{ {
if (typeof filter != "string" || !items) if (typeof filter != "string" || !items)
return false; return false;
@@ -720,10 +720,10 @@ liberator.Completion = function () //{{{
////////////////////// COMPLETION TYPES //////////////////////////////////////// ////////////////////// COMPLETION TYPES ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
bookmark: function (filter) [0, liberator.bookmarks.get(filter)], bookmark: function bookmark(filter) [0, liberator.bookmarks.get(filter)],
// FIXME: items shouldn't be [[[a], b]], but [[a, b]] and only mapped if at all for bLCS --mst // FIXME: items shouldn't be [[[a], b]], but [[a, b]] and only mapped if at all for bLCS --mst
buffer: function (filter) buffer: function buffer(filter)
{ {
var items = []; var items = [];
var num = getBrowser().browsers.length; var num = getBrowser().browsers.length;
@@ -761,7 +761,7 @@ liberator.Completion = function () //{{{
return [0, buildLongestCommonSubstring(items, filter)]; return [0, buildLongestCommonSubstring(items, filter)];
}, },
command: function (filter) command: function command(filter)
{ {
var completions = []; var completions = [];
@@ -778,9 +778,9 @@ liberator.Completion = function () //{{{
return [0, buildLongestStartingSubstring(completions, filter)]; return [0, buildLongestStartingSubstring(completions, filter)];
}, },
dialog: function (filter) [0, this.filter(liberator.config.dialogs || [], filter)], dialog: function dialog(filter) [0, this.filter(liberator.config.dialogs || [], filter)],
environment: function (filter) environment: function environment(filter)
{ {
let command = WINDOWS ? "set" : "export"; let command = WINDOWS ? "set" : "export";
let lines = liberator.io.system(command).split("\n"); let lines = liberator.io.system(command).split("\n");
@@ -795,10 +795,10 @@ liberator.Completion = function () //{{{
return [0, this.filter(vars, filter)]; return [0, this.filter(vars, filter)];
}, },
event: function (filter) [0, this.filter(liberator.config.autocommands, filter)], event: function event(filter) [0, this.filter(liberator.config.autocommands, filter)],
// provides completions for ex commands, including their arguments // provides completions for ex commands, including their arguments
ex: function (str) ex: function ex(str)
{ {
this.filterString = ""; this.filterString = "";
this.parenMatch = null; this.parenMatch = null;
@@ -834,7 +834,7 @@ liberator.Completion = function () //{{{
// TODO: support file:// and \ or / path separators on both platforms // TODO: support file:// and \ or / path separators on both platforms
// if "tail" is true, only return names without any directory components // if "tail" is true, only return names without any directory components
file: function (filter, tail) file: function file(filter, tail)
{ {
let [matches, dir, compl] = filter.match(/^((?:.*[\/\\])?)(.*?)$/); let [matches, dir, compl] = filter.match(/^((?:.*[\/\\])?)(.*?)$/);
// dir == "" is expanded inside readDirectory to the current dir // dir == "" is expanded inside readDirectory to the current dir
@@ -869,7 +869,7 @@ liberator.Completion = function () //{{{
}catch(e){liberator.dump(e)} }catch(e){liberator.dump(e)}
}, },
help: function (filter) help: function help(filter)
{ {
var files = liberator.config.helpFiles || []; var files = liberator.config.helpFiles || [];
var res = []; var res = [];
@@ -896,11 +896,11 @@ liberator.Completion = function () //{{{
return [0, this.filter(res, filter)]; return [0, this.filter(res, filter)];
}, },
history: function (filter) [0, liberator.history.get(filter)], history: function history(filter) [0, liberator.history.get(filter)],
get javascriptCompleter() javascript, get javascriptCompleter() javascript,
javascript: function (str) javascript: function _javascript(str)
{ {
try try
{ {
@@ -913,14 +913,14 @@ liberator.Completion = function () //{{{
} }
}, },
macro: function (filter) macro: function macro(filter)
{ {
var macros = [item for (item in liberator.events.getMacros())]; var macros = [item for (item in liberator.events.getMacros())];
return [0, this.filter(macros, filter)]; return [0, this.filter(macros, filter)];
}, },
search: function (filter) search: function search(filter)
{ {
let [, keyword, args] = filter.match(/^\s*(\S*)\s*(.*)/); let [, keyword, args] = filter.match(/^\s*(\S*)\s*(.*)/);
let keywords = liberator.bookmarks.getKeywords().map(function (k) [k[0], k[1], k[3], k[2]]); let keywords = liberator.bookmarks.getKeywords().map(function (k) [k[0], k[1], k[3], k[2]]);
@@ -953,7 +953,7 @@ liberator.Completion = function () //{{{
}, },
// XXX: Move to bookmarks.js? // XXX: Move to bookmarks.js?
searchEngineSuggest: function (filter, engineAliases) searchEngineSuggest: function searchEngineSuggest(filter, engineAliases)
{ {
this.filterString = filter; this.filterString = filter;
if (!filter) if (!filter)
@@ -1003,7 +1003,7 @@ liberator.Completion = function () //{{{
return [0, completions]; return [0, completions];
}, },
sidebar: function (filter) sidebar: function sidebar(filter)
{ {
var menu = document.getElementById("viewSidebarMenu"); var menu = document.getElementById("viewSidebarMenu");
var nodes = []; var nodes = [];
@@ -1014,7 +1014,7 @@ liberator.Completion = function () //{{{
return [0, this.filter(nodes, filter)]; return [0, this.filter(nodes, filter)];
}, },
stylesheet: function (filter) stylesheet: function stylesheet(filter)
{ {
var completions = liberator.buffer.alternateStyleSheets.map( var completions = liberator.buffer.alternateStyleSheets.map(
function (stylesheet) [stylesheet.title, stylesheet.href || "inline"] function (stylesheet) [stylesheet.title, stylesheet.href || "inline"]
@@ -1040,7 +1040,7 @@ liberator.Completion = function () //{{{
// may consist of search engines, filenames, bookmarks and history, // may consist of search engines, filenames, bookmarks and history,
// depending on the 'complete' option // depending on the 'complete' option
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option // if the 'complete' argument is passed like "h", it temporarily overrides the complete option
url: function (filter, complete) url: function url(filter, complete)
{ {
this.filterString = filter; this.filterString = filter;
var completions = []; var completions = [];
@@ -1071,7 +1071,7 @@ liberator.Completion = function () //{{{
{ {
completionService.stopSearch(); completionService.stopSearch();
completionService.startSearch(filter, "", historyResult, { completionService.startSearch(filter, "", historyResult, {
onSearchResult: function (search, result) { onSearchResult: function onSearchResult(search, result) {
historyResult = result; historyResult = result;
historyTimer.tell(); historyTimer.tell();
if (result.searchResult <= result.RESULT_SUCCESS) if (result.searchResult <= result.RESULT_SUCCESS)
@@ -1085,14 +1085,14 @@ liberator.Completion = function () //{{{
return [start, completionCache.concat(historyCache)]; return [start, completionCache.concat(historyCache)];
}, },
userCommand: function (filter) userCommand: function userCommand(filter)
{ {
var commands = liberator.commands.getUserCommands(); var commands = liberator.commands.getUserCommands();
commands = commands.map(function (command) [command.name, ""]); commands = commands.map(function (command) [command.name, ""]);
return [0, this.filter(commands, filter)]; return [0, this.filter(commands, filter)];
}, },
userMapping: function (filter, modes) userMapping: function userMapping(filter, modes)
{ {
// TODO: add appropriate getters to l.mappings // TODO: add appropriate getters to l.mappings
var mappings = []; var mappings = [];

View File

@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK ***** {{{
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
(c) 2006-2008: Martin Stubenschrott <stubenschrott@gmx.net>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK ***** -->
<!--?xml-stylesheet href="chrome://browser/skin/" type="text/css"?-->
<overlay id="muttator"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!--script type="application/x-javascript;version=1.8" src="mail.js"/-->
</overlay>
<!-- vim: set fdm=marker sw=4 ts=4 et: -->

View File

@@ -0,0 +1,6 @@
<!ENTITY liberator.mainWindow "msgcomposeWindow">
<!ENTITY liberator.name "muttator">
<!ENTITY liberator.statusBefore "">
<!ENTITY liberator.statusAfter "statusText">

View File

@@ -29,7 +29,9 @@ the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK ***** --> }}} ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://liberator/skin/liberator.css" type="text/css"?> <?xml-stylesheet href="chrome://liberator/skin/liberator.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://liberator/content/liberator.dtd"> <!DOCTYPE overlay SYSTEM "liberator.dtd" [
<!ENTITY liberator.content "chrome://liberator/content/">
]>
<overlay id="liberator" <overlay id="liberator"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -37,24 +39,24 @@ the terms of any one of the MPL, the GPL or the LGPL.
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript;version=1.8" src="liberator.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;liberator.js"/>
<script type="application/x-javascript;version=1.8" src="&liberator.name;.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;&liberator.name;.js"/>
<script type="application/x-javascript;version=1.8" src="buffer.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;buffer.js"/>
<script type="application/x-javascript;version=1.8" src="commands.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;commands.js"/>
<script type="application/x-javascript;version=1.8" src="completion.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;completion.js"/>
<script type="application/x-javascript;version=1.8" src="editor.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;editor.js"/>
<script type="application/x-javascript;version=1.8" src="events.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;events.js"/>
<script type="application/x-javascript;version=1.8" src="find.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;find.js"/>
<script type="application/x-javascript;version=1.8" src="help.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;help.js"/>
<script type="application/x-javascript;version=1.8" src="hints.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;hints.js"/>
<script type="application/x-javascript;version=1.8" src="io.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;io.js"/>
<script type="application/x-javascript;version=1.8" src="mappings.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;mappings.js"/>
<script type="application/x-javascript;version=1.8" src="modes.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;modes.js"/>
<script type="application/x-javascript;version=1.8" src="options.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;options.js"/>
<script type="application/x-javascript;version=1.8" src="template.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;template.js"/>
<script type="application/x-javascript;version=1.8" src="ui.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;ui.js"/>
<script type="application/x-javascript;version=1.8" src="util.js"/> <script type="application/x-javascript;version=1.8" src="&liberator.content;util.js"/>
<window id="&liberator.mainWindow;"> <window id="&liberator.mainWindow;">