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

added mail.js, <enter> and <esc> switch between normal and -- MESSAGE -- mode now

This commit is contained in:
Martin Stubenschrott
2008-02-11 15:42:52 +00:00
parent f22a5b7ea2
commit 62b053bab2
6 changed files with 87 additions and 11 deletions

2
TODO
View File

@@ -11,6 +11,7 @@ BUGS:
same for http://forum.mootools.net/topic.php?id=3458 same for http://forum.mootools.net/topic.php?id=3458
- insert abbreviations broken on <space> - insert abbreviations broken on <space>
- :sidebar improvements (:sidebar! Downloads while downloads is open should refocus the sidebar) - :sidebar improvements (:sidebar! Downloads while downloads is open should refocus the sidebar)
- http://www.maximonline.com/jokes/ - the prev and next buttons on the image map are not hinted
FEATURES: FEATURES:
8 middleclick in content == p, and if command line is open, paste there the clipboard buffer 8 middleclick in content == p, and if command line is open, paste there the clipboard buffer
@@ -20,6 +21,7 @@ FEATURES:
8 y and Y should be changed to: Y, yy and yl=yank location, ys=yank selection, 8 y and Y should be changed to: Y, yy and yl=yank location, ys=yank selection,
yd=yank domain name, yt=yank title, yw=yank current word, yf=yank filename, (other things to yank?) yd=yank domain name, yt=yank title, yw=yank current word, yf=yank filename, (other things to yank?)
8 all search commands should start searching from the top of the visible viewport 8 all search commands should start searching from the top of the visible viewport
8 :bdelete full_url<cr> and :bdelete! filter<cr> should delete all tabs matching filter or full_url
7 use ctrl-n/p in insert mode for word completion 7 use ctrl-n/p in insert mode for word completion
7 implement LocationList window, and get rid off/change PreviewWindow to be 7 implement LocationList window, and get rid off/change PreviewWindow to be
a real preview window being able to display html pages a real preview window being able to display html pages

View File

@@ -756,8 +756,7 @@ vimperator.Events = function () //{{{
return; return;
// dump("=+++++++++=\n" + vimperator.util.objectToString(event.target) + "\n") // dump("=+++++++++=\n" + vimperator.util.objectToString(event.target) + "\n")
//dump (elem + "\n"); // dump (elem + ": " + win + "\n");//" - target: " + event.target + " - origtarget: " + event.originalTarget + " - expltarget: " + event.explicitOriginalTarget + "\n");
//dump (win + "\n---\n");
if (elem && elem instanceof HTMLInputElement && if (elem && elem instanceof HTMLInputElement &&
(elem.type.toLowerCase() == "text" || elem.type.toLowerCase() == "password")) (elem.type.toLowerCase() == "text" || elem.type.toLowerCase() == "password"))
@@ -786,8 +785,9 @@ vimperator.Events = function () //{{{
{ {
// we switch to -- MESSAGE -- mode for muttator, when an HTML document // we switch to -- MESSAGE -- mode for muttator, when an HTML document
// is selected but not when we just click a link // is selected but not when we just click a link
if (win && win.document && win.document instanceof HTMLDocument && !elem)// || !(elem instanceof HTMLAnchorElement)) if (win && win.document && win.document instanceof HTMLDocument && (!elem || vimperator.mode == vimperator.modes.MESSAGE))
{ {
if (vimperator.mode != vimperator.modes.MESSAGE)
vimperator.mode = vimperator.modes.MESSAGE; vimperator.mode = vimperator.modes.MESSAGE;
return; return;
} }
@@ -796,6 +796,8 @@ vimperator.Events = function () //{{{
vimperator.focusContent(); vimperator.focusContent();
return; return;
} }
else
;//dump("hu\n")
} }
if (vimperator.mode == vimperator.modes.INSERT || if (vimperator.mode == vimperator.modes.INSERT ||
@@ -967,7 +969,8 @@ vimperator.Events = function () //{{{
// XXX: ugly hack for now pass certain keys to firefox as they are without beeping // XXX: ugly hack for now pass certain keys to firefox as they are without beeping
// also fixes key navigation in combo boxes, submitting forms, etc. // also fixes key navigation in combo boxes, submitting forms, etc.
// FIXME: breaks iabbr for now --mst // FIXME: breaks iabbr for now --mst
if (vimperator.mode == vimperator.modes.NORMAL || vimperator.mode == vimperator.modes.INSERT) if ((vimperator.config.name == "Vimperator" && vimperator.mode == vimperator.modes.NORMAL)
|| vimperator.mode == vimperator.modes.INSERT)
{ {
if (key == "<Return>") if (key == "<Return>")
{ {

65
content/mail.js Normal file
View File

@@ -0,0 +1,65 @@
/***** 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 *****/
vimperator.Mail = function ()
{
////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
// vimperator.options.add(["editor"],
// "Set the external text editor",
// "string", "gvim -f");
// vimperator.options.add(["insertmode", "im"],
// "Use Insert mode as the default for text areas",
// "boolean", true);
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// MAPPINGS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
vimperator.mappings.addDefault([vimperator.modes.NORMAL], ["<Return>", "<Space>"], "Focus message",
function () { content.focus(); }
);
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
return {
};
//}}}
};
// vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -40,7 +40,6 @@ the terms of any one of the MPL, the GPL or the LGPL.
<script type="application/x-javascript;version=1.8" src="vim.js"/> <script type="application/x-javascript;version=1.8" src="vim.js"/>
<script type="application/x-javascript;version=1.8" src="muttator.js"/> <script type="application/x-javascript;version=1.8" src="muttator.js"/>
<!--script type="application/x-javascript;version=1.8" src="bookmarks.js"/-->
<script type="application/x-javascript;version=1.8" src="buffers.js"/> <script type="application/x-javascript;version=1.8" src="buffers.js"/>
<script type="application/x-javascript;version=1.8" src="commands.js"/> <script type="application/x-javascript;version=1.8" src="commands.js"/>
<script type="application/x-javascript;version=1.8" src="completion.js"/> <script type="application/x-javascript;version=1.8" src="completion.js"/>
@@ -53,7 +52,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
<script type="application/x-javascript;version=1.8" src="mappings.js"/> <script type="application/x-javascript;version=1.8" src="mappings.js"/>
<script type="application/x-javascript;version=1.8" src="modes.js"/> <script type="application/x-javascript;version=1.8" src="modes.js"/>
<script type="application/x-javascript;version=1.8" src="options.js"/> <script type="application/x-javascript;version=1.8" src="options.js"/>
<!--script type="application/x-javascript;version=1.8" src="tabs.js"/--> <script type="application/x-javascript;version=1.8" src="mail.js"/>
<script type="application/x-javascript;version=1.8" src="ui.js"/> <script type="application/x-javascript;version=1.8" src="ui.js"/>
<script type="application/x-javascript;version=1.8" src="util.js"/> <script type="application/x-javascript;version=1.8" src="util.js"/>
@@ -74,7 +73,6 @@ the terms of any one of the MPL, the GPL or the LGPL.
<key id="key_open_vimbar" key=":" oncommand="vimperator.commandline.open(':', '', vimperator.modes.EX);" modifiers=""/> <key id="key_open_vimbar" key=":" oncommand="vimperator.commandline.open(':', '', vimperator.modes.EX);" modifiers=""/>
<key id="key_stop" keycode="VK_ESCAPE" oncommand="vimperator.events.onEscape();"/> <key id="key_stop" keycode="VK_ESCAPE" oncommand="vimperator.events.onEscape();"/>
<!-- other keys are handled inside vimperator.js event loop --> <!-- other keys are handled inside vimperator.js event loop -->
<key id="key_open_vimbar" key=";" oncommand="alert(';')" modifiers=""/>
</keyset> </keyset>
<statusbar id="status-bar" class="hl-StatusLine"> <statusbar id="status-bar" class="hl-StatusLine">

View File

@@ -180,7 +180,8 @@ vimperator.CommandLine = function () //{{{
multilineOutputWidget.collapsed = true; multilineOutputWidget.collapsed = true;
} }
var fontSize = document.defaultView.getComputedStyle(document.getElementById("main-window"), null).getPropertyValue("font-size"); var id = vimperator.config.mainWindowID || "main-window";
var fontSize = document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue("font-size");
multilineOutputWidget.contentDocument.body.setAttribute("style", "font-size: " + fontSize); multilineOutputWidget.contentDocument.body.setAttribute("style", "font-size: " + fontSize);
multilineOutputWidget.contentDocument.body.innerHTML = output; multilineOutputWidget.contentDocument.body.innerHTML = output;
@@ -191,7 +192,8 @@ vimperator.CommandLine = function () //{{{
stylesheet.setAttribute("href", "chrome://vimperator/skin/vimperator.css"); stylesheet.setAttribute("href", "chrome://vimperator/skin/vimperator.css");
multilineOutputWidget.contentDocument.getElementsByTagName("head")[0].appendChild(stylesheet); multilineOutputWidget.contentDocument.getElementsByTagName("head")[0].appendChild(stylesheet);
var availableHeight = getBrowser().mPanelContainer.boxObject.height; var availableHeight = getBrowser().mPanelContainer != undefined ?
getBrowser().mPanelContainer.boxObject.height : getBrowser().boxObject.height;
var contentHeight = multilineOutputWidget.contentDocument.height; var contentHeight = multilineOutputWidget.contentDocument.height;
var height = contentHeight < availableHeight ? contentHeight : availableHeight; var height = contentHeight < availableHeight ? contentHeight : availableHeight;

View File

@@ -234,6 +234,7 @@ const vimperator = (function () //{{{
command.execute(args, special, count, modifiers); command.execute(args, special, count, modifiers);
}, },
// TODO: move to vimperator.buffer.focus()?
// after pressing Escape, put focus on a non-input field of the browser document // after pressing Escape, put focus on a non-input field of the browser document
// if clearFocusedElement, also blur a focused link // if clearFocusedElement, also blur a focused link
focusContent: function (clearFocusedElement) focusContent: function (clearFocusedElement)
@@ -498,6 +499,11 @@ const vimperator = (function () //{{{
vimperator.buffer = vimperator.Buffer(); vimperator.buffer = vimperator.Buffer();
vimperator.log("Loading module editor...", 3); vimperator.log("Loading module editor...", 3);
vimperator.editor = vimperator.Editor(); vimperator.editor = vimperator.Editor();
if (vimperator.has("mail"))
{
vimperator.log("Loading module mail...", 3);
vimperator.mail = vimperator.Mail();
}
if (vimperator.has("tabs")) if (vimperator.has("tabs"))
{ {
vimperator.log("Loading module tabs...", 3); vimperator.log("Loading module tabs...", 3);