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

Ability to drag out kint output to a pop up window for future reference and whatnot #46

Closed
raveren opened this issue Feb 12, 2013 · 12 comments

Comments

@raveren
Copy link
Contributor

raveren commented Feb 12, 2013

window.open(
    'data:text/html;base64,'
    + window.btoa(
        unescape(
            encodeURIComponent(
                document.documentElement.innerHTML
            )
        )
    )
);

Instead of document.documentElement use needed Kint nodes along with something along the lines of document.querySelectorAll('script')[0].innerHTML.

@aljinovic
Copy link
Contributor

I implemented this feature in my fork. Base64 was a bad idea because it breaks browser when there's a lot of debug data, so I implemented it this way:

newWindow = window.open();
if(newWindow) {
    newWindow.document.open();
    newWindow.document.write(html);
    newWindow.document.close();
}

I fixed some compatibility issues with older PHP versions that don't support "static::" and "$var::" static calls.

Also, I fixed the bug with _stepIsInternal() method: didn't detect call_user_func_array inside Kint class as internal when short functions were called.

Result: http://www.opengluco.com/demo/kint/demo.php

Raveren, I'll make a pull request in 1.0.0-wip branch if you think this is OK.

Could you just tell me which minifier script you're using for .js so I can minify it again before merge since there are some changes inside also. Thanks!

@raveren
Copy link
Contributor Author

raveren commented Oct 22, 2013

Wow, dude, that is terrific! Sure, please do a pull request, these changes are totally awesome.

I use a custom File Watchers Php storm plugin config, parameters of which are at the top of _kint.js (I know this sucks, I need to brush up contribution guidelines heavily).

You can however just use the online compiler on advanced settings and then wrap the output inside (function(){%output%})() - the online tool does not support this configuration option.

@raveren
Copy link
Contributor Author

raveren commented Oct 22, 2013

Even the dumped object in your demo is awesomely crafted to showcase most of Kint features, that's just wonderful :)

@aljinovic
Copy link
Contributor

I was planing of making an interactive demo where you can switch themes and see the actual code behind, if you agree ;)

raveren added a commit that referenced this issue Oct 22, 2013
 * Fixes #46 (implemented "open in new window")
* fixed the bug with `_stepIsInternal()` method which didn't detect call_user_func_array inside ```Kint``` class as internal when short functions were called
* fixed some compatibility issues with older PHP versions that don't support "static::" and "$var::" static calls
@raveren
Copy link
Contributor Author

raveren commented Oct 22, 2013

That would be stellar! :)

@aljinovic
Copy link
Contributor

I've created a simple demo with theme switcher: http://www.opengluco.com/demo/kint/demo.php

Any suggestions?

@raveren
Copy link
Contributor Author

raveren commented Oct 23, 2013

Wow you even created a new theme :D Fucking A!

I'm finishing up with my own batch of changes and will comment further tomorrow.

@aljinovic
Copy link
Contributor

My colleague did the theme, he'll make a pull request when it's done.

@raveren
Copy link
Contributor Author

raveren commented Oct 24, 2013

It's lovely, I can't wait to use it myself! :)

I'll be awaiting for the pull request and it would be great if you could put your demo in a new /examples folder and pull request it too, we'll work from there.

Thanks again!

@raveren raveren closed this as completed Oct 24, 2013
@aljinovic
Copy link
Contributor

Did you intentionally change the behavior of "open in new window"?

It dumps the parent if you click on some child (for example open some object and click on it's property to open it in new window and it opens all properties from the object).

Also, there's a small bug there (

  • element):

    bug

  • @raveren
    Copy link
    Contributor Author

    raveren commented Oct 24, 2013

    Thanks, fixed!

    @GlassGruber
    Copy link

    Hey there, sorry to bump a closed thread but was wondering if this could be the default behavior for Kint.
    Instead of being printed in the page directly, a new javascript window is opened with something like this

    window.open(
      '', 
      'Kint Window', 
      "height=500,width=500,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1",true
    ).document.write(kintOutput);
    

    Does it make sense?

    Btw is it possible to detach the already implemented pop out to a new window instead of a browser tab? Is there any config to allow this?

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

    No branches or pull requests

    3 participants