muzuiget / dualsub-support

Dualsub - Dual Subtitles for YouTube
https://www.dualsub.xyz/
281 stars 24 forks source link

請問如何用js腳本更改字幕大小? #472

Closed champsing closed 1 year ago

champsing commented 1 year ago

因為DualSub的樣式被刪除了,因此我嘗試研究Wildmonkey來執行js腳本來更改字幕大小的<style>

我先用Microsoft Edge DevTool定位到了DualSub控制字幕大小的<style> image

然後因為本人完全是程式小白,所以稍微自己亂Google了一下怎麼更改<style>,大部分教我使用document.querySelectorAll()來獲取文件當中全部的某個elements

因此我稍微修改了一下Wildmonkey給的預設程式碼:

var node = document.querySelectorAll('head > style');
if (node[3] == '<style>.dualsub-theme-1 .dialogue {font-size: 110%;} </style>')
{
    node.textContent = '.dualsub-theme-1 .dialogue {font-size: 150%;}';
}

可是重整之後依然沒有更動,因此來此請教開發者要如何解決呢?

DualSub真的幫助到我很多,尤其是Netflix把字幕改的跟螞蟻一樣小之後,是DualSub讓我可以用大字體追劇,十分感謝開發者願意造福大眾!

muzuiget commented 1 year ago

不要 JavaScript,纯 CSS 就行了,这样设置:

Screenshot_20221208_071523

.dualsub-renderer {
    font-size: 48px;
}

入门文档可以看 MDN 的教程,看这一篇就够了。

muzuiget commented 1 year ago

调整字体颜色:

Screenshot_20221208_072911

.dualsub-renderer .dialogue {
    color: #ffa500;
}

#ffa500 是颜色号,格式可以看 MDN 的 color 文档。

champsing commented 1 year ago

真是太謝謝了,原來不用這麼麻煩 那現在就等您把DualSub修好了

On Thu, Dec 8, 2022 at 7:32 AM muzuiget @.***> wrote:

调整字体颜色:

[image: Screenshot_20221208_072911] https://user-images.githubusercontent.com/330812/206319537-f60e9759-c1ce-401b-9e1e-84a3813495b0.png

.dualsub-renderer .dialogue {

color: #ffa500;

}

ffa500 是颜色号,格式可以看 MDN 的 color

https://developer.mozilla.org/en-US/docs/Web/CSS/color 文档。

— Reply to this email directly, view it on GitHub https://github.com/muzuiget/dualsub-support/issues/472#issuecomment-1341743359, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVCKSE6P4FWWIDSFLQZCOZLWMEM7BANCNFSM6AAAAAASXNIDWE . You are receiving this because you authored the thread.Message ID: @.***>

LiN-Taiwan commented 1 year ago

不要 JavaScript,纯 CSS 就行了,这样设置:

Screenshot_20221208_071523

.dualsub-renderer {
    font-size: 48px;
}

入门文档可以看 MDN 的教程,看这一篇就够了。

請問要如何到這個截圖頁面?dualsub中沒有看到用戶腳本 我想把中英字幕放大

champsing commented 1 year ago

請問要如何到這個截圖頁面?dualsub中沒有看到用戶腳本 我想把中英字幕放大

這個是開發者的另外一個瀏覽器擴充套件叫Wildmonkey,可以在商店下載到,欲知詳情可以去看 #469 或是到樣式標籤頁 有連結

LiN-Taiwan @.***>於 2022年12月8日 週四,下午1:18寫道:

不要 JavaScript,纯 CSS 就行了,这样设置:

[image: Screenshot_20221208_071523] https://user-images.githubusercontent.com/330812/206317687-48c5ea4d-1797-411d-a1e3-9d272d31bd9f.png

.dualsub-renderer {

font-size: 48px;

}

入门文档可以看 MDN 的教程,看这一篇 https://developer.mozilla.org/zh-CN/docs/Learn/CSS/First_steps/What_is_CSS 就够了。

請問要如何到這個截圖頁面?dualsub中沒有看到用戶腳本 我想把中英字幕放大

— Reply to this email directly, view it on GitHub https://github.com/muzuiget/dualsub-support/issues/472#issuecomment-1342059370, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVCKSE6LHSX4NHV6X2KLYMLWMFVTVANCNFSM6AAAAAASXNIDWE . You are receiving this because you authored the thread.Message ID: @.***>

LiN-Taiwan commented 1 year ago

請問要如何到這個截圖頁面?dualsub中沒有看到用戶腳本 我想把中英字幕放大 這個是開發者的另外一個瀏覽器擴充套件叫Wildmonkey,可以在商店下載到,欲知詳情可以去看 #469 或是到樣式標籤頁 有連結 LiN-Taiwan @.>於 2022年12月8日 週四,下午1:18寫道: 不要 JavaScript,纯 CSS 就行了,这样设置: [image: Screenshot_20221208_071523] https://user-images.githubusercontent.com/330812/206317687-48c5ea4d-1797-411d-a1e3-9d272d31bd9f.png .dualsub-renderer { font-size: 48px; } 入门文档可以看 MDN 的教程,看这一篇 https://developer.mozilla.org/zh-CN/docs/Learn/CSS/First_steps/What_is_CSS 就够了。 請問要如何到這個截圖頁面?dualsub中沒有看到用戶腳本 我想把中英字幕放大 — Reply to this email directly, view it on GitHub <#472 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVCKSE6LHSX4NHV6X2KLYMLWMFVTVANCNFSM6AAAAAASXNIDWE . You are receiving this because you authored the thread.Message ID: @.>

