JavaScript in plugins

April 13th, 2009 by HTML-Kit Support      Tags: HTML-Kit Tools       Views: 8012
Support Home     Next: Tools update 20090506.....     Previous: Tools update 20090411
VN:F [1.7.3_972]
Rating: 3.6/5 (11 votes cast)
 

If you code in JavaScript, you can use your JavaScript skills in HTML-Kit Tools plugins to improve the way you use Tools.

Getting Started

Make sure that you’re using HTML-Kit Tools 20090411+.

First plugin in JavaScript

Here are the quick steps:

  1. Select "File > Insert > Add New Snippet" from HTML-Kit Tools main menu.
  2. Enter "My first JavaScript plugin" (or other title) in the "Title" field, and select "JavaScript" for the "Plugin Language."
  3. Type the following JavaScript code in to the "Snippet" field and click "OK" to close the snippet dialog.
     
    var CurrTime = new Date();
    HKit.Write(  "Hello, world! It's "+ CurrTime.toString() );

To test your new snippet plugin, create a new document and select "File > Insert > My first JavaScript plugin" from the main menu.

Caret Action in JavaScript

Here’s how to manipulate selected text with a JavaScript plugin:

  1. Right click inside a document and select "Extra > Edit Caret Actions."
  2. Click "New" to create a new Caret Action.
  3. In "Short name" field enter "jscaretaction1″ (without quotes). Enter "My First JavaScript Caret Action" in "Title" field. Click "OK" to create the new Caret Action.
  4. Paste the following code inside newly created action:
     
    #@begin-text "default" [plang="js"]
    var sSelText = HKit.GetSelText();
    HKit.Write( sSelText.toUpperCase() );
    #@end-text "default"
  5. Click "OK" to save changes.

To test the Caret Action, select some text in the current document and right click while pressing Ctrl key down. Select "My First JavaScript Caret Action" from the menu.

Was this article helpful?
This did not answer my questionThis answered my question (+7 rating, 15 votes)
Loading ... Loading ...
Share this on:
  • Twitter
  • Digg
  • StumbleUpon
  • Facebook
  • MySpace
  • del.icio.us
  • Sphinn
  • LinkedIn
  • Google Bookmarks
  • Live
  • Yahoo! Buzz
  • email
  • Print
 

Comments are closed.

 

© 2009 HTML-Kit.com. All Rights Reserved.  |  Privacy Statement   
HTML design aid