MediathekViewWeb - Single Click Download

Direct download of shows via single click

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          MediathekViewWeb - Single Click Download
// @description   Direct download of shows via single click
// @author        TheRealHawk
// @license       MIT
// @namespace     https://greasyfork.org/en/users/18936-therealhawk
// @match         https://mediathekviewweb.de/*
// @version       1.3
// @require       https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @require       https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js
// @require       https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js
// @grant         GM_download
// ==/UserScript==

// Workaround to get rid of "is not defined" warnings
/* globals $, jQuery, moment */

function modTitleCol() {
    $('#mediathek > tbody > tr > td:nth-child(2),' +
      '#mediathek > tbody > tr > td:nth-child(3),' +
      '#mediathek > tbody > tr > td:nth-child(5)').hover(
        // Mouseover
        function() {
            $(this).css(
                {color:'#0ce3ac'}
            );
        },
        // Mouseout
        function() {
            $(this).css(
                {color:'#ffffff'}
            );
        }
    );

    $('#mediathek > tbody > tr').each( function() {
        const url = $('td', this).last().find('a').attr('href');
        const topic = $('td', this).eq(1).text();
        const title = $('td', this).eq(2).text();
        const orgTime = $('td', this).eq(4).text();
        const modTime = moment(orgTime, 'DD.MM.YYYY').format('YYYY-MM-DD');

        $('td', this).eq(1).bind('click', function() {
            $(this).effect('pulsate');

            const details = { url: url,
                              name: modTime + ' - ' + topic + ' - ' + title.replace(/[\\\?\.\*<>]/g, '').replace(/[\|:/]/g, ' - ').replace(/"/g, '\'').replace(/[\s]{2,}/g, ' ') + '.mp4',
                              saveAs: true
                            };
            GM_download(details);
        } );

        $('td', this).eq(2).bind('click', function() {
            $(this).effect('pulsate');

            const details = { url: url,
                              name: modTime + ' - ' + title.replace(/[\\\?\.\*<>]/g, '').replace(/[\|:/]/g, ' - ').replace(/"/g, '\'').replace(/[\s]{2,}/g, ' ') + '.mp4',
                              saveAs: true
                            };
            GM_download(details);
        } );

        $('td', this).eq(4).bind('click', function() {
            $(this).effect('pulsate');

            const details = { url: url,
                              name: modTime + '.mp4',
                              saveAs: true
                            };
            GM_download(details);
        } );
    } );
}

const observer = new MutationObserver( function() {
    modTitleCol();
} );

observer.observe($('#mediathek')[0], {childList: true});