kud
11/3/2014 - 3:17 PM

A bookmarklet for Todoist to add a website to your read later project.

A bookmarklet for Todoist to add a website to your read later project.

javascript: (function() {

  var loadJSONP = (function(){
    var unique = 0
    
    return function(url, callback, context) {

      var name = "_jsonp_" + unique++
      
      if (url.match(/\?/)) url += "&callback="+name
      else url += "?callback="+name
      
      var script = document.createElement('script')
      script.type = 'text/javascript'
      script.src = url
      
      window[name] = function(data){
        callback.call((context || window), data)
        document.getElementsByTagName('head')[0].removeChild(script)
        script = null
        delete window[name]
      }
      
      document.getElementsByTagName('head')[0].appendChild(script)
    };
  })()


  var title = document.title
  var url = document.location.href

  var string = title + ' (' + url + ')'
  var encodedString = encodeURIComponent( string )

  var token = 'YOUR_TOKEN'
  var project_id = 'YOUR_PROJECT_ID'

  var todoistUrl = 'https://api.todoist.com/API/addItem?priority=1&content=' + encodedString + '&token=' + token + '&project_id=' + project_id

  loadJSONP(todoistUrl, function() { console.log('Added!') })
})()
javascript:(function(){var e=function(){var e=0;return function(t,n,r){var i="_jsonp_"+e++;if(t.match(/\?/))t+="&callback="+i;else t+="?callback="+i;var s=document.createElement("script");s.type="text/javascript";s.src=t;window[i]=function(e){n.call(r||window,e);document.getElementsByTagName("head")[0].removeChild(s);s=null;delete window[i]};document.getElementsByTagName("head")[0].appendChild(s)}}();var t=document.title;var n=document.location.href;var r=t+" ("+n+")";var i=encodeURIComponent(r);var s="YOUR_TOKEN";var o="YOUR_PROJECT_ID";var u="https://api.todoist.com/API/addItem?priority=1&content="+i+"&token="+s+"&project_id="+o;e(u,function(){console.log("Added!")})})()

One-click "read later" bookmarklet for Todoist

Installation

  • Copy/paste todoist-read-later-one-click.js content in a bookmark.
  • Specify your token (Settings > Todoist Settings > Account > Go to the bottom of the page)
  • Specify your project_id (no project_id means Inbox, if not, go to Task actions > Email tasks to this project, read the url of the popup https://:browser.todoist.com/Emails/view?project_id=:id, take the id there)
  • Profit!

Usage

Just click on your bookmarklet when you want to save a webpage link.

Warning

Doesn't work on certain https websites because of CSP like GitHub.