LEFT | RIGHT |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 let {hook} = require("hooks"); | 5 let {hook} = require("hooks"); |
6 let {application, addonName} = require("info"); | 6 let {application, addonName} = require("info"); |
7 | 7 |
8 let functionHooks = new WeakMap(); | 8 let functionHooks = new WeakMap(); |
9 | 9 |
10 exports.removeFromWindow = function(window) | 10 exports.removeFromWindow = function(window) |
(...skipping 11 matching lines...) Expand all Loading... |
22 case "url-fixer": | 22 case "url-fixer": |
23 { | 23 { |
24 // URL Fixer | 24 // URL Fixer |
25 exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) t
rue; | 25 exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) t
rue; |
26 | 26 |
27 break; | 27 break; |
28 } | 28 } |
29 case "adblockplus": | 29 case "adblockplus": |
30 { | 30 { |
31 // Adblock Plus | 31 // Adblock Plus |
| 32 let {Prefs} = require("prefs"); |
| 33 |
| 34 // Do not ask to opt-in if user found setting |
| 35 if (!Prefs.correctTyposAsked) |
| 36 { |
| 37 let onPrefChange = function(name) |
| 38 { |
| 39 if (name == "correctTypos") |
| 40 { |
| 41 Prefs.correctTyposAsked = true; |
| 42 Prefs.removeListener(onPrefChange); |
| 43 } |
| 44 } |
| 45 |
| 46 Prefs.addListener(onPrefChange); |
| 47 } |
| 48 |
32 exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) | 49 exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) |
33 { | 50 { |
34 let {Prefs} = require("prefs"); | |
35 | |
36 if (!Prefs.correctTyposAsked && !Prefs.correctTypos) | 51 if (!Prefs.correctTyposAsked && !Prefs.correctTypos) |
37 { | 52 { |
38 let {Utils} = require("utils"); | 53 let {Utils} = require("utils"); |
39 let message = Utils.getString("typo_optin_message").replace(/\?1\?/, dom
ain); | 54 let message = Utils.getString("typo_optin_message").replace(/\?1\?/, dom
ain); |
40 let yes = Utils.getString("typo_optin_yes"); | 55 let yes = Utils.getString("typo_optin_yes"); |
41 let no = Utils.getString("typo_optin_no"); | 56 let no = Utils.getString("typo_optin_no"); |
42 let buttons = [ | 57 let buttons = [ |
43 { | 58 { |
44 label: yes, | 59 label: yes, |
45 accessKey: null, | 60 accessKey: null, |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 }; | 356 }; |
342 | 357 |
343 break; | 358 break; |
344 } | 359 } |
345 default: | 360 default: |
346 { | 361 { |
347 exports.isKnownWindow = function(window) false; | 362 exports.isKnownWindow = function(window) false; |
348 break; | 363 break; |
349 } | 364 } |
350 } | 365 } |
LEFT | RIGHT |