You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
angularjs-batarang/js/devtools.js

54 lines
1.1 KiB
JavaScript

// 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");