Skip to content

Instantly share code, notes, and snippets.

@m1k1o
Last active October 4, 2019 17:08
Show Gist options
  • Save m1k1o/3db40e2c28b5d56bef284c999a6282b3 to your computer and use it in GitHub Desktop.
Save m1k1o/3db40e2c28b5d56bef284c999a6282b3 to your computer and use it in GitHub Desktop.
prosieben, sat1, kabeleins, sixx, sat1gold, prosiebenmaxx, kabeleinsdoku herunterladen.
// ==UserScript==
// @name Pro7 Herunterladen
// @version 2.31
// @description prosieben,sat1,kabeleins,sixx,sat1gold,prosiebenmaxx,kabeleinsdoku herunterladen.
// @author kronos
// @match https://www.prosieben.de/*
// @match https://www.sat1.de/*
// @match https://www.kabeleins.de/*
// @match https://www.sixx.de/*
// @match https://www.sat1gold.de/*
// @match https://www.prosiebenmaxx.de/*
// @match https://www.kabeleinsdoku.de/*
// @match https://www.prosieben.at/*
// @match https://www.sat1.at/*
// @match https://www.kabeleins.at/*
// @match https://www.sixx.at/*
// @match https://www.sat1gold.at/*
// @match https://www.prosiebenmaxx.at/*
// @match https://www.kabeleinsdoku.at/*
// @run-at document-ended
// ==/UserScript==
(function () {
'use strict';
var css = '#mount > div > .backdrop-overlay { display: none !important; }',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.type = 'text/css';
if (style.styleSheet){
// This is required for IE8 and below.
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
var loaded_url = '', url = null
var createElem = function() {
var action = document.createElement("div")
action.classList.add('video-action')
action.classList.add('video-bookmark')
var icon = document.createElement("span")
icon.classList.add('video-action-share-icon')
icon.style = 'transform: rotate(90deg);'
var text = document.createElement("span")
text.classList.add('video-bookmark-text')
text.classList.add('video-action-text')
var content = document.createTextNode("Herunterladen")
text.appendChild(content)
action.append(icon)
action.append(text)
var el = document.querySelector(".video-info .video-actions")
el.prepend(action)
action.addEventListener('click', function() {
location.href = url
})
}
var afterAjaxComplete = function(xhr) {
console.log("AJAX", xhr, xhr.responseURL)
if(String(xhr.responseURL).match(/geturls/)) {
url = xhr.response.replace(/\/|\n|\r/g, '').replace(/^.*?(http[^"]+)".*?$/, '$1')
if(loaded_url != location.href) {
createElem()
loaded_url = location.href
return
}
}
};
var oldXHR = unsafeWindow.XMLHttpRequest;
function newXHR() {
var realXHR = new oldXHR();
realXHR.addEventListener("readystatechange", function() {
if(realXHR.readyState == 4 && realXHR.status == 200){
afterAjaxComplete(realXHR)
}
}, false);
return realXHR;
}
unsafeWindow.XMLHttpRequest = newXHR;
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment