diff options
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r-- | org/madore/damlengine/TodoDamlElement.java | 22 | ||||
-rw-r--r-- | org/madore/damlengine/included.css | 99 | ||||
-rw-r--r-- | org/madore/damlengine/included.js | 56 |
3 files changed, 177 insertions, 0 deletions
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java index 9885f36..7e0faee 100644 --- a/org/madore/damlengine/TodoDamlElement.java +++ b/org/madore/damlengine/TodoDamlElement.java @@ -2,6 +2,10 @@ package org.madore.damlengine; import java.util.ArrayList; import java.util.regex.Pattern; +import java.io.Reader; +import java.io.InputStreamReader; +import java.io.BufferedReader; +import java.io.IOException; import org.w3c.dom.*; public final class TodoDamlElement extends TodoDefaultElement { @@ -50,7 +54,25 @@ public final class TodoDamlElement extends TodoDefaultElement { ctx.headNode.appendChild(ctx.doc.createTextNode("\n")); ctx.styleContent = new StringBuffer(); + try { + Reader rd = new BufferedReader(new InputStreamReader(DamlEngine.class.getResourceAsStream("included.css"), "UTF-8")); + int ch; + while ((ch = rd.read()) > -1) + ctx.styleContent.append((char)ch); + rd.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } ctx.scriptContent = new StringBuffer(); + try { + Reader rd = new BufferedReader(new InputStreamReader(DamlEngine.class.getResourceAsStream("included.js"), "UTF-8")); + int ch; + while ((ch = rd.read()) > -1) + ctx.scriptContent.append((char)ch); + rd.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } Element meta; meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta"); diff --git a/org/madore/damlengine/included.css b/org/madore/damlengine/included.css new file mode 100644 index 0000000..ff9d538 --- /dev/null +++ b/org/madore/damlengine/included.css @@ -0,0 +1,99 @@ +body { + color: black; + font-family: Optima, "Zapf Humanist", Palatino, "Palatino Linotype", serif; +} +h1,h2,h3,h4,h5,h6 { + font-family: Futura, "Century Gothic", "Avant Garde", "Avant Garde Gothic", Helvetica, Arial, sans-serif; +} +h1 { color: rgb(0,128,0); } +h2 { color: rgb(96,96,0); } +h3 { color: rgb(96,64,0); } +.title { text-align: center; } +.subtitle { + font-size: 1.5em; text-align: center; + font-family: Futura, "Century Gothic", "Avant Garde", "Avant Garde Gothic", Helvetica, Arial, sans-serif; + color: rgb(24,96,0); +} +.navbar { + font-size: .83em; + font-family: "Times Roman", Times, "Times New Roman", serif; +} +.ffii-call { + clear: both; + color: red; + font-size: 1.7em; + font-family: Helvetica, Arial, sans-serif; + text-align: center; + border: outset; +} +.important { font-weight: bold; border: solid; padding: 1em; } +.outset { border: outset; padding-left: 0.5em; padding-right: 0.5em; } +.sidenote { font-size: .83em; } +.weblog-entry-header { color: rgb(128,64,0); } +.weblog-entry-header > a { color: inherit; } +.weblog-entry-title { + color: black; + font-size: 1.17em; + font-weight: bold; + font-family: Futura, "Avant Garde", Helvetica, Arial, sans-serif; +} +.talkback-link { + color: rgb(128,64,0); font-size: 0.83em; text-align: right; font-family: Futura, "Avant Garde", Helvetica, Arial, sans-serif; + margin-bottom: 0pt; +} +.talkback-link > a { color: inherit; } +.sitemap-note { + font-style: italic; + color: rgb(96,0,0); +} +.idlist > dt { color: rgb(96,64,0); } +.numtable td { text-align: right; } +.noparskip p { margin-top: 0; margin-bottom: 0; } +.cleared { clear: both; } +.cleared-left { clear: left; } +.cleared-right { clear: right; } +.pic { float: left; margin-right: 1em; margin-bottom: 1em; } +.pic-right { float: right; margin-left: 1em; margin-bottom: 1em; } +.pic-embed { float: left; margin-right: 1em; margin-bottom: 1em; margin-top: 1em; } +.pic-embed-right { float: right; margin-left: 1em; margin-bottom: 1em; margin-top: 1em; } +.smiley { vertical-align: middle; } +.separated { margin-top: 2.33em; } +a { text-decoration: none; } +:lang(en) > q { quotes: "\201C" "\201D" "\2018" "\2019"; } +:lang(fr) > q { quotes: "\AB\A0" "\A0\BB" "\201C" "\201D"; } +q:before { content: open-quote; } +q:after { content: close-quote; } +li { -moz-float-edge: content-box; } /* Undo Mozilla buggy bugware! */ +/* For despammed email addresses */ +@media all { /* Hide from various buggy browsers! */ + .subreplace-full-stop:before { content: "."; } + .subreplace-full-stop > img { display: none; } + .subreplace-commercial-at:before { content: "@"; } + .subreplace-commercial-at > img { display: none; } +} +/* Screen-specific rules */ +@media screen { + body { background: rgb(192,208,224); } + .navbar { + background: rgb(224,192,192); + border: solid; border-color: rgb(224,0,0); + padding: 1em; + float: right; margin-left: 1.33em; + } + .important { + background: rgb(208,208,208); + border-color: rgb(255,0,0); + } + .weblog-entry { + background: rgb(224,224,192); + border: solid; border-color: rgb(128,64,0); + padding: 1em; margin-bottom: 1em; + overflow: hidden; + } + .outset { background: rgb(192,224,208); } + .ffii-call { background: rgb(192,224,208); } + :link { color: rgb(0,0,192); } + :visited { color: rgb(96,0,192); } + .weblog-internal-link:link,.weblog-internal-link:visited { color: rgb(0,64,192); } + :link:hover,:visited:hover { text-decoration: underline; } +} diff --git a/org/madore/damlengine/included.js b/org/madore/damlengine/included.js new file mode 100644 index 0000000..7aa2a2b --- /dev/null +++ b/org/madore/damlengine/included.js @@ -0,0 +1,56 @@ +var textNodeType; +function textContent(n) { + if ( n.nodeType == textNodeType ) { + return n.data; + } else { + var children = n.childNodes; + var t = ""; + for ( var i=0 ; i<children.length ; i++ ) { + t = t.concat(textContent(children.item(i))); + } + return t; + } +} +function despam() { + // MSIE seems to barf... Deactivate for now + if ( (/MSIE *[1-6]\./).test(navigator.userAgent) ) + return; + // Now replace as appropriate. + var elts = document.getElementsByTagName("span"); + for ( var i=0 ; i<elts.length ; i++ ) { + var elt = elts.item(i); + if ( elt.className == "replace-commercial-at" ) { + elt.parentNode.replaceChild(document.createTextNode("@"),elt); + i--; // Semi-bugware + } else if ( elt.className == "replace-full-stop" ) { + elt.parentNode.replaceChild(document.createTextNode("."),elt); + i--; // Semi-bugware + } + } + // Merge adjacent text nodes. + try { + document.normalize(); // Your DOM is BROKEN! + } catch (exn) { + document.documentElement.normalize(); + } + // Next, process all <a> elements having class="despammed-address". + elts = document.getElementsByTagName("a"); + for ( var i=0 ; i<elts.length ; i++ ) { + var elt = elts.item(i); + if ( elt.className == "despammed-address" ) { + var addr = "mailto:".concat(textContent(elt)); + elt.setAttribute("href",addr); // (abstract) + elt.href = addr; // (semantic) + } + } +} +function onLoad() { + // Start with some bugware... + try { + textNodeType = Node.TEXT_NODE; + } catch (exn) { // Your DOM is BROKEN! + textNodeType = 3; + } + // Now despam email adresses. + despam(); +} |