Skip to content

Commit

Permalink
Adding getHiddenFriendIds function to be used by eternal. was broken …
Browse files Browse the repository at this point in the history
…after last check in - couldn't hide anybody bc the ids were undefined.
  • Loading branch information
aac committed Jan 12, 2011
1 parent f009637 commit 47383ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jQuery(document).ready(function(){
hiddenFriends = JSON.parse(localStorage.hiddenFriends);

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.action == "getHiddenFriends")
sendResponse({hiddenFriends: getHiddenFriends()})
if (request.action == "getHiddenFriendIds")
sendResponse({hiddenFriends: getHiddenFriendIds()})
else
sendResponse({}); // snub them.
});
Expand All @@ -22,7 +22,8 @@ function addHiddenFriend(id)
debugger;
details["id"] = data.id;
details["name"]= data.name;
details["slug"]= data.link.substring(data.link.lastIndexOf("/")+1);
if (typeof(data.link) != 'undefined')
details["slug"]= data.link.substring(data.link.lastIndexOf("/")+1);

hiddenFriends.push(details);
storeFriends();
Expand All @@ -43,6 +44,13 @@ function getHiddenFriends()
return hiddenFriends;
}

function getHiddenFriendIds()
{
return jQuery.map(hiddenFriends, function(element, index){
return element.id;
});
}

function storeFriends()
{
localStorage.hiddenFriends=JSON.stringify(hiddenFriends);
Expand Down
2 changes: 1 addition & 1 deletion eternal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function filter(element)
//element.bgColor='red';
}

chrome.extension.sendRequest({action: "getHiddenFriends"}, function(response) {
chrome.extension.sendRequest({action: "getHiddenFriendIds"}, function(response) {
hiddenIds = response.hiddenFriends;
});

Expand Down

0 comments on commit 47383ee

Please sign in to comment.