Skip to content

Commit

Permalink
Merge branch 'master' of github.com:michael/github
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Dec 11, 2014
2 parents a4458fb + b2e088b commit f9f5d86
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 98 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
_site/*
.DS_Store

test/.DS_Store
node_modules/
node_modules/
npm-debug.log
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,12 @@ Github.js is automatically™ tested by the users of [Prose](http://prose.io). B
Github.js has the following dependencies:

- Underscore
- Base64 (for basic auth). You can leave this if you are not using basic auth.
- btoa (included in modern browsers, an npm module is included in package.json for node)

Include these before github.js :

```
<script src="lib/underscore-min.js">
<script src="lib/base64.js">
<script src="github.js">
```

Expand Down
9 changes: 4 additions & 5 deletions github.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
// Initial Setup
// -------------

var XMLHttpRequest, Base64, _;
var XMLHttpRequest, _;
if (typeof exports !== 'undefined') {
XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
_ = require('underscore');
Base64 = require('./lib/base64.js');
}else{
btoa = require('btoa');
} else {
_ = window._;
Base64 = window.Base64;
}
//prefer native XMLHttpRequest always
if (typeof window !== 'undefined' && typeof window.XMLHttpRequest !== 'undefined'){
Expand Down Expand Up @@ -63,7 +62,7 @@
xhr.setRequestHeader('Accept','application/vnd.github.v3.raw+json');
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8');
if ((options.token) || (options.username && options.password)) {
var authorization = options.token ? 'token ' + options.token : 'Basic ' + Base64.encode(options.username + ':' + options.password);
var authorization = options.token ? 'token ' + options.token : 'Basic ' + btoa(options.username + ':' + options.password);
xhr.setRequestHeader('Authorization', authorization);
}
if (data)
Expand Down
87 changes: 0 additions & 87 deletions lib/base64.js

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "A higher-level wrapper around the Github API.",
"main": "github.js",
"dependencies": {
"btoa": "^1.1.2",
"tape": "^3.0.3",
"underscore": "~1.6.0",
"xmlhttprequest": "~1.6.0"
Expand Down

0 comments on commit f9f5d86

Please sign in to comment.