AndZyk Posted November 2, 2017 Share Posted November 2, 2017 Maybe it has been asked before, but when I have TracyDebugger disabled I get this error in the console of my developer tools: Quote Uncaught TypeError: Cannot read property 'DebugPanel' of undefined at window.onload Could this be avoided by a try-catch block? It is not too important, but it would be great to not have this error. And I cannot mention enough how great your module is. It helped me a lot of times. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 2, 2017 Author Share Posted November 2, 2017 Hi @AndZyk - this was actually just fixed yesterday. Please update and let me know if you still have any problems. 1 Link to comment Share on other sites More sharing options...
AndZyk Posted November 2, 2017 Share Posted November 2, 2017 You are a mind reader. Now the error is gone, thank you. 1 Link to comment Share on other sites More sharing options...
szabesz Posted November 3, 2017 Share Posted November 3, 2017 17 hours ago, adrian said: So for me, there really is no noticeable difference in load times. But we have seen discrepancies like this before. I remember when kongondo had really slow load times with the three objects in this panel, but it didn't affect you at all. Could you maybe determine which one of these three is causing the main slowdown? If it's "Config Data", then I would suggest just disabling that and using the Console panel and doing: d($config) whenever you want that info. I had the time to do some testing, here it comes (my MAMP Pro): API variables: 0.3ms Core Classes: 0.4ms Config Data: 270ms Version List: 14ms API variables + Core Classes + Admin Link + Doc Links: 0.9ms The result of d($config) is: Frontend:syntax error, unexpected end of file File: .../site/assets/cache/TracyDebugger/consoleCode.php:2 1: <?php if(!defined("PROCESSWIRE")) die("no direct access"); $page = $pages->get(1); 2: d($config) Admin: Same as above + 500: Internal Server Error: See the browser dev console for the actual error Why? It used to work. BTW, links in this Info panel do not not use _blank, why? I keep forgetting it which is kinda annoying after while. Is it just me? 1 Link to comment Share on other sites More sharing options...
adrian Posted November 3, 2017 Author Share Posted November 3, 2017 6 hours ago, szabesz said: The result of d($config) is: Frontend:syntax error, unexpected end of file You're missing the line ending semicolon d($config); So it looks like "Config Data" is the culprit on your setup. I don't really know why it's so slow for you, and I don't really know how to improve it. Anyone else seeing that? If others chime in with a similar experience, I'll see what I can do, but I think for the moment it's probably best to just disable that and use d($config); as needed. 6 hours ago, szabesz said: BTW, links in this Info panel do not not use _blank, why? I keep forgetting it which is kinda annoying after while. Is it just me? I used to be all about _blank links, but these days I actually find them annoying because they give you no choice. A normal link lets you choose - I have three-finger / midd-click setup for open in new tab. If you are finding it that annoying though, I'd be happy to add a config setting to make all those PW Info panel icon links optionally open in a new tab - just let me know. 1 Link to comment Share on other sites More sharing options...
szabesz Posted November 3, 2017 Share Posted November 3, 2017 (edited) 19 minutes ago, adrian said: You're missing the line ending semicolon Double bother I need to think, think, think harder next time This is the first time I see these errors, probably I got intimidated... 19 minutes ago, adrian said: If you are finding it that annoying though, I'd be happy to add a config setting to make all those PW Info panel icon links optionally open in a new tab - just let me know. Yes please! 19 minutes ago, adrian said: and use d($config); The problem with this that I get the result in a not too tall box with lots of scrolling an clicking and the presentation of it is not as "good" as the one with the panel. What if there was a way to put custom settings onto the Panel Selector? Meaning module settings could be enabled/disabled for the Panel Selector, those one happens to switch on/of often. Currently I have no idea how the UI could be implemented for this, so this is just a blurry thought at this time. Edited November 3, 2017 by szabesz typo 1 Link to comment Share on other sites More sharing options...
adrian Posted November 3, 2017 Author Share Posted November 3, 2017 2 hours ago, szabesz said: Yes please! Ok, I'll take care of that shortly - just keep in mind that I won't be adding "_blank" to the Login/Logout, Clear Session & Cookies, and Modules Refresh links, because these are actions that are designed to reload the same page once they complete, but I think all the others will be ok with an option for "_blank". 2 hours ago, szabesz said: The problem with this that I get the result in a not too tall box with lots of scrolling an clicking and the presentation of it is not as "good" as the one with the panel. What if there was a way to put custom settings onto the Panel Selector? Meaning module settings could be enabled/disabled for the Panel Selector, those one happens to switch on/of often. Currently I have no idea how the UI could be implemented for this, so this is just a blurry thought at this time. Honestly I think this is starting to sound a little too complex. i have already added the Enable/Disable Strict Mode option, but I think I think it could get out of control if we're not careful. I'd really like to know why $config is so slow for you - how long does the Console panel response take when doing d($config); ? Just wondering if it's rendering $config itself that's the problem, or something about the way it is done in the PW Info panel that could be improved. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 5, 2017 Author Share Posted November 5, 2017 A quick update. Thanks to lots of help from @szabesz we have fixed the issue with the Config Data section in PW Info panel from being slow. The latest version also: 1) Fixes a ERR_BLOCKED_BY_XSS_AUDITOR browser error if there are <script> tags in your template file and you are using the Template Editor panel to test code changes. 2) Adds a new option for opening links from the PW Info panel in a new browser tab (off by default) - this was requested by @szabesz above. 3) Revamped the init() and ready() code so that much less code is processed when Tracy is completely or temporarily disabled. It also improves efficiency for various conditional checks. 4) Several other minor tweaks / fixes. Please let me know if you come across any problems with this new version. 4 Link to comment Share on other sites More sharing options...
szabesz Posted November 6, 2017 Share Posted November 6, 2017 @adrian This morning I quickly crafted my own version of the "TracyEnableButton" in order to see if a smaller version can be made. The idea is that – in such small sizes the icons are used – using only lines should be enough to get very similar results. Of course, when an icon like this is enlarged its line only characteristics become prominent but I do not think it is an issue in our case. So here it comes: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54.48 57.24"><defs><style>.a{fill:none;stroke:#CD1818;stroke-miterlimit:10;stroke-width:8px;}</style></defs><title>turn-off</title><path class="a" d="M24,10.17a23.24,23.24,0,1,0,16,0" transform="translate(-4.76 -2)"/><line class="a" x1="27.24" x2="27.24" y2="21"/></svg> Only 323 characters versus 1101 (current icon). What do you think? Is it usable, and if so worth the effort? I could produce all the others if you think it is a good idea. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 6, 2017 Author Share Posted November 6, 2017 6 hours ago, szabesz said: @adrian This morning I quickly crafted my own version of the "TracyEnableButton" in order to see if a smaller version can be made. The idea is that – in such small sizes the icons are used – using only lines should be enough to get very similar results. Of course, when an icon like this is enlarged its line only characteristics become prominent but I do not think it is an issue in our case. So here it comes: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54.48 57.24"><defs><style>.a{fill:none;stroke:#CD1818;stroke-miterlimit:10;stroke-width:8px;}</style></defs><title>turn-off</title><path class="a" d="M24,10.17a23.24,23.24,0,1,0,16,0" transform="translate(-4.76 -2)"/><line class="a" x1="27.24" x2="27.24" y2="21"/></svg> Only 323 characters versus 1101 (current icon). What do you think? Is it usable, and if so worth the effort? I could produce all the others if you think it is a good idea. I like where you are headed with this and I think the new version looks nice. The only thing I wonder is whether it is worth re-crafting all the icons vs just running them through SVGO (which I should really have already done). I just used the online GUI for this test. I just tried and it reduced it to 501 characters: <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 44.8 44.8"> <g fill="#CD1818"> <path d="M22.4 21.2c2 0 4-1.8 4-4V4c0-2-2-3.8-4-3.8s-4 1.7-4 3.8v13.5c0 2 2 4 4 4z"/> <path d="M30.7 3.3c-.5-.2-1 0-1.4.2-.5.3-.7.7-.7 1.3v5c0 .6.3 1.2.7 1.4 4.2 2.4 7 7 7 12 0 7.7-6.2 14-14 14-7.6 0-13.8-6.3-13.8-14 0-5 3-9.6 7-12 .4-.2.7-.8.7-1.3V4.4c0-.6-.2-1-.7-1.3C15 3 14.5 3 14 3 6.6 6.6 1 14 1 23c0 12.3 9.7 22 21.6 22 12 0 21.6-9.6 21.6-21.6 0-9-5.4-16.6-13.3-20z"/> </g> </svg> So there is definitely significant room for improvement with these icons. It's just a question of whether it's worth going the "line only" route, or just using SVGO to optimize the existing ones. Honestly I think most of the icons could do with some work - many of them are pretty ugly If you feel like taking this on, it would definitely be appreciated. Anyone else have any thoughts? 1 Link to comment Share on other sites More sharing options...
szabesz Posted November 6, 2017 Share Posted November 6, 2017 (edited) 1 hour ago, adrian said: It's just a question of whether it's worth going the "line only" route, or just using SVGO to optimize the existing ones. Line-only versions are harder to do right because of its nature and limitations but I was thinking about going crazy with optimization regarding how much is injected into the page. 1 hour ago, adrian said: worth re-crafting all the icons vs just running them through SVGO By removing the probably not needed <title>turn-off</title> from my version (it was just exported too, as the name of the file was "turn-off") we have only 300 characters. Probably this is not the one where we can gain a lot but more complex ones like logos and such. 1 hour ago, adrian said: If you feel like taking this on, it would definitely be appreciated. I would be happy to do it. It is probably not worth forcing us to use line-only svg when more complex icons are needed but some of then (like this turn on/off icon called EnableButton) looks doable. Others might just need SVGO treatment I focused on EnableButton because I would like to see less in the source code of a frontend page when Tracy is disabled. So something like this (removing some line breaks) would be nice too: <style>div#TracyEnableButton{bottom:10px!important;right:10px!important;z-index:99999!important;position:fixed!important;width:16px!important;height:16px!important;margin:0px!important;padding:0px!important;cursor:pointer!important;}div#TracyEnableButtonsvg{width:16px!important;height:16px!important;}</style> I often use the Chrome extension called Quick source viewer which displays the actual rendered output in a different way then the inspector. For the styles I get the line breaks but if you could remove them we would get a more compact version injected. Edited November 6, 2017 by szabesz fix: So something like this (removing some line breaks) would be nice too: 1 Link to comment Share on other sites More sharing options...
adrian Posted November 6, 2017 Author Share Posted November 6, 2017 All sounds great @szabesz The other possibility here is to use FontAwesome icons as much as possible. I recently added it for loading the icons for the new "Custom Links" section in the PW Info panel. Although it is only loaded if you have defined some custom links. Because you guys can add a link to any page (admin Process or frontend) on the site, this was the only way to show the appropriate icon automatically. Not sure if this is a better or worse approach in terms of resources. Obviously Fontawesome isn't super lightweight, but it's also not embedding the SVG directly into the panels, so maybe more efficient? 14 minutes ago, szabesz said: I focused on EnableButton because I would like to see less in the source code of a frontend page when Tracy is disabled. So I this removing some line break would be nice too: Sounds like a good idea - I'll sort that out. 1 Link to comment Share on other sites More sharing options...
szabesz Posted November 6, 2017 Share Posted November 6, 2017 1 hour ago, adrian said: Obviously Fontawesome isn't super lightweight, but it's also not embedding the SVG directly into the panels, so maybe more efficient? That reminds me of this tool I've somewhat forgotten about: http://fontello.com/ More efficient? Hard to tell... Maybe a custom set? 1 hour ago, adrian said: Sounds like a good idea - I'll sort that out. Thanks in advance! Link to comment Share on other sites More sharing options...
tpr Posted November 6, 2017 Share Posted November 6, 2017 I was about to suggest fontello but ten icons weighted about 10 kbyte, so 1 per char which seems heavier than svgs. Of course more or other chars can be perhaps less heavy. Another option could be using unicode characters as icons but I'm not sure there are enough of them and browsers may display them differently. That would be super light though. 1 Link to comment Share on other sites More sharing options...
szabesz Posted November 6, 2017 Share Posted November 6, 2017 6 minutes ago, tpr said: browsers may display them differently Do you have any idea where it can be looked up? I mean, where we can check what is probably(?) supported by most modern OSes/browsers these days? It would be interesting to know. I guess the "cross-platform" typefaces are more or less the same as they have ever been but those font files seem to keep growing by added characters as the OSes evolve. Link to comment Share on other sites More sharing options...
adrian Posted November 6, 2017 Author Share Posted November 6, 2017 I like the idea of unicode icons, but I am also not convinced that browser support is that consistent. I have seen screenshots of the Tracy console for example where the history back/forward icons don't look good. Also, I agree that there aren't enough options for our needs. Something like a fontello custom set might be ok, but in general I have always thought that plain SVG icons were lighter, so I think I'd prefer to go with those I think. I wonder how much this really matters - is it over-optimization to be worrying about this? Link to comment Share on other sites More sharing options...
matjazp Posted November 6, 2017 Share Posted November 6, 2017 https://unicode-table.com/en/ but I guess not enough options... Link to comment Share on other sites More sharing options...
netcarver Posted November 6, 2017 Share Posted November 6, 2017 @adrian Ah, git tags at last. Nice. 2 Link to comment Share on other sites More sharing options...
Robin S Posted November 7, 2017 Share Posted November 7, 2017 Hi @adrian, I struck a problem trying to use bd() inside $sanitizer->pageNameUTF8(). If I add a bd() call to pageNameUTF8() like this... public function pageNameUTF8($value) { bd($value, 'value'); //... ...and then trigger the method like this... $test = $sanitizer->pageNameUTF8('foo'); ...then everything is fine so far and works as expected. But as soon as I add the following to /site/config.php $config->pageNameCharset = 'UTF8'; ...then I get an error: Quote Fatal error: Uncaught Error: Call to undefined function ProcessWire\bd() in D:\Websites\__www\1testing\wire\core\Sanitizer.php:456 Any idea why this happens? Link to comment Share on other sites More sharing options...
adrian Posted November 7, 2017 Author Share Posted November 7, 2017 37 minutes ago, Robin S said: Any idea why this happens? I think it's simply a matter of the order of things. Without the pageNameCharset being set in config, the first call to the pageNameUTF8() sanitizer method is after init(), but when you set it, it must call that sanitizer method before Tracy has loaded. I did ask Ryan a long while back about the possibility of being able to load Tracy earlier - he said he might be amenable, but nothing ever came of it. I just did some experiments loading the Tracy core files in the root index.php and with that setup, your bd() call still works, even with: $config->pageNameCharset = 'UTF8'; I'd like to revisit this idea with Ryan - I have come across bd() undefined many times when trying to use them in the PW core files - it would be great to have Tracy loaded before anything else. I wonder if a request for this might be more powerful initiated by someone other than myself? 1 Link to comment Share on other sites More sharing options...
szabesz Posted November 9, 2017 Share Posted November 9, 2017 (edited) @adrian Hi, I scanned the "docs" and could not find this tip of yours:https://github.com/processwire/processwire-issues/issues/429#issuecomment-342976462 sounds like an important one. Could you please consider adding it? Also, AJAX instructions are mostly in the Getting Started section which is fine but probably a dedicated "Debugging AJAX" or maybe "Working with AJAX" section with links to other related tips found on the page and additional tips like the one above would be nice to have. Edited November 9, 2017 by szabesz header name idea fix 3 Link to comment Share on other sites More sharing options...
adrian Posted November 9, 2017 Author Share Posted November 9, 2017 Hey @szabesz - I really need to start the docs again from scratch. I have butchered that blog post so badly with new additions and most of the screenshots are really old. I'd really like to start a Github wiki for docs - @tpr has inspired me with the amazing job he has done on the docs for his modules using the wiki. The problem of course is time. I am already spending way too much time on module development and support and not enough time on paid client work - not meant to be an excuse, just a reality. And there are lots of others here putting in just as much time! I'd love to dedicate more time to PW module development, but of course that would mean paid modules - what to do ? Maybe the Tracy docs could be a team effort - anyone interested? The problem is that there is no easy way to enable PRs on Gitbub wikis, although this might work: http://www.growingwiththeweb.com/2016/07/enabling-pull-requests-on-github-wikis.html Any thoughts? 3 Link to comment Share on other sites More sharing options...
szabesz Posted November 9, 2017 Share Posted November 9, 2017 13 minutes ago, adrian said: anyone interested? +1 13 minutes ago, adrian said: The problem is that there is no easy way to enable PRs on Gitbub wikis, although this might work I'm not fond of unsupported "hacky" solutions but it is just me Maybe a dedicated tool instead? I just googled a bit: https://www.penflip.com/ There could be alternatives, of course. 1 Link to comment Share on other sites More sharing options...
bernhard Posted November 9, 2017 Share Posted November 9, 2017 i don't know how the guys from uikit are doing it but they have nice docs and it seems that everybody can post suggestions (there is an edit button on all pages): https://getuikit.com/docs/icon it's unbelievable how much you contributed to the community so far - a donation button would be the least imho. i've already asked you for that some time ago 3 Link to comment Share on other sites More sharing options...
szabesz Posted November 9, 2017 Share Posted November 9, 2017 5 minutes ago, bernhard said: i've already asked we 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts