Erome Video Download

Shows Erome.com Video Download Links

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Erome Video Download
// @namespace    greasyfork.org
// @version      1.2
// @description  Shows Erome.com Video Download Links
// @author       malakai2
// @match        https://www.erome.com/*
// @icon         https://www.erome.com/favicon.ico
// @grant        GM_download
// @license MIT
// ==/UserScript==

(function() {
	'use strict';

	let addLink = function(media) {
		let tagName = media.tagName;
		let src;
		let sourceElement = media.querySelector('source');
		src = !src && sourceElement ? sourceElement.src : '';

		let br = document.createElement('br');
		let link = document.createElement('a');
        link.style = "display:block;text-align:center;font-weight:bold;text-decoration:underline;";
		link.setAttribute('href', src);
		link.download = '';
		link.textContent = 'Download:- ' + src.split('/').pop();
		link.target = '_blank';
		link.rel = 'noopener';
		link.onclick = function(e) {
			e.preventDefault();
			let src = e.target.href;
			let fname = src.split('/').pop();
			GM_download(src,fname);
		};
		media.parentElement.parentElement.appendChild(link);
		media.parentElement.parentElement.appendChild(br);
	}

	let init = function() {
		let mediaElements = document.querySelectorAll('.media-group .video video');

		for (let i = 0; i < mediaElements.length; i++) {
			let media = mediaElements[i];
			addLink(media);
		}
	}
    if(document.readyState !== 'loading') init();
    else document.addEventListener("DOMContentLoaded", init);
})();