真的太謝謝你了🙇‍♀️ 我第一次在github留言 裝了Wildmonkey馬上就成功了 超酷的🤩 我有另外一個問題 我想拿來學英文 所以都開中英雙字幕 但是我希望英文字幕比較大 中文字幕比較小 請問這樣應該怎麼做呢? 擷取

muzuiget commented 1 year ago

现在第三列那个“主题样式”的“第一/二字幕”不是可以调整字体大小吗?

LiN-Taiwan commented 1 year ago

现在第三列那个“主题样式”的“第一/二字幕”不是可以调整字体大小吗?

請問是說DualSub還是Wildmonkey呢?我都沒有看到耶

muzuiget commented 1 year ago

Dualsub 的工具栏按钮弹出页面。

yc-ts commented 1 year ago

請問可以設定第一字幕和第二字幕 不同大小及顏色嗎?

yc-ts commented 1 year ago

請問可以設定第一字幕和第二字幕 不同大小及顏色嗎? 找到腳本了 .dualsub-renderer .subtitles { font-size: 42px; } .dualsub-renderer .subtitle-2 .contents { color: #ffa500; font-size: 38px; }

yc-ts commented 1 year ago

@muzuiget 請問有方法可以自動導入 Wildmonkey 自己設定好的角本嗎? 現在是每次都要自己手動點擊 Wildmonkey 的腳本

muzuiget commented 1 year ago

下面“网址”那里填了表达式就会自动执行。

Screenshot_20221210_042012

yc-ts commented 1 year ago

下面“网址”那里填了表达式就会自动执行。

Screenshot_20221210_042012

感謝解說,主要是使用在disneyplus部分,後來有發現不要使用「重新整理」功能,點擊「影片標題」返回選單頁面後,再次播放影片就有自動帶入設定樣式

Himly commented 1 year ago

下面“网址”那里填了表达式就会自动执行。

Screenshot_20221210_042012

请问这里可以添加多个网站吗?比如同时添加 netflix, youtube, Disneyplus.... 格式需要什么样的?

muzuiget commented 1 year ago

一行一个网址

https://www.youtube.com/*
https://www.netflix.com/*
https://www.disneyplus.com/*
LiN-Taiwan commented 1 year ago

Dualsub 的工具栏按钮弹出页面。 我都沒有看到耶 請問這個在哪裡呢? 擷 擷取

muzuiget commented 1 year ago

那是另一个扩展 Wildmonkey

LiN-Taiwan commented 1 year ago

*

Dualsub 的工具栏按钮弹出页面。 我都沒有看到耶 請問這個在哪裡呢? 擷 擷取

一行一个网址

https://www.youtube.com/*
https://www.netflix.com/*
https://www.disneyplus.com/*

請問加這個符號*代表什麼意思嗎?

LiN-Taiwan commented 1 year ago

那是另一个扩展 Wildmonkey

不好意思 我還是沒有看到修改兩個字幕大小的地方 擷取2

muzuiget commented 1 year ago

通配符,用来代替其它字符。

muzuiget commented 1 year ago

类似这样设置:

Screenshot_20221215_200039

.dualsub-renderer .subtitle-1 {
    font-size: 42px;
}

.dualsub-renderer .subtitle-2 {
    font-size: 32px;
}
LiN-Taiwan commented 1 year ago

通配符,用来代替其它字符。

原來如此 謝謝🤓

LiN-Taiwan commented 1 year ago

类似这样设置:

Screenshot_20221215_200039

.dualsub-renderer .subtitle-1 {
    font-size: 42px;
}

.dualsub-renderer .subtitle-2 {
    font-size: 32px;
}

我成功了 感謝細心教導🙏🤩 擷取3

LiN-Taiwan commented 1 year ago

类似这样设置:

Screenshot_20221215_200039

.dualsub-renderer .subtitle-1 {
    font-size: 42px;
}

.dualsub-renderer .subtitle-2 {
    font-size: 32px;
}

您好,我又有其他疑問了。有一些英文字幕在netflix中是大寫的英文,請問要怎麼修改成小寫的英文的,如果句首能自動大寫就更好了。 image

muzuiget commented 1 year ago

追加一下 CSS:

.dualsub-renderer .subtitle-2 {
    text-transform: lowercase;
}

.dualsub-renderer .subtitle-2 .token:first-child .content:first-child .text::first-letter {
    text-transform: uppercase;
}
LiN-Taiwan commented 1 year ago

追加一下 CSS:

.dualsub-renderer .subtitle-2 {
    text-transform: lowercase;
}

.dualsub-renderer .subtitle-2 .token:first-child .content:first-child .text::first-letter {
    text-transform: uppercase;
}

謝謝🤓