Use comments instead of spans to markup theme calls

danieljames - April 6, 2009 - 22:28
Project:Devel
Version:6.x-1.x-dev
Component:devel_themer
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I think it's possible to mark the theme calls using comments instead of spans. This would mangle the markup less than the current implementation. The javascript could walk the document tree finding these comments to display the same information as it currently does.

I've attached a rough demonstration of the idea. It's not for review as the implementation is currently quite ugly, uncommented and lacks most of the current functions, but it does let you see the information for a theme call that you've clicked on (but not its parents, it also doesn't show the red outlines as you hover over the page and doesn't show the root page call). I hope it demonstrates how this could work. I'd like to know what you think of it before I continue working on this and try to write a decent implementation.

AttachmentSize
devel_themer.patch8.93 KB

#1

jjeff - April 8, 2009 - 12:53

Hi Daniel,

Both Moshe and I think this is VERY cool! Yes! Please finish your implementation.

You'll find that the rest of the Javascript code (most of which I wrote) is probably more ugly and uncommented than what I saw in your patch. So feel free to clean it up as you see fit.

I had originally written the Javascript with a minimum of commenting in order to keep the size down. However, these days, I've been using the online YUI compressor to create a .min.js version of BeautyTips. And that allows me to comment the code thoroughly. I think we should switch over to this method for the Theme Developer code too... But that's probably a different issue.

So if you're looking for encouragement, here it is... go! do it! awesome! :-)

#2

jeff h - May 11, 2009 - 02:22

Now THAT is a fine idea... I am CONSTANTLY turning theme dev on and off because it breaks every theme I've ever written.

#3

quicksketch - May 20, 2009 - 19:34
Status:active» needs work

I'd love to see this added also, it would signficantly cut down on the strange behavior caused by Devel Themer's extra markup.

#4

moshe weitzman - May 28, 2009 - 02:52

Yeah, I'd love to see us go this way too. Help wanted.

#5

danieljames - June 2, 2009 - 15:20

Sorry I haven't done much on this. I've been busy with other things. I've attached where I'm currently at, although it's got some problems. It deals quite badly with some markup, I think I can improve this by placing the outlines adjacent to the the nodes they cover in the dom (so it they're in, say, an 'overflow: scroll' they'll scroll with the nodes). It's also quite slow on complicated pages - I can hopefully deal with this by looking at the location of less elements in the Dom.

AttachmentSize
devel.patch 14.76 KB

#6

danieljames - June 2, 2009 - 15:51

Alternatively, here's a much cruder but perhaps more effective implementation. It works by replacing the comments with span tags when you activate the theme developer. This does pretty much what the old version does to the markup, but only when it's turned on. It also messes up any javascript on the page but it might be possible to work around that by walking the dom as I did in the other version.

AttachmentSize
devel.patch 3.93 KB

#7

moshe weitzman - July 7, 2009 - 13:22

Any progress here?

 
 

Drupal is a registered trademark of Dries Buytaert.