diff --git a/common/content/buffer.js b/common/content/buffer.js index 282472c9..762b0e10 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -149,47 +149,6 @@ function Buffer() //{{{ ////////////////////// OPTIONS ///////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - function getWebNav() - { - function call(val, fn) - { - try - { - return fn(val); - } - catch (e) - { - return val - } - } - return [ - function () getBrowser().webNavigation, - function (webNav) webNav.sessionHistory.QueryInterface(Ci.nsIWebNavigation) - ].reduce(call, null); - } - - options.add(["encoding", "enc"], - "Sets the current buffer's character encoding", - "string", "UTF-8", - { - scope: options.OPTION_SCOPE_LOCAL, - getter: function () getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset, - setter: function (val) - { - // Stolen from browser.jar/content/browser/browser.js, more or - // less. - try - { - var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val - PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val); - getWebNav().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); - } - catch (e) { liberator.reportError(e); } - }, - completer: function (context) completion.charset(context), - validator: Option.validateCompleter - }); - // FIXME: Most certainly belongs elsewhere. options.add(["fullscreen", "fs"], "Show the current window fullscreen", diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 255e836f..678f6993 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -448,6 +448,27 @@ const config = { //{{{ ////////////////////// OPTIONS ///////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ + options.add(["encoding", "enc"], + "Sets the current buffer's character encoding", + "string", "UTF-8", + { + scope: options.OPTION_SCOPE_LOCAL, + getter: function () getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset, + setter: function (val) + { + // Stolen from browser.jar/content/browser/browser.js, more or less. + try + { + var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val + PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val); + getWebNavigation().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); + } + catch (e) { liberator.reportError(e); } + }, + completer: function (context) completion.charset(context), + validator: Option.validateCompleter + }); + options.add(["online"], "Set the 'work offline' option", "boolean", true,