|
@@ -143,9 +143,27 @@ let isOpen = false;
|
|
|
function clickHandler(e) {
|
|
|
// console.log(jsRequests);
|
|
|
// console.log(oldTarget);
|
|
|
+ console.log("位置:" + getNodePosition(oldTarget))
|
|
|
chrome.runtime.sendMessage({ action: "show_popup", jslist: jsRequests, targe: oldTarget.outerHTML, csslist: myComputedStyle(oldTarget) });
|
|
|
}
|
|
|
|
|
|
+function getNodePosition(element) {
|
|
|
+ let id = "";
|
|
|
+ if (element === document.body) {
|
|
|
+ return "1";
|
|
|
+ } else {
|
|
|
+ let parentNode = element.parentNode;
|
|
|
+ for (let i = 0; parentNode.childNodes.length; i++) {
|
|
|
+ let child = parentNode.childNodes[i];
|
|
|
+ if (child === element) {
|
|
|
+ id = i + "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getNodePosition(element.parentNode) + "-" + id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// window.addEventListener("click", function (e) {
|
|
|
// // e.preventDefault();
|
|
|
// // e.stopPropagation();
|