You can add browser-based analysis to a JS9 Web page by writing a JS9 Plugin module, consisting of a constructor function that gets called for each div of the plugin class, and one or more event callbacks to process the desired events. The this context of the constructor is seeded with a few properties, the most important of which is the div property specifying the DOM element of the containing div. Add your GUI (in the form of HTML elements) to this div and use events to control the action. A plugin is registered using the JS9.RegisterPlugin() public routine.
If the Web page does not contain a div for this plugin class and if the registration routine is passed a viewMenu property specifying a menu name, the plugin will be added to the View menu. In the examples below, the The first two examples define their own static divs for pluginTest. The last instance of JS9 uses the View menu to bring up pluginTest in a light window.
See plugins/plugintest.js for the example plugin code.
An example of a Plugin div element already defined to hold the
Plugin message divs, which will be created by the Plugin constructor.
Load an image, then move the mouse, or create and manipulate a
region, or press a key to see callbacks fire in the blue display region:
|
|
An example of a Plugin div element already defined to hold the
Plugin message divs, which will be created by the Plugin constructor.
Load an image, then move the mouse, or create and manipulate a
region, or press a key to see callbacks fire in the blue display region:
|
|
In this example, no Plugin div element has been defined on the page. It therefore will be offered in the View menu as a light window. Load an image and choose View->pluginTest, then move the mouse, or create and manipulate a region, or press a key to see callbacks fire in the light window. |