From 56148209c7db7e07cdc382e1867c923051e5e928 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Aug 2022 15:28:00 +0200 Subject: [PATCH] Update hello world --- .../client/video-watch-client-plugin.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/peertube-plugin-hello-world/client/video-watch-client-plugin.js b/peertube-plugin-hello-world/client/video-watch-client-plugin.js index 1786a3e..3257faa 100644 --- a/peertube-plugin-hello-world/client/video-watch-client-plugin.js +++ b/peertube-plugin-hello-world/client/video-watch-client-plugin.js @@ -91,6 +91,45 @@ function register ({ registerHook, peertubeHelpers }) { }) } + // --------------------------------------------------------------------------- + // Share modal + // --------------------------------------------------------------------------- + + for (const hook of [ + 'filter:share.video-embed-code.build.result', + 'filter:share.video-playlist-embed-code.build.result', + 'filter:share.video-embed-url.build.result', + 'filter:share.video-playlist-embed-url.build.result', + 'filter:share.video-url.build.result', + 'filter:share.video-playlist-url.build.result', + ]) { + registerHook({ + target: hook, + handler: (result) => { + return result + hook + } + }) + } + + registerHook({ + target: 'action:modal.share.shown', + handler: ({ video, playlist }) => { + if (video) { + const elem = document.createElement('div') + elem.innerHTML = 'video ' + video.name + document.getElementById('plugin-placeholder-share-modal-video-settings').appendChild(elem) + } + + if (playlist) { + const elem = document.createElement('div') + elem.innerHTML = 'playlist ' + playlist.displayName + document.getElementById('plugin-placeholder-share-modal-playlist-settings').appendChild(elem) + } + } + }) + + // --------------------------------------------------------------------------- + peertubeHelpers.notifier.info('you are on the watch page', 'useless', 1000) }