Shared publicly  - 
Lazy Plus Thoughts and Possible Feedback

For those that use Chrome Dev Tools, do you use the new Snippets feature?

If so, would it be of use to have certain scripts/snippets auto run? Saving you from manually running the script and thus making them available when ever Dev Tools is opened?

As i have been going through Webkit's inspector front end code lately and found that ( if my logic is correct ) it is possible  to "autorun" certain snippets. If this seems to be a nice added feature, i will log a feature request with Webkit, else should i have some spare time, attempt the change.

For those interested in the code or a starting point to go digging, the Snippet code can be found here - ( 1 )
The code is nicely layered out / documented so finding necessary methods is relatively simple.

And those interested in my thinking behind it, it is to adjust WebInspector.UISourceCode constructor ( 2 ) to store an "_autoRun" property along with the other scriptFile details. When the snippet, it's details ( path , contentType etc) is stored, the autoRun value is also stored. Then in the WebInspector.SnippetScriptFile method _addScriptSnippet which is called from _loadSnippets , should "_autoRun" be true, execute the run ( "_runScript" ) method. The only thing needed would be to adjust the UI and add a checkbox / settings of some sort per snippet which would update this property.


Update - A Chrome "Bug" report has been filed to add this feature -

#DevTools   #FeatureRequest   #JavaScript  
Christopher J.Churchill's profile photoFred Gandt's profile photoPeter Paul Elfferich's profile photoJesse Sutherland's profile photo
Please do file a crbug for this, Nic. If you're interested in actually implementing the feature, that's even better. Many of the developers I've spoken to who have played with Snippets have been asking for this capability.

cc +Pavel Feldman who may have already considered auto-execution.
Awesome, wasn't sure if developers wanted this. As i have seen requests to look at Syncing the snippets across computers but not this. Will log one and post link so devs can star :)

Will attempt doing the change, but not holding any thumbs for it to work :P
Yes.  Snippets is awesome.  Being able to designate snippets to auto run would be awesomerrr.
Great idea; I've commented on the Chrome Request. Seems like a good addition to our beloved Dev Tools
Hey +Nic da Costa  I'm out in the wild with Dev tools and find it stunning!!
A snippet to extract the exact .css class of a highly nested node would be lovely... 
I'm currently working on Front end volusion store templates and volusion use highly nested tables to display content making my job harder when trying to style just one section of the page... I end up with classes like this: 
#content # content_area> table:nth-child(0) > tbody > tr > td > table > tbody > tr > td

(actual example) 

They also use a one-page layout system  for the whole front end which is also driving me mad I'm ending up with over 50 JS statements like so: 
if( location.href.match("Cat=1826") ) { 
 $(document).ready(function() {
$("# content # content_area > table > tbody > tr > td > table ").css({ width: "580px", top: "-560px", position: "relative" });
$(".featured_sidebar_elearn").css({position: "relative", width: "320px", left: "663px", top: "517px"});
$("#content # content_area > table:nth-child(0) > tbody > tr > td > table > tbody > tr > td").append($(".product_guide_speal").load("Articles.asp?ID=258 .product_guide_speal"));

Srry about the rant just had to get it off my  chest  any way a lovely snippet to run in dev tools to select nested tables or dom nodes would     make my day :D  

+Addy Osmani  when's the next Breakpoint! :D:D 
Sooo it's looking like the next Breakpoint will either be the week of the 5th or the 11th. We'll keep you posted :)
+Kyle Matheny thanks, i think that being able to re-arrange or re-order would be another great addition on managing the current snippets.

+Christopher J.Churchill that sounds like it requires a lot of work!! Hopefully you will be able to create a snippet which will help in the debugging process and eventually auto run this snippet for ease of use!
+Nic da Costa It's driving me mad lately I think I finally have a script to run but having it auto run all the better:D 
Excuse the rant aswell I work from home and the dog doesn't  listen well and no one else seems to understand the work entailed!!!!
I didn't know this existed until Paul Irish shared this post, and have only just found a blog type post explaining what it's for. Now I know I would say that an auto run feature would be handy, although I have yet to actually fiddle with the feature.
Explanatory post thing (for others like me who didn't know etc). >
This might not be the right place for this, but the one feature I'd personally like to see in the Snippets editor is a keyboard shortcut for running the snippet. I was expecting cmd-enter to do this like in FireBug.

On a related note I would expect the Snippets to be more closely tied in with the Console instead of being hidden away under Sources.
Auto-run and dependencies, kinda like Require.js would be great!
Add a comment...