If you use Todoist multiple query filters you quickly discover that they create a lot of white-space, “Add Task” links and duplicated headers. To make the website more readable I created a script to remove the noise. You need a browser like chrome or firefox and an extension that can inject JavaScript into the Todoist website.

Features:

  • Removes empty search queries from filter results
  • Removes all but the first heading
  • Remove “add tasks” option for specified filters
  • Can be set for specific filters

Conditions:

This script assumes that you use several filter queries that are separated with a comma and include a date selector like “today”, “tomorrow”, “3 days”, etc.

Installation:

  1. Use a browser extension that injects the javascript code below on todoist.com
    For chrome you can use “cjs”
  2. Add “@hide_today” without quotation marks to your filter query
    Note, you don’t need to create a label @hide_today

Limitations:

Works only on browser and not on smart phone apps

Example filters:

@hide_today & today, p:first_project & today, p:second_project & today
@hide_today & today, (p1 | p2) & today, p:Inbox & today & !(p1 | p2)
@hide_today & today, p:first_project & today, p:second_project & today
@hide_today & 7 days & ! 6 days, p:first_project & 7 days & ! 6 days, p:second_project & 7 days & ! 6 days

Script:


my_jQuery_triggers = function() {
    
    jQuery("#editor").bind("DOMSubtreeModified",function(){
        my_jQuery_conditions();
    });
    
}

my_jQuery_conditions = function() {
    
    // Check hash for trigger
    
    var url = window.location.href, expr = /hide_today/;
    if(!expr.test(url)) { return; }
    
    // Check if #agenda_view exists
    
    if( !jQuery('#agenda_view').length ) { return; }
    
    // Check if implementation indicator is set
    
    if( jQuery('.my_jQuery_changes_implemented').length ) {
        return;
    }
    
    // Implement changes
    
    jQuery("#agenda_view").addClass(
        'my_jQuery_changes_implemented'
    );
    my_jquery_changes();
    
}

my_jquery_changes = function() {
        
    // Remove empty search queries
    
    jQuery("div.section_day:not(:has(.task_item))").remove();
    
    // Remove add task
    
    jQuery("li.agenda_add_task").remove();
    
    // Show only first heading
    
    jQuery("h2.section_header").hide();
    jQuery("h2.section_header:eq(0)").show();
    
    // Remove margins
    
    //jQuery("div.section_day").css("margin","0px","important");
    //jQuery("ul.day_list").css("margin","0px","important");
        
}

// Load latest jQuery
    
javascript: (function(e, s) {
    e.src = s;
    e.onload = function() {
        jQuery.noConflict();
    };
    document.head.appendChild(e);
})(
    document.createElement('script'),
    '//code.jquery.com/jquery-latest.min.js'
)

// Static triggers

window.onhashchange = function() {
    my_jQuery_triggers();
    my_jQuery_conditions();
}

window.onload = function() {
    my_jQuery_triggers();
    my_jQuery_conditions();
}

Todoist: remove whitespace

Leave a Reply

Your email address will not be published. Required fields are marked *