mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 11:37:57 +01:00
now we have a Events() class
Please report all bugs which arised because of these changes Still not sure, if we should put that into an event.js
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
<pre>
|
<pre>
|
||||||
2007-05-02:
|
2007-05-02:
|
||||||
* version ???
|
* version ???
|
||||||
|
* The RSS feed button in the address bar works again
|
||||||
|
* reload/stop buttons update enabled state again
|
||||||
* added marks support (thanks Viktor Kojouharov)
|
* added marks support (thanks Viktor Kojouharov)
|
||||||
* temporary shortcut Y to yank current selection (for non UNIX-users)
|
* temporary shortcut Y to yank current selection (for non UNIX-users)
|
||||||
* Flashing frame with ]f now works as expected
|
* Flashing frame with ]f now works as expected
|
||||||
|
|||||||
14
TODO
14
TODO
@@ -4,32 +4,26 @@ Priority list:
|
|||||||
|
|
||||||
BUGS:
|
BUGS:
|
||||||
- switching tabs while HINT_MODE_ALWAYS is on does not redisplay hints in new tabs, but exits hint mode
|
- switching tabs while HINT_MODE_ALWAYS is on does not redisplay hints in new tabs, but exits hint mode
|
||||||
- The RSS feed button in the address bar no longer works.
|
|
||||||
- autoupdate does not work
|
- autoupdate does not work
|
||||||
- multiple windows to not work at all, so :q will close the whole browser session, even when there are other windows which has tabs
|
- multiple windows to not work at all, so :q will close the whole browser session, even when there are other windows which has tabs
|
||||||
- reload/stop buttons don't update enabled state
|
|
||||||
- http://en.wikipedia.org/wiki/Portal:Current_events - 'f' shows more hints than 'F' (on left side of nav bar)
|
- http://en.wikipedia.org/wiki/Portal:Current_events - 'f' shows more hints than 'F' (on left side of nav bar)
|
||||||
- gu and gU don't work on local files properly
|
- gu and gU don't work on local files properly
|
||||||
- dpb| 09:09:56 dpb :: when I save a page with vimperator, it adds <hints
|
- dpb| 09:09:56 dpb :: when I save a page with vimperator, it adds <hints
|
||||||
id="hah_hints"></hints> near the end of it.. kinda annoying
|
id="hah_hints"></hints> near the end of it.. kinda annoying
|
||||||
dpb| 09:11:50 dpb :: and this happens only when saving the complete
|
dpb| 09:11:50 dpb :: and this happens only when saving the complete
|
||||||
webpage, saving only the html works just fine..
|
webpage, saving only the html works just fine..
|
||||||
- <ESC> key closes :addons window
|
- <ESC> key closes :addons and other XUL windows
|
||||||
|
|
||||||
|
|
||||||
FEATURES:
|
FEATURES:
|
||||||
9 marks of a Location, [m a-zA-Z] to set it, [` a-zA-Z] to go there
|
9 :map commands to keys
|
||||||
[m 0-9] marks a buffer instead [' 0-9] goes there
|
9 :command for new commands
|
||||||
also mark bookmarks (with M[a-zA-Z] maybe and use only lowercase marks for inbuffer marks?)
|
|
||||||
also support :mark and :marks
|
|
||||||
8 :map commands to keys
|
|
||||||
8 :command for new commands
|
|
||||||
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
|
||||||
8 Use our own find-as-you-type mechanism (like conkeror does)
|
8 Use our own find-as-you-type mechanism (like conkeror does)
|
||||||
|
8 make hints smarter, not only with characters from from hintchars, but use "NE" or "NP" for 'new posts' e.g. (might be too slow)
|
||||||
7 [ctrl-o/i] to Go back to a Previous Position (done partly, however currenty does not use a per tab jumplist)
|
7 [ctrl-o/i] to Go back to a Previous Position (done partly, however currenty does not use a per tab jumplist)
|
||||||
7 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable
|
7 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable
|
||||||
with color support (for things like :echo line1\nline2)
|
with color support (for things like :echo line1\nline2)
|
||||||
7 make hints smarter, not only with characters from from hintchars, but use "NE" or "NP" for 'new posts' e.g. (might be too slow)
|
|
||||||
7 whereever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo()
|
7 whereever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo()
|
||||||
7 Ctrl-6/Ctrl-^ -> jump to the previously active tab
|
7 Ctrl-6/Ctrl-^ -> jump to the previously active tab
|
||||||
7 3d should delete 3 tabs
|
7 3d should delete 3 tabs
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ function Mappings()//{{{
|
|||||||
));
|
));
|
||||||
// if you ever add/remove keys here, also check them in the vimperaotr.onEvent()
|
// if you ever add/remove keys here, also check them in the vimperaotr.onEvent()
|
||||||
addDefaultMap(new Map(vimperator.modes.NORMAL, ["<Esc>", "<C-[>"],
|
addDefaultMap(new Map(vimperator.modes.NORMAL, ["<Esc>", "<C-[>"],
|
||||||
onEscape,
|
vimperator.events.onEscape,
|
||||||
{
|
{
|
||||||
short_help: "Cancel any operation",
|
short_help: "Cancel any operation",
|
||||||
help: "Exits any command line or hint mode and returns to browser mode.<br/>" +
|
help: "Exits any command line or hint mode and returns to browser mode.<br/>" +
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ function init()
|
|||||||
|
|
||||||
// these inner classes are created here, because outside the init()
|
// these inner classes are created here, because outside the init()
|
||||||
// function, the chrome:// is not ready
|
// function, the chrome:// is not ready
|
||||||
|
|
||||||
|
// TODO: can these classes be moved into a namesspace to now clobber
|
||||||
|
// the main namespace?
|
||||||
|
Vimperator.prototype.events = new Events;
|
||||||
Vimperator.prototype.commands = new Commands;
|
Vimperator.prototype.commands = new Commands;
|
||||||
Vimperator.prototype.bookmarks = new Bookmarks;
|
Vimperator.prototype.bookmarks = new Bookmarks;
|
||||||
Vimperator.prototype.history = new History;
|
Vimperator.prototype.history = new History;
|
||||||
@@ -71,7 +75,8 @@ function init()
|
|||||||
|
|
||||||
// this function adds all our required listeners to react on events
|
// this function adds all our required listeners to react on events
|
||||||
// also stuff like window.onScroll is handled there.
|
// also stuff like window.onScroll is handled there.
|
||||||
addEventListeners();
|
//addEventListeners();
|
||||||
|
//vimperator.events();
|
||||||
|
|
||||||
set_showtabline(get_pref("showtabline"));
|
set_showtabline(get_pref("showtabline"));
|
||||||
set_guioptions(get_pref("guioptions"));
|
set_guioptions(get_pref("guioptions"));
|
||||||
@@ -126,26 +131,11 @@ function unload()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
function Events() //{{{1
|
||||||
// focus and mode handling //////////////////////////////////////// {{{1
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
function onEscape()
|
|
||||||
{
|
|
||||||
if (!vimperator.hasMode(vimperator.modes.ESCAPE_ONE_KEY))
|
|
||||||
{
|
|
||||||
vimperator.setMode(vimperator.modes.NORMAL);
|
|
||||||
vimperator.echo("");
|
|
||||||
hah.disableHahMode();
|
|
||||||
vimperator.focusContent();
|
|
||||||
vimperator.statusline.updateUrl();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// event listeners //////////////////////////////////////////////// {{{1
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
function addEventListeners()
|
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// CONSTRUCTOR /////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// any window related events
|
// any window related events
|
||||||
window.addEventListener("unload", unload, false);
|
window.addEventListener("unload", unload, false);
|
||||||
window.addEventListener("keypress", vimperator.onEvent, true);
|
window.addEventListener("keypress", vimperator.onEvent, true);
|
||||||
@@ -173,6 +163,7 @@ function addEventListeners()
|
|||||||
vimperator.statusline.updateTabCount();
|
vimperator.statusline.updateTabCount();
|
||||||
updateBufferList();
|
updateBufferList();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
// this adds an event which is is called on each page load, even if the
|
// this adds an event which is is called on each page load, even if the
|
||||||
// page is loaded in a background tab
|
// page is loaded in a background tab
|
||||||
getBrowser().addEventListener("load", onPageLoad, true);
|
getBrowser().addEventListener("load", onPageLoad, true);
|
||||||
@@ -188,51 +179,9 @@ function addEventListeners()
|
|||||||
//alert("titlechanged");
|
//alert("titlechanged");
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
// for setOverLink() XXX: maybe there is an addEventListener way
|
|
||||||
window.XULBrowserWindow = buffer_changed_listener;
|
|
||||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
|
||||||
.QueryInterface(Components.interfaces.nsIDocShellTreeItem).treeOwner
|
|
||||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Components.interfaces.nsIXULWindow)
|
|
||||||
.XULBrowserWindow = window.XULBrowserWindow;
|
|
||||||
|
|
||||||
// for onStateChange(), etc.:
|
|
||||||
getBrowser().addProgressListener(buffer_changed_listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPageLoad(event)
|
this.progressListener =
|
||||||
{
|
|
||||||
if (event.originalTarget instanceof HTMLDocument)
|
|
||||||
{
|
|
||||||
var doc = event.originalTarget;
|
|
||||||
// document is part of a frameset
|
|
||||||
if (doc.defaultView.frameElement)
|
|
||||||
{
|
|
||||||
// hacky way to get rid of "Transfering data from ..." on sites with frames
|
|
||||||
// when you click on a link inside a frameset, because asyncUpdateUI
|
|
||||||
// is not triggered there (firefox bug?)
|
|
||||||
setTimeout(vimperator.statusline.updateUrl, 10);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// code which should happen for all (also background) newly loaded tabs goes here:
|
|
||||||
updateBufferList();
|
|
||||||
|
|
||||||
//update history
|
|
||||||
var url = getCurrentLocation();
|
|
||||||
var title = getCurrentTitle(); // not perfect "- Vimperator" in the title
|
|
||||||
vimperator.history.add(url, title);
|
|
||||||
|
|
||||||
// code which is only relevant if the page load is the current tab goes here:
|
|
||||||
if(doc == getBrowser().selectedBrowser.contentDocument)
|
|
||||||
{
|
|
||||||
/* none yet */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var buffer_changed_listener =
|
|
||||||
{
|
{
|
||||||
QueryInterface: function(aIID)
|
QueryInterface: function(aIID)
|
||||||
{
|
{
|
||||||
@@ -323,6 +272,67 @@ var buffer_changed_listener =
|
|||||||
setDefaultStatus : function(status) { },
|
setDefaultStatus : function(status) { },
|
||||||
onLinkIconAvailable: function() { }
|
onLinkIconAvailable: function() { }
|
||||||
}
|
}
|
||||||
|
window.XULBrowserWindow = this.progressListener;
|
||||||
|
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
|
.QueryInterface(Components.interfaces.nsIDocShellTreeItem).treeOwner
|
||||||
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIXULWindow)
|
||||||
|
.XULBrowserWindow = window.XULBrowserWindow;
|
||||||
|
|
||||||
|
// for onStateChange(), etc.:
|
||||||
|
getBrowser().addProgressListener(this.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
function onPageLoad(event)
|
||||||
|
{
|
||||||
|
if (event.originalTarget instanceof HTMLDocument)
|
||||||
|
{
|
||||||
|
var doc = event.originalTarget;
|
||||||
|
// document is part of a frameset
|
||||||
|
if (doc.defaultView.frameElement)
|
||||||
|
{
|
||||||
|
// hacky way to get rid of "Transfering data from ..." on sites with frames
|
||||||
|
// when you click on a link inside a frameset, because asyncUpdateUI
|
||||||
|
// is not triggered there (firefox bug?)
|
||||||
|
setTimeout(vimperator.statusline.updateUrl, 10);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// code which should happen for all (also background) newly loaded tabs goes here:
|
||||||
|
updateBufferList();
|
||||||
|
|
||||||
|
//update history
|
||||||
|
var url = getCurrentLocation();
|
||||||
|
var title = getCurrentTitle(); // not perfect "- Vimperator" in the title
|
||||||
|
vimperator.history.add(url, title);
|
||||||
|
|
||||||
|
// code which is only relevant if the page load is the current tab goes here:
|
||||||
|
if(doc == getBrowser().selectedBrowser.contentDocument)
|
||||||
|
{
|
||||||
|
/* none yet */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
this.onEscape = function()
|
||||||
|
{
|
||||||
|
if (!vimperator.hasMode(vimperator.modes.ESCAPE_ONE_KEY))
|
||||||
|
{
|
||||||
|
vimperator.setMode(vimperator.modes.NORMAL);
|
||||||
|
vimperator.echo("");
|
||||||
|
hah.disableHahMode();
|
||||||
|
vimperator.focusContent();
|
||||||
|
vimperator.statusline.updateUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -532,7 +542,7 @@ function getLinkNodes(doc)
|
|||||||
return links;
|
return links;
|
||||||
}//}}}
|
}//}}}
|
||||||
|
|
||||||
function Vimperator()
|
function Vimperator() //{{{1
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
@@ -910,7 +920,7 @@ function Vimperator()
|
|||||||
* Firefox 3.0, then this class should go away and their tab methods should be used
|
* Firefox 3.0, then this class should go away and their tab methods should be used
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function Tabs()
|
function Tabs() //{{{1
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
|
|
||||||
<keyset id="mainKeyset">
|
<keyset id="mainKeyset">
|
||||||
<key id="key_open_vimbar" key=":" oncommand="vimperator.commandline.open(':', '', MODE_EX);" modifiers=""/>
|
<key id="key_open_vimbar" key=":" oncommand="vimperator.commandline.open(':', '', MODE_EX);" modifiers=""/>
|
||||||
<key id="key_stop" keycode="VK_ESCAPE" oncommand="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 -->
|
||||||
</keyset>
|
</keyset>
|
||||||
</window>
|
</window>
|
||||||
|
|||||||
Reference in New Issue
Block a user