Config share functions

The java script share functions can be called in DOM find/replace dialog and "macro" action. You can select a workspace file or input the java script in the panel.

Config java script library for JSDT

The JSDT (come with WTP 3.x) could help to develope the share functions. Here are the steps:

  1. Download java script API, extract and copy xmlnode.js to a Dynamic/Static Web Project.
  2. Open project properties and select Project Facets in left tree. Ensure JavaScript Toolkit are checked.
  3. Select JavaScript -> Libraries in left tree. Click Add a Library Folder... and select the folder contain xmlnode.js.
Create or open a .js file in the project, set variable to new XMLNode() temporary like following one:
Sample script:
function removeNextSiblingIfBlank(node) {
  node = new XMLNode();
  var nodeNext = node.getNextSibling();
  if (nodeNext != null && nodeNext.getNodeType() == 3) {
    if (nodeNext.getOuterHTML().trim().length == 0) {
      nodeNext.remove();
    }
  }
}
The content assist will display the JSDoc of XMLNode. Just remember to comment/remove the 2nd line before save the file.