Permalink
Browse files

renamed devtools page and js

  • Loading branch information...
1 parent a2f56c6 commit 6c018b51bbe6be461d5e8d07b78c3376685a2694 @btford btford committed Jul 25, 2012
Showing with 51 additions and 59 deletions.
  1. +0 −5 devtools.html
  2. +5 −0 devtoolsBackground.html
  3. +0 −53 js/devtools.js
  4. +45 −0 js/devtoolsBackground.js
  5. +1 −1 manifest.json
View
@@ -1,5 +0,0 @@
-<html>
-<body>
-<script src="js/devtools.js"></script>
-</body>
-</html>
View
@@ -0,0 +1,5 @@
+<html>
+<body>
+<script src="js/devtoolsBackground.js"></script>
+</body>
+</html>
View
@@ -1,53 +0,0 @@
-
-// The function below is executed in the context of the inspected page.
-
-var page_getProperties = function () {
- if (window.angular && $0) {
- var scope = window.angular.element($0).scope();
- window.$scope = scope;
- return (function (scope) {
- var ret = {
- __private__: {}
- };
-
- for (prop in scope) {
- if (scope.hasOwnProperty(prop)) {
- if (prop[0] === '$' && prop[1] === '$') {
- ret.__private__[prop] = scope[prop];
- } else {
- ret[prop] = scope[prop];
- }
- }
- }
- return ret;
- }(scope));
- } else {
- return {};
- }
-};
-
-chrome.
- devtools.
- panels.
- elements.
- createSidebarPane(
- "AngularJS Properties",
- function (sidebar) {
- var selectedElt;
-
- var updateElementProperties = function () {
- sidebar.setExpression("(" + page_getProperties.toString() + ")()");
- }
-
- updateElementProperties();
- chrome.devtools.panels.elements.onSelectionChanged.addListener(updateElementProperties);
- });
-
-// Angular panel
-var angularPanel = chrome.
- devtools.
- panels.
- create(
- "AngularJS",
- "img/angular.png",
- "panel.html");
View
@@ -0,0 +1,45 @@
+var panels = chrome.devtools.panels;
+
+// The function below is executed in the context of the inspected page.
+
+var getPanelContents = function () {
+ if (window.angular && $0) {
+ //TODO: can we move this scope export into updateElementProperties
+ var scope = window.angular.element($0).scope();
+ // Export $scope to the console
+ window.$scope = scope;
+ return (function (scope) {
+ var panelContents = {
+ __private__: {}
+ };
+
+ for (prop in scope) {
+ if (scope.hasOwnProperty(prop)) {
+ if (prop.substr(0, 2) === '$$') {
+ panelContents.__private__[prop] = scope[prop];
+ } else {
+ panelContents[prop] = scope[prop];
+ }
+ }
+ }
+ return panelContents;
+ }(scope));
+ } else {
+ return {};
+ }
+};
+
+panels.elements.createSidebarPane(
+ "AngularJS Properties",
+ function (sidebar) {
+ panels.elements.onSelectionChanged.addListener(function updateElementProperties() {
+ sidebar.setExpression("(" + getPanelContents.toString() + ")()");
+ });
+ });
+
+// Angular panel
+var angularPanel = panels.create(
+ "AngularJS",
+ "img/angular.png",
+ "panel.html"
+);
View
@@ -5,7 +5,7 @@
"background": {
"page": "background.html"
},
- "devtools_page": "devtools.html",
+ "devtools_page": "devtoolsBackground.html",
"manifest_version": 2,
"permissions": [
"tabs",

0 comments on commit 6c018b5

Please sign in to comment.