Last active
April 23, 2020 14:56
-
-
Save codesandtags/27290b485cef3bbf83672e6dcff22c47 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
// The selectors | |
const yesButton = document.querySelector('[aria-label="Like"]'); | |
const noButton = document.querySelector('[aria-label="Nope"]'); | |
const getRandomNumberOneToHundred = () => Math.random() * 100; | |
// Logic | |
const MINIMUM_NUMBER_OF_PHOTOS = 3; | |
const RANDOM_PROBABILITIES = 80; | |
const MILISECONDS_TO_CLICK = 2000; | |
const getNumberOfPhotos = () => { | |
const hasSelection = document.querySelectorAll('.Expand .tappable-view > div.CenterAlign').length; | |
if (hasSelection <= 1) return 0; | |
return document.querySelectorAll('.Expand .tappable-view > div.CenterAlign')[1].querySelectorAll('button').length; | |
} | |
// Statistics | |
let yesClicked = 0; | |
let noClicked = 0; | |
const printStatistics = () => { | |
console.log('\n--------------------------'); | |
console.log(' Yes: ', yesClicked); | |
console.log(' No : ', noClicked); | |
console.log(' Total: ', (yesClicked + noClicked)); | |
}; | |
// The logic | |
const createLike = () => { | |
const photos = getNumberOfPhotos(); | |
// console.log('# Photos ', photos); | |
if (photos >= MINIMUM_NUMBER_OF_PHOTOS) { | |
getRandomNumberOneToHundred() <= RANDOM_PROBABILITIES | |
? ++yesClicked && yesButton.click() | |
: ++noClicked && noButton.click(); | |
} else { | |
++noClicked && noButton.click(); | |
} | |
printStatistics(); | |
} | |
// Here is where magic happens | |
function startTinderLikes() { | |
console.log(` | |
-------------------------------------------------------------------- | |
- W E L C O M E T O M Y T I N D E R L I K E S | |
-------------------------------------------------------------------- | |
`) | |
setInterval(createLike, MILISECONDS_TO_CLICK); | |
} | |
startTinderLikes(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment