forked from rapheld/ember_inspector
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configured properly for the latest version of Chrome.
- Loading branch information
Showing
3 changed files
with
43 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |