Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request (and patch) : shift+click to expand all #30

Closed
grippon opened this issue Oct 8, 2015 · 8 comments
Closed

Feature request (and patch) : shift+click to expand all #30

grippon opened this issue Oct 8, 2015 · 8 comments

Comments

@grippon
Copy link

grippon commented Oct 8, 2015

I propose that when you click while pressing Shift, it un/expands all the children "arrows".

I already have the code for old krumo, which seems to be still working.
Maybe there is a better way in naming and method.
(krumo.toggleAll is adapted from Arialdo Martini's code on a sourceforge ticket)

In krumo.js, add these 2 functions

    krumo.toggleAll = function(el) {
            var ul = el.parentNode.getElementsByTagName('ul');
            var parentMode = (ul[0].parentNode.style.display == 'none')
                                    ? 'block'
                                    : 'none';

            for (var i=0; i<ul.length; i++) {
                            ul[i].parentNode.style.display = parentMode;

            }
    }

    krumo.clique = function(event,el) {
        if (event.shiftKey) krumo.toggleAll(el);
        else krumo.toggle(el);
    }

In class.krumo.php, change the function called on onclick

    krumo.toggle(this);

with

    krumo.clique(event, this);
@scottchiefbaker
Copy link
Collaborator

ExpandAll() functionality already exists in krumo by double clicking the footer of a krumo window. The part that says "called from...".

Implementing shift click might also be doable, I'll have to think about it. Do you want both functionalities, or is the double-click event enough?

@scottchiefbaker
Copy link
Collaborator

Actually this is good code... I like your clique() function. I'll implement this after we figure out the object traces in #29

@grippon
Copy link
Author

grippon commented Oct 9, 2015

I see double-click doesn't make the same thing, it expands all krumo on all the page.

I only want to unfold a sub-branch.

For example if you start on your example page with your krumos closed, and you shift+click the first krumo ("line 15"), it will unfold the Object TestException, the trace array and its item 0, but will not touch the second krumo with the array ("line 16").

@scottchiefbaker
Copy link
Collaborator

That was a bug... I fixed it here:

http://www.perturb.org/tmp/krumo-test.php

This rolls both the shift+click and the exception tracing in to one demo. If it does what do you want I'll commit it.

@grippon
Copy link
Author

grippon commented Oct 12, 2015

Thanks

No, they don't do the same thing.

Shift+click must be available for each element which has children, only open / close all of its children, it does not impact the other lines or parent object.

For example, if i shift click the line Exceptiontrace, i want it to open/close fully (item 0 and its args, file, function, line), not to close the full Array.

@scottchiefbaker
Copy link
Collaborator

@grippon been a couple years and I just re-read this. It was quiet at work today so I took a look at this request again. Writing vanilla javascript selectors is a pain, but I think I got it.

http://www.perturb.org/tmp/krumo-test.php

Tell if that does what you want it to

@scottchiefbaker
Copy link
Collaborator

Code is in my repo here, if you want to test your own installation.

https://github.com/scottchiefbaker/krumo/tree/fix_countable

@scottchiefbaker
Copy link
Collaborator

Addressed in the just released v0.6.0.

Note: It's ctrl + click (not shift)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants