CSFD - get series links

Get CSFD series or episodes IDs to clipboard

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         CSFD - get series links
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Get CSFD series or episodes IDs to clipboard
// @author       Libor Marek
// @match        https://www.csfd.cz/film/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    $(document).ready(function () {
        $("#children").append('<div style="float:none;display:block;width:650px;text-align:right;"><input type="button" id="copyEpisodeIDs" value="Kopírovat ID"></div>');

        var EpisodeIDs = '';
        $("#children").children("div").children("ul").children("li").children("a").each(function () {
            var link = $(this).attr("href").trim("/");
            var matches = link.match(/\/(\d+)+[\/]?/g).map(id => id.replace(/\//g, ''));
            EpisodeIDs += matches[1] + "\n";
        });

        $(document).on("click", "#copyEpisodeIDs", function () {
            var $temp = $("<textarea><textarea>");
            $("body").append($temp);
            $temp.val(EpisodeIDs).select();
            document.execCommand("copy");

        });

    });

})();