Forked from qwertyuiop6/TranslateToChineseOnYouTube.user.js
Created
July 11, 2019 03:50
-
-
Save returnk/6d65d389a2d8d9a7a4311ef72c88f87f to your computer and use it in GitHub Desktop.
Revisions
-
qwertyuiop6 revised this gist
Apr 19, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ // @description translate to Chinese automatically. // @author qwertyuiop6 // @match https://www.youtube.com/watch* // @require https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js // @grant none // ==/UserScript== -
qwertyuiop6 revised this gist
Nov 16, 2018 . No changes.There are no files selected for viewing
-
qwertyuiop6 revised this gist
Sep 15, 2018 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,19 +13,19 @@ 'use strict'; function translateToChinese(){ var sub = $('[role="menuitem"]:contains("字幕")'); if(!sub.length) return; sub.click(); var subc = $('[role="menuitemradio"]:contains("中文(简体)")'); if (subc.length) { subc.click(); } else { var autoTrans = $('[role="menuitemradio"]:contains("自动翻译")'); if (!autoTrans.length) return; autoTrans.click(); var autoTransC = $('[role="menuitemradio"]:contains("中文(简体)")'); if (!autoTransC.length) return; autoTransC.click(); } } -
qwertyuiop6 created this gist
Sep 15, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ // ==UserScript== // @name 自动翻译->字幕中文简体 // @namespace http://tampermonkey.net/ // @version 0.1 // @description translate to Chinese automatically. // @author qwertyuiop6 // @match https://www.youtube.com/watch* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js // @grant none // ==/UserScript== (function() { 'use strict'; function translateToChinese(){ var 字幕 = $('[role="menuitem"]:contains("字幕")'); if(!字幕.length) return; 字幕.click(); var 中文简 = $('[role="menuitemradio"]:contains("中文(简体)")'); if (中文简.length) { 中文简.click(); } else { var 自动翻译 = $('[role="menuitemradio"]:contains("自动翻译")'); if (!自动翻译.length) return; 自动翻译.click(); var 自动翻译中文 = $('[role="menuitemradio"]:contains("中文(简体)")'); if (!自动翻译中文.length) return; 自动翻译中文.click(); } } function onLoadStart(){ $('.ytp-subtitles-button[aria-pressed="false"]').click(); $('.ytp-settings-button').click(); translateToChinese(); $('.ytp-settings-button').click(); } $('video').on('loadstart', onLoadStart).trigger('loadstart'); })();