renamed devtools page and js
parent
a2f56c6639
commit
6c018b51bb
@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<script src="js/devtools.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<script src="js/devtoolsBackground.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -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");
|
@ -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"
|
||||
);
|
Reference in New Issue