Skip to content
Open
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
29 changes: 19 additions & 10 deletions content_scripts/vimium_frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,31 @@ const onFocus = forTrusted(function (event) {
globalThis.addEventListener("focus", onFocus, true);
globalThis.addEventListener("hashchange", checkEnabledAfterURLChange, true);

async function initializeOnDomReady() {
async function initializeOnDomReady(){
// Tell the background page we're in the domReady state.
await chrome.runtime.sendMessage({ handler: "domReady" });

await chrome.runtime.sendMessage({handler: "domReady"});
const isVimiumNewTabPage = document.location.href == Settings.vimiumNewTabPageUrl;
if (!isVimiumNewTabPage) return;

// Show the Vomnibar.
//Ensure Settings are loaded before accessing them.
await Settings.onLoaded();
if (Settings.get("openVomnibarOnNewTabPage")) {
await Utils.populateBrowserInfo();
DomUtils.injectUserCss();
Vomnibar.activate(0, {});

//On Vimium's new-tab page, optionally show the Vomnibar.
if(isVimiumNewTabPage) {
if (Settings.get("openVomnibarOnNewTabPage")){
await Utils.populateBrowserInfo();
DomUtils.injectUserCss();
Vomnibar.activate(0, {});
}
}
}

// Automatically enter link-hints mode on page load if enabled in settings.
// Just mirrors what happens when user presses "f" on page load.
if (isEnabledForUrl && Settings.get("autoActivateLinkHints") && globalThis.LinkHints){
// Pass an empty options obbject so activateMode's destructing succeeds.
globalThis.LinkHints.activateMode(1, {});
}
}
const onUnload = Utils.makeIdempotent(() => {
HintCoordinator.exit({ isSuccess: false });
handlerStack.reset();
Expand Down
1 change: 1 addition & 0 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedi
waitForEnterForFilteredHints: true,
helpDialog_showAdvancedCommands: false,
ignoreKeyboardLayout: false,
autoActivateLinkHints: false,
};

/*
Expand Down
9 changes: 9 additions & 0 deletions pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ <h2></h2>
<div class="example">
When enabled, the HUD will not be displayed in insert mode.
</div>

<h2></h2>
<label class="boolean-label">
<input name="autoActivateLinkHints" type="checkbox" />
Automatically enter link-hints mode on page load
</label>
<div class="example">
When enabled, Vimium will behave as if you pressed f after each page loads.
</div>

<h2></h2>
<label class="boolean-label">
Expand Down
1 change: 1 addition & 0 deletions pages/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Commands, KeyMappingsParser } from "../background_scripts/commands.js";
import * as userSearchEngines from "../background_scripts/user_search_engines.js";

const options = {
autoActivateLinkHints: "boolean",
filterLinkHints: "boolean",
grabBackFocus: "boolean",
hideHud: "boolean",
Expand Down