Skip to content

Commit

Permalink
Oops, fixing the rebase issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mfoulks3200 committed Oct 2, 2022
1 parent 3227508 commit 7e508c7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 187 deletions.
5 changes: 0 additions & 5 deletions media/analyzer.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@
<div class="data-row" keyName="Mime Type" data="mimeType"></div>
<div class="data-row" style="padding-bottom:10px;" keyName="Content Size"
require-data="obj.response.content.size" data="obj.response.content.size"></div>
<<<<<<< HEAD
<div class="code-block shorten" require-value="mimeType=text/*|application/(?!json)"></div>
<div class="json-block tree" require-value="mimeType=application/json"></div>
=======
<div class="code-block shorten" require-value="mimeType=text/*|application/*"></div>
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
<div class="subscript open-new-tab" require-value="mimeType=text/*|application/*">(double click to open in a
new tab)</div>
<img class="img-preview" data-to="src=content" require-value="mimeType=image/*" />
Expand Down
105 changes: 1 addition & 104 deletions media/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ var handledKeystroke = false;
var keystrokeTimeout = true;
const vscode = acquireVsCodeApi();

<<<<<<< HEAD
=======
function runSearchCriteria(reqItem, selectorType, selector, attrName, attrVal) {
if ($(reqItem).attr(attrName) == attrVal && (!$(selectorType + selector).hasClass("selected") && ($(selectorType).hasClass("selected")))) {
$(reqItem).hide();
Expand All @@ -17,36 +15,13 @@ function runSearchCriteria(reqItem, selectorType, selector, attrName, attrVal) {
return false;
}

>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
function runSearch() {
while (visibleIndicies.length > 0) {
visibleIndicies.pop();
}
var i = -1;
$(".request-item").each(function () {
i++;
<<<<<<< HEAD
if ($(this).attr("type") == "GET" && (!$(".method-filter.get").hasClass("selected") && $(".method-filter").hasClass("selected"))) {
$(this).hide();
return;
}
if ($(this).attr("type") == "POST" && (!$(".method-filter.post").hasClass("selected") && $(".method-filter").hasClass("selected"))) {
$(this).hide();
return;
}
if ($(this).attr("type") == "PUT" && (!$(".method-filter.put").hasClass("selected") && $(".method-filter").hasClass("selected"))) {
$(this).hide();
return;
}
if ($(this).attr("type") == "DELETE" && (!$(".method-filter.delete").hasClass("selected") && $(".method-filter").hasClass("selected"))) {
$(this).hide();
return;
}
if ($(this).attr("type") == "PATCH" && (!$(".method-filter.patch").hasClass("selected") && $(".method-filter").hasClass("selected"))) {
$(this).hide();
return;
}
=======
if (runSearchCriteria(this, ".method-filter", ".get", "type", "GET")) { return; }
if (runSearchCriteria(this, ".method-filter", ".post", "type", "POST")) { return; }
if (runSearchCriteria(this, ".method-filter", ".put", "type", "PUT")) { return; }
Expand All @@ -64,7 +39,6 @@ function runSearch() {
if (runSearchCriteria(this, ".req-type-filter", ".pre", "reqtype", "preflight")) { return; }
if (runSearchCriteria(this, ".req-type-filter", ".other", "reqtype", "other")) { return; }

>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
if ($(".search").val().length > 0 && !$(this).attr("endpoint").includes($(".search").val())) {
$(this).hide();
return;
Expand Down Expand Up @@ -108,9 +82,6 @@ function setupGUI() {
$(".page[name='" + $(this).attr("name") + "']").addClass("show");
});

<<<<<<< HEAD
$(".method-filter").off().on("click", function () {
=======
$(".expand-filters").off().on("click", function () {
$(this).toggleClass("expanded");
$(".req-type-filters").toggleClass("expanded");
Expand All @@ -119,7 +90,6 @@ function setupGUI() {
});

$(".method-filter,.req-type-filter").off().on("click", function () {
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
$(this).toggleClass("selected");
runSearch();
});
Expand Down Expand Up @@ -229,21 +199,14 @@ function round(num, place) {
function selectReq(index) {
selectedIndex = index;
selectedReq = reqs[index];
console.log(selectedReq)
$(".request-item.selected").removeClass("selected");
$(".request-item[index='" + index + "']").addClass("selected");
$(".inspector-title").attr("type", selectedReq.method);
$(".inspector-title").attr("endpoint", selectedReq.endpoint);
$(".inspector-title").attr("time", selectedReq.time);
$(".inspector-title").attr("status", selectedReq.status);
$("*[data]:not([round])").each(function () {
<<<<<<< HEAD
if ($(this).attr("data") != null) {
$(this).html(getNested($(this).attr("data")).toString().toHtmlEntities());
}
=======
$(this).html(getNested($(this).attr("data")).toString().toHtmlEntities());
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
});
$("*[data][round]").each(function () {
$(this).html(round(getNested($(this).attr("data")), $(this).attr("round")));
Expand Down Expand Up @@ -326,31 +289,6 @@ function selectReq(index) {
$(this).html(selectedReq.contentShort.toString().toHtmlEntities());
});

<<<<<<< HEAD


$(".json-block.tree").each(function () {
$(this).scrollTop(0);
if (!selectedReq.mimeType.includes("json")) {
return;
}
if (selectedReq.content == null) {
return;
}
var json = selectedReq.content.substring(0, 4) == ")]}'" ? selectedReq.content.substring(4) : selectedReq.content;
console.log(json);
console.log(selectedReq.content.substring(0, 4))
$(this).html("");
generateJSONTree(this, JSON.parse(json), "");
try {
//generateJSONTree(this, JSON.parse(json), "");
} catch {
$(this).html(json.toString().toHtmlEntities());
}
});

=======
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
$(".open-new-tab").off().on("dblclick", function () {
vscode.postMessage({
action: "openNewTab",
Expand All @@ -359,17 +297,6 @@ function selectReq(index) {
});
});

<<<<<<< HEAD
try {
$(".stack").html("");
if (selectedReq.obj._initiator.type == "script") {
for (var i = 0; i < selectedReq.obj._initiator.stack.callFrames.length; i++) {
var frame = selectedReq.obj._initiator.stack.callFrames[i];
const re = new RegExp('(?:.+\/)([^\/?]+)', 'gm');
var URLMatch = re.exec(frame.url);
var file = URLMatch == null ? "" : URLMatch[1];
$(".stack").append(`<tr>
=======
$(".stack").html("");
if (selectedReq.obj._initiator.type == "script") {
for (var i = 0; i < selectedReq.obj._initiator.stack.callFrames.length; i++) {
Expand All @@ -378,47 +305,17 @@ function selectReq(index) {
var URLMatch = re.exec(frame.url);
var file = URLMatch == null ? "" : URLMatch[1];
$(".stack").append(`<tr>
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
<td class="stack-frame-function">`+ (frame.functionName.length == 0 ? "(anonymous)" : frame.functionName) + `</td>
<td class="stack-frame-sID">`+ frame.scriptId + `</td>
<td class="stack-frame-location">(`+ frame.lineNumber + ":" + frame.columnNumber + `)</td>
<td class="stack-frame-file"><div>`+ file + `</div></td>
</tr>`);
}
}
} catch { }
$(".request-inspector").addClass("ready");
}
<<<<<<< HEAD
document.addEventListener("click", function (e) {
if (e.target.classList.contains("tree-label")) {
e.target.parentElement.classList.toggle("expanded")
}
});
function generateJSONTree(element, object, previousPath) {
console.log("Enumerating " + previousPath)
console.log(object)
console.log(element)
Object.keys(object).forEach(function (obj) {
element.insertAdjacentHTML("beforeend", `<div class="tree-object" path="` + previousPath + "." + obj + `"></div>`);

var treeObject = document.querySelector(".tree-object[path='" + previousPath + "." + obj + "']");

if (typeof object[obj] == "object" && object != null && obj != null && object[obj] != null && Object.keys(object[obj]) != null && Object.keys(object[obj]).length > 0) {
treeObject.insertAdjacentHTML("beforeend", `<div class="tree-label" path="` + previousPath + "." + obj + `">` + obj + `</div>`);
generateJSONTree(treeObject, object[obj], previousPath + "." + obj)
} else {
treeObject.insertAdjacentHTML("beforeend", `<div class="tree-label data-row" path="` + previousPath + "." + obj + `" keyname="` + obj + `">` + object[obj] + `</div>`);
//treeObject.insertAdjacentHTML("beforeend", `<div class="tree-value">` + object[obj] + `</div>`);
}
});
$(".request-inspector").addClass("ready");
}

=======
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
function toggleBlockCollapse(block) {
if (block.hasClass("collapsed")) {
block.removeClass("collapsed");
Expand Down
78 changes: 0 additions & 78 deletions media/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ body {
transition: top 0.25s ease;
}

<<<<<<< HEAD
.container.request-inspector {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 50%;
}

=======
.container.request-items.expanded {
top: 98px;
}
Expand All @@ -44,7 +34,6 @@ body {
width: 50%;
}

>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
.request-item {
width: 100%;
padding: 10px;
Expand Down Expand Up @@ -280,21 +269,6 @@ table.stack {
transition: opacity ease 0.2s, transform ease 0.2s;
}

<<<<<<< HEAD
.json-block.tree {
=======
.code-block {
font-family: monospace;
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
padding: 10px;
border-radius: 5px;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
border: 1px solid var(--vscode-editorGroup-border);
}

<<<<<<< HEAD
.code-block {
font-family: monospace;
padding: 10px;
Expand All @@ -305,8 +279,6 @@ table.stack {
border: 1px solid var(--vscode-editorGroup-border);
}

=======
>>>>>>> 5bbfd43 (* Added resource type filters (Closes #1))
.code-block.formatted {
white-space: pre;
}
Expand Down Expand Up @@ -682,56 +654,6 @@ table.stack {
z-index: 99999;
}

.tree-label {
padding-bottom: 0px;
padding-left: 35px;
}

.tree-label:not([keyname]) {
font-weight: bold;
color: var(--vscode-editorLineNumber-foreground);
padding-left: 0px;
padding-bottom: 7px;
}

.tree-object.expanded>.tree-label:not([keyname])::before {
opacity: 0.5;
content: "▼";
user-select: none;
cursor: pointer;
width: 15px;
font-size: 9pt;
display: inline-block;
transform: rotate(0deg);
transform-origin: 6px 6px;
transition: transform 0.25s ease;
}

.tree-object:not(expanded)>.tree-label:not([keyname])::before {
content: "▼";
user-select: none;
cursor: pointer;
width: 15px;
font-size: 9pt;
display: inline-block;
transform: rotate(-90deg);
transform-origin: 6px 6px;
transition: transform 0.25s ease;
}

.tree-object:not(.expanded) div:not(.tree-label) {
display: none;
}

.tree-object div:not(.tree-label) {
padding-left: 15px;
}

.tree-label {
user-select: none;
cursor: pointer;
}

@keyframes load {
from {
left: calc(0% - 40px);
Expand Down

0 comments on commit 7e508c7

Please sign in to comment.