Skip to main content
Participant
May 29, 2008
Question

Help Creating an Extension, pls.

  • May 29, 2008
  • 1 reply
  • 406 views
Hi,

I'm trying to create a new toolbar-triggered function from within Dreamweaver, but I'm a little lost. I'm hoping someone experienced with the DW API could point me in the right direction.

Basically, I want to be able to collapse all of the functions on a page with the click of a button.

Specifically, when I click the button, I want to traverse the code page, find any instances of the word "function", skip ahead to the first opening bracket ("{", and then execute the balanceBracesTextView() and collapseSelectedCodeFragment() functions. Then I want to repeat until the end of the document and/or no more functions are found.

I've figured out the balanceBracesTextView() and collapseSelectedCodeFragment() functions and have those successfully tied to a custom code view toolbar button. However, I'm lost when it comes to taking it to the next level.

I'd be very grateful if someone could provide some guidance on how I can 1) traverse the document to find each instance of the word "function", and 2) subsequently advance the cursor to the first bracket after each hit. No need to go into the mechanics of how to create an extension; I just need help with the JavaScript that makes this work.

Many thanks,
Steve

This topic has been closed for replies.

1 reply

Participating Frequently
June 5, 2008
Did you get any answer about that?

Apha-Ground - Wallpapers, videos and Games