Computer User
Computer User

Reputation: 2869

"collapse all" all nodes in one click in firefox or chrome

Any way to "collapse all" all nodes in one click in firefox or chrome and then able to search a node's name and then quickly see its path/tree of parent nodes? First collapse not just top node, but all child nodes, and when I search for a node then it opens only that tree of nodes. I want this because I search a node in a big xml file. The node is present many times under different paths of parent nodes and I need to see the path of the node where ever it appears. Right now I have to manually traverse whole file and collapse many times to find all paths of that node that is present many times in a file. Any quick way of doing it?

Upvotes: 17

Views: 10180

Answers (2)

user9264959
user9264959

Reputation:

To collapse all XML nodes in Chrome, execute this in your JavaScript console

var nodes = document.getElementsByClassName("button collapse-button");
for (var i = 0; i < nodes.length; i++) {
    nodes[i].click();
}

Upvotes: 14

mrfree
mrfree

Reputation: 151

If firefox or chrome are not a strict requirement, I suggest geany, in particular its pretty-printer plugin. With it you can simply format the file in a human-friendly way, fold and un-fold all elements in a single click and so on.

If you are on debian or ubuntu:

sudo apt-get install geany geany-plugin-prettyprinter

Upvotes: 4

Related Questions