Sleazy Fork is available in English.

ExtendRedTube

Remove ads, enlarge video, add video download links, block popups and stops autoplay keeping buffering

Verze ze dne 06. 04. 2016. Zobrazit nejnovější verzi.

// ==UserScript==
// @author			Jack_mustang
// @version			5.6
// @name			ExtendRedTube
// @description		Remove ads, enlarge video, add video download links, block popups and stops autoplay keeping buffering
// @date			2016 April 6
// @include			*redtube.com*
// @include			*redtube.org*
// @include			*redtube.cz*
// @include			*redtube.es*
// @include			*redtube.fr*
// @include			*redtube.it*
// @include			*redtube.kr*
// @include			*redtube.pl*
// @include			*redtube.si*
// @exclude			*blog.redtube.com*
// @run-at			document-start
// @grant			none
// @license			Public Domain
// @icon			https://gmgmla.dm2301.livefilestore.com/y2phTdvWAn7a3fxjda6GWNCiS1ERegalgwxn5z-65SPxhpws5ISHa-Z8CHpmq18FPUOBm-3QJtCfOYFaiyM0Kji1MwBUy6mkxBLJtc5THpPtEU/ERT-logo.png
// @namespace		44db8537bb6ac3d112dd3b5ec7b6b33b84aa5765
// ==/UserScript==
// Block popups
function NoOpen(e){return 1}
parent.open=NoOpen;
this.open=NoOpen;
window.open=NoOpen;
open=NoOpen;
window.open = function(){return;}
open = function(){return;}
this.open = function(){return;}
parent.open = function(){return;}

window.g367CB268B1094004A3689751E7AC568F = {
	Core: "stop mouse tracking and popups"
}

