forked from khrome/ascii-art
-
Notifications
You must be signed in to change notification settings - Fork 0
/
art-source-textfiles.js
58 lines (57 loc) · 1.92 KB
/
art-source-textfiles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(function (root, factory){
if(typeof define === 'function' && define.amd){
// AMD. Register as an anonymous module.
define(['browser-request', './art-source'], factory);
}else if (typeof module === 'object' && module.exports){
module.exports = factory(require('request'), require('./art-source'));
}else{
// Browser globals (root is window)
root.AsciiArtSource = factory(root.request, );
}
}(this, function(request, ArtSource){
ArtSource.define({
search : function(){},
list : function(){
},
fetch : function(path, file, callback){
//if(parts[1]){
var pre = '';
var post = '';
switch(path){
case 'NFOS':
post = 'asciiart/';
case 'asciiart':
pre = 'artscene.';
break;
case 'LOGOS':
case 'DECUS':
post = 'art/';
break;
case 'RAZOR':
case 'FAIRLIGHT':
case 'DREAMTEAM':
case 'HUMBLE':
case 'HYBRID':
case 'PRESTIGE':
case 'INC':
case 'TDUJAM':
case 'ANSI':
post = 'piracy/';
break;
//}
request(
'http://'+pre+'textfiles.com/'+post+path+'/'+file,
function(err, res, body){
var data = body ||
(
res && res.request &&
res.request.responseContent &&
res.request.responseContent.body
) || undefined;
callback(undefined, data);
}
);
}
},
})
}));