ladroop / Cam4 Clean

// ==UserScript==
// @name		   Cam4 Clean
// @description    removes all add's
// @namespace	   cam4_goes_droopy
// @updateURL	   https://openuserjs.org/meta/ladroop/Cam4_Clean.meta.js
// @version		   2.4
// @include        http://*.cam4.*/*
// @include        http://*.cam4s.com/*
// @include        http://*.sex.co.uk/*
// @include        http://*.lesbiansex.com/*
// @include        http://*.pornografico.com/*
// @include        http://*.pornografia.com/*
// @include        https://*.cam4.*/*
// @include        https://*.cam4s.com/*
// @include        https://*.sex.co.uk/*
// @include        https://*.lesbiansex.com/*
// @include        https://*.pornografico.com/*
// @include        https://*.pornografia.com/*
// @grant          GM_info
// @grant          GM_addStyle
// @run-at         document-start
// ==/UserScript==


function do_script() {


	version = Number(GM_info.script.version);

	createCookie("bannerPops","under-exit",1);
	createCookie("dirPageCount",11,1);

//hide add's and things we don't need

		GM_addStyle(".xmlAdsTitle { display: none !important}");
		GM_addStyle(".xmlAdsWrapper { display: none !important}");
		GM_addStyle(".sponsorAd { display: none !important}");
		GM_addStyle(".stickyAd { display: none !important}");
		GM_addStyle(".skyscraper-ad-1 { display: none !important}");
		GM_addStyle(".skyscraper-ad-2 { display: none !important}");
		GM_addStyle(".profileDisclaimer { display: none !important}");
		GM_addStyle(".ads { display: none !important}");
		GM_addStyle(".supershowBanner { display: none !important}");
		GM_addStyle(".meetandfuck { display: none !important}");
		GM_addStyle(".modal-backdrop { display: none !important}");
		GM_addStyle(".promo-center { display: none !important}");

		GM_addStyle("#subfoot { display: none !important}");
		GM_addStyle("#goldNavbar { display: none !important}");
		GM_addStyle("#fan-club-container { display: none !important}");
		GM_addStyle("#rssSectionWrapper { display: none !important}");
		GM_addStyle("#digest-signupHome { display: none !important}");
		GM_addStyle("#profileStatus { display: none !important}");
		GM_addStyle("#rssSectionWrapper { display: none !important}");
		GM_addStyle("#profileStatus_questionnaire { display: none !important}");
		GM_addStyle("#imFloatingAd { display: none !important}");
		GM_addStyle("#Cam4DialogContainer { display: none !important}");
		GM_addStyle("#profilePostrollAd { display: none !important}");
		GM_addStyle("#guestModalLayout { display: none !important}");
		GM_addStyle("#mm-blocker { display: none !important}");
		GM_addStyle("#profile-ad { display: none !important}");
		GM_addStyle("#headerBanner { display: none !important}");


		document.getElementById("main-content").className = "";

		GM_addStyle("#camPaneBig { width: 100% !important}");

// new version info
	infostuff=document.getElementsByClassName('leftStuff');
	infodata=infostuff[0].innerHTML;
	infodata=infodata+" | Made add Free by Ladroop.&nbsp V"+version.toFixed(1);
	infostuff[0].innerHTML=infodata;

//inserted stuff between thumbs
	t=setInterval(function(){
		banner=document.getElementById("directoryDiv");
		if (banner){
			Users = banner.getElementsByClassName('profileBox');
			for (var i = 0; i < Users.length; i++) {
				if (!Users[i].getElementsByTagName('a')[0].href){
					Users[i].setAttribute("style","display: none !important;");
				}
			}
		}
	},500)


// skip age confirm screen with one second delay
	setTimeout(function(){
		hit=document.getElementsByClassName("nopop btn iagree closeOverlayJquery")[0];
		if(hit){click(hit)}
	},1000);

// on profile , cam or no cam
	if (document.getElementById("profileHeaderShare")){

// show votes count
	if (document.getElementById("hiddenvotes")){
		if (document.getElementById("rating_status")){
			document.getElementById("rating_status").innerHTML=document.getElementById("hiddenvotes").innerHTML+" people voted";
		}
	}

// on profile with cam
	if (document.getElementById("broadcastingApp")){
		if (document.getElementById("toggleAccountButton")){// only if logged in
			GM_addStyle(".ui-resizable-handle { display: none !important}");// remove cam4's own rezise	
			GM_addStyle(".completeFullscreen { display: none !important}");
			GM_addStyle(".theatre { display: none !important}"); // remove full screen and theater controls
			GM_addStyle("#videoControlsUpdateContainer { display: none !important}");

		setTimeout(function(){// wait for video
// setup cam for resize		
			holder=document.getElementById("broadcastingApp");
			pheight=parseInt(document.getElementById("Cam4VChat").height)+40;// 440+30+10 video + header + onderrand

			if (!document.getElementById("containerFirebase").style.paddingLeft){
				document.getElementById("containerFirebase").style.paddingLeft="586px"
			}

			ratio=parseInt(document.getElementById("containerFirebase").style.paddingLeft)/document.getElementById("Cam4VChat").height;

			document.getElementById("containerFirebase").style.height="100%";
			document.getElementById("chat_main").style.height="100%";
			document.getElementById("chatUsersList").style.height="100%";
			document.getElementById("chatFriendsList").style.height="100%";
			document.getElementById("chatFriendsOnlineList").style.height="100%";
			document.getElementById("chatFavoritesList").style.height="100%";
			document.getElementById("chatFavoritesOnlineList").style.height="100%";
			document.getElementById("Cam4VChat").style.height="100%";
			document.getElementById("Cam4VChat").style.width="100%";

			holder.setAttribute("style","margin-left:0px;margin-top:0px;margin-bottom:0px;resize:vertical;overflow:hidden;width: 100%;height:"+pheight+"px ");
			newdiv=document.createElement('div');
			newdiv.setAttribute("style","margin-left:100%;width: 100px;height:100px;visibility:visble;position:absolute; left:-50px;bottom:150px;");
			newdiv.id="trigger";
			newdiv.addEventListener("mouseenter", function(){document.getElementById("trigger").style.visibility="hidden";holder.addEventListener("mousemove",adjplayer, false)});
			document.getElementById("camPaneBig").appendChild(newdiv);
			holder.addEventListener("mouseout",  function(){document.getElementById("trigger").style.visibility="visible";holder.removeEventListener("mousemove",adjplayer, false)});
			setInterval(function(){ adjplayer(); }, 1000);

//new full screen button
		newli=document.createElement('li');
		newli.id="fullscreen";
		newli.className="btn btn-orange";
		newli.innerHTML="Full Screen";
		newli.addEventListener('click',function(){fullcam()}, false);
		document.getElementById("NSBar").appendChild(newli);

//new full chat screen button
		newli=document.createElement('li');
		newli.id="fullscreenc";
		newli.className="btn btn-orange";
		newli.innerHTML="Full Screen + Chat";
		newli.addEventListener('click',function(){fullchat()}, false);
		document.getElementById("NSBar").appendChild(newli);

//pull text
		newli=document.createElement('li');
		newli.className="max-only";
		newli.innerHTML='<span class="text-only" style="position: absolute;right:0px">Pull &#8599;</span>';
		document.getElementById("NSBar").appendChild(newli);

		}, 5000);
	}
	
//remove icons below cam	
	banner=document.getElementById("tipMenu");
	if (banner){

		banner=document.getElementById("li5");
		if (banner){banner.parentNode.removeChild(banner)}

		banner=document.getElementById("li4");
		if (banner){banner.parentNode.removeChild(banner)}

		banner=document.getElementById("li3");
		if (banner){banner.parentNode.removeChild(banner)}

		banner=document.getElementById("li2");
		if (banner){banner.parentNode.removeChild(banner)}

		banner=document.getElementById("li1");
		if (banner){banner.parentNode.removeChild(banner)}

		banner=document.getElementById("liveHelpButton");
		if (banner){banner.parentNode.removeChild(banner)}

	}


	}
	}
}//end main


