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

Unified Diff: lib/api.js

Issue 11322004: Injecting libadblockplus into IE (libadblockplus side) (Closed)
Patch Set: Created July 29, 2013, 5:38 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/api.js
===================================================================
--- a/lib/api.js
+++ b/lib/api.js
@@ -162,6 +162,52 @@
forceUpdateCheck: function(eventName)
{
checkForUpdates(true, _triggerEvent.bind(null, eventName));
+ },
+
+ getRequire: function(requireName)
+ {
+ // Just go 2 levels deep to avoid cycles
+ var module = require.scopes[requireName];
+ var requireString = "{";
+ for (var prop in module)
+ {
+ if (typeof(module[prop]) == "object")
+ {
+ requireString += prop + ": ";
+ }
+ else if ((typeof(module[prop]) == "function") || (module[prop] == null))
+ {
+ requireString += prop + ": " + module[prop];
+ }
+ else
+ {
+ requireString += prop + ": \"" + module[prop] + "\"";
+ }
+ var hasSubProperties = false
+ if (typeof(module[prop]) == "object")
+ {
+ requireString += " {";
+ for (var innerProp in module[prop])
+ {
+ if ((typeof(module[prop][innerProp]) == "function") || (module[prop][innerProp] == null))
+ {
+ requireString += innerProp + ": " + module[prop][innerProp] + ",";
+ }
+ else
+ {
+ requireString += innerProp + ": \"" + module[prop][innerProp] + "\",";
+ }
+ }
+ requireString = requireString.replace(/,+$/, "");
+ requireString += "}";
+ }
+ requireString += ",";
+ }
+ requireString = requireString.replace(/,+$/, "");
+ requireString += "}";
+ requireString = requireString.replace(/(\r\n|\n|\r)/gm, "");
+ return requireString;
}
+
};
})();
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld