From 3a2f06d238dce77da4449fa7b8c2cd25a6f9c50c Mon Sep 17 00:00:00 2001 From: kor Date: Tue, 17 Jul 2018 00:38:07 +1200 Subject: [PATCH] Formatting terms. --- asset/style.css | 48 +++++++-- content/Memex.ndtl | 90 +++++++++++++--- index.html | 3 +- logic/main.js | 253 +++++++++++++++++++++++++++++++++------------ logic/runic.js | 102 +++++++++++------- 5 files changed, 365 insertions(+), 131 deletions(-) diff --git a/asset/style.css b/asset/style.css index 1a45ab5..a1572b9 100644 --- a/asset/style.css +++ b/asset/style.css @@ -14,31 +14,63 @@ body { * { box-sizing: border-box; } -.optionsPanel { - width: 100px; +/* MENU */ +.menu { height: 100%; background:#000; position:fixed; left: 0px; top: 0px; z-index: 100; + padding-top:20px; + font-size:1.5em; /*-webkit-transition: width 0.05s ease-in-out; transition: width 0.05s ease-in-out;*/ } -.optionsPanel:hover { - width: 370px; +.menu:hover { + /*width: 370px;*/ /*-webkit-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 { margin-left: 120px; } -.optionsPanel:hover + .container{ - /*transition: 0.05s -webkit-filter ease-in;*/ +/*.menu:hover + .container{ + transition: 0.05s -webkit-filter ease-in; filter: blur(3px); -} +}*/ .grid { border: 1px; diff --git a/content/Memex.ndtl b/content/Memex.ndtl index 2063690..c9c0651 100644 --- a/content/Memex.ndtl +++ b/content/Memex.ndtl @@ -304,13 +304,13 @@ GNOSTICISM KOAN PERS : faun SRCE : Merveilles - TYPE : term + TYPE : list 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 SEEN : 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 LINK : https://www.youtube.com/watch?v=DJUf8MxbcdA @@ -449,8 +449,10 @@ LONG-TERM MEMORY TYPE : article DATE : 12018-07-06 TAGS : psychology - TERM : Anki, Memex - SEEN : false + TERM + > 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 PERS : ark @@ -461,7 +463,7 @@ INDEPENDENCE IN CYBERSPACE TAGS : philosophy 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 TYPE : article DATE : 12018-07-06 @@ -596,7 +598,8 @@ CIRCULAR ECONOMY DATE : 12018-07-06 SEEN : true 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 LINK : http://arachnid.biosci.utexas.edu/courses/THOC/Readings/Boulding_SpaceshipEarth.pdf @@ -729,7 +732,8 @@ GREENSPACE SRCE : Merveilles LINK : https://www.uea.ac.uk/about/-/it-s-official-spending-time-outside-is-good-for-you 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 DATE : 12018-07-08 TAGS : psychology, economics, env @@ -979,14 +983,14 @@ FRACTAL FILM CGI DATE : 12018-07-14 SEEN : false -VORTICAL FLOW + FRACTAL MACHINES +VORTICAL + FRACTAL MACHINES LINK : https://www.fxguide.com/featured/suicide-squad-vortical-flows-and-fractal-machines/ TYPE : article TAGS : fractal, film DATE : 12018-07-14 SEEN : false -VORTICAL FLOW + FRACTAL MACHINES +FRACTALS AND ROUGHNESS LINK : https://www.ted.com/talks/benoit_mandelbrot_fractals_the_art_of_roughness TYPE : video TAGS : fractal, research @@ -1058,7 +1062,7 @@ SYSTEMS ARE EVERYWHERE NZ EXCHANGE LINK : https://www.tokenroom.co.nz/ - TYPE : service + TYPE : tool TAGS : bitcoin DATE : 12018-07-14 SEEN : true @@ -1096,7 +1100,8 @@ THE EMPIRE HORSESHIT PROBLEM LINK : http://www.duncantrussell.com/episodes/2018/7/12/taryn-southern 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 SEEN : true @@ -1153,13 +1158,15 @@ SAD POSTING SEEN : false TAGS : psychology -CHANTING TEMPLES +CHANNELING ARCHTECTURE LINK : http://viewzone2.com/archeosoundx.html TYPE : article DATE : 12018-07-15 SEEN : false 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 LINK : http://www.collaborativefund.com/blog/the-psychology-of-money/ @@ -1196,7 +1203,8 @@ ZOMBIES REDACTED DATE : 12018-07-15 SEEN : false 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 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 DATE : 12018-07-16 SEEN : false - NOTE : Research for memex 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 ` \ No newline at end of file diff --git a/index.html b/index.html index 2b1563a..06ef9e2 100644 --- a/index.html +++ b/index.html @@ -9,13 +9,14 @@ + memex -
+
diff --git a/logic/main.js b/logic/main.js index be2b203..fb0526c 100644 --- a/logic/main.js +++ b/logic/main.js @@ -3,14 +3,12 @@ function Main() // REFERENCE this.database = null; this.keys = null; - // this.page = 0; - this.lastEntry = -1; this.msnry = null; this.grid = null; + this.menu = null; // SETTINGS this.useMasonry = true; - this.postPerPage = 1000; this.divNamePre = 'item'; // MAIN @@ -21,6 +19,7 @@ function Main() this.processDatabase(); this.grid = document.getElementById("grid"); + this.menu = document.getElementById("menu"); if (this.useMasonry) { @@ -32,6 +31,8 @@ function Main() transitionDuration: 0, }); } + + this.displayStats(this.database); } this.start = function() @@ -56,18 +57,12 @@ function Main() window.location.hash = target; } + var tempDatabase = {} + if (target == 'home') { console.log('Display \'home\''); - - this.grid.innerHTML = ''; - this.displayEntries(this.database); - - if (this.useMasonry) - { - this.msnry.reloadItems(); - this.msnry.layout(); - } + tempDatabase = this.database; } else { @@ -79,7 +74,6 @@ function Main() // TAG console.log('Display tag \'' + splitTarget[1] + '\''); - var tempDatabase = {} for (i = 0; i < this.keys.length; 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') { @@ -121,17 +106,20 @@ function Main() } } } - - this.grid.innerHTML = ''; - this.displayEntries(tempDatabase); - - if (this.useMasonry) - { - this.msnry.reloadItems(); - this.msnry.layout(); - } } } + + // DISPLAY + this.grid.innerHTML = ''; + this.displayEntries(tempDatabase); + + if (this.useMasonry) + { + this.msnry.reloadItems(); + this.msnry.layout(); + } + + // this.displayStats(tempDatabase); } this.processDatabase = function() @@ -142,6 +130,8 @@ function Main() for (i = 0; i < dbKeys.length; i++) { let value = this.database[dbKeys[i]]; + + // TAGS if (typeof value.TAGS !== 'undefined') { var tags = value.TAGS.split(","); @@ -154,6 +144,25 @@ function Main() 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; } console.log(this.database); @@ -179,21 +188,157 @@ function Main() //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 += ``; + menuContent += ``; + menuContent += ``; + + if (typeof types['article'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['podcast'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['video'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['list'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['book'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['game'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['service'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['lecture'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['quote'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['tool'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + if (typeof types['music'] !== 'undefined') + { + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + + if (terms > 0) + { + // menuContent += ``; + menuContent += ``; + menuContent += ``; + menuContent += ``; + } + + this.menu.innerHTML = ``; + this.menu.innerHTML += menuContent; + } + this.displayEntries = function(db) { var dbKeys = Object.keys(db); - - //this.page += this.postPerPage; - //var i = this.lastEntry + 1; var i = 0; while (i < dbKeys.length) - // while (i < Math.min(dbKeys.length, this.page)) { this.buildEntry(db, dbKeys[i]); - this.lastEntry = i; - i += 1; + i++; } - // entries += this.doPagination(); } this.buildEntry = function(db, key) @@ -301,7 +446,10 @@ function Main() // TERM if (typeof value.TERM !== 'undefined') { - entry += `
${value.TERM}
`; + for (var i = 0; i < value.TERM.length; i++) + { + entry += `
${value.TERM[i][0]}: ${value.TERM[i][1]}
`; + } } // PROGRESS @@ -313,28 +461,8 @@ function Main() entry += ``; this.grid.innerHTML += entry; - - // if (this.useMasonry) - // { - // this.msnry.appended( entry ); - // } } - // this.doPagination = function() - // { - // return ` - // - // ` - // } - - // this.loadMore = function() - // { - // pagination.remove(); - // document.getElementById("content").innerHTML += doJournal(this.database); - // } - String.prototype.to_url = function() { return this.toLowerCase().replace(/ /g,"+").replace(/[^0-9a-z\+]/gi,"").trim(); @@ -417,13 +545,6 @@ function Main() // function() { console.log("forward"); main.load(); } // )); -// var doThing = function() -// { -// console.log('do thing'); -// } - -// window.addEventListener("hashchange", doThing()); - window.addEventListener("hashchange", navigate ); function navigate() diff --git a/logic/runic.js b/logic/runic.js index 084d896..964e145 100644 --- a/logic/runic.js +++ b/logic/runic.js @@ -1,6 +1,5 @@ -function Runic(raw,tables) +function Runic(raw) { - this.tables = tables; this.raw = raw; 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:"td",class:"outline",stash:true}, "#":{glyph:"#",tag:"code",sub:"ln",class:"",stash:true}, - "%":{glyph:"%"}, + "%":{glyph:"%"}, // media "?":{glyph:"?",tag:"note",class:""}, ":":{glyph:":",tag:"info",class:""}, - "*":{glyph:"*",tag:"h2",class:""}, - "+":{glyph:"+",tag:"hs",class:""}, + "*":{glyph:"*",tag:"h3",class:""}, ">":{glyph:">",tag:"",class:""}, - "$":{glyph:">",tag:"",class:""}, "@":{glyph:"@",tag:"quote",class:""} } @@ -51,25 +48,20 @@ function Runic(raw,tables) var html = ""; 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){ var char = lines[id].substr(0,1).trim().toString() var rune = this.runes[char]; 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(); - if(!line || line.trim() == ""){ continue; } - if(!rune){ console.log(`Unknown rune:${char} : ${line}`); continue; } - if(trail != " "){ console.warn("Runic",`Non-rune[${trail}] at:${id}(${line})`); continue; } + if(!rune){ console.log(`Unknown rune:${char} : ${line}`); } + if(trail != " "){ console.warn("Runic","Non-rune["+trail+"] at:"+id+"("+line+")"); continue; } if(this.stash.is_pop(rune)){ html += this.render_stash(); } - - if(char == "$"){ html += `

${Ø("operation").request(line).to_markup()}

`; 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; } html += this.render(line,rune); } @@ -104,11 +96,19 @@ function Runic(raw,tables) var service = val.split(" ")[0]; var id = val.split(" ")[1]; - if(service == "itchio"){ return ``; } - if(service == "bandcamp"){ return ``; } - if(service == "youtube"){ return ``; } - if(service == "custom"){ return ``; } - return `` + if(service == "itchio"){ + return ``; + } + if(service == "bandcamp"){ + return ``; + } + if(service == "youtube"){ + return ``; + } + if(service == "custom"){ + return ``; + } + return `` } this.quote = function(content) @@ -119,31 +119,53 @@ function Runic(raw,tables) var source = parts[2] var link = parts[3] - return ` - -

- ${text.to_markup()} -

-

- ${author}${source && link ? `, ${source}` : source ? `, ${source}` : ''} -

-
` + return `

${text}

${author ? `

${link ? `${author}, ${source}` : `${author}`}

` : ''}
` } - this.info = function(content) + this.html = function() { - var key = content.split("|")[0].trim() - var term = this.tables.lexicon[key.toUpperCase()] - var log = term.logs[0] - var glyph = term.glyph(); - - if(!log){ return '' } - - return `{{${key.capitalize()}}}${log.name ? log.name : log.task.capitalize()}${log.time.offset_format(new Date().desamber(),true).capitalize()}, ${log.time}`.to_markup() + return this.parse(raw); } 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,"").replace(/_}/g,"") + html = html.replace(/{\*/g,"").replace(/\*}/g,"") + html = html.replace(/{\#/g,"").replace(/\#}/g,"") + + 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 ? `${name}` : `${name}`) + } + return html; +} + +