summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoCommentsScript.java
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore/damlengine/TodoCommentsScript.java')
-rw-r--r--org/madore/damlengine/TodoCommentsScript.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/org/madore/damlengine/TodoCommentsScript.java b/org/madore/damlengine/TodoCommentsScript.java
new file mode 100644
index 0000000..224d547
--- /dev/null
+++ b/org/madore/damlengine/TodoCommentsScript.java
@@ -0,0 +1,26 @@
+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);
+ }
+}