mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
Merge branch 'urlspecific_noiframe'
This commit is contained in:
commit
27e8ca3701
4 changed files with 59 additions and 39 deletions
|
@ -2,10 +2,10 @@
|
|||
|
||||
If changing one of these settings fixes your bug, please visit the corresponding Github issue and let us know you encountered the bug.
|
||||
|
||||
* `:set noiframeon $URL_OF_THE_WEBSITE` and then reload the page. This disables the Tridactyl commandline on a specific url. [CREATE CORRESPONDING ISSUE]
|
||||
* `:set allowautofocus true` and then reload the page. This allows website to use the javascript `focus()` function. [#550](https://github.com/cmcaine/tridactyl/issues/550)
|
||||
* `:set modeindicator false` and then reload the page. This disables the mode indicator. [#821](https://github.com/cmcaine/tridactyl/issues/821)
|
||||
* `:get csp`. If the value returned is "untouched", try `:set csp clobber`. If the value is "clobber", try `:set csp untouched`. In both cases, please reload the page. This disables (or prevents disabling) some security settings of the page. [#109](https://github.com/cmcaine/tridactyl/issues/109)
|
||||
- `:seturl $URL_OF_THE_WEBSITE noiframe true` and then reload the page. This disables the Tridactyl commandline on a specific url. [CREATE CORRESPONDING ISSUE]
|
||||
- `:set allowautofocus true` and then reload the page. This allows website to use the javascript `focus()` function. [#550](https://github.com/cmcaine/tridactyl/issues/550)
|
||||
- `:set modeindicator false` and then reload the page. This disables the mode indicator. [#821](https://github.com/cmcaine/tridactyl/issues/821)
|
||||
- `:get csp`. If the value returned is "untouched", try `:set csp clobber`. If the value is "clobber", try `:set csp untouched`. In both cases, please reload the page. This disables (or prevents disabling) some security settings of the page. [#109](https://github.com/cmcaine/tridactyl/issues/109)
|
||||
|
||||
# Native Editor/Messenger issues
|
||||
|
||||
|
@ -19,14 +19,14 @@ If you're on Unix, running `printf '%c\0\0\0{"cmd": "run", "command": "echo $PAT
|
|||
|
||||
Tridactyl can selectively display logs for certain components. These components are the following:
|
||||
|
||||
* messaging
|
||||
* cmdline
|
||||
* controller
|
||||
* containers
|
||||
* hinting
|
||||
* state
|
||||
* styling
|
||||
* excmds
|
||||
- messaging
|
||||
- cmdline
|
||||
- controller
|
||||
- containers
|
||||
- hinting
|
||||
- state
|
||||
- styling
|
||||
- excmds
|
||||
|
||||
In order to activate logging for a component, you can use the following command: `:set logging.$COMPONENT DEBUG`. Then, to get the logs, click the hamburger menu in the top right of Firefox, click "Web Developer", then click "Browser Console". Open the menu again and click "Web Console" in the same place.
|
||||
|
||||
|
|
|
@ -20,31 +20,25 @@ const cmdline_logger = new Logger("cmdline")
|
|||
let cmdline_iframe: HTMLIFrameElement = undefined
|
||||
let enabled = false
|
||||
|
||||
/** Initialise the cmdline_iframe element unless the window location is included in a value of config/noiframeon */
|
||||
/** Initialise the cmdline_iframe element unless the window location is included in a value of config/noiframe */
|
||||
async function init() {
|
||||
let noiframeon = await config.getAsync("noiframeon")
|
||||
enabled =
|
||||
noiframeon.length == 0 ||
|
||||
noiframeon.find(url => window.location.href.includes(url)) === undefined
|
||||
if (enabled && cmdline_iframe === undefined) {
|
||||
try {
|
||||
cmdline_iframe = window.document.createElementNS(
|
||||
"http://www.w3.org/1999/xhtml",
|
||||
"iframe",
|
||||
) as HTMLIFrameElement
|
||||
cmdline_iframe.className = "cleanslate"
|
||||
cmdline_iframe.setAttribute(
|
||||
"src",
|
||||
browser.extension.getURL("static/commandline.html"),
|
||||
)
|
||||
cmdline_iframe.setAttribute("id", "cmdline_iframe")
|
||||
hide()
|
||||
document.documentElement.appendChild(cmdline_iframe)
|
||||
// first theming of page root
|
||||
await theme(window.document.querySelector(":root"))
|
||||
} catch (e) {
|
||||
logger.error("Couldn't initialise cmdline_iframe!", e)
|
||||
}
|
||||
let noiframe = await config.getAsync("noiframe")
|
||||
if (noiframe == "false" && !enabled && cmdline_iframe === undefined) {
|
||||
cmdline_iframe = window.document.createElementNS(
|
||||
"http://www.w3.org/1999/xhtml",
|
||||
"iframe",
|
||||
) as HTMLIFrameElement
|
||||
cmdline_iframe.className = "cleanslate"
|
||||
cmdline_iframe.setAttribute(
|
||||
"src",
|
||||
browser.extension.getURL("static/commandline.html"),
|
||||
)
|
||||
cmdline_iframe.setAttribute("id", "cmdline_iframe")
|
||||
hide()
|
||||
document.documentElement.appendChild(cmdline_iframe)
|
||||
enabled = true
|
||||
// first theming of page root
|
||||
await theme(window.document.querySelector(":root"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +48,15 @@ try {
|
|||
init()
|
||||
} catch (e) {
|
||||
// Surrender event loop with setTimeout() to page JS in case it's still doing stuff.
|
||||
document.addEventListener("DOMContentLoaded", () => setTimeout(init, 0))
|
||||
document.addEventListener("DOMContentLoaded", () =>
|
||||
setTimeout(() => {
|
||||
try {
|
||||
init()
|
||||
} catch (e) {
|
||||
logger.error("Couldn't initialise cmdline_iframe!", e)
|
||||
}
|
||||
}, 0),
|
||||
)
|
||||
}
|
||||
|
||||
export function show() {
|
||||
|
|
|
@ -2898,6 +2898,18 @@ export function set(key: string, ...values: string[]) {
|
|||
return
|
||||
}
|
||||
|
||||
if (key == "noiframeon") {
|
||||
let noiframes = config.get("noiframeon")
|
||||
// unset previous settings
|
||||
if (noiframes)
|
||||
noiframes.forEach(url => seturl(url, "noiframe", "false"))
|
||||
// store new settings
|
||||
values.forEach(url => seturl(url, "noiframe", "true"))
|
||||
// save as deprecated setting for compatibility
|
||||
config.set("noiframeon", values)
|
||||
throw "Warning: `noiframeon $url1 $url2` has been deprecated in favor of `:seturl $url1 noiframe true`. The right seturl calls have been made for you but from now on please use `:seturl`."
|
||||
}
|
||||
|
||||
config.set(...validateSetArgs(key, values))
|
||||
}
|
||||
|
||||
|
|
|
@ -649,9 +649,9 @@ class default_config {
|
|||
}
|
||||
|
||||
/**
|
||||
* Pages on which the command line should not be inserted. Set these values with `:set noiframeon ["url1", "url2"]`.
|
||||
* Disables the commandline iframe. Dangerous setting, use [[seturl]] to set it. If you ever set this setting to "true" globally and then want to set it to false again, you can do this by opening Tridactyl's preferences page from about:addons.
|
||||
*/
|
||||
noiframeon: string[] = []
|
||||
noiframe: "true" | "false" = "false"
|
||||
|
||||
/**
|
||||
* Insert / input mode edit-in-$EDITOR command to run
|
||||
|
@ -1055,6 +1055,12 @@ export async function update() {
|
|||
].forEach(setting => updateAll([setting], parseInt))
|
||||
set("configversion", "1.4")
|
||||
},
|
||||
"1.4": () => {
|
||||
(getDeepProperty(USERCONFIG, ["noiframeon"]) || []).forEach(site => {
|
||||
setURL(site, "noiframe", "true")
|
||||
})
|
||||
set("configversion", "1.5")
|
||||
}
|
||||
}
|
||||
if (!get("configversion")) set("configversion", "0.0")
|
||||
const updatetest = v => {
|
||||
|
|
Loading…
Add table
Reference in a new issue