// ==UserScript==
// @name Pobieranie z CDA.pl
// @namespace https://www.cda.pl
// @version 3.1
// @description Dodaje przycisk do pobierania filmu na stronie cda.pl i w osadzonych odtwarzaczach
// @author Kizior
// @match http*://www.cda.pl/video/*
// @match http*://ebd.cda.pl/*
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
/*if(window.location.href.slice(0,25) != "https://www.cda.pl/video/" && window.location.href.slice(0,23) != "https://m.cda.pl/video/") {alert("To nie jest cda.pl, sorry"); return;}
if(document.getElementById("pobieraniezcda") != null) {alert("Już masz otwarte okienko"); return;}*/
var okienko = document.createElement("div");
okienko.style.position="fixed";
okienko.style.backgroundColor="#050505";
okienko.style.width="300px";
okienko.style.height="150px";
okienko.style.zIndex="1000000";
okienko.style.top="50%";
okienko.style.left="50%";
okienko.style.transform="translate(-50%,-50%)";
okienko.style.textAlign="center";
okienko.style.borderRadius="5px";
okienko.style.border="dashed 2px darkorange";
okienko.style.padding="2px";
okienko.style.fontSize="12px";
okienko.style.color="#BBB";
okienko.style.lineHeigh="1.25";
okienko.style.fontFamily="Arial,Helvetica,sans-serif";
okienko.id="pobieraniezcda";
var tytul = document.createElement("span");
tytul.innerHTML="Pobieranie z CDA.pl
by Kizior
Wybierz jakość filmu:";
var miejsceNaPrzyciski = document.createElement("div");
miejsceNaPrzyciski.style.position="relative";
miejsceNaPrzyciski.style.top="40%";
miejsceNaPrzyciski.style.transform="translate(0,-100%)";
var napisLadowania = document.createElement("div");
napisLadowania.innerHTML="Ładowanie...";
napisLadowania.style.position="relative";
napisLadowania.style.top="20%";
napisLadowania.style.display="none";
var przyciskWyjscia = document.createElement("div");
przyciskWyjscia.style.position="absolute";
przyciskWyjscia.innerHTML="X";
przyciskWyjscia.style.right="0";
przyciskWyjscia.style.top="0";
przyciskWyjscia.style.color="red";
przyciskWyjscia.style.backgroundColor="lightgrey";
przyciskWyjscia.style.fontWeight="bold";
przyciskWyjscia.style.margin="1%";
przyciskWyjscia.style.padding="2%";
przyciskWyjscia.style.cursor="default";
przyciskWyjscia.style.width="10px";
przyciskWyjscia.style.height="10px";
przyciskWyjscia.style.lineHeight="10px";
przyciskWyjscia.style.border="dotted 2px green";
przyciskWyjscia.style.MozUserSelect="none";
var przyciskWOkienku = document.createElement("button");
przyciskWOkienku.style.padding="2%";
przyciskWOkienku.style.margin="1%";
przyciskWOkienku.style.borderRadius="10%";
przyciskWOkienku.style.fontSize="20px";
przyciskWOkienku.style.fontWeight="bold";
przyciskWOkienku.style.backgroundColor="darkgray";
przyciskWOkienku.style.color="#404040";
przyciskWOkienku.style.borderColor="orange";
przyciskWOkienku.style.fontFamily="Arial,Helvetica,sans-serif";
if(document.getElementsByClassName("areaquality").length==0)
{
if(document.getElementById("naglowek")!=null)
{
document.getElementById("naglowek").parentNode.parentNode.parentNode.innerHTML+=('