| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 var AdblockPlus = { | 1 var AdblockPlus = (function() |
| 2 require: function(param) | 2 { |
| 3 var scopes = | |
| 4 { | |
| 5 prefs: | |
| 3 { | 6 { |
| 4 if (param == "prefs") | 7 Prefs: {documentation_link: ""} |
| 8 }, | |
| 9 utils: | |
| 10 { | |
| 11 Utils: {appLocale: ""} | |
| 12 }, | |
| 13 filterClasses: | |
| 14 { | |
| 15 Filter: | |
| 16 { | |
| 17 fromText: | |
| 5 { | 18 { |
| 6 return { | 19 matches: function(param) {return true} |
| 7 Prefs: | 20 } |
|
Felix Dahlke
2014/07/16 11:05:17
Indentation is still off here :P
| |
| 8 { | 21 } |
| 9 documentation_link: "" | |
| 10 } | |
| 11 } | |
| 12 } | |
| 13 if (param == "utils") | |
| 14 { | |
| 15 return { | |
| 16 Utils: | |
| 17 { | |
| 18 appLocale: "" | |
| 19 } | |
| 20 } | |
| 21 } | |
| 22 if (param == "filterClasses") | |
| 23 { | |
| 24 return { | |
| 25 Filter: | |
| 26 { | |
| 27 fromText: function(param) | |
| 28 { | |
| 29 return { | |
| 30 matches: function(param) { | |
| 31 return true; | |
| 32 } | |
| 33 } | |
| 34 } | |
| 35 } | |
| 36 } | |
| 37 } | |
| 38 return {}; | |
| 39 } | 22 } |
| 40 } | 23 }; |
| 41 | 24 |
| 42 function initWrappers() | 25 var result = |
| 43 { | 26 { |
| 44 AdblockPlus.getMessage = function(section, param) | 27 require: function(module) |
| 45 { | 28 { |
| 46 return window.Settings.GetMessage(section, param); | 29 return scopes[module]; |
| 47 } | 30 } |
| 48 Prefs.documentation_link = window.Settings.GetDocumentationLink(); | 31 }; |
| 49 Utils.appLocale = window.Settings.GetAppLocale(); | 32 |
| 50 } | 33 window.addEventListener("load", function() |
| 34 { | |
| 35 result.getMessage = function(section, param) | |
|
Felix Dahlke
2014/07/16 11:05:17
Simpler:
result.getMessage = Settings.GetMessage;
Oleksandr
2014/07/16 11:19:41
This doesn't work. Settings.GetMessage is a method
Felix Dahlke
2014/07/18 12:43:36
Oh :P
| |
| 36 { | |
| 37 return Settings.GetMessage(section, param); | |
| 38 } | |
| 39 scopes.prefs.Prefs.documentation_link = Settings.GetDocumentationLink(); | |
| 40 scopes.utils.Utils.appLocale = Settings.GetAppLocale(); | |
| 41 }, false); | |
| 42 | |
| 43 return result; | |
| 44 })(); | |
| OLD | NEW |