OpenSubtitles Direct Downloads

Creates direct download links for subtitles on opensubtitles.org

目前為 2015-09-03 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        OpenSubtitles Direct Downloads
// @namespace   https://github.com/Ede123/userscripts
// @version     1.0.2
// @description Creates direct download links for subtitles on opensubtitles.org
// @icon        https://raw.githubusercontent.com/Ede123/userscripts/master/icons/OpenSubtitles.png
// @author      Eduard Braun <[email protected]>
// @license     GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @include     http://www.opensubtitles.org/*
// @grant       GM_addStyle
// @run-at      document-start
// ==/UserScript==


// remove checkboxes for "OS Download Manager"
GM_addStyle('#checkbox1,#checkbox2{display:none}');

// modify button only after DOM is ready
addEventListener('DOMContentLoaded', function() {
	// check for download button on page
	var downloadButton = document.getElementById('bt-dwl') || document.getElementById('bt-dwl-bt');
	if(!downloadButton) return;

	// create direct link avoiding advert page for "Open Subtitles MKV Player"
	var location = document.location.href;
	var re = /subtitles\/(\d*)/i;
	var subtitleID = location.match(re)[1];
	downloadButton.href = "http://dl.opensubtitles.org/download/sub/" + subtitleID;
	downloadButton.removeAttribute("onclick");
	
	// remove event listeners from the download button (by cloning and replacing it)
	// to prevent any unwanted behavior
	downloadButton.parentNode.replaceChild(downloadButton.cloneNode(true), downloadButton);
}, false);