Permalink
Browse files

Added https support to options

  • Loading branch information...
1 parent 3cc0822 commit 07d1640315b84006ab30539ab93c31886ae925cb @mhweaver committed Jul 18, 2011
Showing with 7 additions and 2 deletions.
  1. +6 −2 src/background.js
  2. +1 −0 src/options.html
View
@@ -1,7 +1,8 @@
function initOptions() {
defaultOptions = {
'showTooltips': true,
- 'ignoreSelfPosts': false
+ 'ignoreSelfPosts': false,
+ 'allowHttps': false
}
for (key in defaultOptions) {
@@ -353,7 +354,8 @@ mailNotifier = {
}
function setPageActionIcon(tab) {
- if (/^https?:\/\/.*/.test(tab.url)) {
+ var pattern = (localStorage['allowHttps'] == 'true') ? /^https?:\/\/.*/ : /^http:\/\/.*/
+ if (pattern.test(tab.url)) {
var info = redditInfo.url[tab.url]
if (info) {
chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit.png'})
@@ -412,6 +414,8 @@ chrome.extension.onConnect.addListener(function(port) {
if (info) {
if (localStorage['ignoreSelfPosts'] == 'true' && info.is_self) {
console.log('Ignoring self post', info)
+ } else if (/^https:\/\/.*/.test(tab.url) && (localStorage['allowHttps'] == 'false')) {
+ console.log('Https page. Ignoring', info)
} else {
console.log('Recognized page '+tab.url, info)
tabStatus.showInfo(tab.id, info.name)
View
@@ -12,6 +12,7 @@ <h1><img src="/images/shine.svg" alt="logo"/>reddit companion options</h1>
<ul id="options">
<li><input type="checkbox" id="showTooltips"> <label for="showTooltips">show tooltips on buttons</label></li>
<li><input type="checkbox" id="ignoreSelfPosts"> <label for="ignoreSelfPosts">do not auto-display the bar on self posts</label></li>
+ <li><input type="checkbox" id="allowHttps"> <label for="allowHttps">enable companion on https pages</label>
</ul>
</div>
</body>

0 comments on commit 07d1640

Please sign in to comment.