Sleazy Fork is available in English.

BetterFap - Fap Gauntlet

Fap Gauntlet for BetterFap

Versão de: 22/04/2017. Veja: a última versão.

// ==UserScript==
// @name        BetterFap - Fap Gauntlet
// @author      Goog
// @description Fap Gauntlet for BetterFap
// @namespace   http://reikitech.me/
// @include     https://test.betterfap.com/view/*
// @include     https://betterfap.com/view/*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require     http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js
// @grant       unsafeWindow
// @version 0.0.1.50170419190760
// ==/UserScript==

//WARNING: SPAGHETTI AHEAD

// ideas: time should be set to webm length, webm should repeat x times based on time, skip all nonimages/webms

// fuck the rules, here are some global vars
var firstStart = true;
var isPlaying = false;
var currViewObj = "Null";
var timeFapped = 0;
var currFPS = 0;
var denialMode = false;
var canCum = null;

var context = new AudioContext();
var o = context.createOscillator();
o.type = "sawtooth";
o.connect(context.destination);
o.frequency.value = 0;

function remakeDialog() {

	$('#FapDialog').dialog('open');

	document.querySelector('div[id="FapDialog"]').innerHTML = "Starting...";

	if (remakeDialog.interval) {
		clearInterval(remakeDialog.interval);
	}

	i = 0;
	var currIntensity = getRandomIntensity();
	currFPS = getRandomFPS();
	var randTime = getRandTime(currFPS);
	getCumState();

	if (isPlaying) {
		o.frequency.value = currFPS;
	}

	currViewObj = unsafeWindow.AppState.viewing;

	remakeDialog.interval = setInterval(
			function oneSecTimer() {
				
			if (denialMode === false) {
				document.querySelector('div[id="FapDialog"]').innerHTML = currIntensity + "<br />" + currFPS + "/sec, " + (randTime - i);
			} else {
				document.querySelector('div[id="FapDialog"]').innerHTML = currIntensity + "<br />" + currFPS + "/sec, " + (randTime - i) + "<br />" + getCumText();
			}
			if (randTime - i <= 1) {

				currIntensity = getRandomIntensity();
				currFPS = getRandomFPS();

				if (isPlaying) {
					o.frequency.value = currFPS;
				}
				randTime = getRandTime(currFPS);
				getCumState();
				i = 0;

				var $ = unsafeWindow.jQuery;

				window.top.postMessage({
					action: 'next',
					cr: $.cookie().cr
				}, window.top.location.protocol + window.top.location.host);
				setTimeout(function () {
					currViewObj = unsafeWindow.AppState.viewing;
				}, 1000);
			} else if (currViewObj != unsafeWindow.AppState.viewing && i > 2) {
				currIntensity = getRandomIntensity();
				currFPS = getRandomFPS();

				if (isPlaying) {
					o.frequency.value = currFPS;
				}
				randTime = getRandTime(currFPS);
				getCumState();
				currViewObj = unsafeWindow.AppState.viewing;
				i = 0;

			} else if (i < -2) {
				clearInterval(remakeDialog.interval);
			}

			i = i + 1;
			timeFapped = timeFapped + 1;

		}, 1000);
}

function getRandomInt(min, max) {
	return Math.floor(Math.random() * (max - min + 1)) + min;
}

function getRandomFPS() {
	var rand = getRandomInt(0, 4);
	return fapsPerSec[rand];
}

function getCumState() { // 1 in 10 chance to be allowed to cum
	if (getRandomInt(1,10) == 1) { 
		canCum = true;
	} else {
		canCum = false;
	}
	return canCum;
}

function getCumText() {
	if (canCum == true) {
		cumText = "You can cum.";
	} else {
		cumText = "Do not cum.";
	}
	return cumText;
}

// autistically defined percent chances for each intensity, no equal chances here (except for 4 of them)

