BetterFap - Fap Gauntlet

Fap Gauntlet for BetterFap

2017-04-19 일자. 최신 버전을 확인하세요.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name        BetterFap - Fap Gauntlet
// @author      Goog
// @description Fap Gauntlet for BetterFap
// @namespace   http://reikitech.me/
// @include     https://test.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.20170419190753
// ==/UserScript==

//WARNING: SPAGHETTI AHEAD

var currURL = "Null";

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

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

// 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,
	"AFAP"
];

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

	$("body").append('<div id="FapDialog" style="font-size:400%; color: #00FF00">Hiiii</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 || window.event.keyCode == 116 && $('#FapDialog').dialog('isOpen') !== true) {
			$('#FapDialog').dialog('open');

			i = 0;
			var currIntensity = getRandomIntensity();
			var currFPS = getRandomFPS();
			var randTime = getRandTime(currFPS);
			currURL = window.location.href;
			console.log("window = " + currURL);

			var timerFunc = setInterval(
					function oneSecTimer() {
					document.querySelector('div[id="FapDialog"]').innerHTML = currIntensity + ", " + currFPS + "/sec, " + (randTime - i);

					i = i + 1;

					if (randTime - i == -1) {
						
						currIntensity = getRandomIntensity();
						currFPS = getRandomFPS();
						randTime = getRandTime(currFPS);
						i = 0;

						var $ = unsafeWindow.jQuery;
						
						window.top.postMessage({
							action: 'next',
							cr: $.cookie().cr
						}, window.top.location.protocol + window.top.location.host);
						setTimeout(function () {
							currURL = window.location.href;
						}, 1000);
					} else if (currURL != window.location.href && i > 2) {
						currIntensity = getRandomIntensity();
						currFPS = getRandomFPS();
						randTime = getRandTime(currFPS);
						currURL = window.location.href;
						i = 0;
					} else if (i < -2) {
						clearInterval(timerFunc);
					}

				}, 1000);

		}
	});

	$('div#FapDialog').on('dialogclose', function (event) {
		console.log("stopping...");
		i = -200;
	});

	var i = 0;
	var currIntensity = getRandomIntensity();
	var currFPS = getRandomFPS();
	randTime = getRandTime(currFPS);
	currURL = window.location.href;
	console.log("window = " + currURL);

	var timerFunc = setInterval(
			function oneSecTimer() {
			document.querySelector('div[id="FapDialog"]').innerHTML = currIntensity + ", " + currFPS + "/sec, " + (randTime - i);

			i = i + 1;

			if (randTime - i == -1) {

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

				var $ = unsafeWindow.jQuery;

				window.top.postMessage({
					action: 'next',
					cr: $.cookie().cr
				}, window.top.location.protocol + window.top.location.host);
				setTimeout(function () {
					currURL = window.location.href;
				}, 1000);
			} else if (currURL != window.location.href && i > 2) {
				currIntensity = getRandomIntensity();
				currFPS = getRandomFPS();
				randTime = getRandTime(currFPS);
				currURL = window.location.href;
				i = 0;
			} else if (i < -2) {
				clearInterval(timerFunc);
			}

		}, 1000);

}, 2000);