Skip to content

Instantly share code, notes, and snippets.

@defaultcf
Last active April 10, 2021 12:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defaultcf/800b95c7bdd031d18246ebc92ace0521 to your computer and use it in GitHub Desktop.
Save defaultcf/800b95c7bdd031d18246ebc92ace0521 to your computer and use it in GitHub Desktop.
YouTube Sticky LiveChat
// ==UserScript==
// @name YouTube Sticky Live Chat
// @name:ja YouTube Sticky Live Chat
// @namespace https://i544c.github.io
// @version 0.4.1
// @description Pin the latest message written by live owner or moderator to the top
// @description:ja 生放送主とモデレータの最新のコメントを上に固定するユーザスクリプト
// @author i544c
// @match https://www.youtube.com/live_chat*
// @match https://www.youtube.com/live_chat_replay*
// @grant none
// @license MIT
// ==/UserScript==
(() => {
const style = document.createElement('style');
style.textContent = `
yt-live-chat-app {
/* Global variables */
--ysl-line-length: 3;
--ysl-message-height: calc(1em * var(--ysl-line-length) + 4px);
}
#item-offset {
overflow: visible !important;
}
#items {
transform: none !important;
}
yt-live-chat-text-message-renderer[author-type="owner"],
yt-live-chat-text-message-renderer[author-type="moderator"] {
background: var(--yt-live-chat-message-highlight-background-color);
position: sticky;
top: -1px;
z-index: 1;
height: var(--ysl-message-height);
min-height: var(--ysl-message-height);
}
yt-live-chat-text-message-renderer[author-type="owner"]:hover,
yt-live-chat-text-message-renderer[author-type="moderator"]:hover {
height: 100% !important;
}
yt-live-chat-text-message-renderer[author-type="owner"] #content,
yt-live-chat-text-message-renderer[author-type="moderator"] #content {
align-self: normal;
/* String truncate */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: var(--ysl-line-length);
overflow: hidden;
}
yt-live-chat-text-message-renderer[author-type="owner"] #content:hover,
yt-live-chat-text-message-renderer[author-type="moderator"] #content:hover {
-webkit-box-orient: inline-axis;
}
`;
document.body.appendChild(style);
})();
@defaultcf
Copy link
Author

defaultcf commented May 4, 2020

生放送主とモデレータのコメントを上に固定するユーザスクリプト。こんな感じで動くよ。
sticky_livechat

@defaultcf
Copy link
Author

https://greasyfork.org/ja/scripts/402617-youtube-sticky-live-chat
↑ ここからインストールしてね

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment