Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: background.js

Issue 8787016: Remove "disable inline text-ads" feature (Closed)
Patch Set: Created Nov. 6, 2012, 7:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include.textads.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the Adblock Plus extension, 2 * This file is part of the Adblock Plus extension,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 function setDefaultOptions() 65 function setDefaultOptions()
66 { 66 {
67 function defaultOptionValue(opt, val) 67 function defaultOptionValue(opt, val)
68 { 68 {
69 if(!(opt in localStorage)) 69 if(!(opt in localStorage))
70 localStorage[opt] = val; 70 localStorage[opt] = val;
71 } 71 }
72 72
73 defaultOptionValue("shouldShowIcon", "true"); 73 defaultOptionValue("shouldShowIcon", "true");
74 defaultOptionValue("shouldShowBlockElementMenu", "true"); 74 defaultOptionValue("shouldShowBlockElementMenu", "true");
75 defaultOptionValue("disableInlineTextAds", "false");
76 75
77 // If user had older version installed, get rid of old option 76 // If user had older version installed, get rid of old option
78 if ("specialCaseYouTube" in localStorage) 77 if ("specialCaseYouTube" in localStorage)
79 delete localStorage.specialCaseYouTube; 78 delete localStorage.specialCaseYouTube;
80 if ("experimental" in localStorage) 79 if ("experimental" in localStorage)
81 delete localStorage.experimental; 80 delete localStorage.experimental;
Wladimir Palant 2012/11/06 08:06:11 Please add disableInlineTextAds here to remove the
Felix Dahlke 2012/11/06 08:16:38 Done. I've refactored this a bit.
82 } 81 }
83 82
84 // Upgrade options before we do anything else. 83 // Upgrade options before we do anything else.
85 setDefaultOptions(); 84 setDefaultOptions();
86 85
87 /** 86 /**
88 * Checks whether a page is whitelisted. 87 * Checks whether a page is whitelisted.
89 * @param {String} url 88 * @param {String} url
90 * @param {String} [type] content type to be checked, default is "DOCUMENT" 89 * @param {String} [type] content type to be checked, default is "DOCUMENT"
91 * @return {Filter} filter that matched the URL or null if not whitelisted 90 * @return {Filter} filter that matched the URL or null if not whitelisted
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 sendResponse(collapse); 554 sendResponse(collapse);
556 } 555 }
557 else 556 else
558 sendResponse(false); 557 sendResponse(false);
559 break; 558 break;
560 case "get-domain-enabled-state": 559 case "get-domain-enabled-state":
561 // Returns whether this domain is in the exclusion list. 560 // Returns whether this domain is in the exclusion list.
562 // The page action popup asks us this. 561 // The page action popup asks us this.
563 if(sender.tab) 562 if(sender.tab)
564 { 563 {
565 sendResponse({enabled: !isWhitelisted(sender.tab.url), specialCaseYouTub e: localStorage["specialCaseYouTube"] == "true", disableInlineTextAds: localStor age["disableInlineTextAds"] == "true"}); 564 sendResponse({enabled: !isWhitelisted(sender.tab.url), specialCaseYouTub e: localStorage["specialCaseYouTube"] == "true"});
Wladimir Palant 2012/11/06 08:06:11 Please get rid of specialCaseYouTube as well here
Felix Dahlke 2012/11/06 08:16:38 Done.
566 return; 565 return;
567 } 566 }
568 break; 567 break;
569 case "add-filters": 568 case "add-filters":
570 if (request.filters && request.filters.length) 569 if (request.filters && request.filters.length)
571 { 570 {
572 for (var i = 0; i < request.filters.length; i++) 571 for (var i = 0; i < request.filters.length; i++)
573 FilterStorage.addFilter(Filter.fromText(request.filters[i])); 572 FilterStorage.addFilter(Filter.fromText(request.filters[i]));
574 } 573 }
575 break; 574 break;
(...skipping 20 matching lines...) Expand all
596 refreshIconAndContextMenu(windows[i].tabs[j]); 595 refreshIconAndContextMenu(windows[i].tabs[j]);
597 }); 596 });
598 597
599 // Update icon if a tab changes location 598 // Update icon if a tab changes location
600 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) 599 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
601 { 600 {
602 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"}) 601 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"})
603 if(changeInfo.status == "loading") 602 if(changeInfo.status == "loading")
604 refreshIconAndContextMenu(tab); 603 refreshIconAndContextMenu(tab);
605 }); 604 });
OLDNEW
« no previous file with comments | « no previous file | include.textads.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld