Permalink
Browse files

Adding getHiddenFriendIds function to be used by eternal. was broken …

…after last check in - couldn't hide anybody bc the ids were undefined.
  • Loading branch information...
1 parent f009637 commit 47383ee54c51a698e8aa2d388fb5cdd3c3ef6818 @aac committed Jan 12, 2011
Showing with 12 additions and 4 deletions.
  1. +11 −3 background.js
  2. +1 −1 eternal.js
View
@@ -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.
});
@@ -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();
@@ -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);
View
@@ -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;
});

0 comments on commit 47383ee

Please sign in to comment.