Skip to content

Instantly share code, notes, and snippets.

@otaavioo
Last active October 24, 2017 16:38
Show Gist options
  • Save otaavioo/65e6c09f0ef8b2677dfb16c8cc6b2098 to your computer and use it in GitHub Desktop.
Save otaavioo/65e6c09f0ef8b2677dfb16c8cc6b2098 to your computer and use it in GitHub Desktop.
Creates an account at Operand Site
var name = 'otavio';
var isHomePage = function() {
return window.location.href.indexOf('contratar') === -1;
};
var createAccountStepZero = function() {
var text = 'Qual a sequência do email? Ex.: ' + name + '[sequencia]@mailinator.com',
iSequence = prompt(text, getLastSequenceNumber());
if (iSequence !== null) {
setStorage(true, iSequence);
}
};
var getLastSequenceNumber = function(isCreatingAccount, iSequence) {
if (localStorage.getItem('iSequence') === null || localStorage.getItem('iSequence') === '') {
return '';
}
return parseInt(localStorage.getItem('iSequence')) + 1;
}
var setStorage = function(isCreatingAccount, iSequence) {
localStorage.setItem('isCreatingAccount', isCreatingAccount);
localStorage.setItem('iSequence', iSequence);
};
var createAccount = function() {
if (!isCreatingAccount()) {
return;
}
var vm = ko.dataFor(document.body),
iSequence = localStorage.getItem('iSequence');
vm.sEmail(name + iSequence + '@mailinator.com');
$('.btn.btn-default').click();
setTimeout(function() {
vm.sUserName(name + iSequence);
vm.sOccupation('CEO / Diretor');
vm.sEmail(name + iSequence + '@mailinator.com');
vm.sPassword('123456');
setTimeout(function() {
vm.goToStepTwo();
setTimeout(function() {
vm.sCompanyName(name + iSequence);
vm.sCompanyPriority('Outro');
vm.sOccupationArea('Publicidade e Propaganda');
vm.iCompanyNumber('(00) 00000-0000');
vm.iUserQuantity('Acima de 100');
setTimeout(function() {
vm.goToStepThree();
setTimeout(function() {
vm.sUserToInvite(name + iSequence + '[email protected]');
$('#btnInvite').click();
vm.sUserToInvite(name + iSequence + '[email protected]');
$('#btnInvite').click();
setTimeout(function() {
vm.goToStepFour();
setStorage(false, iSequence);
}, 1000);
}, 2000);
}, 1500);
}, 2000);
}, 1500);
}, 1500);
};
var isCreatingAccount = function() {
return localStorage.getItem('isCreatingAccount') === 'true';
};
$(document).ready(function() {
if (isHomePage()) {
createAccountStepZero();
}
createAccount();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment