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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 }, | 155 }, |
156 | 156 |
157 setPref: function(pref, value) | 157 setPref: function(pref, value) |
158 { | 158 { |
159 Prefs[pref] = value; | 159 Prefs[pref] = value; |
160 }, | 160 }, |
161 | 161 |
162 forceUpdateCheck: function(eventName) | 162 forceUpdateCheck: function(eventName) |
163 { | 163 { |
164 checkForUpdates(true, _triggerEvent.bind(null, eventName)); | 164 checkForUpdates(true, _triggerEvent.bind(null, eventName)); |
| 165 }, |
| 166 |
| 167 getRequire: function(requireName) |
| 168 { |
| 169 // Just go 2 levels deep to avoid cycles |
| 170 var module = require.scopes[requireName]; |
| 171 var requireString = "{"; |
| 172 for (var prop in module) |
| 173 { |
| 174 if (typeof(module[prop]) == "object") |
| 175 { |
| 176 requireString += prop + ": "; |
| 177 } |
| 178 else if ((typeof(module[prop]) == "function") || (module[prop] == null)) |
| 179 { |
| 180 requireString += prop + ": " + module[prop]; |
| 181 } |
| 182 else |
| 183 { |
| 184 requireString += prop + ": \"" + module[prop] + "\""; |
| 185 } |
| 186 var hasSubProperties = false |
| 187 if (typeof(module[prop]) == "object") |
| 188 { |
| 189 requireString += " {"; |
| 190 for (var innerProp in module[prop]) |
| 191 { |
| 192 if ((typeof(module[prop][innerProp]) == "function") || (module[prop]
[innerProp] == null)) |
| 193 { |
| 194 requireString += innerProp + ": " + module[prop][innerProp] + ","; |
| 195 } |
| 196 else |
| 197 { |
| 198 requireString += innerProp + ": \"" + module[prop][innerProp] + "\
","; |
| 199 } |
| 200 } |
| 201 requireString = requireString.replace(/,+$/, ""); |
| 202 requireString += "}"; |
| 203 } |
| 204 requireString += ","; |
| 205 } |
| 206 requireString = requireString.replace(/,+$/, ""); |
| 207 requireString += "}"; |
| 208 requireString = requireString.replace(/(\r\n|\n|\r)/gm, ""); |
| 209 return requireString; |
165 } | 210 } |
| 211 |
166 }; | 212 }; |
167 })(); | 213 })(); |
OLD | NEW |