Skip to content

Commit

Permalink
hide preview and promoted content options are now applied live
Browse files Browse the repository at this point in the history
  • Loading branch information
tekool committed Nov 15, 2013
1 parent b23474d commit 60ab9b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions chrome/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function messageListener( request, sender, response )

case 'optionsRequest':
response({
previews: localStorage["previews"] || true,
promoted: localStorage["promoted"] || true
previews: typeof localStorage.previews === "undefined" || localStorage.previews === "true",
promoted: typeof localStorage.promoted === "undefined" || localStorage.promoted === "true"
});
return true;

Expand Down
11 changes: 6 additions & 5 deletions chrome/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ new Function()
sheet,

//The first pass will hide all as default
preview = true,
previews = true,
promoted = true,

show = 'display:inline-block !important',
Expand All @@ -25,7 +25,7 @@ new Function()

function refresh()
{
console.log("refreshed")
console.log("refreshed");
removeRules();

style = document.createElement("style");
Expand All @@ -42,7 +42,7 @@ new Function()
sheet.addRule( rules.videoPreviewOpen, show );

//image and video previews
if( preview )
if( previews )
{
sheet.addRule(rules.imagePreview, hide );
sheet.addRule(rules.videoPreview, hide );
Expand All @@ -67,8 +67,9 @@ new Function()
{
chrome.extension.sendMessage("optionsRequest", function(response)
{
preview = response.preview || true;
promoted = response.promoted || true;
previews = response.previews;
promoted = response.promoted;

refresh();
});
}
Expand Down

0 comments on commit 60ab9b8

Please sign in to comment.