mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Add hint window/private (untested)
This commit is contained in:
parent
e43f4fae41
commit
b8e1131281
2 changed files with 45 additions and 0 deletions
|
@ -527,6 +527,44 @@ function hintPageOpenInBackground() {
|
|||
})
|
||||
}
|
||||
|
||||
// lazily copied from excmds.ts - really ought to be moved to lib/webext
|
||||
async function winopen(...args: string[]) {
|
||||
let address: string
|
||||
const createData = {}
|
||||
if (args[0] === "-private") {
|
||||
createData["incognito"] = true
|
||||
address = args.slice(1,args.length).join(' ')
|
||||
} else address = args.join(' ')
|
||||
browser.windows.create(createData)
|
||||
}
|
||||
|
||||
|
||||
function hintPageWindow() {
|
||||
hintPage(hintables(), hint=>{
|
||||
hint.target.focus()
|
||||
if (hint.target.href) {
|
||||
winopen(hint.target.href)
|
||||
} else {
|
||||
// This is to mirror vimperator behaviour.
|
||||
simulateClick(hint.target)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hintPageWindowPrivate() {
|
||||
hintPage(hintables(), hint=>{
|
||||
hint.target.focus()
|
||||
if (hint.target.href) {
|
||||
// Try to open with the webext API.
|
||||
winopen("--private",hint.target.href)
|
||||
} else {
|
||||
// Private window, so never fall back to opening in current tab
|
||||
// This is to mirror vimperator behaviour.
|
||||
// simulateClick(hint.target)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hintPageSimple(selectors=HINTTAGS_selectors) {
|
||||
hintPage(hintables(selectors), hint=>{
|
||||
simulateClick(hint.target)
|
||||
|
|
|
@ -32,6 +32,13 @@ export async function hintPageOpenInBackground() {
|
|||
return await messageActiveTab('hinting_content', 'hintPageOpenInBackground')
|
||||
}
|
||||
|
||||
export async function hintPageWindow() {
|
||||
return await messageActiveTab('hinting_content', 'hintPageWindow')
|
||||
}
|
||||
|
||||
export async function hintPageWindowPrivate() {
|
||||
return await messageActiveTab('hinting_content', 'hintPageWindowPrivate')
|
||||
}
|
||||
export async function hintImage(inBackground) {
|
||||
return await messageActiveTab('hinting_content', 'hintImage', [inBackground])
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue