Skip to content

Commit f900356

Browse files
SammysHPtimss
authored andcommitted
Fix #619: Override newtab URL (#620)
* Fix #619: Override newtab URL This exposes the NewTabURL API to the user and also provides a fallback for older versions of Firefox via the browser.newtab.url preference. * Add help entry for 'newtaburl' * Add entry for 'newtaburl' in NEWS
1 parent cf5961b commit f900356

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

vimperator/NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
201x-xx-xx:
2+
* add option 'newtaburl' to set default URL in new tabs
23

34
2016-10-05:
45
* update and fix css related issues

vimperator/content/config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,29 @@ var Config = Module("config", ConfigBase, {
323323
},
324324
getter: function () !services.get("io").offline
325325
});
326+
327+
options.add(["newtaburl", "ntu"],
328+
"Set the default page for new tabs",
329+
"string", "about:newtab",
330+
{
331+
setter: function (value) {
332+
if (services.get("vc").compare(VERSION, "41.*") == -1) {
333+
options.setPref("browser.newtab.url", value);
334+
} else {
335+
Components.utils.import("resource:///modules/NewTabURL.jsm");
336+
NewTabURL.override(value);
337+
}
338+
return value;
339+
},
340+
getter: function () {
341+
if (services.get("vc").compare(VERSION, "41.*") == -1) {
342+
return options.getPref("browser.newtab.url");
343+
} else {
344+
Components.utils.import("resource:///modules/NewTabURL.jsm");
345+
return NewTabURL.get();
346+
}
347+
}
348+
});
326349
}
327350
});
328351

vimperator/locale/en-US/options.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,17 @@
6262
</description>
6363
</item>
6464

65+
<item insertafter="'newtab'">
66+
<tags>'ntu' 'newtaburl'</tags>
67+
<spec>'newtaburl' 'ntu'</spec>
68+
<type>string</type>
69+
<default>about:newtab</default>
70+
<description>
71+
<p>
72+
The URL that will be opened in new tabs.
73+
</p>
74+
</description>
75+
</item>
76+
6577
</overlay>
6678
<!-- vim:se sts=4 sw=4 et: -->

0 commit comments

Comments
 (0)