Greasy Fork

Greasy Fork is available in English.

Youtube 字幕翻譯重疊修復(半自動) 、 字幕字形改微軟正黑體

try to take over the world!

当前为 2020-02-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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/*
// ==/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 class="ytp-subtitlesFix-button ytp-button" aria-label="字幕修復" style="" aria-pressed="false" title="字幕修復"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-19"></use></svg></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();
    }
}