The «open in new window» button is now optional.

This commit is contained in:
John Livingston 2021-02-21 00:13:29 +01:00
parent 3de4b36994
commit 5230aad30f
4 changed files with 22 additions and 6 deletions

View File

@ -6,6 +6,7 @@
* Optional Builtin ConverseJS
* Option for enabling live only on local videos
* The «open in new window» button is optional
## v0.0.8

View File

@ -24,6 +24,12 @@ There are several options in the plugin settings page.
If checked, the chat will be loaded as soon as you are on the video page.
### Show the «open in new window» button
If your webchat can be opened in a full window, you can add a button to do so.
NB: The builtin ConverseJS is compatible with this feature.
### Chats are only available for local videos
Peertube is a federated service. Plugins are only available on the server you are browsing.

View File

@ -76,7 +76,7 @@ function register ({ registerHook, peertubeHelpers }) {
buttons.prepend(button)
}
function displayChatButtons (peertubeHelpers, uuid) {
function displayChatButtons (peertubeHelpers, uuid, showOpenBlank) {
logger.log('Adding buttons in the DOM...')
const p = new Promise((resolve, reject) => {
Promise.all([
@ -93,10 +93,12 @@ function register ({ registerHook, peertubeHelpers }) {
if (!iframeUri) {
return reject(new Error('No uri, cant display the buttons.'))
}
displayButton(buttons, 'openblank', labelOpenBlank, () => {
closeChat()
window.open(iframeUri)
})
if (showOpenBlank) {
displayButton(buttons, 'openblank', labelOpenBlank, () => {
closeChat()
window.open(iframeUri)
})
}
displayButton(buttons, 'open', labelOpen, () => openChat())
displayButton(buttons, 'close', labelClose, () => closeChat())
@ -212,7 +214,7 @@ function register ({ registerHook, peertubeHelpers }) {
return
}
displayChatButtons(peertubeHelpers, uuid).then(() => {
displayChatButtons(peertubeHelpers, uuid, !!settings['chat-open-blank']).then(() => {
if (settings['chat-auto-display']) {
openChat()
} else {

View File

@ -19,6 +19,13 @@ async function register ({
default: false,
private: false
})
registerSetting({
name: 'chat-open-blank',
label: 'Show the «open in new window» button',
private: false,
type: 'input-checkbox',
default: false
})
registerSetting({
name: 'chat-only-locals',
label: 'Chats are only available for local videos.',