Skip to content

Commit

Permalink
all functions working
Browse files Browse the repository at this point in the history
  • Loading branch information
nsimmonds committed Nov 8, 2012
1 parent b7e19c9 commit 23121bb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
53 changes: 28 additions & 25 deletions mailscripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,42 @@ var def;
var mailUrl;
var port = chrome.extension.connect({name: "localStorage"})

function changeDefaults(string){
switch (string) {
case "g":
mailUrl = gMailUrl;
// Gmail uses a different subject identifier
subject = gMailSub;
break;

case "y":
mailUrl = yMailUrl;
break;

case "l":
mailUrl = lMailUrl;
break;

case "o":
mailUrl = owaUrl;
break;

// use Gmail as the default option, just in case.
default:
mailUrl = gMailUrl;
subject = gMailSub;
}
}

port.onMessage.addListener(function(storage){
if (storage.toggle == "on")
tog = true
else
tog = false
def = storage["default"]
changeDefaults(def)
})

switch (def) {
case "g":
mailUrl = gMailUrl;
// Gmail uses a different subject identifier
subject = gMailSub;
break;

case "y":
mailUrl = yMailUrl;
break;

case "l":
mailUrl = lMailUrl;
break;

case "o":
mailUrl = owaUrl;
break;

// use Gmail as the default option, just in case.
default:
mailUrl = gMailUrl;
subject = gMailSub;
}

port.postMessage({sendMe: "localStorage"})

// note (for debugging/learning purposes) that the function above doesn't fire until
Expand Down
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},

"permissions": [
"*://*/*"
"*://*/*",
"contextMenus"
],

"icons": {
Expand Down
3 changes: 1 addition & 2 deletions preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
}
</style>
</head>
<body>
<script src="options.js">
</script>
<script src="toggle.js"></script>
<body>
<img src="bigicon.png" />
<p>Select the webmail providers you use:</p>
<input type="checkbox" id="gmail"/> Gmail<br />
Expand Down
1 change: 1 addition & 0 deletions toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ chrome.browserAction.onClicked.addListener(function (tab) {
}
chrome.extension.getBackgroundPage().window.location.reload();
for (tab in chrome.tabs){
console.log(tab.id)
chrome.tabs.reload(tab.id)
}
})
Expand Down

0 comments on commit 23121bb

Please sign in to comment.