Greasy Fork is available in English.
try to take over the world!
当前为
// ==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();
}
}