Untitled

 avatar
unknown
plain_text
10 months ago
5.8 kB
14
Indexable
let manuallyToggled = false
let shiftKeyDown = false
let zoom = 1
let videoElement = null
let mouseDown = false
let mouseDownStart = { x: 0, y: 0 }
let currentOffset = { x: 0, y: 0 }
let flip = false

console.log('getting set up')

setInterval(() => {
	if(manuallyToggled == true) return;
	var videoPanel = document.getElementById('VideoPanel')
	if(videoPanel) {
		document.body.classList.add('mythemeActive')
		window.scrollTo(0, 0)
			
		var videos = Array.from(videoPanel.querySelectorAll('video'))
		if(videos[0]) {
			videoElement = videos[0]
			videoElementReady(videoElement)
		}
	}

	
	var cards = Array.from(document.querySelectorAll('.roomCard:not(.customCardHover)'))
	
	cards.forEach(card => videoCardReady(card))
}, 1000)

document.body.addEventListener('keydown', e => {
	if(e.key == 'Shift'){
		shiftKeyDown = true;
	}
})

document.body.addEventListener('keyup', e => {
	console.log(e.key)
	if(e.key == 'f'){
		manuallyToggled = true;
		document.body.classList.toggle('mythemeActive')
		window.scrollTo(0, 0)
	} else if(e.key == 'r'){
		mouseDownStart = { x: 0, y: 0 }
		zoom = 1
		videoElement.style.scale = zoom
		videoElement.style.transform = 'translate(0px, 0px)'
	} else if(e.key == 'x'){
		flip = !flip
		videoElement.style.scale = (flip ? -zoom : zoom) + ' ' + zoom
	} else if(e.key == 'Shift'){
		shiftKeyDown = false;
	}
})

document.addEventListener('wheel', e => {
	if(!shiftKeyDown || !videoElement) return;
	const delta = e.deltaY;
	const movement = (delta > 0 ? -1 : 1) * .025;
	zoom += movement;
	
	videoElement.style.scale = (flip ? -zoom : zoom) + ' ' + zoom
})

function videoElementReady(videoElement){
	let scale = -1
	document.body.addEventListener('mousedown', e => {
		mouseDown = true
		mouseDownStart = { x: e.pageX, y: e.pageY }
	})
	
	document.body.addEventListener('mouseup', e => {
		mouseDown = false
		// let delta = { x: (mouseDownStart.x - e.pageX) * scale, y: (mouseDownStart.y - e.pageY) * scale }
		// currentOffset.x += delta.x
		// currentOffset.y += delta.y
	})
	
	document.body.addEventListener('mousemove', e => {
		if(!mouseDown) return;
		let delta = { x: (mouseDownStart.x - e.pageX) * scale, y: (mouseDownStart.y - e.pageY) * scale }
		if(flip){
			delta.x = delta.x * -1
		}
		videoElement.style.transform = 'translate(' + (delta.x) + 'px, ' + (delta.y) + 'px)'
	})
}

function removeUnwanted(){
	Array.from(document.querySelectorAll('.roomCard')).forEach(card => {
	    var subject = card.querySelector('.subject')
	    var gender = card.querySelector('span.genders, span.genderm, span.genderc')?.getAttribute('title')
	    
	    var subjectText = subject.textContent;
	    var hasMaleContext = false;
	    
	    if(subjectText.indexOf('dick') >= 0) hasMaleContext = true;
	    if(subjectText.indexOf('cock') >= 0) hasMaleContext = true;
	    // if(subjectText.indexOf('cum') >= 0) hasMaleContext = true;
	    
	    if(gender && (gender == 'Trans' || gender == 'Male')){
	        card.remove()
	    }
	    
	    if(hasMaleContext){
	        card.remove()
	    }
	})
}

function getAbsoluteUrl(href) {
  return new URL(href, window.location.href).href;
}

function videoCardReady(card){
	card.classList.add('customCardHover')
	
	if(card.offsetLeft < 200)
		card.classList.add('cardFirstLeft')
	else card.classList.remove('cardFirstLeft')
	
	const rawUrl = card.querySelector('a.room_thumbnail_container').getAttribute('href')
	const url = getAbsoluteUrl(rawUrl)
	
	
	let timeout;
	let iframeVisible = false
	let frame;
	
	const onCardHover = () => {
		timeout = setTimeout(showIframe, 500);
	}
	const onCardOut = () => {
		clearTimeout(timeout)
		if(iframeVisible) hideIframe()
	}
	
	const showIframe = () => {
		iframeVisible = true
		if(frame) return;
		frame = document.createElement('iframe')
		frame.classList.add('showPreviewFrame')
		frame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms')
		frame.src = url
		
		frame.addEventListener('load', e => {
			let frame = e.target
				
			const iframeDocument = frame.contentDocument || frame.contentWindow.document;
			
			const style = iframeDocument.createElement('style');
			style.textContent = `
			body{  backgorund-color: #F00; overflow: hidden !important; }
				#header {
					display: none !important;
				}
				#main {
					min-height: 100vh;
				}
					
				#main>div {
					min-height: 100vh;
				}
				
				#TheaterModeRoomContents {
					padding: 0px !important;
					margin: 0px !important;
				}
				
				.draggableCanvasChatWindow {
					display: none !important;
				}
				
				#TheaterModeRoomContents {
					padding: 0px !important;
					margin: 0px !important;
				}
				
				#TheaterModePlayer {
					height: 100vh !important;
					width: 100vw !important;
					position: absolute !important;
					top: 0px !important;
					left: 0px !important;
					z-index: 9999;
				}
					
				.videoPlayerDiv {
					width: 100% !important;
					height: 100% !important;
				}
				.genderTabs {
					height: 0px !important;
					margin-top: 0px !important;
				}
				
				#footer-holder {
					display: none !important;
				}
			`;
			iframeDocument.head.appendChild(style);
		})

		card.appendChild(frame)
		
	}
	
	const hideIframe = () => {
		iframeVisible = false
		frame.remove()
		frame = null
	}
	
	card.addEventListener('mouseover', onCardHover)
	card.addEventListener('mouseout', onCardOut)
}

var currentActivePage = '1'
removeUnwanted()
setInterval(() => {
	// var activePage = document.querySelector('.page_number_container.active').textContent
	// if(activePage !== currentActivePage){
	// 	removeUnwanted()
	// }
	removeUnwanted()
}, 1000)

setInterval()
Editor is loading...
Leave a Comment