Skip to content

Commit

Permalink
Fixed Chrome JavaScript.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-osman committed Jan 19, 2012
1 parent 9bf8ec8 commit f40822f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 32 deletions.
3 changes: 3 additions & 0 deletions chrome/auth.js
@@ -0,0 +1,3 @@
// Send the hash to complete the authorization
chrome.extension.sendRequest({ command: 'authorize',
hash: window.location.hash });
27 changes: 0 additions & 27 deletions chrome/auth_complete.html

This file was deleted.

11 changes: 9 additions & 2 deletions chrome/background.html
Expand Up @@ -11,9 +11,16 @@
StackAlert.PerformUpdate();

// Listen for requests to update the data
chrome.extension.onRequest.addListener(function() {
chrome.extension.onRequest.addListener(function(request, sender) {

StackAlert.PerformUpdate();
// The command to perform is listed in request
if(request.command == 'update')
StackAlert.PerformUpdate();
else if(request.command == 'authorize') {
StackAlert.CompleteAuthorization(request.hash);
chrome.tabs.remove(sender.tab.id);
StackAlert.PerformUpdate();
}

});

Expand Down
13 changes: 11 additions & 2 deletions chrome/manifest.json
@@ -1,6 +1,6 @@
{
"name": "Stack Alert",
"version": "0.18",
"version": "0.21",
"description": "Monitors the inbox of a Stack Exchange account for new items.",
"icons": { "16": "icon16.png",
"48": "icon48.png",
Expand All @@ -13,7 +13,16 @@
"default_icon": "badge.png",
"popup": "popup.html"
},
"content_scripts": [
{
"matches": ["https://stackexchange.com/oauth/login_success*"],
"js": ["auth.js"]
}
],

"permissions": [
"https://api.stackexchange.com/"
"https://api.stackexchange.com/",
"notifications",
"tabs"
]
}
2 changes: 1 addition & 1 deletion common/stackalert.js
Expand Up @@ -432,7 +432,7 @@ var StackAlert = {
button.addEventListener('click', function() {

StackAlert.ResetError();
window.reload();
location.href = location.href;

}, true);

Expand Down

0 comments on commit f40822f

Please sign in to comment.