mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 16:27:59 +01:00
move remaining preference setting from vimperator.startup to Options()
This commit is contained in:
@@ -227,6 +227,23 @@ function Options() //{{{
|
||||
document.title = window.content.document.title + " - " + value; // not perfect fix, but good enough
|
||||
}
|
||||
|
||||
//
|
||||
// firefox preferences which need to be changed to work well with vimperator
|
||||
//
|
||||
|
||||
// work around firefox popup blocker
|
||||
var popup_allowed_events = loadPreference('dom.popup_allowed_events', 'change click dblclick mouseup reset submit');
|
||||
if (!popup_allowed_events.match("keypress"))
|
||||
storePreference('dom.popup_allowed_events', popup_allowed_events + " keypress");
|
||||
|
||||
// TODO: shouldn't we be resetting these in destroy() as well?
|
||||
// we have our own typeahead find implementation
|
||||
storePreference('accessibility.typeaheadfind.autostart', false);
|
||||
storePreference('accessibility.typeaheadfind', false); // actually the above setting should do it, but has no effect in firefox
|
||||
|
||||
// start with saved session
|
||||
storePreference("browser.startup.page", 3);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
@@ -246,6 +263,14 @@ function Options() //{{{
|
||||
return null;
|
||||
}
|
||||
|
||||
this.destroy = function()
|
||||
{
|
||||
// reset some modified firefox prefs
|
||||
if (loadPreference('dom.popup_allowed_events', 'change click dblclick mouseup reset submit')
|
||||
== popup_allowed_events + " keypress")
|
||||
storePreference('dom.popup_allowed_events', popup_allowed_events);
|
||||
}
|
||||
|
||||
// TODO: separate Preferences from Options? Would these utility functions
|
||||
// be better placed in the 'core' vimperator namespace somewhere?
|
||||
Options.setPref = function(name, value)
|
||||
|
||||
@@ -69,8 +69,6 @@ const vimperator = (function() //{{{
|
||||
|
||||
var callbacks = [];
|
||||
|
||||
var popup_allowed_events; // need to change and reset this firefox pref XXX: move to options class
|
||||
|
||||
// our services
|
||||
var sound_service = Components.classes['@mozilla.org/sound;1']
|
||||
.getService(Components.interfaces.nsISound);
|
||||
@@ -626,17 +624,6 @@ const vimperator = (function() //{{{
|
||||
vimperator.registerCallback("submit", vimperator.modes.EX, function(command) { vimperator.execute(command); } );
|
||||
vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return exTabCompletion(str); } );
|
||||
|
||||
// TODO: move most of the following code to Options constructor
|
||||
|
||||
// work around firefox popup blocker
|
||||
popup_allowed_events = Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit');
|
||||
if (!popup_allowed_events.match("keypress"))
|
||||
Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events + " keypress");
|
||||
|
||||
// we have our own typeahead find implementation
|
||||
Options.setFirefoxPref('accessibility.typeaheadfind.autostart', false);
|
||||
Options.setFirefoxPref('accessibility.typeaheadfind', false); // actually the above setting should do it, but has no effect in firefox
|
||||
|
||||
// first time intro message
|
||||
if (Options.getPref("firsttime", true))
|
||||
{
|
||||
@@ -649,9 +636,6 @@ const vimperator = (function() //{{{
|
||||
//gURLBar.blur(); // TODO: needed anymore?
|
||||
vimperator.focusContent();
|
||||
|
||||
// firefox preferences which we need to be changed to work well with vimperator
|
||||
Options.setFirefoxPref("browser.startup.page", 3); // start with saved session
|
||||
|
||||
// finally, read a ~/.vimperatorrc
|
||||
// make sourcing asynchronous, otherwise commands that open new tabs won't work
|
||||
setTimeout(function() {
|
||||
@@ -683,12 +667,8 @@ const vimperator = (function() //{{{
|
||||
// save our preferences
|
||||
vimperator.commandline.destroy();
|
||||
vimperator.events.destroy();
|
||||
vimperator.options.destroy();
|
||||
vimperator.quickmarks.destroy();
|
||||
|
||||
// reset some modified firefox prefs
|
||||
if (Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit')
|
||||
== popup_allowed_events + " keypress")
|
||||
Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events);
|
||||
},
|
||||
|
||||
// @param value MUST be a string, it can have the following form: "+20%", "200%", "-30"
|
||||
|
||||
Reference in New Issue
Block a user