YT chat版面調整

修改YouTube聊天室延伸;字體大小;留言縮緊排版,分類明顯化

目前為 2024-01-12 提交的版本,檢視 最新版本

/* ==UserStyle==
@name           YT chat版面調整
@version        1.6
@namespace      1
@license        MIT
@description    修改YouTube聊天室延伸;字體大小;留言縮緊排版,分類明顯化
@author         Leadra
@preprocessor   stylus

@var number     chat_top                            "訊息置頂透明度"                          [0.8, 0, 1, 0.1]
@var range      font_shadow                           "文字陰影"                                   [1.5, 0, 5, 0.5, "px"]
@var checkbox      hide_reaction                 "YT提醒+貼圖註解+愛心隱藏"                         1
@var checkbox   name_pr                                 "name分行"                                                 0
@var checkbox   name_pr2                                 "name靠右"                                                 1
@var checkbox      hide_user_name             "name+徽章隱藏"                                   0
@var checkbox      hide_pic                             "大頭貼隱藏"                                   0
@var checkbox   message_lines                  "會員訊息右側綠線條"                    1
@var checkbox   superchat_size                             "SC框放大透明"                                      1
@var checkbox   hide_sc_head                            "SC倒數計時調整"                          1
@var checkbox   alternate_background                "alternate交叉背景色"                          1
@var color      manager_background               "板手+版主強調背景色"                            rgba(7, 5, 255, .3)
@var checkbox   chat_scroll                      "chat卷軸隱藏"                          1
@var checkbox   input_down                            "input打字區縮緊固定"                          1
@var range      text_pr                                  "聊天行距"                           [0, -6, 10, 1, "px"]
@var range      message_fontsize                   "聊天字體size"                           [18, 14, 20, 1, "px"]
@var range      name_size                           "name字體size"                           [14, 0, 20, 1, "px"]
@var range      profile_picturesize                "大頭貼Size"                  [26, 0, 48, 2, "px"]
@var range      badge_size                          "會員徽章Size"                            [14, 8, 32, 2, "px"]
@var range      emoji_size                          "Emoji Size"                            [24, 0, 32, 2, "px"]
@var range      timestamp_fontsize                 "時間軸Size"                   [14, 14, 20, 1, "px"]

==/UserStyle== */
//部分功能https://userstyles.world/style/2625/kaiteki-youtube-chat

@-moz-document url-prefix("https://www.youtube.com/live_chat") {
/* alternate交叉背景色 */
    if alternate_background {
        yt-live-chat-text-message-renderer:nth-child(even) {
            background-color: rgba(100, 100, 100, .3);        /* var(--yt-spec-general-background-c); */
    }}
/* 板手+版主強調背景色 */
    yt-live-chat-text-message-renderer[author-type="moderator"] {
            padding: 2px 12px;
            background: manager_background;
            & > #content > span#message {
                color: #fff;
            }
        }
yt-live-chat-text-message-renderer[author-type="owner"] {
                        background-color: rgba(239, 239, 0, .3);
                    }
        /* 版主聊天置頂復原樣式_上部固定をすると見た目が変わるため、各種スタイルを打ち消す必要がある*/
        //#contents > yt-live-chat-text-message-renderer[author-type="moderator"]  {            background-color: #d40213 !important;}/* message lines會員訊息右側線條 */
    if message_lines {
        yt-live-chat-text-message-renderer {
            
/*會員訊息右側綠線條*/           
//border-left: left-message-line solid;
            border-right: 2px solid; /* right-message-line solid*/
            border-color: rgba(255,255,255,0)//default-line-color;
        }
       /* yt-live-chat-text-message-renderer[is-deleted] {border-color: #ff0000 //deleted-message-color;}*/
        yt-live-chat-text-message-renderer[author-type="member"] {
            border-color: var(--yt-live-chat-sponsor-color);
        }
        yt-live-chat-text-message-renderer[author-type="moderator"] {
            border-color: var(--yt-live-chat-moderator-color);
        }
        yt-live-chat-text-message-renderer[author-type="owner"] {
            border-color: var(--yt-live-chat-author-chip-owner-background-color);     /* var(--yt-spec-general-background-c); */
        }
    }
    /* 大頭貼profile picture */
    //#avatar.yt-live-chat-message-input-renderer,
    //#avatar.yt-live-chat-message-input-renderer > img,
    #author-photo.yt-live-chat-text-message-renderer,
    #author-photo.yt-live-chat-text-message-renderer > img {
        width: profile_picturesize;
        height: profile_picturesize;
        margin: 0px;
        /*強制顯示大頭貼
    if profile_picturesize >= 0{display: unset!important;}*/
