The Open Code Project

Reddit Ubiquity Command - Submit sites to Reddit

December 11th,2009 by Allan Bogh

This Ubiquity command submits webpages to Reddit with the title being the text you either select from the webpage or type in yourself.

Usage:

  • Browse to some cool article, image, video, or anything on the web.
  • Highlight some text for a title (not required)
  • Open Ubiquity (ctrl-space by default)
  • Type "reddit this" if you've highlighted some text or type "reddit This is my title!" if "This is my title!" is supposed to be your title.
  • Press Enter

Ubiquity will open a new tab and your submission will be sent to Reddit's submit page, you will need to login first. You can fill out the rest of the information on that page.

Todo:

  • Add subreddit options
  • Preview?
Installation:

Installable command location: http://gist.github.com/248882 (you don't need to do the steps below)

Hack-it method:
  • Open Ubiquity (ctrl-space)
  • Type "edit ubiquity commands" and press Enter
  • Paste in the code below to your command editor
After you've pasted the code you can immediately use it.

CmdUtils.CreateCommand({
  names: ["reddit"],
  icon: "http://reddit.com/static/favicon.ico",
  homepage: "http://www.opencodeproject.com",
  arguments: [
    {role: "object", nountype: noun_arb_text}],
  description: "Submits the page to reddit.",
  author: { name: "Allan Bogh", email: "ajbogh@allanbogh.com"},
  license: "MPL,GPL",
  preview: function reddit_preview(pblock, {object: {html}}) {
      pblock.innerHTML = "Submits \""+html+"\" to reddit.";
  },
  execute: function({object: {html}}) {
    var win = CmdUtils.getWindow();
    var src = CmdUtils.getSelection();  


    Utils.openUrlInBrowser("http://reddit.com/submit" +
                           Utils.paramsToString({
                             url: win.location.href,
                             title: src
                           }));
    
  }
});

Git clone URL: git clone git://github.com/ajbogh/Reddit-Ubiquity-Command.git

Comments (0)


:

:

:


: formatting help
Close

Formatting instructions:

You can use <a> tags but everything else will be stripped and your comment will look funny.

I swear, don't use html except the <a> tag or else some random star will supernova. Remember, we have a star right next to us, so don't try it.

This isn't bbcode either so don't use it. That is all.