diff --git a/workflowy-helper/main.js b/workflowy-helper/main.js index 636e76e..e352477 100644 --- a/workflowy-helper/main.js +++ b/workflowy-helper/main.js @@ -189,25 +189,38 @@ text.push(child); } } + const content = names[0].querySelector('.content'); const hotspots = ["admin", "art","mind","health","social","church","career","work"] text.forEach(function(t) { const breadcrumb = t.querySelector('.breadcrumbs'); if (breadcrumb !== null) { const breadcrumbs = breadcrumb.querySelectorAll('a'); - breadcrumbs.forEach(bc => { + + for (var i = 0; i < breadcrumbs.length; i++) { + var bc = breadcrumbs[i]; + bc.classList.add("breadcrumb"); var text = bc.innerText.trim(); if (hotspots.includes(text)) { const hotspot = text; projectNode.classList.add(`hotspot-${hotspot}`); // const link = document.createElement('a'); + // link.innerText = text; + // console.log({link}); + // const content = names[0].querySelector('.content > .innerContentContainer'); + // console.log({content}); + // content.appendChild(link); + // names[0].appendChild(link); + // break; // link.href = bc.href; // link.innerText = text; // names[0].appendChild(link); } - }); + } + } }); + [notes, names].forEach(function(ns) { if (ns.length > 0) { const n = ns[0]; @@ -223,14 +236,30 @@ } const tags = n.querySelectorAll('.contentTag'); if (text.startsWith("!")) { - const links = n.querySelectorAll('a.contentLink'); - const imgSrcs = []; - for (var i = 0; i < links.length; i++) { - var link = links[i]; - link.textContent = "link"; - var imgSrc = link.href; - imgSrcs.push(imgSrc); - } + console.log("found ! in text"); + const links = [...n.querySelectorAll('a.contentLink')]; + const imgSrcs = links.map(link => { + return link.href; + }); + console.log({imgSrcs}); + + // const imgSrcs = links.forEach(link => { + // // return link.href; + // // link.textContent = "link"; + // // var imgSrc = link.href; + // // console.log({imgSrc}); + // // return imgSrc; + // }); + // console.log({imgSrcs}); + // const imgSrcs = []; + // for (var i = 0; i < links.length; i++) { + // var link = links[i]; + // link.textContent = "link"; + // var imgSrc = link.href; + // console.log({imgSrc}); + // imgSrcs.push(imgSrc); + // } + if (imgSrcs.length > 0) { createImages(n, imgSrcs); }