Cam4 Clean

removes all add's, move webcam to a new window, pull-resize the video player

2015/06/05時点のページです。最新版はこちら。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==

// @name		   Cam4 Clean
// @description    removes all add's, move webcam to a new window, pull-resize the video player
// @namespace	   cam4_goes_droopy
// @version		   1.0
// @include        http://*.cam4.tld/*
// @include        http://*.cam4.com.tld/*
// @include        http://*.cam4.co.tld/*
// @include        http://*.cam4.sa.com/*
// @include        http://*.cam4.za.com/*
// @include        http://*.cam4.de.com/*
// @include        http://*.cam4.ar.com/*
// @include        http://*.cam4.hu.com/*
// @include        http://*.cam4.net.ua/*
// @include        http://*.cam4.biz.tr/*
// @include        http://*.cam4.org.pe/*
// @include        http://*.cam4s.com/*
// @include        http://*.sex.co.uk/*
// @include        http://*.lesbiansex.com/*
// @include        http://*.pornografico.com/*
// @include        http://*.pornografia.com/*
// @grant	       GM_xmlhttpRequest
// @grant          GM_info
// @run-at         document-start
// ==/UserScript==


function do_script() {

	version = Number(GM_info.script.version);

	createCookie("bannerPops","under-exit",1);
	createCookie("DirPageCount",11,1);
	
	
// check for updates once per session 5 seconds after load if logged in
	if ((!readCookie("updatecheck"))&&(document.getElementById('mini-mail_pic'))){
		setTimeout(function(){update()}, 5000);	
	}

//floating cam in new window
	if (readCookie("floatcam")){
		eraseCookie("floatcam");
		player=document.getElementById("Cam4VChat").cloneNode(true);
		document.getElementsByTagName("body")[0].innerHTML="";
		document.getElementsByTagName("head")[0].innerHTML="";
		document.title="Webcam";
		document.getElementsByTagName("body")[0].style.margin="0px 0px 0px 0px";
		document.getElementsByTagName("body")[0].appendChild(player);
		document.getElementsByTagName("body")[0].setAttribute("onresize","document.getElementById('Cam4VChat').height=window.innerHeight;");
		return;
	}


//remove add's that may or may not be there
//empty add space and change id so it can not be filled again

	banner=document.getElementById("subfoot");
	if (banner){banner.innerHTML="";banner.id="subfoot_"}

	banner=document.getElementById("profile-ad");
	if (banner){banner.innerHTML="";banner.id="profile_ad_"}

	banner=document.getElementById("profilePostrollAd");
	if (banner){banner.innerHTML="";banner.id="profilePostrollAd_"}

	banner=document.getElementById("besideBroadcastingContainer");
	if (banner){banner.innerHTML="";banner.id="besideBroadcastingContainer_"}

	banner=document.getElementById("headerBanner");
	if (banner){banner.innerHTML=""}

	banner=document.getElementById("right-content"); 
	if (banner){banner.innerHTML="";banner.id="right-content_"}

	banner=document.getElementById("loading_ads");
	if (banner){banner.innerHTML="";banner.id="loading_ads_"}

	banner = document.getElementsByClassName('supershowBanner')[0];
	if (banner){banner.parentNode.removeChild(banner)}

	banner = document.getElementsByClassName('profileDisclaimer')[0];
	if (banner){banner.parentNode.removeChild(banner)}

// re-useable add space
	banner=document.getElementById("headerBanner");
	if (banner){
		if (document.getElementById("broadcastingApp")){
			banner.innerHTML="<h2 style='font-size:small'>"+document.title+"&nbsp</h2>"}else{
			banner.innerHTML="<h2 style='font-size:small'>Add Free by ladroop.&nbsp V"+version.toFixed(1)+"</h2>"}
	}

//inserted iframes
	t=setInterval(function(){
	ifr=document.getElementsByTagName('iframe')
		for (i=0;i<ifr.length;i++){
			ifr[i].parentNode.removeChild(ifr[i]);
		}
	banner = document.getElementsByClassName('xmlAdsTitle')[0];
	if (banner){banner.parentNode.removeChild(banner)}
	},500)


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


// remove spam from menubar, remove supershow , contest and cam4shop
	if (document.getElementById("headerMenuOptions")){
		lioptions=document.getElementById("headerMenuOptions").getElementsByTagName('li');
		for (i=lioptions.length-1;i!=0;i--){
			h=lioptions[i].innerHTML;
			if ((h.indexOf("super")!=-1)||(h.indexOf("contest")!=-1)||(h.indexOf("cam4shop")!=-1)){
				lioptions[i].parentNode.removeChild(lioptions[i]);
			}
		}
	}

// 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")){

// 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")){

// move cam 80px right and make it expandable
	if (document.getElementById("camPaneBig")){
		document.getElementById("camPaneBig").style.margin="0px 0px 0px 80px";
	}
		holder=document.getElementById("broadcastingApp");
		document.getElementsByTagName("object")[0].style.height="440px";
		holder.setAttribute("style","margin-left:0px;margin-top:0px;margin-bottom:0px;resize:vertical;overflow:hidden;width: 100%; height: 440px; ");
		holder.addEventListener("mousemove", function(){h=document.getElementById("broadcastingApp").style.height;if (h=="auto"){h="440px";document.getElementById("broadcastingApp").style.height=h}document.getElementsByTagName("object")[0].style.height=h}, false);

//new and remove icons below cam	
	banner=document.getElementById("tipMenu");
	if (banner){

		document.getElementById("li1").innerHTML="Float this webcam";
		document.getElementById("li1").removeAttribute("onclick");
		document.getElementById("li1").addEventListener('click',function(){floatcam()}, false);

	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("liveHelpButton");
	if (banner){banner.parentNode.removeChild(banner)}

	}
	}
	}
}//end main

	function floatcam(){
		if (document.getElementById("tDiv")){document.getElementById("tDiv").innerHTML=""}
			createCookie("floatcam",1,1);
			document.getElementById("broadcastingApp").innerHTML="<a href=#><h1>Close the floating web cam if you want to see an other cam!</h1></a>";
			popUpWindow=window.open(document.location,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=880, height=440");
	}

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

// update function
	function update(){
		createCookie("updatecheck","1",1);
		infolink= "https://greasyfork.org/scripts/10272-cam4-clean.json";
		GM_xmlhttpRequest({
		method: 'GET',
		url: infolink,
		onload: function(response) {
		data = response.responseText;
		nversion=Number(JSON.parse(data).version);
		if (nversion>version){
		upurl=JSON.parse(data).code_url;
		if (confirm("There is a new version of the cam4 script available. Do you want to install it?")){
		window.open(unescape(upurl), '_top')}
		}
		}
		});
	}

//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
		if (document.getElementsByTagName('head')[0].innerHTML.indexOf("edgecast.cam4s.com") != -1){ // run only on real cam4 domains
			do_script();
		}
	}
}

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