Sleazy Fork is available in English.

GfyCat adds link to mp4 file

Adds a link to the mp4 file of gfycat webm, redirects from detail page to actual file page

Versione datata 14/10/2017. Vedi la nuova versione l'ultima versione.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo 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         GfyCat adds link to mp4 file
// @namespace    gfycataddmp4link
// @description  Adds a link to the mp4 file of gfycat webm, redirects from detail page to actual file page
// @version      0.3
// @author       https://greasyfork.org/scripts/32493-gfycat-redirect-to-webm-video-file forked by glub
// @match        http://gfycat.com/*
// @match        https://gfycat.com/*
// @grant        none
// @run-at       document-end
// ==/UserScript==




function sleep(ms) {
	return new Promise(resolve => setTimeout(resolve, ms));
}
// Gfycat has been redirecting to the detail page when trying to access a file page directly
// gifycat.com/gifs/detail/id
// work around that by adding a timer to redirect after 5 seconds

if (window.location.href.indexOf("gifs/detail") > 0){
	sleep(5000).then(() => {
	window.location = window.location.href.replace(/gifs\/detail\//,"");
	});
}

var videoPlayer = document.getElementsByTagName('video')[0];
if (videoPlayer) {
	var children = videoPlayer.childNodes;
	for (var i = 0; i < children.length; ++i) {
		if (children[i].type == "video/webm") {
			var webm = children[i].src;
			break;
		}
	}
} else {
	// gifycat.com/id
	var webm = document.getElementById('webmSource').src;
	var mp4 = document.getElementById('mp4Source').src;
}

if (mp4) {
	smallgifbutton = document.getElementById('small-gif');
	smallgifbutton.href = mp4;
	smallgifbutton.innerHTML = "MP4 LINK";

	/*sleep(6000).then(() => {
		location.assign(mp4);
	});*/
}
/*
else if (webm) {
	location.assign(webm);
}
*/