- Original WorkFlowy bookmarklet by Rawbytez
- Adapted for Dynalist. Could be done cleaner with a var = new regex instead of an IF-THEN but hey, it does what I need it to do
- Usage: navigate to the document or list you want a tag index for. Expand/collapse what you want indexed or not. Click the bookmarklet. A list of tags will appear in the search box. Cut & paste it where you want.
- How to install: make a bookmarklet anywhere, copy the below code, edit your bookmark, delete the URL in the bookmark and paste this code there instead
javascript:(function(){var separator=" | ";var URL=location.href;if(URL.indexOf('dynalist.io/d/')==-1){return;}if(URL.indexOf('#z=')==-1){qChar='#'}else{qChar='&'};if(URL.indexOf(qChar+'q=')==-1){location.href=URL+qChar+"q="+encodeURIComponent("# OR @");}var tags=document.getElementsByClassName("Node-children")[0].getElementsByClassName("node-tag");var TagIndex='';if(tags.length>0){var i;var tagList=[];for(i=0;i<tags.length;i++){tagList.push(tags[i].textContent.toLowerCase());}tagList.sort();var tagCount={};tagList.forEach(function(x){tagCount[x]=(tagCount[x]||0)+1;});for(var tagTitle in tagCount){TagIndex+=separator+tagTitle;}if(qChar=='#'){location.href=URL.replace(/\#\=.+/,"")+'#q='+encodeURIComponent(TagIndex.slice(separator.length))}else{location.href=URL.replace(/\&q\=.+/,"")+'&q='+encodeURIComponent(TagIndex.slice(separator.length))};}else{alert("NO TAGS TO INDEX!\n\nThis bookmarklet creates an index of your tags in the VISIBLE/EXPANDED part(s) of your document.\n\nINSTRUCTIONS:\nThe index is created in the search box. Select all the text in the search box, copy, press Esc to clear the search, then paste wherever. \n\nCUSTOMIZE THE TAG SEPARATOR\nEdit between the quotes:\nvar separator=\""+separator+"\"\nFor the highest density use a single space or a single colon.\n\nOriginal WorkFlowy bookmarklet by Rawbytez; adapted for Dynalist by Ruud\n");location.href=URL;}})();