function getRandomIntensity() {
	var rand = getRandomInt(1, 100);
	var x = 2000;
	if (rand <= 10) { // 10% for Feather Light
		x = 0;
	} else if (rand > 10 && rand <= 25) { // 15% for Very Light
		x = 1;
	} else if (rand > 25 && rand <= 40) { // 15% for Light
		x = 2;
	} else if (rand > 40 && rand <= 60) { // 20% for Medium
		x = 3;
	} else if (rand > 60 && rand <= 75) { // 15% for Hard
		x = 4;
	} else if (rand > 75 && rand <= 90) { // 15% for Very Hard
		x = 5;
	} else if (rand > 90) { // 10% for Deathgrip
		x = 6;
	}

	return intensities[x];
}

// made it get only multiples of 10, no more 33 seconds of fapping #trueautism
function getRandTime(randFPS) {
	var randTime = 30000;

	if (randFPS == 1) {
		randTime = getRandomInt(1, 3) * 10;
	} else if (randFPS == 2) {
		randTime = getRandomInt(1, 4) * 10;
	} else if (randFPS == 3) {
		randTime = getRandomInt(1, 5) * 10;
	} else if (randFPS == 4) {
		randTime = getRandomInt(1, 4) * 10;
	} else {
		randTime = getRandomInt(1, 2) * 10;
	}

	return randTime;
}

var intensities = [
	'Deathgrip', //10
	'Very Hard', //15
	'Hard', //15
	'Medium', //20
	'Light', //15
	'Very Light', //15
	'Feather Light' //10
];

var fapsPerSec = [
	1,
	2,
	3,
	4,
	5
];

setTimeout(function () { // thanks for not having a sleep function js

	$("body").append('<div id="FapDialog" style="font-size:400%; color: #00FF00">Press t to start!</div>');

	//--- Activate the dialog.

	$("#FapDialog").dialog({
		position: {
			my: "left top",
			at: "left top",
			of: window
		},
		modal: false,
		height: 400,
		width: 400,
		title: "Fap Gauntlet (click here to drag!) ----> ",
		zIndex: 83666 //-- This number doesn't need to get any higher.


	}).prev(".ui-dialog-titlebar").css("background", "rgba(0, 0, 0, 0.4)");

	$("#FapDialog").dialog().prev(".ui-widget-header").css("font-size", "140%");

	//king spaghetti coming through (it didn't work when I tried to make the main fap shit a function, in my defense)

	$(document).keypress(function (e) {
		if (e.which == 116 || e.keyCode == 116) {
			remakeDialog();
		}
	});

	$('div#FapDialog').on('dialogclose', function (event) {
		clearInterval(remakeDialog.interval);
		o.frequency.value = 0;
		alert("Stopping, press t to bring me back!");
		timeFapped = 0;
	});

	$(document).keypress(function (e) { // if c pressed
		if ((e.which == 99 || e.keyCode == 99) && $('#FapDialog').is(':visible')) {
			o.frequency.value = 0;
			isPlaying = false;
			alert('You lasted ' + timeFapped + ' seconds!');
			clearInterval(remakeDialog.interval);
			timeFapped = 0;
		}
	});

	$(document).keypress(function (e) { // if m pressed
		if (e.which == 109 || e.keyCode == 109) {
			o.frequency.value = 0;
			isPlaying = false;
		}

	});

	$(document).keypress(function (e) { // if n pressed
		if ((e.which == 110 || e.keyCode == 110) && $('#FapDialog').is(':visible') && isPlaying === false) {
			if (firstStart) {
				alert('Tempo helper enabled! Press m to mute!');
				o.start();
				firstStart = false;
			}
			o.frequency.value = currFPS;
			isPlaying = true;
		}
	});
	
	$(document).keypress(function (e) { // if b pressed (b stands for bully)
		if (e.which == 98 || e.keyCode == 98) {
			
			if (denialMode) {
				alert('Denial mode disabled!');
				denialMode = false;
			} else {
				alert('Denial mode enabled! There are now prompts regarding whether you are allowed to cum to any given image, if it says you can cum then you can! If it says you cant and you edge, hands off for the next two images!');
				denialMode = true;
			}
		}
	});
	
	

}, 2000);