From d4a7619f9c51db56016ab710ee007239d1733fc7 Mon Sep 17 00:00:00 2001 From: toofar Date: Sun, 20 Aug 2023 10:42:43 +1200 Subject: userscripts: run view_in_mpv jseval in main world 1. run jseval in main world: the script adds an element that calls the `restore_video` function. This was failing with a "not found" message on webengine, presumably because the dom click handler runs in the main world and the function was over in the jseval world. The the script predates webengine which is the backend that implements the worlds. 2. remove a console log message, seems to be just noise and easy enough to add back later 3. remove href attribute of the restore video link: this seemed to be causing the `restore_video` method to be called twice. The second time with `this` as the global Window object, which was causing an error because that has a null `parentNode` attribute. 4. added the `cursor: pointer` style that was needed since the element didn't have an href anymore 5. change the mpv flags `--terminal` -> `--quiet`. This means we get error messages (eg from yt-dlp) in error logs and in the `:process` page now. It can get a bit spammy though if you are running from a terminal. I'm getting a log of keepalive warning and error logs from ffmpeg. On the other hand it's really annoying to see a "process failed, see :process for details" and having no error messages in there. Fixes: #7838 --- doc/changelog.asciidoc | 10 ++++++++++ misc/userscripts/view_in_mpv | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index f1bd96f81..12416bcc2 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -15,6 +15,16 @@ breaking changes (such as renamed commands) can happen in minor releases. // `Fixed` for any bug fixes. // `Security` to invite users to upgrade in case of vulnerabilities. +[[v3.0.1]] +v3.0.1 (unreleased) +------------------- + +Fixed +~~~~~ + +- The "restore video" functionality of the `view_in_mpv` script works again on + webengine. + [[v3.0.0]] v3.0.0 (2023-08-18) ------------------- diff --git a/misc/userscripts/view_in_mpv b/misc/userscripts/view_in_mpv index 472920433..4f371c6b5 100755 --- a/misc/userscripts/view_in_mpv +++ b/misc/userscripts/view_in_mpv @@ -49,7 +49,7 @@ msg() { MPV_COMMAND=${MPV_COMMAND:-mpv} # Warning: spaces in single flags are not supported -MPV_FLAGS=${MPV_FLAGS:- --force-window --no-terminal --keep-open=yes --ytdl} +MPV_FLAGS=${MPV_FLAGS:- --force-window --quiet --keep-open=yes --ytdl} IFS=" " read -r -a video_command <<< "$MPV_COMMAND $MPV_FLAGS" js() { @@ -94,9 +94,9 @@ cat <click here.

"; @@ -119,7 +119,6 @@ cat <> "$QUTE_FIFO" +echo "jseval -q -w main $(printjs)" >> "$QUTE_FIFO" msg info "Opening $QUTE_URL with mpv" "${video_command[@]}" "$@" "$QUTE_URL" -- cgit v1.2.3-54-g00ecf