-
Notifications
You must be signed in to change notification settings - Fork 3
/
devtools.js
27 lines (25 loc) · 977 Bytes
/
devtools.js
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
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// The function below is executed in the context of the inspected page.
var page_getProperties = function() {
var data = window.jQuery && $0 ? jQuery.data($0) : {};
// Make a shallow copy with a null prototype, so that sidebar does not
// expose prototype.
var props = Object.getOwnPropertyNames(data);
// var copy = { __proto__: null };
var copy = {};
for (var i = 0; i < props.length; ++i)
copy[props[i]] = data[props[i]];
return copy;
};
chrome.devtools.panels.elements.createSidebarPane(
"Position:Awesome",
function(sidebar) {
function updateElementProperties() {
sidebar.setExpression("(" + page_getProperties.toString() + ")()");
}
updateElementProperties();
chrome.devtools.panels.elements.onSelectionChanged.addListener(
updateElementProperties);
});