/*隱藏大頭貼*/
    if hide_pic {display: none!important;}
    }
/* emoji */
    #input.yt-live-chat-text-input-field-renderer img.yt-live-chat-text-input-field-renderer,
    #message.yt-live-chat-text-message-renderer .emoji.yt-live-chat-text-message-renderer {
        margin: 0px 0px 0x 0px ;
        padding: 0px 0px 0x 0px ;
        width: emoji_size;
        height: emoji_size;
        line-height: emoji_size;
        align-self: center;//垂直對齊:中間
        align-items: center;
        vertical-align: middle;
    }
/* badge會員徽章 */
    img.yt-live-chat-author-badge-renderer, yt-icon.yt-live-chat-author-badge-renderer {
        width: badge_size;
        height: badge_size;
        margin: 0px -0px 0px -0px ;
    }
/* header聊天室頂部欄位 
    yt-live-chat-header-renderer {padding: 0px;}*/
/*superchat*/
       yt-live-chat-paid-message-renderer #message.yt-live-chat-paid-message-renderer {
    padding: 0px;
    margin: -0px -0px -0px -0px ;
    font-size: message_fontsize;
    line-height: message_fontsize+1px;
    letter-spacing:0.5px;/*字元間距*/
    }
/*放大透明化_SC+會員每月留言+贈送會員外框+SC貼圖*/
if superchat_size{
yt-live-chat-paid-message-renderer,yt-live-chat-membership-item-renderer{
    margin: 0px -0px -0px -0px ;
    padding: 2px 5px;
    opacity:0.8;
    line-height:1em;
            & > #card {
                position: relative;//相對位置
                //align-items: center;//置中背景不填滿
    /*SC+每月上部*/
    & > #header {padding: 0px;
    //position: static;//hover顯示//background-color: transparent;
    /*SC大頭貼圖片高度*///& > yt-img-shadow,& > yt-img-shadow img{height: 40px;width: 40px;}
                                                                }
    /*SC+每月下部*/
    & > #content {padding: 3px 5px;    font-size: message-font-size;}
                                }
   }
   /*贈送會員外框*/
#header.ytd-sponsorships-live-chat-header-renderer{
min-height:10px;
    opacity:0.7;
    position: relative;//相對層級
    z-index:100;
    & > yt-img-shadow,& > yt-img-shadow img{height: 50px;width: 50px; position: absolute;z-index:-100;right:0px;}
    }
//大頭貼.ytd-sponsorships-live-chat-header-renderer{margin: -3px 0px -3px 0px ;& > yt-img-shadow,& > yt-img-shadow img{height: profile_picturesize;width: profile_picturesize;}}
//yt-live-chat-paid-sticker-renderer:not([dashboard-money-feed])
/*SC貼圖(大頭貼)*/
 yt-live-chat-paid-sticker-renderer {opacity:0.8;margin: 0px -0px -0px -0px;
    & > #card{
        yt-img-shadow , yt-img-shadow img{max-height: 50px;max-width: 50px;}
                        }
                                                                        }
}

/* message +聊天行距*/
    //yt-live-chat-text-input-field-renderer , #content.yt-live-chat-text-message-renderer {}
yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer 
#message.yt-live-chat-text-message-renderer {
    padding: 0px 0px 0px 0px!important;
    margin: text_pr 0px text_pr 0px!important ;
    font-size: message_fontsize;
    line-height: message_fontsize;
    align-items: center;//大頭貼垂直置中
    vertical-align: middle;//文字垂直置中
    //letter-spacing:0.5px;//字元間距
    //align-self: center;//垂直對齊:中間
    //text-align:justify;//左右對齊
    
/*陰影+模糊_右上-左上-左下-右下+短模糊*4*/
if font_shadow >= 0.5 {
    text-shadow: 1px -1px font_shadow #06f, -1px  -1px  #06f, -1px  1px font_shadow #06f, 1px 1px font_shadow #06f,
 0 0 1px #036, 0 0 1px #036, 0 0 1px #036, 0 0 1px #036;}//font-weight:bold;
}
/*聊天行距old
yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer .yt-live-chat-text-message-renderer{
        margin-top:0;//!important
        margin-bottom: text_pr  ;
}*/
/*  name字體*/
    yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer yt-live-chat-author-chip.yt-live-chat-text-message-renderer {
       // align-items: center;
    display: inline-flex;
    flex-direction: row;
    margin: 0px 0px 0px 0px!important;
    padding: 0px 0px 0px 0px;
    letter-spacing: 0px;//間距
    text-shadow:  -0.5px  0.5px #000;
    font-size: name_size;
    line-height: name_size;
    vertical-align: center;//垂直對齊:中間
    --yt-live-chat-sponsor-color: #71ff8c;//會員名稱顏色
    --yt-live-chat-secondary-text-color: #ddd; //一般名稱顏色
    }
/* timestamp */
    #timestamp.yt-live-chat-text-message-renderer {
        font-size: timestamp_fontsize;
        margin-right: 5px;
        vertical-align: middle;
       letter-spacing:0px;//間距
    }
    
/*input單列開關*/
if input_down {
/*input總區塊*/
#input-panel.yt-live-chat-renderer.iron-selected {
    padding: 0px 0 0px 0px;
    margin:0px 0px -0px 0px;
    //overflow: hidden;//隱藏卷軸元素不消除佔位
    background-color:rgba(255, 53, 53, .1);
    }
/* input打字輸入區 */
    yt-live-chat-message-input-renderer {
        padding: 0px 0px 0px 0px!important;
        margin:0px 0px 0px 35px!important;
        //overflow: hidden;//隱藏卷軸元素不消除佔位
    }
/*input名字*/
//#input-container > yt-live-chat-author-chip {display: none;}

/*input貼圖按鈕+SC按鈕*/
#button.yt-live-chat-icon-toggle-button-renderer {
    margin:-0px 0px -0px -0px;
    background-color:rgba(120, 3, 23, .2);
    position: absolute;
    z-index:10;
    left:0px;
    right:0px;
    bottom:0px;
}
    //SC按鈕(YT設定打字時會隱藏)
#input-panel #picker-buttons .yt-live-chat-icon-toggle-button-renderer{
        margin:0px -0px 0px 0px;
position: relative;
    //bottom:2px;

    }
//#input.yt-live-chat-text-input-field-renderer{}
#input-container.yt-live-chat-message-input-renderer  {
    margin:0px -0px -0px 0px;
    height:36px;
}

/*input貼圖框架*/
//#buttons.yt-live-chat-message-input-renderer ,.yt-icon-container.yt-icon {margin:-35px 0px -15px 0px;}
/*input右邊圖*/
//#message-buttons.yt-live-chat-message-input-renderer { display: none; }
/*input頭像*/
#avatar.yt-live-chat-message-input-renderer {display: none;}//margin:0px 50px -0px 0px ;visibility:hidden;display:block;
//貼圖框
yt-emoji-picker-renderer.yt-live-chat-message-input-renderer {margin:-0px 0px -0px -0px;min-height:250px!important;}//display:inline-flex;
/*貼圖內框*/
#categories-wrapper.style-scope.yt-emoji-picker-renderer{ margin:0px -10px 30px -55px;::-webkit-scrollbar {display: none;}}
/*貼圖內框-文字搜尋*/
#search-panel.style-scope.yt-emoji-picker-renderer{ display:inline-flex;height:10px;margin:-0px 0px -5px -20px!important;}
                                }
