Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(function() {
'use strict';
if ( location.pathname !== "/p/PRODUCT-ID HERE/savers" ) {
return false;
}
function rand_between( num1, num2 ) {
return Math.floor(Math.random() * num2) + num1;
}
function follow_user( username ) {
var follow_url = 'https://wanelo.com/' + username + '/follow?last_view=products%23savers'
$.post( follow_url ).success(function( response ) {
console.log( response );
});
}
function get_username( user ) {
var $user_follow_btn = $( user );
var username = $user_follow_btn.closest( '.preview-strip-description' ).find( '.preview-strip-description-text > .pull-left > a[title]' ).attr( 'title' );
return username;
}
var $users_follow_btn = $( '.followable-resource.preview-strip .wb-follow.btn-follow ' );
var users_length = $users_follow_btn.length;
var counter = 1;
function delayed_follow () {
setTimeout(function () {
var username = get_username( $users_follow_btn[counter] );
follow_user( username );
counter++;
if ( counter < users_length ) {
delayed_follow();
} else {
window.location.href = $('.page-links .wnl-page.active').next().find( 'a' ).attr( 'href' );
}
}, rand_between( 2000, 9000 ));
}
delayed_follow();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.