var ExtendRT = function ExtendRedTube() {
	// Pop-up killer, we trick RT to think we are old Presto Opera, this kills the pop-ups

	//Inject CSS
	addStuff()

	window.addEventListener('DOMContentLoaded', function() {
		// Remove ads functions, comment these if you just want them hidden
		function removeQuery(query) {
			var ifr = document.querySelectorAll(query)
			if(ifr.length > 0)
				for(var i=0; i < ifr.length; i++)
					ifr[i].parentNode.removeChild(ifr[i])
		}

		// Remove iframe ads
		removeQuery("iframe")
		// Remove footer ad
		removeQuery('.videosTable + style + div')
		removeQuery('.videosDetails + div + style + div')
		// Adblock notice
		removeQuery('#slidePanelContainerAB')
		// remove search ad
		removeQuery('.tja')
		// Remove below vid ad
		removeQuery('.bvq')

		if(document.getElementById('redtube_flv_player')) {
			var remtab = document.querySelector(".fakeLinkTabber[rel=related-premium-videos]").parentNode
			if (remtab !== null)
				document.querySelector('.tabsElements').removeChild(remtab)

			videoStuff()

			// Include thumbnail button tab
			var thumbtab = document.createElement("li")
			thumbtab.innerHTML = "<a style='cursor:pointer' class='fakeLinkTabber' onclick='$(\"div[class*=tab-content]\").css({\"display\": \"none\"});$(\"#tabsParent>ul li\").attr(\"class\",\"\");$(\"#tabsParent>ul li:last-child\").attr(\"class\",\"activeTab\");$(\"#tabsContentHolder\").attr(\"style\",\"display:none\");$(\"#tagger_thumbs\").attr(\"style\",\"\");$(\"#tabsContentHolder\").slideDown(\"slow\");'>Thumbnails</a>"
			var tabs = document.querySelector(".tabsElements")
			tabs.appendChild(thumbtab)

			// Add arrows to navigate 
			var tabs = document.querySelector("#tabsParent .tabsElements").childNodes,
				l = tabs.length-1

			var tabbar = document.getElementById('moreTopSearches').clientWidth,
				max = tabbar - tabs[l].offsetLeft - tabs[l].clientWidth - 40

			if (max < -41) {
				function moveTabs(button, max) {
					console.log("lol")
					var tabs = document.querySelector("#tabsParent .tabsElements"),
						move = tabs.offsetLeft
					console.log(move+"\n"+max)

					if (button && move > max)
						tabs.setAttribute("style", "margin-left: "+(move-20)+"px")
					else if (!button && move < 0)
						tabs.setAttribute("style", "margin-left: "+(move+20)+"px")
					else
						clearInterval(mvTab)
				}

				var prev, next,
				moveTabFunc = document.createElement("script")
				moveTabFunc.setAttribute("type", "text/javascript")
				moveTabFunc.innerHTML = moveTabs.toString()
				document.getElementById("tabsParent").appendChild(moveTabFunc)

				prev = document.createElement("div")
				next = document.createElement("div")
				prev.innerHTML = "&lt;"
				next.innerHTML = "&gt;"
				prev.setAttribute("id", "ERT-prev")
				next.setAttribute("id", "ERT-next")
				prev.setAttribute("class", "ERT-nav")
				next.setAttribute("class", "ERT-nav")
				prev.setAttribute("onmouseout",  "console.log('onMouseOut');clearInterval(mvTab)")
				next.setAttribute("onmouseout",  "console.log('onMouseOut');clearInterval(mvTab)")
				prev.setAttribute("onmouseover", "mvTab = setInterval(function(){moveTabs(0, 0)}, 50)")
				next.setAttribute("onmouseover", "mvTab = setInterval(function(){moveTabs(1, "+max+")}, 50)")

				document.getElementById("moreTopSearches").appendChild(prev)
				document.getElementById("moreTopSearches").appendChild(next)
			}

			// Add, check thumbs exist, change location if needed and include div
			function changeServer(num) {
				var s = '0',
					table = '',
					source,
					nums = num + 1,
					vidId = location.pathname
				vidId = vidId.slice(1)
				vidId2 = vidId.slice(0, vidId.length -3)
				while(vidId.length < 7)
					vidId = '0' + vidId
				while(vidId2.length < 7)
					vidId2 = '0' + vidId2
				switch(num) {
					case 0:
						source = 'img03'
						break
					case 1:
						source = 'thumbs.lsw'
						break
					case 2:
						source = 'img01'
						break
					case 3:
						source = 'img02'
						break
					case 4:
						source = 'img04'
						break
				}
				for(i=1; i<17; i++) {
					if(i == 10)
						s = ''
					table = table + '<td><img class="te" '
					if(i == 1 && num < 4)
						table = table + 'onerror="changeServer('+ nums +');"'
					table = table + 'src="http://'+ source +'.redtubefiles.com/_thumbs/'+ vidId2 +'/'+ vidId +'/'+ vidId +'_0'+ s + i +'m.jpg" /></td>'
					if(i == 4 || i == 8 || i == 12)
						table = table + '</tr><tr>'
				}
				if(num == 0) {
					var node = document.createElement('div')
					node.setAttribute('id', 'tagger_thumbs')
					node.setAttribute('style', 'overflow:hidden;display:none')
				} else
					var node = document.getElementById('tagger_thumbs')
				node.innerHTML = '<table style="padding:30px 20px 20px"><tr>'+ table +'</tr></table>'
				if(num == 0)
					document.getElementById('tabsContentHolder').appendChild(node)
			}// Now inject this function
			var thumbscript = document.createElement("script")
			thumbscript.setAttribute("type", "text/javascript")
			thumbscript.innerHTML = changeServer.toString() + "changeServer(0);"
			document.body.appendChild(thumbscript)
		}
	},false)

	function videoStuff() {
		if (!(document.querySelector("#redtube_flv_player embed") || document.querySelector("#redtube_flv_player video")))
			return setTimeout(videoStuff, 50)

		// Scroll video to middle of page
		function scrollthere() {
			var vid = document.querySelector('.watch'),
				vh = vid.offsetHeight,
				vd = vid.offsetTop + document.querySelector('.pageVideos').offsetTop + document.querySelector("#contentHolder").offsetTop,
				fh = window.innerHeight,
				sc = vd-((fh-vh)/2)
			scrollTo(0, sc)
		}// Now inject this function
		var script = document.createElement("script")
		script.setAttribute("type","text/javascript")
		script.innerHTML = scrollthere.toString() + "scrollthere();"
		script.id = ("ERT-scrollVid")
		document.head.appendChild(script)

		// Keyboard Shortcut for centring
		window.addEventListener('keyup', function(e) {
			console.log(e)
			if(e.ctrlKey && e.altKey && (e.code === "KeyC" || (e.code === undefined && e.keyCode === 67)))
				scrollthere()
		}, false)

		// Include button in right corner to center video on screen;
		var node = document.createElement("div")
		node.setAttribute("style", "position:fixed; bottom:0; right:0; top:auto!important; height:15px; width:80px; cursor:pointer; background:#121212; padding:5px 10px; border:1px solid #202020; z-index: 10000")
		node.setAttribute("onclick", "scrollthere();")
		node.setAttribute("title", "Use the keyboard shortcut Ctrl+Alt+C (For other keyboard layouts use the key where C should be on the QWERTY layout)")
		node.innerHTML = "Center video"
		document.body.appendChild(node)

		// Download withouth being logged
		if (typeof(document.querySelector("#download-link-hd")) !== "undefined")
			document.querySelector("#download-link-hd").href = MHP1138.players.redtube_flv_player.medias.sources[720]
		if (typeof(document.querySelector("#download-link-480p")) !== "undefined")
			document.querySelector("#download-link-480p").href = MHP1138.players.redtube_flv_player.medias.sources[480]
		if (typeof(document.querySelector("#download-link-mobile")) !== "undefined")
			document.querySelector("#download-link-mobile").href = MHP1138.players.redtube_flv_player.medias.sources[240]
	}

	function addStuff() {
		// While <head> is not loaded we keep trying
		if (!document.querySelector("head"))
			return setTimeout(addStuff, 50)

		// We create an object and start including its content to include in DOM at the end.
		var ertcss =
// Hide ads while we can't remove them
".tja, #slidePanelContainerAB, .videosTable + style + div, .videosDetails + div + style + div, .bvq {\n\
	display: none !important;\n\
	visibility: hidden !important;\n\
	opacity: 0 !important;\n\
	height: 0 !important;\n\
	overflow: hidden !important;\n\
	width: 0 !important;\n\
}\n\
#pb_template {\n\
	display: none !important;\n\
}\n" +
// Prevent background ad
"body {\n\
	background-color: #000 !important\n\
}\n" +
// Make thumbs have 4 in every row
"ul.video-listing.two-in-row {\n\
	width: 100% !important;\n\
}\n\
ul.video-listing.two-in-row .first-in-row:nth-child(3) {\n\
	clear: none;\n\
	margin-left: 25px;\n\
}\n" +
// Porstar page
".pornstar-small-info, .close-button, .show-less-link {\n\
	display: none !important\n\
}\n\
.pornstar-highlight {\n\
	background: none !important;\n\
	margin-bottom: -390px;\n\
	z-index: 2;\n\
}\n\
.pornstar-details-subscribe {\n\
	margin-right: 0 !important;\n\
	padding-left: 235px\n\
}\n\
.pornstar-all-info {\n\
	float: right !important;\n\
	width: 485px !important;\n\
}\n\
.pornstar-highlight-more {\n\
	display: block !important\n\
}\n" +
// PornStars page
"ul.pornStarsThumbs.four-in-row {\n\
	width: 100% !important\n\
}\n\
.pornStarsThumbs.four-in-row > li {\n\
	clear: none !important;\n\
	margin: 0 8px 20px 0 !important\n\
}\n\
.pornStarsThumbs.four-in-row > li:last-child {\n\
	margin-right: 0 !important;\n\
}\n" +
// Gallery
".gallery-listing.three-in-row .first-in-row {\n\
	clear: none !important;\n\
	margin-left: 24px !important;\n\
}\n\
.galleriesTable .pages {\n\
	padding: 45px 0 125px 100px;\n\
}\n\
.gallery-listing.three-in-row li:last-child {\n\
	position: absolute;\n\
	bottom: 135px;\n\
	margin-left: 0 !important;\n\
}\n" +
// Video Page
// Enlarge player
".video-wrap, .watch, .videoPlayer {\n\
	width: 100% !important\n\
}\n\
.videoPlayer {\n\
	height: 600px !important\n\
}\n\
.video-wrap {\n\
	position: absolute;\n\
}\n\
.videoDetails {\n\
	margin-top: 690px;\n\
}\n\
.video-page-right-col {\n\
	margin-top: 673px;\n\
}\n\
/*#vidImgPoster {\n\
	position: static !important;\n\
	width: auto;\n\
}\n\
#posterHolder #playBtn {\n\
	position: absolute !important;\n\
	margin: 0 !important;\n\
	top: 40%;\n\
	left: 45%;\n\
}\n\
.video-wrap h1.videoTitle {\n\
	width: 800px !important\n\
}\n\
.moreTopSearches {\n\
	overflow: hidden;\n\
}\n\
.moreTopSearches .topSearch ul.tabsElements li:first-child {\n\
	margin-left: 40px !important;\n\
}\n\
.moreTopSearches .topSearch ul.tabsElements {\n\
	transition: margin-left 50ms linear;\n\
	width: 150% !important;\n\
}\n\
.ERT-nav {\n\
	background: #121212;\n\
	box-shadow: 0 0 25px 15px #121212;\n\
	cursor: pointer;\n\
	font-size: 40px;\n\
	padding: 0 5px;\n\
	position: absolute;\n\
}\n\
.ERT-nav:hover {\n\
	color: #FFF;\n\
}\n\
.ERT-nav:last-child {\n\
	right: 0;\n\
}*/\n" +

// Other random pages
// API
"#wrapper {\n\
	background: #FFF !important\n\
}\n"

		// Inject created CSS
		var ertnode = document.createElement("style")
			ertnode.type = "text/css"
			ertnode.id = "ERT-style"
			ertnode.appendChild(document.createTextNode(ertcss))
		document.head.appendChild(ertnode)
	}
}();