Last active
April 20, 2022 13:35
-
-
Save 4lessandrodev/31db57cc43bebbeea601797df489ce9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// open your brave browser on brave home page | |
// press F12 or open your console on brave browser | |
// paste this script | |
// wait until it stops (45sec) | |
function goToEndOfPage(){ | |
scrollToPub(9000000000) | |
} | |
function gotoTopOfPage(){ | |
scrollToPub(0) | |
} | |
function getAdsElements(){ | |
gotoTopOfPage(); | |
goToEndOfPage(); | |
gotoTopOfPage(); | |
const adsElements = document.querySelectorAll('[*|href="chrome://rewards"]'); | |
const elements = []; | |
adsElements.forEach((element) => elements.push(element.parentElement)); | |
return elements; | |
} | |
function getAdsPositions(){ | |
const adsElements = getAdsElements(); | |
const positions = []; | |
adsElements.forEach((element) => positions.push(element.getBoundingClientRect().top)); | |
return positions; | |
} | |
function getQtdAds(){ | |
const adsElements = getAdsElements(); | |
const total = adsElements.length; | |
print('qtdOfAds', total); | |
return total; | |
} | |
function print(key, value){ | |
console.table({ [key]: value }); | |
} | |
function getCurrentValue(){ | |
const currentValueElement = document.querySelectorAll(".amount")[2].innerText; | |
const currentCoin = parseFloat(currentValueElement); | |
return currentCoin; | |
} | |
function incrementPosition(position){ | |
const offset = 700; | |
const newPosition = position + offset; | |
return newPosition; | |
} | |
function scrollToPub(position){ | |
window.scrollTo(0, position); | |
return incrementPosition(position); | |
} | |
function viewAllAds(){ | |
const initialValue = getCurrentValue(); | |
print('balance', initialValue); | |
getQtdAds(); | |
const positions = getAdsPositions(); | |
const totalCoin = getCurrentValue(); | |
const offset = 700; | |
const viewAdInterval = setInterval(()=> { | |
const position = positions[0] + offset; | |
gotoTopOfPage(); | |
if(positions.length === 0){ | |
gotoTopOfPage(); | |
print('totalMined', totalCoin - initialValue); | |
clearInterval(viewAdInterval); | |
print('lastRun', new Date()); | |
} else { | |
var scrollTimes = 0; | |
let updatedPosition = position; | |
var scroll3x = setInterval(()=> { | |
if(scrollTimes === 3){ | |
clearInterval(scroll3x); | |
} else { | |
scrollToPub(updatedPosition); | |
updatedPosition = updatedPosition + offset; | |
positions.shift(); | |
scrollTimes = scrollTimes + 1; | |
} | |
}, 1000); | |
} | |
}, 5000); | |
} | |
function mineTokenPerMinutes(minutes=15){ | |
viewAllAds(); | |
const interval = 1000 * 60 * minutes; // 1x each 15 minutes | |
setInterval(viewAllAds, interval); | |
} | |
mineTokenPerMinutes(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment