Sleazy Fork is available in English.

ExtendYouPorn

Remove ads, enlarges video, stops autoplay keeping buffering, fixes the overhaul style & block pop-ups

ของเมื่อวันที่ 28-01-2016 ดู เวอร์ชันล่าสุด

// ==UserScript==
// @author			Jack_mustang
// @version			4.1
// @name			ExtendYouPorn
// @description		Remove ads, enlarges video, stops autoplay keeping buffering, fixes the overhaul style & block pop-ups
// @date			2016 January 28
// @include			*youporn.com/*
// @include			*youporngay.com/*
// @run-at			document-start
// @grant			none
// @license			Public Domain
// @icon			https://gmgmla.dm2301.livefilestore.com/y2pYluU8jK3EnLV1U8D92pYCC9wU5O04Il4j64Ft_pjKGpUG_I5L0fUHrsLpUB4oDCLIJdWp9Bwmr0RPMdhJhl5Bo362RwjatCFUpNjEdMosGA/EYP-logo.jpg
// @namespace		14fac5d83892686b90beea51d35d1d7dbcfe49b6
// ==/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;}

var ExtendYP = function ExtendYouPorn(){
	// Pop-up killer, we trick YP to think we are old Presto Opera, this kills the pop-ups
	if (!window.opera)
		window.opera = true

	addStyle()
	changePlayer()

	window.addEventListener('DOMContentLoaded', function(){
		// Remove ads functions
		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 iframes because they are ads
		removeQuery("iframe")

		// Video page
		if(document.getElementById('videoContainer') || document.querySelector(".channelDetailWrapper")) {
			if (document.querySelector('.playWrapper'))
				document.querySelector('.playWrapper').setAttribute('class', 'playWrapper sixteen-column')

			// Scroll and extra manipulation only after the elements exist
			videoStuff()
		}
	},false)

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

		// Scroll video to middle of page
		function scrollthere() {
			var player = document.getElementById('videoContainer'),
				vh = player.offsetHeight,
				vd = (player.parentNode.offsetTop == 0)? ((document.querySelector('#studioCanvas'))? document.querySelector('.grid_8.alpha').offsetTop : document.querySelector('.watchWrapper').offsetTop+document.querySelector('#videoCanvas').offsetTop ) : player.parentNode.offsetTop,
				fh = window.innerHeight;
			sc = vd-((fh-vh)/2)
			scrollTo(0, sc)
			console.info("** ExtendYouPorn **\ntop: "+vd+", height: "+vh+", scrolled: "+sc+", window: "+fh)
		}
		// Inject this function to page
		var script = document.createElement("script")
		script.setAttribute("type", "text/javascript")
		script.innerHTML = scrollthere.toString() + "scrollthere();"
		script.id = "EYP-scrollVid"
		document.body.appendChild(script)

		// Include button in right corner to center video on screen
		var node = document.createElement("div")
		node.setAttribute("style","position: fixed; bottom: 0; right: 0; cursor: pointer; color: #fff; text-transform: uppercase; background: #ec567c; text-align: center; font-size: 1.2em; padding: 7px;z-index: 999999;")
		node.setAttribute("onclick", "scrollthere();")
		node.innerHTML = "Center video"
		node.id = "EYP-scroll"
		document.body.appendChild(node)
	}

	function changePlayer() {
		if (!document.getElementById('videoWrapper'))
			return setTimeout(changePlayer, 50)

		var newflashvars = document.createElement("script")
		newflashvars.setAttribute("type", "text/javascript")
		newflashvars.id = "EYP-newflashvars"
		newflashvars.innerHTML =
			'page_params.video.playerParams.autoplay = false;'+
			'page_params.video.playerParams.autoload = true;'
		document.head.appendChild(newflashvars)
	}

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

		// We create an object and start including its content to include in DOM at the end
		var eypcss =
		// Hide ads while we can't remove them, the last hides the HTML5 player in-vid ads
		"#adblock_1, footer>div:not([class^=footer]), .eight-column+.eight-column, .container>.row:first-child+.row>.eight-column, .trafficjunky-float-right, .channel-header, .channelSideAd, .watchVideo>.four-column>div:first-child, .watchVideo>.four-column>div:first-child+div, .watchVideo>.four-column>div:first-child+div+div, #videoWrapper+aside, #pb_template, #recommended-videos-first-row+.eight-column {\n\
			display: none !important;\n\
		}\n\
		.eight-column, .eight-column .row, .nine-column, .nine-column .row, #recommended-videos-first-row .row {\n\
			width: 100% !important;\n\
		}\n\
		#recommended-videos-first-row {\n\
			width: 50% !important;\n\
		}\n\
		.nine-column .porn-star-list:last-child {\n\
			display: none !important;\n\
		}\n"

		// Inject created CSS
		var eypnode = document.createElement("style")
			eypnode.type = "text/css"
			eypnode.id = "EYP-style"
			eypnode.appendChild(document.createTextNode(eypcss))
		document.head.appendChild(eypnode)
	}
}();