mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Make commandline show only after : is pressed
I have also attempted to make the commmand line hide when it is not in focus, but had no luck.
This commit is contained in:
parent
38923d8876
commit
b7b4b940ae
3 changed files with 20 additions and 7 deletions
|
@ -10,10 +10,16 @@
|
|||
*/
|
||||
|
||||
// inject the commandline iframe into a content page
|
||||
let clFrame = window.document.createElement("iframe")
|
||||
clFrame.setAttribute("src", browser.extension.getURL("static/commandline.html"))
|
||||
clFrame.setAttribute("style", "position: fixed; top: 0; left: 0; z-index: 10000; width: 100%; height: 36px; border: 0; padding: 0; margin: 0;");
|
||||
window.document.body.appendChild(clFrame)
|
||||
export function showcommandline(){
|
||||
let clFrame = window.document.createElement("iframe")
|
||||
clFrame.setAttribute("src", browser.extension.getURL("static/commandline.html"))
|
||||
clFrame.setAttribute("style", "position: fixed; top: 0; left: 0; z-index: 10000; width: 100%; height: 36px; border: 0; padding: 0; margin: 0;");
|
||||
window.document.body.appendChild(clFrame)
|
||||
|
||||
/** Focus the commandline input */
|
||||
export let focus = ():void => clFrame.focus()
|
||||
/** Focus the commandline input: not required **/
|
||||
// let focus = ():void => clFrame.focus()
|
||||
// line below doesn't work
|
||||
clFrame.addEventListener("blur",clFrame.remove)
|
||||
// Why were we returning focus? It's a void, surely?
|
||||
// return focus
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/** Conventional definition of modulo that never gives a -ve result. */
|
||||
|
||||
Number.prototype.mod = function (n: number): number {
|
||||
return Math.abs(this % n)
|
||||
}
|
||||
|
@ -89,6 +90,12 @@ export async function reload(n = 1, hard = false){
|
|||
)
|
||||
}
|
||||
|
||||
// Commandline function
|
||||
|
||||
export function showcommandline(){
|
||||
messageActiveTab("showcommandline")
|
||||
}
|
||||
|
||||
// TODO: address should default to some page to which we have access
|
||||
// and focus the location bar
|
||||
export async function tabopen(address?: string){
|
||||
|
|
|
@ -24,7 +24,7 @@ const commands = new Map<string, ContentCommand>([
|
|||
window.history.go(n)
|
||||
},
|
||||
function focuscmdline() {
|
||||
CommandLineContent.focus()
|
||||
CommandLineContent.showcommandline()
|
||||
}
|
||||
].map((command):any => [command.name, command]))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue