Skip to content

Instantly share code, notes, and snippets.

@ajbogh
Created December 4, 2009 07:06
Show Gist options
  • Save ajbogh/248882 to your computer and use it in GitHub Desktop.
Save ajbogh/248882 to your computer and use it in GitHub Desktop.
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
}));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment