Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new option to customize blank new tab HTML/CSS #1068

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions background/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ [email protected]`
localeEncoding: "gbk",
mouseReachable: true,
/** mutable */ newTabUrl: "",
userDefinedNewTab: "",
nextPatterns: "\u4e0b\u4e00\u5c01,\u4e0b\u9875,\u4e0b\u4e00\u9875,\u4e0b\u4e00\u7ae0,\u540e\u4e00\u9875\
,\u4e0b\u4e00\u5f20,next,more,newer,>,\u203a,\u2192,\xbb,\u226b,>>",
notifyUpdate: true,
Expand Down
10 changes: 6 additions & 4 deletions pages/blank.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Blank Page</title>
<meta name="color-scheme" content="light dark">
<script src="loader.js"></script>
<meta charset="utf-8">
<title>Blank Page</title>
<meta name="color-scheme" content="light dark">
<script src="loader.js"></script>
</head>
<body id="vimium-user-content"></body>
6 changes: 6 additions & 0 deletions pages/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ var VApi: VApiTy | undefined, VimiumInjector: VimiumInjectorTy | undefined | nul
}
return browser_.runtime.lastError
})
storage.get("userDefinedNewTab", (res): void => {
if (!res.userDefinedNewTab) { return }
const userContentBody = document.getElementById('vimium-user-content');
if (!userContentBody) { return }
userContentBody.insertAdjacentHTML('beforeend', res.userDefinedNewTab);
});
if (browser_.i18n.getMessage("lang1")) {
const s = browser_.i18n.getMessage("vblank")
s && (document.title = s)
Expand Down
11 changes: 11 additions & 0 deletions pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,17 @@
</a>
</div></td>
</tr>
<tr>
<td class="caption">Custom HTML/CSS for blank page</td>
<td>
<textarea id="userDefinedNewTab" class="code min-height-4" inputmode="text" data-model="Text" lang="en"
placeholder="&lt;center&gt;&lt;h2&gt;Welcome to your new page&lt;h2&gt;&lt;center&gt;"
></textarea>
</td>
<td class="help"><div class="help-inner">
If the "New tab URL" is configured on "pages/blank.html", it can be customized with static content.
</div></td>
</tr>
<tr>
<td class="caption" data-i="68">Previous patterns</td>
<td>
Expand Down
1 change: 1 addition & 0 deletions typings/vimium_c.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ declare namespace SettingsNS {
grabBackFocus: boolean;
showAdvancedCommands: boolean;
vomnibarOptions: SelectNVType<VomnibarOptionItems> & VomnibarBackendItems;
userDefinedNewTab: string;
}
interface FrontUpdateAllowedSettings {
showAdvancedCommands: 0;
Expand Down