// ==UserScript== // @require http://code.jquery.com/jquery-3.4.1.min.js // @name Youtube 字幕翻譯重疊修復(半自動) 、 字幕字形改微軟正黑體 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @grant GM_addStyle // @include http*://*.youtube.com/* // @include http*://youtube.com/* // @include http*://*.youtu.be/* // @include http*://youtu.be/* // @downloadURL none // ==/UserScript== GM_addStyle ( ` .ytp-caption-segment{ font-family: "Microsoft JhengHei","Monotype Corsiva", "URW Chancery L", "Apple Chancery", "Dancing Script", cursive !important; font-weight: bold !important; -webkit-text-stroke: 1.5px black !important; } ` ); var $ = window.jQuery; 'use strict'; $(document).ready(function(){ var $button = $(''); $button.appendTo($(".ytp-right-controls")); var interval var fixpress =false; $(".ytp-subtitlesFix-button" ).click( function( event ) { fixpress = !fixpress; if (fixpress){ $(this).attr("aria-pressed","true"); console.log('asdasdas'); interval = setInterval(CCFixs, 10); }else{ clearInterval(interval); $(this).attr("aria-pressed","false"); } }); }); function CCFixs(){ var temp1 = ["",""]; $(".caption-window").each(function(index, element) { temp1[index] = $(this).attr('id').replace("caption-window-_",""); }) if (parseInt(temp1[0]) > parseInt(temp1[1])){ $("#caption-window-_" + temp1[1]).remove(); }else if(parseInt(temp1[0]) < parseInt(temp1[1])){ $("#caption-window-_" + temp1[0]).remove(); } } function CCFix(){ if ($(".html5-video-player").getElementsByClassName("caption-window ytp-caption-window-bottom").length == 2){ $(".html5-video-player").getElementsByClassName("caption-window ytp-caption-window-bottom")[0].remove(); } }