Skip to content

Commit 674bdd7

Browse files
committed
Adding dependencies in.
1 parent dfd52f0 commit 674bdd7

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,22 @@ user.orgRepos(orgname, function(err, repos) {
129129

130130
Github.js is automatically™ tested by the users of [Prose](http://prose.io). Because of that, we decided to save some time by not maintaining a test suite. Yes, you heard right. :) However, you can still consider it stable since it is used in production.
131131

132+
##Setup
133+
134+
Github.js has the following dependencies:
135+
136+
- jQuery (for ajax)
137+
- Underscore
138+
- Base64 (for basic auth). You can leave this if you are not using basic auth.
139+
140+
Include these before github.js :
141+
142+
```
143+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
144+
<script src="lib/underscore-min.js">
145+
<script src="lib/base64.js">
146+
<script src="github.js">
147+
```
132148

133149
## Change Log
134150

lib/base64.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// This code was written by Tyler Akins and has been placed in the
2+
// public domain. It would be nice if you left this header intact.
3+
// Base64 code from Tyler Akins -- http://rumkin.com
4+
5+
var Base64 = (function () {
6+
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
7+
8+
var obj = {
9+
/**
10+
* Encodes a string in base64
11+
* @param {String} input The string to encode in base64.
12+
*/
13+
encode: function (input) {
14+
var output = "";
15+
var chr1, chr2, chr3;
16+
var enc1, enc2, enc3, enc4;
17+
var i = 0;
18+
19+
do {
20+
chr1 = input.charCodeAt(i++);
21+
chr2 = input.charCodeAt(i++);
22+
chr3 = input.charCodeAt(i++);
23+
24+
enc1 = chr1 >> 2;
25+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
26+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
27+
enc4 = chr3 & 63;
28+
29+
if (isNaN(chr2)) {
30+
enc3 = enc4 = 64;
31+
} else if (isNaN(chr3)) {
32+
enc4 = 64;
33+
}
34+
35+
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
36+
keyStr.charAt(enc3) + keyStr.charAt(enc4);
37+
} while (i < input.length);
38+
39+
return output;
40+
},
41+
42+
/**
43+
* Decodes a base64 string.
44+
* @param {String} input The string to decode.
45+
*/
46+
decode: function (input) {
47+
var output = "";
48+
var chr1, chr2, chr3;
49+
var enc1, enc2, enc3, enc4;
50+
var i = 0;
51+
52+
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
53+
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
54+
55+
do {
56+
enc1 = keyStr.indexOf(input.charAt(i++));
57+
enc2 = keyStr.indexOf(input.charAt(i++));
58+
enc3 = keyStr.indexOf(input.charAt(i++));
59+
enc4 = keyStr.indexOf(input.charAt(i++));
60+
61+
chr1 = (enc1 << 2) | (enc2 >> 4);
62+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
63+
chr3 = ((enc3 & 3) << 6) | enc4;
64+
65+
output = output + String.fromCharCode(chr1);
66+
67+
if (enc3 != 64) {
68+
output = output + String.fromCharCode(chr2);
69+
}
70+
if (enc4 != 64) {
71+
output = output + String.fromCharCode(chr3);
72+
}
73+
} while (i < input.length);
74+
75+
return output;
76+
}
77+
};
78+
79+
return obj;
80+
})();
81+
82+
window.Base64 = Base64

lib/underscore-min.js

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)