is it possible to make menu with highlight items?
is it possible to make menu with highlight items?
With the current ways of how the toc works, I don't think it is, as the recursion steps work entirely independently and there is no "after-render" dom manipulation that would find a "current tiddler" and then make sure that its parent items get highlighted (and are expanded).
On the other hand, I don't think the current implementation allows to defer the toc rendering until after the "currently active branch" has been properly identified, as it's iterations render items independently, as already said.So, this begs for a new / different approach to implementing a table of content, one that does away with nested-macro+template-magic.Best wishes,— tb--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/49b1a43c-d3dc-4ecd-af9a-b3ceec63eb57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
/*
Find the first child DOM node of a widget that has the class "tc-title"
*/
function parentTag(node) {
return node.parentNode;
}
function findTitleDomNode(widget,targetClass) {
targetClass = targetClass || "tc-title";
var domNode = widget.findFirstDomNode();
if(domNode.querySelector('.tc-title') != null ){
var ttitle=domNode.querySelector('.tc-title').textContent.replace(/^\s+|\s+$/mg,'');
document.title=ttitle;
var elements = document.querySelectorAll('ol a,ol ol a,ol button,ol ol button') ;
for (var i = 0; i < elements.length; i++) {
elements[i].style.color = 'inherit';
parentTag(elements[i]).style.backgroundColor = '';
parentTag(parentTag(elements[i])).style.backgroundColor = '';
if( elements[i].textContent.replace(/^\s+|\s+$/mg,'')==ttitle){elements[i].style.color = '#ff8400';
if( parentTag(elements[i]).tagName=="LI"){parentTag(elements[i]).style.backgroundColor = 'rgba(0, 0, 0, 0.1)';} ;
if( parentTag(parentTag(elements[i])).tagName=="LI"){parentTag(parentTag(elements[i])).style.backgroundColor = 'rgba(0, 0, 0, 0.1)';} ;
} ;
}
}
if(domNode && domNode.querySelector) {
return domNode.querySelector("." + targetClass);
}
return null;
}
if(~domNode.getAttribute('class').indexOf(encodeURI(elements[i].textContent.replace(/^\s+|\s+$/mg,'')))) {elements[i].style.color = '#ff8400'; };