// full screen
	function fullcam(){
		document.getElementById("Cam4VChat").style.position="fixed";
		document.getElementById("Cam4VChat").style.left="0px";
		document.getElementById("Cam4VChat").style.top="0px";
		document.getElementById("Cam4VChat").style.zIndex="999";
		document.getElementsByTagName("body")[0].style.overflow="hidden";
		document.getElementById("broadcastingApp").style.resize="none";
		document.getElementById("Cam4VChat").addEventListener('keypress',function(){exitfullcam()}, false); //onclick does not work in opera
		document.getElementsByClassName("newStreamControls")[0].style.display="none"
		document.getElementById("Cam4VChat").focus();

	}

//exit full screen
	function exitfullcam(){
		document.getElementById("Cam4VChat").removeEventListener('keypress',function(){exitfullcam()}, false);
		document.getElementsByClassName("newStreamControls")[0].style.display="block"
		document.getElementById("Cam4VChat").style.position="static";
		document.getElementsByTagName("body")[0].style.overflow="visible";
		document.getElementById("broadcastingApp").style.resize="vertical";
	}

//auto clicker
	function click(elm) {
		var evt = document.createEvent('MouseEvents');
		evt.initEvent("click", true, false);
		elm.dispatchEvent(evt);
	} 

// go full screen with chat
	function fullchat(){
		a=window.eval('FullScreenApi.playerGoFullScreen()');
		elem = document.getElementById("camPaneBig");
		if (elem.requestFullscreen) {
			elem.requestFullscreen();
		} else if (elem.mozRequestFullScreen) {
			elem.mozRequestFullScreen();
		} else if (elem.webkitRequestFullscreen) {
			elem.webkitRequestFullscreen();
		}
	}

