Skip to content

Instantly share code, notes, and snippets.

@thosakwe
Created March 3, 2018 20:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thosakwe/0855bf96b398a87726c71b5c947e3e4b to your computer and use it in GitHub Desktop.
Save thosakwe/0855bf96b398a87726c71b5c947e3e4b to your computer and use it in GitHub Desktop.
Tampermonkey UserScript to auto-click Follow/Unfollow Buttons on Crowdfire
Press CTRL+SHIFT+Y (PC) or COMMAND+SHIFT+Y (Mac) to auto-click all the follow or unfollow buttons on Crowdfire,
with a small delay (200ms) in-between.
Sends a notification when the process completes. Saves a lot of time, and makes it much easier to grow your following
without all the clicking.
// ==UserScript==
// @name Crowdfire Clicker
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Clicks all the pesky buttons on Crowdfire, sequentially.
// @author Tobe O
// @match https://*.crowdfireapp.com/*
// @require https://code.jquery.com/jquery-3.1.1.slim.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.0/mousetrap.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
function loadScript(src) {
var s = document.createElement('script');
s.src = src;
document.body.appendChild(s);
}
var delay = 150;
function followAll() {
var $buttons = $('.listItem__action__btn.pointer');
var promiseFunctions = $.map($buttons, function($button) {
return function() {
return new Promise(function(resolve) {
setTimeout(function() {
$button.click();
resolve();
}, delay);
});
};
});
var promiseSerial = function(funcs) {
return funcs.reduce(function(promise, func) {
return promise.then(result => func().then(Array.prototype.concat.bind(result)));
}, Promise.resolve([]));
};
promiseSerial(promiseFunctions)
.then(function() {
new Notification('Crowdfire Task Success');
})
.catch(function() {
new Notification('Crowdfire Task Failure');
});
}
var loadPromises = [];
if (!window.jQuery)
loadPromises.push(loadScript('https://code.jquery.com/jquery-3.1.1.slim.min.js'));
if (!window.Mousetrap)
loadPromises.push(loadScript('https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.0/mousetrap.min.js'));
Promise.all(loadPromises).then(function() {
return Notification.requestPermission().catch().then(function() {
Mousetrap.bind(['ctrl+shift+y', 'command+shift+y'], followAll);
});
});
})();
@BradGroux
Copy link

Just an FYI, this doesn't work anymore due to changes Crowdfire had to make to comply with Twitter's rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment