Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var waitForAndExecute = function(waitForFun, execFun) {
- (function() {
- function waitForAndExecute(waitForFun, execFun) {
- if (!waitForFun()) {
- setTimeout(function() {
- waitForAndExecute(waitForFun, execFun);
- }, 100);
- return;
- }
- execFun();
- };
- waitForAndExecute(waitForFun, execFun);
- })();
- };
- var clickWhenAvailable = function(query, callback) {
- waitForAndExecute(
- function() {
- return document.querySelector(query);
- },
- function() {
- document.querySelector(query).click();
- callback();
- }
- );
- };
- var setValueWhenAvailable = function(query, value, callback) {
- waitForAndExecute(
- function() {
- return document.querySelector(query);
- },
- function() {
- document.querySelector(query).value = value;
- callback();
- }
- );
- };
- var yourAccountName = document.querySelector('.Header__userpic a').title;
- var toAccountName = window.location.pathname.split('/')[1].substring(1);
- document.querySelector('[href="/@' + yourAccountName + '"]').click();
- clickWhenAvailable('[href="/@' + yourAccountName + '"]', function() {
- clickWhenAvailable('[href="/@' + yourAccountName + '/transfers"]', function() {
- clickWhenAvailable('.UserWallet__balance:nth-child(4) a', function() {
- clickWhenAvailable('.UserWallet__balance:nth-child(4) li a', function() {
- setValueWhenAvailable('[role="dialog"] input', toAccountName, function() {
- setTimeout(function() {
- document.querySelectorAll('[role="dialog"] input')[1].focus();
- }, 500);
- });
- });
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement