Skip to content

Commit 7d15999

Browse files
committed
Merge pull request #7 from wellthie/master
Updated to 2.0.3
2 parents c1f3429 + 023be4c commit 7d15999

File tree

18 files changed

+8431
-5034
lines changed

18 files changed

+8431
-5034
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ spec/reports
1515
test/tmp
1616
test/version_tmp
1717
tmp
18-
.idea
18+
.idea
19+
.project
824 Bytes
Loading
980 Bytes
Loading

app/assets/javascripts/grape_swagger_rails/application.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
1111
// GO AFTER THE REQUIRES BELOW.
1212
//
13-
//= require grape_swagger_rails/jquery-1.8.0.min.js
14-
//= require grape_swagger_rails/jquery.slideto.min.js
15-
//= require grape_swagger_rails/jquery.wiggle.min.js
16-
//= require grape_swagger_rails/jquery.ba-bbq.min.js
17-
//= require grape_swagger_rails/handlebars-1.0.rc.1.js
18-
//= require grape_swagger_rails/underscore-min.js
19-
//= require grape_swagger_rails/backbone-min.js
20-
//= require grape_swagger_rails/swagger.js
21-
//= require grape_swagger_rails/swagger-ui.js
22-
//= require grape_swagger_rails/highlight.7.3.pack.js
13+
//= require ./shred.bundle
14+
//= require ./jquery-1.8.0.min
15+
//= require ./jquery.slideto.min
16+
//= require ./jquery.wiggle.min
17+
//= require ./jquery.ba-bbq.min
18+
//= require ./handlebars-1.0.0
19+
//= require ./underscore-min
20+
//= require ./backbone-min
21+
//= require ./swagger
22+
//= require ./swagger-ui
23+
//= require ./highlight.7.3.pack
24+
//= require ./base64
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/**
2+
*
3+
* Base64 encode / decode
4+
* http://www.webtoolkit.info/
5+
*
6+
**/
7+
var Base64 = {
8+
9+
// private property
10+
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
11+
12+
// public method for encoding
13+
encode : function(input) {
14+
var output = "";
15+
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
16+
var i = 0;
17+
18+
input = Base64._utf8_encode(input);
19+
20+
while (i < input.length) {
21+
22+
chr1 = input.charCodeAt(i++);
23+
chr2 = input.charCodeAt(i++);
24+
chr3 = input.charCodeAt(i++);
25+
26+
enc1 = chr1 >> 2;
27+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
28+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
29+
enc4 = chr3 & 63;
30+
31+
if (isNaN(chr2)) {
32+
enc3 = enc4 = 64;
33+
} else if (isNaN(chr3)) {
34+
enc4 = 64;
35+
}
36+
37+
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
38+
39+
}
40+
41+
return output;
42+
},
43+
44+
// public method for decoding
45+
decode : function(input) {
46+
var output = "";
47+
var chr1, chr2, chr3;
48+
var enc1, enc2, enc3, enc4;
49+
var i = 0;
50+
51+
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
52+
53+
while (i < input.length) {
54+
55+
enc1 = this._keyStr.indexOf(input.charAt(i++));
56+
enc2 = this._keyStr.indexOf(input.charAt(i++));
57+
enc3 = this._keyStr.indexOf(input.charAt(i++));
58+
enc4 = this._keyStr.indexOf(input.charAt(i++));
59+
60+
chr1 = (enc1 << 2) | (enc2 >> 4);
61+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
62+
chr3 = ((enc3 & 3) << 6) | enc4;
63+
64+
output = output + String.fromCharCode(chr1);
65+
66+
if (enc3 != 64) {
67+
output = output + String.fromCharCode(chr2);
68+
}
69+
if (enc4 != 64) {
70+
output = output + String.fromCharCode(chr3);
71+
}
72+
73+
}
74+
75+
output = Base64._utf8_decode(output);
76+
77+
return output;
78+
79+
},
80+
81+
// private method for UTF-8 encoding
82+
_utf8_encode : function(string) {
83+
string = string.replace(/\r\n/g, "\n");
84+
var utftext = "";
85+
86+
for (var n = 0; n < string.length; n++) {
87+
88+
var c = string.charCodeAt(n);
89+
90+
if (c < 128) {
91+
utftext += String.fromCharCode(c);
92+
} else if ((c > 127) && (c < 2048)) {
93+
utftext += String.fromCharCode((c >> 6) | 192);
94+
utftext += String.fromCharCode((c & 63) | 128);
95+
} else {
96+
utftext += String.fromCharCode((c >> 12) | 224);
97+
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
98+
utftext += String.fromCharCode((c & 63) | 128);
99+
}
100+
101+
}
102+
103+
return utftext;
104+
},
105+
106+
// private method for UTF-8 decoding
107+
_utf8_decode : function(utftext) {
108+
var string = "";
109+
var i = 0;
110+
var c = c1 = c2 = 0;
111+
112+
while (i < utftext.length) {
113+
114+
c = utftext.charCodeAt(i);
115+
116+
if (c < 128) {
117+
string += String.fromCharCode(c);
118+
i++;
119+
} else if ((c > 191) && (c < 224)) {
120+
c2 = utftext.charCodeAt(i + 1);
121+
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
122+
i += 2;
123+
} else {
124+
c2 = utftext.charCodeAt(i + 1);
125+
c3 = utftext.charCodeAt(i + 2);
126+
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
127+
i += 3;
128+
}
129+
130+
}
131+
132+
return string;
133+
}
134+
};

0 commit comments

Comments
 (0)