From 64f1957ec90a353b6ad88ee647de8013c8bd6b8f Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Thu, 9 Oct 2008 00:31:02 +0200 Subject: [PATCH] Gistie: Create private gists by default We can make this optional once the PrefPane is in --- html/commit.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/html/commit.js b/html/commit.js index f2d80ba..1ed2058 100644 --- a/html/commit.js +++ b/html/commit.js @@ -51,17 +51,22 @@ var notify = function(text, busy) { var gistie = function() { notify("Uploading code to Gistie..", true); - + parameters = { + "file_ext[gistfile1]": "patch", + "file_name[gistfile1]": commit.object.subject.replace(/[^a-zA-Z0-9]/g, "-") + ".patch", + "file_contents[gistfile1]": commit.object.patch(), + }; + + // TODO: Replace true with private preference + if (true) + parameters.private = true; + new Ajax.Request("http://gist.github.com/gists", { method: 'post', - parameters: { - "file_ext[gistfile1]": "patch", - "file_name[gistfile1]": commit.object.subject.replace(/[^a-zA-Z0-9]/g, "-") + ".patch", - "file_contents[gistfile1]": commit.object.patch() - }, + parameters: parameters, onSuccess: function(t) { - if (m = t.responseText.match(/gist: (\d+)/)) + if (m = t.responseText.match(/gist: ([a-f0-9]+)/)) notify("Code uploaded to gistie #" + m[1] + ""); else notify("Pasting to Gistie failed.");