mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-08 05:45:45 +01:00
Reset progress indicator on location change.
This commit is contained in:
@@ -252,7 +252,7 @@ var AutoCommands = Module("autocommands", {
|
||||
"List of autocommand event names which should be ignored",
|
||||
"stringlist", "",
|
||||
{
|
||||
completer: function () Iterator(update({ all: "All Events" }, config.autocommands)),
|
||||
values: iter(update({ all: "All Events" }, config.autocommands)).toArray(),
|
||||
has: Option.has.toggleAll
|
||||
});
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ var Buffer = Module("buffer", {
|
||||
// This fires when the load event is initiated
|
||||
// only thrown for the current tab, not when another tab changes
|
||||
if (flags & Ci.nsIWebProgressListener.STATE_START) {
|
||||
statusline.updateProgress(0);
|
||||
statusline.progress = 0;
|
||||
|
||||
buffer._triggerLoadAutocmd("PageLoadPre", webProgress.DOMWindow.document);
|
||||
|
||||
@@ -307,7 +307,9 @@ var Buffer = Module("buffer", {
|
||||
},
|
||||
onProgressChange: function onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) {
|
||||
onProgressChange.superapply(this, arguments);
|
||||
statusline.updateProgress(curTotalProgress / maxTotalProgress);
|
||||
if (webProgress.DOMWindow)
|
||||
webProgress.DOMWindow.dactylProgress = curTotalProgress / maxTotalProgress;
|
||||
statusline.progress = curTotalProgress / maxTotalProgress;
|
||||
},
|
||||
// happens when the users switches tabs
|
||||
onLocationChange: function onLocationChange(webProgress, request, uri) {
|
||||
@@ -316,10 +318,11 @@ var Buffer = Module("buffer", {
|
||||
delete mappings.hives;
|
||||
|
||||
statusline.updateUrl();
|
||||
statusline.progress = "";
|
||||
|
||||
let win = webProgress.DOMWindow;
|
||||
if (win && uri) {
|
||||
statusline.updateProgress(win);
|
||||
statusline.progress = win.dactylProgress;
|
||||
|
||||
let oldURI = webProgress.document.dactylURI;
|
||||
if (webProgress.document.dactylLoadIdx === webProgress.loadedTransIndex
|
||||
@@ -1924,7 +1927,7 @@ var Buffer = Module("buffer", {
|
||||
options.add(["pageinfo", "pa"],
|
||||
"Define which sections are shown by the :pageinfo command",
|
||||
"charlist", "gfm",
|
||||
{ completer: function (context) [[k, v[1]] for ([k, v] in Iterator(buffer.pageInfo))] });
|
||||
{ get values() [[k, v[1]] for ([k, v] in Iterator(buffer.pageInfo))] });
|
||||
|
||||
options.add(["scroll", "scr"],
|
||||
"Number of lines to scroll with <C-u> and <C-d> commands",
|
||||
@@ -1935,7 +1938,7 @@ var Buffer = Module("buffer", {
|
||||
"Where to show the destination of the link under the cursor",
|
||||
"string", "status",
|
||||
{
|
||||
completer: function (context) [
|
||||
values: [
|
||||
["", "Don't show link destinations"],
|
||||
["status", "Show link destinations in the status line"],
|
||||
["command", "Show link destinations in the command line"]
|
||||
|
||||
@@ -1559,8 +1559,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
"r" + [k for ([k, v] in iter(groups[1].opts))
|
||||
if (!document.getElementById(v[1][0]).collapsed)].join(""),
|
||||
|
||||
completer: function (context)
|
||||
array(groups).map(function (g) [[k, v[0]] for ([k, v] in Iterator(g.opts))]).flatten(),
|
||||
values: array(groups).map(function (g) [[k, v[0]] for ([k, v] in Iterator(g.opts))]).flatten(),
|
||||
|
||||
setter: function (value) {
|
||||
for (let group in values(groups))
|
||||
group.setter(value);
|
||||
|
||||
@@ -1181,7 +1181,7 @@ var Hints = Module("hints", {
|
||||
"The keys used to label and select hints",
|
||||
"string", "0123456789",
|
||||
{
|
||||
completer: function () [
|
||||
values: [
|
||||
["0123456789", "Numbers"],
|
||||
["asdfg;lkjh", "Home Row"]],
|
||||
validator: function (value) {
|
||||
@@ -1202,7 +1202,7 @@ var Hints = Module("hints", {
|
||||
"Change the behavior of <Return> in hint mode",
|
||||
"number", 0,
|
||||
{
|
||||
completer: function () [
|
||||
values: [
|
||||
["0", "Follow the first hint as soon as typed text uniquely identifies it. Follow the selected hint on <Return>."],
|
||||
["1", "Follow the selected hint on <Return>."],
|
||||
["2", "Follow the selected hint on <Return> only it's been <Tab>-selected."]
|
||||
@@ -1213,7 +1213,7 @@ var Hints = Module("hints", {
|
||||
"How hints are filtered",
|
||||
"stringlist", "contains",
|
||||
{
|
||||
completer: function (context) [
|
||||
values: [
|
||||
["contains", "The typed characters are split on whitespace. The resulting groups must all appear in the hint."],
|
||||
["custom", "Delegate to a custom function: dactyl.plugins.customHintMatcher(hintString)"],
|
||||
["firstletters", "Behaves like wordstartswith, but all groups must match a sequence of words."],
|
||||
@@ -1233,7 +1233,7 @@ var Hints = Module("hints", {
|
||||
"Which text is used to filter hints for input elements",
|
||||
"stringlist", "label,value",
|
||||
{
|
||||
completer: function (context) [
|
||||
values: [
|
||||
["value", "Match against the value of the input field"],
|
||||
["label", "Match against the text of a label for the input field, if one can be found"],
|
||||
["name", "Match against the name of the input field"]
|
||||
|
||||
@@ -163,10 +163,6 @@ var Option = Class("Option", {
|
||||
setValues: deprecated("Option#set", "set"),
|
||||
joinValues: deprecated("Option#stringify", "stringify"),
|
||||
parseValues: deprecated("Option#parse", "parse"),
|
||||
values: deprecated("Option#value", {
|
||||
get: function values() this.value,
|
||||
set: function values(val) this.value = val
|
||||
}),
|
||||
|
||||
/**
|
||||
* @property {value} The option's current value. The option's local value,
|
||||
@@ -283,7 +279,16 @@ var Option = Class("Option", {
|
||||
* @property {function(CompletionContext, Args)} This option's completer.
|
||||
* @see CompletionContext
|
||||
*/
|
||||
completer: null,
|
||||
completer: function (context) {
|
||||
if (this.values)
|
||||
context.completions = this.values;
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {[[string, string]]} This option's possible values.
|
||||
* @see CompletionContext
|
||||
*/
|
||||
values: null,
|
||||
|
||||
/**
|
||||
* @property {function(host, values)} A function which should return a list
|
||||
@@ -340,7 +345,7 @@ var Option = Class("Option", {
|
||||
* when set.
|
||||
*/
|
||||
validator: function () {
|
||||
if (this.completer)
|
||||
if (this.values || this.completer !== Option.prototype.completer)
|
||||
return Option.validateCompleter.apply(this, arguments);
|
||||
return true;
|
||||
},
|
||||
@@ -601,13 +606,17 @@ var Option = Class("Option", {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
validateCompleter: function (values) {
|
||||
let context = CompletionContext("");
|
||||
let res = context.fork("", 0, this, this.completer);
|
||||
if (!res)
|
||||
res = context.allItems.items.map(function (item) [item.text]);
|
||||
if (this.values)
|
||||
var acceptable = this.values;
|
||||
else {
|
||||
let context = CompletionContext("");
|
||||
acceptable = context.fork("", 0, this, this.completer);
|
||||
if (!acceptable)
|
||||
acceptable = context.allItems.items.map(function (item) [item.text]);
|
||||
}
|
||||
if (this.type == "regexpmap")
|
||||
return Array.concat(values).every(function (re) res.some(function (item) item[0] == re.result));
|
||||
return Array.concat(values).every(function (value) res.some(function (item) item[0] == value));
|
||||
return Array.concat(values).every(function (re) acceptable.some(function (item) item[0] == re.result));
|
||||
return Array.concat(values).every(function (value) acceptable.some(function (item) item[0] == value));
|
||||
},
|
||||
|
||||
validateXPath: function (values) {
|
||||
|
||||
@@ -979,7 +979,7 @@ var Tabs = Module("tabs", {
|
||||
config.tabbrowser.tabContainer._positionPinnedTabs();
|
||||
return value;
|
||||
},
|
||||
completer: function (context) [
|
||||
values: [
|
||||
["never", "Never show the tab bar"],
|
||||
["multitab", "Show the tab bar when there are multiple tabs"],
|
||||
["always", "Always show the tab bar"]
|
||||
@@ -1005,7 +1005,7 @@ var Tabs = Module("tabs", {
|
||||
"Define when newly created tabs are automatically activated",
|
||||
"stringlist", [g[0] for (g in values(activateGroups.slice(1))) if (!g[2] || !prefs.get("browser.tabs." + g[2]))].join(","),
|
||||
{
|
||||
completer: function (context) activateGroups,
|
||||
values: activateGroups,
|
||||
has: Option.has.toggleAll,
|
||||
setter: function (newValues) {
|
||||
let valueSet = set(newValues);
|
||||
@@ -1022,7 +1022,7 @@ var Tabs = Module("tabs", {
|
||||
"Define which commands should output in a new tab by default",
|
||||
"stringlist", "",
|
||||
{
|
||||
completer: function (context) [
|
||||
values: [
|
||||
["all", "All commands"],
|
||||
["addons", ":addo[ns] command"],
|
||||
["downloads", ":downl[oads] command"],
|
||||
@@ -1056,7 +1056,7 @@ var Tabs = Module("tabs", {
|
||||
"See 'popups' option.");
|
||||
return values;
|
||||
},
|
||||
completer: function (context) [
|
||||
values: [
|
||||
["tab", "Open popups in a new tab"],
|
||||
["window", "Open popups in a new window"],
|
||||
["resized", "Open resized popups in a new window"]
|
||||
|
||||
Reference in New Issue
Block a user