var DetailsWindow = {
visible: false,
toggle: function () {
if (this.visible) {
$("#info_popup").fadeOut(500);
$("#btnDetails").removeClass("button_highlight");
this.visible = false;
} else {
$("#info_popup").fadeIn(500);
$("#btnDetails").addClass("button_highlight");
this.visible = true;
}
},
setDetails: function (file) {
if (Viewer.isList) {
// Lists give incomplete file information, so we have to request
// more details in the background. File descriptions only exist in
// lists, so for that we use the data provided in the page source
$.ajax({
dataType: "json",
url: apiEndpoint + "/file/" + file.id + "/info",
success: function(data){
$("#info_file_details").html(
"
"
+ "Name | | " + escapeHTML(data.name) + " |
"
+ "Url | | /u/" + data.id + " |
"
+ "Mime Type | | " + escapeHTML(data.mime_type) + " |
"
+ "Id | | " + data.id + " |
"
+ "Size | | " + data.size + " |
"
+ "Upload Date | | " + data.date_upload + " |
"
+ "Description | | " + escapeHTML(file.description) + " |
"
+ "
"
);
}
});
} else {
$("#info_file_details").html(
""
+ "Name | | " + escapeHTML(file.name) + " |
"
+ "Mime Type | | " + escapeHTML(file.mime_type) + " |
"
+ "Id | | " + file.id + " |
"
+ "Size | | " + file.size + " |
"
+ "Upload Date | | " + file.date_upload + " |
"
+ "
"
);
}
}
};