// ==UserScript== // @name Dribbble Extender // @description Shows who follows you on your following list // @author Kos // @namespace http://tampermonkey.net/ // @version 0.1 // @license CC BY-SA 2.0 // @homepage https://greasyfork.org/scripts/22003-dribbble-extender // @include https://dribbble.com/*/following // @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; $(document).ready(function(){ var following = [], followers = [], fetchActive = false, fullFetchFinished = false, curPage = 1; function getPage(page) { page = Math.round(page); fetchActive = true; $.ajax({ url: 'https://'+document.location.hostname+document.location.pathname.replace('following', 'followers')+'?page='+page+'&per_page=20' }).done(function(data){ var match = data.match(/Dribbble\.PlayerCards\.update\({"id":\d+,"users":(\[.*?\])/), arr = JSON.parse(match[1]); for (var i = 0; i < arr.length; i++) { setFollowed(arr[i].id); } fetchActive = false; curPage++; }).fail(function(data){ if (data.status == 404) { fullFetchFinished = true; return; } if (data.status == 403) { alert('Request limit exceeded. Wait one minute and refresh page.'); return; } }); } function setFollowed(id) { followers.push(id); } function setFollowedAll() { for (var i = 0; i < followers.length; i++) { var userBlock = $('.user-row-'+followers[i]); if (userBlock.hasClass('follows')) { continue; } userBlock.addClass('follows'); var title = userBlock.find('.hover-card-parent'); title.html(' '+title.html()); } } var interval = setInterval(function(){ if (fullFetchFinished) { clearInterval(interval); return; } if (!fetchActive) { getPage(curPage); } }, 250); setInterval(setFollowedAll, 500); }); })();