CSS: chat buttons smaller when chat is open.

This commit is contained in:
John Livingston 2021-11-18 15:35:13 +01:00
parent 9b20042aad
commit 6c19f0a609
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
2 changed files with 20 additions and 2 deletions

View File

@ -18,8 +18,8 @@
border: 1px solid black;
background-color: var(--mainBackgroundColor);
margin: 5px;
min-height: 36px;
min-width: 36px;
height: 36px;
width: 36px;
padding: 2px;
}
@ -33,6 +33,17 @@
width: 100%;
}
.peertube-plugin-livechat-buttons-open .peertube-plugin-livechat-button {
margin: 1px;
height: 18px;
width: 18px;
padding: 1px;
}
.peertube-plugin-livechat-buttons-open .peertube-plugin-livechat-button-icon {
background-size: 16px 16px;
}
[peertube-plugin-livechat-state="initializing"] {
display: none;
}

View File

@ -232,6 +232,13 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
let savedMyPluginFlexGrow: string | undefined
function hackStyles (on: boolean): void {
try {
document.querySelectorAll('.peertube-plugin-livechat-buttons').forEach(buttons => {
if (on) {
buttons.classList.add('peertube-plugin-livechat-buttons-open')
} else {
buttons.classList.remove('peertube-plugin-livechat-buttons-open')
}
})
const myPluginPlaceholder: HTMLElement | null = document.querySelector('my-plugin-placeholder')
if (on) {
// Saving current style attributes and maximazing space for the chat