From 0bd836e915e9fa040ece76308df5048138391e36 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 30 Apr 2016 18:28:33 +0000 Subject: [PATCH] Added rough SVG support. Added doctypes to all of my HTML, and tried to fix some CSS issues that happened as a result. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3223 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/auth.html | 1 + core/client.js | 15 +++++++++++++++ core/edit.html | 23 +++++++++++------------ core/index.html | 39 +++++++++++++++++++-------------------- core/style.css | 17 +++++++++++------ 5 files changed, 57 insertions(+), 38 deletions(-) diff --git a/core/auth.html b/core/auth.html index df1178dd..6a7de194 100644 --- a/core/auth.html +++ b/core/auth.html @@ -1,3 +1,4 @@ + Auth diff --git a/core/client.js b/core/client.js index d03930f1..abc609b3 100644 --- a/core/client.js +++ b/core/client.js @@ -171,6 +171,19 @@ function print(terminal, data) { autoScroll(terminal); } +function printSvg(container, data, name, namespace) { + var node = document.createElementNS("http://www.w3.org/2000/svg", name); + for (var i in data.attributes) { + node.setAttribute(i, data.attributes[i]); + } + if (data.children) { + for (var i in data.children) { + node.appendChild(printSvg(node, data.children[i], data.children[i].name)); + } + } + return node; +} + function printStructured(container, data) { if (typeof data == "string") { container.appendChild(document.createTextNode(data)); @@ -197,6 +210,8 @@ function printStructured(container, data) { if (data.name) { node.setAttribute("id", "iframe_" + data.name); } + } else if (data.svg) { + node = printSvg(container, data.svg, "svg"); } else if (data.image) { node = document.createElement("img"); node.setAttribute("src", data.image); diff --git a/core/edit.html b/core/edit.html index 1b77cd8c..ad342b94 100644 --- a/core/edit.html +++ b/core/edit.html @@ -1,3 +1,4 @@ + Web Terminal @@ -10,18 +11,16 @@ - -
-
- - - - - - -
- - + + + + diff --git a/core/index.html b/core/index.html index 7b1982d2..c55b41ac 100644 --- a/core/index.html +++ b/core/index.html @@ -1,3 +1,4 @@ + Tilde Friends @@ -6,26 +7,24 @@ - -
- -
-
- - > - -
- + + +
+
+ + > + +
+ diff --git a/core/style.css b/core/style.css index 8249b619..262ca684 100644 --- a/core/style.css +++ b/core/style.css @@ -1,24 +1,29 @@ +html { + width: 100%; + height: 100%; + padding: 0; + margin: 0; +} + body { font-family: monospace; background-color: #002b36; color: #eee8d5; -} - -#body { - display: flex; - flex-flow: column; width: 100%; height: 100%; + padding: 0; + margin: 0; } .navigation { height: auto; - width: 100%; + margin: 4px; } #terminals { flex: 1; flex-flow: column; + margin: 4px; } #logo {