diff --git a/mailscripts.js b/mailscripts.js index 128dc89..35f7d4d 100644 --- a/mailscripts.js +++ b/mailscripts.js @@ -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 diff --git a/manifest.json b/manifest.json index ecd00db..0aa3b07 100644 --- a/manifest.json +++ b/manifest.json @@ -25,7 +25,8 @@ }, "permissions": [ - "*://*/*" + "*://*/*", + "contextMenus" ], "icons": { diff --git a/preferences.html b/preferences.html index 40d3a3f..8675251 100644 --- a/preferences.html +++ b/preferences.html @@ -11,10 +11,9 @@ } +
- -Select the webmail providers you use:
Gmail