-
Notifications
You must be signed in to change notification settings - Fork 19
/
devtools.html
45 lines (41 loc) · 1.06 KB
/
devtools.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<body>
<script type="text/javascript">
var getSelectedEmberView = function() {
// _V is a global of the selected view for experimentation in the console
_V = undefined;
var level;
function findView(elm, n) {
if (elm == null) { return undefined; }
level = n || 0;
var found = Ember.View.views[elm.id];
if (found == null) {
level++;
found = findView(elm.parentElement, level);
}
return found;
}
var view = findView($0),
data = { __proto__: null };
if (view) {
_V = view;
if (level > 0) { data.distance = level; }
data.id = view.get('elementId');
data.type = view.toString().match(/^<(.*):/)[1];
data.view = view;
}
return data;
};
chrome.experimental.devtools.panels.elements.createSidebarPane(
"Ember View (_V)",
function(sidebar) {
function updatePanel() {
sidebar.setExpression("(" + getSelectedEmberView.toString() + ")()");
}
updatePanel();
chrome.experimental.devtools.panels.elements.onSelectionChanged.addListener(updatePanel);
}
);
</script>
</body>
</html>