-
Notifications
You must be signed in to change notification settings - Fork 0
/
dribbble.js
35 lines (31 loc) · 1.24 KB
/
dribbble.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ======================================================================
Dribbble Following Me: JavaScript
----------------------------------------------------------------------
@author: hamish macpherson
@url: http://hami.sh/
----------------------------------------------------------------------
*/
function onResponse(follow)
{
realname = $(".shot-byline-user a").text();
if (follow)
{
imgsrc = chrome.extension.getURL('following.gif');
$(".plugin-follow-status").html("<img title='" + realname + " is following you.' src='" + imgsrc + "' />");
}
else
{
imgsrc = chrome.extension.getURL('notfollowing.gif');
$(".plugin-follow-status").html("<img title='" + realname + " is not following you.' src='" + imgsrc + "' />");
}
}
// Look for our username
username = $(".shot-byline-user a").attr("href").split("/")[1]
current_user = $("#t-profile a").attr("href").split("/")[1]
if (username)
{
imgsrc = chrome.extension.getURL('loading2.gif');
$("<span class='plugin-follow-status'><img src='" + imgsrc + "' /></span>").insertAfter(".follow-prompt");
// Send the request...
chrome.extension.sendRequest({'action' : 'fetchDribbbleFollowing', 'current_user' : current_user, 'username' : username, 'current_page' : 1}, onResponse);
}