mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 21:52:27 +01:00
More of the same.
This commit is contained in:
@@ -240,6 +240,27 @@ liberator.Options = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function echoOptions(title, opts) {
|
||||||
|
XML.prettyPrinting = false;
|
||||||
|
let list = liberator.buffer.template.generic(
|
||||||
|
<table>
|
||||||
|
<tr class="hl-Title" align="left">
|
||||||
|
<th>--- {title} ---</th>
|
||||||
|
</tr>
|
||||||
|
{[
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span style={opt.isDefault ? "" : "font-weight: bold"}>{opt.pre}{opt.name}{opt.value}</span>
|
||||||
|
{opt.isDefault || opt.default == null ? "" : <span style="color: gray"> (default: {opt.default})</span>}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
for each (opt in opts)].reduce(liberator.buffer.template.add, <></>)
|
||||||
|
}
|
||||||
|
</table>);
|
||||||
|
|
||||||
|
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// firefox preferences which need to be changed to work well with vimperator
|
// firefox preferences which need to be changed to work well with vimperator
|
||||||
//
|
//
|
||||||
@@ -844,53 +865,37 @@ liberator.Options = function () //{{{
|
|||||||
if (!scope)
|
if (!scope)
|
||||||
scope = liberator.options.OPTION_SCOPE_BOTH;
|
scope = liberator.options.OPTION_SCOPE_BOTH;
|
||||||
|
|
||||||
let opts = []
|
let opts = function (opt) {
|
||||||
for (let opt in Iterator(this))
|
for (let opt in Iterator(liberator.options))
|
||||||
{
|
|
||||||
let option = {
|
|
||||||
isDefault: opt.value == opt.defaultValue,
|
|
||||||
name: opt.name,
|
|
||||||
default: opt.defaultValue,
|
|
||||||
pre: <>  </>,
|
|
||||||
value: <></>,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (onlyNonDefault && option.isDefault)
|
|
||||||
continue;
|
|
||||||
if (!(opt.scope & scope))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (opt.type == "boolean")
|
|
||||||
{
|
{
|
||||||
if (!opt.value)
|
let option = {
|
||||||
option.pre = "no";
|
isDefault: opt.value == opt.defaultValue,
|
||||||
option.default = (option.default ? "" : "no") + opt.name;
|
name: opt.name,
|
||||||
|
default: opt.defaultValue,
|
||||||
|
pre: <>  </>,
|
||||||
|
value: <></>,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (onlyNonDefault && option.isDefault)
|
||||||
|
continue;
|
||||||
|
if (!(opt.scope & scope))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (opt.type == "boolean")
|
||||||
|
{
|
||||||
|
if (!opt.value)
|
||||||
|
option.pre = "no";
|
||||||
|
option.default = (option.default ? "" : "no") + opt.name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
option.value = <>={liberator.util.colorize(opt.value, false)}</>;
|
||||||
|
}
|
||||||
|
yield option;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
option.value = <>={liberator.util.colorize(opt.value, false)}</>;
|
|
||||||
}
|
|
||||||
opts.push(option);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XML.prettyPrinting = false;
|
echoOptions("Options", opts());
|
||||||
let list = liberator.buffer.template.generic(
|
|
||||||
<table>
|
|
||||||
<tr class="hl-Title" align="left">
|
|
||||||
<th>--- Options ---</th>
|
|
||||||
</tr>
|
|
||||||
{[
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<span style={opt.isDefault ? "" : "font-weight: bold"}>{opt.pre}{opt.name}{opt.value}</span>
|
|
||||||
{opt.isDefault ? "" : <span style="color: gray"> (default: {opt.default})</span>}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
for each (opt in opts)].reduce(liberator.buffer.template.add, <></>)
|
|
||||||
}
|
|
||||||
</table>);
|
|
||||||
|
|
||||||
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
listPrefs: function (onlyNonDefault, filter)
|
listPrefs: function (onlyNonDefault, filter)
|
||||||
@@ -898,42 +903,32 @@ liberator.Options = function () //{{{
|
|||||||
if (!filter)
|
if (!filter)
|
||||||
filter = "";
|
filter = "";
|
||||||
|
|
||||||
/* Argh. Later. */
|
|
||||||
|
|
||||||
var prefArray = prefService.getChildList("", { value: 0 });
|
var prefArray = prefService.getChildList("", { value: 0 });
|
||||||
prefArray.sort();
|
prefArray.sort();
|
||||||
var list = ":" + liberator.util.escapeHTML(liberator.commandline.getCommand()) + "<br/>" +
|
let prefs = function () {
|
||||||
"<table><tr class=\"hl-Title\" align=\"left\"><th>--- " + liberator.config.hostApplication +
|
for each (let pref in prefArray)
|
||||||
" Options ---</th></tr>";
|
|
||||||
var name, value, defaultValue;
|
|
||||||
|
|
||||||
prefArray.forEach(function (pref) {
|
|
||||||
var userValue = prefService.prefHasUserValue(pref);
|
|
||||||
if ((!onlyNonDefault || userValue) && pref.indexOf(filter) >= 0)
|
|
||||||
{
|
{
|
||||||
name = pref;
|
var userValue = prefService.prefHasUserValue(pref);
|
||||||
value = liberator.options.getPref(name);
|
if (onlyNonDefault && !userValue || pref.indexOf(filter) == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
value = liberator.options.getPref(pref);
|
||||||
if (typeof value == "string")
|
if (typeof value == "string")
|
||||||
value = value.substr(0, 100).replace(/\n/g, " ");
|
value = value.substr(0, 100).replace(/\n/g, " ");
|
||||||
|
|
||||||
value = liberator.util.colorize(value, true);
|
let option = {
|
||||||
defaultValue = loadPreference(name, null, true);
|
isDefault: !userValue,
|
||||||
|
default: loadPreference(pref, null, true),
|
||||||
|
value: <>={liberator.util.colorize(value, false)}</>,
|
||||||
|
name: pref,
|
||||||
|
pre: <>  </>,
|
||||||
|
};
|
||||||
|
|
||||||
if (defaultValue == null)
|
yield option;
|
||||||
defaultValue = "no default";
|
|
||||||
else
|
|
||||||
defaultValue = "default: " + defaultValue;
|
|
||||||
|
|
||||||
if (userValue)
|
|
||||||
{
|
|
||||||
list += "<tr><td> <span style=\"font-weight: bold\">" + name + "</span>=" + value + "<span style=\"color: gray\"> (" + defaultValue + ")</span></td></tr>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
list += "<tr><td> " + name + "=" + value + "</td></tr>";
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
list += "</table>";
|
|
||||||
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
|
echoOptions(liberator.config.hostApplication + " Options", prefs());
|
||||||
},
|
},
|
||||||
|
|
||||||
get store() liberator.storage.options,
|
get store() liberator.storage.options,
|
||||||
|
|||||||
Reference in New Issue
Block a user