Skip to content

Commit

Permalink
Configured properly for the latest version of Chrome.
Browse files Browse the repository at this point in the history
  • Loading branch information
juggy committed Jan 15, 2013
1 parent 93b55be commit a20bdb2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 45 deletions.
42 changes: 1 addition & 41 deletions devtools.html
Original file line number Diff line number Diff line change
@@ -1,45 +1,5 @@
<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>
<script src="devtools.js"></script>
</body>
</html>
41 changes: 41 additions & 0 deletions devtools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(function(){
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.devtools.panels.elements.createSidebarPane(
"Ember View",
function(sidebar) {
function updatePanel() {
sidebar.setExpression("(" + getSelectedEmberView.toString() + ")()");
}

updatePanel();
chrome.devtools.panels.elements.onSelectionChanged.addListener(updatePanel);
}
);
})();
5 changes: 1 addition & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"name": "Ember View Inspector",
"version": "1.1.0",
"description": "Inspector for Zendesk Lotus",
"devtools_page": "devtools.html",
"permissions": [
"experimental"
]
"manifest_version": 2
}

0 comments on commit a20bdb2

Please sign in to comment.