Browse Source

lazygit

main
Gregory Leeman 3 weeks ago
parent
commit
44e2e6dcd8
  1. 49
      workflowy-helper/main.js

49
workflowy-helper/main.js

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

Loading…
Cancel
Save