@leeguoo/pwtk-network-debugger 1.2.27 → 1.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +124 -7
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8093,6 +8093,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8093
8093
|
this.isDragging = false;
|
|
8094
8094
|
this.isResizing = false;
|
|
8095
8095
|
this.dragStart = { x: 0, y: 0 };
|
|
8096
|
+
this.resizeTimeout = null;
|
|
8096
8097
|
this.currentTab = "network";
|
|
8097
8098
|
this.consoleHistory = [];
|
|
8098
8099
|
this.requestsCache = [];
|
|
@@ -8210,8 +8211,14 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8210
8211
|
this.startDrag(e);
|
|
8211
8212
|
});
|
|
8212
8213
|
controls.addEventListener("click", (e) => {
|
|
8213
|
-
|
|
8214
|
-
|
|
8214
|
+
e.stopPropagation();
|
|
8215
|
+
let target = e.target;
|
|
8216
|
+
while (target && target !== controls) {
|
|
8217
|
+
if (target.dataset?.action) break;
|
|
8218
|
+
target = target.parentElement;
|
|
8219
|
+
}
|
|
8220
|
+
const action = target?.dataset?.action;
|
|
8221
|
+
if (!action) return;
|
|
8215
8222
|
switch (action) {
|
|
8216
8223
|
case "clear":
|
|
8217
8224
|
this.clearRequests();
|
|
@@ -8261,6 +8268,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8261
8268
|
});
|
|
8262
8269
|
document.addEventListener("mousemove", this.handleMouseMove.bind(this));
|
|
8263
8270
|
document.addEventListener("mouseup", this.handleMouseUp.bind(this));
|
|
8271
|
+
window.addEventListener("resize", this.handleWindowResize.bind(this));
|
|
8264
8272
|
}
|
|
8265
8273
|
startListening() {
|
|
8266
8274
|
this.interceptor.addListener((request) => {
|
|
@@ -8522,8 +8530,14 @@ Created by Leo (@leeguoo)`);
|
|
|
8522
8530
|
`;
|
|
8523
8531
|
const controls = header.querySelector(".debugger-controls");
|
|
8524
8532
|
controls.addEventListener("click", (e) => {
|
|
8525
|
-
|
|
8526
|
-
|
|
8533
|
+
e.stopPropagation();
|
|
8534
|
+
let target = e.target;
|
|
8535
|
+
while (target && target !== controls) {
|
|
8536
|
+
if (target.dataset?.action) break;
|
|
8537
|
+
target = target.parentElement;
|
|
8538
|
+
}
|
|
8539
|
+
const action = target?.dataset?.action;
|
|
8540
|
+
if (!action) return;
|
|
8527
8541
|
switch (action) {
|
|
8528
8542
|
case "clear":
|
|
8529
8543
|
this.clearRequests();
|
|
@@ -8725,6 +8739,61 @@ Created by Leo (@leeguoo)`);
|
|
|
8725
8739
|
this.isResizing = false;
|
|
8726
8740
|
delete this.container.dataset.resizeDirection;
|
|
8727
8741
|
}
|
|
8742
|
+
handleWindowResize() {
|
|
8743
|
+
if (this.resizeTimeout) {
|
|
8744
|
+
clearTimeout(this.resizeTimeout);
|
|
8745
|
+
}
|
|
8746
|
+
this.resizeTimeout = window.setTimeout(() => {
|
|
8747
|
+
this.adjustPositionForWindowResize();
|
|
8748
|
+
}, 100);
|
|
8749
|
+
}
|
|
8750
|
+
adjustPositionForWindowResize() {
|
|
8751
|
+
const rect = this.container.getBoundingClientRect();
|
|
8752
|
+
const windowWidth = window.innerWidth;
|
|
8753
|
+
const windowHeight = window.innerHeight;
|
|
8754
|
+
let needsAdjustment = false;
|
|
8755
|
+
let newLeft = rect.left;
|
|
8756
|
+
let newTop = rect.top;
|
|
8757
|
+
let newWidth = rect.width;
|
|
8758
|
+
let newHeight = rect.height;
|
|
8759
|
+
if (rect.right > windowWidth) {
|
|
8760
|
+
newLeft = windowWidth - rect.width;
|
|
8761
|
+
needsAdjustment = true;
|
|
8762
|
+
}
|
|
8763
|
+
if (rect.bottom > windowHeight) {
|
|
8764
|
+
newTop = windowHeight - rect.height;
|
|
8765
|
+
needsAdjustment = true;
|
|
8766
|
+
}
|
|
8767
|
+
if (newLeft < 0) {
|
|
8768
|
+
newLeft = 0;
|
|
8769
|
+
needsAdjustment = true;
|
|
8770
|
+
}
|
|
8771
|
+
if (newTop < 0) {
|
|
8772
|
+
newTop = 0;
|
|
8773
|
+
needsAdjustment = true;
|
|
8774
|
+
}
|
|
8775
|
+
if (rect.width > windowWidth) {
|
|
8776
|
+
newWidth = windowWidth - 20;
|
|
8777
|
+
newLeft = 10;
|
|
8778
|
+
needsAdjustment = true;
|
|
8779
|
+
}
|
|
8780
|
+
if (rect.height > windowHeight) {
|
|
8781
|
+
newHeight = windowHeight - 20;
|
|
8782
|
+
newTop = 10;
|
|
8783
|
+
needsAdjustment = true;
|
|
8784
|
+
}
|
|
8785
|
+
if (needsAdjustment) {
|
|
8786
|
+
this.container.style.left = `${newLeft}px`;
|
|
8787
|
+
this.container.style.top = `${newTop}px`;
|
|
8788
|
+
this.container.style.right = "auto";
|
|
8789
|
+
this.container.style.bottom = "auto";
|
|
8790
|
+
if (rect.width > windowWidth || rect.height > windowHeight) {
|
|
8791
|
+
this.container.style.width = `${newWidth}px`;
|
|
8792
|
+
this.container.style.height = `${newHeight}px`;
|
|
8793
|
+
}
|
|
8794
|
+
this.savePosition();
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8728
8797
|
show() {
|
|
8729
8798
|
this.container.style.display = "block";
|
|
8730
8799
|
this.removeReopenButton();
|
|
@@ -8738,7 +8807,7 @@ Created by Leo (@leeguoo)`);
|
|
|
8738
8807
|
const btn = document.createElement("button");
|
|
8739
8808
|
btn.id = "network-debugger-reopen-btn";
|
|
8740
8809
|
btn.className = "debugger-reopen-btn";
|
|
8741
|
-
btn.title = "打开调试面板";
|
|
8810
|
+
btn.title = "打开调试面板 (可拖动)";
|
|
8742
8811
|
btn.textContent = "PWTK";
|
|
8743
8812
|
const pos = this.config.position || "bottom-right";
|
|
8744
8813
|
if (pos.includes("bottom")) {
|
|
@@ -8751,7 +8820,55 @@ Created by Leo (@leeguoo)`);
|
|
|
8751
8820
|
} else {
|
|
8752
8821
|
btn.style.left = "20px";
|
|
8753
8822
|
}
|
|
8754
|
-
|
|
8823
|
+
let isDragging = false;
|
|
8824
|
+
let dragStart = { x: 0, y: 0 };
|
|
8825
|
+
let clickTimer = null;
|
|
8826
|
+
btn.addEventListener("mousedown", (e) => {
|
|
8827
|
+
if (e.button === 0) {
|
|
8828
|
+
isDragging = false;
|
|
8829
|
+
dragStart = { x: e.clientX, y: e.clientY };
|
|
8830
|
+
btn.style.transition = "none";
|
|
8831
|
+
clickTimer = window.setTimeout(() => {
|
|
8832
|
+
isDragging = true;
|
|
8833
|
+
btn.style.cursor = "grabbing";
|
|
8834
|
+
}, 150);
|
|
8835
|
+
e.preventDefault();
|
|
8836
|
+
}
|
|
8837
|
+
});
|
|
8838
|
+
const handleMouseMove = (e) => {
|
|
8839
|
+
if (!isDragging) return;
|
|
8840
|
+
const deltaX = e.clientX - dragStart.x;
|
|
8841
|
+
const deltaY = e.clientY - dragStart.y;
|
|
8842
|
+
const rect = btn.getBoundingClientRect();
|
|
8843
|
+
const newLeft = rect.left + deltaX;
|
|
8844
|
+
const newTop = rect.top + deltaY;
|
|
8845
|
+
const maxX = window.innerWidth - rect.width;
|
|
8846
|
+
const maxY = window.innerHeight - rect.height;
|
|
8847
|
+
const clampedX = Math.max(0, Math.min(maxX, newLeft));
|
|
8848
|
+
const clampedY = Math.max(0, Math.min(maxY, newTop));
|
|
8849
|
+
btn.style.position = "fixed";
|
|
8850
|
+
btn.style.left = `${clampedX}px`;
|
|
8851
|
+
btn.style.top = `${clampedY}px`;
|
|
8852
|
+
btn.style.right = "auto";
|
|
8853
|
+
btn.style.bottom = "auto";
|
|
8854
|
+
dragStart = { x: e.clientX, y: e.clientY };
|
|
8855
|
+
};
|
|
8856
|
+
const handleMouseUp = () => {
|
|
8857
|
+
if (clickTimer) {
|
|
8858
|
+
clearTimeout(clickTimer);
|
|
8859
|
+
clickTimer = null;
|
|
8860
|
+
}
|
|
8861
|
+
if (isDragging) {
|
|
8862
|
+
isDragging = false;
|
|
8863
|
+
btn.style.cursor = "pointer";
|
|
8864
|
+
btn.style.transition = "all 0.3s ease";
|
|
8865
|
+
} else {
|
|
8866
|
+
this.show();
|
|
8867
|
+
}
|
|
8868
|
+
};
|
|
8869
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
8870
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
8871
|
+
btn.style.cursor = "pointer";
|
|
8755
8872
|
document.body.appendChild(btn);
|
|
8756
8873
|
}
|
|
8757
8874
|
removeReopenButton() {
|
|
@@ -8915,7 +9032,7 @@ class NetworkDebugger {
|
|
|
8915
9032
|
this.initialized = true;
|
|
8916
9033
|
logger.consoleDirect(`
|
|
8917
9034
|
╔════════════════════════════════════════╗
|
|
8918
|
-
║ 🔓 PWTK 解密小工具 v1.2.
|
|
9035
|
+
║ 🔓 PWTK 解密小工具 v1.2.28 ║
|
|
8919
9036
|
║ Created by Leo (@leeguoo) ║
|
|
8920
9037
|
║ 技术支持: 请联系 Leo ║
|
|
8921
9038
|
║ 分享服务: curl.bwg.leeguoo.com ║
|