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

:set [no]focuscontent, thanks Paul!

This commit is contained in:
Martin Stubenschrott
2008-06-10 18:34:36 +00:00
parent 36a1376835
commit 119de356b5
5 changed files with 39 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
<b>Note:</b> If you don't wish to appear on this list when making a donation, please tell me.
2008:
* Paul Sobey
* Olivier Guéry
* Dotan Cohen
* Daniel Schaffrath

3
NEWS
View File

@@ -3,6 +3,9 @@
* version 1.2
* IMPORTANT: removed old :buffers! buffer window, as it was ugly and slightly broken
use "B" or :buffers instead
* IMPORTANT: input fields are not blured anymore by default after a page has loaded
use :set [no]focuscontent to control the behavior (thanks Paul Sobey for the
generous donation which made this behavior possible)
* :bdelete accepts an optional argument now
* renamed some :autocmd, mainly BrowserStartup -> Startup and BrowserExit -> Quit
* don't pass any ctrl- or alt- prefixed keys to firefox in insert mode

View File

@@ -142,7 +142,9 @@ liberator.Buffer = function () //{{{
////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
liberator.options.add(["fullscreen", "fs"], "Show the current window fullscreen", "boolean", false,
liberator.options.add(["fullscreen", "fs"],
"Show the current window fullscreen",
"boolean", false,
{
setter: function (value) { window.fullScreen = value; },
getter: function () { return window.fullScreen; }

View File

@@ -42,6 +42,14 @@ liberator.AutoCommands = function () //{{{
throw StopIteration;
}
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
liberator.options.add(["focuscontent", "fc"],
"Try to stay in normal mode after loading a web page",
"boolean", false);
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
@@ -456,12 +464,16 @@ liberator.Events = function () //{{{
if (doc == getBrowser().contentDocument)
{
// we want to stay in command mode after a page has loaded
// XXX: Does this still causes window map events which is _very_ annoying
setTimeout(function () {
var focused = document.commandDispatcher.focusedElement;
if (focused && (typeof focused.value != "undefined") && focused.value.length == 0)
focused.blur();
}, 100);
// TODO: move somehwere else, as focusing can already happen earlier than on "load"
if (liberator.options["focuscontent"])
{
liberator.log("focuscontent");
setTimeout(function () {
var focused = document.commandDispatcher.focusedElement;
if (focused && (typeof focused.value != "undefined") && focused.value.length == 0)
focused.blur();
}, 100);
}
}
}
}
@@ -478,7 +490,7 @@ liberator.Events = function () //{{{
if (liberator.buffer.loaded == 1)
return true;
var ms = 15000; // maximum time to wait - TODO: add option
var ms = 25000; // maximum time to wait - TODO: add option
var then = new Date().getTime();
for (var now = then; now - then < ms; now = new Date().getTime())
{
@@ -931,6 +943,8 @@ liberator.Events = function () //{{{
if (liberator.mode == liberator.modes.COMMAND_LINE)
return;
// liberator.log("onFocusChange: " + liberator.buffer.loaded);
var win = window.document.commandDispatcher.focusedWindow;
var elem = window.document.commandDispatcher.focusedElement;
if (elem && elem.readOnly)

View File

@@ -197,6 +197,17 @@ The XPath string of hintable elements activated by [m];[m].
____
|\'nofc'| |\'nofocuscontent'| |\'fc'| |\'focuscontent'|
||'focuscontent' 'fc'|| boolean (default: off)
____
Focus the content after a page has loaded. This is useful, if you always
want to stay in normal mode when browsing between web sites. When "on", it
blurs any textbox which often is automatically focused on page load.
If you usually like 'focuscontent' but sometimes you'd like to focus the
first input field, you can use [m]gi[m] to jump to it.
____
|\'nofs'| |\'nofullscreen'| |\'fs'| |\'fullscreen'|
||'fullscreen' 'fs'|| boolean (default: off)
____