Formatting terms.

This commit is contained in:
kor 2018-07-17 00:38:07 +12:00
parent 0d4bb2a405
commit 3a2f06d238
5 changed files with 365 additions and 131 deletions

View File

@ -14,31 +14,63 @@ body {
* { box-sizing: border-box; } * { box-sizing: border-box; }
.optionsPanel { /* MENU */
width: 100px; .menu {
height: 100%; height: 100%;
background:#000; background:#000;
position:fixed; position:fixed;
left: 0px; left: 0px;
top: 0px; top: 0px;
z-index: 100; z-index: 100;
padding-top:20px;
font-size:1.5em;
/*-webkit-transition: width 0.05s ease-in-out; /*-webkit-transition: width 0.05s ease-in-out;
transition: width 0.05s ease-in-out;*/ transition: width 0.05s ease-in-out;*/
} }
.optionsPanel:hover { .menu:hover {
width: 370px; /*width: 370px;*/
/*-webkit-transition: width 0.05s ease-in-out; /*-webkit-transition: width 0.05s ease-in-out;
transition: width 0.05s ease-in-out;*/ transition: width 0.05s ease-in-out;*/
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, .1); /*box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, .1);*/
}
.menu a {
color: #333;
}
.menu:hover a {
color: #999;
}
.menu:hover a:hover {
color: #eee;
}
.menu-item {
height: 50px;
padding-top:10px;
margin-top: 5px;
margin-right: 20px;
}
.menu-item-space {
margin-top: 50px;
}
.menu-item i {
width: 50%;
float: left;
padding: 2px 0 0 25px;
text-align: center;
}
.menu-item .count {
width: 50%;
float: left;
padding: 0 0 0 15px;
text-align: center;
} }
.container { .container {
margin-left: 120px; margin-left: 120px;
} }
.optionsPanel:hover + .container{ /*.menu:hover + .container{
/*transition: 0.05s -webkit-filter ease-in;*/ transition: 0.05s -webkit-filter ease-in;
filter: blur(3px); filter: blur(3px);
} }*/
.grid { .grid {
border: 1px; border: 1px;

View File

@ -304,13 +304,13 @@ GNOSTICISM
KOAN KOAN
PERS : faun PERS : faun
SRCE : Merveilles SRCE : Merveilles
TYPE : term TYPE : list
DATE : 12018-07-04 DATE : 12018-07-04
QOTE : "A paradoxical anecdote or riddle without a solution, used in Zen Buddhism to demonstrate the inadequacy of logical reasoning and provoke enlightenment."
TYPE : quote
TAGS : philosohpy, paradox TAGS : philosohpy, paradox
SEEN : true SEEN : true
REVI : true REVI : true
TERM
> Koan: 'A paradoxical anecdote or riddle without a solution, used in Zen Buddhism to demonstrate the inadequacy of logical reasoning and provoke enlightenment.'
GERMANY POST WW GERMANY POST WW
LINK : https://www.youtube.com/watch?v=DJUf8MxbcdA LINK : https://www.youtube.com/watch?v=DJUf8MxbcdA
@ -449,8 +449,10 @@ LONG-TERM MEMORY
TYPE : article TYPE : article
DATE : 12018-07-06 DATE : 12018-07-06
TAGS : psychology TAGS : psychology
TERM : Anki, Memex TERM
SEEN : false > Anki: memory tool/app. Manually entered questions and answers. The app repeatedly asks you every question, every time you know the answer the duration it waits before asking that question again doubles. If you forget an answer then the wait duration resets to one day.
> Memex: external memory tool. 'Data storage and retrieval system'.
SEEN : true
INDEPENDENCE IN CYBERSPACE INDEPENDENCE IN CYBERSPACE
PERS : ark PERS : ark
@ -461,7 +463,7 @@ INDEPENDENCE IN CYBERSPACE
TAGS : philosophy TAGS : philosophy
SEEN : true SEEN : true
DESIGNING THE MIND OF AN ONLINE CURATOR CURATOR MIND DESIGN
LINK : https://medium.com/@lintropy/murat-pak-designing-the-mind-of-an-online-curator-5785e373127d LINK : https://medium.com/@lintropy/murat-pak-designing-the-mind-of-an-online-curator-5785e373127d
TYPE : article TYPE : article
DATE : 12018-07-06 DATE : 12018-07-06
@ -596,7 +598,8 @@ CIRCULAR ECONOMY
DATE : 12018-07-06 DATE : 12018-07-06
SEEN : true SEEN : true
TAGS : society, economics TAGS : society, economics
TERM : 'Circular economy' TERM
> Circular economy: 'is a regenerative system in which resource input and waste, emission, and energy leakage are minimised by slowing, closing, and narrowing energy and material loops. This can be achieved through long-lasting design, maintenance, repair, reuse, remanufacturing, refurbishing, and recycling. This is in contrast to a linear economy which is a "take, make, dispose" model of production.'
SPACESHIP EARTH ECONOMICS SPACESHIP EARTH ECONOMICS
LINK : http://arachnid.biosci.utexas.edu/courses/THOC/Readings/Boulding_SpaceshipEarth.pdf LINK : http://arachnid.biosci.utexas.edu/courses/THOC/Readings/Boulding_SpaceshipEarth.pdf
@ -729,7 +732,8 @@ GREENSPACE
SRCE : Merveilles SRCE : Merveilles
LINK : https://www.uea.ac.uk/about/-/it-s-official-spending-time-outside-is-good-for-you LINK : https://www.uea.ac.uk/about/-/it-s-official-spending-time-outside-is-good-for-you
TYPE : article TYPE : article
TERM : greenspace TERM
> Greenspace: 'open, undeveloped land with natural vegetation as well as urban greenspaces, which include urban parks and street greenery.'
SEEN : true SEEN : true
DATE : 12018-07-08 DATE : 12018-07-08
TAGS : psychology, economics, env TAGS : psychology, economics, env
@ -979,14 +983,14 @@ FRACTAL FILM CGI
DATE : 12018-07-14 DATE : 12018-07-14
SEEN : false SEEN : false
VORTICAL FLOW + FRACTAL MACHINES VORTICAL + FRACTAL MACHINES
LINK : https://www.fxguide.com/featured/suicide-squad-vortical-flows-and-fractal-machines/ LINK : https://www.fxguide.com/featured/suicide-squad-vortical-flows-and-fractal-machines/
TYPE : article TYPE : article
TAGS : fractal, film TAGS : fractal, film
DATE : 12018-07-14 DATE : 12018-07-14
SEEN : false SEEN : false
VORTICAL FLOW + FRACTAL MACHINES FRACTALS AND ROUGHNESS
LINK : https://www.ted.com/talks/benoit_mandelbrot_fractals_the_art_of_roughness LINK : https://www.ted.com/talks/benoit_mandelbrot_fractals_the_art_of_roughness
TYPE : video TYPE : video
TAGS : fractal, research TAGS : fractal, research
@ -1058,7 +1062,7 @@ SYSTEMS ARE EVERYWHERE
NZ EXCHANGE NZ EXCHANGE
LINK : https://www.tokenroom.co.nz/ LINK : https://www.tokenroom.co.nz/
TYPE : service TYPE : tool
TAGS : bitcoin TAGS : bitcoin
DATE : 12018-07-14 DATE : 12018-07-14
SEEN : true SEEN : true
@ -1096,7 +1100,8 @@ THE EMPIRE
HORSESHIT PROBLEM HORSESHIT PROBLEM
LINK : http://www.duncantrussell.com/episodes/2018/7/12/taryn-southern LINK : http://www.duncantrussell.com/episodes/2018/7/12/taryn-southern
TYPE : podcast TYPE : podcast
TERM : 'Horseshit problem' - a problem that seems existentially bad but is later solved indirectly by technology. The name refers to horse manue starting to be a major problem when horses were extensively used for transport their manure was everywhere and poisoning water etc. When the cars were invented and mass adopted it was suddenly not an issue. TERM
> Horseshit problem: a problem that seems existentially bad but is later solved trivially/indirectly by technology. The name refers to horse manue starting to be a major problem when horses were extensively used for transport, their manure ending up everywhere - poisoning water wells etc. When the car was invented and mass adopted it was suddenly no longer an issue.
DATE : 12018-07-14 DATE : 12018-07-14
SEEN : true SEEN : true
@ -1153,13 +1158,15 @@ SAD POSTING
SEEN : false SEEN : false
TAGS : psychology TAGS : psychology
CHANTING TEMPLES CHANNELING ARCHTECTURE
LINK : http://viewzone2.com/archeosoundx.html LINK : http://viewzone2.com/archeosoundx.html
TYPE : article TYPE : article
DATE : 12018-07-15 DATE : 12018-07-15
SEEN : false SEEN : false
TAGS : architecture, history TAGS : architecture, history
TERM : '111hz' TERM
> 111hz: '...Findings of MRI scans suggest that at exactly 111hz, the brain switches off the prefrontal cortex, deactivating the language center, and temporaryly switches from left to right-sided dominance, that is responsible for intuition, creativity, holistic processing, inducing a state of meditation or a trance. Further research directed by Prof. Robert Jahn has tested acoustic behaviour in megalithic sites in the UK, showing that they sustained a strong resonance at a sound frequency between 95 and 120 heartz.' ...can't find source of the 'MRI' studies. Prof. Robert Jahn seems controversial. None-the-less interesting.
FILE : 12018-07-15_AcousticalResonancesOfAssortedAncientStructures.pdf
THE PSYCHOLOGY OF MONEY THE PSYCHOLOGY OF MONEY
LINK : http://www.collaborativefund.com/blog/the-psychology-of-money/ LINK : http://www.collaborativefund.com/blog/the-psychology-of-money/
@ -1196,7 +1203,8 @@ ZOMBIES REDACTED
DATE : 12018-07-15 DATE : 12018-07-15
SEEN : false SEEN : false
TAGS : philosophy TAGS : philosophy
TERM : 'Zombie' - 'in the philosophical usage of the term, is putatively a being that is exactly like you in every respect—identical behavior, identical speech, identical brain; every atom and quark in exactly the same position, moving according to the same causal laws of motion—except that your zombie is not conscious.' TERM
> Zombie: 'in the philosophical usage of the term, is putatively a being that is exactly like you in every respect—identical behavior, identical speech, identical brain; every atom and quark in exactly the same position, moving according to the same causal laws of motion—except that your zombie is not conscious.'
KREMLIN MEDIA KREMLIN MEDIA
LINK : https://meduza.io/en/feature/2015/08/13/this-is-how-russian-internet-censorship-works LINK : https://meduza.io/en/feature/2015/08/13/this-is-how-russian-internet-censorship-works
@ -1273,6 +1281,56 @@ CLIENT SIDE ROUTING
TYPE : article TYPE : article
DATE : 12018-07-16 DATE : 12018-07-16
SEEN : false SEEN : false
NOTE : Research for memex
TAGS : web, code TAGS : web, code
PROJ : Memex
NOON GUEST
LINK : https://aliceffekt.bandcamp.com/album/noon-guest
TYPE : music
DATE : 12018-07-16
SEEN : true
TAGS : game
SECRETS OF THE CASTLE
LINK : https://www.youtube.com/watch?v=jWZWTwJ_5Ag
TYPE : video
DATE : 12018-07-16
SEEN : true
TAGS : history
NOTE : Modern day 25 year project to build a castle with traditional methods and tools.
VICTORIAN FARM
LINK : https://www.youtube.com/watch?v=BodKsqkZk2Q
TYPE : video
DATE : 12018-07-16
SEEN : true
TAGS : history
TERM
> Shoddy: 'a type of woollen yarn produced by tearing old woollen rags into shreds and weaving the strands.'
LOW TECH MAGAZINE
PERS : josh
SRCE : Merveilles
LINK : http://www.lowtechmagazine.com/
TYPE : list
DATE : 12018-07-16
SEEN : false
TAGS : history, solarpunk, env
GWERN
PERS : neauoire
SRCE : Merveilles
LINK : http://www.gwern.net/
TYPE : list
DATE : 12018-07-16
SEEN : false
TAGS : history, psychology, science, ai, bitcoin, code, psychedelics, env
ISOTOPE MANSONRY
LINK : https://isotope.metafizzy.co/
TYPE : tool
DATE : 12018-07-17
SEEN : true
TAGS : code, web
PROJ : Memex
` `

View File

@ -9,13 +9,14 @@
<script src="asset/masonry.pkgd.min.js"></script> <script src="asset/masonry.pkgd.min.js"></script>
<script src="content/memex.ndtl"></script> <script src="content/memex.ndtl"></script>
<script src="logic/runic.js"></script>
<script src="logic/indental.js"></script> <script src="logic/indental.js"></script>
<script src="logic/main.js"></script> <script src="logic/main.js"></script>
<title>memex</title> <title>memex</title>
</head> </head>
<body> <body>
<div class="optionsPanel"></div> <div class="menu" id="menu"></div>
<div class="container"> <div class="container">
<div class="grid" id="grid"></div> <div class="grid" id="grid"></div>
</div> </div>

View File

@ -3,14 +3,12 @@ function Main()
// REFERENCE // REFERENCE
this.database = null; this.database = null;
this.keys = null; this.keys = null;
// this.page = 0;
this.lastEntry = -1;
this.msnry = null; this.msnry = null;
this.grid = null; this.grid = null;
this.menu = null;
// SETTINGS // SETTINGS
this.useMasonry = true; this.useMasonry = true;
this.postPerPage = 1000;
this.divNamePre = 'item'; this.divNamePre = 'item';
// MAIN // MAIN
@ -21,6 +19,7 @@ function Main()
this.processDatabase(); this.processDatabase();
this.grid = document.getElementById("grid"); this.grid = document.getElementById("grid");
this.menu = document.getElementById("menu");
if (this.useMasonry) if (this.useMasonry)
{ {
@ -32,6 +31,8 @@ function Main()
transitionDuration: 0, transitionDuration: 0,
}); });
} }
this.displayStats(this.database);
} }
this.start = function() this.start = function()
@ -56,18 +57,12 @@ function Main()
window.location.hash = target; window.location.hash = target;
} }
var tempDatabase = {}
if (target == 'home') if (target == 'home')
{ {
console.log('Display \'home\''); console.log('Display \'home\'');
tempDatabase = this.database;
this.grid.innerHTML = '';
this.displayEntries(this.database);
if (this.useMasonry)
{
this.msnry.reloadItems();
this.msnry.layout();
}
} }
else else
{ {
@ -79,7 +74,6 @@ function Main()
// TAG // TAG
console.log('Display tag \'' + splitTarget[1] + '\''); console.log('Display tag \'' + splitTarget[1] + '\'');
var tempDatabase = {}
for (i = 0; i < this.keys.length; i++) for (i = 0; i < this.keys.length; i++)
{ {
let value = this.database[this.keys[i]]; let value = this.database[this.keys[i]];
@ -94,15 +88,6 @@ function Main()
} }
} }
} }
this.grid.innerHTML = '';
this.displayEntries(tempDatabase);
if (this.useMasonry)
{
this.msnry.reloadItems();
this.msnry.layout();
}
} }
else if (splitTarget[0] == 'type') else if (splitTarget[0] == 'type')
{ {
@ -121,7 +106,10 @@ function Main()
} }
} }
} }
}
}
// DISPLAY
this.grid.innerHTML = ''; this.grid.innerHTML = '';
this.displayEntries(tempDatabase); this.displayEntries(tempDatabase);
@ -130,8 +118,8 @@ function Main()
this.msnry.reloadItems(); this.msnry.reloadItems();
this.msnry.layout(); this.msnry.layout();
} }
}
} // this.displayStats(tempDatabase);
} }
this.processDatabase = function() this.processDatabase = function()
@ -142,6 +130,8 @@ function Main()
for (i = 0; i < dbKeys.length; i++) for (i = 0; i < dbKeys.length; i++)
{ {
let value = this.database[dbKeys[i]]; let value = this.database[dbKeys[i]];
// TAGS
if (typeof value.TAGS !== 'undefined') if (typeof value.TAGS !== 'undefined')
{ {
var tags = value.TAGS.split(","); var tags = value.TAGS.split(",");
@ -154,6 +144,25 @@ function Main()
this.database[dbKeys[i]].TAGS = tags; this.database[dbKeys[i]].TAGS = tags;
} }
// TERMS
if (typeof value.TERM !== 'undefined')
{
let termRunic = new Runic(value.TERM).raw;
let formattedTerms = [];
for (var t = 0; t < termRunic.length; t++)
{
term = termRunic[t].substr(2).split(':');
for (var e = 0; e < term.length; e++)
{
term[e] = term[e].trim();
}
formattedTerms.push(term);
}
this.database[dbKeys[i]].TERM = formattedTerms;
}
this.database[dbKeys[i]].DIID = i; this.database[dbKeys[i]].DIID = i;
} }
console.log(this.database); console.log(this.database);
@ -179,21 +188,157 @@ function Main()
//document.addEventListener('mouseup', (e)=>{ this.touch(e.target); e.preventDefault(); }); //document.addEventListener('mouseup', (e)=>{ this.touch(e.target); e.preventDefault(); });
this.displayStats = function(db)
{
// CALCULATE
let dbKeys = Object.keys(db);
let types = {};
let terms = 0;
let i = 0;
while (i < dbKeys.length)
{
// TYPE
if (typeof db[dbKeys[i]].TYPE !== 'undefined')
{
if (typeof types[db[dbKeys[i]].TYPE] !== 'undefined')
{
types[db[dbKeys[i]].TYPE] ++;
}
else
{
types[db[dbKeys[i]].TYPE] = 1;
}
if (typeof db[dbKeys[i]].TERM !== 'undefined')
{
terms += db[dbKeys[i]].TERM.length;
}
}
i++;
}
console.log(types);
// DISPLAY
let menuContent = ``;
menuContent += `<a href='#home'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-asterisk"></i><div class="count">${this.keys.length}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
if (typeof types['article'] !== 'undefined')
{
menuContent += `<a href='#type-article'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="far fa-newspaper"></i><div class="count">${types['article']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['podcast'] !== 'undefined')
{
menuContent += `<a href='#type-podcast'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-podcast"></i><div class="count">${types['podcast']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['video'] !== 'undefined')
{
menuContent += `<a href='#type-video'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-tv"></i><div class="count">${types['video']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['list'] !== 'undefined')
{
menuContent += `<a href='#type-list'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-file-alt"></i><div class="count">${types['list']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['book'] !== 'undefined')
{
menuContent += `<a href='#type-book'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-book-open"></i><div class="count">${types['book']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['game'] !== 'undefined')
{
menuContent += `<a href='#type-game'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-gamepad"></i><div class="count">${types['game']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['service'] !== 'undefined')
{
menuContent += `<a href='#type-service'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-server"></i><div class="count">${types['service']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['lecture'] !== 'undefined')
{
menuContent += `<a href='#type-lecture'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-chalkboard-teacher"></i><div class="count">${types['lecture']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['quote'] !== 'undefined')
{
menuContent += `<a href='#type-quote'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-comment"></i><div class="count">${types['quote']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['tool'] !== 'undefined')
{
menuContent += `<a href='#type-tool'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-wrench"></i><div class="count">${types['tool']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (typeof types['music'] !== 'undefined')
{
menuContent += `<a href='#type-music'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-music"></i><div class="count">${types['music']}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
if (terms > 0)
{
// menuContent += `<div class="menu-item-space"></div>`;
menuContent += `<a href='#term'>`;
menuContent += `<div class="menu-item">`;
menuContent += `<i class="fas fa-ribbon"></i><div class="count">${terms}</div>`;
menuContent += `</div>`;
menuContent += `</a>`;
}
this.menu.innerHTML = ``;
this.menu.innerHTML += menuContent;
}
this.displayEntries = function(db) this.displayEntries = function(db)
{ {
var dbKeys = Object.keys(db); var dbKeys = Object.keys(db);
//this.page += this.postPerPage;
//var i = this.lastEntry + 1;
var i = 0; var i = 0;
while (i < dbKeys.length) while (i < dbKeys.length)
// while (i < Math.min(dbKeys.length, this.page))
{ {
this.buildEntry(db, dbKeys[i]); this.buildEntry(db, dbKeys[i]);
this.lastEntry = i; i++;
i += 1;
} }
// entries += this.doPagination();
} }
this.buildEntry = function(db, key) this.buildEntry = function(db, key)
@ -301,7 +446,10 @@ function Main()
// TERM // TERM
if (typeof value.TERM !== 'undefined') if (typeof value.TERM !== 'undefined')
{ {
entry += `<div class="term"><i class="fas fa-ribbon textIcon"></i>${value.TERM}</div>`; for (var i = 0; i < value.TERM.length; i++)
{
entry += `<div class="term"><i class="fas fa-ribbon textIcon"></i><b>${value.TERM[i][0]}</b>: ${value.TERM[i][1]}</div>`;
}
} }
// PROGRESS // PROGRESS
@ -313,28 +461,8 @@ function Main()
entry += `</div>`; entry += `</div>`;
this.grid.innerHTML += entry; this.grid.innerHTML += entry;
// if (this.useMasonry)
// {
// this.msnry.appended( entry );
// }
} }
// this.doPagination = function()
// {
// return `
// <div id="pagination">
// <a id="loadmore" onClick="loadMore();">${this.lastEntry < this.keys.length -1 ? `Load more ▼` : ``}</a>
// </div>
// `
// }
// this.loadMore = function()
// {
// pagination.remove();
// document.getElementById("content").innerHTML += doJournal(this.database);
// }
String.prototype.to_url = function() String.prototype.to_url = function()
{ {
return this.toLowerCase().replace(/ /g,"+").replace(/[^0-9a-z\+]/gi,"").trim(); return this.toLowerCase().replace(/ /g,"+").replace(/[^0-9a-z\+]/gi,"").trim();
@ -417,13 +545,6 @@ function Main()
// function() { console.log("forward"); main.load(); } // function() { console.log("forward"); main.load(); }
// )); // ));
// var doThing = function()
// {
// console.log('do thing');
// }
// window.addEventListener("hashchange", doThing());
window.addEventListener("hashchange", navigate ); window.addEventListener("hashchange", navigate );
function navigate() function navigate()

View File

@ -1,6 +1,5 @@
function Runic(raw,tables) function Runic(raw)
{ {
this.tables = tables;
this.raw = raw; this.raw = raw;
this.runes = { this.runes = {
@ -11,13 +10,11 @@ function Runic(raw,tables)
"!":{glyph:"!",tag:"table",sub:"tr",wrap:"th",class:"outline",stash:true}, "!":{glyph:"!",tag:"table",sub:"tr",wrap:"th",class:"outline",stash:true},
"|":{glyph:"|",tag:"table",sub:"tr",wrap:"td",class:"outline",stash:true}, "|":{glyph:"|",tag:"table",sub:"tr",wrap:"td",class:"outline",stash:true},
"#":{glyph:"#",tag:"code",sub:"ln",class:"",stash:true}, "#":{glyph:"#",tag:"code",sub:"ln",class:"",stash:true},
"%":{glyph:"%"}, "%":{glyph:"%"}, // media
"?":{glyph:"?",tag:"note",class:""}, "?":{glyph:"?",tag:"note",class:""},
":":{glyph:":",tag:"info",class:""}, ":":{glyph:":",tag:"info",class:""},
"*":{glyph:"*",tag:"h2",class:""}, "*":{glyph:"*",tag:"h3",class:""},
"+":{glyph:"+",tag:"hs",class:""},
">":{glyph:">",tag:"",class:""}, ">":{glyph:">",tag:"",class:""},
"$":{glyph:">",tag:"",class:""},
"@":{glyph:"@",tag:"quote",class:""} "@":{glyph:"@",tag:"quote",class:""}
} }
@ -51,25 +48,20 @@ function Runic(raw,tables)
var html = ""; var html = "";
var lines = raw; var lines = raw;
var lines = !Array.isArray(raw) ? raw.toString().split("\n") : raw; var lines = !Array.isArray(raw) ? raw.split("\n") : raw;
for(id in lines){ for(id in lines){
var char = lines[id].substr(0,1).trim().toString() var char = lines[id].substr(0,1).trim().toString()
var rune = this.runes[char]; var rune = this.runes[char];
var trail = lines[id].substr(1,1); var trail = lines[id].substr(1,1);
if(char == "%"){ html += this.media(lines[id].substr(2)); continue; }
if(char == "@"){ html += this.quote(lines[id].substr(2)); continue; }
var line = lines[id].substr(2).to_markup(); var line = lines[id].substr(2).to_markup();
if(!line || line.trim() == ""){ continue; } if(!line || line.trim() == ""){ continue; }
if(!rune){ console.log(`Unknown rune:${char} : ${line}`); continue; } if(!rune){ console.log(`Unknown rune:${char} : ${line}`); }
if(trail != " "){ console.warn("Runic",`Non-rune[${trail}] at:${id}(${line})`); continue; } if(trail != " "){ console.warn("Runic","Non-rune["+trail+"] at:"+id+"("+line+")"); continue; }
if(this.stash.is_pop(rune)){ html += this.render_stash(); } if(this.stash.is_pop(rune)){ html += this.render_stash(); }
if(char == "$"){ html += `<p>${Ø("operation").request(line).to_markup()}</p>`; continue; }
if(char == "%"){ html += this.media(line); continue; }
if(char == "@"){ html += this.quote(line); continue; }
if(char == ":"){ html += this.info(line); continue; }
if(rune.stash === true){ this.stash.add(rune,line) ; continue; } if(rune.stash === true){ this.stash.add(rune,line) ; continue; }
html += this.render(line,rune); html += this.render(line,rune);
} }
@ -104,11 +96,19 @@ function Runic(raw,tables)
var service = val.split(" ")[0]; var service = val.split(" ")[0];
var id = val.split(" ")[1]; var id = val.split(" ")[1];
if(service == "itchio"){ return `<iframe frameborder="0" src="https://itch.io/embed/${id}?link_color=000000" width="600" height="167"></iframe>`; } if(service == "itchio"){
if(service == "bandcamp"){ return `<iframe style="border: 0; width: 600px; height: 274px;" src="https://bandcamp.com/EmbeddedPlayer/album=${id}/size=large/bgcol=ffffff/linkcol=333333/artwork=small/transparent=true/" seamless></iframe>`; } return `<iframe frameborder="0" src="https://itch.io/embed/${id}?link_color=000000" width="600" height="167"></iframe>`;
if(service == "youtube"){ return `<iframe width="600" height="315" src="https://www.youtube.com/embed/${id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>`; } }
if(service == "custom"){ return `<iframe src='${id}' style='width:100%;height:350px;'></iframe>`; } if(service == "bandcamp"){
return `<img src='media/${val}'/>` return `<iframe style="border: 0; width: 600px; height: 274px;" src="https://bandcamp.com/EmbeddedPlayer/album=${id}/size=large/bgcol=ffffff/linkcol=333333/artwork=small/transparent=true/" seamless></iframe>`;
}
if(service == "youtube"){
return `<iframe width="600" height="315" src="https://www.youtube.com/embed/${id}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>`;
}
if(service == "custom"){
return `<iframe src='${id}' style='width:100%;height:350px;'></iframe>`;
}
return `<img src='media/${service}' class='${id}'/>`
} }
this.quote = function(content) this.quote = function(content)
@ -119,31 +119,53 @@ function Runic(raw,tables)
var source = parts[2] var source = parts[2]
var link = parts[3] var link = parts[3]
return ` return `<quote><p class='text'>${text}</p>${author ? `<p class='attrib'>${link ? `${author}, <a href='${link}'>${source}</a>` : `${author}`}</p>` : ''}</quote>`
<quote>
<p class='text'>
${text.to_markup()}
</p>
<p class='attrib'>
${author}${source && link ? `, <a href='${link}'>${source}</a>` : source ? `, <b>${source}</b>` : ''}
</p>
</quote>`
} }
this.info = function(content) this.html = function()
{ {
var key = content.split("|")[0].trim() return this.parse(raw);
var term = this.tables.lexicon[key.toUpperCase()]
var log = term.logs[0]
var glyph = term.glyph();
if(!log){ return '' }
return `<info><svg width="30" height="30" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1"><g transform='scale(0.1)'><path d='${glyph}'/></g></svg><t class='key'>{{${key.capitalize()}}}</t><t class='val'>${log.name ? log.name : log.task.capitalize()}</t><t class='offset'>${log.time.offset_format(new Date().desamber(),true).capitalize()}, <b>${log.time}</b></t></info>`.to_markup()
} }
this.toString = function() this.toString = function()
{ {
return this.parse(); return this.html();
} }
} }
String.prototype.capitalize = function()
{
return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
}
String.prototype.to_url = function()
{
return this.toLowerCase().replace(/ /g,"+").replace(/[^0-9a-z\+]/gi,"").trim();
}
String.prototype.to_path = function()
{
return this.toLowerCase().replace(/ /g,".").replace(/[^0-9a-z\.]/gi,"").trim();
}
String.prototype.to_markup = function()
{
html = this;
html = html.replace(/{_/g,"<i>").replace(/_}/g,"</i>")
html = html.replace(/{\*/g,"<b>").replace(/\*}/g,"</b>")
html = html.replace(/{\#/g,"<code class='inline'>").replace(/\#}/g,"</code>")
var parts = html.split("{{")
for(id in parts){
var part = parts[id];
if(part.indexOf("}}") == -1){ continue; }
var content = part.split("}}")[0];
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}}}`,external ? `<a href='${target}' class='external' target='_blank'>${name}</a>` : `<a class='local' href='#${target.to_url()}'>${name}</a>`)
}
return html;
}