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
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* File Object
* author: Anthony Dillon
*/
function File($id, $url, $type, $name, $size, $date ,$location){
if($name == undefined){ var tempName = _url.split('/'); $name = tempName[tempName.length-1].split('.')[0]; }
if($size == undefined){ $size = '11.5MB'; }
if($date == undefined){ $date = new Date().toString(); }
if ($location==undefined) { $location='/Home';}
if($type == undefined){$type = 'photo'; }
var _id = $id;
var _url = $url;
var _type = $type;
var _name = $name;
var _size = $size;
var _date = $date;
var _location = $location;
this.url = function(){ return _url; }
this.name = function(){ return _name; }
this.size = function(){ return _size; }
this.date = function(){ return _date; }
this.location = function(){ return _location; }
this.id = function(){ return _id; }
this.type = function(){ return _type; }
this.setURL = function($url){ _url = $url; }
this.setName = function($name){ _name = $name; }
this.setSize = function($size){ _size = $size; }
this.setDate = function($date){ _date = $date; }
this.setLocation = function($location){ _location = $location; }
this.setType = function($type){ _type = $type; }
this.drawIcon = function($id, $type){
switch(_type){
case 'photo':
if($type == 'display-icon'){
return '<div class="file '+$type+'" data-type="photo" data-id='+$id+'><p class="border"><img src="'+_url+'" width="53px" /></p><span>'+_name+'</span></div>';
}else{
return '<div class="file '+$type+'" data-type="photo" data-id='+$id+'><p></p><span>'+_name+'</span></div>';
}
break;
case 'video':
var tempName = _url.split('/');
tempName = tempName[tempName.length-1].split('.')[0];
if($type == 'display-icon'){
return '<div class="file '+$type+'" data-type="video" data-id='+$id+'><p class="border"><img src="../img/videos/'+tempName+'.jpg" width="53px" /></p><span>'+_name+'</span></div>';
}else{
return '<div class="file '+$type+'" data-type="video" data-id='+$id+'><p></p><span>'+_name+'</span></div>';
}
break;
case 'audio':
if($type == 'display-icon'){
return '<div class="file '+$type+'" data-type="audio" data-id='+$id+'><p><img src="../img/folder/audio.png" /></p><span>'+_name+'</span></div>';
}else{
return '<div class="file '+$type+'" data-type="audio" data-id='+$id+'><p></p><span>'+_name+'</span></div>';
}
break;
default:
if($type == 'display-icon'){
return '<div class="file '+$type+'" data-type="unknown" data-id='+$id+'><p><img src="../img/folder/unknown.png" /></p><span>'+_name+'</span></div>';
}else{
return '<div class="file '+$type+'" data-type="unknown" data-id='+$id+'><p></p><span>'+_name+'</span></div>';
}
break;
}
}
}
|