Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @match *://*.freebitco.in/*
- // ==/UserScript==
- (function() {
- 'use strict';
- let config = {
- // timeout: 4, // Use -1 to disable the timeout functionality. In minutes. Max time the monitor will wait for a result/roll.
- // // After timeout is reached, the Manager/Monitor will assume something is wrong
- // // (usually faucet tab being accidentally closed or failed to connect)
- // // Will trigger a refresh on the Monitor website and carry on the process
- // postponeMinutes: 3, // Minutes to wait before retrying a faucet that timed out
- fb: {
- activateRPBonus: false // will try to activate the highest RP Roll Bonus available for the account (100, 50 25, ... points per roll),
- }
- }
- let persistence, interactions, FBProcessor;
- let helpers = {
- cleanString: function(input) {
- var output = "";
- for (var i=0; i<input.length; i++) {
- if (input.charCodeAt(i) <= 127) {
- output += input.charAt(i);
- }
- }
- return output;
- },
- shuffle: function (array) {
- let currentIndex = array.length, temporaryValue, randomIndex;
- while (0 !== currentIndex) {
- randomIndex = Math.floor(Math.random() * currentIndex);
- currentIndex -= 1;
- temporaryValue = array[currentIndex];
- array[currentIndex] = array[randomIndex];
- array[randomIndex] = temporaryValue;
- }
- return array;
- },
- randomMs: function (a, b){
- return a + (b - a) * Math.random();
- },
- addMinutes: function(date, mins) {
- return date.setMinutes(date.getMinutes() + parseInt(mins) + 1);
- },
- randomInt: function(min, max) {
- return Math.floor(Math.random() * (max - min + 1) + min);
- },
- addMilliseconds: function(date, ms) {
- return date.setMilliseconds(date.getMilliseconds() + ms);
- },
- getRandomMillisecondsFromMinutesRange(minute, rangeDiffInPercentage) {
- const msCenter = minute * 60 * 1000;
- const msRangeDiff = Math.round(msCenter * rangeDiffInPercentage / 100);
- return helpers.randomMs(msCenter - msRangeDiff, msCenter + msRangeDiff);
- },
- }
- let objectGenerator = {
- createPersistence: function() {
- const prefix = 'autoWeb_';
- function save(key, value, parseIt = false) {
- GM_setValue(prefix + key, parseIt ? JSON.stringify(value) : value);
- };
- function load(key, parseIt = false) {
- let value = GM_getValue(prefix + key);
- if(value && parseIt) {
- value = JSON.parse(value);
- }
- return value;
- };
- return {
- save: save,
- load: load
- };
- },
- createFBProcessor: function() {
- let timeWaiting= 0;
- let countdownMinutes;
- function run() {
- setTimeout(findCountdownOrRollButton, helpers.randomMs(12000, 15000));
- };
- function findCountdownOrRollButton() {
- if ( isCountdownVisible() ) {
- timeWaiting = 0;
- countdownMinutes = +document.querySelectorAll('.free_play_time_remaining.hasCountdown .countdown_amount')[0].innerHTML + 1;
- return;
- }
- if ( isRollButtonVisible() ) {
- if (config.fb.activateRPBonus) {
- if (!document.getElementById('bonus_container_free_points')) {
- document.querySelector('a.rewards_link').click();
- activateBonus(0);
- }
- }
- if (isHCaptchaVisible()) {
- waitForCaptcha();
- } else {
- clickRoll();
- }
- }
- };
- function isCountdownVisible() {
- return document.querySelectorAll('.free_play_time_remaining.hasCountdown .countdown_amount').length > 0;
- };
- function isHCaptchaVisible() {
- let hCaptchaFrame = document.querySelector('.h-captcha > iframe');
- if (hCaptchaFrame && $(hCaptchaFrame).is(':visible')) {
- return true;
- }
- return false;
- };
- function isRollButtonVisible() {
- return $(document.getElementById('free_play_form_button')).is(':visible');
- };
- function waitForCaptcha() {
- if ( document.querySelector('.h-captcha > iframe').getAttribute('data-hcaptcha-response').length > 0) {
- clickRoll();
- } else {
- if (timeWaiting/1000 > config.timeout * 60) {
- return;
- }
- timeWaiting += 10000;
- setTimeout(waitForCaptcha, helpers.randomMs(10000, 12000));
- }
- };
- function clickRoll() {
- document.getElementById('free_play_form_button').click();
- setTimeout(waitForCaptcha, helpers.randomMs(4000, 6000));
- };
- function closePopup() {
- let closePopupBtn = document.querySelector('.reveal-modal.open .close-reveal-modal');
- if (closePopupBtn) {
- closePopupBtn.click();
- }
- };
- return {
- run: run
- };
- }
- };
- /**
- * Prevents alert popups to be able to reload the faucet if invisible captcha validation fails
- */
- function overrideSelectNativeJS_Functions () {
- window.alert = function alert (message) {
- console.log (message);
- }
- }
- function addJS_Node (text, s_URL, funcToRun) {
- var scriptNode= document.createElement ('script');
- scriptNode.type= "text/javascript";
- if (text)scriptNode.textContent= text;
- if (s_URL)scriptNode.src= s_URL;
- if (funcToRun)scriptNode.textContent = '(' + funcToRun.toString() + ')()';
- var element = document.getElementsByTagName ('head')[0] || document.body || document.documentElement;
- element.appendChild (scriptNode);
- }
- FBProcessor = objectGenerator.createFBProcessor();
- setTimeout(FBProcessor.run, helpers.randomMs(2000, 5000));
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement