1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 21:44:12 +01:00

Add go=r to toggle the scrollbar

This commit is contained in:
Kris Maglione
2008-12-04 15:58:19 -05:00
parent eb11ec2b06
commit b8d32c8e3d
6 changed files with 78 additions and 38 deletions

View File

@@ -122,6 +122,8 @@ CompletionContext.prototype = {
{
let self = this;
let minStart = Math.min.apply(Math, [context.offset for ([k, context] in Iterator(this.contexts)) if (context.items.length && context.hasItems)]);
if (minStart == Infinity)
minStart = 0;
let items = this.contextList.map(function (context) {
if (!context.hasItems)
return [];

View File

@@ -92,48 +92,63 @@ const liberator = (function () //{{{
"Allow reading of an RC file in the current directory",
"boolean", false);
const tabopts = [
["n", "Tab number", null, highlight.selector("TabNumber")],
["N", "Tab number over icon", null, highlight.selector("TabIconNumber")]
];
const groups = {
config: {
opts: config.guioptions,
setter: function (opts)
{
for (let [opt, [,ids]] in Iterator(this.opts))
{
ids.map(function (id) document.getElementById(id))
.forEach(function (elem)
{
if (elem)
elem.collapsed = (opts.indexOf(opt) == -1)
});
}
}
},
scroll: {
opts: { r: ["Right Scrollbar"] },
setter: function (opts)
{
if (opts.indexOf("r") == -1)
styles.addSheet("scrollbar", "*", "html|html > xul|scrollbar { visibility: collapse !important; }", true, true);
else
styles.removeSheet("scrollbar", null, null, null, true);
}
},
tab: {
opts: {
n: ["Tab number", highlight.selector("TabNumber")],
N: ["Tab number over icon", highlight.selector("TabIconNumber")]
},
setter: function (opts)
{
let classes = [v[1] for ([k, v] in Iterator(this.opts)) if (opts.indexOf(k) >= 0)];
let css = classes.length ? classes.join(",") + "{ display: none; }" : "";
styles.addSheet("taboptions", "chrome://*", css, true, true);
statusline.updateTabCount();
}
}
};
options.add(["guioptions", "go"],
"Show or hide certain GUI elements like the menu or toolbar",
"charlist", config.defaults.guioptions || "",
{
setter: function (value)
{
for (let [opt, ids] in Iterator(config.guioptions))
{
ids.forEach(function (id)
{
try
{
document.getElementById(id).collapsed = (value.indexOf(opt) < 0);
}
catch (e) {}
});
}
let classes = tabopts.filter(function (o) value.indexOf(o[0]) == -1)
.map(function (a) a[3])
if (!classes.length)
{
styles.removeSheet("taboptions", null, null, null, true);
}
else
{
storage.styles.addSheet("taboptions", "chrome://*", classes.join(",") + "{ display: none; }", true, true);
statusline.updateTabCount();
}
for (let [,group] in Iterator(groups))
group.setter(value);
return value;
},
completer: function (filter)
{
return [
["m", "Menubar"],
["T", "Toolbar"],
["b", "Bookmark bar"]
].concat(!liberator.has("tabs") ? [] : tabopts);
let opts = [v.opts for ([k, v] in Iterator(groups))];
opts = opts.map(function (opt) [[k, v[0]] for ([k, v] in Iterator(opt))]);
return util.Array.flatten(opts);
},
validator: Option.validateCompleter
});

View File

@@ -238,6 +238,7 @@ function Styles(name, store, serial)
try
{
this.registerSheet(cssUri(wrapCSS(sheet)), !force);
this.registerAgentSheet(cssUri(wrapCSS(sheet)))
}
catch (e)
{
@@ -299,6 +300,7 @@ function Styles(name, store, serial)
if (!sheet.ref.length)
{
this.unregisterSheet(cssUri(wrapCSS(sheet)));
this.unregisterAgentSheet(cssUri(wrapCSS(sheet)));
if (sheets.indexOf(sheet) > -1)
sheets.splice(sheets.indexOf(sheet), 1);
}
@@ -331,6 +333,21 @@ function Styles(name, store, serial)
sss.unregisterSheet(uri, sss.USER_SHEET);
}
// FIXME
this.registerAgentSheet = function (uri)
{
this.unregisterAgentSheet(uri);
uri = ios.newURI(uri, null, null);
sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
}
this.unregisterAgentSheet = function (uri)
{
uri = ios.newURI(uri, null, null);
if (sss.sheetRegistered(uri, sss.AGENT_SHEET))
sss.unregisterSheet(uri, sss.AGENT_SHEET);
}
function wrapCSS(sheet)
{
let filter = sheet.sites;

View File

@@ -232,9 +232,9 @@ function CommandLine() //{{{
this.wildtypes = this.wildmode.values;
this.wildIndex = -1;
this.prefix = this.context.value.substr(0, this.start);
this.value = this.context.value.substr(this.start, this.context.caret);
this.suffix = this.context.value.substr(this.context.caret);
this.prefix = this.context.value.substring(0, this.start);
this.value = this.context.value.substring(this.start, this.caret);
this.suffix = this.context.value.substring(this.caret);
if (show)
{
@@ -1372,7 +1372,7 @@ function CommandLine() //{{{
if (completions)
{
completions.context.reset();
completions.reset();
//completions.reset();
}
historyIndex = UNINITIALIZED;
removeSuffix = "";

View File

@@ -18,6 +18,7 @@
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
VimperatorLeave respectively
* add 'guioptions'=r to toggle the scrollbar.
* remove spaces and newlines when open urls starting with http:// or similar
before :o http://linux .com would search for http://linux and for .com, now
it just opens linux.com. Also handy when pasting broken urls with p or P.

View File

@@ -33,8 +33,13 @@ const config = { //{{{
/*** optional options, there are checked for existance and a fallback provided ***/
features: ["bookmarks", "hints", "history", "marks", "quickmarks", "session", "tabs", "windows"],
defaults: { guioptions: "" },
guioptions: { m: ["toolbar-menubar"], T: ["nav-bar"], b: ["PersonalToolbar"] },
defaults: { guioptions: "r" },
guioptions: {
m: ["MenuBar", ["toolbar-menubar"]],
T: ["Toolbar", ["nav-bar"]],
b: ["Bookmark bar", ["PersonalToolbar"]]
},
get visualbellWindow() getBrowser().mPanelContainer,
styleableChrome: "chrome://browser/content/browser.xul",