You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Posting this as a potential enhancement that I coded for myself a few months ago. I was tired of looking at filters in my favorites list that didn't have any tasks, so created a code snippet to auto-hide them when the last task is completed and have them show up again as soon as they contain a task. I'm a self-taught, noobie coder so I'm sure this is far from elegant, but figured I'd share the concept in case anyone wants to improve upon it and/or include it in future releases of this extension:
function initiate_hide_filters(){
var param = "AuiqUdaGFITJcNpaWKvZFA==";
var escapedParam = param.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1');
const targetNode = document.querySelectorAll(".sidebar_expansion_panel,.expansion_panel,.expansion_panel--expanded")[0];
const config = { attributes: false, childList: true, subtree: true };
const callback = function(mutationsList, observer) {
var favContainer = $(".sidebar_expansion_panel.expansion_panel.expansion_panel--expanded")[0];
$(favContainer).find("li").each(function(){
var container = $(this).find($("."+escapedParam));
if(container.length==0){ $(this).hide(); }else{ $(this).show(); }
});
if(AUTO_HIDE_EMPTY_LABELS){
var labelContainer = $(".sidebar_expansion_panel.expansion_panel.expansion_panel--expanded")[1];
$(labelContainer).find("li").not(".FilterListItemSortable").each(function(){
var labelCounter = $(this).find(".counter_count");
if(labelCounter.length==0){ $(this).hide(); }else{ $(this).show(); }
});
}
};
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);
var favContainer = $(".sidebar_expansion_panel.expansion_panel.expansion_panel--expanded")[0];
$(favContainer).find("li").not(".FilterListItemSortable").each(function(){
var container = $(this).find($("."+escapedParam));
if(container.length==0){ $(this).hide(); }else{ $(this).show(); }
});
if(AUTO_HIDE_EMPTY_LABELS){
var labelContainer = $(".sidebar_expansion_panel.expansion_panel.expansion_panel--expanded")[1];
$(labelContainer).find("li").each(function(){
var labelCounter = $(this).find(".counter_count");
if(labelCounter.length==0){ $(this).hide(); }else{ $(this).show(); }
});
}
}
Nice! I definitely would like to auto-hide my favorite filters that have no tasks.
One trickiness with adding such functionality is that so far todoist-shortcuts has no options. So, would need to add an options page. Which isn't /that/ hard, but still I feel a bit of hesitance to do so. Might revisit this in the future!
Posting this as a potential enhancement that I coded for myself a few months ago. I was tired of looking at filters in my favorites list that didn't have any tasks, so created a code snippet to auto-hide them when the last task is completed and have them show up again as soon as they contain a task. I'm a self-taught, noobie coder so I'm sure this is far from elegant, but figured I'd share the concept in case anyone wants to improve upon it and/or include it in future releases of this extension:
Then, to get it to run post-load, I just used:
The text was updated successfully, but these errors were encountered: