Dribbble Extender

Shows who follows you on your following list

2016/08/04のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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
// ==/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('<span title="Follows you" style="color: #2cff5a;">✓</span> '+title.html());
            }
            
        }
        
        var interval = setInterval(function(){
            if (fullFetchFinished)
            {
                clearInterval(interval);
                return;
            }
            
            if (!fetchActive)
            {
                getPage(curPage);
            }
        }, 250);
        
        setInterval(setFollowedAll, 500);
    });
})();