assAdd

给盗版vip视频解析网站加上b站bilibili的(ass格式)弹幕,腾讯视频等网站下载下来的ass文件同理也可以

目前為 2024-09-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         assAdd
// @namespace    http://tampermonkey.net/
// @version      2024-07-04
// @description  给盗版vip视频解析网站加上b站bilibili的(ass格式)弹幕,腾讯视频等网站下载下来的ass文件同理也可以
// @author       You
// @match        https://www.imandaow.com/*
// @require https://update.greasyfork.org/scripts/507156/1442599/JavascriptSubtitlesOctopus_cdnjs.js
// @require https://update.greasyfork.org/scripts/507157/1442600/subtitles-octopus.js
// @require      https://unpkg.com/sweetalert/dist/sweetalert.min.js
// @license MIT
// ==/UserScript==


function addStyle(css) {
	// 添加样式
	const style = document.createElement('style');
	style.type = 'text/css';
	style.innerHTML = css
	document.head.appendChild(style);
}

let css = `
#myTextarea {
		width: 100%;
		height: 200px; /* 可以根据需要调整 */
		border: 1px solid #ccc;
		border-radius: 5px;
		padding: 5px;
		resize: vertical; /* 允许垂直调整大小 */
		margin-bottom: 10px; /* 添加底部外边距 */
}
`;
addStyle(css)

let assContent = "";
let options_video = document.querySelector("video");

setTimeout(() => {
	if(options_video === null) return;

	// 创建textarea
	const textarea = document.createElement('textarea');
	textarea.id = 'myTextarea';
	textarea.placeholder = '粘贴进ass文件内容';
	swal("粘贴", {
			content: textarea,
			buttons: {
				confirm: {
					/*
					 * We need to initialize the value of the button to
					 * an empty string instead of "true":
					 */
					value: "",
				},
			},
			closeOnClickOutside: false,
		})
		.then((value) => {
			debugger
			assContent = document.querySelector('#myTextarea').value;

			window.SubtitlesOctopusOnLoad = function () {
				var options = {
					video: options_video,
					subContent: assContent,
					// fonts: ['https://raw.githubusercontent.com/freemedom/ass/main/NotoSansSC-Regular.otf',"https://raw.githubusercontent.com/freemedom/ass/main/MicrosoftYaHeiUI-Bold.ttf"],
					// availableFonts: {"microsoft yahei ui": "https://raw.githubusercontent.com/freemedom/ass/main/MicrosoftYaHeiUI-Bold.ttf"}, // key需要改为小写
					//onReady: onReadyFunction,
					fallbackFont: 'https://raw.githubusercontent.com/freemedom/ass/main/NotoSansSC-Regular.otf', // 艹 ass文件里的Fontname跟这里的ttf otf文件的字体名根本不用一样,只要是个有汉字的字体就行(默认字体是不行的) 枉我调试了半天fonts和availableFonts的代码逻辑
					// fallbackFont: 'https://raw.githubusercontent.com/freemedom/ass/main/MicrosoftYaHeiUI-Bold.ttf', // 没修改之前实际是这里起作用 // 艹 搞了半天好像不是字体的问题,是ass文件里边其它地方有问题 // 艹 这ass文件下载下来Tex少了个t,坑了我一个小时
					debug: true,
					workerUrl: URL.createObjectURL(new Blob(["(" + worker_function.toString() + ")()"], {
						type: 'text/javascript'
					}))
				};
				window.octopusInstance = new SubtitlesOctopus(options); // You can experiment in console
			};

			if (SubtitlesOctopus) {
				SubtitlesOctopusOnLoad();
		}
		});
}, 5000);