mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-13 19:35:47 +01:00
add basic validators for the cpt, go, ssli, vbs, wim, and wop options
This commit is contained in:
@@ -102,7 +102,7 @@ function build_longest_starting_substring(list, filter) //{{{
|
|||||||
*
|
*
|
||||||
* may consist of searchengines, filenames, bookmarks and history,
|
* may consist of searchengines, filenames, bookmarks and history,
|
||||||
* depending on the 'complete' option
|
* depending on the 'complete' option
|
||||||
* if the 'complete' argument is passed like "h", it temproarily overrides the complete option
|
* if the 'complete' argument is passed like "h", it tempoarily overrides the complete option
|
||||||
*/
|
*/
|
||||||
function get_url_completions(filter, complete) //{{{
|
function get_url_completions(filter, complete) //{{{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ function Options() //{{{
|
|||||||
var firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
var firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator.");
|
var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator.");
|
||||||
var options = []
|
var options = [];
|
||||||
|
|
||||||
function addOption(option)
|
function addOption(option)
|
||||||
{
|
{
|
||||||
@@ -292,7 +292,8 @@ function Options() //{{{
|
|||||||
"<li><b>h</b>: History</li></ul>" +
|
"<li><b>h</b>: History</li></ul>" +
|
||||||
"The order is important, so <code class=\"command\">:set complete=bs</code> would list bookmarks first, and then any available quick searches.<br/>" +
|
"The order is important, so <code class=\"command\">:set complete=bs</code> would list bookmarks first, and then any available quick searches.<br/>" +
|
||||||
"Add 'sort' to the <code class=\"option\">'wildoptions'</code> option if you want all entries sorted.",
|
"Add 'sort' to the <code class=\"option\">'wildoptions'</code> option if you want all entries sorted.",
|
||||||
default_value: "sfbh"
|
default_value: "sfbh",
|
||||||
|
validator: function (value) { if (/[^sfbh]/.test(value)) return false; else return true; }
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addOption(new Option(["defsearch", "ds"], "string",
|
addOption(new Option(["defsearch", "ds"], "string",
|
||||||
@@ -339,7 +340,8 @@ function Options() //{{{
|
|||||||
"<li><b>s</b>: original Firefox statusbar</li></ul>",
|
"<li><b>s</b>: original Firefox statusbar</li></ul>",
|
||||||
setter: function(value) { Options.setPref("guioptions", value); setGuiOptions(value); },
|
setter: function(value) { Options.setPref("guioptions", value); setGuiOptions(value); },
|
||||||
getter: function() { return Options.getPref("guioptions"); },
|
getter: function() { return Options.getPref("guioptions"); },
|
||||||
default_value: ""
|
default_value: "",
|
||||||
|
validator: function (value) { if (/[^mTbs]/.test(value)) return false; else return true; }
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addOption(new Option(["hintchars", "hc"], "charlist",
|
addOption(new Option(["hintchars", "hc"], "charlist",
|
||||||
@@ -403,7 +405,8 @@ function Options() //{{{
|
|||||||
"<li><b>0</b>: Don't show link destination</li>" +
|
"<li><b>0</b>: Don't show link destination</li>" +
|
||||||
"<li><b>1</b>: Show the link in the status line</li>" +
|
"<li><b>1</b>: Show the link in the status line</li>" +
|
||||||
"<li><b>2</b>: Show the link in the command line</li></ul>",
|
"<li><b>2</b>: Show the link in the command line</li></ul>",
|
||||||
default_value: 1
|
default_value: 1,
|
||||||
|
validator: function (value) { if (value>=0 && value <=2) return true; else return false; }
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addOption(new Option(["showtabline", "stal"], "number",
|
addOption(new Option(["showtabline", "stal"], "number",
|
||||||
@@ -445,7 +448,8 @@ function Options() //{{{
|
|||||||
short_help: "Define which type of messages are logged",
|
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/>" +
|
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/>" +
|
||||||
"The highest value is 9, being the most verbose mode.",
|
"The highest value is 9, being the most verbose mode.",
|
||||||
default_value: 0
|
default_value: 0,
|
||||||
|
validator: function (value) { if (value>=0 && value <=9) return true; else return false; }
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addOption(new Option(["wildmode", "wim"], "stringlist",
|
addOption(new Option(["wildmode", "wim"], "stringlist",
|
||||||
@@ -465,7 +469,13 @@ function Options() //{{{
|
|||||||
"<tr><td><b>'list:longest'</b></td><td>When more than one match, list all matches and complete till the longest common string.</td></tr>" +
|
"<tr><td><b>'list:longest'</b></td><td>When more than one match, list all matches and complete till the longest common string.</td></tr>" +
|
||||||
"</table>" +
|
"</table>" +
|
||||||
"When there is only a single match, it is fully completed regardless of the case.",
|
"When there is only a single match, it is fully completed regardless of the case.",
|
||||||
default_value: "list:full"
|
default_value: "list:full",
|
||||||
|
validator: function (value) {
|
||||||
|
if (/^(?:(?:full|longest|list|list:full|list:longest)(?:,(?!,))?){0,3}(?:full|longest|list|list:full|list:longest)?$/.test(value))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addOption(new Option(["wildoptions", "wop"], "stringlist",
|
addOption(new Option(["wildoptions", "wop"], "stringlist",
|
||||||
@@ -476,7 +486,8 @@ function Options() //{{{
|
|||||||
"<table>" +
|
"<table>" +
|
||||||
"<tr><td><b>sort</b></td><td>Always sorts completion list, overriding the <code class=\"option\">'complete'</code> option.</td></tr>" +
|
"<tr><td><b>sort</b></td><td>Always sorts completion list, overriding the <code class=\"option\">'complete'</code> option.</td></tr>" +
|
||||||
"</table>",
|
"</table>",
|
||||||
default_value: ""
|
default_value: "",
|
||||||
|
validator: function (value) { if (/^sort$/.test(value)) return true; else return false; }
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
//}}}
|
//}}}
|
||||||
|
|||||||
Reference in New Issue
Block a user