package org.madore.damlengine; import org.w3c.dom.*; public final class TodoCommentsScript extends TodoElement { public TodoCommentsScript(Element node, Context ctx, TodoItem caller) { super(node, ctx, caller); } @Override public void handle() { if ( ctx.gc.commentsJSParam == null ) { node.getParentNode().removeChild(node); return; } Element script = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "script"); script.setAttributeNS(null, "type", "text/javascript"); script.setAttributeNS(null, "src", "/cgi-bin/numcomments.pl/x.js?"+ctx.gc.commentsJSParam); script.setAttributeNS(null, "defer", "defer"); node.appendChild(ctx.doc.createComment(" EMPTY ")); node.getParentNode().replaceChild(script, node); } }