The «open in new window» button is now optional.
This commit is contained in:
parent
3de4b36994
commit
5230aad30f
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
7
main.js
7
main.js
@ -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.',
|
||||
|
Loading…
x
Reference in New Issue
Block a user