commit: 4d716850695b6c94d3c0c007d0ea2c90e529acba
parent 904e46e5000f7e2abb406289d90296a5ca58280d
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Wed, 14 Mar 2018 08:41:20 +1300
Updated Riven tools
Diffstat:
3 files changed, 25 insertions(+), 34 deletions(-)
diff --git a/links/riven.main.css b/links/riven.main.css
@@ -1,5 +1,5 @@
body { padding:20px; background-image: url(../media/assets/grid.svg); background-color:#111; font-family: 'input_mono_medium'; font-size:9px; background-size:20px 20px;}
-svg { padding:50px 10px; width:100%; height:100%; position: fixed; left:0px; top:0px; }
+svg { padding:50px 10px; width:200%; height:150%; position: fixed; left:0px; top:0px; }
svg.magnet { transition: all 250ms }
svg g.node { fill:#777; }
svg g.node text { text-anchor: middle }
@@ -12,9 +12,13 @@ svg path { stroke:white; fill:none; stroke-width:1;stroke-linejoin: round; strok
svg rect { stroke:#fff; stroke-width:1; fill:none; }
svg rect.fill { fill:#111; }
svg text { fill:white; text-transform: uppercase; }
-svg path.route { stroke:#555; stroke-width:2; }
+svg path.route { stroke:#555; stroke-width:2; stroke-dasharray: 50,3; }
svg path.route.request { stroke-dasharray: 5,5; }
-svg path.route.bidirectional { stroke:#33; stroke-dasharray: 0,3; }
+svg path.route.bidirectional { stroke:#33; stroke-dasharray: 0,4; }
svg g:hover text { fill:#72dec2; cursor: pointer; }
-yu { display: none }-
\ No newline at end of file
+yu { display: none }
+
+path.route { stroke-dashoffset: 100; animation: dash 5s linear infinite; }
+path.route.request { stroke-dashoffset: -50; animation: dash 5s linear infinite; }
+@keyframes dash { to { stroke-dashoffset: 0;} }+
\ No newline at end of file
diff --git a/scripts/lib/riven.js b/scripts/lib/riven.js
@@ -10,16 +10,17 @@ function Riven()
function Ø(s,network = RIVEN.network)
{
- if(s.indexOf(" ") > -1){
- var node_id = s.split(" ")[0];
- var port_id = s.split(" ")[1];
+ var id = s.toLowerCase();
+ if(id.indexOf(" ") > -1){
+ var node_id = id.split(" ")[0];
+ var port_id = id.split(" ")[1];
return network[node_id] && network[node_id].ports[port_id] ? network[node_id].ports[port_id] : null;
}
- else if(network[s]){
- return network[s];
+ else if(network[id]){
+ return network[id];
}
else{
- return new Node(s);
+ return new Node(id);
}
}
@@ -108,7 +109,7 @@ function Node(id,rect={x:0,y:0,w:2,h:2})
var port = this.ports[port_id]
for(route_id in port.routes){
var route = port.routes[route_id];
- if(!route || !route.host || route.host.id != target){ continue; }
+ if(!route || !route.host || route.host.id != target.toLowerCase()){ continue; }
return route.host
}
}
diff --git a/scripts/lib/runic.js b/scripts/lib/runic.js
@@ -15,7 +15,8 @@ function Runic(raw)
"*":{glyph:"*",tag:"h2",class:""},
"=":{glyph:"=",tag:"h3",class:""},
"+":{glyph:"+",tag:"hs",class:""},
- ">":{glyph:">",tag:"",class:""}
+ ">":{glyph:">",tag:"",class:""},
+ "$":{glyph:">",tag:"",class:""}
}
this.stash = {
@@ -56,22 +57,6 @@ function Runic(raw)
return `<img src='media/${val}'/>`
}
- this.operation = function(val)
- {
- val = val.replace("$","").trim();
-
- if(val == "desamber"){
- return new Date().desamber();
- }
- if(val == "clock"){
- return new Date().clock();
- }
- if(val.split(" ")[0] == "lietal"){
- return invoke.vessel.lietal.construction(val.replace("lietal","").trim());
- }
- return `((${val}))`
- }
-
this.parse = function(raw = this.raw)
{
if(!raw){ return ""; }
@@ -84,13 +69,13 @@ function Runic(raw)
var char = lines[id].substr(0,1).trim().toString()
var rune = this.runes[char];
var trail = lines[id].substr(1,1);
+ if(char == "$"){ html += "<p>"+Ø("operation").request(lines[id].substr(2)).to_markup()+"</p>"; continue; }
+ if(char == "%"){ html += this.media(lines[id].substr(2)); continue; }
var line = lines[id].substr(2).to_markup();
if(!line || line.trim() == ""){ continue; }
-
if(!rune){ console.log(`Unknown rune:${char} : ${line}`); }
if(trail != " "){ console.warn("Runic","Non-rune["+trail+"] at:"+id+"("+line+")"); continue; }
- if(char == "%"){ html += this.media(line); continue; }
if(this.stash.is_pop(rune)){ html += this.render_stash(); }
if(rune.stash === true){ this.stash.add(rune,line) ; continue; }
html += this.render(line,rune);
@@ -159,13 +144,14 @@ String.prototype.to_markup = function()
var part = parts[id];
if(part.indexOf("}}") == -1){ continue; }
var content = part.split("}}")[0];
- if(content.substr(0,1) == "$"){ html = html.replace(`{{${content}}}`, this.operation(content)); continue; }
- if(content.substr(0,1) == "%"){ html = html.replace(`{{${content}}}`, this.media(content)); continue; }
+ if(content.substr(0,1) == "$"){ html = html.replace(`{{${content}}}`, Ø("operation").request(content.replace("$",""))); continue; }
+ // if(content.substr(0,1) == "%"){ html = html.replace(`{{${content}}}`, this.media(content)); continue; }
var target = content.indexOf("|") > -1 ? content.split("|")[1] : content;
var name = content.indexOf("|") > -1 ? content.split("|")[0] : content;
var external = (target.indexOf("https:") > -1 || target.indexOf("http:") > -1 || target.indexOf("dat:") > -1);
- html = html.replace(`{{${content}}}`,`<a target='${external ? "_blank" : "_self"}' class='${external ? "external" : "local"}' onclick="Ø('query').bang('${target}')">${name}</a>`)
+ html = html.replace(`{{${content}}}`,external ? `<a href='${target}' class='external' target='_blank'>${name}</a>` : `<a class='local' onclick="Ø('query').bang('${target}')">${name}</a>`)
}
return html;
}
+