/*貼圖內框-分類*/
#category-buttons.style-scope.yt-emoji-picker-renderer{margin:-20px -100px 0px 0px;}
/*貼圖內框-標題*/
#title.style-scope.yt-emoji-picker-category-renderer{margin:-10px 0px -15px 0px;opacity:0.3;background-color:rgba(216, 192, 192, .3);}
/*SC內視窗標題*/
#title.style-scope.yt-live-chat-product-picker-renderer {display: none;}
//chat卷軸隱藏
if chat_scroll {#item-scroller.yt-live-chat-item-list-renderer::-webkit-scrollbar {display: none;}}
//----------------------------------------------------------------------------------- 

//name分行-----------------------------------------------------------------------------------
if name_pr {
    yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer {
//分行聊天室格式 複數行に渡るチャットユーザー名&メッセージを真ん中に揃える、餘白を詰める
        & > #content {width: 100%;display: inline-flex;align-items: center;
            & > yt-live-chat-author-chip {
                align-items: center;
                margin: 0px -0px 0px -0px;
                position: relative;//相對層級100
                z-index:100;
                // 用戶名格式チャットユーザー名 - 幅を固定&小さくすることでメッセージを見やすくする
                & > #author-name {
                    max-width: 4em;
                    font-size: 15px;
                    max-height: 1.5em;
                    line-height: 1em;
                    word-break: break-word;//名稱破行自動斷行break-all//keep-all//word-wrap: break-all;
                    //margin: 0px 0px 0px 0px!important;
                    //align-items: baseline;//center
                    border-top: 0.1px solid;
}}}}
    /*分行的 profile picture */
    #author-photo.yt-live-chat-text-message-renderer,
    #author-photo.yt-live-chat-text-message-renderer > img {
        margin: 0px;
        opacity:0.9;
   }
    /*分行的 badge會員徽章 */
    img.yt-live-chat-author-badge-renderer, yt-icon.yt-live-chat-author-badge-renderer {
        margin: -0px -0px 0px -15px ;
        opacity:0.4;
        position: relative;//相對層級-10
        z-index:-10;
            }
    /*分行的 顯示破框name*/
             #items yt-live-chat-text-message-renderer{contain: layout style;}
}
//----------------------------------------------------------------------------------- 

/*name靠右*/
if name_pr2 {
   yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer {
        & > #content  > yt-live-chat-author-chip {
            max-width:10em;
            max-height:1em;
            line-height: 1em;
            word-break:break-all ;//名稱破行自動斷行break-all//keep-all//word-wrap: break-all;break-word;
            align-items: stretch ;
            margin: 0px -0px 0px 0px;
            padding:0;
            position: absolute;
            z-index:0;
            right:0px;//top:1em;
            bottom: 0em;
            opacity:0.8;
            }}
    /*非會員name顯示(非會員格式會跑掉)
    yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer[author-type=""] {& >#content yt-live-chat-author-chip {line-height: 1em;}}*/
    /*分行2_大頭貼靠右yt-live-chat-text-message-renderer.yt-live-chat-item-list-renderer {min-height: profile_picturesize ;
    if profile_right {yt-img-shadow  , yt-img-shadow img {min-height: profile_picturesize;min-width: profile_picturesize;position: absolute;right:0px;opacity:0.8;z-index:-100;}
& > #content  yt-live-chat-author-chip {right:profile_picturesize;}}}*/
//#author-photo.yt-live-chat-text-message-renderer, #author-photo.yt-live-chat-text-message-renderer > img { opacity:0.8;z-index:-100;}
}
//----------------------------------------------------------------------------------- 

/*訊息置頂透明度*/
yt-live-chat-banner-manager[has-active-banner]{ opacity:chat_top;
        margin: 0px 0px 0px 0px !important;
        padding: 20px 0px 0px 0px;

        text-shadow:  -0.5px  0.5px #000;
    if chat_top ==0{display:none;}
}
/* name+徽章隱藏 */
 if hide_user_name {
    yt-live-chat-text-message-renderer > #content > yt-live-chat-author-chip > #author-name {display: none !important;}
    img.yt-live-chat-author-badge-renderer, yt-icon.yt-live-chat-author-badge-renderer {display: none !important;}
}
/*YT提醒+貼圖註解+愛心動畫隱藏*/
 if hide_reaction {
        yt-live-chat-viewer-engagement-message-renderer.yt-live-chat-item-list-renderer {display: none;}//YT提醒
        #chat > #reaction-control-panel-overlay.yt-live-chat-renderer {display: none;}//愛心動畫
        #content.yt-tooltip-renderer,#Wrapper.tp-yt-iron-dropdown  ,yt-tooltip-renderer{display: none;}//YT輸入提醒框//yt-tooltip-renderer是包含所有的提醒
    /*貼圖註解隱藏_chat貼圖-SC貼圖-會員徽章-每月會員*/
    tp-yt-paper-tooltip.style-scope.yt-live-chat-text-message-renderer[role="tooltip"],
    tp-yt-paper-tooltip.style-scope.yt-live-chat-paid-message-renderer[role="tooltip"],
    tp-yt-paper-tooltip.style-scope.yt-live-chat-author-badge-renderer[role="tooltip"] ,
    tp-yt-paper-tooltip.style-scope.yt-live-chat-membership-item-renderer[role="tooltip"],
    {display: none;}
                                    }
/*SC倒數計時調整*/
if hide_sc_head {
    yt-live-chat-ticker-renderer.style-scope.yt-live-chat-renderer {max-height:0px;margin: -0px -0px -0px 0px;background:rgba(0, 0, 0, 0);opacity:0.7;}
    /*每月會員計時背景調整*/
    #content.yt-live-chat-ticker-sponsor-item-renderer{max-height:10px;margin: -0px -0px -0px 0px;}
    //#container.yt-live-chat-ticker-sponsor-item-renderer{background:rgba(15,157,88,0.5)!important;}
    #text.yt-live-chat-ticker-sponsor-item-renderer{margin: -0px -0px 0px 5px;}
    /*SC計時背景調整*/
    #content.yt-live-chat-ticker-paid-message-item-renderer{max-height:10px;margin: -0px -0px -0px 0px;}
    //#container.yt-live-chat-ticker-paid-message-item-renderer{opacity:0.7;}
    #username-text.yt-live-chat-ticker-paid-message-item-renderer{margin: -0px -0px -0px 0px;}
        //#items.yt-live-chat-ticker-renderer{max-height:10px;margin: -0px -0px -0px 0px;}
        //.run-ticker, yt-live-chat-ticker-renderer #items > * > #container.run-ticker, yt-live-chat-ticker-renderer[class] #items[class] > *[class] > #container.run-ticker[class]{}
#container.run-ticker, yt-live-chat-ticker-renderer[class] #content,#items[class] > *[class] > #container.run-ticker[class ]{max-height:10px;margin: -0px -0px -0px 0px;}
       //#content yt-live-chat-text-message-renderer.style-scope.yt-live-chat-item-list-renderer, yt-live-chat-membership-item-renderer.style-scope.yt-live-chat-item-list-renderer, yt-live-chat-paid-message-renderer.style-scope.yt-live-chat-item-list-renderer, yt-live-chat-banner-manager.style-scope.yt-live-chat-item-list-renderer{max-height:10px;margin: -0px -0px -0px 0px;}
    }
}