| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 var isFirstRun = false; | 48 var isFirstRun = false; |
| 49 var seenDataCorruption = false; | 49 var seenDataCorruption = false; |
| 50 require("filterNotifier").FilterNotifier.addListener(function(action) | 50 require("filterNotifier").FilterNotifier.addListener(function(action) |
| 51 { | 51 { |
| 52 if (action == "load") | 52 if (action == "load") |
| 53 { | 53 { |
| 54 var importingOldData = importOldData(); | 54 var importingOldData = importOldData(); |
| 55 | 55 |
| 56 var addonVersion = require("info").addonVersion; | 56 var addonVersion = require("info").addonVersion; |
| 57 var prevVersion = localStorage.currentVersion; | 57 var prevVersion = ext.storage.currentVersion; |
| 58 if (prevVersion != addonVersion) | 58 if (prevVersion != addonVersion) |
| 59 { | 59 { |
| 60 isFirstRun = !prevVersion; | 60 isFirstRun = !prevVersion; |
| 61 localStorage.currentVersion = addonVersion; | 61 ext.storage.currentVersion = addonVersion; |
| 62 if (!importingOldData) | 62 if (!importingOldData) |
| 63 addSubscription(prevVersion); | 63 addSubscription(prevVersion); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 // update browser actions when whitelisting might have changed, | 67 // update browser actions when whitelisting might have changed, |
| 68 // due to loading filters or saving filter changes | 68 // due to loading filters or saving filter changes |
| 69 if (action == "load" || action == "save") | 69 if (action == "load" || action == "save") |
| 70 { | 70 { |
| 71 ext.pages.query({}, function(pages) | 71 ext.pages.query({}, function(pages) |
| 72 { | 72 { |
| 73 pages.forEach(refreshIconAndContextMenu); | 73 pages.forEach(refreshIconAndContextMenu); |
| 74 }); | 74 }); |
| 75 } | 75 } |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 // Special-case domains for which we cannot use style-based hiding rules. | 78 // Special-case domains for which we cannot use style-based hiding rules. |
| 79 // See http://crbug.com/68705. | 79 // See http://crbug.com/68705. |
| 80 var noStyleRulesHosts = ["mail.google.com", "mail.yahoo.com", "www.google.com"]; | 80 var noStyleRulesHosts = ["mail.google.com", "mail.yahoo.com", "www.google.com"]; |
| 81 | 81 |
| 82 function removeDeprecatedOptions() | 82 function removeDeprecatedOptions() |
| 83 { | 83 { |
| 84 var deprecatedOptions = ["specialCaseYouTube", "experimental", "disableInlineT
extAds"]; | 84 var deprecatedOptions = ["specialCaseYouTube", "experimental", "disableInlineT
extAds"]; |
| 85 deprecatedOptions.forEach(function(option) | 85 deprecatedOptions.forEach(function(option) |
| 86 { | 86 { |
| 87 if (option in localStorage) | 87 if (option in ext.storage) |
| 88 delete localStorage[option]; | 88 delete ext.storage[option]; |
| 89 }); | 89 }); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Remove deprecated options before we do anything else. | 92 // Remove deprecated options before we do anything else. |
| 93 removeDeprecatedOptions(); | 93 removeDeprecatedOptions(); |
| 94 | 94 |
| 95 var activeNotification = null; | 95 var activeNotification = null; |
| 96 | 96 |
| 97 // Adds or removes browser action icon according to options. | 97 // Adds or removes browser action icon according to options. |
| 98 function refreshIconAndContextMenu(page) | 98 function refreshIconAndContextMenu(page) |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 page.sendMessage({type: "clickhide-deactivate"}); | 483 page.sendMessage({type: "clickhide-deactivate"}); |
| 484 refreshIconAndContextMenu(page); | 484 refreshIconAndContextMenu(page); |
| 485 }); | 485 }); |
| 486 | 486 |
| 487 setTimeout(function() | 487 setTimeout(function() |
| 488 { | 488 { |
| 489 var notificationToShow = Notification.getNextToShow(); | 489 var notificationToShow = Notification.getNextToShow(); |
| 490 if (notificationToShow) | 490 if (notificationToShow) |
| 491 showNotification(notificationToShow); | 491 showNotification(notificationToShow); |
| 492 }, 3 * 60 * 1000); | 492 }, 3 * 60 * 1000); |
| OLD | NEW |