Fix creating Gists

GitHub changed their site to use SSL.

On error GitHub may return the "All Gists" page which will have several "gist: #", so check for the edit link instead.
This commit is contained in:
Nathan Kinsinger
2010-11-16 20:17:48 -07:00
parent b41da9e23e
commit 9dd29f6048
+2 -2
View File
@@ -107,7 +107,7 @@ var gistie = function() {
var t = new XMLHttpRequest();
t.onreadystatechange = function() {
if (t.readyState == 4 && t.status >= 200 && t.status < 300) {
if (m = t.responseText.match(/gist: ([a-f0-9]+)/))
if (m = t.responseText.match(/<a href="\/gists\/([a-f0-9]+)\/edit">/))
notify("Code uploaded to gistie <a target='_new' href='http://gist.github.com/" + m[1] + "'>#" + m[1] + "</a>", 1);
else {
notify("Pasting to Gistie failed :(.", -1);
@@ -116,7 +116,7 @@ var gistie = function() {
}
}
t.open('POST', "http://gist.github.com/gists");
t.open('POST', "https://gist.github.com/gists");
t.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
t.setRequestHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
t.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=UTF-8');