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

Side by Side Diff: lib/typoRules.js

Issue 6695604965081088: Issue 2549 - Fix documentation generation for URL Fixer (Closed)
Patch Set: Created May 18, 2015, 7:46 p.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 | « lib/typoFixer.js ('k') | metadata.gecko » ('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 URL Fixer, 2 * This file is part of the URL Fixer,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * URL Fixer is free software: you can redistribute it and/or modify 5 * URL Fixer 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 * URL Fixer is distributed in the hope that it will be useful, 9 * URL Fixer 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 14 matching lines...) Expand all
25 let CUSTOM_RULE_PRIORITY = 0x7FFFFFFF; 25 let CUSTOM_RULE_PRIORITY = 0x7FFFFFFF;
26 26
27 let rules = {expressions: []}; 27 let rules = {expressions: []};
28 28
29 loadRules(); 29 loadRules();
30 30
31 // Make first attempt to update rules after five minutes 31 // Make first attempt to update rules after five minutes
32 let updateTimer = null; 32 let updateTimer = null;
33 updateTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); 33 updateTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
34 updateTimer.initWithCallback(onTimer, 1000 * 60 * 5, Ci.nsITimer.TYPE_REPEATING_ SLACK); 34 updateTimer.initWithCallback(onTimer, 1000 * 60 * 5, Ci.nsITimer.TYPE_REPEATING_ SLACK);
35 onShutdown.add(function() updateTimer.cancel()); 35 onShutdown.add(() => updateTimer.cancel());
36 36
37 function loadRules() 37 function loadRules()
38 { 38 {
39 loadRulesFrom(Services.io.newFileURI(getRuleFile()).spec, false, function(succ ess) 39 loadRulesFrom(Services.io.newFileURI(getRuleFile()).spec, false, function(succ ess)
40 { 40 {
41 if (!success) 41 if (!success)
42 loadRulesFrom(require("info").addonRoot + "defaults/typoRules.json", true) ; 42 loadRulesFrom(require("info").addonRoot + "defaults/typoRules.json", true) ;
43 }); 43 });
44 } 44 }
45 45
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND) 89 if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND)
90 Cu.reportError(e); 90 Cu.reportError(e);
91 callback(false); 91 callback(false);
92 } 92 }
93 } 93 }
94 94
95 function getRuleFile() 95 function getRuleFile()
96 { 96 {
97 let result = FileUtils.getFile("ProfD", [require("info").addonName + "-rules.j son"]); 97 let result = FileUtils.getFile("ProfD", [require("info").addonName + "-rules.j son"]);
98 98
99 getRuleFile = function() result; 99 getRuleFile = () => result;
100 return getRuleFile(); 100 return getRuleFile();
101 } 101 }
102 102
103 function addCustomRules() 103 function addCustomRules()
104 { 104 {
105 for (let domain in Prefs.whitelist) 105 for (let domain in Prefs.whitelist)
106 onWhitelistEntryAdded(domain); 106 onWhitelistEntryAdded(domain);
107 } 107 }
108 108
109 function onWhitelistEntryAdded(domain) 109 function onWhitelistEntryAdded(domain)
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 bestSuggestionDistance = distance; 413 bestSuggestionDistance = distance;
414 bestSuggestionMatched = matchedLen; 414 bestSuggestionMatched = matchedLen;
415 bestSuggestionPriority = priority; 415 bestSuggestionPriority = priority;
416 } 416 }
417 } 417 }
418 if (bestSuggestion) 418 if (bestSuggestion)
419 return input.substr(0, input.length - bestSuggestionMatched) + bestSuggestio n; 419 return input.substr(0, input.length - bestSuggestionMatched) + bestSuggestio n;
420 else 420 else
421 return input; 421 return input;
422 } 422 }
OLDNEW
« no previous file with comments | « lib/typoFixer.js ('k') | metadata.gecko » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld