1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 17:27:57 +01:00

merge moving global constructor functions to the vimperator namespace

This commit is contained in:
Doug Kearns
2007-10-22 06:09:16 +00:00
parent 55c8cb6ec5
commit 160035e9ee
13 changed files with 260 additions and 258 deletions

View File

@@ -26,7 +26,7 @@ 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 *****/
function Option(names, type, extra_info) //{{{
vimperator.Option = function(names, type, extra_info) //{{{
{
if (!names || !type)
return null;
@@ -107,7 +107,7 @@ function Option(names, type, extra_info) //{{{
}
} //}}}
function Options() //{{{
vimperator.Options = function() //{{{
{
////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -118,13 +118,6 @@ function Options() //{{{
var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator.");
var options = [];
function addOption(option)
{
Options.prototype.__defineGetter__(option.name, function() { return option.value; });
Options.prototype.__defineSetter__(option.name, function(value) { option.value = value; });
options.push(option);
}
function optionsIterator()
{
for (var i = 0; i < options.length; i++)
@@ -206,8 +199,8 @@ function Options() //{{{
function setGuiOptions(value)
{
// hide menubar
document.getElementById("toolbar-menubar").collapsed = value.indexOf("m") > -1 ? false : true;
document.getElementById("toolbar-menubar").hidden = value.indexOf("m") > -1 ? false : true;
//document.getElementById("toolbar-menubar").collapsed = value.indexOf("m") > -1 ? false : true;
//document.getElementById("toolbar-menubar").hidden = value.indexOf("m") > -1 ? false : true;
// and main toolbar
document.getElementById("nav-bar").collapsed = value.indexOf("T") > -1 ? false : true;
document.getElementById("nav-bar").hidden = value.indexOf("T") > -1 ? false : true;
@@ -311,6 +304,13 @@ function Options() //{{{
return null;
}
this.add = function(option)
{
this.__defineGetter__(option.name, function() { return option.value; });
this.__defineSetter__(option.name, function(value) { option.value = value; });
options.push(option);
}
this.destroy = function()
{
// reset some modified firefox prefs
@@ -392,7 +392,7 @@ function Options() //{{{
"//xhtml:*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | " +
"//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select"
addOption(new Option(["activate", "act"], "stringlist",
this.add(new vimperator.Option(["activate", "act"], "stringlist",
{
short_help: "Define when tabs are automatically activated",
help: "Available items:<br/>" +
@@ -405,7 +405,7 @@ function Options() //{{{
default_value: "homepage,quickmark,tabopen,paste"
}
));
addOption(new Option(["complete", "cpt"], "charlist",
this.add(new vimperator.Option(["complete", "cpt"], "charlist",
{
short_help: "Items which are completed at the :[tab]open prompt",
help: "Available items:<br/>" +
@@ -421,7 +421,7 @@ function Options() //{{{
validator: function (value) { if (/[^sfbh]/.test(value)) return false; else return true; }
}
));
addOption(new Option(["defsearch", "ds"], "string",
this.add(new vimperator.Option(["defsearch", "ds"], "string",
{
short_help: "Set the default search engine",
help: "The default search engine is used in the <code class=\"command\">:[tab]open [arg]</code> command " +
@@ -430,20 +430,20 @@ function Options() //{{{
default_value: "google"
}
));
addOption(new Option(["extendedhinttags", "eht"], "string",
this.add(new vimperator.Option(["extendedhinttags", "eht"], "string",
{
short_help: "XPath string of hintable elements activated by ';'",
default_value: DEFAULT_HINTTAGS
}
));
addOption(new Option(["focusedhintstyle", "fhs"], "string",
this.add(new vimperator.Option(["focusedhintstyle", "fhs"], "string",
{
short_help: "CSS specification of focused hints",
default_value: "z-index:5000; font-family:monospace; font-size:12px; color:ButtonText; background-color:ButtonShadow; " +
"border-color:ButtonShadow; border-width:1px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;"
}
));
addOption(new Option(["fullscreen", "fs"], "boolean",
this.add(new vimperator.Option(["fullscreen", "fs"], "boolean",
{
short_help: "Show the current window fullscreen",
setter: function(value) { window.fullScreen = value; },
@@ -451,7 +451,7 @@ function Options() //{{{
default_value: false
}
));
addOption(new Option(["guioptions", "go"], "charlist",
this.add(new vimperator.Option(["guioptions", "go"], "charlist",
{
short_help: "Show or hide the menu, toolbar and scrollbars",
help: "Supported characters:<br/>" +
@@ -465,52 +465,52 @@ function Options() //{{{
validator: function (value) { if (/[^mTb]/.test(value)) return false; else return true; }
}
));
addOption(new Option(["hintchars", "hc"], "charlist",
this.add(new vimperator.Option(["hintchars", "hc"], "charlist",
{
short_help: "String of single characters which can be used to follow hints",
default_value: "hjklasdfgyuiopqwertnmzxcvb"
}
));
addOption(new Option(["hintstyle", "hs"], "string",
this.add(new vimperator.Option(["hintstyle", "hs"], "string",
{
short_help: "CSS specification of unfocused hints",
default_value: "z-index:5000; font-family:monospace; font-size:12px; color:white; background-color:red; " +
"border-color:ButtonShadow; border-width:0px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;"
}
));
addOption(new Option(["hinttags", "ht"], "string",
this.add(new vimperator.Option(["hinttags", "ht"], "string",
{
short_help: "XPath string of hintable elements activated by <code class=\"mapping\">'f'</code> and <code class=\"mapping\">'F'</code>",
default_value: DEFAULT_HINTTAGS
}
));
addOption(new Option(["hlsearch", "hls"], "boolean",
this.add(new vimperator.Option(["hlsearch", "hls"], "boolean",
{
short_help: "Highlight previous search pattern matches",
setter: function(value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); },
default_value: false
}
));
addOption(new Option(["hlsearchstyle", "hlss"], "string",
this.add(new vimperator.Option(["hlsearchstyle", "hlss"], "string",
{
short_help: "CSS specification of highlighted search items",
default_value: "color: black; background-color: yellow; padding: 0; display: inline;"
}
));
addOption(new Option(["ignorecase", "ic"], "boolean",
this.add(new vimperator.Option(["ignorecase", "ic"], "boolean",
{
short_help: "Ignore case in search patterns",
default_value: true
}
));
addOption(new Option(["incsearch", "is"], "boolean",
this.add(new vimperator.Option(["incsearch", "is"], "boolean",
{
short_help: "Show where the search pattern matches as it is typed",
help: "NOTE: Incremental searching currently only works in the forward direction.",
default_value: true
}
));
addOption(new Option(["laststatus", "ls"], "number",
this.add(new vimperator.Option(["laststatus", "ls"], "number",
{
short_help: "Show the status line",
help: "Determines when the last window will have a status line. " +
@@ -526,20 +526,20 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; }
}
));
addOption(new Option(["linksearch", "lks"], "boolean",
this.add(new vimperator.Option(["linksearch", "lks"], "boolean",
{
short_help: "Limit the search to hyperlink text",
help: "This includes (X)HTML elements with an \"href\" atrribute and XLink \"simple\" links.",
default_value: false
}
));
addOption(new Option(["more"], "boolean",
this.add(new vimperator.Option(["more"], "boolean",
{
short_help: "Pause the message list window when more than one screen of listings is displayed",
default_value: true
}
));
addOption(new Option(["maxhints", "mh"], "number",
this.add(new vimperator.Option(["maxhints", "mh"], "number",
{
short_help: "Maximum number of simultaneously shown hints",
help: "If you want to speed up display of hints, choose a smaller value",
@@ -547,7 +547,7 @@ function Options() //{{{
validator: function (value) { if (value >= 1 && value <= 1000) return true; else return false; }
}
));
addOption(new Option(["popups", "pps"], "number",
this.add(new vimperator.Option(["popups", "pps"], "number",
{
short_help: "Where to show requested popup windows",
help: "Define where to show requested popup windows. Does not apply to windows which are opened by middle clicking a link, they always open in a new tab. " +
@@ -564,7 +564,7 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 3) return true; else return false; }
}
));
addOption(new Option(["preload"], "boolean",
this.add(new vimperator.Option(["preload"], "boolean",
{
short_help: "Speed up first time history/bookmark completion",
help: "History access can be quite slow for a large history. Vimperator maintains a cache to speed it up significantly on subsequent access.<br/>" +
@@ -572,7 +572,7 @@ function Options() //{{{
default_value: true
}
));
addOption(new Option(["previewheight", "pvh"], "number",
this.add(new vimperator.Option(["previewheight", "pvh"], "number",
{
short_help: "Default height for preview window",
help: "Value must be between 1 and 50. If the value is too high, completions may cover the command-line. " +
@@ -582,7 +582,7 @@ function Options() //{{{
validator: function (value) { if (value >= 1 && value <= 50) return true; else return false; }
}
));
addOption(new Option(["scroll", "scr"], "number",
this.add(new vimperator.Option(["scroll", "scr"], "number",
{
short_help: "Number of lines to scroll with <code class=\"mapping\">C-u</code> and <code class=\"mapping\">C-d</code> commands",
help: "The number of lines scrolled defaults to half the window size. " +
@@ -592,13 +592,13 @@ function Options() //{{{
validator: function (value) { if (value >= 0) return true; else return false; }
}
));
addOption(new Option(["showmode", "smd"], "boolean",
this.add(new vimperator.Option(["showmode", "smd"], "boolean",
{
short_help: "Show the current mode in the command line",
default_value: true
}
));
addOption(new Option(["showstatuslinks", "ssli"], "number",
this.add(new vimperator.Option(["showstatuslinks", "ssli"], "number",
{
short_help: "Show the destination of the link under the cursor in the status bar",
help: "Also links which are focused by keyboard commands like <code class=\"mapping\">&lt;Tab&gt;</code> are shown. " +
@@ -612,7 +612,7 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; }
}
));
addOption(new Option(["showtabline", "stal"], "number",
this.add(new vimperator.Option(["showtabline", "stal"], "number",
{
short_help: "Control when to show the tab bar of opened web pages",
help: "Possible values:<br/>" +
@@ -626,14 +626,14 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; }
}
));
addOption(new Option(["smartcase", "scs"], "boolean",
this.add(new vimperator.Option(["smartcase", "scs"], "boolean",
{
short_help: "Override the 'ignorecase' option if the pattern contains uppercase characters",
help: "This is only used if the <code class=\"option\">'ignorecase'</code> option is set.",
default_value: true
}
));
addOption(new Option(["titlestring"], "string",
this.add(new vimperator.Option(["titlestring"], "string",
{
short_help: "Change the title of the browser window",
help: "Vimperator changes the browser title from \"Title of web page - Mozilla Firefox\" to " +
@@ -643,7 +643,7 @@ function Options() //{{{
default_value: "Vimperator"
}
));
addOption(new Option(["usermode", "um"], "boolean",
this.add(new vimperator.Option(["usermode", "um"], "boolean",
{
short_help: "Show current website with a minimal style sheet to make it easily accessible",
help: "Note that this is a local option for now, later it may be split into a global and <code class=\"command\">:setlocal</code> part",
@@ -652,7 +652,7 @@ function Options() //{{{
default_value: false
}
));
addOption(new Option(["verbose", "vbs"], "number",
this.add(new vimperator.Option(["verbose", "vbs"], "number",
{
short_help: "Define which type of messages are logged",
help: "When bigger than zero, Vimperator will give messages about what it is doing. They are printed to the error console which can be shown with <code class=\"command\">:javascript!</code>.<br/>" +
@@ -661,14 +661,14 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 9) return true; else return false; }
}
));
addOption(new Option(["visualbell", "vb"], "boolean",
this.add(new vimperator.Option(["visualbell", "vb"], "boolean",
{
short_help: "Use visual bell instead of beeping on errors",
setter: function(value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); },
default_value: false
}
));
addOption(new Option(["visualbellstyle", "t_vb"], "string",
this.add(new vimperator.Option(["visualbellstyle", "t_vb"], "string",
{
short_help: "CSS specification of the visual bell",
help: "To hide the visual bell use a value of \"display: none;\" or unset it with <code class=\"command\">:set t_vb=</code>",
@@ -676,7 +676,7 @@ function Options() //{{{
default_value: "background-color: black; color: black;"
}
));
addOption(new Option(["wildmode", "wim"], "stringlist",
this.add(new vimperator.Option(["wildmode", "wim"], "stringlist",
{
short_help: "Define how command line completion works",
help: "It is a comma-separated list of parts, where each part specifies " +
@@ -703,7 +703,7 @@ function Options() //{{{
}
}
));
addOption(new Option(["wildoptions", "wop"], "stringlist",
this.add(new vimperator.Option(["wildoptions", "wop"], "stringlist",
{
short_help: "Change how command line completion is done",
help: "A list of words that change how command line completion is done.<br/>" +