// adjust player and chat size
	function adjplayer(){
		frameh=document.getElementById("broadcastingApp").style.height;
		if (frameh !="100%"){// full screen from theater
			if (frameh=="auto"){// return from theater
				pframeh=parseInt(document.getElementsByClassName("chatlessPlayer")[0].style.height);
				document.getElementById("broadcastingApp").style.height=pframeh+40+"px"
			}else{
				pframeh=parseInt(frameh);
				if (pframeh <250){pframeh=250;document.getElementById("broadcastingApp").style.height=pframeh+"px"}
				ww = window.innerWidth;
				if (pframeh*ratio+250 > ww){pframeh=parseInt((ww-250)/ratio);document.getElementById("broadcastingApp").style.height=pframeh+"px"}
				pframeh=pframeh-40;
			}
		pframew=parseInt(pframeh*ratio);
		document.getElementsByClassName("chatlessPlayer")[0].style.height=pframeh+"px";
		document.getElementsByClassName("chatlessPlayer")[0].style.width=pframew+"px";
		document.getElementById("containerFirebase").style.paddingLeft=pframew+"px";
		document.getElementById("fakechatDiv").style.height=pframeh+8+"px";
		document.getElementById("tab1C").style.height=pframeh-71+"px";
		document.getElementById("tab2C").style.height=pframeh-22+"px";
		document.getElementById("lists").style.height=pframeh-52+"px";
		document.getElementById("GSTabPanel").style.maxHeight=pframeh-85+"px";
		document.getElementById("chatTabPanel").style.maxHeight=pframeh-85+"px";
		document.getElementById("chatPanelTemplate").style.maxHeight=pframeh-85+"px";
		}
	}


//cookie functions
	function createCookie(name,value,days,domain){
		if (domain){
		var domain=";domain=."+domain;
		}else var domain = "";
		if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		}else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/"+domain;
		}

	function eraseCookie(name,domain){
		createCookie(name,"",-1,domain);
		}

	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
		}



function do_script1(){

	window.removeEventListener("DOMContentLoaded", this, false);
	if (document.getElementsByTagName('head')[0].innerHTML.indexOf("icra") != -1){ // no running on other cam4 pages like iframes
		do_script();
	}
}

window.addEventListener("DOMContentLoaded", function() { do_script1() }, false);