Created
October 8, 2019 11:24
-
-
Save Robin-bob/8bce08e820b238b28ebaaa496200a0cb to your computer and use it in GitHub Desktop.
add Program To Favorites After Purchase
This file contains 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
<script> | |
function addProgramToFavoritesAfterPurchase() { | |
var button = document.querySelector('.favorite.s-button'); | |
var notClicked = true; | |
if (button && notClicked) { | |
if (document.referrer.includes('orders/success')) { | |
document.querySelector('.favorite.s-button').click(); | |
notClicked = false; | |
} | |
} else { | |
setTimeout(function(){ | |
addProgramToFavoritesAfterPurchase(); | |
},500) | |
} | |
} | |
addProgramToFavoritesAfterPurchase(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment