Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nko/chaosscript
Browse files Browse the repository at this point in the history
  • Loading branch information
antifarben committed Aug 29, 2010
2 parents 7b66dd5 + 04880d3 commit a3cad24
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
9 changes: 4 additions & 5 deletions html.js
Expand Up @@ -91,8 +91,6 @@ module.exports = {
return fList; return fList;
}, },
filemenuFor: function( fileData ) { filemenuFor: function( fileData ) {
if (fileData['kind'] == 'unknown')
return '';
var M = module.exports; var M = module.exports;
var method = 'show'+fileData['kind']; var method = 'show'+fileData['kind'];
var r = ''; var r = '';
Expand All @@ -105,9 +103,10 @@ module.exports = {
else else
mime = ", 'video/divx'"; mime = ", 'video/divx'";
} }
r += M.tag('a',{href:'#', if (fileData.kind !== 'unknown')
onclick:'return '+method+"(this, '/"+escape(fileData['path'])+"'"+mime+");", r += M.tag('a',{href:'#',
'class':'viewmovie'},'View'); onclick:'return '+method+"(this, '/"+escape(fileData['path'])+"'"+mime+");",
'class':'viewmovie'},'View');
r += M.tag('a',{href:'/'+fileData['path']},'Download'); r += M.tag('a',{href:'/'+fileData['path']},'Download');
return M.tag('div', {'class':'filemenu'}, r); return M.tag('div', {'class':'filemenu'}, r);
} }
Expand Down
8 changes: 6 additions & 2 deletions mime.js
Expand Up @@ -15,8 +15,12 @@ var types = {
mp2: 'video/mpeg', mp2: 'video/mpeg',
avi: 'video/x-msvideo', avi: 'video/x-msvideo',
wmv: 'video/x-ms-wmv', wmv: 'video/x-ms-wmv',
wma: 'audio/x-ms-wma',
aac: 'audio/aac',
'3gp': 'audio/3gpp',
mov: 'video/quicktime', mov: 'video/quicktime',
mp4: 'video/mp4', mp4: 'video/mp4',
m4v: 'video/mp4',
mkv: 'video/x-matroska', mkv: 'video/x-matroska',
mks: 'video/x-matroska', mks: 'video/x-matroska',
mka: 'audio/x-matroska', mka: 'audio/x-matroska',
Expand All @@ -27,7 +31,7 @@ var types = {


module.exports = { module.exports = {
fileType: function(path) { fileType: function(path) {
var ext = path.split('/').pop().split('.').pop(); var ext = path.split('/').pop().split('.').pop();
return types[ext] || 'binary/octet-stream'; return types[ext] || 'binary/octet-stream';
} }
}; };
13 changes: 12 additions & 1 deletion model.js
Expand Up @@ -15,14 +15,25 @@ var FiletypeMapping = { mkv:'Video',
mov:'Video', mov:'Video',
mks:'Video', mks:'Video',
asf:'Video', asf:'Video',
svg:'Text', // iframe ;-)
nfo:'Text', nfo:'Text',
js:'Text', js:'Text',
css:'Text', css:'Text',
txt:'Text', txt:'Text',
jpg:'Image', jpg:'Image',
jpeg:'Image', jpeg:'Image',
bmp:'Image', bmp:'Image',
png:'Image'}; png:'Image',
ogg:'Audio',
mp3:'Audio',
wav:'Audio',
flac:'Audio',
wma:'Audio',
'3gp':'Audio',
aac:'Audio',
wma:'Audio',
flac:'Audio',
mka:'Audio'};
redis.select(1); redis.select(1);


module.exports = { module.exports = {
Expand Down
11 changes: 11 additions & 0 deletions public/js/application.js
Expand Up @@ -91,6 +91,17 @@ function showImage( ele, path ) {
} }




function showAudio( ele, path ) {
path = unescape(path);
return showPreview( ele, '<div class="preview"><audio controls><source src="'+path+'"></audio></div>' );
}

/*function showunknown( ele, path ) {
path = unescape(path);
return showPreview( ele, '<div class="preview"><input value="'+path+'" size="40" readonly></div>' );
}
*/

function showPreview( ele, content ) { function showPreview( ele, content ) {
$('.preview').remove(); $('.preview').remove();
if ($(ele).hasClass('active')) if ($(ele).hasClass('active'))
Expand Down
11 changes: 6 additions & 5 deletions public/main.css
Expand Up @@ -52,6 +52,7 @@ a img {
width:410px; width:410px;
padding: 25px; padding: 25px;
padding-top:20px; padding-top:20px;
margin-bottom: 2em;
border:17px solid #9BB0C9; border:17px solid #9BB0C9;
font-size:15pt; font-size:15pt;
border-radius: 18pt 18pt; border-radius: 18pt 18pt;
Expand Down Expand Up @@ -229,13 +230,13 @@ pre {
} }


ul.torrents { ul.torrents {
list-style-type: none; list-style-type: square;
list-style-image: url('/img/bitsuckr.png');
padding: 0; padding: 0;
padding-left: -16px; padding-left: -16px;
margin: 1em; margin: 1em;
margin-left: 2em;
} }
ul.torrents li:before { ul.torrents li a {
content: url('/img/bitsuckr.png'); padding: 0;
padding: 2px 1px;
margin-left: -16px;
} }
2 changes: 0 additions & 2 deletions web.js
Expand Up @@ -213,7 +213,6 @@ function app(app) {
webStats.root++; webStats.root++;
var torrentItemString = ''; var torrentItemString = '';
recommendations.forEach(function(r) { recommendations.forEach(function(r) {
console.log(r);
torrentItemString += Html.tag('li',[], Html.tag('a', {href:'/'+r.infoHex + '.html'},r.name)); torrentItemString += Html.tag('li',[], Html.tag('a', {href:'/'+r.infoHex + '.html'},r.name));
}); });
res.writeHead(200, {}); res.writeHead(200, {});
Expand All @@ -227,7 +226,6 @@ function app(app) {
res.end('Not found'); res.end('Not found');
} else if (fileinfo) { } else if (fileinfo) {
var files = Model.parseTreeByFiles(fileinfo.files, req.params.infoHex); var files = Model.parseTreeByFiles(fileinfo.files, req.params.infoHex);
console.log(files);
res.writeHead(200, {}); res.writeHead(200, {});
res.write(Html.show(files)); res.write(Html.show(files));
res.end(); res.end();
Expand Down

0 comments on commit a3cad24

Please sign in to comment.